TimeTrex/interface/html5/dist/attendance-schedule-ScheduleShiftViewController.bundle.js

1 line
114 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["attendance-schedule-ScheduleShiftViewController"],{2509:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ScheduleShiftViewController\": () => (/* binding */ ScheduleShiftViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass ScheduleShiftViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#schedule_shift_view_container',\n\n\n\t\t\tschedule_status_array: null,\n\n\t\t\tuser_status_array: null,\n\n\t\t\tuser_group_array: null,\n\n\t\t\tuser_api: null,\n\t\t\tuser_group_api: null,\n\t\t\tdate_api: null,\n\t\t\tabsence_policy_api: null,\n\n\t\t\tjob_api: null,\n\t\t\tjob_item_api: null,\n\t\t\tdepartment_api: null,\n\t\t\tdefault_punch_tag: [],\n\t\t\tprevious_punch_tag_selection: [],\n\n\t\t\ttotal_time: null,\n\t\t\tpre_total_time: 0,\n\n\t\t\tis_mass_adding: false\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit( options ) {\n\t\t//this._super('initialize', options );\n\t\tthis.edit_view_tpl = 'ScheduleShiftEditView.html';\n\t\tthis.permission_id = 'schedule';\n\t\tthis.viewId = 'ScheduleShift';\n\t\tthis.script_name = 'ScheduleShiftView';\n\t\tthis.table_name_key = 'schedule';\n\t\tthis.context_menu_name = $.i18n._( 'Schedule Shift' );\n\t\tthis.navigation_label = $.i18n._( 'Schedule' );\n\t\tthis.api = TTAPI.APISchedule;\n\t\tthis.absence_policy_api = TTAPI.APIAbsencePolicy;\n\t\tthis.user_api = TTAPI.APIUser;\n\t\tthis.user_group_api = TTAPI.APIUserGroup;\n\n\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\tthis.job_api = TTAPI.APIJob;\n\t\t\tthis.job_item_api = TTAPI.APIJobItem;\n\t\t\tthis.punch_tag_api = TTAPI.APIPunchTag;\n\t\t\tthis.department_api = TTAPI.APIDepartment;\n\t\t}\n\n\t\tthis.date_api = TTAPI.APITTDate;\n\n\t\tthis.initPermission();\n\t\tthis.render();\n\t\tthis.buildContextMenu();\n\n\t\tthis.initData();\n\t}\n\n\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\texclude: ['copy'],\n\t\t\tinclude: []\n\t\t};\n\n\t\treturn context_menu_model;\n\t}\n\n\tonSaveClick( ignoreWarning ) {\n\t\t// this function will shortly be deprecated and replaced by BaseViewController.onViewClick(), but this intermediatiary step of reorganizing the code\n\t\t// is to help debug in future by seeing how the current function was updated to match baseview.\n\t\t// initially, the code looped over all the mass edit records, and then for each record, it would loop over the changed fields and set them on that record.\n\t\t// instead, we will now just loop over the changed fields once, and then loop over the mass edit records, cloning this changed set of fields.\n\t\t// The clone itself is probably yet another loop internally, but this at least makes it easier to read and also allows the merge to use the common base view controller function.\n\n\t\tvar $this = this;\n\t\tvar record;\n\t\tif ( this.is_mass_editing ) {\n\t\t\trecord = [];\n\n\t\t\t// loop over all fields on the form, and track the ones that have changed\n\t\t\tvar mass_record_shared = {};\n\t\t\tfor ( var key in this.edit_view_ui_dic ) {\n\n\t\t\t\tif ( !this.edit_view_ui_dic.hasOwnProperty( key ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tvar widget = this.edit_view_ui_dic[key];\n\t\t\t\tif ( Global.isSet( widget.isChecked ) ) {\n\t\t\t\t\tif ( widget.isChecked() && widget.getEnabled() ) {\n\t\t\t\t\t\tmass_record_shared[key] = widget.getValue();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// loop over all the selected id's for the mass edit, and apply a copy of the changed fields to each\n\n\t\t\tfor ( var i = 0; i < this.mass_edit_record_ids.length; i++ ) {\n\t\t\t\t//create new copy of the fields that have changed.\n\t\t\t\tvar mass_record_single = Global.clone( mass_record_shared );\n\t\t\t\tmass_record_single['id'] = $