TimeTrex Community Edition v16.2.0

This commit is contained in:
2022-12-13 07:10:06 +01:00
commit 472f000c1b
6810 changed files with 2636142 additions and 0 deletions

View File

@ -0,0 +1,564 @@
export class PayrollRemittanceAgencyEventViewController extends BaseViewController {
constructor( options = {} ) {
_.defaults( options, {
el: '#payroll_remittance_agency_event_view_container', //Must set el here and can only set string, so events can work
user_api: null,
status_array: null,
action_array: null,
agency_array: null,
payment_frequency_array: null,
report_frequency_array: null,
country_array: null,
province_array: null,
district_array: null,
month_of_year_array: null,
month_of_quarter_array: null,
week_interval_array: null,
day_of_month_array: null,
day_of_week_array: null,
remittance_source_account_array: null,
sub_event_view_controller: null,
} );
super( options );
}
init( options ) {
//this._super('initialize', options );
this.edit_view_tpl = 'PayrollRemittanceAgencyEventEditView.html';
this.permission_id = 'payroll_remittance_agency';
this.script_name = 'PayrollRemittanceAgencyEventView';
this.table_name_key = 'payroll_remittance_agency_event';
this.viewId = 'PayrollRemittanceAgencyEvent';
this.context_menu_name = $.i18n._( 'Remittance Agency Event' );
this.navigation_label = $.i18n._( 'Remittance Agency Event' );
this.api = TTAPI.APIPayrollRemittanceAgencyEvent;
this.user_group_api = TTAPI.APIUserGroup;
this.company_api = TTAPI.APICompany;
this.date_api = TTAPI.APITTDate;
this.api_user_report = TTAPI.APIUserReportData;
this.month_of_quarter_array = Global.buildRecordArray( { 1: 1, 2: 2, 3: 3 } );
this.render();
if ( this.sub_view_mode ) {
this.buildContextMenu( true );
} else {
this.buildContextMenu();
}
//call init data in parent view
if ( !this.sub_view_mode ) {
this.initData();
}
}
//override required because this is a subview in an edit view.
_setGridSizeGridWidthOfSubViewMode() {
this.grid.setGridWidth( $( this.el ).parents( '.edit-view-tab' ).parent().parent().width() - 10 );
}
//Don't initOptions if edit_only_mode. Do it in sub views
initOptions() {
var $this = this;
this.initDropDownOption( 'status' );
this.initDropDownOption( 'frequency' );
this.api.getOptions( 'week_interval', {
onResult: function( res ) {
res = res.getResult();
$this.week_interval_array = res;
}
} );
this.date_api.getMonthOfYearArray( {
onResult: function( res ) {
res = res.getResult();
$this.month_of_year_array = res;
}
} );
this.date_api.getDayOfMonthArray( {
onResult: function( res ) {
res = res.getResult();
$this.day_of_month_array = Global.buildRecordArray( res );
}
} );
this.date_api.getDayOfWeekArray( {
onResult: function( res ) {
res = res.getResult();
$this.day_of_week_array = res;
}
} );
}
getTypeOptions() {
var $this = this;
var type_params = {
'payroll_remittance_agency_id': this.edit_view_ui_dic.payroll_remittance_agency_id.getValue()
};
this.api.getOptions( 'type', type_params, {
onResult: function( res ) {
res = res.getResult();
$this.edit_view_ui_dic.type_id.setSourceData( Global.buildRecordArray( res ) );
$this.edit_view_ui_dic.type_id.setSourceData( Global.buildRecordArray( res ) );
//must update current edit record in case the previous type has been removed from list
$this.current_edit_record.type_id = $this.edit_view_ui_dic.type_id.getValue();
TTPromise.resolve( 'PayrollRemittanceAgencyEvent', 'updateUI' );
}
} );
}
getReportOptions() {
var $this = this;
this.api_user_report.getUserReportData( { filter_data: { include_user_report_id: this.current_edit_record.user_report_data_id } }, {
onResult: function( res ) {
$this.edit_view_ui_dic.user_report_data_id.setSourceData( res.getResult() );
}
} );
}
setEditViewDataDone() {
super.setEditViewDataDone();
this.onFrequencyChange();
if ( typeof this.current_edit_record.id == 'undefined' ) {
this.detachElement( 'enable_recalculate_dates' );
}
this.getTypeOptions();
this.getReportOptions();
this.confirm_on_exit = false;
}
onFormItemChange( target, doNotValidate ) {
this.setIsChanged( target );
this.setMassEditingFieldsWhenFormChange( target );
var key = target.getField();
var c_value = target.getValue();
Debug.Text( 'key: ' + key + ' value: ' + c_value, 'PayrollRemittanceAgencyEventViewController.js', 'PayrollRemittanceAgencyEventViewController', 'onFormItemChange', 10 );
TTPromise.add( 'PayrollRemittanceAgencyEvent', 'updateUI' );
switch ( key ) {
case 'payroll_remittance_agency_id':
this.getTypeOptions(); //must be dynamically connected every time stuff changes.
break;
case 'frequency_id':
this.onFrequencyChange( c_value );
this.current_edit_record[key] = c_value;
this.validate();
this.updateFutureDates();
TTPromise.reject( 'PayrollRemittanceAgencyEvent', 'updateUI' );
break;
default:
TTPromise.resolve( 'PayrollRemittanceAgencyEvent', 'updateUI' );
break;
}
var $this = this;
// Hit when all promises are done...
TTPromise.wait( 'PayrollRemittanceAgencyEvent', 'updateUI', function() {
$this.onFrequencyChange();
$this.current_edit_record[key] = c_value;
$this.validate();
$this.updateFutureDates();
} );
}
updateFutureDates() {
Debug.Text( 'Updating remittance agency event dates.', null, null, null, 10 );
var $this = this;
this.api.calculateNextRunDate( this.current_edit_record, {
onResult: function( result ) {
result = result.getResult();
$this.edit_view_ui_dic.start_date.setValue( result.start_date );
$this.edit_view_ui_dic.end_date.setValue( result.end_date );
$this.edit_view_ui_dic.due_date.setValue( result.due_date );
$this.edit_view_ui_dic.next_reminder_date.setValue( result.next_reminder_date );
}
} );
}
onFrequencyChange( arg ) {
if ( !Global.isSet( arg ) ) {
if ( !Global.isSet( this.current_edit_record['frequency_id'] ) ) {
this.current_edit_record['frequency_id'] = 10;
}
arg = this.current_edit_record['frequency_id'];
}
Debug.Text( 'Selected Frequency: ' + arg, null, null, null, 10 );
this.detachElement( 'week' );
this.detachElement( 'primary_month' );
this.detachElement( 'primary_day_of_month' );
this.detachElement( 'secondary_month' );
this.detachElement( 'secondary_day_of_month' );
this.detachElement( 'day_of_week' );
this.detachElement( 'due_date_delay_days' );
this.detachElement( 'quarter_month' );
this.detachElement( 'pay_period_schedule_id' );
if ( arg == 1000 ) { //each pay period
this.attachElement( 'pay_period_schedule_id' );
this.attachElement( 'due_date_delay_days' );
} else if ( arg == 2000 ) { //annually
this.attachElement( 'primary_month' );
this.edit_view_ui_dic.primary_month.parents( '.edit-view-form-item-div' ).find( '.edit-view-form-item-label' ).html( 'Month' );
this.attachElement( 'primary_day_of_month' );
this.edit_view_ui_dic.primary_day_of_month.parents( '.edit-view-form-item-div' ).find( '.edit-view-form-item-label' ).html( 'Day Of Month' );
} else if ( arg == 2100 ) { //Year-To-Date
this.attachElement( 'primary_day_of_month' );
this.edit_view_ui_dic.primary_day_of_month.parents( '.edit-view-form-item-div' ).find( '.edit-view-form-item-label' ).html( 'Day Of Month' );
this.attachElement( 'primary_month' );
this.edit_view_ui_dic.primary_month.parents( '.edit-view-form-item-div' ).find( '.edit-view-form-item-label' ).html( 'Month' );
this.attachElement( 'due_date_delay_days' );
} else if ( arg == 2200 ) { //Semi-Annually
this.attachElement( 'primary_day_of_month' );
this.edit_view_ui_dic.primary_day_of_month.parents( '.edit-view-form-item-div' ).find( '.edit-view-form-item-label' ).html( 'Primary Day Of Month' );
this.attachElement( 'primary_month' );
this.edit_view_ui_dic.primary_month.parents( '.edit-view-form-item-div' ).find( '.edit-view-form-item-label' ).html( 'Primary Month' );
this.attachElement( 'secondary_month' );
this.attachElement( 'secondary_day_of_month' );
this.attachElement( 'due_date_delay_days' );
} else if ( arg == 3000 ) {//Quarterly
this.attachElement( 'primary_day_of_month' );
this.edit_view_ui_dic.primary_day_of_month.parents( '.edit-view-form-item-div' ).find( '.edit-view-form-item-label' ).html( 'Day Of Month' );
this.attachElement( 'quarter_month' );
} else if ( arg == 4100 ) { //monthly
this.attachElement( 'primary_day_of_month' );
this.edit_view_ui_dic.primary_day_of_month.parents( '.edit-view-form-item-div' ).find( '.edit-view-form-item-label' ).html( 'Day Of Month' );
} else if ( arg == 4200 ) { //semimonthly
this.attachElement( 'primary_day_of_month' );
this.edit_view_ui_dic.primary_day_of_month.parents( '.edit-view-form-item-div' ).find( '.edit-view-form-item-label' ).html( 'Primary Day Of Month' );
this.attachElement( 'secondary_day_of_month' );
this.attachElement( 'due_date_delay_days' );
} else if ( arg == 5100 ) { //weekly
this.attachElement( 'day_of_week' );
} else if ( arg == 90100 || arg == 90200 ) { //On Hire/Termination
this.attachElement( 'due_date_delay_days' );
} else if ( arg == 90310 ) { //On Termination (Pay Period End Date)
this.attachElement( 'pay_period_schedule_id' );
this.attachElement( 'due_date_delay_days' );
}
this.editFieldResize();
}
setDefaultMenuMassEditIcon( context_btn, grid_selected_length ) {
ContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )
}
setDefaultMenuSaveAndCopyIcon( context_btn, grid_selected_length ) {
ContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )
}
/* jshint ignore:end */
//Make sure this.current_edit_record is updated before validate
// validate() {
// var $this = this;
// var record = {};
// LocalCacheData.current_doing_context_action = 'validate';
// if ( this.is_mass_editing ) {
// for ( var key in this.edit_view_ui_dic ) {
// var widget = this.edit_view_ui_dic[key];
//
// if ( Global.isSet( widget.isChecked ) ) {
// if ( widget.isChecked() && widget.getEnabled() ) {
// record[key] = widget.getValue();
// }
// }
// }
// } else {
// if ( Global.isArray( this.current_edit_record.user_id ) && this.current_edit_record.user_id.length > 0 ) {
// record = [];
// $.each( this.current_edit_record.user_id, function( index, value ) {
//
// var commonRecord = Global.clone( $this.current_edit_record );
// commonRecord.user_id = value;
// record.push( commonRecord );
//
// } );
// } else {
// record = this.current_edit_record;
// }
// }
// this.api['validate' + this.api.key_name]( record, {
// onResult: function( result ) {
// $this.validateResult( result );
// }
// } );
// },
setDefaultMenuImportIcon( context_btn, grid_selected_length, pId ) {
}
copyAsNewResetIds( record ) {
record['id'] = '';
record['start_date'] = '';
record['end_date'] = '';
record['due_date'] = '';
record['last_due_date'] = '';
record['next_reminder_date'] = '';
record['last_reminder_date'] = '';
return record;
}
onCustomContextClick( id ) {
switch ( id ) {
case 'import_icon':
this.onImportClick();
break;
}
}
setEditMenuSaveAndContinueIcon( context_btn, pId ) {
this.saveAndContinueValidate( context_btn );
if ( !this.current_edit_record || !this.current_edit_record.id ) {
ContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );
}
}
setEditMenuSaveAndAddIcon( context_btn, pId ) {
this.saveAndNewValidate( context_btn );
if ( !this.current_edit_record || !this.current_edit_record.id ) {
ContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );
}
}
setEditMenuSaveAndCopyIcon( context_btn, pId ) {
this.saveAndContinueValidate( context_btn );
if ( !this.current_edit_record || !this.current_edit_record.id ) {
ContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );
}
}
buildEditViewUI() {
super.buildEditViewUI();
var $this = this;
var form_item_input;
var tab_model = {
'tab_payroll_remittance_agency_event': { 'label': $.i18n._( 'Remittance Agency Event' ) },
'tab_audit': true,
};
this.setTabModel( tab_model );
this.navigation.AComboBox( {
api_class: TTAPI.APIPayrollRemittanceAgencyEvent,
id: this.script_name + '_navigation',
allow_multiple_selection: false,
layout_name: 'global_payroll_remittance_agency',
navigation_mode: true,
show_search_inputs: true
} );
this.setNavigation();
var tab_payroll_remittance_agency_event = this.edit_view_tab.find( '#tab_payroll_remittance_agency_event' );
this.edit_view_tabs[0] = [];
this.edit_view_tabs[0].push( tab_payroll_remittance_agency_event );
var tab_payroll_remittance_agency_event_column_1 = tab_payroll_remittance_agency_event.find( '.first-column' );
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayrollRemittanceAgency,
allow_multiple_selection: false,
layout_name: 'global_payroll_remittance_agency',
show_search_inputs: true,
set_empty: false,
field: 'payroll_remittance_agency_id'
} );
this.addEditFieldToColumn( $.i18n._( 'Remittance Agency' ), form_item_input, tab_payroll_remittance_agency_event_column_1 );
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( {
field: 'status_id'
} );
form_item_input.setSourceData( $this.status_array );
this.addEditFieldToColumn( $.i18n._( 'Status' ), form_item_input, tab_payroll_remittance_agency_event_column_1 );
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( {
field: 'type_id'
} );
this.addEditFieldToColumn( $.i18n._( 'Type' ), form_item_input, tab_payroll_remittance_agency_event_column_1 );
// Payment Frequency
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( {
field: 'frequency_id'
} );
form_item_input.setSourceData( $this.frequency_array );
this.addEditFieldToColumn( $.i18n._( 'Frequency' ), form_item_input, tab_payroll_remittance_agency_event_column_1 );
// Payment Frequency Month
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( { field: 'primary_month' } );
form_item_input.setSourceData( Global.buildRecordArray( $this.month_of_year_array ) );
this.addEditFieldToColumn( $.i18n._( 'Primary Month' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '', null, true );
// Payment Frequency Day Of Month
// Day of the Month
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( { field: 'primary_day_of_month' } );
var day_of_month_array = Global.addLastItemToArray( $this.day_of_month_array, -1, $.i18n._( '- Last Day Of Month -' ) );
form_item_input.setSourceData( day_of_month_array );
this.addEditFieldToColumn( $.i18n._( 'Primary Day of Month' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '', null, true );
// Payment Frequency Month
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( { field: 'secondary_month' } );
form_item_input.setSourceData( Global.buildRecordArray( $this.month_of_year_array ) );
this.addEditFieldToColumn( $.i18n._( 'Secondary Month' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '', null, true );
// Payment Frequency Day Of Month
// Day of the Month
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( { field: 'secondary_day_of_month' } );
form_item_input.setSourceData( day_of_month_array );
this.addEditFieldToColumn( $.i18n._( 'Secondary Day of Month' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '', null, true );
// Payment Frequency Week
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( { field: 'week' } );
form_item_input.setSourceData( Global.buildRecordArray( $this.week_interval_array ) );
this.addEditFieldToColumn( $.i18n._( 'Week' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '', null, true );
// Payment Frequency quarter Month
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( { field: 'quarter_month' } );
form_item_input.setSourceData( $this.month_of_quarter_array );
this.addEditFieldToColumn( $.i18n._( 'Month of Quarter' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '', null, true );
// Day of the week
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( { field: 'day_of_week' } );
form_item_input.setSourceData( Global.buildRecordArray( $this.day_of_week_array ) );
this.addEditFieldToColumn( $.i18n._( 'Day of week' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '', null, true );
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIPayPeriodSchedule,
allow_multiple_selection: true,
layout_name: 'global_pay_period_schedule',
show_search_inputs: true,
set_special_empty: true,
set_any: true,
field: 'pay_period_schedule_id'
} );
form_item_input.setSourceData( $this.saved_report_array );
this.addEditFieldToColumn( $.i18n._( 'Pay Period Schedule' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '', null, true );
// Payment Frequency Days After Transaction Date
form_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
form_item_input.TTextInput( { field: 'due_date_delay_days', width: 50 } );
this.addEditFieldToColumn( $.i18n._( 'Due Date Delay Days' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '', null, true );
// Effective Date
form_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );
form_item_input.TDatePicker( {
field: 'effective_date'
} );
this.addEditFieldToColumn( $.i18n._( 'Effective Date' ), form_item_input, tab_payroll_remittance_agency_event_column_1 );
//user to remind
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIUser,
allow_multiple_selection: false,
layout_name: 'global_user',
show_search_inputs: true,
set_empty: true,
field: 'reminder_user_id'
} );
this.addEditFieldToColumn( $.i18n._( 'Send Reminder To' ), form_item_input, tab_payroll_remittance_agency_event_column_1 );
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
allow_multiple_selection: false,
layout_name: 'global_user_report_data',
show_search_inputs: true,
set_default: true,
field: 'user_report_data_id'
} );
this.addEditFieldToColumn( $.i18n._( 'Saved Report' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '', null, true );
// Payment Frequency reminder days
form_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
form_item_input.TTextInput( { field: 'reminder_days', width: 50 } );
this.addEditFieldToColumn( $.i18n._( 'Reminder Days' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '' );
//Note
form_item_input = Global.loadWidgetByName( FormItemType.TEXT_AREA );
form_item_input.TTextArea( { field: 'note', width: '100%', rows: 5 } );
this.addEditFieldToColumn( $.i18n._( 'Notes' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '', null, true, true );
form_item_input.parent().width( '50%' );
form_item_input = Global.loadWidgetByName( FormItemType.CHECKBOX );
form_item_input.TCheckbox( { field: 'enable_recalculate_dates' } );
this.addEditFieldToColumn( $.i18n._( 'Recalculate Dates' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '', null, true );
// Recalculate Dates From
form_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );
form_item_input.TDatePicker( {
field: 'recalculate_date'
} );
this.addEditFieldToColumn( $.i18n._( 'Recalculate Dates From' ), form_item_input, tab_payroll_remittance_agency_event_column_1 );
form_item_input = Global.loadWidgetByName( FormItemType.TEXT );
form_item_input.TText( { field: 'start_date' } );
this.addEditFieldToColumn( $.i18n._( 'Start Date' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '', null, true );
form_item_input = Global.loadWidgetByName( FormItemType.TEXT );
form_item_input.TText( { field: 'end_date' } );
this.addEditFieldToColumn( $.i18n._( 'End Date' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '', null, true );
form_item_input = Global.loadWidgetByName( FormItemType.TEXT );
form_item_input.TText( { field: 'due_date' } );
this.addEditFieldToColumn( $.i18n._( 'Due Date' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '', null, true );
form_item_input = Global.loadWidgetByName( FormItemType.TEXT );
form_item_input.TText( { field: 'next_reminder_date' } );
this.addEditFieldToColumn( $.i18n._( 'Reminder Date' ), form_item_input, tab_payroll_remittance_agency_event_column_1, '', null, true );
}
}
PayrollRemittanceAgencyEventViewController.loadSubView = function( container, beforeViewLoadedFun, afterViewLoadedFun ) {
Global.loadViewSource( 'PayrollRemittanceAgencyEvent', 'SubPayrollRemittanceAgencyEventView.html', function( result ) {
var args = {};
var template = _.template( result );
if ( Global.isSet( beforeViewLoadedFun ) ) {
beforeViewLoadedFun();
}
if ( Global.isSet( container ) ) {
container.html( template( args ) );
if ( Global.isSet( afterViewLoadedFun ) ) {
afterViewLoadedFun( sub_payroll_remittance_agency_event_view_controller );
}
}
} );
};

View File

@ -0,0 +1,882 @@
export class PayrollRemittanceAgencyViewController extends BaseViewController {
constructor( options = {} ) {
_.defaults( options, {
el: '#payroll_remittance_agency_view_container',
status_array: null,
type_array: null,
agency_array: null,
country_array: null,
province_array: null,
district_array: null,
remittance_source_account_array: null,
sub_event_view_controller: null,
e_province_array: null,
company_api: null,
remittance_source_account_api: null,
always_week_day_array: null,
date_api: null
} );
super( options );
}
init() {
this.edit_view_tpl = 'PayrollRemittanceAgencyEditView.html';
this.permission_id = 'payroll_remittance_agency';
this.viewId = 'PayrollRemittanceAgency';
this.script_name = 'PayrollRemittanceAgencyView';
this.table_name_key = 'payroll_remittance_agency';
this.context_menu_name = $.i18n._( 'Remittance Agencies' );
this.navigation_label = $.i18n._( 'Remittance Agency' );
this.api = TTAPI.APIPayrollRemittanceAgency;
this.company_api = TTAPI.APICompany;
this.date_api = TTAPI.APITTDate;
this.remittance_source_account_api = TTAPI.APIRemittanceSourceAccount;
this.render();
this.buildContextMenu();
this.initData();
}
//Don't initOptions if edit_only_mode. Do it in sub views
initOptions( callback ) {
var $this = this;
var options = [
{ option_name: 'status', api: this.api },
{ option_name: 'type', api: this.api },
{ option_name: 'country', field_name: 'country', api: this.company_api },
];
this.initDropDownOptions( options );
this.api.getOptions( 'always_week_day', {
onResult: function( res ) {
res = res.getResult();
$this.always_week_day_array = Global.buildRecordArray( res );
if ( typeof callback == 'function' ) {
callback( res ); // First to initialize drop down options, and then to initialize edit view UI.
}
}
} );
}
openEditView( record_id ) {
var $this = this;
if ( this.edit_only_mode ) {
this.initOptions( function( result ) {
if ( !$this.edit_view ) {
$this.initEditViewUI( $this.viewId, $this.edit_view_tpl );
}
var filter = {};
filter.filter_data = { id: record_id };
$this.api.getPayrollRemittanceAgency( filter, {
onResult: function( result ) {
result = result.getResult()[0];
//Error: Uncaught TypeError: Cannot read property 'user_id' of null in interface/html5/#!m=TimeSheet&date=20150915&user_id=42175&show_wage=0 line 79
if ( !result ) {
TAlertManager.showAlert( $.i18n._( 'Invalid agency id' ) );
$this.onCancelClick();
} else {
// Waiting for the TTAPI.API returns data to set the current edit record.
$this.current_edit_record = result;
$this.initEditView();
}
}
} );
} );
} else {
super.openEditView();
}
}
getFilterColumnsFromDisplayColumns() {
var column_filter = {};
column_filter.is_owner = true;
column_filter.id = true;
column_filter.is_child = true;
column_filter.in_use = true;
column_filter.first_name = true;
column_filter.last_name = true;
column_filter.type_id = true;
column_filter.country = true;
column_filter.province = true;
column_filter.district = true;
// Error: Unable to get property 'getGridParam' of undefined or null reference
var display_columns = [];
if ( this.grid ) {
display_columns = this.grid.getGridParam( 'colModel' );
}
//Fixed possible exception -- Error: Unable to get property 'length' of undefined or null reference in /interface/html5/views/BaseViewController.js?v=7.4.3-20140924-090129 line 5031
if ( display_columns ) {
var len = display_columns.length;
for ( var i = 0; i < len; i++ ) {
var column_info = display_columns[i];
column_filter[column_info.name] = true;
}
}
return column_filter;
}
onSetSearchFilterFinished() {
var combo;
var select_value;
if ( this.search_panel.getSelectTabIndex() === 0 ) {
combo = this.basic_search_field_ui_dic['country'];
select_value = combo.getValue();
this.setProvince( select_value );
} else if ( this.search_panel.getSelectTabIndex() === 1 ) {
combo = this.adv_search_field_ui_dic['country'];
select_value = combo.getValue();
this.setProvince( select_value );
}
}
getCustomContextMenuModel() {
var context_menu_model = {
exclude: ['export_excel'],
include: []
};
return context_menu_model;
}
onBuildAdvUIFinished() {
this.adv_search_field_ui_dic['country'].change( $.proxy( function() {
var combo = this.adv_search_field_ui_dic['country'];
var selectVal = combo.getValue();
this.setProvince( selectVal );
this.adv_search_field_ui_dic['province'].setValue( null );
}, this ) );
}
onBuildBasicUIFinished() {
this.basic_search_field_ui_dic['country'].change( $.proxy( function() {
var combo = this.basic_search_field_ui_dic['country'];
var selectVal = combo.getValue();
this.setProvince( selectVal );
this.basic_search_field_ui_dic['province'].setValue( null );
}, this ) );
}
onFormItemChange( target, doNotValidate ) {
this.setIsChanged( target );
this.setMassEditingFieldsWhenFormChange( target );
var key = target.getField();
var c_value = target.getValue();
switch ( key ) {
case 'country':
case 'province':
if ( c_value.toString() === this.current_edit_record[key].toString() ) {
return;
}
break;
case 'type_id':
if ( c_value.toString() === this.current_edit_record[key].toString() ) {
return;
}
this.onTypeChange( c_value );
break;
case 'agency_id':
this.onAgencyIdChange();
break;
}
this.current_edit_record[key] = c_value;
if ( key === 'country' || key === 'type_id' || key === 'province' || key === 'district' ) {
if ( key != 'province' ) {
this.detachElement( 'province' );
this.eSetProvince( this.current_edit_record['country'] );
}
if ( key != 'district' ) {
this.detachElement( 'district' );
this.setDistrict( this.current_edit_record['country'], this.current_edit_record['province'] );
}
this.current_edit_record['type_id'] = this.edit_view_ui_dic['type_id'].getValue();
this.current_edit_record['country'] = this.edit_view_ui_dic['country'].getValue();
this.current_edit_record['province'] = this.edit_view_ui_dic['province'].getValue() ? this.edit_view_ui_dic['province'].getValue() : '00';
this.current_edit_record['district'] = this.edit_view_ui_dic['district'].getValue() ? this.edit_view_ui_dic['district'].getValue() : '00';
this.getAgencyOptions();
}
if ( key === 'legal_entity_id' ) {
this.getRemittanceSourceAccount();
}
if ( !doNotValidate ) {
this.validate();
}
}
onAgencyIdChange() {
var id_field_array_api_params = { 'agency_id': this.edit_view_ui_dic.agency_id.getValue() };
var id_field_array = this.api.getOptions( 'agency_id_field_labels', id_field_array_api_params, { async: false } ).getResult();
this.detachElement( 'primary_identification' );
this.detachElement( 'secondary_identification' );
this.detachElement( 'tertiary_identification' );
for ( var key in id_field_array ) {
this.attachElement( key );
this.edit_view_form_item_dic[key].find( '.edit-view-form-item-label' ).text( id_field_array[key] );
}
this.editFieldResize();
}
getAgencyOptions() {
var params = {
'type_id': this.current_edit_record['type_id'],
'country': this.current_edit_record['country'],
'province': this.current_edit_record['province'],
'district': this.current_edit_record['district']
};
var $this = this;
this.api.getOptions( 'agency', params, {
async: false,
onResult: function( res ) {
var result = res.getResult();
if ( !result ) {
result = [];
}
$this.agency_array = Global.buildRecordArray( result );
if ( Global.isSet( $this.basic_search_field_ui_dic['agency_id'] ) ) {
$this.basic_search_field_ui_dic['agency_id'].setSourceData( Global.buildRecordArray( result ) );
}
if ( Global.isSet( $this.adv_search_field_ui_dic['agency_id'] ) ) {
$this.adv_search_field_ui_dic['agency_id'].setSourceData( Global.buildRecordArray( result ) );
}
$this.edit_view_ui_dic['agency_id'].setSourceData( $this.agency_array );
if ( $this.current_edit_record['agency_id'] && res[$this.current_edit_record['agency_id']] ) {
$this.edit_view_ui_dic['agency_id'].setValue( $this.current_edit_record['agency_id'] );
} else {
$this.current_edit_record['agency_id'] = $this.edit_view_ui_dic['agency_id'].getValue();
}
$this.onAgencyIdChange();
}
} );
}
getRemittanceSourceAccount() {
var $this = this;
var legal_entity_id = this.edit_view_ui_dic['legal_entity_id'].getValue();
if ( !Global.isSet( legal_entity_id ) || Global.isFalseOrNull( legal_entity_id ) ) {
legal_entity_id = this.current_edit_record['legal_entity_id'];
}
if ( TTUUID.isUUID( legal_entity_id ) ) {
var source_account_args = {};
source_account_args.filter_data = {};
source_account_args.filter_data.legal_entity_id = legal_entity_id;
source_account_args.filter_columns = {};
source_account_args.filter_columns.id = true;
source_account_args.filter_columns.name = true;
$this.remittance_source_account_api.getRemittanceSourceAccount( source_account_args, {
onResult: function( result ) {
result = result.getResult();
$this.remittance_source_account_array = result;
$this.edit_view_ui_dic['remittance_source_account_id'].setSourceData( result );
}
} );
}
}
onTypeChange( arg ) {
if ( !Global.isSet( arg ) || Global.isFalseOrNull( arg ) ) {
if ( !Global.isSet( this.current_edit_record['type_id'] ) || Global.isFalseOrNull( this.current_edit_record['type_id'] ) ) {
this.current_edit_record['type_id'] = 10;
}
}
this.editFieldResize();
}
setDistrict( c, p ) {
var $this = this;
if ( this.edit_view_ui_dic.type_id.getValue() == 30 ) {
this.api.getDistrictOptions( c, p, {
async: false, onResult: function( res ) {
res = res.getResult();
//#2486 When there are no provinces for 3rd party agencies in countries outside those with scripted agencies, we must hide the field
if ( Object.keys( res ).length == 0 || Object.keys( res ).length == 1 && res['00'] ) {
$this.current_edit_record['district'] = '00';
return;
}
if ( !res ) {
res = [];
}
$this.attachElement( 'district' );
var first_element = null;
if ( res.length <= 1 ) {
first_element = {
label: '-- ' + $.i18n._( 'Other' ) + ' --',
value: '00',
fullValue: '00',
orderValue: -1,
id: '00'
};
}
$this.district_array = Global.buildRecordArray( res, first_element );
$this.edit_view_ui_dic['district'].setSourceData( $this.district_array );
if ( $this.current_edit_record['district'] && res[$this.current_edit_record['district']] ) {
$this.edit_view_ui_dic['district'].setValue( $this.current_edit_record['district'] );
} else {
var district = $this.edit_view_ui_dic['district'].getValue();
if ( district == TTUUID.not_exist_id || district == TTUUID.zero_id || district == false || district == null ) {
district = '00';
$this.edit_view_ui_dic['district'].setValue( district );
}
$this.current_edit_record['district'] = district;
}
}
} );
} else {
$this.current_edit_record['district'] = '00';
$this.edit_view_ui_dic['district'].setValue( '00' );
}
}
setCurrentEditRecordData() {
//Set current edit record data to all widgets
for ( var key in this.current_edit_record ) {
if ( !this.current_edit_record.hasOwnProperty( key ) ) {
continue;
}
var widget = this.edit_view_ui_dic[key];
if ( Global.isSet( widget ) ) {
switch ( key ) {
default:
widget.setValue( this.current_edit_record[key] );
break;
}
}
}
this.collectUIDataToCurrentEditRecord();
this.setEditViewDataDone();
}
eSetProvince( val, refresh ) {
var $this = this;
if ( this.edit_view_ui_dic.type_id.getValue() > 10 ) {
this.api.getProvinceOptions( val, {
async: false, onResult: function( result ) {
result = result.getResult();
if ( !result ) {
result = [];
}
//#2486 When there are no provinces for 3rd party agencies in countries outside those with scripted agencies, we must hide the field
if ( $this.edit_view_ui_dic.type_id.getValue() < 20 || ( Object.keys( result ).length == 0 || Object.keys( result ).length == 1 && result['00'] ) ) {
$this.current_edit_record['province'] = '00';
//Field stays hidden. value is set to '00'
return;
}
$this.attachElement( 'province' );
var first_element = null;
if ( result.length <= 1 ) {
first_element = {
label: '-- ' + $.i18n._( 'Other' ) + ' --',
value: '00',
fullValue: '00',
orderValue: -1,
id: '00'
};
}
$this.province_array = Global.buildRecordArray( result, first_element );
$this.edit_view_ui_dic['province'].setSourceData( $this.province_array );
if ( $this.current_edit_record['province'] && Global.isSet( result[$this.current_edit_record['province']] ) ) {
$this.edit_view_ui_dic['province'].setValue( $this.current_edit_record['province'] );
} else {
var province = $this.edit_view_ui_dic['province'].getValue();
if ( province == TTUUID.not_exist_id || province == TTUUID.zero_id || province == false || province == null ) {
province = '00';
}
$this.current_edit_record['province'] = province;
}
}
} );
} else {
$this.current_edit_record['province'] = '00';
$this.edit_view_ui_dic['province'].setValue( '00 ' );
}
}
setEditViewDataDone() {
super.setEditViewDataDone();
this.onTypeChange();
this.detachElement( 'province' );
this.detachElement( 'district' );
this.eSetProvince( this.current_edit_record['country'] );
this.setDistrict( this.current_edit_record['country'], this.current_edit_record['province'] );
this.getAgencyOptions();
}
buildEditViewUI() {
super.buildEditViewUI();
var $this = this;
var tab_model = {
'tab_payroll_remittance_agency': { 'label': $.i18n._( 'Remittance Agency' ), 'is_multi_column': true },
'tab_payroll_remittance_agency_event': {
'label': $.i18n._( 'Events' ),
'init_callback': 'initSubEventView',
'display_on_mass_edit': false,
'html_template': this.getPayrollRemittanceAgencyEventTabHtml()
},
'tab_audit': true,
};
this.setTabModel( tab_model );
if ( this.navigation ) {
this.navigation.AComboBox( {
api_class: TTAPI.APIPayrollRemittanceAgency,
id: this.script_name + '_navigation',
allow_multiple_selection: false,
layout_name: 'global_payroll_remittance_agency',
navigation_mode: true,
show_search_inputs: true
} );
this.setNavigation();
}
var tab_payroll_remittance_agency = this.edit_view_tab.find( '#tab_payroll_remittance_agency' );
var tab_payroll_remittance_agency_column1 = tab_payroll_remittance_agency.find( '.first-column' );
var tab_payroll_remittance_agency_column2 = tab_payroll_remittance_agency.find( '.second-column' );
this.edit_view_tabs[0] = [];
this.edit_view_tabs[0].push( tab_payroll_remittance_agency_column1 );
this.edit_view_tabs[0].push( tab_payroll_remittance_agency_column2 );
// tab_employee_contact column1
// Legal Entity
var form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APILegalEntity,
allow_multiple_selection: false,
layout_name: 'global_legal_entity',
field: 'legal_entity_id',
set_empty: true,
show_search_inputs: true
} );
this.addEditFieldToColumn( $.i18n._( 'Legal Entity' ), form_item_input, tab_payroll_remittance_agency_column1, '' );
// Status
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( {
field: 'status_id'
} );
form_item_input.setSourceData( $this.status_array );
this.addEditFieldToColumn( $.i18n._( 'Status' ), form_item_input, tab_payroll_remittance_agency_column1 );
// Name
form_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
form_item_input.TTextInput( { field: 'name', width: '100%' } );
this.addEditFieldToColumn( $.i18n._( 'Name' ), form_item_input, tab_payroll_remittance_agency_column1 );
form_item_input.parent().width( '45%' );
// Description
form_item_input = Global.loadWidgetByName( FormItemType.TEXT_AREA );
form_item_input.TTextArea( { field: 'description', width: '100%' } );
this.addEditFieldToColumn( $.i18n._( 'Description' ), form_item_input, tab_payroll_remittance_agency_column1 );
form_item_input.parent().width( '45%' );
// Type
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( {
field: 'type_id'
} );
form_item_input.setSourceData( $this.type_array );
this.addEditFieldToColumn( $.i18n._( 'Type' ), form_item_input, tab_payroll_remittance_agency_column1 );
// Country
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( {
set_empty: false,
field: 'country'
} );
form_item_input.setSourceData( $this.country_array );
this.addEditFieldToColumn( $.i18n._( 'Country' ), form_item_input, tab_payroll_remittance_agency_column1 );
// Province/State
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( {
set_empty: false,
field: 'province'
} );
form_item_input.setSourceData( [] );
this.addEditFieldToColumn( $.i18n._( 'Province/State' ), form_item_input, tab_payroll_remittance_agency_column1, '', null, true );
// District
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( {
set_empty: false,
field: 'district'
} );
form_item_input.setSourceData( [] );
this.addEditFieldToColumn( $.i18n._( 'District' ), form_item_input, tab_payroll_remittance_agency_column1, '', null, true );
// Agency
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( {
set_empty: false,
field: 'agency_id'
} );
form_item_input.setSourceData( [] );
this.addEditFieldToColumn( $.i18n._( 'Agency' ), form_item_input, tab_payroll_remittance_agency_column1 );
form_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
form_item_input.TTextInput( { field: 'primary_identification', width: 200 } );
this.addEditFieldToColumn( $.i18n._( 'Primary Identification' ), form_item_input, tab_payroll_remittance_agency_column1, '', null, true );
form_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
form_item_input.TTextInput( { field: 'secondary_identification', width: 200 } );
this.addEditFieldToColumn( $.i18n._( 'Secondary Identification' ), form_item_input, tab_payroll_remittance_agency_column1, '', null, true );
form_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
form_item_input.TTextInput( { field: 'tertiary_identification', width: 200 } );
this.addEditFieldToColumn( $.i18n._( 'Tertiary Identification' ), form_item_input, tab_payroll_remittance_agency_column1, '', null, true );
//prevent flashing province and district on addclick.
this.detachElement( 'primary_identification' );
this.detachElement( 'secondary_identification' );
this.detachElement( 'tertiary_identification' );
// column2
// Start Date
form_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );
form_item_input.TDatePicker( {
field: 'start_date'
} );
this.addEditFieldToColumn( $.i18n._( 'Start Date' ), form_item_input, tab_payroll_remittance_agency_column2 );
// Start Date
form_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );
form_item_input.TDatePicker( {
field: 'end_date'
} );
this.addEditFieldToColumn( $.i18n._( 'End Date' ), form_item_input, tab_payroll_remittance_agency_column2 );
// Contact
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIUser,
allow_multiple_selection: false,
layout_name: 'global_user',
field: 'contact_user_id',
set_empty: true,
show_search_inputs: true
} );
this.addEditFieldToColumn( $.i18n._( 'Contact' ), form_item_input, tab_payroll_remittance_agency_column2, '' );
// Remittance Source Account
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIRemittanceSourceAccount,
allow_multiple_selection: false,
layout_name: 'global_remittance_source_account',
field: 'remittance_source_account_id',
set_empty: true,
show_search_inputs: true
} );
this.addEditFieldToColumn( $.i18n._( 'Remittance Source Account' ), form_item_input, tab_payroll_remittance_agency_column2, '' );
// Always On Business Day
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
form_item_input.TComboBox( { field: 'always_week_day_id' } );
form_item_input.setSourceData( this.always_week_day_array );
this.addEditFieldToColumn( $.i18n._( 'Events Always On Business Day' ), form_item_input, tab_payroll_remittance_agency_column2 );
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
form_item_input.AComboBox( {
api_class: TTAPI.APIRecurringHoliday,
allow_multiple_selection: true,
layout_name: 'global_recurring_holiday',
show_search_inputs: true,
set_empty: true,
field: 'recurring_holiday_policy_id'
} );
this.addEditFieldToColumn( $.i18n._( 'Recurring Holidays' ), form_item_input, tab_payroll_remittance_agency_column2 );
//prevent flashing province and district on addclick.
this.detachElement( 'province' );
this.detachElement( 'district' );
}
setProvince( val, m ) {
var $this = this;
if ( !val || val === TTUUID.not_exist_id || val === TTUUID.zero_id ) {
$this.province_array = [];
this.adv_search_field_ui_dic['province'].setSourceData( [] );
this.basic_search_field_ui_dic['province'].setSourceData( [] );
} else {
this.company_api.getOptions( 'province', val, {
async: false,
onResult: function( res ) {
res = res.getResult();
if ( !res ) {
res = [];
}
$this.province_array = Global.buildRecordArray( res, {
label: '-- ' + $.i18n._( 'Other' ) + ' --',
value: '00',
fullValue: '00',
orderValue: -1,
id: '00'
} );
$this.adv_search_field_ui_dic['province'].setSourceData( $this.province_array );
$this.basic_search_field_ui_dic['province'].setSourceData( $this.province_array );
}
} );
}
}
buildSearchFields() {
super.buildSearchFields();
this.search_fields = [
new SearchField( {
label: $.i18n._( 'Legal Entity' ),
in_column: 1,
field: 'legal_entity_id',
layout_name: 'global_legal_entity',
api_class: TTAPI.APILegalEntity,
multiple: true,
basic_search: true,
adv_search: true,
script_name: 'LegalEntityView',
form_item_type: FormItemType.AWESOME_BOX
} ),
new SearchField( {
label: $.i18n._( 'Status' ),
in_column: 1,
field: 'status_id',
multiple: true,
basic_search: true,
adv_search: true,
layout_name: 'global_option_column',
form_item_type: FormItemType.AWESOME_BOX
} ),
new SearchField( {
label: $.i18n._( 'Name' ),
in_column: 1,
field: 'name',
multiple: true,
basic_search: true,
adv_search: true,
form_item_type: FormItemType.TEXT_INPUT
} ),
new SearchField( {
label: $.i18n._( 'Country' ),
in_column: 2,
field: 'country',
multiple: true,
basic_search: true,
adv_search: true,
layout_name: 'global_option_column',
form_item_type: FormItemType.COMBO_BOX
} ),
new SearchField( {
label: $.i18n._( 'Province/State' ),
in_column: 2,
field: 'province',
multiple: true,
basic_search: true,
adv_search: true,
layout_name: 'global_option_column',
form_item_type: FormItemType.AWESOME_BOX
} ),
new SearchField( {
label: $.i18n._( 'Created By' ),
in_column: 3,
field: 'created_by',
layout_name: 'global_user',
api_class: TTAPI.APIUser,
multiple: true,
basic_search: false,
adv_search: true,
script_name: 'EmployeeView',
form_item_type: FormItemType.AWESOME_BOX
} ),
new SearchField( {
label: $.i18n._( 'Updated By' ),
in_column: 3,
field: 'updated_by',
layout_name: 'global_user',
api_class: TTAPI.APIUser,
multiple: true,
basic_search: false,
adv_search: true,
script_name: 'EmployeeView',
form_item_type: FormItemType.AWESOME_BOX
} )
];
}
initSubEventView() {
var $this = this;
if ( !this.current_edit_record.id ) {
TTPromise.resolve( 'BaseViewController', 'onTabShow' ); //Since search() isn't called in this case, and we just display the "Please Save This Record ..." message, resolve the promise.
return;
}
if ( this.sub_event_view_controller ) {
this.sub_event_view_controller.buildContextMenu( true );
this.sub_event_view_controller.setDefaultMenu();
$this.sub_event_view_controller.parent_value = $this.current_edit_record.id;
$this.sub_event_view_controller.parent_edit_record = $this.current_edit_record;
$this.sub_event_view_controller.initData(); //Init data in this parent view
return;
}
Global.loadScript( 'views/company/payroll_remittance_agency/PayrollRemittanceAgencyEventViewController.js', function() {
if ( !$this.edit_view_tab ) {
return;
}
var tab_event = $this.edit_view_tab.find( '#tab_payroll_remittance_agency_event' );
var firstColumn = tab_event.find( '.first-column-sub-view' );
Global.trackView( 'Sub' + 'PayrollRemittanceEvent' + 'View' );
PayrollRemittanceAgencyEventViewController.loadSubView( firstColumn, beforeLoadView, afterLoadView );
} );
function beforeLoadView() {
}
function afterLoadView( subViewController ) {
$this.sub_event_view_controller = subViewController;
$this.sub_event_view_controller.parent_key = 'payroll_remittance_agency_id';
$this.sub_event_view_controller.parent_value = $this.current_edit_record.id;
$this.sub_event_view_controller.parent_edit_record = $this.current_edit_record;
$this.sub_event_view_controller.parent_view_controller = $this;
$this.sub_event_view_controller.postInit = function() {
this.initData();
};
}
}
onCancelClick() {
super.onCancelClick();
this.sub_event_view_controller = null;
}
onSaveClick( ignore_warning ) {
super.onSaveClick( ignore_warning );
this.sub_event_view_controller = null;
}
uniformVariable( data ) {
if ( data ) {
super.collectUIDataToCurrentEditRecord();
if ( this.is_mass_editing != true ) {
data.payroll_remittance_agency_id = this.parent_value;
if ( data.type_id != 30 || data.district == TTUUID.not_exist_id || data.district == TTUUID.zero_id || data.district == false || data.district == null ) {
data.district = '00';
}
if ( data.type_id <= 10 || data.province == TTUUID.not_exist_id || data.province == TTUUID.zero_id || data.province == false || data.province == null ) {
data.province = '00';
}
var agency_identifier = '0000';
if ( data.agency_id ) {
agency_identifier = data.agency_id.slice( -4 );
}
data.agency_id = data.type_id + ':' + data.country + ':' + data.province + ':' + data.district + ':' + agency_identifier;
}
}
return data;
}
getPayrollRemittanceAgencyEventTabHtml() {
return `<div id="tab_payroll_remittance_agency_event" class="edit-view-tab-outside-sub-view">
<div class="edit-view-tab" id="tab_payroll_remittance_agency_event_content_div">
<div class="first-column-sub-view">
</div>
<div class="save-and-continue-div">
<span class="message"></span>
<div class="save-and-continue-button-div">
<button class="tt-button p-button p-component" type="button">
<span class="icon"></span>
<span class="p-button-label"></span>
</button>
</div>
</div>
</div>
</div>`;
}
}