Add import API module files and templates
- Created front.js for handling frontend JavaScript functionalities. - Added index.php files for both the views and templates to manage redirection and access control. - Implemented configure.tpl for admin configuration settings with AJAX functionality for field retrieval. - Developed delete.tpl for product deletion with progress tracking. - Introduced file_upload.tpl for file upload handling with drag-and-drop support. - Created import.tpl for managing product imports with progress indicators. - Added list.tpl for displaying uploaded files with action links. - Implemented temp.tpl for queuing products with visual feedback. - Enhanced index.php for module access control. - Updated templates to include necessary JavaScript for AJAX operations and user interactions.
This commit is contained in:
79
modules/import_api/views/templates/admin/delete.tpl
Normal file
79
modules/import_api/views/templates/admin/delete.tpl
Normal file
@@ -0,0 +1,79 @@
|
||||
{**
|
||||
* 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>
|
||||
Reference in New Issue
Block a user