TimeTrex/interface/html5/dist/payperiod-PayPeriodScheduleViewController.bundle.js

1 line
64 KiB
JavaScript
Raw Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["payperiod-PayPeriodScheduleViewController"],{6415:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"PayPeriodScheduleViewController\": () => (/* binding */ PayPeriodScheduleViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass PayPeriodScheduleViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#pay_period_schedule_view_container', //Must set el here and can only set string, so events can work\n\n\t\t\tuser_preference_api: null,\n\t\t\ttype_array: null,\n\t\t\tpay_period_starts_on_array: null,\n\t\t\tstart_week_day_array: null,\n\t\t\ttransaction_date_array: null,\n\t\t\ttransaction_date_business_day_array: null,\n\t\t\ttime_zone_array: null,\n\t\t\tshift_assigned_day_array: null,\n\t\t\ttimesheet_verify_type_array: null,\n\t\t\tsub_pay_periods_view_controller: 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 = 'PayPeriodScheduleEditView.html';\n\t\tthis.permission_id = 'pay_period_schedule';\n\t\tthis.viewId = 'PayPeriodSchedule';\n\t\tthis.script_name = 'PayPeriodScheduleView';\n\t\tthis.table_name_key = 'pay_period_schedule';\n\t\tthis.context_menu_name = $.i18n._( 'Pay Period Schedule' );\n\t\tthis.navigation_label = $.i18n._( 'Pay Period Schedule' );\n\t\tthis.api = TTAPI.APIPayPeriodSchedule;\n\t\tthis.user_preference_api = TTAPI.APIUserPreference;\n\n\t\tthis.render();\n\t\tthis.buildContextMenu();\n\t\tthis.initData();\n\t}\n\n\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\texclude: ['copy', 'mass_edit'],\n\t\t\tinclude: []\n\t\t};\n\n\t\treturn context_menu_model;\n\t}\n\n\topenEditView( id ) {\n\t\tGlobal.setUINotready();\n\t\tTTPromise.add( 'init', 'init' );\n\t\tTTPromise.wait();\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.getPayPeriodScheduleData( 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();\n\n\t\t\t\t} );\n\n\t\t\t} );\n\n\t\t} else {\n\t\t\tif ( !this.edit_view ) {\n\t\t\t\tthis.initEditViewUI( $this.viewId, $this.edit_view_tpl );\n\t\t\t}\n\n\t\t}\n\t}\n\n\tgetPayPeriodScheduleData( id, callBack ) {\n\t\tvar filter = {};\n\t\tfilter.filter_data = {};\n\t\tfilter.filter_data.id = [id];\n\n\t\tthis.api['get' + this.api.key_name]( filter, {\n\t\t\tonResult: function( result ) {\n\t\t\t\tvar result_data = result.getResult();\n\n\t\t\t\tif ( !result_data ) {\n\t\t\t\t\tresult_data = [];\n\t\t\t\t}\n\t\t\t\tresult_data = result_data[0];\n\n\t\t\t\tcallBack( result_data );\n\n\t\t\t}\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: 'type' },\n\t\t\t{ option_name: 'transaction_date' },\n\t\t\t{ option_name: 'transaction_date_business_day' },\n\t\t\t{ option_name: 'shift_assigned_day' },\n\t\t\t{ option_name: 'time_zone', field_name: '', api: this.user_preference_api },\n\t\t\t{ option_name: 'timesheet_verify_type' },\n\t\t\t{ option_name: 'start_week_day' }\n\n\t\t];\n\n\t\tthis.initDropDownOptions( options, function( result ) {\n\t\t\t$this.transaction_date_array = Global.addLastItemToArray( $this.transaction_date_array, -1, $.i18n._( '- Last Day Of Month -' ) );\n\n\t\t\t$this.user_preference_api.getOptions( 'start_week_day', {\n\t\t\t\tonResult: function( res ) {\n\t\t\t\t\tvar result = res.getResult();\n\t\t\t\t\t$this.pay_period_starts_on_array = Global.buildRecordArray( res