From 7a50802144181be2b021e922239bfe58335e5ece Mon Sep 17 00:00:00 2001 From: prateek srivastava Date: Thu, 12 Sep 2019 14:06:38 +0530 Subject: [PATCH 1/6] issue #1442 fixed --- .../Http/Controllers/CustomerController.php | 26 +++++++++++++ .../Controllers/RegistrationController.php | 10 +++++ .../Customer/src/Mail/RegistrationEmail.php | 38 +++++++++++++++++++ packages/Webkul/Shop/src/Http/routes.php | 6 +++ .../customers/account/profile/index.blade.php | 12 ++++++ .../emails/customer/registration.blade.php | 33 ++++++++++++++++ 6 files changed, 125 insertions(+) create mode 100644 packages/Webkul/Customer/src/Mail/RegistrationEmail.php create mode 100644 packages/Webkul/Shop/src/Resources/views/emails/customer/registration.blade.php diff --git a/packages/Webkul/Customer/src/Http/Controllers/CustomerController.php b/packages/Webkul/Customer/src/Http/Controllers/CustomerController.php index 14c36e819..30d407510 100755 --- a/packages/Webkul/Customer/src/Http/Controllers/CustomerController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/CustomerController.php @@ -133,6 +133,32 @@ class CustomerController extends Controller } } + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function destroy($id) + { + $id = auth()->guard('customer')->user()->id; + + $customer = $this->customer->findorFail($id); + + try { + $this->customer->delete($id); + + session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Customer'])); + + return redirect()->route($this->_config['redirect']); + } catch(\Exception $e) { + session()->flash('error', trans('admin::app.response.delete-failed', ['name' => 'Customer'])); + + return redirect()->route($this->_config['redirect']); + } + } + + /** * Load the view for the customer account panel, showing approved reviews. * diff --git a/packages/Webkul/Customer/src/Http/Controllers/RegistrationController.php b/packages/Webkul/Customer/src/Http/Controllers/RegistrationController.php index 53c72926f..d0a0e195b 100755 --- a/packages/Webkul/Customer/src/Http/Controllers/RegistrationController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/RegistrationController.php @@ -6,6 +6,7 @@ use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Mail; +use Webkul\Customer\Mail\RegistrationEmail; use Webkul\Customer\Mail\VerificationEmail; use Illuminate\Routing\Controller; use Webkul\Customer\Repositories\CustomerRepository; @@ -97,6 +98,15 @@ class RegistrationController extends Controller session()->flash('info', trans('shop::app.customer.signup-form.success-verify-email-unsent')); } } else { + try { + Mail::queue(new RegistrationEmail(request()->all())); + + session()->flash('success', trans('shop::app.customer.signup-form.success-verify')); //customer registered successfully + } catch (\Exception $e) { + session()->flash('info', trans('shop::app.customer.signup-form.success-verify-email-unsent')); + } + + session()->flash('success', trans('shop::app.customer.signup-form.success')); } diff --git a/packages/Webkul/Customer/src/Mail/RegistrationEmail.php b/packages/Webkul/Customer/src/Mail/RegistrationEmail.php new file mode 100644 index 000000000..4e59791ee --- /dev/null +++ b/packages/Webkul/Customer/src/Mail/RegistrationEmail.php @@ -0,0 +1,38 @@ +data = $data; + } + + /** + * Build the message. + * + * @return $this + */ + public function build() + { + return $this->to($this->data['email']) + ->from(env('SHOP_MAIL_FROM')) + ->subject('Suucessfully Registered Customer') + ->view('shop::emails.customer.registration')->with('data', $this->data); + } +} \ No newline at end of file diff --git a/packages/Webkul/Shop/src/Http/routes.php b/packages/Webkul/Shop/src/Http/routes.php index 0d13a6783..92104e47c 100755 --- a/packages/Webkul/Shop/src/Http/routes.php +++ b/packages/Webkul/Shop/src/Http/routes.php @@ -210,6 +210,12 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function Route::post('profile/edit', 'Webkul\Customer\Http\Controllers\CustomerController@update')->defaults('_config', [ 'redirect' => 'customer.profile.index' ])->name('customer.profile.edit'); + + //Customer Profile Delete Form Store + Route::post('profile/destroy', 'Webkul\Customer\Http\Controllers\CustomerController@destroy')->defaults('_config', [ + 'redirect' => 'customer.profile.index' + ])->name('customer.profile.destroy'); + /* Profile Routes Ends Here */ /* Routes for Addresses */ diff --git a/packages/Webkul/Shop/src/Resources/views/customers/account/profile/index.blade.php b/packages/Webkul/Shop/src/Resources/views/customers/account/profile/index.blade.php index c6d8730ba..8bf150254 100755 --- a/packages/Webkul/Shop/src/Resources/views/customers/account/profile/index.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/customers/account/profile/index.blade.php @@ -67,6 +67,18 @@ + +
+
+
+ @csrf + +
+
+ +
+
+ {!! view_render_event('bagisto.shop.customers.account.profile.view.after', ['customer' => $customer]) !!} diff --git a/packages/Webkul/Shop/src/Resources/views/emails/customer/registration.blade.php b/packages/Webkul/Shop/src/Resources/views/emails/customer/registration.blade.php new file mode 100644 index 000000000..e4ffad970 --- /dev/null +++ b/packages/Webkul/Shop/src/Resources/views/emails/customer/registration.blade.php @@ -0,0 +1,33 @@ +@component('shop::emails.layouts.master') + +
+
+ + + +
+ +
+ Welcome to Bagisto, +
+ +
+ Hi {{ $data['first_name'] }}, + + Welcome and thank you for registering at Bagisto! + + Your account has now been created successfully and you can login using your email address and password credentials. + + Upon logging in, you will be able to access other services including reviewing past orders, printing invoices and editing your account information. + + Thanks, + Bagisto + +
+ +
+ +
+
+ +@endcomponent \ No newline at end of file From 98792912d88f4d39237c758c6b7f6c2eff026b5d Mon Sep 17 00:00:00 2001 From: prateek srivastava Date: Fri, 13 Sep 2019 12:50:06 +0530 Subject: [PATCH 2/6] translation added --- .../Webkul/Customer/src/Mail/RegistrationEmail.php | 2 +- packages/Webkul/Shop/src/Resources/lang/en/app.php | 1 + .../views/emails/customer/registration.blade.php | 14 +++++--------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/Webkul/Customer/src/Mail/RegistrationEmail.php b/packages/Webkul/Customer/src/Mail/RegistrationEmail.php index 4e59791ee..c09cabbf8 100644 --- a/packages/Webkul/Customer/src/Mail/RegistrationEmail.php +++ b/packages/Webkul/Customer/src/Mail/RegistrationEmail.php @@ -32,7 +32,7 @@ class RegistrationEmail extends Mailable { return $this->to($this->data['email']) ->from(env('SHOP_MAIL_FROM')) - ->subject('Suucessfully Registered Customer') + ->subject(trans('shop::app.customer.signup-form.customer-registration')) ->view('shop::emails.customer.registration')->with('data', $this->data); } } \ No newline at end of file diff --git a/packages/Webkul/Shop/src/Resources/lang/en/app.php b/packages/Webkul/Shop/src/Resources/lang/en/app.php index d496a6826..aa634256b 100755 --- a/packages/Webkul/Shop/src/Resources/lang/en/app.php +++ b/packages/Webkul/Shop/src/Resources/lang/en/app.php @@ -117,6 +117,7 @@ return [ 'verified' => 'Your Account Has Been Verified, Try To Login Now', 'verify-failed' => 'We Cannot Verify Your Mail Account', 'dont-have-account' => 'You Do Not Have Account With Us', + 'customer-registration' => 'Customer Registered Successfully' ], 'login-text' => [ diff --git a/packages/Webkul/Shop/src/Resources/views/emails/customer/registration.blade.php b/packages/Webkul/Shop/src/Resources/views/emails/customer/registration.blade.php index e4ffad970..05b15548b 100644 --- a/packages/Webkul/Shop/src/Resources/views/emails/customer/registration.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/emails/customer/registration.blade.php @@ -7,20 +7,16 @@ -
- Welcome to Bagisto, -
-
- Hi {{ $data['first_name'] }}, + Hi {{ $data['first_name'] }},

- Welcome and thank you for registering at Bagisto! + Welcome and thank you for registering at Bagisto!

- Your account has now been created successfully and you can login using your email address and password credentials. + Your account has now been created successfully and you can login using your email address and password credentials.
- Upon logging in, you will be able to access other services including reviewing past orders, printing invoices and editing your account information. + Upon logging in, you will be able to access other services including reviewing past orders, wishlists and editing your account information.

- Thanks, + Thanks,
Bagisto
From f4f5dd3b08aedef8b75908faad1bbe1924d6c988 Mon Sep 17 00:00:00 2001 From: prateek srivastava Date: Fri, 13 Sep 2019 15:41:38 +0530 Subject: [PATCH 3/6] translation added --- .../src/Mail/NewCustomerNotification.php | 2 +- .../Customer/src/Mail/RegistrationEmail.php | 2 +- .../Customer/src/Mail/VerificationEmail.php | 2 +- .../Shop/src/Mail/SubscriptionEmail.php | 2 +- .../Webkul/Shop/src/Resources/lang/en/app.php | 35 ++++++++++++++++++- .../emails/customer/new-customer.blade.php | 16 ++++++--- .../emails/customer/registration.blade.php | 27 +++++++------- .../customer/subscription-email.blade.php | 10 +++--- .../customer/verification-email.blade.php | 9 ++--- 9 files changed, 75 insertions(+), 30 deletions(-) diff --git a/packages/Webkul/Admin/src/Mail/NewCustomerNotification.php b/packages/Webkul/Admin/src/Mail/NewCustomerNotification.php index b4e47718d..4af9308e6 100644 --- a/packages/Webkul/Admin/src/Mail/NewCustomerNotification.php +++ b/packages/Webkul/Admin/src/Mail/NewCustomerNotification.php @@ -51,7 +51,7 @@ class NewCustomerNotification extends Mailable public function build() { return $this->to($this->customer->email) - ->subject(trans('shop::app.mail.customer.subject')) + ->subject(trans('shop::app.mail.customer.new.subject')) ->view('shop::emails.customer.new-customer')->with(['customer' => $this->customer, 'password' => $this->password]); } } \ No newline at end of file diff --git a/packages/Webkul/Customer/src/Mail/RegistrationEmail.php b/packages/Webkul/Customer/src/Mail/RegistrationEmail.php index c09cabbf8..ffd045e90 100644 --- a/packages/Webkul/Customer/src/Mail/RegistrationEmail.php +++ b/packages/Webkul/Customer/src/Mail/RegistrationEmail.php @@ -32,7 +32,7 @@ class RegistrationEmail extends Mailable { return $this->to($this->data['email']) ->from(env('SHOP_MAIL_FROM')) - ->subject(trans('shop::app.customer.signup-form.customer-registration')) + ->subject(trans('shop::app.mail.customer.registration.customer-registration')) ->view('shop::emails.customer.registration')->with('data', $this->data); } } \ No newline at end of file diff --git a/packages/Webkul/Customer/src/Mail/VerificationEmail.php b/packages/Webkul/Customer/src/Mail/VerificationEmail.php index 41fa0bc31..73c4b6f30 100755 --- a/packages/Webkul/Customer/src/Mail/VerificationEmail.php +++ b/packages/Webkul/Customer/src/Mail/VerificationEmail.php @@ -32,7 +32,7 @@ class VerificationEmail extends Mailable { return $this->to($this->verificationData['email']) ->from(env('SHOP_MAIL_FROM')) - ->subject('Verification email') + ->subject(trans('shop::app.mail.customer.verification.subject')) ->view('shop::emails.customer.verification-email')->with('data', ['email' => $this->verificationData['email'], 'token' => $this->verificationData['token']]); } } \ No newline at end of file diff --git a/packages/Webkul/Shop/src/Mail/SubscriptionEmail.php b/packages/Webkul/Shop/src/Mail/SubscriptionEmail.php index 2acf41474..96ba6a3e3 100755 --- a/packages/Webkul/Shop/src/Mail/SubscriptionEmail.php +++ b/packages/Webkul/Shop/src/Mail/SubscriptionEmail.php @@ -32,7 +32,7 @@ class SubscriptionEmail extends Mailable { return $this->to($this->subscriptionData['email']) ->from(env('SHOP_MAIL_FROM')) - ->subject('subscription email') + ->subject(trans('shop::app.mail.customer.subscription.subject')) ->view('shop::emails.customer.subscription-email')->with('data', ['content' => 'You Are Subscribed', 'token' => $this->subscriptionData['token']]); } } \ No newline at end of file diff --git a/packages/Webkul/Shop/src/Resources/lang/en/app.php b/packages/Webkul/Shop/src/Resources/lang/en/app.php index aa634256b..ed4e720aa 100755 --- a/packages/Webkul/Shop/src/Resources/lang/en/app.php +++ b/packages/Webkul/Shop/src/Resources/lang/en/app.php @@ -544,7 +544,40 @@ return [ 'thanks' => 'Thanks!' ], 'customer' => [ - 'subject' => 'New Customer Registration' + 'new' => [ + 'dear' => 'Dear :customer_name', + 'username-email' => 'UserName/Email', + 'subject' => 'New Customer Registration', + 'password' => 'Password', + 'summary' => 'Your account has been created in bagisto. + Your account details are below: ', + 'thanks' => 'Thanks!', + ], + + 'registration' => [ + 'subject' => 'New Customer Registration', + 'customer-registration' => 'Customer Registered Successfully', + 'dear' => 'Dear :customer_name', + 'greeting' => 'Welcome and thank you for registering at Bagisto!', + 'summary' => 'Your account has now been created successfully and you can login using your email address and password credentials. Upon logging in, you will be able to access other services including reviewing past orders, wishlists and editing your account information.', + 'thanks' => 'Thanks!', + ], + + 'verification' => [ + 'heading' => 'Bagisto - Email Verification', + 'subject' => 'Verification Mail', + 'verify' => 'Verify Your Account', + 'summary' => 'This is the mail to verify that the email address you entered is yours. + Kindly click the Verify Your Account button below to verify your account.' + ], + + 'subscription' => [ + 'subject' => 'Subscription Email', + 'greeting' => ' Welcome to Bagisto - Email Subscription', + 'unsubscribe' => 'Unsubscribe', + 'summary' => 'Thanks for putting me into your inbox. It’s been a while since you’ve read Bagisto email, and we don’t want to overwhelm your inbox. If you still do not want to receive + the latest email marketing news then for sure click the button below.' + ] ] ], diff --git a/packages/Webkul/Shop/src/Resources/views/emails/customer/new-customer.blade.php b/packages/Webkul/Shop/src/Resources/views/emails/customer/new-customer.blade.php index 3352a37a0..d5c486eca 100644 --- a/packages/Webkul/Shop/src/Resources/views/emails/customer/new-customer.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/emails/customer/new-customer.blade.php @@ -8,15 +8,23 @@
- Hi {{ $customer['name'] }}, your new account has been created in bagisto. - Your account details are below + {{ __('shop::app.mail.customer.new.dear', ['customer_name' => $customer['name']]) }}, +
- UserName/Email - {{ $customer['email'] }}
- Password - {{ $password}} + {!! __('shop::app.mail.customer.new.summary') !!} +
+
+ {!! __('shop::app.mail.customer.new.username-email') !!} - {{ $customer['email'] }}
+ {!! __('shop::app.mail.customer.new.password') !!} - {{ $password}} +
+ +

+ {{ __('shop::app.mail.customer.new.thanks') }} +

@endcomponent \ No newline at end of file diff --git a/packages/Webkul/Shop/src/Resources/views/emails/customer/registration.blade.php b/packages/Webkul/Shop/src/Resources/views/emails/customer/registration.blade.php index 05b15548b..1e5a67c30 100644 --- a/packages/Webkul/Shop/src/Resources/views/emails/customer/registration.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/emails/customer/registration.blade.php @@ -7,22 +7,25 @@ -
- Hi {{ $data['first_name'] }},

- Welcome and thank you for registering at Bagisto!

+
+
+

+ {{ __('shop::app.mail.customer.registration.dear', ['customer_name' => $data['first_name']. ' ' .$data['last_name']]) }}, +

- Your account has now been created successfully and you can login using your email address and password credentials.
+

+ {!! __('shop::app.mail.customer.registration.greeting') !!} +

+
- Upon logging in, you will be able to access other services including reviewing past orders, wishlists and editing your account information.

- - Thanks,
- Bagisto - -
- -
+
+ {{ __('shop::app.mail.customer.registration.summary') }} +
+

+ {{ __('shop::app.mail.customer.registration.thanks') }} +

diff --git a/packages/Webkul/Shop/src/Resources/views/emails/customer/subscription-email.blade.php b/packages/Webkul/Shop/src/Resources/views/emails/customer/subscription-email.blade.php index 7d4555b75..f80625e4f 100755 --- a/packages/Webkul/Shop/src/Resources/views/emails/customer/subscription-email.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/emails/customer/subscription-email.blade.php @@ -8,18 +8,18 @@
- Welcome to Bagisto - Email Subscription + {!! __('shop::app.mail.customer.subscription.greeting') !!}
- Thanks for putting me into your inbox. It’s been a while since you’ve read Bagisto - email, and we don’t want to overwhelm your inbox. If you still do not want to receive - the latest email marketing news then for sure click the button below. + {!! __('shop::app.mail.customer.subscription.summary') !!}
Unsubscribe + color: #FFFFFF; text-align: center; background: #0031F0; padding: 10px 100px;text-decoration: none;"> + {!! __('shop::app.mail.customer.subscription.unsubscribe') !!} +
diff --git a/packages/Webkul/Shop/src/Resources/views/emails/customer/verification-email.blade.php b/packages/Webkul/Shop/src/Resources/views/emails/customer/verification-email.blade.php index 762f81bc1..75edcfb19 100755 --- a/packages/Webkul/Shop/src/Resources/views/emails/customer/verification-email.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/emails/customer/verification-email.blade.php @@ -8,17 +8,18 @@
- Bagisto - Email Verification + {!! __('shop::app.mail.customer.verification.heading') !!}
- This is the mail to verify that the email address you entered is yours. - Kindly click the 'Verify Your Account' button below to verify your account. + {!! __('shop::app.mail.customer.verification.summary') !!}
Verify Your Account + color: #FFFFFF; text-align: center; background: #0031F0; padding: 10px 100px;text-decoration: none;"> + {!! __('shop::app.mail.customer.verification.verify') !!} +
From 00b83b1398da35f154ebed23c8ac56cdaa8128f1 Mon Sep 17 00:00:00 2001 From: rahul shukla Date: Fri, 13 Sep 2019 15:54:05 +0530 Subject: [PATCH 4/6] change defualt payment method & oderder number in customer invoice --- packages/Webkul/Payment/src/Config/paymentmethods.php | 4 ++-- .../Resources/views/customers/account/orders/pdf.blade.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/Webkul/Payment/src/Config/paymentmethods.php b/packages/Webkul/Payment/src/Config/paymentmethods.php index ec7ec7e56..0d78373ed 100755 --- a/packages/Webkul/Payment/src/Config/paymentmethods.php +++ b/packages/Webkul/Payment/src/Config/paymentmethods.php @@ -7,7 +7,7 @@ return [ 'class' => 'Webkul\Payment\Payment\CashOnDelivery', 'active' => true, 'sort' => 1, - 'default' => 'no' + 'default' => 'yes' ], 'moneytransfer' => [ @@ -17,7 +17,7 @@ return [ 'class' => 'Webkul\Payment\Payment\MoneyTransfer', 'active' => true, 'sort' => 2, - 'default' => 'yes' + 'default' => 'no' ], 'paypal_standard' => [ diff --git a/packages/Webkul/Shop/src/Resources/views/customers/account/orders/pdf.blade.php b/packages/Webkul/Shop/src/Resources/views/customers/account/orders/pdf.blade.php index a3871d349..409d3ef94 100755 --- a/packages/Webkul/Shop/src/Resources/views/customers/account/orders/pdf.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/customers/account/orders/pdf.blade.php @@ -92,7 +92,7 @@
{{ __('shop::app.customer.account.order.view.order-id') }} - - #{{ $invoice->order_id }} + #{{ $invoice->order->increment_id }}
From 53030b2a21f8d708059e24086d27ca7d7b737646 Mon Sep 17 00:00:00 2001 From: rahul shukla Date: Fri, 13 Sep 2019 17:02:46 +0530 Subject: [PATCH 5/6] conditon added for checkout back button --- .../checkout/onepage/customer-info.blade.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/onepage/customer-info.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/onepage/customer-info.blade.php index 87041cc53..1d6a198c3 100755 --- a/packages/Webkul/Shop/src/Resources/views/checkout/onepage/customer-info.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/onepage/customer-info.blade.php @@ -71,9 +71,11 @@ @endguest @auth('customer') - - {{ __('shop::app.checkout.onepage.back') }} - + @if(count(auth('customer')->user()->addresses)) + + {{ __('shop::app.checkout.onepage.back') }} + + @endif @endauth
@@ -293,9 +295,11 @@

{{ __('shop::app.checkout.onepage.shipping-address') }}

@auth('customer') - - {{ __('shop::app.checkout.onepage.back') }} - + @if(count(auth('customer')->user()->addresses)) + + {{ __('shop::app.checkout.onepage.back') }} + + @endif @endauth From 3d03bc099c867c59bef9735f4565340645dd43ac Mon Sep 17 00:00:00 2001 From: CodeInnovers Date: Sun, 15 Sep 2019 23:33:35 +0530 Subject: [PATCH 6/6] fixed issue #1460 --- .../Webkul/Core/src/Http/Controllers/SubscriptionController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/Webkul/Core/src/Http/Controllers/SubscriptionController.php b/packages/Webkul/Core/src/Http/Controllers/SubscriptionController.php index 74cd058a3..b6ca92773 100755 --- a/packages/Webkul/Core/src/Http/Controllers/SubscriptionController.php +++ b/packages/Webkul/Core/src/Http/Controllers/SubscriptionController.php @@ -91,7 +91,7 @@ class SubscriptionController extends Controller $subscriber = $this->subscribers->findOrFail($id); try { - $this->subscriber->delete($id); + $this->subscribers->delete($id); session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Subscriber']));