<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** @var \Magento\Sales\Block\Adminhtml\Order\View\History $block */ /** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */ if ($block->getRetur()): ?> <div id="order_history_block" class="edit-order-comments" style="margin: auto 15%"><?php if ($block->canAddComment()): ?> <div class="order-history-block" id="history_form"><div class="admin__field"><label for="history_status" class="admin__field-label"><?= $block->escapeHtml(__('Status')) ?></label> <div class="admin__field-control"><select name="history[status]" id="history_status" class="admin__control-select"><?php foreach ($block->getStatuses() as $_code => $info): ?> <option value="<?= $block->escapeHtmlAttr($info['value']) ?>" <?php if ($info['value'] == $block->getRetur()->getStatus()): ?> selected="selected" <?php endif; ?>><?= $block->escapeHtml($info['label']) ?></option><?php endforeach; ?></select></div></div><?php if (in_array($block->getRetur()->getStatus(), [\Autogedal\Retur\Model\Provider\StatusProvider::ACCEPTAT, Autogedal\Retur\Model\Provider\StatusProvider::IN_LIVRARE])): ?> <div class="admin__field status_acceptat_suma_div" <?php if($block->getRetur()->getStatus() != \Autogedal\Retur\Model\Provider\StatusProvider::ACCEPTAT): ?> style="display: none" <?php endif; ?>><label for="status_acceptat_suma" class="admin__field-label"><?= $block->escapeHtml(__('Suma')) ?></label> <div class="admin__field-control"><input style="max-width: 100px" class="admin__control-text validate-number" type="text" name="history[status_acceptat_suma]" id="status_acceptat_suma" required="true" value="<?= $block->getRetur()->getStatusAcceptatSuma() ?>"></div></div><?php endif; ?> <?php if (in_array($block->getRetur()->getStatus(), [\Autogedal\Retur\Model\Provider\StatusProvider::RESPINS, Autogedal\Retur\Model\Provider\StatusProvider::IN_LIVRARE])): ?> <div class="admin__field status_respins_motiv_div" <?php if($block->getRetur()->getStatus() != \Autogedal\Retur\Model\Provider\StatusProvider::RESPINS): ?> style="display: none" <?php endif; ?>><label for="status_respins_motiv" class="admin__field-label"><?= $block->escapeHtml(__('Motiv Status Respins')) ?></label> <div class="admin__field-control"><select name="history[status_respins_motiv]" id="status_respins_motiv" class="admin__control-select"><?php foreach ($block->getRespinsReasons() as $_code => $info): ?> <option value="<?= $block->escapeHtmlAttr($info['value']) ?>" <?php if ($info['value'] == $block->getRetur()->getStatusRespinsMotiv()): ?> selected="selected" <?php endif; ?>><?= $block->escapeHtml($info['label']) ?></option><?php endforeach; ?></select></div></div><?php endif; ?> <div class="admin__field"><label for="history_comment" class="admin__field-label"><?= $block->escapeHtml(__('Comment')) ?></label> <div class="admin__field-control"><textarea name="history[comment]"
                                rows="3"
                                cols="5"
                                id="history_comment"
                                class="admin__control-textarea"></textarea></div></div><div class="admin__field"><div class="order-history-comments-options"><div class="admin__field admin__field-option"><?php if ($block->canSendCommentEmail()): ?> <input name="history[is_customer_notified]" type="checkbox" id="history_notify" value="1" /><label class="admin__field-label" for="history_notify"><?= $block->escapeHtml(__('Notify Customer by Email')) ?></label> <?php endif; ?></div></div><div class="order-history-comments-actions"><?php $onclick = "submitAndReloadArea($('order_history_block').parentNode, '" . $this->getSubmitUrl() . "')"; $button = $this->getLayout()->createBlock( \Magento\Backend\Block\Widget\Button::class )->setData( ['label' => __('Submit Comment'), 'class' => 'action-save action-secondary', 'onclick' => $onclick] )->toHtml(); echo $button; ?></div></div></div><?php endif;?> <ul class="note-list"><?php foreach ($block->getRetur()->getStatusHistoryCollection(true) as $_item): ?> <li class="note-list-item"><span class="note-list-date"><?= /* @noEscape */ $block->formatDate($_item->getCreatedAt(), \IntlDateFormatter::MEDIUM) ?></span> <span class="note-list-time"><?= /* @noEscape */ $block->formatTime($_item->getCreatedAt(), \IntlDateFormatter::MEDIUM) ?></span> <span><?= $block->escapeHtml($block->getStatusLabel($_item->getStatus())) ?></span> <span class="note-list-customer"><?= $block->escapeHtml(__('Customer')) ?> <?php if ($block->isCustomerNotificationNotApplicable($_item)): ?> <span class="note-list-customer-notapplicable"><?= $block->escapeHtml(__('Notification Not Applicable')) ?></span> <?php elseif ($_item->getIsCustomerNotified()): ?> <span class="note-list-customer-notified"><?= $block->escapeHtml(__('Notified')) ?></span> <?php else: ?> <span class="note-list-customer-not-notified"><?= $block->escapeHtml(__('Not Notified')) ?></span> <?php endif; ?></span> <?php if ($_item->getAdminUserId()): ?> <span><?= 'Admin: '.$block->escapeHtml($block->getAdmin($_item->getAdminUserId())) ?></span> <?php endif; ?> <?php if ($_item->getComment()): ?> <div class="note-list-comment"><?= $block->escapeHtml($_item->getComment(), ['b', 'br', 'strong', 'i', 'u', 'a']) ?></div><?php endif; ?></li> <?php endforeach; ?></ul><?php $scriptString = <<<script
            require(['jquery'], function($){
                $('#history_status').on('change', function() {
                    if (this.value == 3) {
                        if (!$('#history_notify').is(':checked')) {
                            $('.order-history-comments-options label').click();
                        }
                        $('.status_acceptat_suma_div').show();
                        $('.status_respins_motiv_div').hide();
                    } else if (this.value == 4) {
                        if (!$('#history_notify').is(':checked')) {
                            $('.order-history-comments-options label').click();
                        }
                        $('.status_respins_motiv_div').show();
                        $('.status_acceptat_suma_div').hide();
                    } else {
                        if ($('#history_notify').is(':checked')) {
                            $('.order-history-comments-options label').click();
                        }
                    }
                });
            });
    script; ?> <?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?> <?php $scriptString = <<<script
            require(['prototype'], function(){
                if($('order_status'))$('order_status').update('{$block->escapeJs($block->getRetur()->getStatusLabel())}');
            });
    script; ?> <?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?></div><?php endif; ?>