diff --git a/app/model/product.go b/app/model/product.go index eb63f68..3c8faae 100644 --- a/app/model/product.go +++ b/app/model/product.go @@ -82,18 +82,27 @@ type ProductFilters struct { } type ScannedCategory struct { - CategoryID uint `gorm:"column:ID;primaryKey"` - Name string `gorm:"column:name"` - Active uint `gorm:"column:active"` - Position uint `gorm:"column:position"` - ParentID uint `gorm:"column:id_parent"` - IsRoot uint `gorm:"column:is_root_category"` + CategoryID uint `gorm:"column:ID;primaryKey"` + Name string `gorm:"column:name"` + Active uint `gorm:"column:active"` + Position uint `gorm:"column:position"` + ParentID uint `gorm:"column:id_parent"` + IsRoot uint `gorm:"column:is_root_category"` + LinkRewrite string `gorm:"column:link_rewrite"` + IsoCode string `gorm:"column:iso_code"` } type Category struct { - CategoryID uint `json:"category_id" form:"category_id"` - Name string `json:"name" form:"name"` - Active uint `json:"active" form:"active"` - Subcategories []Category `json:"subcategories" form:"subcategories"` + CategoryID uint `json:"category_id" form:"category_id"` + Label string `json:"label" form:"label"` + // Active bool `json:"active" form:"active"` + Params CategpryParams `json:"params" form:"params"` + Children []Category `json:"children" form:"children"` +} + +type CategpryParams struct { + CategoryID uint `json:"category_id" form:"category_id"` + LinkRewrite string `json:"link_rewrite" form:"link_rewrite"` + Locale string `json:"locale" form:"locale"` } type FeatVal = map[uint][]uint diff --git a/app/repos/categoriesRepo/categoriesRepo.go b/app/repos/categoriesRepo/categoriesRepo.go index 1713441..1556f59 100644 --- a/app/repos/categoriesRepo/categoriesRepo.go +++ b/app/repos/categoriesRepo/categoriesRepo.go @@ -26,15 +26,14 @@ func (repo *CategoriesRepo) GetAllCategories(id_lang uint) ([]model.ScannedCateg ps_category.active AS active, ps_category_shop.position AS position, ps_category.id_parent AS id_parent, - ps_category.is_root_category AS is_root_category + ps_category.is_root_category AS is_root_category, + ps_category_lang.link_rewrite AS link_rewrite, + ps_lang.iso_code AS iso_code FROM ps_category - LEFT JOIN ps_category_lang - ON ps_category_lang.id_category = ps_category.id_category - AND ps_category_lang.id_shop = ? - AND ps_category_lang.id_lang = ? - LEFT JOIN ps_category_shop - ON ps_category_shop.id_category = ps_category.id_category - AND ps_category_shop.id_shop = ?`, + LEFT JOIN ps_category_lang ON ps_category_lang.id_category = ps_category.id_category AND ps_category_lang.id_shop = ? AND ps_category_lang.id_lang = ? + LEFT JOIN ps_category_shop ON ps_category_shop.id_category = ps_category.id_category AND ps_category_shop.id_shop = ? + JOIN ps_lang ON ps_lang.id_lang = ps_category_lang.id_lang + `, constdata.SHOP_ID, id_lang, constdata.SHOP_ID). Scan(&allCategories).Error diff --git a/app/service/menuService/menuService.go b/app/service/menuService/menuService.go index 13a6a89..1244075 100644 --- a/app/service/menuService/menuService.go +++ b/app/service/menuService/menuService.go @@ -64,7 +64,7 @@ func (s *MenuService) createTree(index int, all_categories *([]model.ScannedCate node := s.scannedToNormalCategory((*all_categories)[index]) for i := 0; i < len((*children_indices)[index]); i++ { - node.Subcategories = append(node.Subcategories, s.createTree((*children_indices)[index][i].Index, all_categories, children_indices)) + node.Children = append(node.Children, s.createTree((*children_indices)[index][i].Index, all_categories, children_indices)) } return node @@ -72,10 +72,12 @@ func (s *MenuService) createTree(index int, all_categories *([]model.ScannedCate func (s *MenuService) scannedToNormalCategory(scanned model.ScannedCategory) model.Category { var normal model.Category - normal.Active = scanned.Active + // normal.Active = scanned.Active normal.CategoryID = scanned.CategoryID - normal.Name = scanned.Name - normal.Subcategories = []model.Category{} + normal.Label = scanned.Name + // normal.Active = scanned.Active == 1 + normal.Params = model.CategpryParams{CategoryID: normal.CategoryID, LinkRewrite: scanned.LinkRewrite, Locale: scanned.IsoCode} + normal.Children = []model.Category{} return normal } diff --git a/bo/components.d.ts b/bo/components.d.ts index 622aa17..3425316 100644 --- a/bo/components.d.ts +++ b/bo/components.d.ts @@ -41,6 +41,7 @@ declare module 'vue' { UInput: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Input.vue')['default'] UInputNumber: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/InputNumber.vue')['default'] UModal: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Modal.vue')['default'] + UNavigationMenu: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/NavigationMenu.vue')['default'] UPagination: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Pagination.vue')['default'] USelect: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Select.vue')['default'] USelectMenu: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/SelectMenu.vue')['default'] diff --git a/bo/src/layouts/default.vue b/bo/src/layouts/default.vue index 1e86a0a..9f19d9e 100644 --- a/bo/src/layouts/default.vue +++ b/bo/src/layouts/default.vue @@ -1,14 +1,56 @@ diff --git a/bo/src/layouts/empty.vue b/bo/src/layouts/empty.vue index e8cfec0..e665e66 100644 --- a/bo/src/layouts/empty.vue +++ b/bo/src/layouts/empty.vue @@ -1,7 +1,7 @@ \ No newline at end of file diff --git a/bo/src/views/LoginView.vue b/bo/src/views/LoginView.vue index 20cec7b..f85d2c3 100644 --- a/bo/src/views/LoginView.vue +++ b/bo/src/views/LoginView.vue @@ -4,8 +4,8 @@ import { useRouter, useRoute } from 'vue-router' import { useAuthStore } from '@/stores/auth' import { useValidation } from '@/composable/useValidation' import type { FormError } from '@nuxt/ui' -import { useI18n } from 'vue-i18n' import { i18n } from '@/plugins/02_i18n' +import Empty from '@/layouts/empty.vue' const router = useRouter() const route = useRoute() @@ -52,9 +52,11 @@ const PrivacyComponent = computed(() => import(`@/components/terms/${i18n.locale.value}_PrivacyPolicyView.vue`).catch(() => import('@/components/terms/en_PrivacyPolicyView.vue')), ), ) +