<commit_before><?php
/**
 * Pizza E96
 *
 * @author: <NAME>
 */

/** @var \App\TemplateEngine $this */
/** @var \App\Models\RequestsRowset $myRequests */
/** @var array $orderPizzas */
/** @var \App\Models\OrdersRow $order */
/** @var int $orderPrice */
/** @var bool $canEdit */

$title = "Заказ №" . $order->id . " &mdash; Пицца E96";

$priceMultiplier = $orderPrice != 0 ? 1 - $order->discount_percent / 100 - $order->discount_absolute / $orderPrice : 0;
$hasDiscount = $order->discount_absolute != 0 || $order->discount_percent != 0;
$isActive = $order->status == \App\Models\OrdersRow::STATUS_ACTIVE;

?>
<h2>Заказ № <?php echo $this->escape($order->id) ?>
<?php
$btnClassByStatus = function($status) {
    $classes = [
        \App\Models\OrdersRow::STATUS_ACTIVE => "btn-primary",
        \App\Models\OrdersRow::STATUS_FIXED  => "btn-warning",
        \App\Models\OrdersRow::STATUS_ORDERED => "btn-info",
        \App\Models\OrdersRow::STATUS_DELIVERED => "btn-success",
        \App\Models\OrdersRow::STATUS_CANCELLED => "btn-danger",
    ];
    return !empty($classes[$status]) ? $classes[$status] : "btn-default";
};
?>
<?php if ($canEdit) { ?>
<span class="btn <?php echo $btnClassByStatus($order->status); ?>" style="margin-left: 2em;" data-toggle="modal" data-target="#changeStatusModal"><?php echo $this->escape($order->getCurrentStatusText()); ?></span>
<?php } else { ?>
<span class="btn <?php echo $btnClassByStatus($order->status); ?>" style="margin-left: 2em;" disabled><?php echo $this->escape($order->getCurrentStatusText()); ?></span>
<?php } ?>

</h2>
<div class="alert alert-warning" role="alert">
    Доставка на <?php echo $this->escape(date("j M Y, H:i", strtotime($order->delivery))); ?>.
</div>

<?php if ($order->note != "") { ?>
<blockquote><?php echo $this->escape($order->note); ?></blockquote>
<?php } ?>

<?php if ($canEdit) { ?>
<p style="float: right"><a href="<?php echo $this->escape($this->url("editOrder", [ "orderId" => $order->id ])); ?>">Редактировать заказ</a></p>
<div class="modal fade" id="changeStatusModal" tabindex="-1" role="dialog" aria-labelledby="changeStatusModalLabel" aria-hidden="true">
    <form action="<?php echo $this->escape($this->url("statusOrder", [ "orderId" => $order->id ] )); ?>" method="post" class="form-horizontal changeStatus">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="changeStatusModalLabel">Изменить статус</h4>
            </div><commit_msg>Мелкие косметические правки<commit_after><?php
/**
 * Pizza E96
 *
 * @author: <NAME>
 */

/** @var \App\TemplateEngine $this */
/** @var \App\Models\RequestsRowset $myRequests */
/** @var array $orderPizzas */
/** @var \App\Models\OrdersRow $order */
/** @var int $orderPrice */
/** @var bool $canEdit */

$title = "Заказ №" . $order->id . " &mdash; Пицца E96";

$priceMultiplier = $orderPrice != 0 ? 1 - $order->discount_percent / 100 - $order->discount_absolute / $orderPrice : 0;
$hasDiscount = $order->discount_absolute != 0 || $order->discount_percent != 0;
$isActive = $order->status == \App\Models\OrdersRow::STATUS_ACTIVE;

?>
<h1>Заказ № <?php echo $this->escape($order->id) ?>
<?php
$btnClassByStatus = function($status) {
    $classes = [
        \App\Models\OrdersRow::STATUS_ACTIVE => "btn-primary",
        \App\Models\OrdersRow::STATUS_FIXED  => "btn-warning",
        \App\Models\OrdersRow::STATUS_ORDERED => "btn-info",
        \App\Models\OrdersRow::STATUS_DELIVERED => "btn-success",
        \App\Models\OrdersRow::STATUS_CANCELLED => "btn-danger",
    ];
    return !empty($classes[$status]) ? $classes[$status] : "btn-default";
};
?>
<?php if ($canEdit) { ?>
<span class="btn <?php echo $btnClassByStatus($order->status); ?>" style="margin-left: 2em; margin-top: -5px;" data-toggle="modal" data-target="#changeStatusModal"><?php echo $this->escape($order->getCurrentStatusText()); ?></span>
<?php } else { ?>
<span class="btn <?php echo $btnClassByStatus($order->status); ?>" style="margin-left: 2em; margin-top: -5px;" disabled><?php echo $this->escape($order->getCurrentStatusText()); ?></span>
<?php } ?>
</h1>

<div class="bg-info" style="padding: 1em 1em;">
    Доставка на <?php echo $this->escape(date("j M Y, H:i", strtotime($order->delivery))); ?>.
</div>

<?php if ($order->note != "") { ?>
<blockquote><?php echo $this->escape($order->note); ?></blockquote>
<?php } ?>

<?php if ($canEdit) { ?>
<p style="float: right"><a href="<?php echo $this->escape($this->url("editOrder", [ "orderId" => $order->id ])); ?>">Редактировать заказ</a></p>
<div class="modal fade" id="changeStatusModal" tabindex="-1" role="dialog" aria-labelledby="changeStatusModalLabel" aria-hidden="true">
    <form action="<?php echo $this->escape($this->url("statusOrder", [ "orderId" => $order->id ] )); ?>" method="post" class="form-horizontal changeStatus">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="changeStatusModalLabel">Изменить статус</h4>
            </div>
{'fraction_non_alphanumeric': 0.2232884295995571, 'fraction_numerical': 0.007750507473703636, 'mean_word_length': 4.45271629778672, 'pattern_counts': {'":': 0, '<': 95, '<?xml version=': 0, '>': 159, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1041852', 'n_tokens_mistral': 1835, 'n_tokens_neox': 1844, 'n_words': 344}