edit SMSpanel
This commit is contained in:
@@ -4,6 +4,8 @@ import { useRouterStore } from '@core/stores/router'
|
||||
import type { Router, RouteRecordRaw } from 'vue-router'
|
||||
import { getConfigApp, isStoreApp } from '@/utils/config'
|
||||
import { isDeployAdmin } from '@/utils/deployAdmin'
|
||||
import { hasSmsPanelAccess, isSmsBillingEnabled } from '@/utils/smsPanelAccess'
|
||||
import { useUserStore } from '@/store/userStore'
|
||||
import { cloneDeep } from 'lodash'
|
||||
//const _router = useRouter()
|
||||
//import { cloneDeep } from 'lodash'
|
||||
@@ -46,6 +48,20 @@ function filterRoutesByApp(routes: RouteRecordRaw, appName: string | null) {
|
||||
routes.children.forEach((child) => filterRoutesByApp(child, appName))
|
||||
}
|
||||
|
||||
/** زیرمنوی پنل پیامک — فقط deploy admin و وقتی billing فعال است */
|
||||
function filterSmsPanelRoutes(route: RouteRecordRaw) {
|
||||
const user = useUserStore().userInfo
|
||||
|
||||
if (!route.children?.length) return
|
||||
|
||||
route.children = route.children.filter((child) => {
|
||||
if (!child.meta?.requiresSmsPanelAccess) return true
|
||||
return isSmsBillingEnabled(user) && hasSmsPanelAccess(user)
|
||||
})
|
||||
|
||||
route.children.forEach((child) => filterSmsPanelRoutes(child))
|
||||
}
|
||||
|
||||
/** زیرمنوی تنظیمات پیشرفته — فقط برای ادمین دیپلoyi */
|
||||
function filterDeployAdminRoutes(route: RouteRecordRaw, mobile?: string | number | null) {
|
||||
if (!route.children?.length) return
|
||||
@@ -90,6 +106,7 @@ function prepareRoute(route: RouteRecordRaw, appName: string | null, mobile?: st
|
||||
applyAppModeMeta(route, appName)
|
||||
filterRoutesByApp(route, appName)
|
||||
filterDeployAdminRoutes(route, mobile)
|
||||
filterSmsPanelRoutes(route)
|
||||
}
|
||||
|
||||
function loadDynamicRoutes(appName: string | null, mobile?: string | number | null): RouteRecordRaw[] {
|
||||
|
||||
Reference in New Issue
Block a user