admin user and ui panel
This commit is contained in:
@@ -26,7 +26,7 @@ export const adminRoute: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'dashboard',
|
||||
redirect: '/my-data'
|
||||
redirect: '/dashboard/ecommerce'
|
||||
},
|
||||
{
|
||||
// Legacy had two dashboards ("آمار تک فروشی" at /dashboard/analytics and
|
||||
@@ -470,6 +470,30 @@ export const adminRoute: RouteRecordRaw[] = [
|
||||
no_scroll: true
|
||||
}
|
||||
},
|
||||
{
|
||||
// Add uses the same form as edit, with no :id — see ReagentCustomer.vue.
|
||||
path: '/reagent/add',
|
||||
name: 'reagent-add',
|
||||
component: () => import('../views/apps/customer/EditReagent.vue'),
|
||||
meta: {
|
||||
rule: 'editor',
|
||||
role: 'persons.create',
|
||||
parent: 'product',
|
||||
no_scroll: true
|
||||
}
|
||||
},
|
||||
{
|
||||
// A sales agent's own detail screen — see AgentDetail.vue's header comment.
|
||||
path: '/reagent/view/:id',
|
||||
name: 'reagent-view',
|
||||
component: () => import('../views/customer/reagentList/AgentDetail.vue'),
|
||||
meta: {
|
||||
rule: 'editor',
|
||||
role: 'persons.list.sellers.view',
|
||||
parent: 'product',
|
||||
no_scroll: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/bulkCustomer/edit/:id',
|
||||
name: 'bulkCustomer-edit',
|
||||
|
||||
@@ -117,6 +117,9 @@ router.beforeEach(async (to) => {
|
||||
if (token) {
|
||||
const roles = await getPermission();
|
||||
if (roles && to.meta && to.meta.role && !roles.includes(to.meta.role as string)) {
|
||||
if (to.name === 'dashboard-ecommerce' || to.name === 'dashboard-analytics') {
|
||||
return { name: 'my-data' };
|
||||
}
|
||||
return { name: 'page-not-authorized' };
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user