Files
boursecu_admin/src/router/routes/setting.ts
T
2026-07-23 22:24:26 +03:30

198 lines
5.8 KiB
TypeScript

import type { RouteRecordRaw } from 'vue-router'
import { isDeployAdmin } from '@/utils/deployAdmin'
import { hasSmsPanelAccess } from '@/utils/smsPanelAccess'
import { useUserStore } from '@/store/userStore'
import { bannerEnabledSetting, trackingSystemsEnabledSetting, appNotificationEnabledSetting } from '@/utils/config'
const Setting: RouteRecordRaw = {
name: 'settings',
path: '/settings',
component: () => import('@core/layouts/BasicLayout.vue'),
redirect: { name: 'settingMain' },
meta: {
icon: 'vuesax-linear:setting',
permissionsKey: 'config',
title: 'پیکربندی',
disabled: false,
hideMenu: false,
hideChildren: true,
order: 7
},
children: [
{
name: 'settingMain',
path: '',
component: () => import('@/pages/menuPages/setting/index.vue'),
redirect: { name: 'configuration' },
meta: {
permissionsKey: 'config',
icon: 'vuesax-linear:setting',
order: 5,
title: 'پیکربندی',
disabled: false,
hideMenu: true
},
children: [
{
name: 'configuration',
path: 'configuration',
component: () => import('@/pages/menuPages/configuration/index.vue'),
meta: {
icon: 'vuesax-linear:setting-2',
title: 'تنظیمات',
order: 1
}
},
{
name: 'captureSitesMain',
path: 'capture-sites',
component: () => import('@/pages/menuPages/captureSites/index.vue'),
meta: {
permissionsKey: 'pricing',
icon: 'vuesax-linear:global',
title: 'سایت‌های ری‌گیری',
order: 2
},
beforeEnter() {
if (!trackingSystemsEnabledSetting.value) {
return { name: 'configuration' }
}
}
},
{
name: 'advancedConfiguration',
path: 'advanced-configuration',
component: () => import('@/pages/menuPages/configuration/index.vue'),
props: { mode: 'system' },
meta: {
deployAdminOnly: true,
icon: 'vuesax-linear:code-circle',
title: 'تنظیمات پیشرفته',
order: 3
},
beforeEnter() {
const userStore = useUserStore()
if (!isDeployAdmin(userStore.userInfo?.mobile)) {
return { name: 'configuration' }
}
}
},
{
name: 'smsPanelMain',
path: 'sms-panel',
component: () => import('@/pages/menuPages/smsPanel/index.vue'),
meta: {
icon: 'vuesax-linear:wallet-3',
title: 'پنل پیامک',
order: 3.5,
requiresSmsPanelAccess: true
},
beforeEnter() {
const userStore = useUserStore()
if (!hasSmsPanelAccess(userStore.userInfo)) {
return { name: 'configuration' }
}
}
},
{
name: 'banners',
path: 'banners',
component: () => import('@/pages/menuPages/banners/index.vue'),
meta: {
icon: 'vuesax-linear:image',
title: 'بنرها',
order: 4
},
beforeEnter() {
if (!bannerEnabledSetting.value) {
return { name: 'configuration' }
}
}
},
{
name: 'appNotifications',
path: 'app-notifications',
component: () => import('@/pages/menuPages/appNotifications/index.vue'),
meta: {
icon: 'vuesax-linear:notification-bing',
title: 'اعلان‌ها',
order: 4.5
},
beforeEnter() {
if (!appNotificationEnabledSetting.value) {
return { name: 'configuration' }
}
}
},
{
name: 'smsMain',
path: 'sms',
component: () => import('@/pages/menuPages/sms/index.vue'),
meta: {
permissionsKey: 'sms',
icon: 'vuesax-linear:sms',
title: 'پیامک‌ها',
order: 5
}
},
{
name: 'giftCardMain',
path: 'giftCard',
component: () => import('@/pages/menuPages/giftCards/index.vue'),
meta: {
permissionsKey: 'project',
icon: 'vuesax-linear:gift',
title: 'کارت هدیه',
hideMenu: true,
order: 6
}
},
{
name: 'discounts',
path: 'discounts',
component: () => import('@/pages/menuPages/discount/index.vue'),
meta: {
permissionsKey: 'discounts',
icon: 'vuesax-linear:discount-shape',
title: 'تخفیفات',
hideMenu: true,
order: 7
}
},
{
name: 'usersMain',
path: 'admins',
component: () => import('@/pages/menuPages/users/index.vue'),
meta: {
permissionsKey: 'user',
icon: 'vuesax-linear:profile',
title: 'مدیران',
order: 8
}
},
/** ریدایرکت آدرس قدیمی — به حساب کتاب منتقل شد */
{
name: 'settingsPricingRedirect',
path: 'pricing',
redirect: { name: 'pricingMain' },
meta: { hideMenu: true }
},
{
name: 'settingsPriceTriggersRedirect',
path: 'priceTriggers',
redirect: { name: 'priceTriggers' },
meta: { hideMenu: true }
},
{
name: 'settingsAccountingRedirect',
path: 'accounting',
redirect: { name: 'accountingMain' },
meta: { hideMenu: true }
}
]
}
]
}
export default Setting