<?php $this->layout('layouts/main'); ?>

<section class="section profile-section">
	<div class="container">
		<div class="row">
			<div class="col-md-12">
				<?php $this->insert('components/breadcrumb', ['items' => [
					[
						"url" => url("fortune-wheel.index"),
						"text" => t__('Wheel of Fortune')
					],
					[
						"text" => t__('Wheel of Fortune History')
					]
				]]) ?>
			</div>
			
			<div class="col-md-12">
				<div class="card">
					<div class="card-header">
						<h2 class="card-title">
							<?php e__('Wheel of Fortune History') ?>
						</h2>
					</div>
					<div class="card-body p-0">
						<?php if (count($logs) > 0): ?>
							<div class="table-responsive">
								<table class="table table-hover">
									<thead>
									<tr>
										<th class="text-center">ID</th>
										<th><?php e__('Name') ?></th>
										<th><?php e__('Prize') ?></th>
										<th><?php e__('Date') ?></th>
									</tr>
									</thead>
									<tbody>
									<?php foreach ($logs as $log): ?>
										<tr>
											<td class="text-center">#<?php echo $log["id"]; ?></td>
											<td>
												<?php echo $log["lotteryTitle"]; ?>
											</td>
											<td>
												<?php echo $log["awardTitle"]; ?>
											</td>
											<td><?php echo carbon($log["creationDate"])->intlFormat(); ?></td>
										</tr>
									<?php endforeach; ?>
									</tbody>
								</table>
							</div>
						<?php else: ?>
							<div class="p-4"><?php $this->insert('components/alert', ['type' => 'error', 'message' => t__('No data found!')]); ?></div>
						<?php endif; ?>
					</div>
				</div>
			</div>
		</div>
	</div>
</section>
