TimeTrex/interface/html5/dist/payroll-pay_periods-PayPeriodsViewController.bundle.js

1 line
49 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["payroll-pay_periods-PayPeriodsViewController"],{505:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"PayPeriodsViewController\": () => (/* binding */ PayPeriodsViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass PayPeriodsViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#pay_periods_view_container',\n\n\t\t\tstatus_array: null,\n\t\t\ttype_array: null,\n\t\t\tpay_period_schedule_api: null\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit( options ) {\n\n\t\t//this._super('initialize', options );\n\t\tthis.edit_view_tpl = 'PayPeriodsEditView.html';\n\t\tthis.permission_id = 'pay_period_schedule';\n\t\tthis.script_name = 'PayPeriodsView';\n\t\tthis.viewId = 'PayPeriods';\n\t\tthis.table_name_key = 'pay_period';\n\t\tthis.context_menu_name = $.i18n._( 'Pay Period' );\n\t\tthis.navigation_label = $.i18n._( 'Pay Period' );\n\t\tthis.api = TTAPI.APIPayPeriod;\n\t\tthis.pay_period_schedule_api = TTAPI.APIPayPeriodSchedule;\n\n\t\tthis.render();\n\n\t\tif ( this.sub_view_mode ) {\n\t\t\tthis.buildContextMenu( true );\n\t\t} else {\n\t\t\tthis.buildContextMenu();\n\t\t}\n\n\t\t//call init data in parent view\n\n\t\tif ( !this.sub_view_mode ) {\n\t\t\tthis.initData();\n\t\t}\n\t}\n\n\tremoveEditView( is_cancel ) {\n\n\t\tsuper.removeEditView();\n\n\t\tif ( this.parent_view_controller &&\n\t\t\t( this.parent_view_controller.viewId === 'TimeSheet' || this.parent_view_controller.viewId === 'PayStub' ) ) {\n\t\t\tthis.parent_view_controller.onSubViewRemoved( is_cancel );\n\t\t}\n\t}\n\n\tinitOptions( callBack ) {\n\t\tvar $this = this;\n\n\t\tvar options = [\n\t\t\t{ option_name: 'status', field_name: null, api: null },\n\t\t\t{ option_name: 'type', field_name: 'type_id', api: this.pay_period_schedule_api }\n\t\t];\n\n\t\tthis.initDropDownOptions( options, function( result ) {\n\n\t\t\tif ( callBack ) {\n\t\t\t\tcallBack( result ); // First to initialize drop down options, and then to initialize edit view UI.\n\t\t\t}\n\n\t\t} );\n\t}\n\n\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\texclude: ['copy'],\n\t\t\tinclude: [\n\t\t\t\t{\n\t\t\t\t\tlabel: '', //Empty label. vue_icon is displayed instead of text.\n\t\t\t\t\tid: 'other_header',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'other',\n\t\t\t\t\taction_group_header: true,\n\t\t\t\t\tvue_icon: 'tticon tticon-more_vert_black_24dp',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Delete Data' ),\n\t\t\t\t\tid: 'delete_data',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'other'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Import Data' ),\n\t\t\t\t\tid: 'import_icon',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'other'\n\t\t\t\t},\n\t\t\t]\n\t\t};\n\n\t\tif ( this.edit_only_mode ) {\n\t\t\tcontext_menu_model.exclude.push( 'import_icon', 'delete_data' );\n\t\t}\n\n\t\treturn context_menu_model;\n\t}\n\n\tonEditClick( record_id, noRefreshUI ) {\n\t\t//If a dynamic future pay period is selected (zero id) do not allow it to be interacted with.\n\t\tif ( this.getGridSelectIdArray().includes( TTUUID.zero_id ) ) {\n\t\t\tProgressBar.closeOverlay();\n\t\t\treturn;\n\t\t}\n\n\t\tsuper.onEditClick( record_id, noRefreshUI );\n\t}\n\n\topenEditView( id ) {\n\n\t\tvar $this = this;\n\n\t\tif ( $this.edit_only_mode ) {\n\n\t\t\t$this.initOptions( function( result ) {\n\n\t\t\t\tif ( !$this.edit_view ) {\n\t\t\t\t\t$this.initEditViewUI( $this.viewId, $this.edit_view_tpl );\n\t\t\t\t}\n\n\t\t\t\t$this.getPayPeriodData( id, function( result ) {\n\t\t\t\t\t// Waiting for the TTAPI.API returns data to set the current edit record.\n\t\t\t\t\t$this.current_edit_record = result;\n\n\t\t\t\t\t$this.initEditView();\