<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>Gift card</title>
		<link href='http://fonts.googleapis.com/css?family=Atomic+Age' rel='stylesheet' type='text/css'>
		<link rel="stylesheet" type="text/css" href="/assets/css/giftcard/reset.css">
		<link rel="stylesheet" type="text/css" href="/assets/css/giftcard/flyer.css">
	</head>
	<body>
<?php 
// Workaround to avoid image be cached
$imageCached = date( 'dHis' );
$count = 0;
$giftcards = $this->giftcards;
if( sizeof( $giftcards ) > 0 ) {
	foreach( $giftcards as $giftcard ){
		$message = $giftcard->message;
		if( !$message || $message == '' ){
			$message = 'crunchbutton.com';
		}
		if( !$giftcard ){ continue; }
		$count++;
		if( $giftcard->id_restaurant ){
			$restaurant = $giftcard->restaurant();
			$restaurant_name = $restaurant->name;			
		} else {
			$restaurant_name = 'Crunchbutton';
		}
	?>
	<div class="giftcard">
		<div class="dollar">$</div>
		<div class="value" <?php if( $giftcard->value > 9 ){ echo 'style="font-size:120px;margin-left:70px;margin-top:860px;"'; } ?>><?php echo $giftcard->value;?></div>
		<div class="title">Gift Card</div>
		<div class="info">To redeem, go to<span class="link">www.crunchbutton.com/giftcard/<?php echo $giftcard->code;?></span></div>
		<div class="call">Questions: Call or text us anytime at (646) 783-1444</div>
		<div class="images">
			<img class="parachutes" src="/assets/images/giftcard/flyer_parachutes.png?<?php echo $imageCached; ?>"/>
			<img class="flyer" src="/assets/images/giftcard/print-flyer.svg?<?php echo $imageCached; ?>"/>	
		</div>
	</div>
	<!-- <div class="page"></div> -->
	<?php 
	} 
} else {
	echo 'Oops, is seems you are trying to print a gift card that was already redemmed!';
}
?>
	</body>
</html>