80 lines
2.3 KiB
Smarty
80 lines
2.3 KiB
Smarty
{**
|
|
* NOTICE OF LICENSE
|
|
* With the purchase or the installation of the software in your application
|
|
* you accept the license agreement.
|
|
*
|
|
* You can not resell and redistribute this file.
|
|
*
|
|
* @author Dalibor Stojcevski <dal_sto@yahoo.com>
|
|
* @copyright 2019 Dalibor Stojcevski
|
|
* @license Dalibor Stojcevski
|
|
*}
|
|
<div class="panel">
|
|
<p>There are {$total} products from this file {$file_name}. Products will be deleted from prestashop. Press delete button only if you are sure that you don't need products from this file</p>
|
|
</div>
|
|
<div class="panel">
|
|
<div class="buttons">
|
|
<input type="button" value="Start delete" id="start-delete" data-loading-text="{l s='Deleting' mod='import_api'}" class="btn btn-primary api-delete" />
|
|
</div>
|
|
<div id="import-result" style="min-height:100px"></br>
|
|
<div class="progress">
|
|
<div class="progress-bar progress-bar-success progress-bar-striped" role="progressbar"
|
|
aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%"></div>
|
|
</div>
|
|
<span>Deleted : </span> <span id="deleted-number">NA</span></br>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script type="text/javascript">
|
|
var deleted = 0;
|
|
var global_limit = {$total};
|
|
|
|
$(document).delegate('#start-delete', 'click', function() {
|
|
$('#start-delete').button('loading');
|
|
$('#delete-number').html('');
|
|
|
|
deleteProducts();
|
|
});
|
|
|
|
function deleteProducts(){
|
|
$.ajax({
|
|
url: '{$get_import_link}&action=delete&token={$token}',
|
|
type: 'post',
|
|
data: $('#module_form').serialize(),
|
|
dataType: 'json',
|
|
beforeSend: function() {
|
|
$('#delete-number').html($('#delete-number').html() + ' /Please wait...');
|
|
},
|
|
complete: function() {
|
|
|
|
},
|
|
success: function(ret) {
|
|
session_processed = ret['products_deleted'];
|
|
createVisialProgress(ret);
|
|
if(ret['notice'] == 'time_out'){
|
|
deleteProducts();
|
|
|
|
} else {
|
|
$('#start-delete').button('reset');
|
|
}
|
|
},
|
|
error: function(xhr, ajaxOptions, thrownError) {
|
|
//alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
|
deleteProducts();
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function createVisialProgress(ret){
|
|
deleted += ret['products_deleted'];
|
|
$('#deleted-number').html(deleted);
|
|
processed = deleted;
|
|
|
|
valeur = ( processed / global_limit ) * 100;
|
|
$('.progress-bar').css('width', valeur+'%').attr('aria-valuenow', valeur);
|
|
|
|
}
|
|
</script>
|