").dxButton( {
text : "Cancel",
onClick : function( e ) {
instance.popup.hide();
instance.popup.element().remove();
}
}).dxButton( "instance" );
return instance.cancelButton.element();
}
},
{
toolbar : "bottom",
location : "after",
template : function() {
instance.mergeButton = $("
").dxButton( {
text : "Merge",
type : "default",
disabled : true,
onClick : function( e ) {
const $mergeAckCheckbox = $( "form[name='frm_merge'] input[name='mergeAck']" );
if( !$mergeAckCheckbox.is( ':checked' ) ){
alert( 'Please acknowledge that you indeed wish to merge these two operators.' );
return;
}
let bMergeBlocked = false;
let deliveryLocationInputs = $( "input[name='deliveryLocation']" );
if( deliveryLocationInputs.length > 0 ) {
deliveryLocationInputs.each( function( index, element ) {
if( $( this ).val() !== '0' ) {
bMergeBlocked = true;
//alert( 'Merge not allowed. One of the operators is a claim delivery location.' );
alert( 'Heads up!\n\nMerging these accounts is not possible right now as one of the operators is a delivery location from claims.\n\nWhat you can do:\n\nTo move forward, you can rename the operator instead. This is the only available option at the moment. If you need additional help, contact TELUS Support through Service Cloud.' );
return false;
}
});
}
if( bMergeBlocked ) {
instance.popup.hide();
instance.popup.element().remove();
return;
}
//instance.contentElement.empty();
const loadPanel = $( '
' ).dxLoadPanel({
container: instance.popup.content(),
visible: false,
showIndicator: true,
showPane: true,
shading: true,
shadingColor: 'rgba(0, 0, 0, 0.5)',
hideOnOutsideClick: false,
message: 'Merging...',
}).appendTo( instance.popup.content() ).dxLoadPanel('instance');
instance.flipFlopButton.option( "disabled", true );
instance.mergeButton.option( "disabled", true );
instance.cancelButton.option( "disabled", true );
loadPanel.show();
let mergeURL = Fse.Util.updateURL2( $("link#PortalDocRootURL").attr("href") + '/apps/OPR/index.cfm', { do : 'mergeOperators' } );
$.ajax({
url: mergeURL,
method: 'POST',
data: $( "form[name='frm_merge']" ).serialize(),
success: function( data, textStatus, jqXHR ) {
let confirmationHeader = Fse.Ajax.getResponseHeader( jqXHR, 'x-fse-merge-confirmation' );
if( confirmationHeader === 'succeeded' ) {
DevExpress.ui.notify( { message: 'Merge Successful', width: 500, position: 'top center' }, 'success', 2000 );
} else {
DevExpress.ui.notify( { message: 'Merge Failed', width: 500, position: 'top center' }, 'warning', 2000 );
}
loadPanel.hide();
instance.popup.hide();
instance.popup.element().remove();
instance.dataGrid.refresh();
}
})/*.always( function() {
instance.popup.hide();
instance.popup.element().remove();
})*/
}
}).dxButton( "instance");
return instance.mergeButton.element();
}
}],
onHidden: function() {
instance.popup.dispose();
instance.popup.element().remove();
},
}).dxPopup( 'instance' );
instance.popup.element().appendTo( "body" );
instance.popup.show();
}