diff --git a/bo/src/components/admin/PageProducts.vue b/bo/src/components/admin/PageProducts.vue index 3ae8e8d..46cb4ae 100644 --- a/bo/src/components/admin/PageProducts.vue +++ b/bo/src/components/admin/PageProducts.vue @@ -345,30 +345,6 @@ const columns: TableColumn[] = [ }, cell: ({ row }) => row.getValue('quantity') as number }, - { - accessorKey: 'count', - header: 'Count', - cell: ({ row }) => { - return h(UInputNumber, { - modelValue: selectedCount.value.product_id === row.original.product_id ? selectedCount.value.count : 0, - 'onUpdate:modelValue': (val: number) => { - if (val) - selectedCount.value = { - product_id: row.original.product_id, - count: val - } - else { - selectedCount.value = { - product_id: null, - count: 0 - } - } - }, - min: 0, - max: row.original.quantity - }) - } - }, { accessorKey: 'count', header: '', @@ -377,10 +353,9 @@ const columns: TableColumn[] = [ onClick: () => { console.log('Clicked', row.original) }, - color: selectedCount.value.product_id !== row.original.product_id ? 'info' : 'primary', - disabled: selectedCount.value.product_id !== row.original.product_id, + color: 'primary', variant: 'solid' - }, 'Add to cart') + }, 'Show product') }, } ] diff --git a/bo/src/router/menu.ts b/bo/src/router/menu.ts index 00713e8..e6c6d40 100644 --- a/bo/src/router/menu.ts +++ b/bo/src/router/menu.ts @@ -1,8 +1,16 @@ import { useFetchJson } from "@/composable/useFetchJson"; import type { MenuItem, Route } from "@/types/menu"; +import { ref } from "vue"; +import { settings } from "./settings"; + + +const categoryId = ref() export const getMenu = async () => { - const resp = await useFetchJson('/api/v1/restricted/menu/get-category-tree'); + if(!categoryId.value){ + categoryId.value = settings['app'].category_tree_root_id + } + const resp = await useFetchJson(`/api/v1/restricted/menu/get-category-tree?root_category_id=${categoryId.value}`); return resp.items.children } diff --git a/bo/src/router/settings.ts b/bo/src/router/settings.ts index 2e3b3b2..af068d7 100644 --- a/bo/src/router/settings.ts +++ b/bo/src/router/settings.ts @@ -8,4 +8,6 @@ export const settings = reactive({} as Settings) export async function getSettings() { const { items } = await useFetchJson>('/api/v1/settings',) Object.assign(settings, items) + + console.log(settings['app']) } diff --git a/bo/src/types/settings.d.ts b/bo/src/types/settings.d.ts index 7982779..79069a2 100644 --- a/bo/src/types/settings.d.ts +++ b/bo/src/types/settings.d.ts @@ -7,6 +7,7 @@ export interface Settings { } export interface App { + category_tree_root_id: number name: string environment: string base_url: string