From 2446f56413db9cd9794ba7d37fa2f2586a4161cc Mon Sep 17 00:00:00 2001 From: jitendra Date: Tue, 12 Nov 2019 13:52:38 +0530 Subject: [PATCH] Issue #1746, #1271, #1735 fixed --- .../Http/Controllers/OnepageController.php | 3 +- .../views/checkout/onepage.blade.php | 42 +++++++++- .../onepage/customer-checkout.blade.php | 34 ++++---- .../checkout/onepage/customer-info.blade.php | 81 +------------------ 4 files changed, 59 insertions(+), 101 deletions(-) diff --git a/packages/Webkul/Shop/src/Http/Controllers/OnepageController.php b/packages/Webkul/Shop/src/Http/Controllers/OnepageController.php index 5e3fcad25..a77f66752 100755 --- a/packages/Webkul/Shop/src/Http/Controllers/OnepageController.php +++ b/packages/Webkul/Shop/src/Http/Controllers/OnepageController.php @@ -357,8 +357,7 @@ class OnepageController extends Controller public function loginForCheckout() { $this->validate(request(), [ - 'email' => 'required|email', - 'password' => 'required' + 'email' => 'required|email' ]); if (! auth()->guard('customer')->attempt(request(['email', 'password']))) { diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/onepage.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/onepage.blade.php index 62b3bea3b..2cdd1d776 100755 --- a/packages/Webkul/Shop/src/Resources/views/checkout/onepage.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/onepage.blade.php @@ -164,7 +164,9 @@ summeryComponentKey: 0, - reviewComponentKey: 0 + reviewComponentKey: 0, + + is_customer_exist: 0 } }, @@ -229,6 +231,44 @@ }); }, + isCustomerExist: function() { + this.$validator.attach('email', 'required|email'); + + var this_this = this; + + this.$validator.validate('email', this.address.billing.email) + .then(function(isValid) { + if (! isValid) + return; + + this_this.$http.post("{{ route('customer.checkout.exist') }}", {email: this_this.address.billing.email}) + .then(function(response) { + this_this.is_customer_exist = response.data ? 1 : 0; + }) + .catch(function (error) {}) + + }) + }, + + loginCustomer: function() { + var this_this = this; + + this_this.$http.post("{{ route('customer.checkout.login') }}", { + email: this_this.address.billing.email, + password: this_this.address.billing.password + }) + .then(function(response) { + if (response.data.success) { + window.location.href = "{{ route('shop.checkout.onepage.index') }}"; + } else { + window.flashMessages = [{'type': 'alert-error', 'message': response.data.error }]; + + this_this.$root.addFlashMessages() + } + }) + .catch(function (error) {}) + }, + getOrderSummary () { var this_this = this; diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/onepage/customer-checkout.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/onepage/customer-checkout.blade.php index c3ad89f1d..4ad841c6e 100644 --- a/packages/Webkul/Shop/src/Resources/views/checkout/onepage/customer-checkout.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/onepage/customer-checkout.blade.php @@ -1,27 +1,23 @@ -
- +
+
+ - + +
- - @{{ errors.first('address-form.password') }} -
- {{ __('shop::app.checkout.onepage.login-exist-message') }} -
+
+ @endif - - -@push('scripts') - - -@endpush + \ No newline at end of file