_decodeProperties($_smarty_tpl, array ( 'version' => '3.1.39', 'unifunc' => 'content_64943290906823_00199598', 'has_nocache_code' => false, 'file_dependency' => array ( 'aaab454b36e58dc5e836fb57c5e062e8c818ef81' => array ( 0 => 'C:\\xampp\\htdocs\\hotelcommerce\\admin\\themes\\default\\template\\controllers\\products\\helpers\\uploader\\ajax.tpl', 1 => 1687433793, 2 => 'file', ), ), 'includes' => array ( ), ),false)) { function content_64943290906823_00199598 (Smarty_Internal_Template $_smarty_tpl) { ?>
tpl_vars['url']->value))) {?> data-url="tpl_vars['url']->value;?> "tpl_vars['multiple']->value)) && $_smarty_tpl->tpl_vars['multiple']->value) {?> multiple="multiple" style="width:0px;height:0px;" />
type="text/javascript"> function humanizeSize(bytes) { if (typeof bytes !== 'number') { return ''; } if (bytes >= 1000000000) { return (bytes / 1000000000).toFixed(2) + ' GB'; } if (bytes >= 1000000) { return (bytes / 1000000).toFixed(2) + ' MB'; } return (bytes / 1000).toFixed(2) + ' KB'; } $( document ).ready(function() { tpl_vars['multiple']->value)) && (isset($_smarty_tpl->tpl_vars['max_files']->value))) {?> var tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> _max_files = tpl_vars['max_files']->value-count($_smarty_tpl->tpl_vars['files']->value);?> ; tpl_vars['files']->value)) && $_smarty_tpl->tpl_vars['files']->value) {?> $('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> -images-thumbnails').parent().show(); var tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> _upload_button = Ladda.create( document.querySelector('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> -upload-button' )); var tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> _total_files = 0; $('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> ').fileupload({ dataType: 'json', async: false, autoUpload: false, singleFileUploads: true, maxFileSize: tpl_vars['post_max_size']->value;?> , start: function (e) { tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> _upload_button.start(); $('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> -upload-button').unbind('click'); //Important as we bind it for every elements in add function }, fail: function (e, data) { $('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> -errors').html(data.errorThrown.message).parent().show(); $('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> -files-list').html('').parent().hide(); }, done: function (e, data) { if (data.result) { if (typeof data.result.tpl_vars['name']->value, ENT_QUOTES, 'UTF-8', true);?> !== 'undefined') { for (var i=0; itpl_vars['name']->value, ENT_QUOTES, 'UTF-8', true);?> .length; i++) { if (typeof data.result.tpl_vars['name']->value, ENT_QUOTES, 'UTF-8', true);?> [i].error !== 'undefined' && data.result.tpl_vars['name']->value, ENT_QUOTES, 'UTF-8', true);?> [i].error != '') { $('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> -errors').html(''+data.result.tpl_vars['name']->value, ENT_QUOTES, 'UTF-8', true);?> [i].name+' : '+data.result.tpl_vars['name']->value, ENT_QUOTES, 'UTF-8', true);?> [i].error).parent().show(); $('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> -files-list').html('').parent().hide(); } else { $(data.context).appendTo($('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> -success')); $('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> -success').parent().show(); if (data.result.tpl_vars['name']->value, ENT_QUOTES, 'UTF-8', true);?> [i] !== null && data.result.tpl_vars['name']->value, ENT_QUOTES, 'UTF-8', true);?> [i].status == 'ok') { var response = data.result.tpl_vars['name']->value, ENT_QUOTES, 'UTF-8', true);?> [i]; var cover = "icon-check-empty"; var legend = ''; if (response.cover == "1") cover = "icon-check-sign"; if (typeof response.legend !== 'undefined' && response.legend != null) legend = response.legend[tpl_vars['default_language']->value);?> ]; imageLine(response.id, response.path, response.position, cover, response.shops, legend); $("#countImage").html(parseInt($("#countImage").html()) + 1); $("#img" + id).remove(); $("#imageTable").tableDnDUpdate(); } } } } $(data.context).find('button').remove(); } }, }).on('fileuploadalways', function (e, data) { tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> _total_files--; if (tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> _total_files == 0) { tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> _upload_button.stop(); $('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> -upload-button').unbind('click'); $('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> -files-list').parent().hide(); } }).on('fileuploadadd', function(e, data) { if (typeof tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> _max_files !== 'undefined') { if (tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> _total_files >= tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> _max_files) { e.preventDefault(); alert('smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>sprintf('You can upload a maximum of %s files',$_smarty_tpl->tpl_vars['max_files']->value)),$_smarty_tpl ) );?> '); return; } } data.context = $('
').addClass('form-group').appendTo($('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?> -files-list')); var file_name = $('').append(' '+data.files[0].name+' ('+humanizeSize(data.files[0].size)+')').appendTo(data.context); var button = $('