cart rule labels refactoring in midway

This commit is contained in:
Prashant Singh 2019-06-03 17:52:52 +05:30
parent 6705f07e27
commit db3b35ff4c
4 changed files with 15 additions and 34 deletions

View File

@ -140,6 +140,11 @@ Although, mailer environment variables are also required to be set up as **Bagis
##### On server:
Warning: Before going full on production mode we recommend you to install developer dependencies.
In order to do that, run the command below:
> composer install --no-dev
~~~
Open the specified entry point in your hosts file in browser or make entry in hosts file if not done.
~~~

View File

@ -116,7 +116,7 @@
'']">
<label for="customer_groups" class="required">{{ __('admin::app.promotion.general-info.is-coupon') }}</label>
<select type="text" class="control" name="use_coupon" v-model="use_coupon" v-validate="'required'" value="{{ old('use_coupon')}}" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.is-coupon') }}&quot;" v-on:change="useCoupon">
<select type="text" class="control" name="use_coupon" v-model="use_coupon" v-validate="'required'" value="{{ old('use_coupon')}}" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.is-coupon') }}&quot;">
<option value="1" :selected="use_coupon == 1">{{ __('admin::app.promotion.general-info.is-coupon-yes') }}</option>
<option value="0" :selected="use_coupon == 0">{{ __('admin::app.promotion.general-info.is-coupon-no') }}</option>
</select>

View File

@ -232,6 +232,9 @@
<input type="number" step="0.1000" class="control" name="cart_attributes[]" v-model="conditions_list[index].value" placeholder="Enter Value">
</div>
<input type="hidden" name="all_conditions" v-model="all_conditions">
</div>
</div>
</div>
@ -348,27 +351,9 @@
<accordian :active="false" title="labels">
<div slot="body">
<input type="hidden" name="all_conditions" v-model="all_conditions">
<div class="control-group" :class="[errors.has('label') ? 'has-error' : '']" v-if="dedicated_label">
<label for="label" class="required">Global Label</label>
<input type="text" class="control" name="label[global]" v-model="label.global" data-vv-as="&quot;label&quot;">
<span class="control-error" v-if="errors.has('label')">@{{ errors.first('label') }}</span>
</div>
<div v-if="label.global == null || label.global == ''">
@foreach($cart_rule[3]->labels as $label)
<span>[{{ $label->channel->code }}]</span>
<div class="control-group" :class="[errors.has('label') ? 'has-error' : '']">
<label for="id">{{ $label->locale->code }}</label>
<input type="text" class="control" name="label[{{ $label->channel->code }}][{{ $label->locale->code }}]" v-model="label.{{ $label->channel->code }}.{{ $label->locale->code }}" data-vv-as="&quot;Label&quot;" value="{{ old('label') }}">
<span class="control-error" v-if="errors.has('label')">@{{ errors.first('label') }}</span>
</div>
@endforeach
</div>
</div>
</accordian>
</div>
@ -421,11 +406,10 @@
global_label: null,
label: {
global: null,
@foreach(core()->getAllChannels() as $channel)
@foreach($channel->locales as $locale)
'{{ trim($channel->code) }}' : {
'{{ trim($locale->code) }}': null
{{ trim($channel->code) }} : {
{{ trim($locale->code) }}: ''
},
@endforeach
@endforeach
@ -504,18 +488,6 @@
this.conditions_list = JSON.parse(JSON.parse(data.conditions));
}
this.dedicated_label = false;
global_label = null;
this.label = {
@foreach($cart_rule[3]->labels as $label)
'{{ $label->channel->code }}': {
'{{ $label->locale->code }}':
'{{ $label->label }}'
},
@endforeach
}
criteria = null;
},

View File

@ -209,12 +209,14 @@ class CartRuleController extends Controller
foreach($channel->locales as $locale) {
$label1['locale_id'] = $locale->id;
$label1['label'] = $labels['global'];
$label1['cart_rule_id'] = $ruleCreated->id;
$ruleLabelCreated = $this->cartRuleLabel->create($label1);
}
}
} else {
$label2['label'] = $labels['global'];
$label2['cart_rule_id'] = $ruleCreated->id;
$ruleLabelCreated = $this->cartRuleLabel->create($label2);
}
@ -280,6 +282,8 @@ class CartRuleController extends Controller
$data = request()->all();
dd($data);
if ($data['starts_from'] == "" || $data['ends_till'] == "") {
$data['starts_from'] = null;
$data['ends_till'] = null;