Working : Coupon - update loop
This commit is contained in:
@@ -78,7 +78,14 @@ $(function($){
|
||||
// Save rules on click
|
||||
couponManager.onClickSaveRule = function() {
|
||||
$('#constraint-save-btn').on('click', function () {
|
||||
couponManager.createOrUpdateRuleAjax();
|
||||
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.onClickSaveRule();
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<h1>{intl l='Coupon : '}<small>{$CODE}</small></h1>
|
||||
</div>
|
||||
|
||||
|
||||
<section class="row">
|
||||
<div class="col-md-12 general-block-decorator">
|
||||
|
||||
@@ -31,9 +30,27 @@
|
||||
<td>{intl l='Title'}</td>
|
||||
<td>{$TITLE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_ENABLED}
|
||||
<span class="label label-success">
|
||||
{intl l="Is enabled"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-warning">
|
||||
{intl l="Is disabled"}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{$TOOLTIP}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Expiration date'}</td>
|
||||
<td>{$EXPIRATION_DATE}</td>
|
||||
<td>{$EXPIRATION_DATE} ({$DAY_LEFT_BEFORE_EXPIRATION} {intl l="days left"})</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Usage left'}</td>
|
||||
@@ -43,7 +60,7 @@
|
||||
{$USAGE_LEFT}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-important">
|
||||
<span class="label label-warning">
|
||||
0
|
||||
</span>
|
||||
{/if}
|
||||
@@ -62,7 +79,7 @@
|
||||
{intl l="May be cumulative"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-important">
|
||||
<span class="label label-warning">
|
||||
{intl l="Can't be cumulative"}
|
||||
</span>
|
||||
{/if}
|
||||
@@ -71,13 +88,26 @@
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_REMOVING_POSTAGE}
|
||||
<span class="label label-important">
|
||||
{intl l="Will remove postage"}
|
||||
</span>
|
||||
<span class="label label-warning">
|
||||
{intl l="Will remove postage"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-success">
|
||||
{intl l="Won't remove postage"}
|
||||
</span>
|
||||
{intl l="Won't remove postage"}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_AVAILABLE_ON_SPECIAL_OFFERS}
|
||||
<span class="label label-warning">
|
||||
{intl l="Will be available on special offers"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-success">
|
||||
{intl l="Won't be available on special offers"}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
@@ -102,7 +132,6 @@
|
||||
<td>{intl l='Actions'}</td>
|
||||
<td>
|
||||
<a href="#url" class="btn btn-default btn-primary btn-medium"><span class="icon-edit icon-white"></span> {intl l='Edit'}</a>
|
||||
<a href="#url" class="btn btn-default btn-success btn-medium" data-toggle="confirm" data-target="#enable"><span class="glyphicon glyphicon-ok"></span> {intl l='Enabled'}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -112,13 +112,21 @@
|
||||
}).done(function(data) {
|
||||
$('#constraint-add-operators-values').html(data);
|
||||
couponManager.ruleToSave.serviceId = ruleId;
|
||||
|
||||
if (ruleId == -1) {
|
||||
// Placeholder can't be saved
|
||||
$('#constraint-save-btn').hide();
|
||||
} else {
|
||||
$('#constraint-save-btn').show();
|
||||
}
|
||||
return callBack();
|
||||
});
|
||||
};
|
||||
|
||||
// Rules which will be saved
|
||||
couponManager.rulesToSave = couponManager.initRules();
|
||||
|
||||
$('#constraint-save-btn').hide();
|
||||
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
@@ -202,6 +202,7 @@
|
||||
<div id="rule-add-type" class="form-group col-md-4">
|
||||
<label for="categoryRule">{intl l='Rule\'s category :'}</label>
|
||||
<select name="categoryRule" id="category-rule" class="form-control">
|
||||
<option value="-1" >{intl l='Please select a rule category'}</option>
|
||||
{foreach from=$availableRules item=availableRule}
|
||||
<option value="{$availableRule.serviceId}" data-description="{$availableRule.toolTip}">{$availableRule.name}</option>
|
||||
{/foreach}
|
||||
|
||||
Reference in New Issue
Block a user