Introduced DepartmentVariables object for managing department-specific variables. Enhanced the time bookings user interface with a new calendar using FullCalendar and added routing for department modules setup. Updated admin menus and permissions for better module accessibility.
113 lines
2.8 KiB
Vue
113 lines
2.8 KiB
Vue
<script>
|
|
import Swal from "sweetalert2";
|
|
import { authenticatedRequest } from "@/components/session/authenticatedRequest.vue";
|
|
import { ObjectsGlobal } from "@/components/session/token/SessionUser/Objects/ObjectsGlobal.vue";
|
|
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
|
import {ref} from "vue";
|
|
|
|
/**
|
|
* The DepartmentVariables object
|
|
*/
|
|
export const DepartmentVariables = {
|
|
meta: {
|
|
title: "Afdelingsvariabler",
|
|
icon: "fas fa-list",
|
|
description: "Oversigt over afdelingsvariabler",
|
|
endpoint: "/superuser/department/variables",
|
|
labels: {
|
|
single: "variabel",
|
|
multiple: "variabler"
|
|
}
|
|
},
|
|
columns: {
|
|
id: {
|
|
label: "ID",
|
|
type: "number",
|
|
sortable: true,
|
|
creation: {
|
|
required: false
|
|
}
|
|
},
|
|
department_id: {
|
|
label: "Afdeling",
|
|
type: "select",
|
|
sortable: true,
|
|
creation: {
|
|
required: true
|
|
},
|
|
options: async () => {
|
|
return SessionUser.objects.departments.get.all();
|
|
}
|
|
},
|
|
variable: {
|
|
label: "Variabel",
|
|
type: "string",
|
|
sortable: true,
|
|
creation: {
|
|
required: true
|
|
}
|
|
},
|
|
value: {
|
|
label: "Værdi",
|
|
type: "string",
|
|
sortable: true,
|
|
creation: {
|
|
required: true
|
|
}
|
|
},
|
|
},
|
|
add: async (department_id, variable, value) => {
|
|
return ObjectsGlobal.add.object(
|
|
DepartmentVariables.meta.endpoint,
|
|
{
|
|
department_id: parseInt(department_id),
|
|
variable: variable,
|
|
value: value
|
|
}
|
|
);
|
|
},
|
|
set: {},
|
|
get: {
|
|
all: async () => {
|
|
return ObjectsGlobal.get.objects(DepartmentVariables.meta.endpoint);
|
|
},
|
|
single: async (id) => {
|
|
return ObjectsGlobal.get.object(DepartmentVariables.meta.endpoint, id);
|
|
},
|
|
},
|
|
delete: async (id) => {
|
|
return ObjectsGlobal.delete.object(DepartmentVariables.meta.endpoint, id);
|
|
},
|
|
functions: {
|
|
showDeleteObjectForm: (id, onAfterSubmit = null) => {
|
|
return ObjectsGlobal.showDeleteObjectForm(DepartmentVariables, id, onAfterSubmit);
|
|
},
|
|
},
|
|
/**
|
|
* Show the create object form
|
|
* @param onAfterSubmit
|
|
* @param lockedValues
|
|
* @returns {Promise<SweetAlertResult<Awaited<any>>>}
|
|
*/
|
|
showCreateObjectForm: (onAfterSubmit = null, lockedValues = {}) => {
|
|
return ObjectsGlobal.showCreateObjectForm(DepartmentVariables, onAfterSubmit, lockedValues);
|
|
},
|
|
/**
|
|
* Show the edit object field form
|
|
* @param id
|
|
* @param column
|
|
* @param value
|
|
* @param onAfterSubmit
|
|
* @returns {Promise<SweetAlertResult<Awaited<any>>>}
|
|
*/
|
|
showEditObjectFieldForm: (id, column, value, onAfterSubmit = null) => {
|
|
return ObjectsGlobal.showEditObjectFieldForm(
|
|
DepartmentVariables,
|
|
id,
|
|
column,
|
|
value,
|
|
onAfterSubmit
|
|
);
|
|
}
|
|
};
|
|
</script> |