mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
vendor profile updates
This commit is contained in:
parent
f03ab7e537
commit
4606215ba2
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\VendorPortal;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\VendorContact;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\TranslationHelper;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class VendorContactController extends Controller
|
||||
{
|
||||
use MakesHash;
|
||||
|
||||
public const MODULE_RECURRING_INVOICES = 1;
|
||||
public const MODULE_CREDITS = 2;
|
||||
public const MODULE_QUOTES = 4;
|
||||
public const MODULE_TASKS = 8;
|
||||
public const MODULE_EXPENSES = 16;
|
||||
public const MODULE_PROJECTS = 32;
|
||||
public const MODULE_VENDORS = 64;
|
||||
public const MODULE_TICKETS = 128;
|
||||
public const MODULE_PROPOSALS = 256;
|
||||
public const MODULE_RECURRING_EXPENSES = 512;
|
||||
public const MODULE_RECURRING_TASKS = 1024;
|
||||
public const MODULE_RECURRING_QUOTES = 2048;
|
||||
public const MODULE_INVOICES = 4096;
|
||||
public const MODULE_PROFORMAL_INVOICES = 8192;
|
||||
public const MODULE_PURCHASE_ORDERS = 16384;
|
||||
|
||||
public function edit(VendorContact $vendor_contact)
|
||||
{
|
||||
|
||||
return $this->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;
|
||||
}
|
||||
|
||||
}
|
@ -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');
|
||||
|
12
composer.lock
generated
12
composer.lock
generated
@ -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",
|
||||
|
@ -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;
|
||||
|
@ -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');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user