Merge pull request #1448 from prateek-webkul/master

Issue #1442 fixed
This commit is contained in:
Jitendra Singh 2019-09-16 10:19:58 +05:30 committed by GitHub
commit 58306e3252
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 184 additions and 17 deletions

View File

@ -51,7 +51,7 @@ class NewCustomerNotification extends Mailable
public function build() public function build()
{ {
return $this->to($this->customer->email) 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]); ->view('shop::emails.customer.new-customer')->with(['customer' => $this->customer, 'password' => $this->password]);
} }
} }

View File

@ -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. * Load the view for the customer account panel, showing approved reviews.
* *

View File

@ -6,6 +6,7 @@ use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
use Webkul\Customer\Mail\RegistrationEmail;
use Webkul\Customer\Mail\VerificationEmail; use Webkul\Customer\Mail\VerificationEmail;
use Illuminate\Routing\Controller; use Illuminate\Routing\Controller;
use Webkul\Customer\Repositories\CustomerRepository; 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')); session()->flash('info', trans('shop::app.customer.signup-form.success-verify-email-unsent'));
} }
} else { } 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')); session()->flash('success', trans('shop::app.customer.signup-form.success'));
} }

View File

@ -0,0 +1,38 @@
<?php
namespace Webkul\Customer\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
/**
* Registration Mail class
*
* @author Prateek Srivastava
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class RegistrationEmail extends Mailable
{
use Queueable, SerializesModels;
public $data;
public function __construct($data) {
$this->data = $data;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->to($this->data['email'])
->from(env('SHOP_MAIL_FROM'))
->subject(trans('shop::app.mail.customer.registration.customer-registration'))
->view('shop::emails.customer.registration')->with('data', $this->data);
}
}

View File

@ -32,7 +32,7 @@ class VerificationEmail extends Mailable
{ {
return $this->to($this->verificationData['email']) return $this->to($this->verificationData['email'])
->from(env('SHOP_MAIL_FROM')) ->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']]); ->view('shop::emails.customer.verification-email')->with('data', ['email' => $this->verificationData['email'], 'token' => $this->verificationData['token']]);
} }
} }

View File

@ -210,6 +210,12 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
Route::post('profile/edit', 'Webkul\Customer\Http\Controllers\CustomerController@update')->defaults('_config', [ Route::post('profile/edit', 'Webkul\Customer\Http\Controllers\CustomerController@update')->defaults('_config', [
'redirect' => 'customer.profile.index' 'redirect' => 'customer.profile.index'
])->name('customer.profile.edit'); ])->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 */ /* Profile Routes Ends Here */
/* Routes for Addresses */ /* Routes for Addresses */

View File

@ -32,7 +32,7 @@ class SubscriptionEmail extends Mailable
{ {
return $this->to($this->subscriptionData['email']) return $this->to($this->subscriptionData['email'])
->from(env('SHOP_MAIL_FROM')) ->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']]); ->view('shop::emails.customer.subscription-email')->with('data', ['content' => 'You Are Subscribed', 'token' => $this->subscriptionData['token']]);
} }
} }

View File

@ -117,6 +117,7 @@ return [
'verified' => 'Your Account Has Been Verified, Try To Login Now', 'verified' => 'Your Account Has Been Verified, Try To Login Now',
'verify-failed' => 'We Cannot Verify Your Mail Account', 'verify-failed' => 'We Cannot Verify Your Mail Account',
'dont-have-account' => 'You Do Not Have Account With Us', 'dont-have-account' => 'You Do Not Have Account With Us',
'customer-registration' => 'Customer Registered Successfully'
], ],
'login-text' => [ 'login-text' => [
@ -543,7 +544,40 @@ return [
'thanks' => 'Thanks!' 'thanks' => 'Thanks!'
], ],
'customer' => [ '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. Its been a while since youve read Bagisto email, and we dont 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.'
]
] ]
], ],

View File

@ -67,6 +67,18 @@
</table> </table>
</div> </div>
<accordian :title="'{{ __('shop::app.customer.account.profile.index.title') }}'" :active="true">
<div slot="body">
<div class="page-action">
<form method="POST" action="{{ route('customer.profile.destroy') }}">
@csrf
<input type="submit" class="btn btn-lg btn-primary mt-10" value="Delete">
</form>
</div>
</div>
</accordian>
{!! view_render_event('bagisto.shop.customers.account.profile.view.after', ['customer' => $customer]) !!} {!! view_render_event('bagisto.shop.customers.account.profile.view.after', ['customer' => $customer]) !!}
</div> </div>
</div> </div>

View File

@ -8,15 +8,23 @@
</div> </div>
<div style="font-size:16px; color:#242424; font-weight:600; margin-top: 60px; margin-bottom: 15px"> <div style="font-size:16px; color:#242424; font-weight:600; margin-top: 60px; margin-bottom: 15px">
Hi {{ $customer['name'] }}, your new account has been created in bagisto. {{ __('shop::app.mail.customer.new.dear', ['customer_name' => $customer['name']]) }},
Your account details are below
</div> </div>
<div> <div>
<b>UserName/Email</b> - {{ $customer['email'] }} <br> {!! __('shop::app.mail.customer.new.summary') !!}
<b>Password</b> - {{ $password}}
</div> </div>
<div>
<b> {!! __('shop::app.mail.customer.new.username-email') !!} </b> - {{ $customer['email'] }} <br>
<b> {!! __('shop::app.mail.customer.new.password') !!} </b> - {{ $password}}
</div>
<p style="font-size: 16px;color: #5E5E5E;line-height: 24px;">
{{ __('shop::app.mail.customer.new.thanks') }}
</p>
</div> </div>
@endcomponent @endcomponent

View File

@ -0,0 +1,32 @@
@component('shop::emails.layouts.master')
<div>
<div style="text-align: center;">
<a href="{{ config('app.url') }}">
<img src="{{ bagisto_asset('images/logo.svg') }}">
</a>
</div>
<div style="padding: 30px;">
<div style="font-size: 20px;color: #242424;line-height: 30px;margin-bottom: 34px;">
<p style="font-weight: bold;font-size: 20px;color: #242424;line-height: 24px;">
{{ __('shop::app.mail.customer.registration.dear', ['customer_name' => $data['first_name']. ' ' .$data['last_name']]) }},
</p>
<p style="font-size: 16px;color: #5E5E5E;line-height: 24px;">
{!! __('shop::app.mail.customer.registration.greeting') !!}
</p>
</div>
<div style="font-size: 16px;color: #5E5E5E;line-height: 30px;margin-bottom: 20px !important;">
{{ __('shop::app.mail.customer.registration.summary') }}
</div>
<p style="font-size: 16px;color: #5E5E5E;line-height: 24px;">
{{ __('shop::app.mail.customer.registration.thanks') }}
</p>
</div>
</div>
@endcomponent

View File

@ -8,18 +8,18 @@
</div> </div>
<div style="font-size:16px; color:#242424; font-weight:600; margin-top: 60px; margin-bottom: 15px"> <div style="font-size:16px; color:#242424; font-weight:600; margin-top: 60px; margin-bottom: 15px">
Welcome to Bagisto - Email Subscription {!! __('shop::app.mail.customer.subscription.greeting') !!}
</div> </div>
<div> <div>
Thanks for putting me into your inbox. Its been a while since youve read Bagisto {!! __('shop::app.mail.customer.subscription.summary') !!}
email, and we dont 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.
</div> </div>
<div style="margin-top: 40px; text-align: center"> <div style="margin-top: 40px; text-align: center">
<a href="{{ route('shop.unsubscribe', $data['token']) }}" style="font-size: 16px; <a href="{{ route('shop.unsubscribe', $data['token']) }}" style="font-size: 16px;
color: #FFFFFF; text-align: center; background: #0031F0; padding: 10px 100px;text-decoration: none;">Unsubscribe</a> color: #FFFFFF; text-align: center; background: #0031F0; padding: 10px 100px;text-decoration: none;">
{!! __('shop::app.mail.customer.subscription.unsubscribe') !!}
</a>
</div> </div>
</div> </div>

View File

@ -8,17 +8,18 @@
</div> </div>
<div style="font-size:16px; color:#242424; font-weight:600; margin-top: 60px; margin-bottom: 15px"> <div style="font-size:16px; color:#242424; font-weight:600; margin-top: 60px; margin-bottom: 15px">
Bagisto - Email Verification {!! __('shop::app.mail.customer.verification.heading') !!}
</div> </div>
<div> <div>
This is the mail to verify that the email address you entered is yours. {!! __('shop::app.mail.customer.verification.summary') !!}
Kindly click the 'Verify Your Account' button below to verify your account.
</div> </div>
<div style="margin-top: 40px; text-align: center"> <div style="margin-top: 40px; text-align: center">
<a href="{{ route('customer.verify', $data['token']) }}" style="font-size: 16px; <a href="{{ route('customer.verify', $data['token']) }}" style="font-size: 16px;
color: #FFFFFF; text-align: center; background: #0031F0; padding: 10px 100px;text-decoration: none;">Verify Your Account</a> color: #FFFFFF; text-align: center; background: #0031F0; padding: 10px 100px;text-decoration: none;">
{!! __('shop::app.mail.customer.verification.verify') !!}
</a>
</div> </div>
</div> </div>