From 770bb9340f4e105e2f5b65f421a11e73505fbce8 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Wed, 10 Aug 2022 23:58:18 +0800 Subject: [PATCH] 1688 landing page --- .../ControllersLogic/CreateCustomerLogic.php | 13 ++++++++- .../forms/RegistrationFormComponent.vue | 11 +++++++- resources/assets/vue/general/mixins/guards.js | 4 +-- resources/views/pages/landing_page.blade.php | 28 +++++++++++++++++++ routes/web.php | 4 +++ 5 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 resources/views/pages/landing_page.blade.php diff --git a/app/Classes/Modules/Accounts/ControllersLogic/CreateCustomerLogic.php b/app/Classes/Modules/Accounts/ControllersLogic/CreateCustomerLogic.php index 2c732126..5f01daae 100644 --- a/app/Classes/Modules/Accounts/ControllersLogic/CreateCustomerLogic.php +++ b/app/Classes/Modules/Accounts/ControllersLogic/CreateCustomerLogic.php @@ -56,6 +56,9 @@ class CreateCustomerLogic extends AbstractControllerLogic /** @var GenerateEmailVerificationAttemptProcessor */ private $generateEmailVerificationAttemptProcessor; + /** @var AssignSegmentProcessor */ + private $assignCompanyToSegmentProcessor; + /** * CreateCustomerLogic constructor. * @param CreateUserProcessor $createUserProcessor @@ -65,8 +68,9 @@ class CreateCustomerLogic extends AbstractControllerLogic * @param AssignSegmentProcessor $assignSegmentProcessor * @param AuthenticationProcessor $authenticationProcessor * @param GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor + * @param AssignSegmentProcessor $assignCompanyToSegmentProcessor */ - public function __construct(CreateUserProcessor $createUserProcessor, CreateCompanyProcessor $createCompanyProcessor, CreateContactProcessor $createContactProcessor, AssignEmployeeProcessor $assignEmployeeProcessor, AssignSegmentProcessor $assignSegmentProcessor, AuthenticationProcessor $authenticationProcessor, GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor) + public function __construct(CreateUserProcessor $createUserProcessor, CreateCompanyProcessor $createCompanyProcessor, CreateContactProcessor $createContactProcessor, AssignEmployeeProcessor $assignEmployeeProcessor, AssignSegmentProcessor $assignSegmentProcessor, AuthenticationProcessor $authenticationProcessor, GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor, AssignSegmentProcessor $assignCompanyToSegmentProcessor) { $this->createUserProcessor = $createUserProcessor; $this->createCompanyProcessor = $createCompanyProcessor; @@ -75,6 +79,7 @@ class CreateCustomerLogic extends AbstractControllerLogic $this->assignSegmentProcessor = $assignSegmentProcessor; $this->authenticationProcessor = $authenticationProcessor; $this->generateEmailVerificationAttemptProcessor = $generateEmailVerificationAttemptProcessor; + $this->assignCompanyToSegmentProcessor = $assignCompanyToSegmentProcessor; } /** @@ -94,6 +99,12 @@ class CreateCustomerLogic extends AbstractControllerLogic /** @var Company $company */ $company = $this->createCompanyProcessor->execute($request, BusinessType::IMPORTER, $request->input('type') === CompanyType::COMPANY_BUSINESS ? CompanyType::COMPANY_BUSINESS : CompanyType::PERSONAL_BUSINESS, ApprovalStatus::PENDING_SUBMISSION); + if ($request->input('label')) { + foreach (json_decode($request->input('label')) as $label) { + $this->assignCompanyToSegmentProcessor->execute($company, $label); + } + } + $this->createContactProcessor->execute($request, $company); $Object = new EmploymentObject($company, $user); diff --git a/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue b/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue index 9f49275e..07bb9476 100644 --- a/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue +++ b/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue @@ -182,6 +182,7 @@ phone: '', password: '', password_confirmation: '', + label: '', } } }, @@ -204,7 +205,15 @@ }, submitForm(){ - this.step === 2 ? this.submit(this.route('api.account.registration.register'), 'post', 'registrationSection', false, false) : this.changeStep('next'); + // this.step === 2 ? this.submit(this.route('api.account.registration.register'), 'post', 'registrationSection', false, false) : this.changeStep('next'); + + if (this.step === 2) { + const params = new URLSearchParams(window.location.search) + this.parameters.label = params.get('label'); + this.submit(this.route('api.account.registration.register'), 'post', 'registrationSection', false, false); + } else { + this.changeStep('next'); + } } }, mixins: [registrationFormValidation] diff --git a/resources/assets/vue/general/mixins/guards.js b/resources/assets/vue/general/mixins/guards.js index 3e5aaea5..568ceae1 100644 --- a/resources/assets/vue/general/mixins/guards.js +++ b/resources/assets/vue/general/mixins/guards.js @@ -5,8 +5,8 @@ export default { (this.$store.getters.isAuthenticated && !this.isProtectedRoute()&& !this.isWithTokenRoute()) ? window.location.href = this.route('dashboard') : ''; }, isProtectedRoute(){ - const unprotectedRoutes = [this.route('login'), this.route('signup'), this.route('account.email.verification')]; - return !unprotectedRoutes.includes(window.location.href); + const unprotectedRoutes = [this.route('login'), this.route('signup'), this.route('account.email.verification'), this.route('landing_page')]; + return !unprotectedRoutes.includes(window.location.href.split('?')[0]); }, isWithTokenRoute(){ return window.location.href.includes(this.route('account.password.reset')); diff --git a/resources/views/pages/landing_page.blade.php b/resources/views/pages/landing_page.blade.php new file mode 100644 index 00000000..2abc242d --- /dev/null +++ b/resources/views/pages/landing_page.blade.php @@ -0,0 +1,28 @@ +@extends('layouts.base_login') + +@section('inner_content') + +
+
+
+
+
+
+

Landing template for startups

+

Our landing page template works on all devices, so you only have to set it up once, and get beautiful results forever.

+ Sign Up Now +
+
+
+
+
+ +
+
+
+
+
+
+
+
+@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 8bdf45f7..b21694ae 100644 --- a/routes/web.php +++ b/routes/web.php @@ -36,6 +36,10 @@ Route::get('/signup', function () { return view('pages.accounts.sign_up'); })->name('signup'); +Route::get('/landing-page', function () { + return view('pages.landing_page'); +})->name('landing_page'); + Route::get('/account/email/verification/{token}', function ($token) { return view('pages.accounts.email_verified', ['token' => $token]); })->name('account.email.verification');