WIP
- Coupon Add/Edit/Delete rule AJAX
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
{*{$inputs.inputs|var_dump}*}
|
||||
{foreach from=$inputs.inputs key=name item=input}
|
||||
<label for="operator">{$input.title}</label>
|
||||
<div class="row">
|
||||
@@ -71,6 +70,8 @@
|
||||
{*</div>*}
|
||||
|
||||
<script>
|
||||
|
||||
// Init Rules to set
|
||||
var ruleToSave = {};
|
||||
ruleToSave['serviceId'] = '{$ruleId}';
|
||||
ruleToSave['operators'] = {};
|
||||
@@ -81,22 +82,23 @@
|
||||
{/foreach}
|
||||
|
||||
|
||||
// Update ruleToSave Array ready to be saved
|
||||
// Fill in ready to be saved rule array
|
||||
var onInputsChange = function() {literal}{{/literal}
|
||||
{foreach from=$inputs.inputs key=name item=input}
|
||||
$('#{$name}-operator').change(function (e) {
|
||||
|
||||
var $this = $(this);
|
||||
console.log('{$name}-operator changed by ' + $this.val());
|
||||
ruleToSave['operators']['{$name nofilter}'] = $this.val();
|
||||
console.log('#{$name}-operator changed ' + $this.val());
|
||||
console.log(ruleToSave);
|
||||
});
|
||||
$('#{$name}-value').change(function (e) {
|
||||
var $this = $(this);
|
||||
console.log('{$name}-value changed by ' + $this);
|
||||
ruleToSave['values']['{$name nofilter}'] = $this.val();
|
||||
console.log('#{$name}-value changed ' + $this.val());
|
||||
console.log(ruleToSave);
|
||||
});
|
||||
{/foreach}
|
||||
console.log('will save ');
|
||||
console.log(ruleToSave);
|
||||
{literal}}{/literal}
|
||||
onInputsChange();
|
||||
</script>
|
||||
Reference in New Issue
Block a user