gift card - flyer

This commit is contained in:
Daniel Camargo 2013-07-26 18:29:08 -03:00
parent 14d12ff4ae
commit 08c311a95b
12 changed files with 1485 additions and 10 deletions

View File

@ -44,7 +44,12 @@ class Controller_giftcards extends Crunchbutton_Controller_Account {
$giftcards = Crunchbutton_Promo::multiple( c::getPagePiece(2) );
c::view()->layout('layout/blank');
c::view()->giftcards = $giftcards;
c::view()->display('giftcards/print');
c::view()->display('giftcards/print/default');
} else if( c::getPagePiece(1) == 'print-flyer' ){
$giftcards = Crunchbutton_Promo::multiple( c::getPagePiece(2) );
c::view()->layout('layout/blank');
c::view()->giftcards = $giftcards;
c::view()->display('giftcards/print/flyer');
} else {
$giftcard = Crunchbutton_Promo::o(c::getPagePiece(1));
if ($giftcard->id_promo) {

View File

@ -24,7 +24,8 @@
<td> <?=$date->format('M jS Y')?><br /><?=$date->format('g:i:s A')?> </td>
<td style="width:70px;">
<?php if( !$wasUsed ) { ?>
<a title="Print" target="_blank" href="/giftcards/print/<?=$giftcard->id_promo;?>"><i style="color:black;" class="icon-print"></i></a>
<a title="Print" target="_blank" href="/giftcards/print/<?=$giftcard->id_promo;?>"><i style="color:black;" class="icon-print"></i></a>&nbsp;
<a title="Print Flyer" target="_blank" href="/giftcards/print-flyer/<?=$giftcard->id_promo;?>"><i style="color:black;" class="icon-picture"></i></a>
<?php } ?> <a href="/giftcards/<?=$giftcard->id_promo;?>"><?=$giftcard->code; ?></a>
</td>
<td class="center"> $<?= Util::ceil($giftcard->value, 2); ?></td>

View File

@ -154,6 +154,7 @@ if ( $credit->id_credit ) {
<td colspan="2">
<?php if( !CrunchButton_Promo::giftWasAlreadyUsed( $this->giftcard->id_promo ) ){ ?>
<a target="_blank" class="btn btn-gray" href="/giftcards/print/<?=$this->giftcard->id_promo;?>"><i class="icon-print"></i> Print</a>&nbsp;
<a target="_blank" class="btn btn-blue" href="/giftcards/print-flyer/<?=$this->giftcard->id_promo;?>"><i class="icon-picture"></i> Print flyer</a>&nbsp;
<?php } ?>
<?php if( $this->giftcard->phone ) { ?>
<div class="btn btn-blue admin-giftcard-sms"><i class="icon-phone"></i> Send by sms</div>&nbsp;

View File

@ -8,7 +8,7 @@
?>
<!-- Preview stuff -->
<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.css">
<link rel="stylesheet" type="text/css" href="/assets/css/giftcard/default.css">
<div class="container-fluid padded">
<div class="row-fluid">
<div class="span6">
@ -164,6 +164,7 @@
<li class="input">
<button type="submit" class="btn btn-blue admin-giftcard-save"><i class="icon-save"></i> Save </button>
<button type="submit" class="btn btn-green admin-giftcard-print"><i class="icon-print"></i> Save &amp; Print </button>
<button type="submit" class="btn btn-blue admin-giftcard-print-flyer"><i class="icon-picture"></i> Save &amp; Print Flyer </button>
</li>
</ul>
</div>
@ -255,7 +256,7 @@
<div class="giftcard-message"></div>
<div class="help">Questions: Call or text us anytime at (646) 783-1444</div>
<div class="dollar">$</div><div class="value"><span class="preview-value"></span></div><div class="info">To redeem, go to<span class="url">crunchbutton.com/giftcard/<span class="preview-code"></span></span></div><div class="call">Free Food from
<br/>Crunchbutton</div><img src="/assets/images/giftcard_print.svg?<?php echo date( 'dHis' ); ?>"/>
<br/>Crunchbutton</div><img src="/assets/images/giftcard/print-default.svg?<?php echo date( 'dHis' ); ?>"/>
</div>
<br />
</div>
@ -395,7 +396,11 @@ $(function() {
} );
$(document).on('click', '.admin-giftcard-print', function() {
App.giftcards.print = true;
App.giftcards.print = 'default';
sendForm();
} );
$(document).on('click', '.admin-giftcard-print-flyer', function() {
App.giftcards.print = 'flyer';
sendForm();
} );
});
@ -407,7 +412,7 @@ function sendForm(){
var id_user = $( '#id_user' ).val();
var total = $( '#total' ).val();
var message = $( '#giftcard-message' ).val();
var print = ( App.giftcards.print ) ? 1 : 0;
var print = ( App.giftcards.print ) ? App.giftcards.print : 0;
var id_order_reference = $( '#id_order_reference' ).val();
var prefix = $( '#prefix' ).val();
@ -465,7 +470,11 @@ function sendForm(){
} else {
alert( 'Gift card(s) created!' );
if( App.giftcards.print ){
location.href = '/giftcards/print/' + json.success;
if( App.giftcards.print == 'flyer' ){
location.href = '/giftcards/print-flyer/' + json.success;
} else {
location.href = '/giftcards/print/' + json.success;
}
} else {
location.href = '/giftcards';
}

View File

@ -4,8 +4,8 @@
<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.css">
<link rel="stylesheet" type="text/css" href="/assets/css/giftcard/reset.css">
<link rel="stylesheet" type="text/css" href="/assets/css/giftcard/default.css">
</head>
<body>
<?php
@ -30,7 +30,7 @@ if( sizeof( $giftcards ) > 0 ) {
?><div class="giftcard <?php if( $count % 3 != 1 ){ ?>negativemargin<?php } ?>"><div class="giftcard-message"><?php echo $message; ?></div>
<div class="help">Questions: Call or text us anytime at (646) 783-1444</div>
<div class="dollar">$</div><div class="value"><?php echo $giftcard->value;?></div><div class="info">To redeem, go to<span class="url">crunchbutton.com/giftcard/<?php echo $giftcard->code;?></span></div><div class="call">Free Food from
<br/><?php echo $restaurant_name; ?></div><img src="/assets/images/giftcard_print.svg?<?php echo $imageCached; ?>"/>
<br/><?php echo $restaurant_name; ?></div><img src="/assets/images/giftcard/print-default.svg?<?php echo $imageCached; ?>"/>
</div>
<?php
if( $count % 3 == 0 ){

View File

@ -0,0 +1,49 @@
<!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 echo $giftcard->value;?></div>
<div class="info">To redeem, go to<span class="link">crunchbutton.com/giftcard/<?php echo $giftcard->code;?></span></div>
<div class="freefood">Free Food from <?php echo $restaurant_name; ?></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>

View File

@ -0,0 +1,68 @@
.giftcard{
text-align: center;
width: 816px;
margin: 0 auto;
}
.flyer{
width: 816px;
}
.parachutes{
width: 600px;
position: absolute;
margin-top: 250px;
margin-left: 110px;
}
.value{
font-family: 'Atomic Age', cursive;
color:#FFF;
font-size: 145px;
position: absolute;
z-index: 10;
letter-spacing: -10px;
margin-left: 60px;
margin-top: 870px;
text-align: center;
width: 140px;
}
.dollar{
color:#FFF;
font-family: 'Atomic Age', cursive;
font-size: 25px;
font-weight: bold;
position: absolute;
z-index: 11;
margin-left: 70px;
margin-top: 920px;
text-align: left;
width: 220px;
}
.info{
margin-left: 225px;
margin-top: 905px;
color:#FFF;
font-family: 'Helvetica';
font-size: 35px;
font-weight: bold;
position: absolute;
text-align: left;
}
.info .link{
display: block;
color:#7b201a;
font-size: 25px;
margin-top: 10px;
}
.freefood{
width: 500px;
margin-left: 275px;
margin-top: 990px;
color:#FFF;
font-family: 'Helvetica';
font-size: 18px;
font-weight: bold;
position: absolute;
text-align: right;
}
.page{
page-break-after:always;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 KiB

View File

Before

Width:  |  Height:  |  Size: 223 KiB

After

Width:  |  Height:  |  Size: 223 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 240 KiB