diff --git a/app/Http/Controllers/VendorPortal/VendorContactController.php b/app/Http/Controllers/VendorPortal/VendorContactController.php new file mode 100644 index 000000000000..7aa93db123e0 --- /dev/null +++ b/app/Http/Controllers/VendorPortal/VendorContactController.php @@ -0,0 +1,81 @@ +render('vendor_profile.edit', [ + 'contact' => $vendor_contact, + 'vendor' => $vendor_contact->vendor, + 'settings' => $vendor_contact->vendor->company->settings, + 'company' => $vendor_contact->vendor->company, + 'sidebar' => $this->sidebarMenu(), + 'countries' => TranslationHelper::getCountries() + ]); + } + + public function update(VendorContact $vendor_contact) + { + $vendor_contact->fill(request()->all()); + $vendor_contact->vendor->fill(request()->all()); + $vendor_contact->push(); + + return back()->withSuccess(ctrans('texts.profile_updated_successfully')); + + } + + private function sidebarMenu() :array + { + $enabled_modules = auth()->guard('vendor')->user()->company->enabled_modules; + $data = []; + + // TODO: Enable dashboard once it's completed. + // $this->settings->enable_client_portal_dashboard + // $data[] = [ 'title' => ctrans('texts.dashboard'), 'url' => 'client.dashboard', 'icon' => 'activity']; + + if (self::MODULE_PURCHASE_ORDERS & $enabled_modules) { + $data[] = ['title' => ctrans('texts.purchase_orders'), 'url' => 'vendor.purchase_orders.index', 'icon' => 'file-text']; + } + + // $data[] = ['title' => ctrans('texts.documents'), 'url' => 'client.documents.index', 'icon' => 'download']; + + return $data; + } + +} \ No newline at end of file diff --git a/app/Http/Middleware/VendorLocale.php b/app/Http/Middleware/VendorLocale.php index ebe3bb7b4ebe..490973f00ddb 100644 --- a/app/Http/Middleware/VendorLocale.php +++ b/app/Http/Middleware/VendorLocale.php @@ -28,6 +28,12 @@ class VendorLocale public function handle($request, Closure $next) { + if (auth()->guard('contact')->check()) { + auth()->guard('contact')->logout(); + $request->session()->invalidate(); + } + + /*LOCALE SET */ if ($request->has('lang')) { $locale = $request->input('lang'); diff --git a/composer.lock b/composer.lock index 313a3d2f5ce6..233fe30a2ae1 100644 --- a/composer.lock +++ b/composer.lock @@ -110,16 +110,16 @@ }, { "name": "apimatic/unirest-php", - "version": "2.2.2", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/apimatic/unirest-php.git", - "reference": "a45c4c71a1ea3659b118042a67cc1b6486bcf03a" + "reference": "52e226fb3b7081dc9ef64aee876142a240a5f0f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/apimatic/unirest-php/zipball/a45c4c71a1ea3659b118042a67cc1b6486bcf03a", - "reference": "a45c4c71a1ea3659b118042a67cc1b6486bcf03a", + "url": "https://api.github.com/repos/apimatic/unirest-php/zipball/52e226fb3b7081dc9ef64aee876142a240a5f0f9", + "reference": "52e226fb3b7081dc9ef64aee876142a240a5f0f9", "shasum": "" }, "require": { @@ -168,9 +168,9 @@ "support": { "email": "opensource@apimatic.io", "issues": "https://github.com/apimatic/unirest-php/issues", - "source": "https://github.com/apimatic/unirest-php/tree/2.2.2" + "source": "https://github.com/apimatic/unirest-php/tree/2.3.0" }, - "time": "2022-03-24T08:19:20+00:00" + "time": "2022-06-15T08:29:49+00:00" }, { "name": "asm/php-ansible", diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index b4fef4c8f6d3..9c044f987481 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -4630,6 +4630,7 @@ $LANG = array( 'purchase_order_number_placeholder' => 'Purchase Order # :purchase_order', 'accepted' => 'Accepted', 'activity_137' => ':contact accepted purchase order :purchase_order', + 'vendor_information' => 'Vendor Information', ); return $LANG; diff --git a/routes/vendor.php b/routes/vendor.php index 8af6f10189cf..28986e8ad0ac 100644 --- a/routes/vendor.php +++ b/routes/vendor.php @@ -12,6 +12,7 @@ use App\Http\Controllers\Auth\VendorContactLoginController; use App\Http\Controllers\VendorPortal\InvitationController; use App\Http\Controllers\VendorPortal\PurchaseOrderController; +use App\Http\Controllers\VendorPortal\VendorContactController; use Illuminate\Support\Facades\Route; Route::get('vendors', [VendorContactLoginController::class, 'catch'])->name('vendor.catchall')->middleware(['domain_db', 'contact_account','vendor_locale']); //catch all @@ -31,7 +32,9 @@ Route::group(['middleware' => ['auth:vendor', 'vendor_locale', 'domain_db'], 'pr Route::get('purchase_orders', [PurchaseOrderController::class, 'index'])->name('purchase_orders.index'); Route::get('purchase_orders/{purchase_order}', [PurchaseOrderController::class, 'show'])->name('purchase_order.show'); - Route::get('profile/{vendor_contact}/edit', [PurchaseOrderController::class, 'index'])->name('profile.edit'); + Route::get('profile/{vendor_contact}/edit', [VendorContactController::class, 'edit'])->name('profile.edit'); + Route::put('profile/{vendor_contact}/edit', [VendorContactController::class, 'update'])->name('profile.update'); + Route::post('purchase_orders/bulk', [PurchaseOrderController::class, 'bulk'])->name('purchase_orders.bulk'); Route::get('logout', [VendorContactLoginController::class, 'logout'])->name('logout');