Minor: Format code + remove unnecessary code

pull/4870/head
Angel Fernando Quiroz Campos 1 year ago
parent 04d2b5ee62
commit aa222e720e
  1. 446
      assets/vue/main.js

@ -1,304 +1,246 @@
import { createApp } from 'vue'; import { createApp } from "vue"
import App from './App.vue'; import App from "./App.vue"
import i18n from './i18n'; import i18n from "./i18n"
import router from './router'; import router from "./router"
import store from './store'; import store from "./store"
import axios from 'axios' import axios from "axios"
import { createPinia } from 'pinia'; import { createPinia } from "pinia"
// Services. // Services.
import courseCategoryService from "./services/coursecategory"
import documentsService from "./services/documents"
import courseService from "./services/course"
import personalFileService from "./services/personalfile"
import resourceLinkService from "./services/resourcelink"
import resourceNodeService from "./services/resourcenode"
import messageService from "./services/message"
import messageAttachmentService from "./services/messageattachment"
import messageRelUserService from "./services/messagereluser"
import messageTagService from "./services/messagetag"
import userService from "./services/user"
import userGroupService from "./services/usergroup"
import userRelUserService from "./services/userreluser"
import calendarEventService from "./services/ccalendarevent"
import toolIntroService from "./services/ctoolintro"
import pageService from "./services/page"
import pageCategoryService from "./services/pagecategory"
import sessionService from "./services/session"
import socialPostService from "./services/socialpost"
import makeCrudModule from "./store/modules/crud"
import VueFlatPickr from "vue-flatpickr-component"
import "flatpickr/dist/flatpickr.css"
import "@mdi/font/css/materialdesignicons.css"
import DashboardLayout from "./components/layout/DashboardLayout.vue"
import EmptyLayout from "./components/layout/EmptyLayout.vue"
// Tinymce
import Editor from "./components/Editor"
import courseCategoryService from './services/coursecategory'; // Prime
import documentsService from './services/documents'; import PrimeVue from "primevue/config"
import courseService from './services/course'; import DataView from "primevue/dataview"
import personalFileService from './services/personalfile'; import DataTable from "primevue/datatable"
import resourceLinkService from './services/resourcelink'; import Dropdown from "primevue/dropdown"
import resourceNodeService from './services/resourcenode'; import Toolbar from "primevue/toolbar"
import messageService from './services/message'; import DataViewLayoutOptions from "primevue/dataviewlayoutoptions"
import messageAttachmentService from './services/messageattachment';
import messageRelUserService from './services/messagereluser'; import Dialog from "primevue/dialog"
import messageTagService from "./services/messagetag"; import InputText from "primevue/inputtext"
import userService from './services/user'; import Button from "primevue/button"
import userGroupService from './services/usergroup'; import Column from "primevue/column"
import userRelUserService from './services/userreluser'; import ColumnGroup from "primevue/columngroup"
import calendarEventService from './services/ccalendarevent'; import ToastService from "primevue/toastservice"
import toolIntroService from './services/ctoolintro'; import ConfirmationService from "primevue/confirmationservice"
import pageService from './services/page';
import pageCategoryService from './services/pagecategory'; import "primevue/resources/primevue.min.css"
import sessionService from './services/session'; // import 'primeflex/primeflex.css';
import socialPostService from './services/socialpost'; import "primeicons/primeicons.css"
import Alpine from "alpinejs"
import makeCrudModule from './store/modules/crud';
//import vuetify from './plugins/vuetify' // path to vuetify export
//require('@fancyapps/fancybox');
//require('@fancyapps/fancybox/dist/jquery.fancybox.css');
//Vue.use(Vuelidate);
import Toast from 'vue-toastification';
//import 'vue-toastification/dist/index.css';
const toastOptions = {
transition: 'Vue-Toastification__fade',
maxToasts: 20,
newestOnTop: true
};
import VueFlatPickr from 'vue-flatpickr-component';
import 'flatpickr/dist/flatpickr.css';
// @todo move in a file: // @todo move in a file:
store.registerModule( store.registerModule(
'course', "course",
makeCrudModule({ makeCrudModule({
service: courseService service: courseService,
}) }),
); )
store.registerModule( store.registerModule(
'coursecategory', "coursecategory",
makeCrudModule({ makeCrudModule({
service: courseCategoryService service: courseCategoryService,
}) }),
); )
store.registerModule( store.registerModule(
'documents', "documents",
makeCrudModule({ makeCrudModule({
service: documentsService service: documentsService,
}) }),
); )
store.registerModule( store.registerModule(
'ccalendarevent', "ccalendarevent",
makeCrudModule({ makeCrudModule({
service: calendarEventService service: calendarEventService,
}) }),
); )
store.registerModule( store.registerModule(
'ctoolintro', "ctoolintro",
makeCrudModule({ makeCrudModule({
service: toolIntroService service: toolIntroService,
}) }),
); )
store.registerModule( store.registerModule(
'page', "page",
makeCrudModule({ makeCrudModule({
service: pageService service: pageService,
}) }),
); )
store.registerModule( store.registerModule(
'pagecategory', "pagecategory",
makeCrudModule({ makeCrudModule({
service: pageCategoryService service: pageCategoryService,
}) }),
); )
store.registerModule( store.registerModule(
'session', "session",
makeCrudModule({ makeCrudModule({
service: sessionService service: sessionService,
}) }),
); )
store.registerModule( store.registerModule(
'personalfile', "personalfile",
makeCrudModule({ makeCrudModule({
service: personalFileService service: personalFileService,
}) }),
); )
store.registerModule( store.registerModule(
'resourcelink', "resourcelink",
makeCrudModule({ makeCrudModule({
service: resourceLinkService service: resourceLinkService,
}) }),
); )
store.registerModule( store.registerModule(
'resourcenode', "resourcenode",
makeCrudModule({ makeCrudModule({
service: resourceNodeService service: resourceNodeService,
}) }),
); )
store.registerModule( store.registerModule(
'message', "message",
makeCrudModule({ makeCrudModule({
service: messageService service: messageService,
}) }),
); )
store.registerModule( store.registerModule(
'messageattachment', "messageattachment",
makeCrudModule({ makeCrudModule({
service: messageAttachmentService service: messageAttachmentService,
}) }),
); )
store.registerModule( store.registerModule(
'messagereluser', "messagereluser",
makeCrudModule({ makeCrudModule({
service: messageRelUserService service: messageRelUserService,
}) }),
); )
store.registerModule( store.registerModule(
'messagetag', "messagetag",
makeCrudModule({ makeCrudModule({
service: messageTagService service: messageTagService,
}) }),
); )
store.registerModule( store.registerModule(
'userreluser', "userreluser",
makeCrudModule({ makeCrudModule({
service: userRelUserService service: userRelUserService,
}) }),
); )
store.registerModule( store.registerModule(
'user', "user",
makeCrudModule({ makeCrudModule({
service: userService service: userService,
}) }),
); )
store.registerModule( store.registerModule(
'usergroup', "usergroup",
makeCrudModule({ makeCrudModule({
service: userGroupService service: userGroupService,
}) }),
); )
store.registerModule( store.registerModule(
'socialpost', "socialpost",
makeCrudModule({ makeCrudModule({
service: socialPostService service: socialPostService,
}) }),
); )
// Vuetify.
import '@mdi/font/css/materialdesignicons.css';
//import 'vuetify/styles'
import { createVuetify } from 'vuetify';
import { aliases, mdi } from 'vuetify/lib/iconsets/mdi'
const options = {
// components,
// directives,
defaults: {
global: {
ripple: false,
},
VSheet: {
elevation: 4,
},
},
icons: {
defaultSet: 'mdi',
aliases,
sets: {
mdi,
}
},
theme: {
defaultTheme: 'light'
},
}
const vuetify = createVuetify(options);
import DashboardLayout from './components/layout/DashboardLayout.vue'
import EmptyLayout from './components/layout/EmptyLayout.vue'
// Vue setup. // Vue setup.
const app = createApp(App); const app = createApp(App)
// Quasar app.use(ToastService)
import { Quasar } from 'quasar' app.use(ConfirmationService)
import quasarUserOptions from './quasar-user-options' app.component("Dialog", Dialog)
app.component("DataView", DataView)
// Tinymce app.component("DataTable", DataTable)
import Editor from './components/Editor'; app.component("Dropdown", Dropdown)
app.component("DataViewLayoutOptions", DataViewLayoutOptions)
// Prime app.component("InputText", InputText)
import PrimeVue from 'primevue/config' app.component("Button", Button)
import DataView from 'primevue/dataview'; app.component("Column", Column)
import DataTable from 'primevue/datatable'; app.component("ColumnGroup", ColumnGroup)
import Dropdown from 'primevue/dropdown'; app.component("Toolbar", Toolbar)
import Toolbar from 'primevue/toolbar'; app.component("DashboardLayout", DashboardLayout)
import DataViewLayoutOptions from 'primevue/dataviewlayoutoptions'; app.component("EmptyLayout", EmptyLayout)
app.component("TinyEditor", Editor)
import Dialog from 'primevue/dialog';
import InputText from 'primevue/inputtext'; app.config.globalProperties.axios = axios
import Button from 'primevue/button';
import Column from 'primevue/column';
import ColumnGroup from 'primevue/columngroup';
import ToastService from 'primevue/toastservice';
import ConfirmationService from 'primevue/confirmationservice';
import 'primevue/resources/primevue.min.css';
// import 'primeflex/primeflex.css';
import "primeicons/primeicons.css";
app.use(ToastService);
app.use(ConfirmationService);
app.component('Dialog', Dialog);
app.component('DataView', DataView);
app.component('DataTable', DataTable);
app.component('Dropdown', Dropdown);
app.component('DataViewLayoutOptions', DataViewLayoutOptions);
app.component('InputText', InputText);
app.component('Button', Button);
app.component('Column', Column);
app.component('ColumnGroup', ColumnGroup);
app.component('Toolbar', Toolbar);
app.component('DashboardLayout', DashboardLayout);
app.component('EmptyLayout', EmptyLayout);
app.component('TinyEditor', Editor);
app.config.globalProperties.axios = axios;
app.config.globalProperties.window = window app.config.globalProperties.window = window
const prettyBytes = require('pretty-bytes');
const { DateTime } = require("luxon"); const prettyBytes = require("pretty-bytes")
const { DateTime } = require("luxon")
app.config.globalProperties.$filters = { app.config.globalProperties.$filters = {
/** /**
* @param {string} datetime * @param {string} datetime
* @returns {string} * @returns {string}
*/ */
abbreviatedDatetime(datetime) { abbreviatedDatetime(datetime) {
return DateTime.fromISO(datetime).toLocaleString({ ...DateTime.DATETIME_MED, month: 'long' }); return DateTime.fromISO(datetime).toLocaleString({ ...DateTime.DATETIME_MED, month: "long" })
}, },
/** /**
* @param {string} datetime * @param {string} datetime
* @returns {string} * @returns {string}
*/ */
relativeDatetime(datetime) { relativeDatetime(datetime) {
return DateTime.fromISO(datetime).toRelative(); return DateTime.fromISO(datetime).toRelative()
}, },
prettyBytes, prettyBytes,
} }
import Alpine from 'alpinejs'
window.Alpine = Alpine window.Alpine = Alpine
Alpine.start(); Alpine.start()
const pinia = createPinia(); const pinia = createPinia()
app app.use(PrimeVue, { ripple: false }).use(VueFlatPickr).use(router).use(store).use(pinia).use(i18n)
.use(PrimeVue, {ripple: false})
.use(Quasar, quasarUserOptions) app.mount("#app")
.use(VueFlatPickr)
//.use(VuelidatePlugin)
// .use(vuetify)
.use(router)
.use(store)
.use(pinia)
.use(i18n)
.use(Toast, toastOptions)
;
app.mount('#app');

Loading…
Cancel
Save