Files
drmaterac.pl/modules/phstickers/views/templates/admin/editCategory.tpl
2025-01-06 20:47:25 +01:00

66 lines
3.4 KiB
Smarty

<form method="post" enctype="multipart/form-data" class="defaultForm form-horizontal">
<div class="panel">
<div class="panel-heading">
<i class="icon-cogs"></i> Edytuj naklejki dla kategorii: <b>{$category_name}</b>
</div>
<div class="form-wrapper">
<div class="row">
<div class="col-lg-4">
<p class='alert alert-info'>Możesz wybrać maksymalnie <b>{$PHSTICKERS_PRODUCT_MAX}</b> naklejki.</p>
<div class="form-group">
<label class="control-label col-lg-3">Naklejki:</label>
<div class="col-lg-9">
<table class="table">
<tbody>
{foreach $list as $l}
<tr>
<td>
<div class="checkbox">
<label>
<input type="checkbox" name="stickers[]" class="stickerChbox" value="{$l.id_sticker}"{if $l.id_sticker|in_array:$stickers} checked="checked"{/if} />
<img src="{$imageStickerDir}{$l.file_name}" alt="" style="max-width:60px;max-height: 60px;vertical-align: middle;" />
</label>
</div>
</td>
<td>
<select name="position[{$l.id_sticker}]">
<option value="">wybierz pozycję</option>
{foreach $positions as $key => $p}
<option value="{$key}"{if isset($stickerPosition[$l.id_sticker]) && $stickerPosition[$l.id_sticker] == $key} selected="selected" {/if}>{$p}</option>
{/foreach}
</select>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<input type="hidden" name="id_category" value="{$id_category}">
<div class="panel-footer">
<button id="configuration_form_submit_btn" class="btn btn-default pull-right" type="submit" value="1" name="submitEditCategoryProcess"><i class="process-icon-save"></i> {l s='Save' mod='phstickers'}</button>
</div>
</div>
</form>
<script type="text/javascript">
var max = '{$PHSTICKERS_PRODUCT_MAX}';
$(document).ready(function() {
$('.stickerChbox').on('click', function() {
var stickers = 0;
$('.stickerChbox').each(function() {
if ($(this).is(':checked')) {
stickers += 1;
}
});
if ($(this).is(':checked')) {
if (stickers > max) {
alert('Nie możesz zaznaczyć więcej niż '+max+' naklejek!');
return false;
}
}
});
});
</script>