ConvertXToProductId frontend complete now moving to converting X to ids
This commit is contained in:
parent
08f606c099
commit
4017e3b16e
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/admin.js": "/js/admin.js?id=bc5093aae84319207809",
|
||||
"/js/admin.js": "/js/admin.js?id=0afa8deaa3ea01b81abf",
|
||||
"/css/admin.css": "/css/admin.css?id=195e1b16939f9c233f32"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,76 +8,6 @@ Vue.prototype.$http = axios
|
|||
|
||||
window.eventBus = new Vue();
|
||||
|
||||
window.addEventListener('DOMContentLoaded', function() {
|
||||
moveDown = 60;
|
||||
moveUp = -60;
|
||||
count = 0;
|
||||
countKeyUp = 0;
|
||||
pageDown = 60;
|
||||
pageUp = -60;
|
||||
scroll = 0;
|
||||
|
||||
listLastElement = $('.menubar li:last-child').offset();
|
||||
|
||||
if (listLastElement) {
|
||||
lastElementOfNavBar = listLastElement.top;
|
||||
}
|
||||
|
||||
navbarTop = $('.navbar-left').css("top");
|
||||
menuTopValue = $('.navbar-left').css('top');
|
||||
menubarTopValue = menuTopValue;
|
||||
|
||||
documentHeight = $(document).height();
|
||||
menubarHeight = $('ul.menubar').height();
|
||||
navbarHeight = $('.navbar-left').height();
|
||||
windowHeight = $(window).height();
|
||||
contentHeight = $('.content').height();
|
||||
innerSectionHeight = $('.inner-section').height();
|
||||
gridHeight = $('.grid-container').height();
|
||||
pageContentHeight = $('.page-content').height();
|
||||
|
||||
if (menubarHeight <= windowHeight) {
|
||||
differenceInHeight = windowHeight - menubarHeight;
|
||||
} else {
|
||||
differenceInHeight = menubarHeight - windowHeight;
|
||||
}
|
||||
|
||||
if (menubarHeight > windowHeight) {
|
||||
document.addEventListener("keydown", function(event) {
|
||||
if ((event.keyCode == 38) && count <= 0) {
|
||||
count = count + moveDown;
|
||||
|
||||
$('.navbar-left').css("top", count + "px");
|
||||
} else if ((event.keyCode == 40) && count >= -differenceInHeight) {
|
||||
count = count + moveUp;
|
||||
|
||||
$('.navbar-left').css("top", count + "px");
|
||||
} else if ((event.keyCode == 33) && countKeyUp <= 0) {
|
||||
countKeyUp = countKeyUp + pageDown;
|
||||
|
||||
$('.navbar-left').css("top", countKeyUp + "px");
|
||||
} else if ((event.keyCode == 34) && countKeyUp >= -differenceInHeight) {
|
||||
countKeyUp = countKeyUp + pageUp;
|
||||
|
||||
$('.navbar-left').css("top", countKeyUp + "px");
|
||||
} else {
|
||||
$('.navbar-left').css("position", "fixed");
|
||||
}
|
||||
});
|
||||
|
||||
$("body").css({minHeight: $(".menubar").outerHeight() + 100 + "px"});
|
||||
|
||||
window.addEventListener('scroll', function() {
|
||||
documentScrollWhenScrolled = $(document).scrollTop();
|
||||
|
||||
if (documentScrollWhenScrolled <= differenceInHeight + 200) {
|
||||
$('.navbar-left').css('top', -documentScrollWhenScrolled + 60 + 'px');
|
||||
scrollTopValueWhenNavBarFixed = $(document).scrollTop();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
Vue.config.ignoredElements = [
|
||||
'option-wrapper',
|
||||
|
|
|
|||
|
|
@ -75,7 +75,77 @@
|
|||
|
||||
<script type="text/javascript" src="{{ asset('vendor/webkul/admin/assets/js/admin.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ asset('vendor/webkul/ui/assets/js/ui.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
window.addEventListener('DOMContentLoaded', function() {
|
||||
moveDown = 60;
|
||||
moveUp = -60;
|
||||
count = 0;
|
||||
countKeyUp = 0;
|
||||
pageDown = 60;
|
||||
pageUp = -60;
|
||||
scroll = 0;
|
||||
|
||||
listLastElement = $('.menubar li:last-child').offset();
|
||||
|
||||
if (listLastElement) {
|
||||
lastElementOfNavBar = listLastElement.top;
|
||||
}
|
||||
|
||||
navbarTop = $('.navbar-left').css("top");
|
||||
menuTopValue = $('.navbar-left').css('top');
|
||||
menubarTopValue = menuTopValue;
|
||||
|
||||
documentHeight = $(document).height();
|
||||
menubarHeight = $('ul.menubar').height();
|
||||
navbarHeight = $('.navbar-left').height();
|
||||
windowHeight = $(window).height();
|
||||
contentHeight = $('.content').height();
|
||||
innerSectionHeight = $('.inner-section').height();
|
||||
gridHeight = $('.grid-container').height();
|
||||
pageContentHeight = $('.page-content').height();
|
||||
|
||||
if (menubarHeight <= windowHeight) {
|
||||
differenceInHeight = windowHeight - menubarHeight;
|
||||
} else {
|
||||
differenceInHeight = menubarHeight - windowHeight;
|
||||
}
|
||||
|
||||
if (menubarHeight > windowHeight) {
|
||||
document.addEventListener("keydown", function(event) {
|
||||
if ((event.keyCode == 38) && count <= 0) {
|
||||
count = count + moveDown;
|
||||
|
||||
$('.navbar-left').css("top", count + "px");
|
||||
} else if ((event.keyCode == 40) && count >= -differenceInHeight) {
|
||||
count = count + moveUp;
|
||||
|
||||
$('.navbar-left').css("top", count + "px");
|
||||
} else if ((event.keyCode == 33) && countKeyUp <= 0) {
|
||||
countKeyUp = countKeyUp + pageDown;
|
||||
|
||||
$('.navbar-left').css("top", countKeyUp + "px");
|
||||
} else if ((event.keyCode == 34) && countKeyUp >= -differenceInHeight) {
|
||||
countKeyUp = countKeyUp + pageUp;
|
||||
|
||||
$('.navbar-left').css("top", countKeyUp + "px");
|
||||
} else {
|
||||
$('.navbar-left').css("position", "fixed");
|
||||
}
|
||||
});
|
||||
|
||||
$("body").css({minHeight: $(".menubar").outerHeight() + 100 + "px"});
|
||||
|
||||
window.addEventListener('scroll', function() {
|
||||
documentScrollWhenScrolled = $(document).scrollTop();
|
||||
|
||||
if (documentScrollWhenScrolled <= differenceInHeight + 200) {
|
||||
$('.navbar-left').css('top', -documentScrollWhenScrolled + 60 + 'px');
|
||||
scrollTopValueWhenNavBarFixed = $(document).scrollTop();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@stack('scripts')
|
||||
|
||||
{!! view_render_event('bagisto.admin.layout.body.after') !!}
|
||||
|
|
|
|||
|
|
@ -343,6 +343,8 @@
|
|||
|
||||
<accordian :active="true" title="{{ __('admin::app.promotion.select-products') }}">
|
||||
<div slot="body">
|
||||
<input type="hidden" name="all_attributes" v-model="all_attributes">
|
||||
|
||||
<div class="control-group" :class="[errors.has('category_values') ? 'has-error' : '']">
|
||||
<label class="mb-10" for="categories">{{ __('admin::app.promotion.select-category') }}</label>
|
||||
|
||||
|
|
@ -455,6 +457,11 @@
|
|||
all_conditions: [],
|
||||
match_criteria: 'all_are_true',
|
||||
|
||||
all_attributes: {
|
||||
'categories' : null,
|
||||
'attributes' : null
|
||||
},
|
||||
|
||||
code: null,
|
||||
suffix: null,
|
||||
prefix: null,
|
||||
|
|
@ -477,8 +484,8 @@
|
|||
actions: @json($cart_rule[0]).actions,
|
||||
conditions_list:[],
|
||||
cart_object: {
|
||||
attribute: null,
|
||||
condition: null,
|
||||
attribute: [],
|
||||
condition: [],
|
||||
value: []
|
||||
},
|
||||
country_and_states: @json($cart_rule[2]),
|
||||
|
|
@ -497,10 +504,6 @@
|
|||
}
|
||||
},
|
||||
|
||||
mounted () {
|
||||
// console.log(this.category_options, this.attribute_input[1].options);
|
||||
},
|
||||
|
||||
methods: {
|
||||
categoryLabel (option) {
|
||||
return option.name + ' [ ' + option.slug + ' ]';
|
||||
|
|
@ -595,6 +598,20 @@
|
|||
},
|
||||
|
||||
onSubmit: function (e) {
|
||||
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.length > 0) {
|
||||
this.all_attributes.categories = this.category_values;
|
||||
}
|
||||
|
||||
this.all_attributes.attributes = this.attribute_values;
|
||||
|
||||
this.all_attributes = JSON.stringify(this.all_attributes);
|
||||
}
|
||||
|
||||
if (this.conditions_list.length != 0) {
|
||||
this.conditions_list.push({'criteria': this.match_criteria});
|
||||
|
||||
|
|
|
|||
|
|
@ -346,6 +346,54 @@
|
|||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :active="true" title="{{ __('admin::app.promotion.select-products') }}">
|
||||
<div slot="body">
|
||||
<input type="hidden" name="all_attributes" v-model="all_attributes">
|
||||
|
||||
<div class="control-group" :class="[errors.has('category_values') ? 'has-error' : '']">
|
||||
<label class="mb-10" for="categories">{{ __('admin::app.promotion.select-category') }}</label>
|
||||
|
||||
<multiselect v-model="category_values" :close-on-select="false" :options="category_options" :searchable="false" :custom-label="categoryLabel" :show-labels="true" placeholder="Select Categories" track-by="slug" :multiple="true"></multiselect>
|
||||
</div>
|
||||
|
||||
<label class="mb-10" for="attributes">{{ __('admin::app.promotion.select-attribute') }}</label>
|
||||
|
||||
<br/>
|
||||
|
||||
<div class="control-container mt-20" v-for="(condition, index) in attribute_values" :key="index">
|
||||
<select class="control" v-model="attribute_values[index].attribute" title="You Can Make Multiple Selections Here" style="margin-right: 15px; width: 30%;" v-on:change="enableAttributeCondition($event, index)">
|
||||
<option disabled="disabled">Select Option</option>
|
||||
|
||||
<option v-for="(attr_ip, index1) in attribute_input" :value="attr_ip.code" :key="index1">@{{ attr_ip.name }}</option>
|
||||
</select>
|
||||
|
||||
<select class="control" v-model="attribute_values[index].condition" style="margin-right: 15px;">
|
||||
<option v-for="(condition, index) in conditions.string" :value="index" :key="index">@{{ condition }}</option>
|
||||
</select>
|
||||
|
||||
<div v-show='attribute_values[index].type == "select" || attribute_values[index].type == "multiselect"' style="display: flex;">
|
||||
<select class="control" v-model="attribute_values[index].value" style="margin-right: 15px; height: 100px" :multiple="true">
|
||||
<option :disabled="true">
|
||||
{{ __('ui::form.select-attribute', ['attribute' => 'Values']) }}
|
||||
</option>
|
||||
|
||||
<option v-for="(label, index2) in attribute_values[index].options" :value="index2" :key="index2">@{{ label.admin_name }}</option>
|
||||
</select>
|
||||
|
||||
{{-- <multiselect v-model="attribute_values[index].value" :close-on-select="false" :options="attribute_values[index].options" :searchable="false" :track-by="admin_name" :custom-label="attributeListLabel" :multiple="true" ></multiselect> --}}
|
||||
</div>
|
||||
|
||||
<div v-show='attribute_values[index].type == "text" || attribute_values[index].type == "textarea" || attribute_values[index].type == "price" || attribute_values[index].type == "textarea"' style="display: flex">
|
||||
<input class="control" v-model="attribute_values[index].value" type="text" placeholder="{{ __('ui::form.enter-attribute', ['attribute' => 'Text']) }}">
|
||||
</div>
|
||||
|
||||
<span class="icon trash-icon" v-on:click="removeAttr(index)"></span>
|
||||
</div>
|
||||
|
||||
<span class="btn btn-primary btn-lg mt-20" v-on:click="addAttributeCondition">Add Attribute Condition</span>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :active="false" :title="'{{ __('admin::app.promotion.general-info.labels') }}'">
|
||||
<div slot="body">
|
||||
@foreach($cart_rule[3]->labels as $label)
|
||||
|
|
@ -403,6 +451,11 @@
|
|||
all_conditions: null,
|
||||
match_criteria: 'all_are_true',
|
||||
|
||||
all_attributes: {
|
||||
'categories' : null,
|
||||
'attributes' : null
|
||||
},
|
||||
|
||||
code: null,
|
||||
suffix: null,
|
||||
prefix: null,
|
||||
|
|
@ -428,7 +481,19 @@
|
|||
condition: null,
|
||||
value: []
|
||||
},
|
||||
country_and_states: @json($cart_rule[2])
|
||||
country_and_states: @json($cart_rule[2]),
|
||||
|
||||
category_options: @json($cart_rule[1]),
|
||||
category_values: null,
|
||||
|
||||
attribute_values: [],
|
||||
attr_object: {
|
||||
attribute: null,
|
||||
condition: null,
|
||||
value: [],
|
||||
options: []
|
||||
},
|
||||
attribute_input: @json($cart_rule[4]),
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -491,10 +556,32 @@
|
|||
this.match_criteria = this.conditions_list.pop().criteria;
|
||||
}
|
||||
|
||||
this.category_values = JSON.parse(JSON.parse(data.actions).attribute_conditions).categories;
|
||||
|
||||
this.attribute_values = JSON.parse(JSON.parse(data.actions).attribute_conditions).attributes;
|
||||
|
||||
for (i in this.attribute_values) {
|
||||
for (j in this.attribute_input) {
|
||||
if (this.attribute_input[j].code == this.attribute_values[i].attribute) {
|
||||
this.attribute_values[i].has_options = true;
|
||||
|
||||
this.attribute_values[i].options = this.attribute_input[j].options;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
criteria = null;
|
||||
},
|
||||
|
||||
methods: {
|
||||
categoryLabel (option) {
|
||||
return option.name + ' [ ' + option.slug + ' ]';
|
||||
},
|
||||
|
||||
attributeListLabel(option) {
|
||||
return option.label;
|
||||
},
|
||||
|
||||
addCondition () {
|
||||
if (this.criteria == 'product_subselection' || this.criteria == 'cart') {
|
||||
this.condition_on = this.criteria;
|
||||
|
|
@ -515,6 +602,17 @@
|
|||
}
|
||||
},
|
||||
|
||||
addAttributeCondition() {
|
||||
this.attribute_values.push(this.attr_object);
|
||||
|
||||
this.attr_object = {
|
||||
attribute: null,
|
||||
condition: null,
|
||||
value: [],
|
||||
options: []
|
||||
};
|
||||
},
|
||||
|
||||
checkAutogen() {
|
||||
},
|
||||
|
||||
|
|
@ -538,6 +636,22 @@
|
|||
}
|
||||
},
|
||||
|
||||
enableAttributeCondition (event, index) {
|
||||
selectedIndex = event.target.selectedIndex - 1;
|
||||
|
||||
for(i in this.attribute_input) {
|
||||
if (i == selectedIndex) {
|
||||
if (this.attribute_input[i].has_options == true) {
|
||||
this.attribute_values[index].options = this.attribute_input[i].options;
|
||||
|
||||
console.log(this.attribute_values);
|
||||
}
|
||||
|
||||
this.attribute_values[index].type = this.attribute_input[i].type;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
useCoupon() {
|
||||
if (this.use_coupon == 0) {
|
||||
this.auto_generation = null;
|
||||
|
|
|
|||
|
|
@ -128,6 +128,9 @@ class CartRuleController extends Controller
|
|||
|
||||
$data = request()->all();
|
||||
|
||||
$attribute_conditions = $data['all_attributes'];
|
||||
unset($data['all_attributes']);
|
||||
|
||||
// unset token
|
||||
unset($data['_token']);
|
||||
|
||||
|
|
@ -172,11 +175,22 @@ class CartRuleController extends Controller
|
|||
|
||||
$data['disc_quantity'] = $data['disc_amount'];
|
||||
} else {
|
||||
$data['actions'] = [
|
||||
'action_type' => $data['action_type'],
|
||||
'disc_amount' => $data['disc_amount'],
|
||||
'disc_quantity' => $data['disc_quantity']
|
||||
];
|
||||
if (! isset($attribute_conditions) || $attribute_conditions == "[]" || $attribute_conditions == "") {
|
||||
$data['uses_attribute_conditions'] = 0;
|
||||
|
||||
$data['actions'] = [
|
||||
'action_type' => $data['action_type'],
|
||||
'disc_amount' => $data['disc_amount'],
|
||||
'disc_quantity' => $data['disc_quantity']
|
||||
];
|
||||
} else {
|
||||
$data['actions'] = [
|
||||
'action_type' => $data['action_type'],
|
||||
'disc_amount' => $data['disc_amount'],
|
||||
'disc_quantity' => $data['disc_quantity'],
|
||||
'attribute_conditions' => $attribute_conditions
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// prepare json object from conditions
|
||||
|
|
@ -304,9 +318,10 @@ class CartRuleController extends Controller
|
|||
|
||||
return view($this->_config['view'])->with('cart_rule', [
|
||||
$this->appliedConfig,
|
||||
[],
|
||||
$this->category->getPartial(),
|
||||
$this->getStatesAndCountries(),
|
||||
$cart_rule
|
||||
$cart_rule,
|
||||
$this->attribute->getPartial()
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue