mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 19:51:09 -04:00
build version 400
This commit is contained in:
@ -1,10 +1,9 @@
|
||||
import Vue from 'vue'
|
||||
import VueRouter from 'vue-router'
|
||||
import store from './store/index.js'
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Admin Views
|
||||
| Views
|
||||
|--------------------------------------------------------------------------|
|
||||
*/
|
||||
|
||||
@ -21,18 +20,13 @@ import Register from './views/auth/Register.vue'
|
||||
|
||||
import NotFoundPage from './views/errors/404.vue'
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Admin Views
|
||||
|--------------------------------------------------------------------------|
|
||||
*/
|
||||
|
||||
// Dashbord
|
||||
import Dashboard from './views/dashboard/Dashboard.vue'
|
||||
|
||||
// Customers
|
||||
import CustomerIndex from './views/customers/Index.vue'
|
||||
import CustomerCreate from './views/customers/Create.vue'
|
||||
import CustomerView from './views/customers/View.vue'
|
||||
|
||||
// Items
|
||||
import ItemsIndex from './views/items/Index.vue'
|
||||
@ -57,6 +51,10 @@ import EstimateView from './views/estimates/View.vue'
|
||||
import ExpensesIndex from './views/expenses/Index'
|
||||
import ExpenseCreate from './views/expenses/Create.vue'
|
||||
|
||||
//User
|
||||
import UserIndex from './views/users/Index.vue'
|
||||
import UserCreate from './views/users/Create.vue'
|
||||
|
||||
// Report
|
||||
import SalesReports from './views/reports/SalesReports'
|
||||
import ExpensesReport from './views/reports/ExpensesReport'
|
||||
@ -65,31 +63,29 @@ import TaxReport from './views/reports/TaxReport.vue'
|
||||
import ReportLayout from './views/reports/layout/Index.vue'
|
||||
|
||||
// Settings
|
||||
import SettingsLayout from './views/settings/layout/Index.vue'
|
||||
import CompanyInfo from './views/settings/CompanyInfo.vue'
|
||||
import Customization from './views/settings/Customization.vue'
|
||||
import Notifications from './views/settings/Notifications.vue'
|
||||
import Preferences from './views/settings/Preferences.vue'
|
||||
import UserProfile from './views/settings/UserProfile.vue'
|
||||
import TaxTypes from './views/settings/TaxTypes.vue'
|
||||
import ExpenseCategory from './views/settings/ExpenseCategory.vue'
|
||||
import MailConfig from './views/settings/MailConfig.vue'
|
||||
import UpdateApp from './views/settings/UpdateApp.vue'
|
||||
|
||||
import Wizard from './views/wizard/Index.vue'
|
||||
import SettingsLayout from './views/settings/SettingsIndex.vue'
|
||||
import CompanyInfo from './views/settings/CompanyInfoSetting.vue'
|
||||
import Customization from './views/settings/CustomizationSetting.vue'
|
||||
import Notifications from './views/settings/NotificationsSetting.vue'
|
||||
import Preferences from './views/settings/PreferencesSetting.vue'
|
||||
import UserProfile from './views/settings/UserProfileSetting.vue'
|
||||
import TaxTypes from './views/settings/TaxTypesSetting.vue'
|
||||
import NotesSetting from './views/settings/NotesSetting.vue'
|
||||
import ExpenseCategory from './views/settings/ExpenseCategorySetting.vue'
|
||||
import MailConfig from './views/settings/MailConfigSetting.vue'
|
||||
import UpdateApp from './views/settings/UpdateAppSetting.vue'
|
||||
import Backup from './views/settings/BackupSetting.vue'
|
||||
import FileDisk from './views/settings/FileDiskSetting.vue'
|
||||
import CustomFieldsIndex from './views/settings/CustomFieldsSetting.vue'
|
||||
import PaymentMode from './views/settings/PaymentsModeSetting.vue'
|
||||
import Wizard from './views/wizard/Wizard.vue'
|
||||
|
||||
Vue.use(VueRouter)
|
||||
|
||||
const routes = [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Frontend Routes
|
||||
|--------------------------------------------------------------------------|
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Auth & Registration Routes
|
||||
| Auth & Registration
|
||||
|--------------------------------------------------------------------------|
|
||||
*/
|
||||
|
||||
@ -100,34 +96,34 @@ const routes = [
|
||||
children: [
|
||||
{
|
||||
path: '/',
|
||||
component: Login
|
||||
component: Login,
|
||||
},
|
||||
{
|
||||
path: 'login',
|
||||
component: Login,
|
||||
name: 'login'
|
||||
name: 'login',
|
||||
},
|
||||
{
|
||||
path: '/forgot-password',
|
||||
component: ForgotPassword,
|
||||
name: 'forgot-password'
|
||||
name: 'forgot-password',
|
||||
},
|
||||
{
|
||||
path: '/reset-password/:token',
|
||||
component: ResetPassword,
|
||||
name: 'reset-password'
|
||||
name: 'reset-password',
|
||||
},
|
||||
{
|
||||
path: 'register',
|
||||
component: Register,
|
||||
name: 'register'
|
||||
}
|
||||
]
|
||||
name: 'register',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Onboarding Routes
|
||||
| Onboarding
|
||||
|--------------------------------------------------------------------------|
|
||||
*/
|
||||
{
|
||||
@ -137,149 +133,170 @@ const routes = [
|
||||
{
|
||||
path: '/',
|
||||
component: Wizard,
|
||||
name: 'wizard'
|
||||
}
|
||||
]
|
||||
name: 'wizard',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Admin Backend Routes
|
||||
| Admin
|
||||
|--------------------------------------------------------------------------|
|
||||
*/
|
||||
{
|
||||
path: '/admin',
|
||||
component: LayoutBasic, // Change the desired Layout here
|
||||
component: LayoutBasic,
|
||||
meta: { requiresAuth: true },
|
||||
children: [
|
||||
// Dashbord
|
||||
// Dashboard
|
||||
{
|
||||
path: '/',
|
||||
component: Dashboard,
|
||||
name: 'dashboard'
|
||||
name: 'dashboard',
|
||||
},
|
||||
{
|
||||
path: 'dashboard',
|
||||
component: Dashboard
|
||||
component: Dashboard,
|
||||
},
|
||||
|
||||
// Customer
|
||||
// Customers
|
||||
{
|
||||
path: 'customers',
|
||||
component: CustomerIndex
|
||||
component: CustomerIndex,
|
||||
},
|
||||
{
|
||||
path: 'customers/create',
|
||||
name: 'customers.create',
|
||||
component: CustomerCreate
|
||||
component: CustomerCreate,
|
||||
},
|
||||
{
|
||||
path: 'customers/:id/edit',
|
||||
name: 'customers.edit',
|
||||
component: CustomerCreate
|
||||
component: CustomerCreate,
|
||||
},
|
||||
{
|
||||
path: 'customers/:id/view',
|
||||
name: 'customers.view',
|
||||
component: CustomerView,
|
||||
},
|
||||
|
||||
// Items
|
||||
{
|
||||
path: 'items',
|
||||
component: ItemsIndex
|
||||
component: ItemsIndex,
|
||||
},
|
||||
{
|
||||
path: 'items/create',
|
||||
name: 'items.create',
|
||||
component: ItemCreate
|
||||
component: ItemCreate,
|
||||
},
|
||||
{
|
||||
path: 'items/:id/edit',
|
||||
name: 'items.edit',
|
||||
component: ItemCreate
|
||||
component: ItemCreate,
|
||||
},
|
||||
|
||||
// Estimate
|
||||
// Estimates
|
||||
{
|
||||
path: 'estimates',
|
||||
name: 'estimates.index',
|
||||
component: EstimateIndex
|
||||
component: EstimateIndex,
|
||||
},
|
||||
{
|
||||
path: 'estimates/create',
|
||||
name: 'estimates.create',
|
||||
component: EstimateCreate
|
||||
component: EstimateCreate,
|
||||
},
|
||||
{
|
||||
path: 'estimates/:id/view',
|
||||
name: 'estimates.view',
|
||||
component: EstimateView
|
||||
component: EstimateView,
|
||||
},
|
||||
{
|
||||
path: 'estimates/:id/edit',
|
||||
name: 'estimates.edit',
|
||||
component: EstimateCreate
|
||||
component: EstimateCreate,
|
||||
},
|
||||
|
||||
// Invoice
|
||||
// Invoices
|
||||
{
|
||||
path: 'invoices',
|
||||
name: 'invoices.index',
|
||||
component: InvoiceIndex
|
||||
component: InvoiceIndex,
|
||||
},
|
||||
{
|
||||
path: 'invoices/create',
|
||||
name: 'invoices.create',
|
||||
component: InvoiceCreate
|
||||
component: InvoiceCreate,
|
||||
},
|
||||
{
|
||||
path: 'invoices/:id/view',
|
||||
name: 'invoices.view',
|
||||
component: InvoiceView
|
||||
component: InvoiceView,
|
||||
},
|
||||
{
|
||||
path: 'invoices/:id/edit',
|
||||
name: 'invoices.edit',
|
||||
component: InvoiceCreate
|
||||
component: InvoiceCreate,
|
||||
},
|
||||
|
||||
// Payments
|
||||
{
|
||||
path: 'payments',
|
||||
name: 'payments.index',
|
||||
component: PaymentsIndex
|
||||
component: PaymentsIndex,
|
||||
},
|
||||
{
|
||||
path: 'payments/create',
|
||||
name: 'payments.create',
|
||||
component: PaymentCreate
|
||||
component: PaymentCreate,
|
||||
},
|
||||
{
|
||||
path: 'payments/:id/create',
|
||||
name: 'invoice.payments.create',
|
||||
component: PaymentCreate
|
||||
component: PaymentCreate,
|
||||
},
|
||||
|
||||
{
|
||||
path: 'payments/:id/edit',
|
||||
name: 'payments.edit',
|
||||
component: PaymentCreate
|
||||
component: PaymentCreate,
|
||||
},
|
||||
{
|
||||
path: 'payments/:id/view',
|
||||
name: 'payments.view',
|
||||
component: PaymentView
|
||||
component: PaymentView,
|
||||
},
|
||||
|
||||
// Expenses
|
||||
{
|
||||
path: 'expenses',
|
||||
component: ExpensesIndex
|
||||
component: ExpensesIndex,
|
||||
},
|
||||
{
|
||||
path: 'expenses/create',
|
||||
name: 'expenses.create',
|
||||
component: ExpenseCreate
|
||||
component: ExpenseCreate,
|
||||
},
|
||||
{
|
||||
path: 'expenses/:id/edit',
|
||||
name: 'expenses.edit',
|
||||
component: ExpenseCreate
|
||||
component: ExpenseCreate,
|
||||
},
|
||||
|
||||
// User
|
||||
{
|
||||
path: 'users',
|
||||
component: UserIndex,
|
||||
},
|
||||
{
|
||||
path: 'users/create',
|
||||
name: 'users.create',
|
||||
component: UserCreate,
|
||||
},
|
||||
{
|
||||
path: 'users/:id/edit',
|
||||
name: 'users.edit',
|
||||
component: UserCreate,
|
||||
},
|
||||
|
||||
// Reports
|
||||
@ -289,21 +306,21 @@ const routes = [
|
||||
children: [
|
||||
{
|
||||
path: 'sales',
|
||||
component: SalesReports
|
||||
component: SalesReports,
|
||||
},
|
||||
{
|
||||
path: 'expenses',
|
||||
component: ExpensesReport
|
||||
component: ExpensesReport,
|
||||
},
|
||||
{
|
||||
path: 'profit-loss',
|
||||
component: ProfitLossReport
|
||||
component: ProfitLossReport,
|
||||
},
|
||||
{
|
||||
path: 'taxes',
|
||||
component: TaxReport
|
||||
}
|
||||
]
|
||||
component: TaxReport,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// Settings
|
||||
@ -314,76 +331,87 @@ const routes = [
|
||||
{
|
||||
path: 'company-info',
|
||||
name: 'company.info',
|
||||
component: CompanyInfo
|
||||
component: CompanyInfo,
|
||||
},
|
||||
{
|
||||
path: 'customization',
|
||||
name: 'customization',
|
||||
component: Customization
|
||||
component: Customization,
|
||||
},
|
||||
{
|
||||
path: 'payment-mode',
|
||||
name: 'payment.mode',
|
||||
component: PaymentMode,
|
||||
},
|
||||
|
||||
{
|
||||
path: 'custom-fields',
|
||||
name: 'custom.fields',
|
||||
component: CustomFieldsIndex,
|
||||
},
|
||||
{
|
||||
path: 'user-profile',
|
||||
name: 'user.profile',
|
||||
component: UserProfile
|
||||
component: UserProfile,
|
||||
},
|
||||
{
|
||||
path: 'preferences',
|
||||
name: 'preferences',
|
||||
component: Preferences
|
||||
component: Preferences,
|
||||
},
|
||||
{
|
||||
path: 'tax-types',
|
||||
name: 'tax.types',
|
||||
component: TaxTypes
|
||||
component: TaxTypes,
|
||||
},
|
||||
{
|
||||
path: 'notes',
|
||||
name: 'notes',
|
||||
component: NotesSetting,
|
||||
},
|
||||
{
|
||||
path: 'expense-category',
|
||||
name: 'expense.category',
|
||||
component: ExpenseCategory
|
||||
component: ExpenseCategory,
|
||||
},
|
||||
{
|
||||
path: 'mail-configuration',
|
||||
name: 'mailconfig',
|
||||
component: MailConfig
|
||||
component: MailConfig,
|
||||
},
|
||||
{
|
||||
path: 'notifications',
|
||||
name: 'notifications',
|
||||
component: Notifications
|
||||
component: Notifications,
|
||||
},
|
||||
{
|
||||
path: 'update-app',
|
||||
name: 'updateapp',
|
||||
component: UpdateApp
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
component: UpdateApp,
|
||||
},
|
||||
{
|
||||
path: 'backup',
|
||||
name: 'backup',
|
||||
component: Backup,
|
||||
},
|
||||
{
|
||||
path: 'file-disk',
|
||||
name: 'file-disk',
|
||||
component: FileDisk,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// DEFAULT ROUTE
|
||||
{ path: '*', component: NotFoundPage }
|
||||
{ path: '*', component: NotFoundPage },
|
||||
]
|
||||
|
||||
const router = new VueRouter({
|
||||
routes,
|
||||
mode: 'history',
|
||||
linkActiveClass: 'active'
|
||||
})
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
// Redirect if not authenticated on secured routes
|
||||
if (to.matched.some(m => m.meta.requiresAuth)) {
|
||||
if (!store.getters['auth/isAuthenticated']) {
|
||||
return next('/login')
|
||||
}
|
||||
}
|
||||
|
||||
if (to.matched.some(m => m.meta.redirectIfAuthenticated) && store.getters['auth/isAuthenticated']) {
|
||||
return next('/admin/dashboard')
|
||||
}
|
||||
|
||||
return next()
|
||||
linkActiveClass: 'active',
|
||||
})
|
||||
|
||||
export default router
|
||||
|
||||
Reference in New Issue
Block a user