Merge pull request #2924 from cagartner/added_new_events_to_core
Added new events to customer update and checkou, fixed some view rend…
This commit is contained in:
commit
30061b8f8d
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Webkul\Admin\Http\Controllers\Customer;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Admin\Http\Controllers\Controller;
|
||||
use Webkul\Customer\Repositories\CustomerRepository;
|
||||
use Webkul\Customer\Repositories\CustomerGroupRepository;
|
||||
|
|
@ -111,8 +112,12 @@ class CustomerController extends Controller
|
|||
|
||||
$data['is_verified'] = 1;
|
||||
|
||||
Event::dispatch('customer.registration.before');
|
||||
|
||||
$customer = $this->customerRepository->create($data);
|
||||
|
||||
Event::dispatch('customer.registration.after', $customer);
|
||||
|
||||
try {
|
||||
$configKey = 'emails.general.notifications.emails.general.notifications.customer';
|
||||
if (core()->getConfigData($configKey)) {
|
||||
|
|
@ -164,7 +169,11 @@ class CustomerController extends Controller
|
|||
|
||||
$data['status'] = ! isset($data['status']) ? 0 : 1;
|
||||
|
||||
$this->customerRepository->update($data, $id);
|
||||
Event::dispatch('customer.update.before');
|
||||
|
||||
$customer = $this->customerRepository->update($data, $id);
|
||||
|
||||
Event::dispatch('customer.update.after', $customer);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Customer']));
|
||||
|
||||
|
|
|
|||
|
|
@ -1242,14 +1242,14 @@ return [
|
|||
'system' => [
|
||||
'catalog' => 'Catálogo',
|
||||
'products' => 'Produtos',
|
||||
'guest-checkout' => 'Saída do hóspede',
|
||||
'allow-guest-checkout' => 'Permitir saída do hóspede',
|
||||
'guest-checkout' => 'Compras sem cadastro?',
|
||||
'allow-guest-checkout' => 'Permitir compra para clientes sem cadastros?',
|
||||
'allow-guest-checkout-hint' => 'Dica: se ativada, esta opção pode ser configurada para cada produto especificamente.',
|
||||
'review' => 'Reveja',
|
||||
'allow-guest-review' => 'Permitir comentário de convidado',
|
||||
'review' => 'Avaliações',
|
||||
'allow-guest-review' => 'Permitir comentários sem cadastro?',
|
||||
'inventory' => 'Inventário',
|
||||
'stock-options' => 'Opções de ações',
|
||||
'allow-backorders' => 'Permitir Pedidos por Admin',
|
||||
'allow-backorders' => 'Permitir Pedidos pelo Admin',
|
||||
'customer' => 'Cliente',
|
||||
'settings' => 'Definições',
|
||||
'address' => 'Endereço',
|
||||
|
|
|
|||
|
|
@ -31,24 +31,32 @@
|
|||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
{!! view_render_event('bagisto.admin.customers.create.before') !!}
|
||||
|
||||
<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="{{ old('first_name') }}" data-vv-as=""{{ __('shop::app.customer.signup-form.firstname') }}"">
|
||||
<span class="control-error" v-if="errors.has('first_name')">@{{ errors.first('first_name') }}</span>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.admin.customers.create.first_name.after') !!}
|
||||
|
||||
<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="{{ old('last_name') }}" data-vv-as=""{{ __('shop::app.customer.signup-form.lastname') }}"">
|
||||
<span class="control-error" v-if="errors.has('last_name')">@{{ errors.first('last_name') }}</span>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.admin.customers.create.last_name.after') !!}
|
||||
|
||||
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
|
||||
<label for="email" class="required">{{ __('shop::app.customer.signup-form.email') }}</label>
|
||||
<input type="email" class="control" name="email" v-validate="'required|email'" value="{{ old('email') }}" data-vv-as=""{{ __('shop::app.customer.signup-form.email') }}"">
|
||||
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.admin.customers.create.email.after') !!}
|
||||
|
||||
<div class="control-group" :class="[errors.has('gender') ? 'has-error' : '']">
|
||||
<label for="gender" class="required">{{ __('admin::app.customers.customers.gender') }}</label>
|
||||
<select name="gender" class="control" v-validate="'required'" data-vv-as=""{{ __('admin::app.customers.customers.gender') }}"">
|
||||
|
|
@ -60,18 +68,24 @@
|
|||
<span class="control-error" v-if="errors.has('gender')">@{{ errors.first('gender') }}</span>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.admin.customers.create.gender.after') !!}
|
||||
|
||||
<div class="control-group" :class="[errors.has('date_of_birth') ? 'has-error' : '']">
|
||||
<label for="dob">{{ __('admin::app.customers.customers.date_of_birth') }}</label>
|
||||
<input type="date" class="control" name="date_of_birth" v-validate="" value="{{ old('date_of_birth') }}" data-vv-as=""{{ __('admin::app.customers.customers.date_of_birth') }}"">
|
||||
<span class="control-error" v-if="errors.has('date_of_birth')">@{{ errors.first('date_of_birth') }}</span>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.admin.customers.create.date_of_birth.after') !!}
|
||||
|
||||
<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" value="{{ old('phone') }}" data-vv-as=""{{ __('admin::app.customers.customers.phone') }}"">
|
||||
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.admin.customers.create.phone.after') !!}
|
||||
|
||||
<div class="control-group">
|
||||
<label for="customerGroup" >{{ __('admin::app.customers.customers.customer_group') }}</label>
|
||||
<select class="control" name="customer_group_id">
|
||||
|
|
@ -80,6 +94,8 @@
|
|||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.admin.customers.create.after') !!}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@
|
|||
<accordian :title="'{{ __('admin::app.account.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
{!! view_render_event('bagisto.admin.customer.edit.form.before', ['customer' => $customer]) !!}
|
||||
|
||||
<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="{{old('first_name') ?:$customer->first_name}}"
|
||||
|
|
@ -43,18 +45,24 @@
|
|||
<span class="control-error" v-if="errors.has('first_name')">@{{ errors.first('first_name') }}</span>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.admin.customer.edit.first_name.after', ['customer' => $customer]) !!}
|
||||
|
||||
<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="{{old('last_name') ?:$customer->last_name}}" data-vv-as=""{{ __('shop::app.customer.signup-form.lastname') }}"">
|
||||
<span class="control-error" v-if="errors.has('last_name')">@{{ errors.first('last_name') }}</span>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.admin.customer.edit.last_name.after', ['customer' => $customer]) !!}
|
||||
|
||||
<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="{{old('email') ?:$customer->email}}" data-vv-as=""{{ __('shop::app.customer.signup-form.email') }}"">
|
||||
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.admin.customer.edit.email.after', ['customer' => $customer]) !!}
|
||||
|
||||
<div class="control-group" :class="[errors.has('gender') ? 'has-error' : '']">
|
||||
<label for="gender" class="required">{{ __('admin::app.customers.customers.gender') }}</label>
|
||||
<select name="gender" class="control" value="{{ $customer->gender }}" v-validate="'required'" data-vv-as=""{{ __('admin::app.customers.customers.gender') }}"">
|
||||
|
|
@ -66,6 +74,8 @@
|
|||
<span class="control-error" v-if="errors.has('gender')">@{{ errors.first('gender') }}</span>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.admin.customer.edit.gender.after', ['customer' => $customer]) !!}
|
||||
|
||||
<div class="control-group">
|
||||
<label for="status" class="required">{{ __('admin::app.customers.customers.status') }}</label>
|
||||
|
||||
|
|
@ -77,18 +87,24 @@
|
|||
<span class="control-error" v-if="errors.has('status')">@{{ errors.first('status') }}</span>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.admin.customer.edit.status.after', ['customer' => $customer]) !!}
|
||||
|
||||
<div class="control-group" :class="[errors.has('date_of_birth') ? 'has-error' : '']">
|
||||
<label for="dob">{{ __('admin::app.customers.customers.date_of_birth') }}</label>
|
||||
<input type="date" class="control" name="date_of_birth" value="{{ old('date_of_birth') ?:$customer->date_of_birth }}" v-validate="" data-vv-as=""{{ __('admin::app.customers.customers.date_of_birth') }}"">
|
||||
<span class="control-error" v-if="errors.has('date_of_birth')">@{{ errors.first('date_of_birth') }}</span>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.admin.customer.edit.date_of_birth.after', ['customer' => $customer]) !!}
|
||||
|
||||
<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" value="{{ $customer->phone }}" data-vv-as=""{{ __('admin::app.customers.customers.phone') }}"">
|
||||
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.admin.customer.edit.phone.after', ['customer' => $customer]) !!}
|
||||
|
||||
<div class="control-group">
|
||||
<label for="customerGroup" >{{ __('admin::app.customers.customers.customer_group') }}</label>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Webkul\Customer\Http\Controllers;
|
||||
|
||||
use Hash;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Customer\Repositories\CustomerRepository;
|
||||
use Webkul\Product\Repositories\ProductReviewRepository;
|
||||
|
||||
|
|
@ -114,7 +115,12 @@ class CustomerController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
if ($this->customerRepository->update($data, $id)) {
|
||||
Event::dispatch('customer.update.before');
|
||||
|
||||
if ($customer = $this->customerRepository->update($data, $id)) {
|
||||
|
||||
Event::dispatch('customer.update.after', $customer);
|
||||
|
||||
Session()->flash('success', trans('shop::app.customer.account.profile.edit-success'));
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Webkul\Shop\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Shop\Http\Controllers\Controller;
|
||||
use Webkul\Checkout\Facades\Cart;
|
||||
use Webkul\Shipping\Facades\Shipping;
|
||||
|
|
@ -52,6 +53,8 @@ class OnepageController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
Event::dispatch('checkout.load.index');
|
||||
|
||||
if (! auth()->guard('customer')->check()
|
||||
&& ! core()->getConfigData('catalog.products.guest-checkout.allow-guest-checkout')) {
|
||||
return redirect()->route('customer.session.index');
|
||||
|
|
|
|||
|
|
@ -38,28 +38,28 @@
|
|||
<td>{{ $customer->first_name }}</td>
|
||||
</tr>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.table.first_name.after') !!}
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.table.first_name.after', ['customer' => $customer]) !!}
|
||||
|
||||
<tr>
|
||||
<td>{{ __('shop::app.customer.account.profile.lname') }}</td>
|
||||
<td>{{ $customer->last_name }}</td>
|
||||
</tr>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.table.last_name.after') !!}
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.table.last_name.after', ['customer' => $customer]) !!}
|
||||
|
||||
<tr>
|
||||
<td>{{ __('shop::app.customer.account.profile.gender') }}</td>
|
||||
<td>{{ $customer->gender }}</td>
|
||||
<td>{{ __($customer->gender) }}</td>
|
||||
</tr>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.table.gender.after') !!}
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.table.gender.after', ['customer' => $customer]) !!}
|
||||
|
||||
<tr>
|
||||
<td>{{ __('shop::app.customer.account.profile.dob') }}</td>
|
||||
<td>{{ $customer->date_of_birth }}</td>
|
||||
</tr>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.table.date_of_birth.after') !!}
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.table.date_of_birth.after', ['customer' => $customer]) !!}
|
||||
|
||||
<tr>
|
||||
<td>{{ __('shop::app.customer.account.profile.email') }}</td>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
action="{{ route('customer.profile.edit') }}">
|
||||
@csrf
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit.before', ['customer' => $customer]) !!}
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit_form_controls.before', ['customer' => $customer]) !!}
|
||||
|
||||
<div :class="`row ${errors.has('first_name') ? 'has-error' : ''}`">
|
||||
<label class="col-12 mandatory">
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit.first_name.after') !!}
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit.first_name.after', ['customer' => $customer]) !!}
|
||||
|
||||
<div class="row">
|
||||
<label class="col-12">
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit.last_name.after') !!}
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit.last_name.after', ['customer' => $customer]) !!}
|
||||
|
||||
<div :class="`row ${errors.has('gender') ? 'has-error' : ''}`">
|
||||
<label class="col-12 mandatory">
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit.gender.after') !!}
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit.gender.after', ['customer' => $customer]) !!}
|
||||
|
||||
<div :class="`row ${errors.has('date_of_birth') ? 'has-error' : ''}`">
|
||||
<label class="col-12">
|
||||
|
|
@ -119,7 +119,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit.date_of_birth.after') !!}
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit.date_of_birth.after', ['customer' => $customer]) !!}
|
||||
|
||||
<div class="row">
|
||||
<label class="col-12 mandatory">
|
||||
|
|
@ -132,7 +132,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit.email.after') !!}
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit.email.after', ['customer' => $customer]) !!}
|
||||
|
||||
<div class="row">
|
||||
<label class="col-12">
|
||||
|
|
@ -144,7 +144,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit.oldpassword.after') !!}
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit.oldpassword.after', ['customer' => $customer]) !!}
|
||||
|
||||
<div class="row">
|
||||
<label class="col-12">
|
||||
|
|
@ -164,7 +164,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit.password.after') !!}
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit.password.after', ['customer' => $customer]) !!}
|
||||
|
||||
<div class="row">
|
||||
<label class="col-12">
|
||||
|
|
|
|||
|
|
@ -46,28 +46,28 @@
|
|||
<td>{{ $customer->first_name }}</td>
|
||||
</tr>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.table.first_name.after') !!}
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.table.first_name.after', ['customer' => $customer]) !!}
|
||||
|
||||
<tr>
|
||||
<td>{{ __('shop::app.customer.account.profile.lname') }}</td>
|
||||
<td>{{ $customer->last_name }}</td>
|
||||
</tr>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.table.last_name.after') !!}
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.table.last_name.after', ['customer' => $customer]) !!}
|
||||
|
||||
<tr>
|
||||
<td>{{ __('shop::app.customer.account.profile.gender') }}</td>
|
||||
<td>{{ $customer->gender ?? '-' }}</td>
|
||||
</tr>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.table.gender.after') !!}
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.table.gender.after', ['customer' => $customer]) !!}
|
||||
|
||||
<tr>
|
||||
<td>{{ __('shop::app.customer.account.profile.dob') }}</td>
|
||||
<td>{{ $customer->date_of_birth ?? '-' }}</td>
|
||||
</tr>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.table.date_of_birth.after') !!}
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.view.table.date_of_birth.after', ['customer' => $customer]) !!}
|
||||
|
||||
<tr>
|
||||
<td>{{ __('shop::app.customer.account.profile.email') }}</td>
|
||||
|
|
|
|||
Loading…
Reference in New Issue