From bca19663d94215c0cc847a36ab0431834b4d74a4 Mon Sep 17 00:00:00 2001 From: Krystian Date: Mon, 2 Dec 2024 15:33:20 +0100 Subject: [PATCH] manufacturers --- package.json | 2 +- src/components/modules/manufacturers/Form.vue | 134 ++++++++++++ .../products/view/ProductBasicDetails.vue | 38 +++- src/consts/featureFlags.ts | 2 + src/consts/menuItems.ts | 10 + src/locales/en.json | 3 +- src/locales/pl.json | 3 +- src/router.ts | 19 ++ src/store/index.ts | 2 + src/store/manufacturers.ts | 19 ++ src/views/manufacturers/index.vue | 154 ++++++++++++++ src/views/manufacturers/view.vue | 200 ++++++++++++++++++ yarn.lock | 8 +- 13 files changed, 584 insertions(+), 10 deletions(-) create mode 100644 src/components/modules/manufacturers/Form.vue create mode 100644 src/store/manufacturers.ts create mode 100644 src/views/manufacturers/index.vue create mode 100644 src/views/manufacturers/view.vue diff --git a/package.json b/package.json index d55f42a5..fc4bdceb 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "postinstall": "patch-package" }, "dependencies": { - "@heseya/store-core": "7.1.0-beta.2", + "@heseya/store-core": "7.1.0-beta.3", "@sentry/tracing": "^7.6.0", "@sentry/vue": "^7.6.0", "ant-design-vue": "^1.7.8", diff --git a/src/components/modules/manufacturers/Form.vue b/src/components/modules/manufacturers/Form.vue new file mode 100644 index 00000000..2bad1980 --- /dev/null +++ b/src/components/modules/manufacturers/Form.vue @@ -0,0 +1,134 @@ + + +{ + "pl": { + "name": "Nazwa", + "email": "Email", + "lastName": "Nazwisko", + "firstName": "Imię", + "products": "Produkty", + "manufactureAddress": "Adres Producenta", + "relatedProducts": "Produkty powiązane" + }, + "en": { + "name": "Name", + "email": "Email", + "lastName": "Last Name", + "firstName": "First Name", + "products": "Products", + "manufactureAddress": "Manufacture address", + "relatedProducts": "Related products" + } +} + + + diff --git a/src/components/modules/products/view/ProductBasicDetails.vue b/src/components/modules/products/view/ProductBasicDetails.vue index 55195130..06d0c698 100644 --- a/src/components/modules/products/view/ProductBasicDetails.vue +++ b/src/components/modules/products/view/ProductBasicDetails.vue @@ -31,6 +31,27 @@ :label="$t('form.shortDescription').toString()" :disabled="disabled" /> + + + + @@ -39,13 +60,17 @@ "pl": { "form": { "vatRate": "Stawka VAT (%)", - "shortDescription": "Krótki opis" + "shortDescription": "Krótki opis", + "safetyInformation": "informacje dotyczące bezpieczeństwa", + "manufacturer": "Producent" } }, "en": { "form": { "vatRate": "VAT rate (%)", - "shortDescription": "Short description" + "shortDescription": "Short description", + "safetyInformation": "Safety information", + "manufacturer": "Manufacturer" } } } @@ -60,11 +85,18 @@ import ProductSetSelect from '../ProductSetSelect.vue' import Textarea from '@/components/form/Textarea.vue' import TagsSelect from '@/components/TagsSelect.vue' import CurrencyPriceForm from '@/components/CurrencyPriceForm.vue' +import AutocompleteInput from '@/components/AutocompleteInput.vue' import { generateSlug } from '@/utils/generateSlug' export default defineComponent({ - components: { ProductSetSelect, AppTextarea: Textarea, TagsSelect, CurrencyPriceForm }, + components: { + ProductSetSelect, + AppTextarea: Textarea, + TagsSelect, + CurrencyPriceForm, + AutocompleteInput, + }, props: { value: { type: Object as PropType, diff --git a/src/consts/featureFlags.ts b/src/consts/featureFlags.ts index a36b6068..8cdb5e82 100644 --- a/src/consts/featureFlags.ts +++ b/src/consts/featureFlags.ts @@ -21,6 +21,8 @@ export const FEATURE_FLAGS = { * If true, product images on every list will be shown as object-fit: contain, otherwise they will be shown as object-fit: cover */ ProductContain: 'dashboard_products_contain', + + manufacturers: 'Manufacturers_enabled', } export const SETTINGS_KEYS = { diff --git a/src/consts/menuItems.ts b/src/consts/menuItems.ts index 3cb30cd1..0cb7f52e 100644 --- a/src/consts/menuItems.ts +++ b/src/consts/menuItems.ts @@ -75,6 +75,16 @@ export const MENU_ITEMS: MenuItem[] = [ can: PERMISSIONS_TREE.Pages.Show, section: SettingsSection.Shop, }, + { + id: nextId(), + type: MenuItemType.Link, + to: '/manufacturers', + iconClass: 'bx bxs-bot', + label: 'models.manufacturers', + can: PERMISSIONS_TREE.Webhooks.Show, + hidden: () => accessor.config.env[FEATURE_FLAGS.manufacturers] !== '1', + section: SettingsSection.Shop, + }, { id: nextId(), type: MenuItemType.Link, diff --git a/src/locales/en.json b/src/locales/en.json index 443a774c..65250d2d 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -77,7 +77,8 @@ "attributes": "Attributes", "media": "Media", "currencies": "Currencies", - "salesChannels": "Sales channels" + "salesChannels": "Sales channels", + "manufacturers": "Manufacturers" }, "attributeTypes": { "single-option": "Text single choice", diff --git a/src/locales/pl.json b/src/locales/pl.json index 6271c9b9..4a0e23ed 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -77,7 +77,8 @@ "attributes": "Atrybuty", "media": "Media", "currencies": "Waluty", - "salesChannels": "Kanały sprzedaży" + "salesChannels": "Kanały sprzedaży", + "manufacturers": "Producenci" }, "attributeTypes": { "single-option": "Tekstowy jednokrotnego wyboru", diff --git a/src/router.ts b/src/router.ts index 684965a7..c950cb4c 100644 --- a/src/router.ts +++ b/src/router.ts @@ -209,6 +209,25 @@ const router = new VueRouter({ permissions: [Permissions.Pages.ShowDetails], }, }, + { + path: '/manufacturers', + name: 'Manufacturers', + component: () => import('./views/manufacturers/index.vue'), + meta: { + requiresAuth: true, + permissions: [Permissions.Manufacturers.Show], + }, + }, + { + path: '/manufacturers/:id', + name: 'ManufacturersView', + component: () => import('./views/manufacturers/view.vue'), + meta: { + returnUrl: '/manufacturers', + requiresAuth: true, + permissions: [Permissions.Manufacturers.ShowDetails], + }, + }, { path: '/settings/banners', name: 'Banners', diff --git a/src/store/index.ts b/src/store/index.ts index 0e31c45e..e7adf168 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -35,6 +35,7 @@ import { menuItems } from './menuItems' import { providers } from './providers' import { salesChannels } from './salesChannels' import { redirects } from './redirects' +import { manufacturers } from './manufacturers' Vue.use(Vuex) @@ -96,6 +97,7 @@ const storeModules = { salesChannels, menuItems, redirects, + manufacturers, } const storePattern = { diff --git a/src/store/manufacturers.ts b/src/store/manufacturers.ts new file mode 100644 index 00000000..6759ba33 --- /dev/null +++ b/src/store/manufacturers.ts @@ -0,0 +1,19 @@ +import { Manufacturer, ManufacturerDto } from '@heseya/store-core' +import { GLOBAL_QUERY_PARAMS, createVuexCRUD } from './generator' + +export const manufacturers = createVuexCRUD()( + 'manufacturers', + { + state: {}, + getters: {}, + mutations: {}, + actions: {}, + }, + { + get: { lang_fallback: 'any' }, + getOne: GLOBAL_QUERY_PARAMS, + add: GLOBAL_QUERY_PARAMS, + edit: GLOBAL_QUERY_PARAMS, + update: GLOBAL_QUERY_PARAMS, + }, +) diff --git a/src/views/manufacturers/index.vue b/src/views/manufacturers/index.vue new file mode 100644 index 00000000..c825586a --- /dev/null +++ b/src/views/manufacturers/index.vue @@ -0,0 +1,154 @@ + + + +{ + "pl": { + "title": "Producenci", + "add": "Dodaj producenta", + "table": { + "firstName": "Imię", + "lastName": "Nazwisko", + "email": "Email", + "address": "Adres", + "active": "Aktywny" + } + }, + "en": { + "title": "Manufacturers", + "add": "Add manufacture", + "table": { + "firstName": "First name", + "lastName": "Last name", + "email": "Email", + "address": "Address", + "active": "Active" + } + } +} + + + diff --git a/src/views/manufacturers/view.vue b/src/views/manufacturers/view.vue new file mode 100644 index 00000000..d14e401e --- /dev/null +++ b/src/views/manufacturers/view.vue @@ -0,0 +1,200 @@ + + + +{ + "en": { + "newTitle": "New manufacture", + "deleteText": "Are you sure, you want to delete this manufacture?", + "alerts": { + "deleted": "Manufacture has been deleted", + "created": "Manufacture has been created", + "updated": "Manufacture has been updated" + }, + "formCode": "Code" + }, + "pl": { + "newTitle": "Nowy Producent", + "deleteText": "Jesteś pewien, że chcesz usunąć tego producenta?", + "alerts": { + "deleted": "Producent został usunięty", + "created": "Producent został utworzony", + "updated": "Producent został zaktualizowany" + }, + "formCode": "Kod" + } +} + + + + + diff --git a/yarn.lock b/yarn.lock index 173f8907..7defb5f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1224,10 +1224,10 @@ dependencies: "@hapi/hoek" "^9.0.0" -"@heseya/store-core@7.1.0-beta.2": - version "7.1.0-beta.2" - resolved "https://registry.yarnpkg.com/@heseya/store-core/-/store-core-7.1.0-beta.2.tgz#fe75d681f5f3c7d5fa4b5037d2122117b738f8fb" - integrity sha512-a7lmTvOWPh1g7+Bq3Fv3szlJ6RaycR9co89Sh0Ydevg8NydCN9haLTlEltkKhPvkFlHdNa8DbsuqZfa19IqaEw== +"@heseya/store-core@7.1.0-beta.3": + version "7.1.0-beta.3" + resolved "https://registry.yarnpkg.com/@heseya/store-core/-/store-core-7.1.0-beta.3.tgz#25aa447242ee5b8cc91cbe97a80ac09f130671e3" + integrity sha512-J7loGuyVig0aFmFy2M6s65pwmsHAJUVdPThRxNS31izFHBcZySkWFROeWTUzr7qn2bTFMAK4GdRrd7WJEyEzUg== dependencies: flat "^5.0.2" form-data "^4.0.0"