<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/**
 * @var \Magento\Sales\Block\Adminhtml\Order\View\Info $block
 */

// @codingStandardsIgnoreFile

$order = $block->getOrder();

$orderAdminDate = $block->formatDate(
    $block->getOrderAdminDate($order->getCreatedAt()),
    \IntlDateFormatter::MEDIUM,
    true
);

$orderStoreDate = $block->formatDate(
    $order->getCreatedAt(),
    \IntlDateFormatter::MEDIUM,
    true,
    $block->getTimezoneForStore($order->getStore())
);

$orderId   = $order->getEntityId();
$sibsOrder = new Sibs\Sibs\Model\SibsOrder($orderId);
?>
<?php if (! is_null($sibsOrder->get()) && $sibsOrder->isSibsOrder()) { ?>
	<section class="admin__page-section order-view-account-information">
		<div class="admin__page-section-title">
			<span class="title"><?= $block->escapeHtml(__('SIBS Transactions Information')) ?></span>
		</div>

		<div class="admin__page-section-content">
			<div class="admin__page-section-item order-payment-method">
				<div class="admin__page-section-item-title">
					<span class="title"><?= $block->escapeHtml(__('Payment Information')) ?></span>
				</div>
				<div class="admin__page-section-item-content">
					<div class="order-payment-method-title">
						<strong><?= $block->escapeHtml(__('Payment Method')) ?></strong>
						<span class="payment_method"><?= $sibsOrder->getPaymentMethod() ?></span>
					</div>
					<div class="order-payment-method-title">
						<strong><?= $block->escapeHtml(__('Transaction ID')) ?></strong>
						<span class="transaction_id"><?= $sibsOrder->getTransactionId() ?></span>
					</div>
				</div>
			</div>
			<?php if ($sibsOrder->isCaptured() || $sibsOrder->isRefunded()) { ?>
				<div class="admin__page-section-item order-shipping-method">
					<div class="admin__page-section-item-title">
						<span class="title"><?= $block->escapeHtml(__('Capture and Refund Information')) ?></span>
					</div>
					<?php if ($sibsOrder->isCaptured()) { ?>
						<div class="admin__page-section-item-content">
							<div class="order-payment-method-title">
								<strong><?= $block->escapeHtml(__('Capture ID')) ?></strong>
								<span class="capture_id"><?= $sibsOrder->getCaptureId() ?></span>
							</div>
							<div class="order-payment-method-title">
								<strong><?= $block->escapeHtml(__('Capture Status')) ?></strong>
								<span class="capture_status"><?= $sibsOrder->getCaptureStatus() ?></span>
							</div>
						</div>
					<?php } ?>
					<?php if ($sibsOrder->isCaptured() && $sibsOrder->isRefunded()) { ?>
						<br>
					<?php } ?>
					<?php if ($sibsOrder->isRefunded()) { ?>
						<div class="admin__page-section-item-content">
							<div class="order-payment-method-title">
								<strong><?= $block->escapeHtml(__('Refund ID')) ?></strong>
								<span class="refund_id"><?= $sibsOrder->getRefundedId() ?></span>
							</div>
							<div class="order-payment-method-title">
								<strong><?= $block->escapeHtml(__('Refund Status')) ?></strong>
								<span class="refund_status"><?= $sibsOrder->getRefundedStatus() ?></span>
							</div>
						</div>
					<?php } ?>
				</div>
			<?php } ?>
		</div>
	</section>
<?php } ?>
