_decodeProperties($_smarty_tpl, array (
'version' => '3.1.39',
'unifunc' => 'content_6494329f129837_15322620',
'has_nocache_code' => false,
'file_dependency' =>
array (
'3fcd17fd2eb62a57baf614aa6f77e79870f6a141' =>
array (
0 => 'C:\\xampp\\htdocs\\hotelcommerce\\admin\\themes\\default\\template\\helpers\\uploader\\ajax.tpl',
1 => 1687433793,
2 => 'file',
),
),
'includes' =>
array (
),
),false)) {
function content_6494329f129837_15322620 (Smarty_Internal_Template $_smarty_tpl) {
?>
tpl_vars['max_files']->value)) && count($_smarty_tpl->tpl_vars['files']->value) >= $_smarty_tpl->tpl_vars['max_files']->value) {?>
smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'You have reached the limit (%s) of files to upload, please remove files to continue uploading','sprintf'=>$_smarty_tpl->tpl_vars['max_files']->value),$_smarty_tpl ) );?>
type="text/javascript">
$( document ).ready(function() {
tpl_vars['files']->value)) && $_smarty_tpl->tpl_vars['files']->value) {?>
$('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
-images-thumbnails').parent().show();
});
>
tpl_vars['multiple']->value)) && $_smarty_tpl->tpl_vars['multiple']->value) {
echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Upload files'),$_smarty_tpl ) );
} else {
echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Upload file'),$_smarty_tpl ) );
}?>
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,
tpl_vars['post_max_size']->value))) {?>maxFileSize: tpl_vars['post_max_size']->value;?>
,
tpl_vars['drop_zone']->value))) {?>dropZone: tpl_vars['drop_zone']->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();
},
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 (data.result.tpl_vars['name']->value, ENT_QUOTES, 'UTF-8', true);?>
[i] !== null) {
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();
}
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 (typeof data.result.tpl_vars['name']->value, ENT_QUOTES, 'UTF-8', true);?>
[i].image !== 'undefined')
{
var template = '';
$('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
-images-thumbnails').html($('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
-images-thumbnails').html()+template);
$('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
-images-thumbnails').parent().show();
}
}
}
}
}
$(data.context).find('button').remove();
}
},
}).on('fileuploadalways', function (e, data) {
if (typeof tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
_max_files !== 'undefined') {
tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
_max_files--;
}
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 cannot have more than %s images in total. Please remove some of the current images before adding new ones.',$_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 = $(' ').addClass('btn btn-default pull-right').prop('type', 'button').html(' smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Remove file'),$_smarty_tpl ) );?>
').appendTo(data.context).on('click', function() {
tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
_total_files--;
data.files = null;
var total_elements = $(this).parent().siblings('div.form-group').length;
$(this).parent().remove();
if (total_elements == 0) {
$('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
-files-list').html('').parent().hide();
}
});
$('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
-files-list').parent().show();
$('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
-upload-button').show().bind('click', function () {
if (data.files != null)
data.submit();
});
tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
_total_files++;
}).on('fileuploadprocessalways', function (e, data) {
var index = data.index, file = data.files[index];
if (file.error) {
$('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
-errors').append(''+file.name+' ('+humanizeSize(file.size)+') : '+file.error+'
').parent().show();
$(data.context).find('button').trigger('click');
}
});
$('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
-files-list').parent().hide();
tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
_total_files = 0;
$('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
-add-button').on('click', function() {
$('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
-success').html('').parent().hide();
$('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
-errors').html('').parent().hide();
$('#tpl_vars['id']->value, ENT_QUOTES, 'UTF-8', true);?>
').trigger('click');
});
});
>