From 6c03f824ec6cf44fabbfe917807953d799746120 Mon Sep 17 00:00:00 2001 From: Prashant Singh Date: Tue, 10 Sep 2019 04:11:43 +0530 Subject: [PATCH] Refactoring in catalog rule form --- .../views/promotions/catalog-rule/create.blade.php | 9 +++++---- .../views/promotions/catalog-rule/edit.blade.php | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/Webkul/Admin/src/Resources/views/promotions/catalog-rule/create.blade.php b/packages/Webkul/Admin/src/Resources/views/promotions/catalog-rule/create.blade.php index 197ce1be1..e223cc1c5 100644 --- a/packages/Webkul/Admin/src/Resources/views/promotions/catalog-rule/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/promotions/catalog-rule/create.blade.php @@ -377,13 +377,14 @@ this.all_attributes.categories = this.category_values; } - this.all_attributes.attributes = this.attribute_values; + if (this.attribute_values.length > 0) { + this.all_attributes.attributes = this.attribute_values; + } - this.all_conditions = JSON.stringify(this.all_attributes); - } else { - this.all_conditions = null; } + this.all_conditions = JSON.stringify(this.all_attributes); + // this.all_conditions = JSON.stringify(this.conditions_list); // if (this.conditions_list.length != 0) { diff --git a/packages/Webkul/Admin/src/Resources/views/promotions/catalog-rule/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/promotions/catalog-rule/edit.blade.php index 28e72b240..d8f307a94 100644 --- a/packages/Webkul/Admin/src/Resources/views/promotions/catalog-rule/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/promotions/catalog-rule/edit.blade.php @@ -235,8 +235,8 @@ all_conditions: [], all_attributes: { - 'categories' : null, - 'attributes' : null + 'categories' : [], + 'attributes' : [] }, criteria: 'cart', @@ -365,12 +365,12 @@ }, onSubmit: function (e) { - if (this.attribute_values != null || this.category_values != null) { + if (this.attribute_values.length > 0 || this.category_values.length > 0) { for (i in this.attribute_values) { delete this.attribute_values[i].options; } - if (this.category_values != null) { + if (this.category_values.length > 0) { this.all_attributes.categories = this.category_values; }