From 60853a851020c6aa59d2f75ede9f4879727060bb Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 14 Aug 2019 07:41:02 +1000 Subject: [PATCH] Edit client information --- app/Exceptions/Handler.php | 6 +- .../ClientPortal/ProfileController.php | 9 +- .../profile/client_information.blade.php | 34 ++++++ .../portal/default/profile/index.blade.php | 2 + .../portal/default/settings/index.blade.php | 110 ------------------ routes/client.php | 3 +- 6 files changed, 42 insertions(+), 122 deletions(-) create mode 100644 resources/views/portal/default/profile/client_information.blade.php delete mode 100644 resources/views/portal/default/settings/index.blade.php diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 853049d205..be8e38075c 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -77,16 +77,16 @@ class Handler extends ExceptionHandler { return response()->json(['message'=>'Fatal error', 500]); } -/* else if ($exception instanceof \Illuminate\Session\TokenMismatchException) + else if ($exception instanceof \Illuminate\Session\TokenMismatchException) { return redirect() ->back() - ->withInput($request->except('password')) + ->withInput($request->except('password', 'password_confirmation', '_token')) ->with([ 'message' => ctrans('texts.token_expired'), 'message-type' => 'danger']); } -*/ + return parent::render($request, $exception); } diff --git a/app/Http/Controllers/ClientPortal/ProfileController.php b/app/Http/Controllers/ClientPortal/ProfileController.php index 2f2cb45bc5..82625f0887 100644 --- a/app/Http/Controllers/ClientPortal/ProfileController.php +++ b/app/Http/Controllers/ClientPortal/ProfileController.php @@ -90,14 +90,9 @@ class ProfileController extends Controller return back(); } - public function settings() + public function updateClient(UpdateSettingsRequest $request, ClientContact $client_contact) { - return view('portal.default.settings.index'); - } - - public function updateSettings(UpdateSettingsRequest $request) - { - +dd("hi"); return back(); } } diff --git a/resources/views/portal/default/profile/client_information.blade.php b/resources/views/portal/default/profile/client_information.blade.php new file mode 100644 index 0000000000..7ae6adb0b7 --- /dev/null +++ b/resources/views/portal/default/profile/client_information.blade.php @@ -0,0 +1,34 @@ +
+ +
+ + {!! Former::framework('TwitterBootstrap4'); !!} + + {!! Former::horizontal_open() + ->id('update_settings') + ->route('client.profile.update_settings', auth()->user()->hashed_id) + ->method('PUT'); !!} + + @csrf + +
+ +
+ {{ ctrans('texts.client_information') }} +
+ +
+
+ + + + {!! Former::close() !!} + +
+ + + \ No newline at end of file diff --git a/resources/views/portal/default/profile/index.blade.php b/resources/views/portal/default/profile/index.blade.php index 8812b033b7..039bc70450 100644 --- a/resources/views/portal/default/profile/index.blade.php +++ b/resources/views/portal/default/profile/index.blade.php @@ -100,6 +100,8 @@
+ @include('portal.default.profile.client_information') +
diff --git a/resources/views/portal/default/settings/index.blade.php b/resources/views/portal/default/settings/index.blade.php deleted file mode 100644 index 727d27b597..0000000000 --- a/resources/views/portal/default/settings/index.blade.php +++ /dev/null @@ -1,110 +0,0 @@ -@extends('portal.default.layouts.master') -@push('css') - - - -@endpush -@section('body') -
- -
-
- - @if (Session::has('error')) -
{!! Session::get('error') !!}
- @endif -
- - {!! Former::framework('TwitterBootstrap4'); !!} - - {!! Former::horizontal_open() - ->id('update_settings') - ->route('client.profile.update_settings', auth()->user()->hashed_id) - ->method('PUT'); !!} - - @csrf - -
- -
- - {{ ctrans('texts.avatar') }} - -
- -
- - @if(auth()->user()->avatar) - - @else - - @endif - - {!! Former::file('avatar') - ->max(2, 'MB') - ->accept('image') - ->label('') - ->inlineHelp(trans('texts.logo_help')) !!} - -
- - - -
- -
- -
- -
- -
- - {{ ctrans('texts.user_details') }} - -
- -
- - {!! Former::text('first_name')->placeholder( ctrans('texts.first_name'))->label('')->value(auth()->user()->first_name)!!} - - {!! Former::text('last_name')->placeholder( ctrans('texts.last_name'))->label('')->value(auth()->user()->last_name) !!} - - {!! Former::text('email')->placeholder( ctrans('texts.email'))->label('')->value(auth()->user()->email) !!} - - {!! Former::text('phone')->placeholder( ctrans('texts.phone'))->label('')->value(auth()->user()->phone) !!} - - {!! Former::password('password')->placeholder( ctrans('texts.password'))->label('') !!} - - {!! Former::password('password_confirmation')->placeholder( ctrans('texts.confirm_password'))->label('') !!} - -
- - - -
- - {!! Former::close() !!} - -
- -
- -
- -
- - -@endsection \ No newline at end of file diff --git a/routes/client.php b/routes/client.php index ecda7d6cfe..fd6d24ece2 100644 --- a/routes/client.php +++ b/routes/client.php @@ -18,8 +18,7 @@ Route::group(['middleware' => ['auth:contact'], 'prefix' => 'client', 'as' => 'c Route::get('invoices', 'ClientPortal\InvoiceController@index')->name('invoices.index'); // name = (dashboard. index / create / show / update / destroy / edit Route::get('profile/{client_contact}/edit', 'ClientPortal\ProfileController@edit')->name('profile.edit'); Route::put('profile/{client_contact}/edit', 'ClientPortal\ProfileController@update')->name('profile.update'); - Route::get('profile/{client_contact}/settings', 'ClientPortal\ProfileController@settings')->name('profile.settings'); - Route::put('profile/{client_contact}/settings', 'ClientPortal\ProfileController@updateSettings')->name('profile.update_settings'); + Route::put('profile/{client_contact}/edit_client', 'ClientPortal\ProfileController@updateClient')->name('profile.edit_client'); Route::post('document', 'ClientPortal\DocumentController@store')->name('document.store'); Route::delete('document', 'ClientPortal\DocumentController@destroy')->name('document.destroy');