import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

// scrollBehavior:
// - only available in html5 history mode
// - defaults to no scroll behavior
// - return false to prevent scroll
const scrollBehavior = function(to, from, savedPosition) {
  if (savedPosition) {
    // savedPosition is only available for popstate navigations.
    return savedPosition;
  } else {
    const position = {};

    // scroll to anchor by returning the selector
    if (to.hash) {
      position.selector = to.hash;

      // specify offset of the element
      if (to.hash === "#anchor2") {
        position.offset = { y: 100 };
      }

      if (document.querySelector(to.hash)) {
        return position;
      }

      // if the returned position is falsy or an empty object,
      // will retain current scroll position.

      return false;
    }

    // eslint-disable-next-line
    return new Promise((resolve) => {
      // check if any matched route config has meta that requires scrolling to top
      // eslint-disable-next-line
      if (to.matched.some((m) => m.meta.scrollToTop)) {
        // coords will be used if no selector is provided,
        // or if the selector didn't match any element.
        position.x = 0;
        position.y = 0;
      }

      // wait for the out transition to complete (if necessary)
      this.app.$root.$once("triggerScroll", () => {
        // if the resolved position is falsy or an empty object,
        // will retain current scroll position.

        resolve(position);
      });
    });
  }
};
/**
 * https://router.vuejs.org/guide/advanced/lazy-loading.html#grouping-components-in-the-same-chunk
 *
 *
 */
export default new Router({
  mode: "history",
  base: process.env.BASE_URL,
  scrollBehavior,
  routes: [
    //########################## GENERAL / COMMON GROUP ###################################
    {
      path: "/open/:ayatype/:recordid",
      name: "ay-open",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/ay-open.vue")
    },
    {
      path: "/viewreport/:oid/:rid",
      name: "ay-report-view",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/ay-report-view.vue")
    },
    {
      path: "/about",
      name: "ay-about",
      // route level code-splitting
      // this generates a separate chunk (about.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/ay-about.vue")
    },
    {
      path: "/applog",
      name: "ay-log",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/ay-log.vue")
    },
    {
      path: "/customize/:formCustomTemplateKey",
      name: "ay-customize",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/ay-customize.vue")
    },
    {
      path: "/data-list-column-view/:dataListKey",
      name: "ay-data-list-column-view",
      component: () =>
        import(
          /* webpackChunkName: "ay-common" */ "./views/ay-data-list-column-view.vue"
        )
    },

    {
      path: "/history/:ayatype/:recordid/:userlog?",
      name: "ay-history",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/ay-history.vue")
    },
    {
      path: "/login",
      name: "login",
      meta: { scrollToTop: true }, //KEEP THIS AS AN EXAMPLE OF HOW TO USE WITH CODE ABOVE
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/login.vue")
    },
    {
      path: "/home-dashboard",
      name: "home-dashboard",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/home-dashboard.vue")
    },
    {
      //path: "/home-search/:ayatype?", this was making it sticky and couldn't change type as it was in url path
      path: "/home-search",
      name: "home-search",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/home-search.vue")
    },
    { path: "/", redirect: "/login" }, //If someone goes blindly to the root of the app, then it should go to login
    {
      path: "/home-schedule",
      name: "home-schedule",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/home-schedule.vue")
    },
    {
      path: "/home-memos",
      name: "home-memos",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/home-memos.vue")
    },
    {
      path: "/home-memos/:recordid",
      name: "memo-edit",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/home-memo.vue")
    },
    {
      path: "/home-notifications",
      name: "home-notifications",
      component: () =>
        import(
          /* webpackChunkName: "ay-common" */ "./views/home-notifications.vue"
        )
    },
    {
      path: "/home-notify-direct",
      name: "home-notify-direct",
      component: () =>
        import(
          /* webpackChunkName: "ay-common" */ "./views/home-notify-direct.vue"
        )
    },
    {
      path: "/home-reminders",
      name: "home-reminders",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/home-reminders.vue")
    },
    {
      path: "/home-reminders/:recordid",
      name: "reminder-edit",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/home-reminder.vue")
    },
    {
      path: "/home-reviews/:aType?/:objectId?/:name?",
      name: "home-reviews",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/home-reviews.vue")
    },
    {
      path: "/home-reviews/:recordid/:aType?/:objectId?/:name?",
      name: "review-edit",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/home-review.vue")
    },
    {
      path: "/home-user-settings",
      name: "home-user-settings",
      component: () =>
        import(
          /* webpackChunkName: "ay-common" */ "./views/home-user-settings.vue"
        )
    },
    {
      path: "/home-reset",
      name: "home-reset",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/home-reset.vue")
    },
    {
      path: "/home-password",
      name: "home-password",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/home-password.vue")
    },
    {
      path: "/home-security",
      name: "home-security",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/home-security.vue")
    },
    {
      path: "/home-notify-subscriptions",
      name: "home-notify-subscriptions",
      component: () =>
        import(
          /* webpackChunkName: "ay-common" */ "./views/home-notify-subscriptions.vue"
        )
    },
    {
      path: "/home-notify-subscriptions/:recordid",
      name: "home-notify-subscription",
      component: () =>
        import(
          /* webpackChunkName: "ay-common" */ "./views/home-notify-subscription.vue"
        )
    },
    //####################### CUSTOMERS GROUP ##############################
    {
      path: "/cust-customers",
      name: "cust-customers",
      component: () =>
        import(/* webpackChunkName: "cust" */ "./views/cust-customers.vue")
    },
    {
      path: "/cust-customers/:recordid",
      name: "customer-edit",
      component: () =>
        import(/* webpackChunkName: "cust" */ "./views/cust-customer.vue")
    },
    {
      path: "/cust-customer-notes/:customerid",
      name: "customer-notes",
      component: () =>
        import(/* webpackChunkName: "cust" */ "./views/cust-customer-notes.vue")
    },
    {
      path: "/cust-customer-note/:recordid",
      name: "customer-note-edit",
      component: () =>
        import(/* webpackChunkName: "cust" */ "./views/cust-customer-note.vue")
    },
    {
      path: "/cust-users",
      name: "cust-users",
      component: () =>
        import(/* webpackChunkName: "cust" */ "./views/cust-users.vue")
    },
    {
      path: "/cust-users/:recordid",
      name: "cust-user",
      component: () =>
        import(/* webpackChunkName: "cust" */ "./views/cust-user.vue")
    },
    {
      path: "/cust-head-offices",
      name: "cust-head-offices",
      component: () =>
        import(/* webpackChunkName: "cust" */ "./views/cust-head-offices.vue")
    },
    {
      path: "/cust-head-offices/:recordid",
      name: "head-office-edit",
      component: () =>
        import(/* webpackChunkName: "cust" */ "./views/cust-head-office.vue")
    },
    {
      path: "/cust-notify-subscriptions",
      name: "cust-notify-subscriptions",
      component: () =>
        import(
          /* webpackChunkName: "cust" */ "./views/customer-notify-subscriptions.vue"
        )
    },
    {
      path: "/cust-notify-subscriptions/:recordid",
      name: "cust-notify-subscription",
      component: () =>
        import(
          /* webpackChunkName: "cust" */ "./views/customer-notify-subscription.vue"
        )
    },
    //####################### SERVICE GROUP ##############################
    {
      path: "/svc-schedule",
      name: "svc-schedule",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-schedule.vue")
    },
    {
      path: "/svc-schedule-user/:recordid/:name",
      name: "svc-schedule-user",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-schedule-user.vue")
    },
    //future v.next
    // {
    //   path: "/svc-schedule-cust/:recordid/:name",
    //   name: "svc-schedule-cust",
    //   component: () =>
    //     import(/* webpackChunkName: "svc" */ "./views/svc-schedule-cust.vue")
    // },
    {
      path: "/svc-workorders",
      name: "svc-workorders",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-workorders.vue")
    },
    {
      path: "/svc-workorders/:recordid",
      name: "workorder-edit",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-workorder.vue")
    },
    {
      path: "/svc-workorder-items",
      name: "svc-workorder-items",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-workorder-items.vue")
    },
    {
      path: "/svc-workorder-item-units",
      name: "svc-workorder-item-units",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-workorder-item-units.vue"
        )
    },
    {
      path: "/svc-workorder-item-scheduled-users",
      name: "svc-workorder-item-scheduled-users",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-workorder-item-scheduled-users.vue"
        )
    },
    {
      path: "/svc-workorder-item-tasks",
      name: "svc-workorder-item-tasks",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-workorder-item-tasks.vue"
        )
    },
    {
      path: "/svc-workorder-item-parts",
      name: "svc-workorder-item-parts",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-workorder-item-parts.vue"
        )
    },
    {
      path: "/svc-workorder-item-part-requests",
      name: "svc-workorder-item-part-requests",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-workorder-item-part-requests.vue"
        )
    },
    {
      path: "/svc-workorder-item-labors",
      name: "svc-workorder-item-labors",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-workorder-item-labors.vue"
        )
    },
    {
      path: "/svc-workorder-item-travels",
      name: "svc-workorder-item-travels",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-workorder-item-travels.vue"
        )
    },
    {
      path: "/svc-workorder-item-expenses",
      name: "svc-workorder-item-expenses",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-workorder-item-expenses.vue"
        )
    },
    {
      path: "/svc-workorder-item-loans",
      name: "svc-workorder-item-loans",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-workorder-item-loans.vue"
        )
    },
    {
      path: "/svc-workorder-item-outside-services",
      name: "svc-workorder-item-outside-services",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-workorder-item-outside-services.vue"
        )
    },
    // ---------------------- quote ----------------------
    {
      path: "/svc-quotes",
      name: "svc-quotes",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-quotes.vue")
    },
    {
      path: "/svc-quotes/:recordid",
      name: "quote-edit",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-quote.vue")
    },
    {
      path: "/svc-quote-status",
      name: "svc-quote-status",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-quote-status.vue")
    },
    {
      path: "/svc-quote-status/:recordid",
      name: "svc-quote-status-edit",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-quote-status-edit.vue"
        )
    },
    {
      path: "/svc-quote-items",
      name: "svc-quote-items",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-quote-items.vue")
    },
    {
      path: "/svc-quote-item-units",
      name: "svc-quote-item-units",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-quote-item-units.vue")
    },
    {
      path: "/svc-quote-item-scheduled-users",
      name: "svc-quote-item-scheduled-users",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-quote-item-scheduled-users.vue"
        )
    },
    {
      path: "/svc-quote-item-tasks",
      name: "svc-quote-item-tasks",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-quote-item-tasks.vue")
    },
    {
      path: "/svc-quote-item-parts",
      name: "svc-quote-item-parts",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-quote-item-parts.vue")
    },
    {
      path: "/svc-quote-item-labors",
      name: "svc-quote-item-labors",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-quote-item-labors.vue"
        )
    },
    {
      path: "/svc-quote-item-travels",
      name: "svc-quote-item-travels",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-quote-item-travels.vue"
        )
    },
    {
      path: "/svc-quote-item-expenses",
      name: "svc-quote-item-expenses",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-quote-item-expenses.vue"
        )
    },
    {
      path: "/svc-quote-item-loans",
      name: "svc-quote-item-loans",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-quote-item-loans.vue")
    },
    {
      path: "/svc-quote-item-outside-services",
      name: "svc-quote-item-outside-services",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-quote-item-outside-services.vue"
        )
    },
    //----------------------- PM -----------------------------------
    {
      path: "/svc-pms",
      name: "svc-pms",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-pms.vue")
    },
    {
      path: "/svc-pms/:recordid",
      name: "pm-edit",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-pm.vue")
    },
    {
      path: "/svc-pm-items",
      name: "svc-pm-items",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-pm-items.vue")
    },
    {
      path: "/svc-pm-item-units",
      name: "svc-pm-item-units",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-pm-item-units.vue")
    },
    {
      path: "/svc-pm-item-scheduled-users",
      name: "svc-pm-item-scheduled-users",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-pm-item-scheduled-users.vue"
        )
    },
    {
      path: "/svc-pm-item-tasks",
      name: "svc-pm-item-tasks",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-pm-item-tasks.vue")
    },
    {
      path: "/svc-pm-item-parts",
      name: "svc-pm-item-parts",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-pm-item-parts.vue")
    },
    {
      path: "/svc-pm-item-labors",
      name: "svc-pm-item-labors",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-pm-item-labors.vue")
    },
    {
      path: "/svc-pm-item-travels",
      name: "svc-pm-item-travels",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-pm-item-travels.vue")
    },
    {
      path: "/svc-pm-item-expenses",
      name: "svc-pm-item-expenses",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-pm-item-expenses.vue")
    },
    {
      path: "/svc-pm-item-loans",
      name: "svc-pm-item-loans",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-pm-item-loans.vue")
    },
    {
      path: "/svc-pm-item-outside-services",
      name: "svc-pm-item-outside-services",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-pm-item-outside-services.vue"
        )
    },
    //---------------------------------------------------------------------
    {
      path: "/svc-units",
      name: "svc-units",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-units.vue")
    },
    {
      path: "/svc-units/:recordid",
      name: "unit-edit",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-unit.vue")
    },
    {
      path: "/svc-meter-readings/:unitid",
      name: "meter-readings",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-meter-readings.vue")
    },
    {
      path: "/svc-meter-reading/:recordid",
      name: "meter-reading",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-meter-reading.vue")
    },
    {
      path: "/svc-unit-models",
      name: "svc-unit-models",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-unit-models.vue")
    },
    {
      path: "/svc-unit-models/:recordid",
      name: "unit-model-edit",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-unit-model.vue")
    },
    {
      path: "/svc-loaners",
      name: "svc-loaners",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-loaners.vue")
    },
    {
      path: "/svc-loaners/:recordid",
      name: "loan-unit-edit",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-loaner.vue")
    },
    {
      path: "/svc-contracts",
      name: "svc-contracts",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-contracts.vue")
    },
    {
      path: "/svc-contracts/:recordid",
      name: "contract-edit",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-contract.vue")
    },
    {
      path: "/svc-projects",
      name: "svc-projects",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-projects.vue")
    },
    {
      path: "/svc-projects/:recordid",
      name: "project-edit",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-project.vue")
    },
    {
      path: "/svc-csr",
      name: "svc-csr",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-csrs.vue")
    },
    {
      path: "/svc-csr/:recordid",
      name: "csr-edit",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-csr.vue")
    },
    {
      path: "/svc-work-order-status",
      name: "svc-work-order-status",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-work-order-status.vue"
        )
    },
    {
      path: "/svc-work-order-status/:recordid",
      name: "svc-work-order-status-edit",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-work-order-status-edit.vue"
        )
    },
    {
      path: "/svc-work-order-item-status",
      name: "svc-work-order-item-status",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-work-order-item-status.vue"
        )
    },
    {
      path: "/svc-work-order-item-status/:recordid",
      name: "svc-work-order-item-status-edit",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-work-order-item-status-edit.vue"
        )
    },
    {
      path: "/svc-work-order-item-priorities",
      name: "svc-work-order-item-priorities",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-work-order-item-priorities.vue"
        )
    },
    {
      path: "/svc-work-order-item-priorities/:recordid",
      name: "svc-work-order-item-priorities-edit",
      component: () =>
        import(
          /* webpackChunkName: "svc" */ "./views/svc-work-order-item-priorities-edit.vue"
        )
    },
    {
      path: "/svc-task-groups",
      name: "svc-task-groups",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-task-groups.vue")
    },
    {
      path: "/svc-task-group/:recordid",
      name: "svc-task-group",
      component: () =>
        import(/* webpackChunkName: "svc" */ "./views/svc-task-group.vue")
    },
    //######################### INVENTORY GROUP ##############################
    {
      path: "/inv-parts",
      name: "inv-parts",
      component: () =>
        import(/* webpackChunkName: "inv" */ "./views/inv-parts.vue")
    },
    {
      path: "/inv-parts/:recordid",
      name: "inv-part",
      component: () =>
        import(/* webpackChunkName: "inv" */ "./views/inv-part.vue")
    },
    {
      path: "/inv-part-warehouses",
      name: "inv-part-warehouses",
      component: () =>
        import(/* webpackChunkName: "inv" */ "./views/inv-part-warehouses.vue")
    },
    {
      path: "/inv-part-warehouses/:recordid",
      name: "inv-part-warehouse",
      component: () =>
        import(/* webpackChunkName: "inv" */ "./views/inv-part-warehouse.vue")
    },
    {
      path: "/inv-part-serials/:recordid",
      name: "inv-part-serials",
      component: () =>
        import(/* webpackChunkName: "inv" */ "./views/inv-part-serials.vue")
    },
    {
      path: "/inv-part-stock-levels/:recordid",
      name: "inv-part-stock-levels",
      component: () =>
        import(
          /* webpackChunkName: "inv" */ "./views/inv-part-stock-levels.vue"
        )
    },
    {
      path: "/inv-part-assemblies",
      name: "inv-part-assemblies",
      component: () =>
        import(/* webpackChunkName: "inv" */ "./views/inv-part-assemblies.vue")
    },
    {
      path: "/inv-part-assemblies/:recordid",
      name: "part-assembly-edit",
      component: () =>
        import(/* webpackChunkName: "inv" */ "./views/inv-part-assembly.vue")
    },

    {
      path: "/inv-part-inventory",
      name: "inv-part-inventory",
      component: () =>
        import(/* webpackChunkName: "inv" */ "./views/inv-part-inventory.vue")
    },
    {
      path: "/inv-part-inventory-transactions",
      name: "inv-part-inventory-transactions",
      component: () =>
        import(
          /* webpackChunkName: "inv" */ "./views/inv-part-inventory-transactions.vue"
        )
    },
    {
      path: "/inv-part-adjustment",
      name: "inv-part-adjustment",
      component: () =>
        import(/* webpackChunkName: "inv" */ "./views/inv-part-adjustment.vue")
    },
    {
      path: "/inv-part-requests",
      name: "inv-part-requests",
      component: () =>
        import(/* webpackChunkName: "inv" */ "./views/inv-part-requests.vue")
    },
    // {
    //   path: "/inv-part-restocks",
    //   name: "inv-part-restocks",
    //   component: () =>
    //     import(/* webpackChunkName: "inv" */ "./views/inv-part-restocks.vue")
    // },

    {
      path: "/inv-purchase-orders",
      name: "inv-purchase-orders",
      component: () =>
        import(/* webpackChunkName: "inv" */ "./views/inv-purchase-orders.vue")
    },
    {
      path: "/inv-purchase-orders/:recordid",
      name: "inv-purchase-order",
      component: () =>
        import(/* webpackChunkName: "inv" */ "./views/inv-purchase-order.vue")
    },

    //####################### VENDORS GROUP ##############################
    {
      path: "/vendors",
      name: "vendors",
      component: () =>
        import(/* webpackChunkName: "vend" */ "./views/vendors.vue")
    },
    {
      path: "/vendors/:recordid",
      name: "vendor-edit",
      component: () =>
        import(/* webpackChunkName: "vend" */ "./views/vendor.vue")
    },
    //###################### ACCOUNTING GROUP ##########################
    {
      path: "/acc-service-rates",
      name: "service-rates",
      component: () =>
        import(/* webpackChunkName: "acc" */ "./views/acc-service-rates.vue")
    },
    {
      path: "/acc-service-rates/:recordid",
      name: "service-rate-edit",
      component: () =>
        import(/* webpackChunkName: "acc" */ "./views/acc-service-rate.vue")
    },

    {
      path: "/acc-travel-rates",
      name: "travel-rates",
      component: () =>
        import(/* webpackChunkName: "acc" */ "./views/acc-travel-rates.vue")
    },
    {
      path: "/acc-travel-rates/:recordid",
      name: "travel-rate-edit",
      component: () =>
        import(/* webpackChunkName: "acc" */ "./views/acc-travel-rate.vue")
    },
    {
      path: "/acc-tax-codes",
      name: "tax-codes",
      component: () =>
        import(/* webpackChunkName: "acc" */ "./views/acc-tax-codes.vue")
    },
    {
      path: "/acc-tax-codes/:recordid",
      name: "tax-code-edit",
      component: () =>
        import(/* webpackChunkName: "acc" */ "./views/acc-tax-code.vue")
    },
    // {
    //   path: "/acc-service-banks/:aType?/:objectId?",
    //   name: "service-banks",
    //   component: () =>
    //     import(/* webpackChunkName: "acc" */ "./views/acc-service-banks.vue")
    // },
    // {
    //   path: "/acc-service-banks/:recordid/:aType?/:objectId?",
    //   name: "service-bank-edit",
    //   component: () =>
    //     import(/* webpackChunkName: "acc" */ "./views/acc-service-bank.vue")
    // },
    //######################### ADMINISTRATION GROUP #####################################
    {
      path: "/adm-global-settings",
      name: "adm-global-settings",
      component: () =>
        import(/* webpackChunkName: "adm" */ "./views/adm-global-settings.vue")
    },
    {
      path: "/adm-global-select-templates",
      name: "adm-global-select-templates",
      component: () =>
        import(
          /* webpackChunkName: "adm" */ "./views/adm-global-select-templates.vue"
        )
    },
    {
      path: "/adm-global-seeds",
      name: "adm-global-seeds",
      component: () =>
        import(/* webpackChunkName: "adm" */ "./views/adm-global-seeds.vue")
    },
    {
      path: "/adm-global-logo",
      name: "adm-global-logo",
      component: () =>
        import(/* webpackChunkName: "adm" */ "./views/adm-global-logo.vue")
    },
    {
      path: "/adm-license",
      name: "adm-license",
      component: () =>
        import(/* webpackChunkName: "adm" */ "./views/adm-license.vue")
    },
    {
      path: "/adm-users",
      name: "adm-users",
      component: () =>
        import(/* webpackChunkName: "adm" */ "./views/adm-users.vue")
    },
    {
      path: "/adm-users/:recordid",
      name: "adm-user",
      component: () =>
        import(/* webpackChunkName: "adm" */ "./views/adm-user.vue")
    },
    {
      path: "/adm-translations",
      name: "adm-translations",
      component: () =>
        import(/* webpackChunkName: "adm" */ "./views/adm-translations.vue")
    },
    {
      path: "/adm-translations/:recordid",
      name: "adm-translation",
      component: () =>
        import(/* webpackChunkName: "adm" */ "./views/adm-translation.vue")
    },

    {
      path: "/adm-report-templates",
      name: "adm-report-templates",
      component: () =>
        import(/* webpackChunkName: "adm" */ "./views/adm-report-templates.vue")
    },
    {
      path: "/report-edit/:recordid", //Route to edit a report template
      name: "ay-report-edit",
      component: () =>
        import(
          //it gets it's own chunk name because it's huge and rarely used
          /* webpackChunkName: "ay-report-edit" */ "./views/ay-report-edit.vue"
        )
    },
    {
      path: "/adm-attachments",
      name: "adm-attachments",
      component: () =>
        import(/* webpackChunkName: "adm" */ "./views/adm-attachments.vue")
    },

    {
      path: "/adm-history",
      name: "adm-history",
      component: () =>
        import(/* webpackChunkName: "adm" */ "./views/adm-history.vue")
    },
    {
      path: "/adm-import",
      name: "adm-import",
      component: () =>
        import(/* webpackChunkName: "adm" */ "./views/adm-import.vue")
    },
    {
      path: "/adm-integrations",
      name: "adm-integrations",
      component: () =>
        import(/* webpackChunkName: "adm" */ "./views/adm-integrations.vue")
    },
    {
      path: "/adm-integrations/:recordid",
      name: "adm-integration",
      component: () =>
        import(/* webpackChunkName: "adm" */ "./views/adm-integration.vue")
    },

    //########################## OPERATIONS GROUP ############################
    {
      path: "/ops-backup",
      name: "ops-backup",
      component: () =>
        import(/* webpackChunkName: "ops" */ "./views/ops-backup.vue")
    },

    {
      path: "/ops-server-state",
      name: "ops-server-state",
      component: () =>
        import(/* webpackChunkName: "ops" */ "./views/ops-server-state.vue")
    },

    {
      path: "/ops-jobs",
      name: "ops-jobs",
      component: () =>
        import(/* webpackChunkName: "ops" */ "./views/ops-jobs.vue")
    },

    {
      path: "/ops-log",
      name: "ops-log",
      component: () =>
        import(/* webpackChunkName: "ops" */ "./views/ops-log.vue")
    },
    {
      path: "/ops-view-configuration",
      name: "ops-view-configuration",
      component: () =>
        import(
          /* webpackChunkName: "ops" */ "./views/ops-view-configuration.vue"
        )
    },

    {
      path: "/ops-metrics",
      name: "ops-metrics",
      component: () =>
        import(/* webpackChunkName: "ops" */ "./views/ops-metrics.vue")
    },
    {
      path: "/ops-profile",
      name: "ops-profile",
      component: () =>
        import(/* webpackChunkName: "ops" */ "./views/ops-profile.vue")
    },
    {
      path: "/ops-notify-queue",
      name: "ops-notify-queue",
      component: () =>
        import(/* webpackChunkName: "ops" */ "./views/ops-notify-queue.vue")
    },
    {
      path: "/ops-notification-settings",
      name: "ops-notification-settings",
      component: () =>
        import(
          /* webpackChunkName: "ops" */ "./views/ops-notification-settings.vue"
        )
    },
    {
      path: "/ops-notify-log",
      name: "ops-notify-log",
      component: () =>
        import(/* webpackChunkName: "ops" */ "./views/ops-notify-log.vue")
    },
    {
      path: "/ops-customer-notify-log",
      name: "ops-customer-notify-log",
      component: () =>
        import(
          /* webpackChunkName: "ops" */ "./views/ops-customer-notify-log.vue"
        )
    },

    //######################### CUSTOMER USER GROUP ######################################
    {
      path: "/customer-workorders",
      name: "customer-workorders",
      component: () =>
        import(
          /* webpackChunkName: "customer" */ "./views/customer-workorders.vue"
        )
    },
    {
      path: "/customer-workorders/:recordid",
      name: "customer-workorder-edit",
      component: () =>
        import(
          /* webpackChunkName: "customer" */ "./views/customer-workorder.vue"
        )
    },
    {
      path: "/customer-csr",
      name: "customer-csr",
      component: () =>
        import(/* webpackChunkName: "customer" */ "./views/customer-csr.vue")
    },
    {
      path: "/customer-csr/:recordid",
      name: "customer-csr-edit",
      component: () =>
        import(
          /* webpackChunkName: "customer" */ "./views/customer-csr-edit.vue"
        )
    },

    //##############################  SPECIAL ROUTES ###############################

    {
      path: "/ay-evaluate",
      name: "ay-evaluate",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/ay-evaluate.vue")
    },
    {
      //No rights - happens when customer user logs in without access to anything at all due to configuration not allowing it
      path: "/no-features-available",
      name: "no-features-available",
      component: () =>
        import(
          /* webpackChunkName: "ay-common" */ "./views/nofeaturesavailable.vue"
        )
    },
    {
      //404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404
      path: "*",
      name: "notfound",
      component: () =>
        import(/* webpackChunkName: "ay-common" */ "./views/notfound.vue")
    }
  ]
});
