1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-15 23:52:33 +01:00
invoiceninja/app/Http/Controllers/VendorPortal/VendorContactController.php

92 lines
2.6 KiB
PHP
Raw Normal View History

2022-06-15 13:24:30 +02:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2023-01-28 23:21:40 +01:00
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
2022-06-15 13:24:30 +02:00
*
* @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;
class VendorContactController extends Controller
{
use MakesHash;
public const MODULE_RECURRING_INVOICES = 1;
2022-06-15 13:24:30 +02:00
public const MODULE_CREDITS = 2;
2022-06-15 13:24:30 +02:00
public const MODULE_QUOTES = 4;
2022-06-15 13:24:30 +02:00
public const MODULE_TASKS = 8;
2022-06-15 13:24:30 +02:00
public const MODULE_EXPENSES = 16;
2022-06-15 13:24:30 +02:00
public const MODULE_PROJECTS = 32;
2022-06-15 13:24:30 +02:00
public const MODULE_VENDORS = 64;
2022-06-15 13:24:30 +02:00
public const MODULE_TICKETS = 128;
2022-06-15 13:24:30 +02:00
public const MODULE_PROPOSALS = 256;
2022-06-15 13:24:30 +02:00
public const MODULE_RECURRING_EXPENSES = 512;
2022-06-15 13:24:30 +02:00
public const MODULE_RECURRING_TASKS = 1024;
2022-06-15 13:24:30 +02:00
public const MODULE_RECURRING_QUOTES = 2048;
2022-06-15 13:24:30 +02:00
public const MODULE_INVOICES = 4096;
2022-06-15 13:24:30 +02:00
public const MODULE_PROFORMAL_INVOICES = 8192;
2022-06-15 13:24:30 +02:00
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(),
2022-06-15 13:24:30 +02:00
]);
}
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'));
2022-06-15 13:24:30 +02:00
}
2024-01-14 05:05:00 +01:00
private function sidebarMenu(): array
2022-06-15 13:24:30 +02:00
{
$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;
}
}