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

58 lines
1.8 KiB
XML
Raw Normal View History

{extends "../@layout.xml"}
{block title}
2021-10-07 23:09:14 +03:00
{_gift_select}
{/block}
{block header}
<a href="{$user->getURL()}">{$user->getCanonicalName()}</a> »
2021-10-07 23:09:14 +03:00
<a href="/gifts?act=pick&user={$user->getId()}">{_gift_select}</a> »
<a href="/gifts?act=pick&user={$user->getId()}">{_collections}</a> »
{$cat->getName(tr("__lang"))}
{/block}
{block content}
2024-11-02 11:16:25 +03:00
<div class="gift_grid scroll_container">
<div n:foreach="$gifts as $gift" n:class="scroll_node, gift_sel, !$gift->canUse($thisUser) ? disabled" data-gift="{$gift->getId()}">
2024-01-06 21:30:59 +03:00
<img class="gift_pic" src="{$gift->getImage(2)}" alt="{_gift}" loading=lazy />
<strong class="gift_price">
{if $gift->isFree()}
2021-10-07 23:09:14 +03:00
{_free_gift}
{else}
2021-10-07 23:09:14 +03:00
{tr('coins', $gift->getPrice())}
{/if}
</strong>
2024-01-06 21:30:59 +03:00
<strong class="gift_limit">
{if $gift->getUsagesLeft($thisUser) !== INF}
2021-10-07 23:09:14 +03:00
{tr("gifts_left", $gift->getUsagesLeft($thisUser))}
{/if}&nbsp;
</strong>
</div>
</div>
2024-01-06 21:30:59 +03:00
<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;
2024-01-06 21:30:59 +03:00
let link = "/gifts?act=confirm&user={$user->getId()}&pack={$cat->getId()}&elid=";
let gift = el.data("gift");
2024-01-06 21:30:59 +03:00
window.location.assign(link + gift);
});
</script>
2024-01-06 21:30:59 +03:00
{/block}