Add company setting for enabling client portal uploads

This commit is contained in:
Benjamin Beganović 2020-08-19 16:35:54 +02:00
parent 9223ff9ac8
commit c386167762
5 changed files with 9 additions and 5 deletions

View File

@ -235,6 +235,7 @@ class CompanySettings extends BaseSettings
public $client_can_register = false;
public $client_portal_terms = '';
public $client_portal_privacy_policy = '';
public $client_portal_enable_uploads = false;
public static $casts = [
'lock_invoices' => 'string',
@ -402,6 +403,7 @@ class CompanySettings extends BaseSettings
'portal_custom_css' => 'string',
'portal_custom_footer' => 'string',
'portal_custom_js' => 'string',
'client_portal_enable_uploads' => 'bool',
];

View File

@ -13,8 +13,7 @@ class StoreUploadRequest extends FormRequest
*/
public function authorize()
{
// TODO: Check for the setting to allow client uploads.
return true;
return (bool) auth('contact')->user()->client->getSetting('client_portal_enable_uploads');
}
/**

View File

@ -1,4 +1,4 @@
<div class="mt-10">
<div>
<div class="flex items-center justify-between">
<div class="flex items-center">
<span class="mr-2 text-sm hidden md:block">{{ ctrans('texts.per_page') }}</span>

View File

@ -2,7 +2,10 @@
@section('meta_title', ctrans('texts.downloads'))
@section('header')
@component('portal.ninja2020.upload.index')@endcomponent
{{ dd(auth('contact')->user()->client) }}
@if($client->getSetting('client_portal_enable_uploads'))
@component('portal.ninja2020.upload.index') @endcomponent
@endif
@endsection
@section('body')

View File

@ -1,7 +1,7 @@
<link rel="stylesheet" href="{{ asset('vendor/dropzone-5.7.0/dist/min/basic.min.css') }}">
<script src="{{ asset('vendor/dropzone-5.7.0/dist/min/dropzone.min.js') }}"></script>
<div class="bg-white rounded shadow p-4">
<div class="bg-white rounded shadow p-4 mb-10">
<span class="text-sm mb-4 block text-gray-500">{{ ctrans('texts.allowed_file_types' )}} png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx</span>
<form action="{{ route('client.upload.store') }}" class="dropzone" method="post" enctype="multipart/form-data">
@csrf