Merge pull request #441 from rahulshukla-webkul/development

Development
This commit is contained in:
JItendra Singh 2019-01-11 15:02:51 +05:30 committed by GitHub
commit 968e730b86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 165 additions and 76 deletions

View File

@ -575,6 +575,7 @@ return [
'country' => 'Country',
'male' => 'Male',
'female' => 'Female',
'phone' => 'Phone',
'created' => 'Customer created successfully.',
'updated' => 'Customer updated successfully.',
'deleted' => 'Customer deleted successfully.',

View File

@ -14,7 +14,7 @@
}
.table td.actions .icon.pencil-lg-icon {
margin-right: 10px;
}
}
</style>
@stop
@ -46,7 +46,7 @@
<div class="page-content">
<div class="form-container">
<div v-for='(attribute, index) in super_attributes' class="control-group" :class="[errors.has('add-variant-form.' + attribute.code) ? 'has-error' : '']">
<label :for="attribute.code" class="required">@{{ attribute.admin_name }}</label>
<select v-validate="'required'" v-model="variant[attribute.code]" class="control" :id="attribute.code" :name="attribute.code" :data-vv-as="'&quot;' + attribute.admin_name + '&quot;'">
@ -148,7 +148,7 @@
</td>
<td>
<div class="control-group" :class="[errors.has(variantInputName + '[price]') ? 'has-error' : '']">
<div class="control-group" :class="[errors.has(variantInputName + '[weight]') ? 'has-error' : '']">
<input type="text" v-validate="'required'" v-model="variant.weight" :name="[variantInputName + '[weight]']" class="control" data-vv-as="&quot;{{ __('admin::app.catalog.products.weight') }}&quot;"/>
<span class="control-error" v-if="errors.has(variantInputName + '[weight]')">@{{ errors.first(variantInputName + '[weight]') }}</span>
</div>
@ -232,7 +232,7 @@
weight: 0,
status: 1
}, this.variant));
this.resetModel();
this.$parent.closeModal();
@ -252,7 +252,7 @@
});
Vue.component('variant-list', {
template: '#variant-list-template',
inject: ['$validator'],
@ -331,7 +331,7 @@
if(inventories.length)
return inventories[0]['qty'];
return 0;
return 0;
},
updateTotalQty () {

View File

@ -62,7 +62,7 @@
@if (isset($field['repository']))
@foreach($value as $option)
<option value="{{ $option['name'] }}" {{ $option['name'] == $selectedOption ? 'selected' : ''}}
<option value="{{ $option['name'] }}" {{ $option['name'] == $selectedOption ? 'selected' : ''}}
{{ $option['name'] }}
</option>
@endforeach
@ -90,48 +90,41 @@
<select v-validate="'{{ $validations }}'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}][]" data-vv-as="&quot;{{ $field['name'] }}&quot;" multiple>
@if (isset($field['repository']))
@foreach($value as $option)
<option value="{{ $option['name'] }}" {{ in_array($option['name'], explode(',', $selectedOption)) ? 'selected' : ''}}>
{{ $option['name'] }}
</option>
@endforeach
@else
@foreach($field['options'] as $option)
@foreach($field['options'] as $option)
<?php
if($option['value'] == false) {
$value = 0;
} else {
$value = $option['value'];
}
<?php
if($option['value'] == false) {
$value = 0;
} else {
$value = $option['value'];
}
$selectedOption = core()->getConfigData($name) ?? '';
?>
$selectedOption = core()->getConfigData($name) ?? '';
?>
<option value="{{ $value }}" {{ $value == $selectedOption ? 'selected' : ''}}>
{{ $option['title'] }}
</option>
<option value="{{ $value }}" {{ in_array($option['value'], explode(',', $selectedOption)) ? 'selected' : ''}}>
{{ $option['title'] }}
</option>
@endforeach
@endif
@endforeach
</select>
@elseif ($field['type'] == 'country')
<select type="text" v-validate="'required'" class="control" id="country" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" data-vv-as="&quot;{{ __('admin::app.customers.customers.country') }}&quot;" onchange="myFunction()">
<option value=""></option>
<?php
$countryCode = core()->getConfigData($name) ?? '';
?>
@foreach (core()->countries() as $country)
<country code = {{ $countryCode }}></country>
<option value="{{ $country->code }}">
{{ $country->name }}
</option>
@elseif ($field['type'] == 'state')
@endforeach
</select>
<?php
$stateCode = core()->getConfigData($name) ?? '';
?>
<state code = {{ $stateCode }}></state>
@endif
@ -140,30 +133,107 @@
</div>
@push('scripts')
<script type="text/x-template" id="country-template">
<div>
<select type="text" v-validate="'required'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" v-model="country" data-vv-as="&quot;{{ __('admin::app.customers.customers.country') }}&quot;" @change="someHandler">
<option value=""></option>
@foreach (core()->countries() as $country)
<option value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
</select>
</div>
</script>
<script>
Vue.component('country', {
function myFunction() {
var countryId = document.getElementById("country").value;
var countryStates = <?php echo json_encode(core()->groupedStatesByCountries()) ;?>;
template: '#country-template',
for (var key in countryStates) {
if(key == countryId){
inject: ['$validator'],
props: ['code'],
for(state in countryStates[key]) {
console.log(state);
}
}
data: () => ({
country: "",
}),
mounted() {
this.country = this.code;
this.someHandler()
},
methods: {
someHandler() {
this.$root.$emit('sendCountryCode', this.country)
},
}
});
</script>
}
<script type="text/x-template" id="state-template">
<div>
<input type="text" v-validate="'required'" v-if="!haveStates()" class="control" v-model="state" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][state]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][state]" data-vv-as="&quot;{{ __('admin::app.customers.customers.state') }}&quot;"/>
<select v-validate="'required'" v-if="haveStates()" class="control" v-model="state" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][state]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][state]" data-vv-as="&quot;{{ __('admin::app.customers.customers.state') }}&quot;" >
<option value="">{{ __('admin::app.customers.customers.select-state') }}</option>
<option v-for='(state, index) in countryStates[country]' :value="state.code">
@{{ state.default_name }}
</option>
</select>
</div>
</script>
<script>
Vue.component('state', {
template: '#state-template',
inject: ['$validator'],
props: ['code'],
data: () => ({
state: "",
country: "",
countryStates: @json(core()->groupedStatesByCountries())
}),
mounted() {
this.state = this.code
},
methods: {
haveStates() {
this.$root.$on('sendCountryCode', (country) => {
this.country = country;
})
if(this.countryStates[this.country] && this.countryStates[this.country].length)
return true;
return false;
},
}
});
</script>
@endpush

View File

@ -67,7 +67,7 @@
haveStates() {
if(this.countryStates[this.country] && this.countryStates[this.country].length)
return true;
return false;
},
}

View File

@ -62,6 +62,12 @@
<span class="control-error" v-if="errors.has('date_of_birth')">@{{ errors.first('date_of_birth') }}</span>
</div>
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
<label for="phone">{{ __('admin::app.customers.customers.phone') }}</label>
<input type="text" class="control" name="phone" v-validate="'numeric|max:10'" value="{{ old('phone') }}" data-vv-as="&quot;{{ __('admin::app.customers.customers.phone') }}&quot;">
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
</div>
<div class="control-group">
<label for="customerGroup" >{{ __('admin::app.customers.customers.customer_group') }}</label>
<select class="control" name="customer_group_id">

View File

@ -34,19 +34,20 @@
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
<label for="first_name" class="required"> {{ __('admin::app.customers.customers.first_name') }}</label>
<input type="text" class="control" name="first_name" v-validate="'required'" value="{{$customer->first_name}}" data-vv-as="&quot;{{ __('shop::app.customers.customers.first_name') }}&quot;"/>
<input type="text" class="control" name="first_name" v-validate="'required'" value="{{$customer->first_name}}"
data-vv-as="&quot;{{ __('shop::app.customer.signup-form.firstname') }}&quot;"/>
<span class="control-error" v-if="errors.has('first_name')">@{{ errors.first('first_name') }}</span>
</div>
<div class="control-group" :class="[errors.has('last_name') ? 'has-error' : '']">
<label for="last_name" class="required"> {{ __('admin::app.customers.customers.last_name') }}</label>
<input type="text" class="control" name="last_name" v-validate="'required'" value="{{$customer->last_name}}" data-vv-as="&quot;{{ __('shop::app.customers.customers.last_name') }}&quot;"/>
<input type="text" class="control" name="last_name" v-validate="'required'" value="{{$customer->last_name}}" data-vv-as="&quot;{{ __('shop::app.customer.signup-form.lastname') }}&quot;">
<span class="control-error" v-if="errors.has('last_name')">@{{ errors.first('last_name') }}</span>
</div>
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
<label for="email" class="required"> {{ __('admin::app.customers.customers.email') }}</label>
<input type="email" class="control" name="email" v-validate="'required|email'" value="{{$customer->email}}" data-vv-as="&quot;{{ __('shop::app.customers.customers.email') }}&quot;"/>
<input type="email" class="control" name="email" v-validate="'required|email'" value="{{$customer->email}}" data-vv-as="&quot;{{ __('shop::app.customer.signup-form.email') }}&quot;">
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
</div>
@ -65,6 +66,12 @@
<span class="control-error" v-if="errors.has('date_of_birth')">@{{ errors.first('date_of_birth') }}</span>
</div>
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
<label for="phone">{{ __('admin::app.customers.customers.phone') }}</label>
<input type="text" class="control" name="phone" v-validate="'numeric|max:10'" value="{{ $customer->phone }}" data-vv-as="&quot;{{ __('admin::app.customers.customers.phone') }}&quot;">
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
</div>
<div class="control-group">
<label for="customerGroup" >{{ __('admin::app.customers.customers.customer_group') }}</label>

View File

@ -695,7 +695,6 @@ class Core
foreach (config('core') as $coreData) {
if (isset($coreData['fields'])) {
foreach ($coreData['fields'] as $field) {
$name = $coreData['key'] . '.' . $field['name'];
if ($name == $fieldName ) {

View File

@ -99,6 +99,7 @@ class CustomerController extends Controller
'gender' => 'required',
'date_of_birth' => 'date|before:today',
'email' => 'email|unique:customers,email,'.$id,
'phone' => 'nullable|numeric|unique:customers,phone,'. $id,
'password' => 'confirmed'
]);

View File

@ -17,7 +17,7 @@ class Customer extends Authenticatable
protected $table = 'customers';
protected $fillable = ['first_name', 'channel_id', 'last_name', 'gender', 'date_of_birth', 'email', 'password', 'customer_group_id', 'subscribed_to_news_letter', 'is_verified', 'token'];
protected $fillable = ['first_name', 'channel_id', 'last_name', 'gender', 'date_of_birth', 'email', 'password', 'customer_group_id', 'subscribed_to_news_letter', 'is_verified', 'token', 'phone'];
protected $hidden = ['password', 'remember_token'];

View File

@ -35,9 +35,6 @@ return [
[
'title' => 'Pending',
'value' => 'pending'
], [
'title' => 'Approved',
'value' => 'Approved'
], [
'title' => 'Pending Payment',
'value' => 'pending_payment'
@ -86,9 +83,6 @@ return [
[
'title' => 'Pending',
'value' => 'pending'
], [
'title' => 'Approved',
'value' => 'Approved'
], [
'title' => 'Pending Payment',
'value' => 'pending_payment'
@ -137,9 +131,6 @@ return [
[
'title' => 'Pending',
'value' => 'pending'
], [
'title' => 'Approved',
'value' => 'Approved'
], [
'title' => 'Pending Payment',
'value' => 'pending_payment'

View File

@ -106,16 +106,21 @@ return [
'name' => 'Origin',
'sort' => 0,
'fields' => [
// [
// 'name' => 'country',
// 'title' => 'Country',
// 'type' => 'country_state',
// 'stateName' => 'state'
// 'validation' => 'required',
// 'channel_based' => true,
// 'locale_based' => true
// ],
[
'name' => 'country',
'title' => 'Country',
'type' => 'country',
'validation' => 'required',
'channel_based' => true,
'locale_based' => true
], [
'name' => 'state',
'title' => 'State',
'type' => 'state',
'validation' => 'required',
'channel_based' => true,
'locale_based' => true
], [
'name' => 'address1',
'title' => 'Address Line 1',
'type' => 'text',

View File

@ -63,6 +63,12 @@
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
</div>
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
<label for="phone">{{ __('shop::app.customer.account.profile.phone') }}</label>
<input type="text" class="control" name="phone" v-validate="'numeric|max:10'" value="{{ old('phone') ?? $customer->phone }}" data-vv-as="&quot;{{ __('shop::app.customer.account.profile.phone') }}&quot;">
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
</div>
<div class="control-group" :class="[errors.has('oldpassword') ? 'has-error' : '']">
<label for="password">{{ __('shop::app.customer.account.profile.opassword') }}</label>
<input type="password" class="control" name="oldpassword" data-vv-as="&quot;{{ __('shop::app.customer.account.profile.opassword') }}&quot;" v-validate="'min:6'">

View File

@ -55,6 +55,11 @@
<td>{{ $customer->email }}</td>
</tr>
<tr>
<td>{{ __('shop::app.customer.account.profile.phone') }}</td>
<td>{{ $customer->phone }}</td>
</tr>
{{-- @if($customer->subscribed_to_news_letter == 1)
<tr>
<td> {{ __('shop::app.footer.subscribe-newsletter') }}</td>

View File

@ -15,7 +15,7 @@ $(function() {
var currentElement = $(e.currentTarget);
if(currentElement.attr('disabled') == "disabled")
return;
$('.dropdown-list').hide();
if(currentElement.hasClass('active')) {
currentElement.removeClass('active');
@ -59,7 +59,7 @@ $(function() {
height = dropdown.height() + 50;
var topOffset = dropdown.offset().top - 70;
var bottomOffset = $(window).height() - topOffset - dropdown.height();
if(bottomOffset > topOffset || height < bottomOffset) {
dropdown.removeClass("bottom");
if(dropdown.hasClass('top-right')) {

View File

@ -1,2 +0,0 @@
*
!.gitignore