diff --git a/templates/backOffice/default/assets/js/coupon.js b/templates/backOffice/default/assets/js/coupon.js
index 0bf95b41a..de83da5be 100644
--- a/templates/backOffice/default/assets/js/coupon.js
+++ b/templates/backOffice/default/assets/js/coupon.js
@@ -4,7 +4,7 @@ $(function($){
$.couponManager = {};
// Condition being updated category id
- $.couponManager.conditionToUpdateServiceId = -1;
+ $.couponManager.conditionToUpdateServiceId = '';
// Condition being updated index
$.couponManager.conditionToUpdateIndex = false;
@@ -20,6 +20,7 @@ $(function($){
$.couponManager.intlPleaseRetry = '';
$.couponManager.intlPleaseSelectAnotherCondition = '';
$.couponManager.intlDoYouReallyWantToSetCouponAvailableForEveryOne = '';
+ $.couponManager.intlDoYouReallyWantToDeleteThisCondition = '';
// *****************************************
// ****************** Delete ***************
@@ -28,11 +29,13 @@ $(function($){
$.couponManager.onClickDeleteCondition = function() {
$('.condition-delete-btn').on('click', function (e) {
e.preventDefault();
- var $this = $(this);
- var index = $this.attr('data-conditionIndex');
- $.couponManager.conditionToUpdateServiceId = -1;
- $.couponManager.conditionToUpdateIndex = false;
- $.couponManager.removeConditionAjax(index);
+ if (confirm($.couponManager.intlDoYouReallyWantToDeleteThisCondition)) {
+ var $this = $(this);
+ var index = $this.data('condition-index');
+ $.couponManager.conditionToUpdateServiceId = '';
+ $.couponManager.conditionToUpdateIndex = false;
+ $.couponManager.removeConditionAjax(index);
+ }
});
};
$.couponManager.onClickDeleteCondition();
@@ -94,7 +97,7 @@ $(function($){
$('#condition-add-operators-values').html('');
// Set the condition selector to default
$("#category-condition option").filter(function() {
- return $(this).val() == '-1';
+ return $(this).val() == '';
}).prop('selected', true);
}).fail(function() {
$('#condition-add-operators-values').html(
@@ -115,8 +118,8 @@ $(function($){
$('.condition-update-btn').on('click', function (e) {
e.preventDefault();
var $this = $(this);
- $.couponManager.conditionToUpdateServiceId = $this.attr('data-serviceId');
- $.couponManager.conditionToUpdateIndex = $this.attr('data-conditionIndex');
+ $.couponManager.conditionToUpdateServiceId = $this.data('service-id');
+ $.couponManager.conditionToUpdateIndex = $this.data('condition-index');
$.couponManager.updateConditionSelectFromConditionInterfaceAjax(
$.couponManager.conditionToUpdateIndex,
@@ -135,7 +138,7 @@ $(function($){
var $this = $(this);
var mainDiv = $('#condition-add-type');
var optionSelected = $('option:selected', this);
- mainDiv.find('.typeToolTip').html(optionSelected.attr('data-description'));
+ mainDiv.find('.typeToolTip').html(optionSelected.data('description'));
// Only if add mode
if (false != $.couponManager.conditionToUpdateIndex) {
@@ -179,7 +182,7 @@ $(function($){
}
}).done(function(data) {
$('#condition-add-operators-values').html(data);
- if ($.couponManager.conditionToUpdateServiceId == -1) {
+ if ($.couponManager.conditionToUpdateServiceId == '') {
// Placeholder can't be saved
$('#condition-save-btn').hide();
} else {
@@ -213,7 +216,7 @@ $(function($){
$.couponManager.onEffectChange = function() {
var mainDiv = $('#coupon-type');
var optionSelected = mainDiv.find('#type option:selected');
- mainDiv.find('.typeToolTip').html(optionSelected.attr('data-description'));
+ mainDiv.find('.typeToolTip').html(optionSelected.data('description'));
mainDiv.find('#type').on('change', function () {
var optionSelected = $('option:selected', this);
@@ -225,7 +228,7 @@ $(function($){
$.couponManager.displayEfffect = function(optionSelected) {
var mainDiv = $('#coupon-type');
- mainDiv.find('.typeToolTip').html(optionSelected.attr('data-description'));
+ mainDiv.find('.typeToolTip').html(optionSelected.data('description'));
var inputsDiv = mainDiv.find('.inputs');
inputsDiv.html('
');
diff --git a/templates/backOffice/default/coupon-create.html b/templates/backOffice/default/coupon-create.html
index 8dab9585e..b57547415 100644
--- a/templates/backOffice/default/coupon-create.html
+++ b/templates/backOffice/default/coupon-create.html
@@ -17,12 +17,8 @@
-
-
{form name="thelia.admin.coupon.creation"}
- {include file='coupon/form.html' formAction={url path={$formAction}} noConditions=true}
+ {include file='coupon/form.html' formAction={url path={$formAction}} noConditions=true title={intl l='Create a new coupon'}}
{/form}
@@ -48,6 +44,7 @@
$.couponManager.urlAjaxAdminCouponDrawInputs = "{$urlAjaxAdminCouponDrawInputs}";
$.couponManager.intlPleaseRetry = '{intl l='Please retry'}';
$.couponManager.intlDoYouReallyWantToSetCouponAvailableForEveryOne = '{intl l='Do you really want to set this coupon available to everyone ?'}';
+ $.couponManager.intlDoYouReallyWantToDeleteThisCondition = '{intl l='Do you really want to delete this condition ?'}';
});
diff --git a/templates/backOffice/default/coupon-update.html b/templates/backOffice/default/coupon-update.html
index 9a70d6fa0..6a943027c 100644
--- a/templates/backOffice/default/coupon-update.html
+++ b/templates/backOffice/default/coupon-update.html
@@ -14,12 +14,12 @@
{intl l='Home'}
{intl l='Tools'}
{intl l='Coupon'}
- {intl l="Editing %title" title="$couponCode"}
+ {intl l='Editing coupon "%title"' title="$couponCode"}
{form name="thelia.admin.coupon.creation"}
- {include file='coupon/form.html' formAction={url path={$formAction}} form=$form noConditions=false}
+ {include file='coupon/form.html' formAction={url path={$formAction}} form=$form noConditions=false title={intl l='Editing coupon "%title"' title=$couponCode}}
{/form}
@@ -52,6 +52,7 @@
$.couponManager.intlPleaseRetry = '{intl l='Please retry'}';
$.couponManager.intlPleaseSelectAnotherCondition = '{intl l='Please select another condition'}';
$.couponManager.intlDoYouReallyWantToSetCouponAvailableForEveryOne = '{intl l='Do you really want to set this coupon available to everyone ?'}';
+ $.couponManager.intlDoYouReallyWantToDeleteThisCondition = '{intl l='Do you really want to delete this condition ?'}';
$('#condition-save-btn').hide();
});
diff --git a/templates/backOffice/default/coupon/conditions.html b/templates/backOffice/default/coupon/conditions.html
index 1ae577e42..5972c0327 100644
--- a/templates/backOffice/default/coupon/conditions.html
+++ b/templates/backOffice/default/coupon/conditions.html
@@ -1,5 +1,5 @@
{* List all condition with their summary *}
-{foreach from=$conditions item=condition key=i name=conditionsForeach}
+{foreach from=$conditions item=condition name=conditionsForeach}
{if !$smarty.foreach.conditionsForeach.first}
@@ -7,13 +7,15 @@
{/if}
{$condition.summary nofilter}
-
-
- {intl l='Edit'}
+
+
+
+
+
{if $conditions|count != 1}
-
- {intl l='Delete'}
+
+
{/if}
diff --git a/templates/backOffice/default/coupon/form.html b/templates/backOffice/default/coupon/form.html
index 34432ae1e..a90b0df12 100644
--- a/templates/backOffice/default/coupon/form.html
+++ b/templates/backOffice/default/coupon/form.html
@@ -3,9 +3,10 @@
+
-
- {intl l='Edit %title' title={$couponCode}}
+
+ {$title}
@@ -34,19 +35,12 @@
{/if}
{/form_field}
@@ -86,7 +80,7 @@
{if $error}{$message}{/if}
- {intl l='Is removing postage'}
+ {intl l='Provides free shipping'}
{/form_field}
@@ -107,125 +101,127 @@
- {intl l='Is unlimited'}
+ {intl l='Unlimited usage'}
-
{intl l='Max usage :'}
-
+
{intl l='Maximum usage count :'}
+
{if $error}{$message}{/if}
{/form_field}
-
-
-
- {form_field form=$form field='type'}
-
- {intl l='Type :'}
-
- {intl l='Please select a coupon type'}
- {foreach from=$availableCoupons item=availableCoupon}
-
- {$availableCoupon.name}
-
- {/foreach}
-
- {if $error}{$message}{/if}
- {$availableCoupons.0.toolTip}
-
- {/form_field}
-
+
-
+
+
+
+ {form_field form=$form field='title'}
+
+ {intl l='Title :'}
+
+ {if $error}{$message}{/if}
+
+ {/form_field}
{form_field form=$form field='shortDescription'}
{intl l='Short description :'}
-
+
{if $error}{$message}{/if}
{/form_field}
-
-
-
-
{form_field form=$form field='description'}
{intl l='Long description :'}
-
+
{if $error}{$message}{/if}
{/form_field}
-
- {if $noConditions}
-
{intl l='Save your modifications'}
- {/if}
-
-
-
-
-
-
-{if $noConditions}
- {include file='includes/notifications.html' message={intl l='Please save your Coupon in oder to affect it some conditions'}}
-{else}
-
-
-
-
-
-
- {intl l='Conditions'}
-
-
-
- {intl l='Conditions'}
- {intl l='Actions'}
-
-
-
- {include file='coupon/conditions.html' conditions=$conditions}
-
-
-
-
-
-
-
-
-
-{/if}
+
+
+ {intl l='Coupon conditions'}
+
+
+
+
+ {if $noConditions}
+
+
+ {include file='includes/notifications.html' type='info' dismissable=false message={intl l='Please save this coupon first to define coupon conditions'}}
+
+ {else}
+
+
+
+
+
+ {intl l='Condition description'}
+ {intl l='Actions'}
+
+
+
+ {include file='coupon/conditions.html' conditions=$conditions}
+
+
+
+
+
+
+ {/if}
+
+
+
\ No newline at end of file