Files
lulandia.pl/modules/phstickers/views/templates/admin/product.tpl
2025-04-01 00:38:54 +02:00

99 lines
5.3 KiB
Smarty

<div class="panel product-tab" id="product-informations">
<h3>Dodaj naklejki do produktu</h3>
{if !empty($list)}
<p class='alert alert-info'>Możesz wybrać maksymalnie <b>{$PHSTICKERS_PRODUCT_MAX}</b> naklejki.</p>
<div class="row">
<div class="col-lg-4">
<div class="form-group">
<label class="control-label col-lg-12">Wybierz naklejkę:</label>
<div class="col-lg-12">
<table class="table">
<tbody>
<tr>
<td>
<div class="checkbox">
<label>
{assign var=brak value=0}
<input type="checkbox" name="stickers[]" value="0"{if $brak|in_array:$stickers || empty($stickers)} checked="checked"{/if} />
BRAK
</label>
</div>
</td>
<td></td>
</tr>
{foreach $list as $l}
<tr>
<td>
<div class="checkbox">
<label>
<input type="checkbox" class="stickerChbox" name="stickers[]" 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 class="col-lg-8">
<div class="form-group">
<label class="control-label col-lg-6 text-right" style="display: inline-block;">Czy naklejki mają być dziedziczone po kategorii?</label>
<div class="col-lg-4" style="display: inline-block;">
<span class="switch prestashop-switch fixed-width-lg">
<input id="sandbox_on" onClick="toggleDraftWarning(false);showOptions(true);showRedirectProductOptions(false);" name="stickerInherit" value="1" type="radio" {if $si == 1}checked="checked"{/if} />
<label class="radioCheck" for="sandbox_on">TAK</label>
<input id="sandbox_off" onClick="toggleDraftWarning(true);showOptions(false);showRedirectProductOptions(true);" name="stickerInherit" value="0" type="radio" {if $si == 0}checked="checked"{/if} />
<label class="radioCheck" for="sandbox_off">NIE</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
</div>
</div>
{if $ps16}
<div class="panel-footer">
<a class="btn btn-default">
<i class="process-icon-cancel"></i> Cancel
</a>
<button class="btn btn-default pull-right" name="submitAddproduct" type="submit">
<i class="process-icon-save"></i> Zapisz
</button>
<button class="btn btn-default pull-right" name="submitAddproductAndStay" type="submit">
<i class="process-icon-save"></i> Zapisz i zostań
</button>
</div>
{/if}
{else}
<div class="alert alert-warning">Brak dodanych naklejek.</div>
{/if}
</div>
<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>