2021-10-07 11:48:55 +03:00
|
|
|
{extends "@layout.xml"}
|
|
|
|
|
|
|
|
{block title}
|
|
|
|
{if $form->id === 0}
|
2022-04-24 09:02:23 +03:00
|
|
|
{_admin_newgift}
|
2021-10-07 11:48:55 +03:00
|
|
|
{else}
|
2022-04-24 09:02:23 +03:00
|
|
|
{_gift} "{$form->name}"
|
2021-10-07 11:48:55 +03:00
|
|
|
{/if}
|
|
|
|
{/block}
|
|
|
|
|
|
|
|
{block heading}
|
|
|
|
{include title}
|
|
|
|
{/block}
|
|
|
|
|
|
|
|
{block content}
|
|
|
|
<form class="aui" method="POST" enctype="multipart/form-data">
|
|
|
|
<div class="field-group">
|
|
|
|
<label for="avatar">
|
2022-04-24 09:02:23 +03:00
|
|
|
{_admin_image}
|
2021-10-07 11:48:55 +03:00
|
|
|
<span n:if="$form->id === 0" class="aui-icon icon-required"></span>
|
|
|
|
</label>
|
|
|
|
{if $form->id === 0}
|
|
|
|
<input type="file" name="pic" accept="image/jpeg,image/png,image/gif,image/webp" required="required" />
|
|
|
|
{else}
|
|
|
|
<span id="avatar" class="aui-avatar aui-avatar-project aui-avatar-xlarge">
|
|
|
|
<span class="aui-avatar-inner">
|
|
|
|
<img id="pic" src="{$form->pic}" style="object-fit: cover;"></img>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
<input style="display: none;" id="picInput" type="file" name="pic" accept="image/jpeg,image/png,image/gif,image/webp" />
|
|
|
|
<div class="description">
|
2022-04-24 09:02:23 +03:00
|
|
|
<a id="picChange" href="javascript:false">{_admin_image_replace}</a>
|
2021-10-07 11:48:55 +03:00
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
</div>
|
2022-04-24 09:02:23 +03:00
|
|
|
|
2021-10-07 11:48:55 +03:00
|
|
|
<div class="field-group">
|
2022-04-24 09:02:23 +03:00
|
|
|
<label for="id">ID</label>
|
2021-10-07 11:48:55 +03:00
|
|
|
<input class="text long-field" type="number" id="id" disabled="disabled" value="{$form->id}" />
|
|
|
|
</div>
|
|
|
|
<div class="field-group">
|
2022-04-24 09:02:23 +03:00
|
|
|
<label for="usages">{_admin_uses}</label>
|
|
|
|
<input class="text long-field" type="number" id="usages" disabled="disabled" value="{$form->usages}" />
|
2021-10-07 11:48:55 +03:00
|
|
|
<div n:if="$form->usages > 0" class="description">
|
2022-04-24 09:02:23 +03:00
|
|
|
<a href="javascript:$('#usages').value(0);">{_admin_uses_reset}</a>
|
2021-10-07 11:48:55 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="field-group">
|
|
|
|
<label for="name">
|
2022-04-24 09:02:23 +03:00
|
|
|
{_admin_name}
|
2021-10-07 11:48:55 +03:00
|
|
|
<span class="aui-icon icon-required"></span>
|
|
|
|
</label>
|
|
|
|
<input class="text long-field" type="text" id="name" name="name" value="{$form->name}" />
|
|
|
|
</div>
|
|
|
|
<div class="field-group">
|
|
|
|
<label for="price">
|
2022-04-24 09:02:23 +03:00
|
|
|
{_admin_price}
|
2021-10-07 11:48:55 +03:00
|
|
|
<span class="aui-icon icon-required"></span>
|
|
|
|
</label>
|
|
|
|
<input class="text long-field" type="number" id="price" name="price" min="0" value="{$form->price}" />
|
|
|
|
</div>
|
|
|
|
<div class="field-group">
|
|
|
|
<label for="limit">
|
2022-04-24 09:02:23 +03:00
|
|
|
{_admin_limits}
|
2021-10-07 11:48:55 +03:00
|
|
|
<span class="aui-icon icon-required"></span>
|
|
|
|
</label>
|
|
|
|
<input class="text long-field" type="number" min="-1" id="limit" name="limit" value="{$form->limit}" />
|
|
|
|
</div>
|
|
|
|
<fieldset class="group">
|
|
|
|
<legend></legend>
|
|
|
|
<div class="checkbox" resolved="">
|
|
|
|
<input n:attr="disabled => $form->id === 0, checked => $form->id === 0" class="checkbox" type="checkbox" name="reset_limit" id="reset_limit" />
|
|
|
|
<span class="aui-form-glyph"></span>
|
2022-04-24 09:02:23 +03:00
|
|
|
|
|
|
|
<label for="reset_limit">{_admin_limits_reset}</label>
|
2021-10-07 11:48:55 +03:00
|
|
|
</div>
|
|
|
|
</fieldset>
|
2022-04-24 09:02:23 +03:00
|
|
|
|
2021-10-07 11:48:55 +03:00
|
|
|
<input n:if="$form->id === 0" type="hidden" name="_cat" value="{$_GET['cat'] ?? 1}" />
|
2022-04-24 09:02:23 +03:00
|
|
|
|
2021-10-07 11:48:55 +03:00
|
|
|
<div class="buttons-container">
|
|
|
|
<div class="buttons">
|
|
|
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
|
|
|
<input class="aui-button aui-button-primary submit" type="submit" value="{_save}">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
{/block}
|
|
|
|
|
|
|
|
{block scripts}
|
|
|
|
<script>
|
|
|
|
const TRANS_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
2022-04-24 09:02:23 +03:00
|
|
|
|
2021-10-07 11:48:55 +03:00
|
|
|
$("#picChange").click(_ => $("#picInput").click());
|
|
|
|
$("#picInput").bind("change", e => {
|
|
|
|
if(typeof e.target.files[0] === "undefined")
|
|
|
|
$("#pic").prop("src", URL.createObjectURL(TRANS_GIF));
|
2022-04-24 09:02:23 +03:00
|
|
|
|
2021-10-07 11:48:55 +03:00
|
|
|
$("#pic").prop("src", URL.createObjectURL(e.target.files[0]));
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
{/block}
|