diff --git a/src/plugins/schedule/components/management/CreateEvent.vue b/src/plugins/schedule/components/management/CreateEvent.vue new file mode 100644 index 0000000..7be95b0 --- /dev/null +++ b/src/plugins/schedule/components/management/CreateEvent.vue @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/plugins/schedule/components/management/Eventtypes.vue b/src/plugins/schedule/components/management/Eventtypes.vue new file mode 100644 index 0000000..b92f7ec --- /dev/null +++ b/src/plugins/schedule/components/management/Eventtypes.vue @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/plugins/schedule/components/management/JobTypes.vue b/src/plugins/schedule/components/management/JobTypes.vue new file mode 100644 index 0000000..8f952d0 --- /dev/null +++ b/src/plugins/schedule/components/management/JobTypes.vue @@ -0,0 +1,131 @@ + + + + + + Editere Diensttyp {{ actualJob.name }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/plugins/schedule/pages/Mainpage.vue b/src/plugins/schedule/pages/Mainpage.vue new file mode 100644 index 0000000..6edbb33 --- /dev/null +++ b/src/plugins/schedule/pages/Mainpage.vue @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + diff --git a/src/plugins/schedule/pages/Management.vue b/src/plugins/schedule/pages/Management.vue new file mode 100644 index 0000000..05b65d1 --- /dev/null +++ b/src/plugins/schedule/pages/Management.vue @@ -0,0 +1,99 @@ + + + + + + + + + + + + {{ tabindex.label }} + + + + + + + + + + + + + + + + + + + + diff --git a/src/plugins/schedule/pages/Overview.vue b/src/plugins/schedule/pages/Overview.vue new file mode 100644 index 0000000..b64ab3f --- /dev/null +++ b/src/plugins/schedule/pages/Overview.vue @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/plugins/schedule/pages/Requests.vue b/src/plugins/schedule/pages/Requests.vue new file mode 100644 index 0000000..b64ab3f --- /dev/null +++ b/src/plugins/schedule/pages/Requests.vue @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/plugins/schedule/permissions.ts b/src/plugins/schedule/permissions.ts new file mode 100644 index 0000000..6f47772 --- /dev/null +++ b/src/plugins/schedule/permissions.ts @@ -0,0 +1,12 @@ +export const PERMISSIONS = { + // Kann andere Nutzer bearbeiten + EDIT_OTHER: 'users_edit_other', + // Kann Rollen von Nutzern setzen + SET_ROLES: 'users_set_roles', + // Kann Nutzer löschen + DELETE: 'users_delete_other', + // Kann neue Nutzer hinzufügen + REGISTER: 'users_register', + // Kann Rollen löschen oder bearbeiten, z.b. Rechte hinzufügen etc + ROLES_EDIT: 'roles_edit' +}; diff --git a/src/plugins/schedule/plugin.ts b/src/plugins/schedule/plugin.ts index 8565d4c..4ff59b1 100644 --- a/src/plugins/schedule/plugin.ts +++ b/src/plugins/schedule/plugin.ts @@ -1,10 +1,16 @@ import { FG_Plugin } from 'src/plugins'; +import mainRoutes from './routes'; +import store from './store/schedule'; +import { Module } from 'vuex'; +import { StateInterface } from 'src/store'; const plugin: FG_Plugin.Plugin = { name: 'Schedule', - requiredModules: [], + mainRoutes, + requiredModules: ['User'], requiredBackendModules: ['schedule'], version: '0.0.1', + store: new Map>([['schedule', store]]), widgets: [ { priority: 0, diff --git a/src/plugins/schedule/routes/index.ts b/src/plugins/schedule/routes/index.ts new file mode 100644 index 0000000..5a02182 --- /dev/null +++ b/src/plugins/schedule/routes/index.ts @@ -0,0 +1,63 @@ +import { FG_Plugin } from 'src/plugins'; + +/*const permissions = { + // Show own and others balance + SHOW: 'balance_show', + SHOW_OTHER: 'balance_show_others', + // Credit balance (give) + CREDIT: 'balance_credit', + // Debit balance (take) + DEBIT: 'balance_debit', + // Debit own balance only + DEBIT_OWN: 'balance_debit_own', + // Send from to other + SEND: 'balance_send', + // Send from other to another + SEND_OTHER: 'balance_send_others', + // Can set limit for users + SET_LIMIT: 'balance_set_limit', + //Allow sending / sub while exceeding the set limit + EXCEED_LIMIT: 'balance_exceed_limit' +};*/ + +const mainRoutes: FG_Plugin.PluginRouteConfig[] = [ + { + title: 'Dienste', + icon: 'mdi-briefcase', + path: 'schedule', + name: 'schedule', + component: () => import('../pages/MainPage.vue'), + meta: { permissions: ['user'] }, + children: [ + { + title: 'Dienstübersicht', + icon: 'mdi-account-group', + path: 'schedule-overview', + name: 'schedule-overview', + shortcut: true, + meta: { permissions: [] }, + component: () => import('../pages/Overview.vue') + }, + { + title: 'Dienstverwaltung', + icon: 'mdi-account-details', + path: 'schedule-management', + name: 'schedule-management', + shortcut: false, + meta: { permissions: [] }, + component: () => import('../pages/Management.vue') + }, + { + title: 'Dienstanfragen', + icon: 'mdi-account-switch', + path: 'schedule-requests', + name: 'schedule-requests', + shortcut: false, + meta: { permissions: [] }, + component: () => import('../pages/Requests.vue') + } + ] + } +]; + +export default mainRoutes; diff --git a/src/plugins/schedule/store/schedule.ts b/src/plugins/schedule/store/schedule.ts new file mode 100644 index 0000000..5df9273 --- /dev/null +++ b/src/plugins/schedule/store/schedule.ts @@ -0,0 +1,102 @@ +import { Module, MutationTree, ActionTree, GetterTree } from 'vuex'; +import { StateInterface } from 'src/store'; +import { axios } from 'src/boot/axios'; +import { AxiosResponse } from 'axios'; + +export interface JobType { + id: number; + name: string; +} + +export interface ScheduleInterface { + jobTypes: JobType[]; +} + +// export interface StateInterfaceSchedule extends StateInterface { +// // balance: BalanceInterface; +// } + +const state: ScheduleInterface = { + jobTypes: [] +}; + +const mutations: MutationTree = { + setJobTypes(state, jobTypes: JobType[]) { + state.jobTypes = jobTypes; + }, + addJobType(state, jobType: JobType) { + state.jobTypes.unshift(jobType); + }, + removeJobType(state, id: number) { + const index = state.jobTypes.findIndex(item => item.id == id); + state.jobTypes.splice(index, 1); + }, + setJobType(state, jobType: JobType) { + const _jobtype = state.jobTypes.find(item => item.id == jobType.id); + if (_jobtype) { + _jobtype.name = jobType.name; + } + } +}; + +const actions: ActionTree = { + getJobTypes({ commit }) { + axios + .get('/schedule/job-types') + .then((response: AxiosResponse) => { + console.log('action:', response.data); + commit('setJobTypes', response.data); + }) + .catch(err => { + console.warn(err); + }); + }, + + addJobType({ commit }, data) { + axios + .post('/schedule/job-types', data) + .then((response: AxiosResponse) => { + commit('addJobType', response.data); + }) + .catch(err => { + console.warn(err); + }); + }, + removeJobType({ commit }, data: number) { + axios + .delete(`/schedule/job-types/${data}`) + .then(() => { + commit('removeJobType', data); + }) + .catch(err => { + console.warn(err); + }); + }, + + changeJobTypeName({ commit }, jobtype: JobType) { + axios + .put(`/schedule/job-types/${jobtype.id}`, jobtype) + .then(() => { + commit('setJobType', jobtype); + }) + .catch(err => { + console.warn(err); + }); + } +}; + +const getters: GetterTree = { + jobTypes(state) { + return state.jobTypes; + } +}; + +const schedule: Module = { + namespaced: true, + state, + mutations, + actions, + getters +}; + +export default schedule;