<?php
/**
 * File: api-settings-widget.php
 * Year: 2023
 */

$apiSettings   = \Tami\WooCommerce\TamiAdminSettings::get_api_settings(true);
$merchantId    = ( $apiSettings['merchant_id'] ?? '' );
$terminalId    = ( $apiSettings['terminal_id'] ?? '' );
$testMode      = ( $apiSettings['environment'] ?? 'live' ) === 'test';
$paymentMethod = $apiSettings['payment_method'] ?? '3D';
$lines         = [
	(object) [ 'title' => __( 'Merchant ID', 'tami-payment' ), 'content' => $merchantId ],
	(object) [ 'title' => __( 'Terminal ID', 'tami-payment' ), 'content' => $terminalId ],
	(object) [
		'title'   => __( 'Environment', 'tami-payment' ),
		'content' => $testMode ? __( 'Test mode', 'tami-payment' ) : __( 'Live mode', 'tami-payment' )
	],
];
?>
<div class="tami-card tami-rounded-4 tami-p-4 tami-py-2 tami-bg-tami tami-wave-green tami-border-0" id="tami-installation-status-widget">
	<div class="tami-d-flex">
                    <span class="tami-lead tami-text-white tami-w-75"><i
		                    class="fa fa-cogs"></i> <?php esc_attr_e( 'Installation Details', 'tami-payment' ) ?></span>
	</div>
	<div class="tami-text-white tami-mt-2 tami-pb-3"><?php
		foreach ( $lines as $line ) {
			echo sprintf( "<div class='tami-row tami-py-2'>
<div class='tami-col'><h6 class='tami-m-0'>%s</h6></div>
<div class='tami-col'>%s</div>
</div>", esc_attr($line->title), esc_attr($line->content) );
		}
		?>

		<div class="tami-row">
			<div class="tami-col">
				<a href="#"
				   class="tami-btn tami-btn-tami-green tami-mt-2 tami-go-apisettings-button"><?php esc_attr_e( 'Go Settings', 'tami-payment' ) ?>
					<i class="fa fa-arrow-right-long"></i></a>
			</div>
		</div>

	</div>
</div>
