Fixed form error management

This commit is contained in:
Franck Allimant
2014-05-02 20:08:38 +02:00
parent 4bab223421
commit 621c17c97d
2 changed files with 44 additions and 46 deletions

View File

@@ -56,7 +56,7 @@ $(function($){
$('#condition-list').html($.couponManager.intlPleaseSelectAnotherCondition);
}
}
}).done(function(data) {
}).done(function() {
// Reload condition summaries ajax
$.couponManager.displayConditionsSummary();
});
@@ -207,24 +207,9 @@ $(function($){
};
// ***********************************************
// *************** Manager Coupon ****************
// ***********************************************
// Reload effect inputs when changing effect
$.couponManager.onEffectChange = function() {
var mainDiv = $('#coupon-type');
var optionSelected = mainDiv.find('#type option:selected');
mainDiv.find('.typeToolTip').html(optionSelected.data('description'));
mainDiv.find('#type').on('change', function () {
var optionSelected = $('option:selected', this);
$.couponManager.displayEfffect(optionSelected);
});
};
$.couponManager.onEffectChange();
$.couponManager.displayEfffect = function(optionSelected) {
var mainDiv = $('#coupon-type');
@@ -251,6 +236,20 @@ $(function($){
});
};
// Reload effect inputs when changing effect
$.couponManager.onEffectChange = function() {
var mainDiv = $('#coupon-type');
var optionSelected = mainDiv.find('#type option:selected');
mainDiv.find('.typeToolTip').html(optionSelected.data('description'));
mainDiv.find('#type').on('change', function () {
var optionSelected = $('option:selected', this);
$.couponManager.displayEfffect(optionSelected);
});
};
$.couponManager.onEffectChange();
$.couponManager.displayConditionsSummary = function() {
var mainDiv = $('#condition-list');
mainDiv.html('<div class="loading" ></div>');
@@ -277,7 +276,9 @@ $(function($){
// Set max usage to unlimited or not
$.couponManager.onUsageUnlimitedChange = function() {
var $isUnlimited = $('#is-unlimited');
$maxUsage = $('#max-usage');
var $maxUsage = $('#max-usage');
if ($maxUsage.val() == -1) {
$isUnlimited.prop('checked', true);
$maxUsage.hide();
@@ -299,5 +300,6 @@ $(function($){
}
});
};
$.couponManager.onUsageUnlimitedChange();
});