diff --git a/bo/src/components/admin/ProductsView.vue b/bo/src/components/admin/ProductsView.vue
deleted file mode 100644
index 7b4d910..0000000
--- a/bo/src/components/admin/ProductsView.vue
+++ /dev/null
@@ -1,243 +0,0 @@
-
-
-
-
-
-
-
-
-
-
{{ t('products.title') }}
-
-
- {{ t('products.login_to_view') }}
-
-
-
-
- {{ t('products.loading') }}...
-
-
-
-
- {{ productStore.error }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/bo/src/components/customer/Cart1.vue b/bo/src/components/customer/CartDetails.vue
similarity index 99%
rename from bo/src/components/customer/Cart1.vue
rename to bo/src/components/customer/CartDetails.vue
index 2ae6fbd..a27ca88 100644
--- a/bo/src/components/customer/Cart1.vue
+++ b/bo/src/components/customer/CartDetails.vue
@@ -65,7 +65,7 @@ function handleCancel() {
}
function handleContinueToCheckout() {
- router.push({ name: 'cart' })
+ router.push({ name: 'carts' })
}
function removeItem(itemId: number) {
diff --git a/bo/src/components/customer/PageCart.vue b/bo/src/components/customer/PageCart.vue
deleted file mode 100644
index 833e0a5..0000000
--- a/bo/src/components/customer/PageCart.vue
+++ /dev/null
@@ -1,201 +0,0 @@
-
-
-
-
{{ t('Shopping Cart') }}
-
-
-
-
- {{ t('Selected Products') }}
-
-
-
-
-
![]()
-
-
-
{{ item.name }}
-
${{ item.price.toFixed(2) }}
-
${{ (item.price * item.quantity).toFixed(2)
- }}
-
-
-
cartStore.updateQuantity(item.id, val)" />
-
-
-
-
-
-
-
-
-
{{ t('Your cart is empty') }}
-
- {{ t('Continue Shopping') }}
-
-
-
-
-
-
-
{{ t('Order Summary') }}
-
-
- {{ t('Products total') }}
- ${{ cartStore.productsTotal.toFixed(2) }}
-
-
- {{ t('Shipping') }}
-
- {{ cartStore.shippingCost > 0 ? `$${cartStore.shippingCost.toFixed(2)}` : t('Free') }}
-
-
-
- {{ t('VAT') }} ({{ (cartStore.vatRate * 100).toFixed(0)
- }}%)
- ${{ cartStore.vatAmount.toFixed(2) }}
-
-
-
- {{ t('Total') }}
- ${{
- cartStore.orderTotal.toFixed(2) }}
-
-
-
- {{ t('Place Order') }}
-
-
- {{ t('Cancel') }}
-
-
-
-
-
-
-
-
-
{{ t('Select Delivery Address') }}
-
-
-
-
-
-
-
-
-
{{ t('No addresses found') }}
-
- {{ t('Add Address') }}
-
-
-
-
-
-
-
{{ t('Delivery Method') }}
-
-
-
-
-
-
-
-
-
-
-
diff --git a/bo/src/components/customer/PageCarts.vue b/bo/src/components/customer/PageCarts.vue
new file mode 100644
index 0000000..fd1e1fb
--- /dev/null
+++ b/bo/src/components/customer/PageCarts.vue
@@ -0,0 +1,204 @@
+
+
+
+
{{ t('Shopping Cart') }}
+
+
+
+
+ {{ t('Selected Products') }}
+
+
+
+
+
![]()
+
+
+
{{ item.name }}
+
${{ item.price.toFixed(2) }}
+
${{ (item.price * item.quantity).toFixed(2)
+ }}
+
+
+
cartStore.updateQuantity(item.id, val)" />
+
+
+
+
+
+
+
+
+
{{ t('Your cart is empty') }}
+
+ {{ t('Continue Shopping') }}
+
+
+
+
+
+
+
{{ t('Order Summary') }}
+
+
+ {{ t('Products total') }}
+ ${{ cartStore.productsTotal.toFixed(2) }}
+
+
+ {{ t('Shipping') }}
+
+ {{ cartStore.shippingCost > 0 ? `$${cartStore.shippingCost.toFixed(2)}` : t('Free') }}
+
+
+
+ {{ t('VAT') }} ({{ (cartStore.vatRate * 100).toFixed(0)
+ }}%)
+ ${{ cartStore.vatAmount.toFixed(2) }}
+
+
+
+ {{ t('Total') }}
+ ${{
+ cartStore.orderTotal.toFixed(2) }}
+
+
+
+ {{ t('Place Order') }}
+
+
+ {{ t('Cancel') }}
+
+
+
+
+
+
+
+
+
{{ t('Select Delivery Address') }}
+
+
+
+
+
+
+
+
+
{{ t('No addresses found') }}
+
+ {{ t('Add Address') }}
+
+
+
+
+
+
+
{{ t('Delivery Method') }}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bo/src/components/customer/PageProductCardFull.vue b/bo/src/components/customer/PageProduct.vue
similarity index 100%
rename from bo/src/components/customer/PageProductCardFull.vue
rename to bo/src/components/customer/PageProduct.vue
diff --git a/bo/src/components/customer/PageCustomerData.vue b/bo/src/components/customer/PageProfileDetails.vue
similarity index 99%
rename from bo/src/components/customer/PageCustomerData.vue
rename to bo/src/components/customer/PageProfileDetails.vue
index 3fb35cc..62acd5d 100644
--- a/bo/src/components/customer/PageCustomerData.vue
+++ b/bo/src/components/customer/PageProfileDetails.vue
@@ -118,6 +118,6 @@ const companyAddress = computed(() => {
})
function goToCreateAccount() {
- router.push({ name: 'create-account' })
+ router.push({ name: 'profile-details-add-info' })
}
\ No newline at end of file
diff --git a/bo/src/components/customer/PageCreateAccount.vue b/bo/src/components/customer/PageProfileDetailsAddInfo.vue
similarity index 99%
rename from bo/src/components/customer/PageCreateAccount.vue
rename to bo/src/components/customer/PageProfileDetailsAddInfo.vue
index a940866..882b545 100644
--- a/bo/src/components/customer/PageCreateAccount.vue
+++ b/bo/src/components/customer/PageProfileDetailsAddInfo.vue
@@ -173,9 +173,9 @@ function saveAccount() {
companyAddress : ''
})
- router.push({ name: 'customer-data' })
+ router.push({ name: 'profile-details' })
}
function goBack() {
- router.push({ name: 'customer-data' })
+ router.push({ name: 'profile-details' })
}
\ No newline at end of file
diff --git a/bo/src/components/inner/categoryMenu.vue b/bo/src/components/inner/categoryMenu.vue
index a370c3c..1edcafb 100644
--- a/bo/src/components/inner/categoryMenu.vue
+++ b/bo/src/components/inner/categoryMenu.vue
@@ -8,11 +8,11 @@ const openAll = ref(false)
function adaptMenu(menu: NavigationMenuItem[]) {
for (const item of menu) {
- if(item.children && item.children.length > 0){
+ if (item.children && item.children.length > 0) {
console.log(item);
adaptMenu(item.children);
item.open = openAll.value
- item.children.unshift({ label: item.label, icon: 'i-lucide-book-open', popover: item.label ,to: { name: 'category', params: item.params }})
+ item.children.unshift({ label: item.label, icon: 'i-lucide-book-open', popover: item.label, to: { name: 'category', params: item.params } })
} else {
item.to = { name: 'category', params: item.params };
item.icon = 'i-lucide-file-text'
@@ -27,14 +27,10 @@ const items = ref
([
[
...menu as NavigationMenuItem[]
],
-
+
])
-
-
-
-
-
+
diff --git a/bo/src/components/inner/categoryMenuListing.vue b/bo/src/components/inner/categoryMenuListing.vue
new file mode 100644
index 0000000..492188e
--- /dev/null
+++ b/bo/src/components/inner/categoryMenuListing.vue
@@ -0,0 +1,35 @@
+
+
+
+
+
diff --git a/bo/src/components/inner/langSwitch.vue b/bo/src/components/inner/langSwitch.vue
index 7a61ab6..e1a345d 100644
--- a/bo/src/components/inner/langSwitch.vue
+++ b/bo/src/components/inner/langSwitch.vue
@@ -1,4 +1,5 @@
+ {{ locale }}
diff --git a/bo/src/router/index.ts b/bo/src/router/index.ts
index 7727497..f12fead 100644
--- a/bo/src/router/index.ts
+++ b/bo/src/router/index.ts
@@ -2,17 +2,13 @@ import { createRouter, createWebHistory } from 'vue-router'
import { currentLang, langs } from './langs'
import { getSettings } from './settings'
import { useAuthStore } from '@/stores/auth'
-// import Default from '@/layouts/default.vue'
-// import { getMenu } from './menu'
-
+import { getRoutes } from './menu'
function isAuthenticated(): boolean {
if (typeof document === 'undefined') return false
return document.cookie.split('; ').some((c) => c === 'is_authenticated=1')
}
await getSettings()
-// await getMenu()
-
const router = createRouter({
history: createWebHistory(import.meta.env.VITE_BASE_URL),
@@ -23,68 +19,41 @@ const router = createRouter({
},
{
path: '/:locale',
+ name: 'locale',
children: [
- { path: 'category/:category_id-:link_rewrite', component: () => import('@/views/CategoryView.vue'), name: 'category' },
- { path: 'products-datail', component: () => import('@/components/admin/ProductDetailView.vue'), name: 'product-detail' },
- { path: '', component: () => import('@/views/RepoChartView.vue'), name: 'home' },
- { path: 'products', component: () => import('@/components/admin/ProductsView.vue'), name: 'products' },
- { path: 'product-card-full', component: () => import('@/components/customer/PageProductCardFull.vue'), name: 'product-card-full' },
- { path: 'addresses', component: () => import('@/components/customer/PageAddresses.vue'), name: 'addresses' },
- { path: 'customer-data', component: () => import('@/components/customer/PageCustomerData.vue'), name: 'customer-data' },
- { path: 'create-account', component: () => import('@/components/customer/PageCreateAccount.vue'), name: 'create-account' },
- { path: 'cart', component: () => import('@/components/customer/PageCart.vue'), name: 'cart' },
- { path: 'cart1', component: () => import('@/components/customer/Cart1.vue'), name: 'cart1' },
- { path: 'products-list', component: () => import('@/components/admin/PageProductsList.vue'), name: 'products-list' },
- { path: 'login', component: () => import('@/views/LoginView.vue'), name: 'login', meta: { guest: true, } },
- { path: 'register', component: () => import('@/views/RegisterView.vue'), name: 'register', meta: { guest: true } },
- { path: 'password-recovery', component: () => import('@/views/PasswordRecoveryView.vue'), name: 'password-recovery', meta: { guest: true } },
- { path: 'reset-password', component: () => import('@/views/ResetPasswordForm.vue'), name: 'reset-password', meta: { guest: true } },
- { path: 'verify-email', component: () => import('@/views/VerifyEmailView.vue'), name: 'verify-email', meta: { guest: true } },
-
{
path: '/:pathMatch(.*)*',
component: () => import('@/views/NotFoundView.vue'),
- name: 'not-found',
+ name: 'not-found-child',
},
],
},
{
path: '/:pathMatch(.*)*',
component: () => import('@/views/NotFoundView.vue'),
- name: 'not-found',
+ name: 'not-found-root',
},
],
})
-// router.beforeEach((to, from, next) => {
-// const locale = to.params.locale as string
-// const localeLang = langs.find((x) => x.iso_code == locale)
+await getRoutes().then(routes => {
+ const modules = import.meta.glob('/src/**/**/*.vue')
+ routes.forEach(item => {
+ const component = modules[`/src${item.Component}`]
-// if (locale && langs.length > 0) {
-// const authStore = useAuthStore()
-// // console.log(authStore.isAuthenticated, to, from)
-// // if()
-// const validLocale = langs.find((l) => l.lang_code === locale)
+ if (!component) {
+ console.error('Component not found:', item.Component)
+ return
+ }
-// if (validLocale) {
-// currentLang.value = localeLang
-// if (!to.meta?.guest && !isAuthenticated()) {
-// return next({ name: 'login', params: { locale } })
-// }
-
-// // return next()
-// return next()
-// } else if (locale) {
-// return next(`/${currentLang.value?.iso_code}${to.path.replace(`/${locale}`, '') || '/'}`)
-// }
-// }
-
-// if (!locale && to.path !== '/') {
-// return next(`/${currentLang.value?.iso_code}${to.path}`)
-// }
-
-// next()
-// })
+ router.addRoute('locale', {
+ path: item.Path,
+ component,
+ name: item.Name,
+ meta: item.Meta ? JSON.parse(item.Meta) : {}
+ })
+ })
+})
router.beforeEach((to, from) => {
const locale = to.params.locale as string
diff --git a/bo/src/types/index.d.ts b/bo/src/types/index.d.ts
index ae62d73..f33dff1 100644
--- a/bo/src/types/index.d.ts
+++ b/bo/src/types/index.d.ts
@@ -1,2 +1,8 @@
export * from '@types/lang'
export * from '@types/response'
+
+export interface ApiResponse {
+ message: string
+ items: Product[]
+ count: number
+}