{"version":3,"file":"home-mcuKaqhl.js","sources":["../../../app/frontend/entrypoints/controllers/teams/home/home.ts"],"sourcesContent":["import Utils from \"../../../utils\";\nimport Swal from 'sweetalert2';\nimport * as bootstrap from 'bootstrap'\nimport DefaultController from \"../../defaultController\";\n\n\nexport default class TeamsHome extends DefaultController {\n private absenceModal: any;\n private absenceTable: any\n private tableElem: any;\n\n async init() {\n this.entity = \"absences\"\n this.tableElem = jQuery(\".teams_home_absences_pending\")\n this.tableElem.delegate(\".delete-record\", \"click\", async (e: any) => {const confirm = await Swal.fire({\n title: 'Are you sure?',\n text: \"You won't be able to revert this!\",\n icon: 'warning',\n showCancelButton: true,\n confirmButtonText: 'Yes, delete it!',\n customClass: {\n confirmButton: 'btn btn-primary me-3',\n cancelButton: 'btn btn-label-secondary'\n },\n buttonsStyling: false\n })\n if(confirm.value === true) {\n const id = e.currentTarget.getAttribute(\"data-id\")\n const r = await Utils.entity.destroy(id, this.entity)\n if (r.status === 200) {\n this.toastr.success(`${Utils.translate('absence.name')} ${Utils.translate('generic.deleted')}`, `${Utils.translate('generic.success')}`)\n } else {\n this.toastr.error(`${Utils.translate('absence.name')} ${Utils.translate('generic.messages.not_deleted')}`, `${Utils.translate('generic.error')}`)\n }\n await this.request(\"\")\n console.log(\"this.absenceTable\", this.absenceTable)\n }\n });\n this.setupEventListeners();\n\n await this.setupDatatables();\n await this.request(\"\");\n this.bindListeners()\n Utils.hideLoader()\n }\n\n protected bindListeners() {\n }\n\n setupDatatables() {\n let columns = [\n {data: 'from'},\n {data: 'to'},\n {data: 'name'},\n {data: 'uuid'}\n ];\n let columnDefs = [\n {\n targets: 0,\n render: (data: any, type: any, full: any, meta: any) => {\n return `
${new Date(Date.parse(data)).toLocaleDateString()}`;\n },\n },\n {\n targets: 1,\n render: (data: any, type: any, full: any, meta: any) => {\n return ` ${new Date(Date.parse(data)).toLocaleDateString()}`;\n },\n },\n {\n targets: 2,\n render: (data: any, type: any, full: any, meta: any) => {\n return full.absence_mode.name\n },\n },\n {\n targets: 3,\n searchable: false,\n orderable: false,\n render: (data: any, type: any, full: any, meta: any) => {\n if (full.status === \"NEW\" || (window.activeUser && window.activeUser.role === \"admin\")) {\n return `