Revenues attachment add multiple

This commit is contained in:
Cüneyt Şentürk 2021-02-09 11:48:58 +03:00
parent cf2726441c
commit fcc8b6358e
3 changed files with 26 additions and 13 deletions

View File

@ -66,7 +66,17 @@ class Revenues extends Controller
$payment_methods = Modules::getPaymentMethods(); $payment_methods = Modules::getPaymentMethods();
return view('sales.revenues.create', compact('accounts', 'currencies', 'account_currency_code', 'currency', 'customers', 'categories', 'payment_methods')); $file_type_mimes = explode(',', config('filesystems.mimes'));
$file_types = [];
foreach ($file_type_mimes as $mime) {
$file_types[] = '.' . $mime;
}
$file_types = implode(',', $file_types);
return view('sales.revenues.create', compact('accounts', 'currencies', 'account_currency_code', 'currency', 'customers', 'categories', 'payment_methods', 'file_types'));
} }
/** /**
@ -166,7 +176,17 @@ class Revenues extends Controller
$date_format = $this->getCompanyDateFormat(); $date_format = $this->getCompanyDateFormat();
return view('sales.revenues.edit', compact('revenue', 'accounts', 'currencies', 'currency', 'customers', 'categories', 'payment_methods', 'date_format')); $file_type_mimes = explode(',', config('filesystems.mimes'));
$file_types = [];
foreach ($file_type_mimes as $mime) {
$file_types[] = '.' . $mime;
}
$file_types = implode(',', $file_types);
return view('sales.revenues.edit', compact('revenue', 'accounts', 'currencies', 'currency', 'customers', 'categories', 'payment_methods', 'date_format', 'file_types'));
} }
/** /**

View File

@ -38,9 +38,9 @@
{{ Form::textGroup('reference', trans('general.reference'), 'file', []) }} {{ Form::textGroup('reference', trans('general.reference'), 'file', []) }}
{{ Form::fileGroup('attachment', trans('general.attachment'), '', ['dropzone-class' => 'form-file']) }}
{{ Form::selectGroup('document_id', trans_choice('general.invoices', 1), 'file-invoice', [], null, ['disabled' => 'true']) }} {{ Form::selectGroup('document_id', trans_choice('general.invoices', 1), 'file-invoice', [], null, ['disabled' => 'true']) }}
{{ Form::fileGroup('attachment', trans('general.attachment'), '', ['dropzone-class' => 'w-100', 'multiple' => 'multiple', 'options' => ['acceptedFiles' => $file_types]], null, 'col-md-12') }}
</div> </div>
</div> </div>

View File

@ -57,19 +57,12 @@
{{ Form::textGroup('reference', trans('general.reference'), 'file',[]) }} {{ Form::textGroup('reference', trans('general.reference'), 'file',[]) }}
@if ($revenue->attachment)
<div class="col-md-6">
@php $file = $revenue->attachment; @endphp
@include('partials.media.file')
</div>
@else
{{ Form::fileGroup('attachment', trans('general.attachment'), '', ['dropzone-class' => 'form-file']) }}
@endif
@if ($revenue->invoice) @if ($revenue->invoice)
{{ Form::textGroup('document', trans_choice('general.invoices', 1), 'file-invoice', ['disabled' => 'true'], $revenue->invoice->document_number) }} {{ Form::textGroup('document', trans_choice('general.invoices', 1), 'file-invoice', ['disabled' => 'true'], $revenue->invoice->document_number) }}
{{ Form::hidden('document_id', $revenue->invoice->id) }} {{ Form::hidden('document_id', $revenue->invoice->id) }}
@endif @endif
{{ Form::fileGroup('attachment', trans('general.attachment'), '', ['dropzone-class' => 'w-100', 'multiple' => 'multiple', 'options' => ['acceptedFiles' => $file_types]], $revenue->attachment, 'col-md-12') }}
</div> </div>
</div> </div>