<?php $shop_id = restaurant()->id ?? 0; ?>
<div class="col-12 mb-4">
	<div class="modern-card sales-graph-card">
		<div class="card-header">
			<h3 class="card-title">
				<i class="fas fa-chart-area"></i>
				<?= lang('sales_graph'); ?>
			</h3>
		</div>
		<div class="card-body">
			<div id="chartContainers" style="height: 300px; width: 100%;"></div>
		</div>
		<?php if (!auth('is_staff')): ?>
			<div class="card-footer">
				<div class="revenue-stats">
					<div class="revenue-stat-item">
						<h4><?= currency_format($this->admin_m->user_total_income_in_year(0), $shop_id, true); ?>
						</h4>
						<p><?= lang('total_revenue'); ?></p>
					</div>
					<div class="revenue-stat-item">
						<h4><?= currency_format($this->admin_m->user_total_income_in_year('year'), $shop_id, true); ?>
						</h4>
						<p><?= lang('total_revenue'); ?> (<?= date('Y'); ?>)</p>
					</div>
					<div class="revenue-stat-item">
						<h4><?= currency_format($this->admin_m->user_total_income_in_year('month'), $shop_id, true); ?>
						</h4>
						<p><?= lang('total_revenue'); ?> (<?= date('M'); ?>)</p>
					</div>
				</div>
			</div>
		<?php endif; ?>
	</div>
</div>

<?php
$pending = order_st($_ENV['ID'], $order_type = 0, $status = 0, $is_deliveried = 0)->count;
$success = order_st($_ENV['ID'], $order_type = 0, $status = 2, $is_deliveried = 0)->count;
$deliveried = order_st($_ENV['ID'], $order_type = 0, $status = 2, $is_deliveried = 1)->count;
$cancled = order_st($_ENV['ID'], $order_type = 0, $status = 3, $is_deliveried = 0)->count;
?>

<div class="col-12 mb-4 mt-15">
	<div class="modern-card order-status-card">
		<div class="card-header">
			<h3 class="card-title">
				<i class="fas fa-clipboard-list"></i>
				<?= lang('order_status'); ?>
			</h3>
		</div>
		<div class="card-body">
			<div class="order-status-grid">
				<div class="order-status-item status-pending <?= $pending > 0 ? "active" : ""; ?>">
					<div class="status-icon">
						<i class="fas fa-clock"></i>
					</div>
					<div class="status-content">
						<h4><?= $pending; ?></h4>
						<p><?= lang('pending'); ?></p>
					</div>
				</div>

				<div class="order-status-item status-completed <?= $success > 0 ? "active" : ""; ?>">
					<div class="status-icon">
						<i class="fas fa-check-circle"></i>
					</div>
					<div class="status-content">
						<h4><?= $success; ?></h4>
						<p><?= lang('completed'); ?></p>
					</div>
				</div>

				<div class="order-status-item status-delivered <?= $deliveried > 0 ? "active" : ""; ?>">
					<div class="status-icon">
						<i class="fas fa-truck"></i>
					</div>
					<div class="status-content">
						<h4><?= $deliveried; ?></h4>
						<p><?= lang('delivered'); ?></p>
					</div>
				</div>

				<div class="order-status-item status-cancelled <?= $cancled > 0 ? "active" : ""; ?>">
					<div class="status-icon">
						<i class="fas fa-times-circle"></i>
					</div>
					<div class="status-content">
						<h4><?= $cancled; ?></h4>
						<p><?= lang('cancled'); ?></p>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>