import { RouterView } from 'vue-router';
import { setRectificative } from 'src/pages/InvoiceIn/composables/setRectificative';
export default {
    path: '/invoice-in',
    name: 'InvoiceIn',
    meta: {
        title: 'invoiceIns',
        icon: 'vn:invoice-in',
        moduleName: 'InvoiceIn',
    },
    component: RouterView,
    redirect: { name: 'InvoiceInMain' },
    menus: {
        main: ['InvoiceInList', 'InvoiceInSerial'],
        card: [
            'InvoiceInBasicData',
            'InvoiceInVat',
            'InvoiceInDueDay',
            'InvoiceInIntrastat',
            'InvoiceInCorrective',
            'InvoiceInLog',
        ],
    },
    children: [
        {
            path: '',
            name: 'InvoiceInMain',
            component: () => import('src/components/common/VnSectionMain.vue'),
            redirect: { name: 'InvoiceInList' },
            children: [
                {
                    path: 'list',
                    name: 'InvoiceInList',
                    meta: {
                        title: 'list',
                        icon: 'view_list',
                    },
                    component: () => import('src/pages/InvoiceIn/InvoiceInList.vue'),
                },
                {
                    path: 'serial',
                    name: 'InvoiceInSerial',
                    meta: {
                        title: 'serial',
                        icon: 'view_list',
                    },
                    component: () =>
                        import('src/pages/InvoiceIn/Serial/InvoiceInSerial.vue'),
                },
                {
                    path: 'create',
                    name: 'InvoiceInCreare',
                    meta: {
                        title: 'invoiceInCreate',
                        icon: 'create',
                    },
                    component: () => import('src/pages/InvoiceIn/InvoiceInCreate.vue'),
                },
            ],
        },
        {
            name: 'InvoiceInCard',
            path: ':id',
            component: () => import('src/pages/InvoiceIn/Card/InvoiceInCard.vue'),
            redirect: { name: 'InvoiceInSummary' },
            beforeEnter: async (to, from, next) => {
                await setRectificative(to);
                next();
            },
            children: [
                {
                    name: 'InvoiceInSummary',
                    path: 'summary',
                    meta: {
                        title: 'summary',
                        icon: 'view_list',
                    },
                    component: () =>
                        import('src/pages/InvoiceIn/Card/InvoiceInSummary.vue'),
                },
                {
                    name: 'InvoiceInBasicData',
                    path: 'basic-data',
                    meta: {
                        title: 'basicData',
                        icon: 'vn:settings',
                    },
                    component: () =>
                        import('src/pages/InvoiceIn/Card/InvoiceInBasicData.vue'),
                },
                {
                    name: 'InvoiceInVat',
                    path: 'vat',
                    meta: {
                        title: 'vat',
                        icon: 'vn:tax',
                    },
                    component: () => import('src/pages/InvoiceIn/Card/InvoiceInVat.vue'),
                },
                {
                    name: 'InvoiceInDueDay',
                    path: 'due-day',
                    meta: {
                        title: 'dueDay',
                        icon: 'vn:calendar',
                    },
                    component: () =>
                        import('src/pages/InvoiceIn/Card/InvoiceInDueDay.vue'),
                },
                {
                    name: 'InvoiceInIntrastat',
                    path: 'intrastat',
                    meta: {
                        title: 'intrastat',
                        icon: 'vn:lines',
                    },
                    component: () =>
                        import('src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue'),
                },
                {
                    name: 'InvoiceInLog',
                    path: 'log',
                    meta: {
                        title: 'log',
                        icon: 'history',
                    },
                    component: () => import('src/pages/InvoiceIn/Card/InvoiceInLog.vue'),
                },
                {
                    name: 'InvoiceInCorrective',
                    path: 'corrective',
                    meta: {
                        title: 'corrective',
                        icon: 'attachment',
                    },
                    component: () =>
                        import('src/pages/InvoiceIn/Card/InvoiceInCorrective.vue'),
                },
            ],
        },
    ],
};
