<commit_before><?php
/**
 * FoodCoopShop - The open source software for your foodcoop
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @since         FoodCoopShop 1.0.0
 * @license       https://opensource.org/licenses/mit-license.php MIT License
 * @author        <NAME> <<EMAIL>>
 * @copyright     Copyright (c) <NAME>, https://www.rothauer-it.com
 * @link          https://www.foodcoopshop.com
 */

use Cake\Core\Configure;

if (!$appAuth->user() || $appAuth->isManufacturer()) {
    return;
}

$this->element('addScript', ['script' =>
    Configure::read('app.jsNamespace').".Cart.setCartButtonIcon('".$cartButtonIcon."');"
]);

if ($appAuth->Cart->getProducts() !== null) {
    $this->element('addScript', ['script' =>
        Configure::read('app.jsNamespace').".Cart.initCartProducts('".addslashes(json_encode($appAuth->Cart->getProducts()))."');"
    ]);

    if (!empty($cartErrors)) {
        $javascriptClass = 'Cart';
        if ($selfServiceModeEnabled) {
            $javascriptClass = 'SelfService';
        }
        $this->element('addScript', ['script' =>
            Configure::read('app.jsNamespace').".".$javascriptClass.".initCartErrors('".addslashes(json_encode($cartErrors))."');"
        ]);
    }
    if ($this->name == 'Carts' && $this->request->getParam('action') == 'detail') {
        $this->element('addScript', ['script' =>
            Configure::read('app.jsNamespace').".Cart.initRemoveFromCartLinks();".
            Configure::read('app.jsNamespace').".Cart.initChangeAmountLinks();"
        ]);
    }
}
?>

<div id="cart" class="box cart">

    <h3>
        <i class="fa <?php echo $icon; ?>"></i>
        <?php echo $name; ?>
        <a class="question" target="_blank" href="<?php echo $docsLink; ?>"><i class="far fa-question-circle"></i></a>
    </h3>

    <div class="inner">

        <?php
        if ($showLoadLastOrderDetailsDropdown && !$appAuth->isInstantOrderMode()) {
            $lastOrderDetails = $appAuth->getLastOrderDetailsForDropdown();
            if (!empty($lastOrderDetails)) {
                $lastOrderDetails['remove-all-products-from-cart'] = __('Empty_cart').'...';
                $this->element('addScript', ['script' =>
                    Configure::read('app.jsNamespace') . ".ModalLoadLastOrderDetails.init();"
                ]);
                echo $this->Form->control('load-last-order-details', [
                    'label' => '',
                    'type' => 'select',
                    'empty' => __('Load_past_orders').'...',
                    'options' => $lastOrderDetails
                ]);
            }
        }

        if ($appAuth->user() && $this->Html->paymentIsCashless()) {
            if ($appAuth->isInstantOrderMode()) {
                $this->element('addScript', ['script' =>
                    Configure::read('app.jsNamespace').".ModalInstantOrderCancel.init();"
                ]);
                echo '<p class="instant-order-customer-info">';
                    echo __('This_order_will_be_placed_for_{0}.', ['<b>'.$this->request->getSession()->read('Auth.instantOrderCustomer')->name.'</b>']);
                    if (Configure::read('appDb.FCS_SHOW_NON_STOCK_PRODUCTS_IN_INSTANT_ORDERS')) {
                        echo ' ' . __('Only_stock_products_are_shown.');
                    }
                echo '<b><a class="btn btn-outline-light" href="javascript:void(0);">'.__('Cancel_instant_order?').'</a></b>';
                echo '</p>';

            }
            $class = ['payment'];
            if ($creditBalance < 0) { // set in FrontendController
                $class[] = 'negative';
            }
            echo '<div class="credit-balance-wrapper">';
              echo '<p><b><a href="'.$this->Slug->getMyCreditBalance().'">'.__('Your_credit_balance').'</a></b><b class="'.implode(' ', $class).'">'.$this->Number->formatAsCurrency($creditBalance).'</b></p>';
            if ($shoppingLimitReached) {
                echo '<p><b class="negative">'.__('You_reached_the_order_limit_{0}_please_add_credit.',[$this->Number->formatAsCurrency(Configure::read('appDb.FCS_MINIMAL_CREDIT_BALANCE'))]).'</b></p>';
                echo '<p><a class="btn btn-success" href="'.$this->Slug->getMyCreditBalance().'">';
                echo __('Add_credit');
                echo '</a></p>';
            }
                echo '</div>';
        }
        ?>

        <?php if (!isset($shoppingLimitReached) || !$shoppingLimitReached) {  // set in AppController ?>
            <p class="no-products"><?php echo $cartEmptyMessage; ?></p>
            <p class="products"></p>
            <p class="sum-wrapper"><b><?php echo __('Sum'); ?></b><span class="sum"><?php echo $this->Number->formatAsCurrency(0); ?></span></p>
            <p class="deposit-sum-wrapper"><b><?php echo __('Deposit'); ?></b><span class="sum"><?php echo $this->Number->formatAsCurrency(0); ?></span></p>
            <p class="tax-sum-wrapper"><b><?php echo __('Value_added_tax'); ?></b><span class="sum"><?php echo $this->Number->formatAsCurrency(0); ?></span></p>

            <?php if (!$appAuth->isInstantOrderMode() && $appAuth->isTimebasedCurrencyEnabledForCustomer()) { ?>
                <p class="timebased-currency-sum-wrapper"><b><?php echo __('From_which_in'); ?> <?php echo Configure::read('appDb.FCS_TIMEBASED_CURRENCY_NAME'); ?></b><span class="sum"><?php echo $this->TimebasedCurrency->formatSecondsToTimebasedCurrency($appAuth->Cart->getTimebasedCurrencySecondsSum()); ?></span></p>
            <?php } ?>
<commit_msg>instant order hint was not shown if payment type is cash<commit_after><?php
/**
 * FoodCoopShop - The open source software for your foodcoop
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @since         FoodCoopShop 1.0.0
 * @license       https://opensource.org/licenses/mit-license.php MIT License
 * @author        <NAME> <<EMAIL>>
 * @copyright     Copyright (c) <NAME>, https://www.rothauer-it.com
 * @link          https://www.foodcoopshop.com
 */

use Cake\Core\Configure;

if (!$appAuth->user() || $appAuth->isManufacturer()) {
    return;
}

$this->element('addScript', ['script' =>
    Configure::read('app.jsNamespace').".Cart.setCartButtonIcon('".$cartButtonIcon."');"
]);

if ($appAuth->Cart->getProducts() !== null) {
    $this->element('addScript', ['script' =>
        Configure::read('app.jsNamespace').".Cart.initCartProducts('".addslashes(json_encode($appAuth->Cart->getProducts()))."');"
    ]);

    if (!empty($cartErrors)) {
        $javascriptClass = 'Cart';
        if ($selfServiceModeEnabled) {
            $javascriptClass = 'SelfService';
        }
        $this->element('addScript', ['script' =>
            Configure::read('app.jsNamespace').".".$javascriptClass.".initCartErrors('".addslashes(json_encode($cartErrors))."');"
        ]);
    }
    if ($this->name == 'Carts' && $this->request->getParam('action') == 'detail') {
        $this->element('addScript', ['script' =>
            Configure::read('app.jsNamespace').".Cart.initRemoveFromCartLinks();".
            Configure::read('app.jsNamespace').".Cart.initChangeAmountLinks();"
        ]);
    }
}
?>

<div id="cart" class="box cart">

    <h3>
        <i class="fa <?php echo $icon; ?>"></i>
        <?php echo $name; ?>
        <a class="question" target="_blank" href="<?php echo $docsLink; ?>"><i class="far fa-question-circle"></i></a>
    </h3>

    <div class="inner">

        <?php
        if ($showLoadLastOrderDetailsDropdown && !$appAuth->isInstantOrderMode()) {
            $lastOrderDetails = $appAuth->getLastOrderDetailsForDropdown();
            if (!empty($lastOrderDetails)) {
                $lastOrderDetails['remove-all-products-from-cart'] = __('Empty_cart').'...';
                $this->element('addScript', ['script' =>
                    Configure::read('app.jsNamespace') . ".ModalLoadLastOrderDetails.init();"
                ]);
                echo $this->Form->control('load-last-order-details', [
                    'label' => '',
                    'type' => 'select',
                    'empty' => __('Load_past_orders').'...',
                    'options' => $lastOrderDetails
                ]);
            }
        }

        if ($appAuth->isInstantOrderMode()) {
            $this->element('addScript', ['script' =>
                Configure::read('app.jsNamespace').".ModalInstantOrderCancel.init();"
            ]);
            echo '<p class="instant-order-customer-info">';
                echo __('This_order_will_be_placed_for_{0}.', ['<b>'.$this->request->getSession()->read('Auth.instantOrderCustomer')->name.'</b>']);
                if (Configure::read('appDb.FCS_SHOW_NON_STOCK_PRODUCTS_IN_INSTANT_ORDERS')) {
                    echo ' ' . __('Only_stock_products_are_shown.');
                }
            echo '<b><a class="btn btn-outline-light" href="javascript:void(0);">'.__('Cancel_instant_order?').'</a></b>';
            echo '</p>';

            if ($appAuth->user() && $this->Html->paymentIsCashless()) {
                $class = ['payment'];
                if ($creditBalance < 0) { // set in FrontendController
                    $class[] = 'negative';
                }
                echo '<div class="credit-balance-wrapper">';
                  echo '<p><b><a href="'.$this->Slug->getMyCreditBalance().'">'.__('Your_credit_balance').'</a></b><b class="'.implode(' ', $class).'">'.$this->Number->formatAsCurrency($creditBalance).'</b></p>';
                    if ($shoppingLimitReached) {
                        echo '<p><b class="negative">'.__('You_reached_the_order_limit_{0}_please_add_credit.',[$this->Number->formatAsCurrency(Configure::read('appDb.FCS_MINIMAL_CREDIT_BALANCE'))]).'</b></p>';
                        echo '<p><a class="btn btn-success" href="'.$this->Slug->getMyCreditBalance().'">';
                        echo __('Add_credit');
                        echo '</a></p>';
                    }
                echo '</div>';
            }
        }
        ?>

        <?php if (!isset($shoppingLimitReached) || !$shoppingLimitReached) {  // set in AppController ?>
            <p class="no-products"><?php echo $cartEmptyMessage; ?></p>
            <p class="products"></p>
            <p class="sum-wrapper"><b><?php echo __('Sum'); ?></b><span class="sum"><?php echo $this->Number->formatAsCurrency(0); ?></span></p>
            <p class="deposit-sum-wrapper"><b><?php echo __('Deposit'); ?></b><span class="sum"><?php echo $this->Number->formatAsCurrency(0); ?></span></p>
            <p class="tax-sum-wrapper"><b><?php echo __('Value_added_tax'); ?></b><span class="sum"><?php echo $this->Number->formatAsCurrency(0); ?></span></p>

            <?php if (!$appAuth->isInstantOrderMode() && $appAuth->isTimebasedCurrencyEnabledForCustomer()) { ?>
                <p class="timebased-currency-sum-wrapper"><b><?php echo __('From_which_in'); ?> <?php echo Configure::read('appDb.FCS_TIMEBASED_CURRENCY_NAME'); ?></b><span class="sum"><?php echo $this->TimebasedCurrency->formatSecondsToTimebasedCurrency($appAuth->Cart->getTimebasedCurrencySecondsSum()); ?></span></p>
            <?php } ?>

{'fraction_non_alphanumeric': 0.20166886253842775, 'fraction_numerical': 0.002108036890645586, 'mean_word_length': 2.6342164060006383, 'pattern_counts': {'":': 0, '<': 177, '<?xml version=': 0, '>': 289, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6784961', 'n_tokens_mistral': 3397, 'n_tokens_neox': 3368, 'n_words': 512}