openvk/Web/Presenters/templates/Gifts/Pick.xml

59 lines
1.8 KiB
XML
Raw Normal View History

{extends "../@layout.xml"}
{block title}
Выбрать подарок
{/block}
{block header}
<a href="{$user->getURL()}">{$user->getCanonicalName()}</a> »
<a href="/gifts?act=pick&user={$user->getId()}">Выбор подарка</a> »
<a href="/gifts?act=pick&user={$user->getId()}">Коллекции</a> »
{$cat->getName(tr("__lang"))}
{/block}
{block content}
<div class="gift_grid">
<div n:foreach="$gifts as $gift" n:class="gift_sel, !$gift->canUse($thisUser) ? disabled" data-gift="{$gift->getId()}">
<img class="gift_pic" src="{$gift->getImage(2)}" alt="Подарок" />
<strong class="gift_price">
{if $gift->isFree()}
бесплатный
{else}
{$gift->getPrice()} голосов
{/if}
</strong>
<strong class="gift_limit">
{if $gift->getUsagesLeft($thisUser) !== INF}
осталось {$gift->getUsagesLeft($thisUser)} штук
{/if}&nbsp;
</strong>
</div>
</div>
<div style="padding: 8px;">
{include "../components/paginator.xml", conf => (object) [
"page" => $page,
"count" => $count,
"amount" => sizeof($gifts),
"perPage" => OPENVK_DEFAULT_PER_PAGE,
]}
</div>
{/block}
{block bodyScripts}
<script>
$(".gift_sel").click(function() {
let el = $(this);
if(el.hasClass("disabled"))
return false;
let link = "/gifts?act=confirm&user={$user->getId()}&pack={$cat->getId()}&elid=";
let gift = el.data("gift");
window.location.assign(link + gift);
});
</script>
{/block}