TimeTrex/interface/html5/dist/attendance-map-MapViewController.bundle.js

1 line
89 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["attendance-map-MapViewController","leaflet-timetrex"],{6638:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"MapViewController\": () => (/* binding */ MapViewController)\n/* harmony export */ });\n/* harmony import */ var _framework_leaflet_leaflet_timetrex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6889);\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\n/* provided dependency */ var jQuery = __webpack_require__(9755);\n// TODO: This file needs cleaning up of old functions once the Map is known to be stable\n// and that we are certain the old code is no longer needed\n\n\nclass MapViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#map_view_container',\n\t\t\t// _required_files: {\n\t\t\t// \t15: ['leaflet-timetrex']\n\t\t\t// },\n\t\t\tcolors: [\n\t\t\t\t{ name: 'red', value: '#c0392b' },\n\t\t\t\t{ name: 'orange', value: '#d35400' },\n\t\t\t\t{ name: 'yellow', value: '#f39c12' },\n\t\t\t\t{ name: 'green', value: '#16a085' },\n\t\t\t\t{ name: 'lightblue', value: '#27ae60' },\n\t\t\t\t{ name: 'blue', value: '#2980b9' },\n\t\t\t\t{ name: 'purple', value: '#8e44ad' }\n\t\t\t],\n\t\t\tmoved_unsaved_markers: null, // type object as its an array with named keys\n\t\t\tpunches_dic: {},\n\t\t\tpunch_api: null,\n\t\t\tlayers: null,\n\t\t\tcircle_layers: null,\n\t\t\tdisplay_mode: null,\n\t\t\tgeo_labels: null,\n\t\t\tzoom_changed_timer: null,\n\t\t\tdragend_timer: null,\n\t\t\tpopups: [],\n\t\t\tinfo_panel_dic: {},\n\t\t\tmap_control: null,\n\t\t\tsearch_typing_delay: 0,\n\t\t\tstop_suggestions: false,\n\t\t\tmap_last_bounds: null,\n\t\t\tgeofence_filters: null,\n\t\t\tdistances_grid: null,\n\t\t\tcalculatedRouteData: null,\n\n\t\t\t// General page build section\n\t\t\t// -----------------------------------------------------------------------\n\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit() {\n\t\tif ( Global.getProductEdition() >= 15 ) {\n\t\t\tthis.edit_only_mode = true;\n\t\t\tthis.moved_unsaved_markers = {};\n\t\t\t//this._super('initialize' );\n\t\t\tthis.edit_view_tpl = 'MapEditView.html';\n\t\t\tthis.permission_id = 'punch';\n\t\t\tthis.sub_view_mode = true;\n\t\t\tthis.viewId = 'Map';\n\t\t\tthis.script_name = 'MapView';\n\t\t\tthis.context_menu_name = $.i18n._( 'Map' );\n\t\t\tthis.navigation_label = $.i18n._( 'Map' );\n\t\t\t// Including this.api below to avoid issues with references to this.api.key_name in BaseViewController.onContextMenuClick() in connection with onExportClick()\n\t\t\tthis.punch_api = this.api = TTAPI.APIPunch;\n\t\t\tthis.map_last_bounds = new L.LatLngBounds();\n\t\t\tthis.calculatedRouteData = {};\n\n\t\t\t//all product edition checks in this view should be based off the existance of this.geo_fence_api\n\t\t\tif ( Global.getProductEdition() >= 20 ) {\n\t\t\t\tthis.geo_fence_api = TTAPI.APIGEOFence;\n\t\t\t}\n\n\t\t\tthis.user_api = TTAPI.APIUser;\n\n\t\t\tthis.render();\n\t\t\tthis.buildContextMenu();\n\n\t\t\tthis.initData();\n\t\t}\n\t}\n\n\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\texclude: ['default'],\n\t\t\tinclude: [\n\t\t\t\t'save',\n\t\t\t\t'cancel',\n\t\t\t\t'export_excel'\n\t\t\t]\n\t\t};\n\n\t\treturn context_menu_model;\n\t}\n\n\tsetEditMenuSaveIcon( context_btn, pId ) {\n\t\t//#2557 - JavaScript exception - Cannot read property 'editPermissionValidate' of null\n\t\tif ( !this.parent_view_controller || !this.parent_view_controller.editPermissionValidate( 'punch' ) ||\n\t\t\tthis.parent_view_controller.is_mass_editing ||\n\t\t\tthis.display_mode === 'geo_fence' ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t}\n\t\tif ( !this.is_changed || this.parent_view_controller.is_viewing ) {\n\t\t\tContextMen