Fixed issue raised in confirm modal
This commit is contained in:
@@ -20,8 +20,7 @@
|
||||
<button type="button" class="close" data-dismiss="modal"><i class="icon-remove-sign"></i></button>
|
||||
<h4 class="modal-title"><i class="icon icon-exclamation-triangle"></i> {l s='Confirm Delete'}</h4>
|
||||
{if isset($cartRules)}
|
||||
<p>{l s='The following cart rules in your selection were created dynamically from refunds or credit slips. Please confirm if you also intend
|
||||
to delete these cart rules.'}</p>
|
||||
<p>{l s='The following cart rules in your selection were created dynamically from refunds or credit slips. Please confirm if you also intend to delete these cart rules?'}</p>
|
||||
{else}
|
||||
<p>{l s='Are you sure, you want to delete the selected cart rules?'}</p>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*}
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><i class="icon-remove-sign"></i></button>
|
||||
<h4 class="modal-title"><i class="icon icon-exclamation-triangle"></i>{l s='Confirm Delete'}</h4>
|
||||
<h4 class="modal-title"><i class="icon icon-exclamation-triangle"></i> {l s='Confirm Delete'}</h4>
|
||||
<p>{l s='Are you sure, you want to delete this cart rule?'}</p>
|
||||
</div>
|
||||
{if isset($cartRule)}
|
||||
|
||||
@@ -144,7 +144,7 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
echo json_encode(array('html' => $html, 'next_link' => $next_link));
|
||||
}
|
||||
|
||||
public function ajaxProcessInitRuleDeleteModal()
|
||||
public function ajaxProcessInitCartRuleDeleteModal()
|
||||
{
|
||||
$response = array('success' => false);
|
||||
$modalConfirmDelete = $this->createTemplate('modal_confirm_delete.tpl');
|
||||
@@ -195,11 +195,11 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
die(Tools::jsonEncode($response));
|
||||
}
|
||||
|
||||
public function ajaxProcessInitRuleBulkDeleteModal()
|
||||
public function ajaxProcessInitCartRuleBulkDeleteModal()
|
||||
{
|
||||
$response = array('success' => false);
|
||||
$modalConfirmDelete = $this->createTemplate('modal_confirm_bulk_delete.tpl');
|
||||
if ($idCartRules = Tools::getValue('id_cart_rule')) {
|
||||
if ($idCartRules = Tools::getValue('id_cart_rules')) {
|
||||
$toConfirm = array();
|
||||
foreach($idCartRules as $idCartRule) {
|
||||
if ($ruleDetails = CartRule::getGeneratedBy($idCartRule)) {
|
||||
|
||||
@@ -46,7 +46,7 @@ $(document).ready(function() {
|
||||
cache: false,
|
||||
data: {
|
||||
ajax: true,
|
||||
action: 'InitRuleDeleteModal',
|
||||
action: 'initCartRuleDeleteModal',
|
||||
id_cart_rule: id_cart_rule
|
||||
},
|
||||
success: function(result) {
|
||||
@@ -60,12 +60,7 @@ $(document).ready(function() {
|
||||
$('#moduleConfirmDelete .btn-close').click(() => {
|
||||
resolve(false);
|
||||
});
|
||||
} else {
|
||||
resolve(true);
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$(".loading_overlay").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -86,8 +81,8 @@ function confirmDeleteBulk(form)
|
||||
cache: false,
|
||||
data: {
|
||||
ajax: true,
|
||||
action: 'InitRuleBulkDeleteModal',
|
||||
id_cart_rule: id_cart_rules
|
||||
action: 'initCartRuleBulkDeleteModal',
|
||||
id_cart_rules: id_cart_rules
|
||||
},
|
||||
success: function(result) {
|
||||
if (result.success && result.confirm_delete) {
|
||||
@@ -100,39 +95,43 @@ function confirmDeleteBulk(form)
|
||||
$('#moduleConfirmDelete .btn-close').click(() => {
|
||||
resolve(false);
|
||||
});
|
||||
} else {
|
||||
resolve(true);
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$(".loading_overlay").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function sendBulkAction(form, action)
|
||||
{
|
||||
confirmDeleteBulk(form).then((toDelete) => {
|
||||
if (toDelete) {
|
||||
String.prototype.splice = function(index, remove, string) {
|
||||
return (this.slice(0, index) + string + this.slice(index + Math.abs(remove)));
|
||||
};
|
||||
if (action.search('delete')!= -1) {
|
||||
confirmDeleteBulk(form).then((toDelete) => {
|
||||
if (toDelete) {
|
||||
submitBulkActionForm(form, action);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
submitBulkActionForm(form, action);
|
||||
}
|
||||
}
|
||||
|
||||
var form_action = $(form).attr('action');
|
||||
function submitBulkActionForm(form, action)
|
||||
{
|
||||
String.prototype.splice = function(index, remove, string) {
|
||||
return (this.slice(0, index) + string + this.slice(index + Math.abs(remove)));
|
||||
};
|
||||
|
||||
if (form_action.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g,'').replace(/\s+/g,' ') == '')
|
||||
return false;
|
||||
var form_action = $(form).attr('action');
|
||||
|
||||
if (form_action.indexOf('#') == -1)
|
||||
$(form).attr('action', form_action + '&' + action);
|
||||
else
|
||||
$(form).attr('action', form_action.splice(form_action.lastIndexOf('&'), 0, '&' + action));
|
||||
if (form_action.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g,'').replace(/\s+/g,' ') == '')
|
||||
return false;
|
||||
|
||||
if (form_action.indexOf('#') == -1)
|
||||
$(form).attr('action', form_action + '&' + action);
|
||||
else
|
||||
$(form).attr('action', form_action.splice(form_action.lastIndexOf('&'), 0, '&' + action));
|
||||
|
||||
|
||||
$(form).submit();
|
||||
}
|
||||
});
|
||||
$(form).submit();
|
||||
}
|
||||
|
||||
$(document).on('change', '.cart_rule_to_delete', function() {
|
||||
|
||||
Reference in New Issue
Block a user