TimeTrex Community Edition v16.2.0
This commit is contained in:
@ -0,0 +1,31 @@
|
||||
<script>
|
||||
var pay_stub_account_wizard_controller = new PayStubAccountWizardController();
|
||||
</script>
|
||||
<div class="wizard-bg">
|
||||
<div class="wizard-overlay"></div>
|
||||
<div class="wizard">
|
||||
<span class="title">Wizard</span>
|
||||
<div class="progress-bar">
|
||||
<div class="title-1-div">
|
||||
<div class="logo"></div>
|
||||
<span class="title-1">Wizard</span>
|
||||
</div>
|
||||
<div class="clear-both-div"></div>
|
||||
<progress class="progress" max="10" value="0">
|
||||
</progress>
|
||||
<span class="steps"></span>
|
||||
</div>
|
||||
<div class="content">
|
||||
</div>
|
||||
<div class="bottom-actions">
|
||||
<div class="move-buttons-div">
|
||||
<button class="back-btn" id="wizard-back-button"></button>
|
||||
<button class="forward-btn" id="wizard-forward-button"></button>
|
||||
</div>
|
||||
<div class="confirm-buttons-div">
|
||||
<button class="done-btn" id="wizard-done-button"></button>
|
||||
<button class="close-btn" id="wizard-close-button"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,150 @@
|
||||
export class PayStubAccountWizardController extends BaseWizardController {
|
||||
constructor( options = {} ) {
|
||||
_.defaults( options, {
|
||||
el: '.wizard-bg'
|
||||
} );
|
||||
|
||||
super( options );
|
||||
}
|
||||
|
||||
init( options ) {
|
||||
//this._super('initialize', options );
|
||||
this.title = $.i18n._( 'Migrate PS Accounts' );
|
||||
this.steps = 2;
|
||||
this.current_step = 1;
|
||||
$( this.el ).width( 1010 );
|
||||
this.render();
|
||||
}
|
||||
|
||||
render() {
|
||||
super.render();
|
||||
this.initCurrentStep();
|
||||
}
|
||||
|
||||
//Create each page UI
|
||||
buildCurrentStepUI() {
|
||||
this.content_div.empty();
|
||||
this.stepsWidgetDic[this.current_step] = {};
|
||||
|
||||
switch ( this.current_step ) {
|
||||
case 1:
|
||||
var label = this.getLabel();
|
||||
label.html( $.i18n._( 'This wizard will automatically create Pay Stub Amendments to migrate Year-To-Date amounts from one Pay Stub Account to another as of a specific effective date.' ) + '<br><br>' );
|
||||
this.content_div.append( label );
|
||||
break;
|
||||
case 2:
|
||||
//Source Pay Stub Account
|
||||
var form_item = $( Global.loadWidget( 'global/widgets/wizard_form_item/WizardFormItem.html' ) );
|
||||
form_item.css( 'margin-top', '15px' );
|
||||
var form_item_label = form_item.find( '.form-item-label' );
|
||||
var form_item_input_div = form_item.find( '.form-item-input-div' );
|
||||
var a_combobox = this.getAComboBox( TTAPI.APIPayStubEntryAccount, true, 'global_PayStubAccount', 'src_ids' );
|
||||
form_item_label.text( $.i18n._( 'Source Pay Stub Account(s)' ) );
|
||||
form_item_input_div.append( a_combobox );
|
||||
this.content_div.append( form_item );
|
||||
this.stepsWidgetDic[this.current_step][a_combobox.getField()] = a_combobox;
|
||||
|
||||
// Destination Pay Stub Account
|
||||
form_item = $( Global.loadWidget( 'global/widgets/wizard_form_item/WizardFormItem.html' ) );
|
||||
form_item_label = form_item.find( '.form-item-label' );
|
||||
form_item_input_div = form_item.find( '.form-item-input-div' );
|
||||
a_combobox = this.getAComboBox( TTAPI.APIPayStubEntryAccount, false, 'global_PayStubAccount', 'dst_id' );
|
||||
form_item_label.text( $.i18n._( 'Destination Pay Stub Account' ) );
|
||||
form_item_input_div.append( a_combobox );
|
||||
this.content_div.append( form_item );
|
||||
this.stepsWidgetDic[this.current_step][a_combobox.getField()] = a_combobox;
|
||||
|
||||
//Effective Date
|
||||
form_item = $( Global.loadWidget( 'global/widgets/wizard_form_item/WizardFormItem.html' ) );
|
||||
form_item_label = form_item.find( '.form-item-label' );
|
||||
form_item_input_div = form_item.find( '.form-item-input-div' );
|
||||
var effective_date = this.getDatePicker( 'effective_date' );
|
||||
form_item_label.text( $.i18n._( 'Effective Date' ) );
|
||||
form_item_input_div.append( effective_date );
|
||||
this.content_div.append( form_item );
|
||||
this.stepsWidgetDic[this.current_step][effective_date.getField()] = effective_date;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
buildCurrentStepData() {
|
||||
var $this = this;
|
||||
var current_step_data = this.stepsDataDic[this.current_step];
|
||||
var current_step_ui = this.stepsWidgetDic[this.current_step];
|
||||
|
||||
switch ( this.current_step ) {
|
||||
case 2:
|
||||
if ( !current_step_data ) {
|
||||
var date = new Date();
|
||||
current_step_ui.effective_date.setValue( date.format() );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
onDoneClick() {
|
||||
var $this = this;
|
||||
super.onDoneClick();
|
||||
this.saveCurrentStep();
|
||||
var src_ids = this.stepsDataDic[2].src_ids;
|
||||
var dst_id = this.stepsDataDic[2].dst_id;
|
||||
var effective_date = this.stepsDataDic[2].effective_date;
|
||||
var ps_api = TTAPI.APIPayStubEntryAccount;
|
||||
ps_api.migratePayStubEntryAccount( src_ids, dst_id, effective_date, {
|
||||
onResult: function( result ) {
|
||||
var result_data = result.getResult();
|
||||
if ( result_data ) {
|
||||
$this.onCloseClick();
|
||||
if ( $this.call_back ) {
|
||||
$this.call_back();
|
||||
}
|
||||
} else {
|
||||
TAlertManager.showErrorAlert( result );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
setCurrentStepValues() {
|
||||
|
||||
if ( !this.stepsDataDic[this.current_step] ) {
|
||||
return;
|
||||
} else {
|
||||
var current_step_data = this.stepsDataDic[this.current_step];
|
||||
var current_step_ui = this.stepsWidgetDic[this.current_step];
|
||||
}
|
||||
|
||||
switch ( this.current_step ) {
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
if ( current_step_data.src_ids ) {
|
||||
current_step_ui.src_ids.setValue( current_step_data.src_ids );
|
||||
}
|
||||
if ( current_step_data.dst_id ) {
|
||||
current_step_ui.dst_id.setValue( current_step_data.dst_id );
|
||||
}
|
||||
if ( current_step_data.effective_date ) {
|
||||
current_step_ui.effective_date.setValue( current_step_data.effective_date );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
saveCurrentStep() {
|
||||
this.stepsDataDic[this.current_step] = {};
|
||||
var current_step_data = this.stepsDataDic[this.current_step];
|
||||
var current_step_ui = this.stepsWidgetDic[this.current_step];
|
||||
switch ( this.current_step ) {
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
current_step_data.src_ids = current_step_ui.src_ids.getValue();
|
||||
current_step_data.dst_id = current_step_ui.dst_id.getValue();
|
||||
current_step_data.effective_date = current_step_ui.effective_date.getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user