Files

54 lines
4.1 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
use Bitrix\Main\Localization\Loc;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
Loc::loadMessages(__FILE__);
$this->addExternalCss("/local/components/jinove/personal.profile/templates/.default/style.css");
$number = static fn(float $value): string => rtrim(rtrim(number_format($value, 3, ",", ""), "0"), ",");
?>
<section class="vino-cab">
<?php $APPLICATION->IncludeComponent("jinove:personal.nav", ".default", ["ACTIVE" => "orders"]); ?>
<div class="vino-cab__main">
<h1 class="vino-cab__title"><?= Loc::getMessage("VINO_ORD_TITLE") ?></h1>
<div class="vino-cab__tabs" role="group" aria-label="<?= htmlspecialcharsbx(Loc::getMessage("VINO_ORD_FILTER")) ?>">
<a class="vino-cab__tab<?= $arResult["COMPLETED"] ? "" : " vino-cab__tab--active" ?>" href="<?= htmlspecialcharsbx($arResult["BASE_URL"]) ?>"<?= $arResult["COMPLETED"] ? "" : ' aria-current="page"' ?>><?= Loc::getMessage("VINO_ORD_CURRENT") ?></a>
<a class="vino-cab__tab<?= $arResult["COMPLETED"] ? " vino-cab__tab--active" : "" ?>" href="<?= htmlspecialcharsbx($arResult["BASE_URL"]) ?>?status=completed"<?= $arResult["COMPLETED"] ? ' aria-current="page"' : "" ?>><?= Loc::getMessage("VINO_ORD_COMPLETED") ?></a>
</div>
<?php if (!$arResult["ORDERS"]): ?>
<div class="vino-cab__panel vino-cab__empty">
<p class="vino-cab__empty-text"><?= Loc::getMessage($arResult["COMPLETED"] ? "VINO_ORD_EMPTY_COMPLETED" : "VINO_ORD_EMPTY") ?></p>
<a class="vino-btn" href="<?= htmlspecialcharsbx($arResult["CATALOG_URL"]) ?>"><?= Loc::getMessage("VINO_ORD_TO_CATALOG") ?></a>
</div>
<?php else: ?>
<ul class="vino-cab-list">
<?php foreach ($arResult["ORDERS"] as $order): ?>
<li class="vino-cab-card">
<div class="vino-cab-card__head">
<p class="vino-cab-card__title"><?= Loc::getMessage("VINO_ORD_NUMBER", ["#NUMBER#" => htmlspecialcharsbx($order["number"]), "#DATE#" => \Jinove\Vinoteca\DateFormat::long($order["date"], LANGUAGE_ID)]) ?></p>
<p class="vino-cab-card__status<?= $order["canceled"] ? " vino-cab-card__status--canceled" : "" ?>"><?= $order["canceled"] ? Loc::getMessage("VINO_ORD_CANCELED") : htmlspecialcharsbx(Loc::getMessage("VINO_ORD_STATUS_" . $order["statusId"]) ?: $order["status"]) ?></p>
</div>
<ul class="vino-cab-card__items">
<?php foreach ($order["items"] as $item): ?>
<li class="vino-cab-card__item">
<?php if ($item["image"] !== ""): ?><img class="vino-cab-card__image" src="<?= htmlspecialcharsbx($item["image"]) ?>" width="64" height="64" alt="" loading="lazy" decoding="async"><?php endif; ?>
<div class="vino-cab-card__info">
<?php if ($item["url"] !== ""): ?><a class="vino-cab-card__name" href="<?= htmlspecialcharsbx($item["url"]) ?>"><?= htmlspecialcharsbx($item["name"]) ?></a><?php else: ?><span class="vino-cab-card__name"><?= htmlspecialcharsbx($item["name"]) ?></span><?php endif; ?>
<span class="vino-cab-card__meta"><?= htmlspecialcharsbx($number($item["quantity"])) ?> × <?= htmlspecialcharsbx($item["price"]) ?></span>
</div>
</li>
<?php endforeach; ?>
</ul>
<p class="vino-cab-card__total"><?= Loc::getMessage("VINO_ORD_TOTAL") ?> <span class="vino-cab-card__sum"><?= htmlspecialcharsbx($order["total"]) ?></span></p>
</li>
<?php endforeach; ?>
</ul>
<?php if ($arResult["MORE_URL"] !== ""): ?>
<a class="vino-btn vino-btn--outline vino-cab__more" href="<?= htmlspecialcharsbx($arResult["MORE_URL"]) ?>"><?= Loc::getMessage("VINO_ORD_MORE") ?></a>
<?php endif; ?>
<?php endif; ?>
</div>
</section>