<?php
	Assets::add( 'buy-package.min.js' );
?>
<?php $__env->startSection( 'content' ); ?>
	<div id="main-content" class="cc padding">
		<h1><?php echo trans( 'package.buy-title' ); ?></h1>

		<?php echo error_html( $errors ); ?>


		<table id="packages-table" class="default">
			<thead>
				<tr>
					<th><?php echo trans( 'main.row' ); ?></th>
					<th><?php echo trans( 'package.name' ); ?></th>
					<th><?php echo trans( 'order.detail.price' ); ?></th>
					<th></th>
				</tr>
			</thead>
			<tbody>
				<?php foreach( $packages as $index => $package ): ?>
					<tr data-package-id="<?php echo $package->id; ?>" data-price="<?php echo $package->price; ?>">
						<td><?php echo en2fa( $index + 1 ); ?></td>
						<td><?php echo $package->name; ?></td>
						<td>
							<?php if( $package->price > 0 ): ?>
								<?php echo en2fa( number_format( $package->price ) ); ?> <?php echo trans( 'main.currency' ); ?>

							<?php else: ?>
								<?php echo trans( 'package.free' ); ?>

							<?php endif; ?>
						</td>
						<td>
							<button type="button" class="button buy-package"
							        data-id="<?php echo $package->id; ?>"
							        data-price="<?php echo $package->price; ?>">
								<?php if( $package->price > 0 ): ?>
									<?php echo trans( 'order.add-to-basket' ); ?>

								<?php else: ?>
									<?php echo trans( 'order.free-activate' ); ?>

								<?php endif; ?>
							</button>
						</td>
					</tr>
				<?php endforeach; ?>
			</tbody>
		</table>

		<form id="buy-form" method="POST" style="display: none;">
			<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
			<input type="hidden" name="package_id" id="package_id" value="0">
		</form>
	</div>
<?php $__env->stopSection(); ?>