Working : coupon creation : add default rule (thelia.constraint.rule.available_for_everyone)

This commit is contained in:
gmorel
2013-09-23 23:04:00 +02:00
parent e4658d2fa2
commit d0f20cca1d
12 changed files with 154 additions and 156 deletions

View File

@@ -32,6 +32,7 @@ use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Coupon\CouponFactory;
use Thelia\Coupon\CouponManager;
use Thelia\Coupon\CouponRuleCollection;
use Thelia\Coupon\Type\CouponInterface;
use Thelia\Model\Coupon as CouponModel;
@@ -137,11 +138,21 @@ class Coupon extends BaseAction implements EventSubscriberInterface
{
$coupon->setDispatcher($this->getDispatcher());
// Set default rule if none found
$noConditionRule = $this->container->get('thelia.constraint.rule.available_for_everyone');
$constraintFactory = $this->container->get('thelia.constraint.factory');
$couponRuleCollection = new CouponRuleCollection();
$couponRuleCollection->add($noConditionRule);
$defaultSerializedRule = $constraintFactory->serializeCouponRuleCollection(
$couponRuleCollection
);
$coupon->createOrUpdate(
$event->getCode(),
$event->getTitle(),
$event->getAmount(),
$event->getEffect(),
$event->getType(),
$event->isRemovingPostage(),
$event->getShortDescription(),
$event->getDescription(),
@@ -150,9 +161,12 @@ class Coupon extends BaseAction implements EventSubscriberInterface
$event->isAvailableOnSpecialOffers(),
$event->isCumulative(),
$event->getMaxUsage(),
$defaultSerializedRule,
$event->getLocale()
);
$event->setCoupon($coupon);
}

View File

@@ -229,7 +229,7 @@ class Image extends BaseCachedFile implements EventSubscriberInterface
// Compute the image URL
$processed_image_url = $this->getCacheFileURL($subdir, basename($cacheFilePath));
// compute the full resulution image path in cache
// compute the full resolution image path in cache
$original_image_url = $this->getCacheFileURL($subdir, basename($originalImagePathInCache));
// Update the event with file path and file URL

View File

@@ -78,13 +78,13 @@ class CouponController extends BaseAdminController
$args['urlReadCoupon'] = $this->getRoute(
'admin.coupon.read',
array('couponId' => 'couponId'),
array('couponId' => 0),
Router::ABSOLUTE_URL
);
$args['urlEditCoupon'] = $this->getRoute(
'admin.coupon.update',
array('couponId' => 'couponId'),
array('couponId' => 0),
Router::ABSOLUTE_URL
);
@@ -164,7 +164,7 @@ class CouponController extends BaseAdminController
$args['dateFormat'] = $this->getSession()->getLang()->getDateFormat();
$args['availableCoupons'] = $this->getAvailableCoupons();
$args['formAction'] = 'admin/coupon/create/';
$args['formAction'] = 'admin/coupon/create';
return $this->render(
'coupon-create',
@@ -223,7 +223,7 @@ class CouponController extends BaseAdminController
'code' => $coupon->getCode(),
'title' => $coupon->getTitle(),
'amount' => $coupon->getAmount(),
'effect' => $coupon->getType(),
'type' => $coupon->getType(),
'shortDescription' => $coupon->getShortDescription(),
'description' => $coupon->getDescription(),
'isEnabled' => ($coupon->getIsEnabled() == 1),
@@ -271,7 +271,7 @@ class CouponController extends BaseAdminController
Router::ABSOLUTE_URL
);
$args['formAction'] = 'admin/coupon/update/' . $couponId;
$args['formAction'] = 'admin/coupon/update' . $couponId;
return $this->render('coupon-update', $args);
}
@@ -347,20 +347,7 @@ class CouponController extends BaseAdminController
);
$couponEvent = new CouponCreateOrUpdateEvent(
$coupon->getCode(),
$coupon->getTitle(),
$coupon->getAmount(),
$coupon->getType(),
$coupon->getShortDescription(),
$coupon->getDescription(),
$coupon->getIsEnabled(),
$coupon->getExpirationDate(),
$coupon->getIsAvailableOnSpecialOffers(),
$coupon->getIsCumulative(),
$coupon->getIsRemovingPostage(),
$coupon->getMaxUsage(),
$rules,
$coupon->getLocale()
$coupon->getCode(), $coupon->getTitle(), $coupon->getAmount(), $coupon->getType(), $coupon->getShortDescription(), $coupon->getDescription(), $coupon->getIsEnabled(), $coupon->getExpirationDate(), $coupon->getIsAvailableOnSpecialOffers(), $coupon->getIsCumulative(), $coupon->getIsRemovingPostage(), $coupon->getMaxUsage(), $coupon->getLocale()
);
$couponEvent->setCoupon($coupon);
@@ -497,20 +484,7 @@ class CouponController extends BaseAdminController
$data = $form->getData();
$couponEvent = new CouponCreateOrUpdateEvent(
$data['code'],
$data['title'],
$data['amount'],
$data['type'],
$data['shortDescription'],
$data['description'],
$data['isEnabled'],
\DateTime::createFromFormat('Y-m-d', $data['expirationDate']),
$data['isAvailableOnSpecialOffers'],
$data['isCumulative'],
$data['isRemovingPostage'],
$data['maxUsage'],
new CouponRuleCollection(array()),
$data['locale']
$data['code'], $data['title'], $data['amount'], $data['type'], $data['shortDescription'], $data['description'], $data['isEnabled'], \DateTime::createFromFormat('Y-m-d', $data['expirationDate']), $data['isAvailableOnSpecialOffers'], $data['isCumulative'], $data['isRemovingPostage'], $data['maxUsage'], $data['locale']
);
// Dispatch Event to the Action
@@ -538,7 +512,6 @@ class CouponController extends BaseAdminController
} catch (FormValidationException $e) {
// Invalid data entered
$message = 'Please check your input:';
$this->logError($action, $message, $e);
} catch (\Exception $e) {
// Any other error

View File

@@ -78,8 +78,8 @@ class CouponCreateOrUpdateEvent extends ActionEvent
/** @var Coupon Coupon model */
protected $coupon = null;
/** @var string Coupon effect */
protected $effect;
/** @var string Coupon type */
protected $type;
/** @var string Language code ISO (ex: fr_FR) */
protected $locale = null;
@@ -87,36 +87,22 @@ class CouponCreateOrUpdateEvent extends ActionEvent
/**
* Constructor
*
* @param string $code Coupon Code
* @param string $title Coupon title
* @param float $amount Amount removed from the Total Checkout
* @param string $type Coupon type
* @param string $shortDescription Coupon short description
* @param string $description Coupon description
* @param boolean $isEnabled Enable/Disable
* @param \DateTime $expirationDate Coupon expiration date
* @param boolean $isAvailableOnSpecialOffers Is available on special offers
* @param boolean $isCumulative Is cumulative
* @param boolean $isRemovingPostage Is removing Postage
* @param int $maxUsage Coupon quantity
* @param CouponRuleCollection $rules CouponRuleInterface to add
* @param string $locale Coupon Language code ISO (ex: fr_FR)
* @param string $code Coupon Code
* @param string $title Coupon title
* @param float $amount Amount removed from the Total Checkout
* @param string $type Coupon type
* @param string $shortDescription Coupon short description
* @param string $description Coupon description
* @param boolean $isEnabled Enable/Disable
* @param \DateTime $expirationDate Coupon expiration date
* @param boolean $isAvailableOnSpecialOffers Is available on special offers
* @param boolean $isCumulative Is cumulative
* @param boolean $isRemovingPostage Is removing Postage
* @param int $maxUsage Coupon quantity
* @param string $locale Coupon Language code ISO (ex: fr_FR)
*/
public function __construct(
$code,
$title,
$amount,
$type,
$shortDescription,
$description,
$isEnabled,
\DateTime $expirationDate,
$isAvailableOnSpecialOffers,
$isCumulative,
$isRemovingPostage,
$maxUsage,
$rules,
$locale
$code, $title, $amount, $type, $shortDescription, $description, $isEnabled, \DateTime $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $isRemovingPostage, $maxUsage, $locale
) {
$this->amount = $amount;
$this->code = $code;
@@ -127,7 +113,6 @@ class CouponCreateOrUpdateEvent extends ActionEvent
$this->isEnabled = $isEnabled;
$this->isRemovingPostage = $isRemovingPostage;
$this->maxUsage = $maxUsage;
$this->rules = $rules;
$this->shortDescription = $shortDescription;
$this->title = $title;
$this->type = $type;
@@ -206,22 +191,6 @@ class CouponCreateOrUpdateEvent extends ActionEvent
return $this->amount;
}
/**
* Return condition to validate the Coupon or not
*
* @return CouponRuleCollection
*/
public function getRules()
{
if ($this->rules === null || !is_object($this->rules)) {
$rules = $this->rules;
} else {
$rules = clone $this->rules;
}
return $rules;
}
/**
* Return Coupon expiration date
*

View File

@@ -63,11 +63,12 @@ class Coupon extends BaseCoupon
* @param boolean $isAvailableOnSpecialOffers Is available on special offers
* @param boolean $isCumulative Is cumulative
* @param int $maxUsage Coupon quantity
* @param string $defaultSerializedRule Serialized default rule added if none found
* @param string $locale Coupon Language code ISO (ex: fr_FR)
*
* @throws \Exception
*/
function createOrUpdate($code, $title, $amount, $type, $isRemovingPostage, $shortDescription, $description, $isEnabled, $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $maxUsage, $locale = null)
function createOrUpdate($code, $title, $amount, $type, $isRemovingPostage, $shortDescription, $description, $isEnabled, $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $maxUsage, $defaultSerializedRule, $locale = null)
{
$this->setCode($code)
->setTitle($title)
@@ -82,6 +83,11 @@ class Coupon extends BaseCoupon
->setIsCumulative($isCumulative)
->setMaxUsage($maxUsage);
// If no rule given, set default rule
if (null === $this->getSerializedRules()) {
$this->setSerializedRules($defaultSerializedRule);
}
// Set object language (i18n)
if (!is_null($locale)) {
$this->setLocale($locale);

View File

@@ -147,7 +147,7 @@
{loop name="menu-auth-coupon" type="auth" roles="ADMIN" permissions="admin.coupon.view"}
<li class="{if $admin_current_location == 'coupon'}active{/if}" id="coupon_menu">
<a href="{url path='/admin/coupon/'}">{intl l="Coupons"}</a>
<a href="{url path='/admin/coupon'}">{intl l="Coupons"}</a>
</li>
{/loop}

View File

@@ -1,5 +1,17 @@
$(function($){
// Manage how coupon and rules are saved
$.couponManager = {};
// Rule to be saved
$.couponManager.ruleToSave = {};
$.couponManager.ruleToSave.serviceId = false;
$.couponManager.ruleToSave.operators = {};
$.couponManager.ruleToSave.values = {};
// Rules payload to save
$.couponManager.rulesToSave = [];
// Rule being updated id
$.couponManager.ruleToUpdateId = false;
// Clean array from deleteValue (undefined) keys
Array.prototype.clean = function(deleteValue) {
for (var i = 0; i < this.length; i++) {
@@ -12,109 +24,109 @@ $(function($){
};
// Remove 1 Rule then Save Rules AJAX
couponManager.removeRuleAjax = function(id) {
$.couponManager.removeRuleAjax = function(id) {
// Delete rule in temporary array
delete couponManager.rulesToSave[id];
couponManager.rulesToSave.clean(undefined);
delete $.couponManager.rulesToSave[id];
$.couponManager.rulesToSave.clean(undefined);
// Save
couponManager.saveRuleAjax();
$.couponManager.saveRuleAjax();
};
// Add 1 Rule / or update the temporary Rules array then Save Rules via AJAX
couponManager.createOrUpdateRuleAjax = function() {
var id = couponManager.ruleToUpdateId;
$.couponManager.createOrUpdateRuleAjax = function() {
var id = $.couponManager.ruleToUpdateId;
// If create
if(!id) {
couponManager.rulesToSave.push(couponManager.ruleToSave);
$.couponManager.rulesToSave.push($.couponManager.ruleToSave);
} else { // else update
couponManager.rulesToSave[id] = couponManager.ruleToSave;
$.couponManager.rulesToSave[id] = $.couponManager.ruleToSave;
// reset edit mode to off
couponManager.ruleToUpdateId = false;
$.couponManager.ruleToUpdateId = false;
}
// Save
couponManager.saveRuleAjax();
$.couponManager.saveRuleAjax();
};
// Set rule inputs to allow editing
couponManager.updateRuleSelectAjax = function(id) {
couponManager.ruleToUpdateId = id;
couponManager.ruleToSave = couponManager.rulesToSave[id];
$.couponManager.updateRuleSelectAjax = function(id) {
$.couponManager.ruleToUpdateId = id;
$.couponManager.ruleToSave = $.couponManager.rulesToSave[id];
// Set the rule selector
$("#category-rule option").filter(function() {
return $(this).val() == couponManager.ruleToSave.serviceId;
return $(this).val() == $.couponManager.ruleToSave.serviceId;
}).prop('selected', true);
// Force rule input refresh
couponManager.loadRuleInputs(couponManager.ruleToSave.serviceId, function() {
couponManager.fillInRuleInputs();
$.couponManager.loadRuleInputs($.couponManager.ruleToSave.serviceId, function() {
$.couponManager.fillInRuleInputs();
});
};
// Fill in rule inputs
couponManager.fillInRuleInputs = function() {
$.couponManager.fillInRuleInputs = function() {
var operatorId = null;
var valueId = null;
var idName = null;
var id = couponManager.ruleToUpdateId;
var id = $.couponManager.ruleToUpdateId;
if(id) {
couponManager.ruleToSave = couponManager.rulesToSave[id];
$.couponManager.ruleToSave = $.couponManager.rulesToSave[id];
}
for (idName in couponManager.ruleToSave.operators) {
for (idName in $.couponManager.ruleToSave.operators) {
// Setting idName operator select
operatorId = idName + '-operator';
$('#' + operatorId).val(couponManager.ruleToSave.operators[idName]);
$('#' + operatorId).val($.couponManager.ruleToSave.operators[idName]);
// Setting idName value input
valueId = idName + '-value';
$('#' + valueId).val(couponManager.ruleToSave.values[idName]);
$('#' + valueId).val($.couponManager.ruleToSave.values[idName]);
}
};
// Save rules on click
couponManager.onClickSaveRule = function() {
$.couponManager.onClickSaveRule = function() {
$('#constraint-save-btn').on('click', function () {
if($('#category-rule').val() == 'thelia.constraint.rule.available_for_everyone') {
// @todo translate + modal
var r= confirm("Do you really want to set this coupon available to everyone ?");
if (r == true) {
couponManager.createOrUpdateRuleAjax();
$.couponManager.createOrUpdateRuleAjax();
}
}
});
};
couponManager.onClickSaveRule();
$.couponManager.onClickSaveRule();
// Remove rule on click
couponManager.onClickDeleteRule = function() {
$.couponManager.onClickDeleteRule = function() {
$('.constraint-delete-btn').on('click', function (e) {
e.preventDefault();
var $this = $(this);
couponManager.removeRuleAjax($this.attr('data-int'));
$.couponManager.removeRuleAjax($this.attr('data-int'));
});
};
couponManager.onClickDeleteRule();
$.couponManager.onClickDeleteRule();
// Update rule on click
couponManager.onClickUpdateRule = function() {
$.couponManager.onClickUpdateRule = function() {
$('.constraint-update-btn').on('click', function (e) {
e.preventDefault();
var $this = $(this);
couponManager.updateRuleSelectAjax($this.attr('data-int'));
$.couponManager.updateRuleSelectAjax($this.attr('data-int'));
// Hide row being updated
$this.parent().parent().remove();
});
};
couponManager.onClickUpdateRule();
$.couponManager.onClickUpdateRule();
// Reload effect inputs when changing effect
couponManager.onEffectChange = function() {
$.couponManager.onEffectChange = function() {
var optionSelected = $("option:selected", this);
$('#effectToolTip').html(optionSelected.attr("data-description"));
$('#effect').on('change', function () {
@@ -122,22 +134,22 @@ $(function($){
$('#effectToolTip').html(optionSelected.attr("data-description"));
});
};
couponManager.onEffectChange();
$.couponManager.onEffectChange();
// Reload rule inputs when changing effect
couponManager.onRuleChange = function() {
$.couponManager.onRuleChange = function() {
$('#category-rule').on('change', function () {
couponManager.loadRuleInputs($(this).val(), function() {});
$.couponManager.loadRuleInputs($(this).val(), function() {});
});
};
couponManager.onRuleChange();
$.couponManager.onRuleChange();
// Fill in ready to be saved rule array
// var onInputsChange = function()
// In AJAX response
// Set max usage to unlimited or not
couponManager.onUsageUnlimitedChange = function() {
$.couponManager.onUsageUnlimitedChange = function() {
var isUnlimited = $('#is-unlimited');
if ($('#max-usage').val() == -1) {
isUnlimited.prop('checked', true);
@@ -160,20 +172,9 @@ $(function($){
}
});
};
couponManager.onUsageUnlimitedChange();
$.couponManager.onUsageUnlimitedChange();
});
// Rule to save
var couponManager = {};
// Rule to be saved
couponManager.ruleToSave = {};
couponManager.ruleToSave.serviceId = false;
couponManager.ruleToSave.operators = {};
couponManager.ruleToSave.values = {};
// Rules payload to save
couponManager.rulesToSave = [];
// Rule being updated id
couponManager.ruleToUpdateId = false;

View File

@@ -8,7 +8,7 @@
<nav>
<ul class="breadcrumb">
<li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
<li><a href="{url path='admin/coupon/'}">{intl l='Coupon'}</a></li>
<li><a href="{url path='admin/coupon'}">{intl l='Coupon'}</a></li>
<li>{intl l='Create'}</li>
</ul>
</nav>

View File

@@ -8,7 +8,7 @@
<nav>
<ul class="breadcrumb">
<li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
<li><a href="{url path='admin/coupon/'}">{intl l='Coupon'}</a></li>
<li><a href="{url path='admin/coupon'}">{intl l='Coupon'}</a></li>
<li>{intl l='Browse'}</li>
</ul>
</nav>
@@ -39,13 +39,29 @@
<tbody>
{loop type="coupon" name="list_coupon" is_enabled="1" backend_context="true"}
<tr>
<td>{block name="coupon-code"}<a href="{$urlReadCoupon|replace:'couponId':$ID}">{$CODE}</a>{/block}</td>
<td>{block name="coupon-code"}<a href="{$urlReadCoupon|replace:'0':$ID}">{$CODE}</a>{/block}</td>
<td>{block name="coupon-title"}{$TITLE}{/block}</td>
<td>{block name="coupon-expiration-date"}{$EXPIRATION_DATE}{/block}</td>
<td>{block name="coupon-usage-left"}{$USAGE_LEFT}{/block}</td>
<td>
{block name="coupon-usage-left"}
{if $USAGE_LEFT == -1}
<span class="label label-success">
{intl l="Unlimited"}
</span>
{elseif $USAGE_LEFT}
<span class="label label-success">
{$USAGE_LEFT}
</span>
{else}
<span class="label label-warning">
0
</span>
{/if}
{/block}
</td>
<td>
{block name="coupon-action"}
<a href="{$urlEditCoupon|replace:'couponId':$ID}" class="btn btn-default btn-primary btn-medium">
<a href="{$urlEditCoupon|replace:'0':$ID}" class="btn btn-default btn-primary btn-medium">
<span class="glyphicon glyphicon-edit"></span> {intl l='Edit'}
</a>
{/block}
@@ -80,7 +96,23 @@
<td>{block name="coupon-code"}<a href="{$urlReadCoupon|replace:'couponId':$ID}">{$CODE}</a>{/block}</td>
<td>{block name="coupon-title"}{$TITLE}{/block}</td>
<td>{block name="coupon-expiration-date"}{$EXPIRATION_DATE}{/block}</td>
<td>{block name="coupon-usage-left"}{$USAGE_LEFT}{/block}</td>
<td>
{block name="coupon-usage-left"}
{if $USAGE_LEFT == -1}
<span class="label label-success">
{intl l="Unlimited"}
</span>
{elseif $USAGE_LEFT}
<span class="label label-success">
{$USAGE_LEFT}
</span>
{else}
<span class="label label-warning">
0
</span>
{/if}
{/block}
</td>
<td>
{block name="coupon-action"}
<a href="{$urlEditCoupon|replace:'couponId':$ID}" class="btn btn-default btn-primary btn-medium">

View File

@@ -8,7 +8,7 @@
<nav>
<ul class="breadcrumb">
<li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
<li><a href="{url path='admin/coupon/'}">{intl l='Coupon'}</a></li>
<li><a href="{url path='admin/coupon'}">{intl l='Coupon'}</a></li>
<li>{$CODE}</li>
</ul>
</nav>
@@ -64,7 +64,11 @@
<tr>
<td>{intl l='Usage left'}</td>
<td>
{if $USAGE_LEFT}
{if $USAGE_LEFT == -1}
<span class="label label-success">
{intl l="Unlimited"}
</span>
{elseif $USAGE_LEFT}
<span class="label label-success">
{$USAGE_LEFT}
</span>

View File

@@ -8,7 +8,7 @@
<nav>
<ul class="breadcrumb">
<li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
<li><a href="{url path='admin/coupon/'}">{intl l='Coupon'}</a></li>
<li><a href="{url path='admin/coupon'}">{intl l='Coupon'}</a></li>
<li>{intl l='Update'} {$couponCode}</li>
</ul>
</nav>
@@ -48,7 +48,7 @@
miniBrowser(0, '/test_to_remove/datas_coupon_edit.json');
// Init Rules
couponManager.initRules = function() {
$.couponManager.initRules = function() {
var rules = [];
{foreach from=$rulesObject key=k item=rule}
// Init rule
@@ -70,13 +70,13 @@
};
// Save Rules AJAX
couponManager.saveRuleAjax = function() {
$.couponManager.saveRuleAjax = function() {
$('#constraint-add-operators-values').html('<div class="loading" ></div>');
var $url = '{$urlAjaxUpdateRules}';
$.ajax({
type: "POST",
url: $url,
data: {literal}{{/literal}rules:JSON.stringify(couponManager.rulesToSave){literal}}{/literal},
data: {literal}{{/literal}rules:JSON.stringify($.couponManager.rulesToSave){literal}}{/literal},
statusCode: {
404: function() {
$('#constraint-add-operators-values').html(
@@ -92,13 +92,13 @@
return $(this).val() == 'thelia.constraint.rule.available_for_everyone';
}).prop('selected', true);
couponManager.onClickUpdateRule();
couponManager.onClickDeleteRule();
$.couponManager.onClickUpdateRule();
$.couponManager.onClickDeleteRule();
});
};
// Reload rule inputs
couponManager.loadRuleInputs = function(ruleId, callBack) {
$.couponManager.loadRuleInputs = function(ruleId, callBack) {
$('#constraint-add-operators-values').html('<div class="loading" ></div>');
var url = "{$urlAjaxGetRuleInput}";
url = url.replace('ruleId', ruleId)
@@ -113,7 +113,7 @@
}
}).done(function(data) {
$('#constraint-add-operators-values').html(data);
couponManager.ruleToSave.serviceId = ruleId;
$.couponManager.ruleToSave.serviceId = ruleId;
if (ruleId == -1) {
// Placeholder can't be saved
$('#constraint-save-btn').hide();
@@ -125,7 +125,7 @@
};
// Rules which will be saved
couponManager.rulesToSave = couponManager.initRules();
$.couponManager.rulesToSave = $.couponManager.initRules();
$('#constraint-save-btn').hide();

View File

@@ -11,7 +11,7 @@
{/form_field}
{form_field form=$form field='success_url'}
<input type="hidden" name="{$name}" value="{url path='/admin/coupon/update/{id}/'}" />
<input type="hidden" name="{$name}" value="{url path='/admin/coupon/update/{id}'}" />
{/form_field}
<div class="span4">
@@ -104,10 +104,10 @@
{form_field form=$form field='type'}
<div class="form-group {if $error}has-error{/if}">
<label for="type" class="control-label">{intl l='Type :'}</label>
<select name="{$name}" value="{$value}" id="type" class="col-md-12 form-control">
<option value="-1" data-description="">{intl l='Please select an type'}</option>
<select name="{$name}" id="type" class="col-md-12 form-control">
<option value="-1" data-description="">{intl l='Please select a coupon type'}</option>
{foreach from=$availableCoupons item=availableCoupon}
<option value="{$availableCoupon.serviceId}" data-description="{$availableCoupon.toolTip}" {if $value == $availableCoupon.serviceId}selected="selected"{/if}>
<option value="{$availableCoupon.serviceId}" data-description="{$availableCoupon.toolTip}" {if $value == $availableCoupon.serviceId}selected{/if}>
{$availableCoupon.name}
</option>
{/foreach}
@@ -285,4 +285,3 @@
</section>
{/if}
</form>