355 lines
17 KiB
PHP
355 lines
17 KiB
PHP
<div class="row">
|
|
{{-- DATES/STATUS --}}
|
|
@if (request()->routeIs('bo.invoices.edit'))
|
|
@if ($invoiceModel->status !== \App\Enums\Invoices\InvoiceStatusEnum::opened || $invoiceModel->signed_date)
|
|
<div class="col-12">
|
|
<div class="alert alert-secondary text-white" role="alert">
|
|
<strong>
|
|
@if ($invoiceModel->status !== \App\Enums\Invoices\InvoiceStatusEnum::opened)
|
|
{{ __('Impossible de mettre à jour les informations d\'un devis :status.', ['status' => $invoiceModel->status->label()]) }}
|
|
@elseif($invoiceModel->signed_date)
|
|
{{ __('Impossible de mettre à jour les informations d\'un devis déjà signé, seule les sections "État" et "Commentaires" sont pris en compte') }}
|
|
@endif
|
|
</strong>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
{{-- DATES STATUS --}}
|
|
<div class="col-12 mb-3">
|
|
<fieldset class="row w-100 h-100 mx-auto border bg-white p-3">
|
|
<legend class="p-0">{{ __('État') }}</legend>
|
|
<div class="row w-100 mx-auto p-0">
|
|
{{-- SENT_CLIENT_DATE --}}
|
|
<div class="col-12 col-sm-6 col-md-4 pe-md-3 p-0">
|
|
@if ($invoiceModel->status === \App\Enums\Invoices\InvoiceStatusEnum::opened and !$invoiceModel->sent_client_date)
|
|
@include('bo.partials.inputs.date', [
|
|
'id' => 'invoiceSentclientdate',
|
|
'label' => __('Date d\'envoi du :model', [
|
|
'model' => __('models.classes.invoices'),
|
|
]),
|
|
'name' => 'sent_client_date',
|
|
'defaultValue' => false,
|
|
'required' => true,
|
|
'model' => $invoiceModel ?? null,
|
|
'helper' => __('Doît être une date réelle et existante.'),
|
|
])
|
|
@elseif ($invoiceModel->sent_client_date)
|
|
<p class="fw-bold m-0 text-center">
|
|
{{ __('Envoyé le :date', ['date' => \Carbon\Carbon::parse($invoiceModel->sent_client_date)->format('d/m/Y')]) ?? 'xxx' }}
|
|
</p>
|
|
@endif
|
|
</div>
|
|
{{-- SIGNED_DATE --}}
|
|
<div class="col-12 col-sm-6 col-md-4 pe-md-3 p-0">
|
|
@if ($invoiceModel->status === \App\Enums\Invoices\InvoiceStatusEnum::opened and !$invoiceModel->signed_date)
|
|
@include('bo.partials.inputs.date', [
|
|
'id' => 'invoiceSigneddate',
|
|
'label' => __('Date de signature du :model (client)', [
|
|
'model' => __('models.classes.invoices'),
|
|
]),
|
|
'name' => 'signed_date',
|
|
'defaultValue' => false,
|
|
'required' => true,
|
|
'model' => $invoiceModel ?? null,
|
|
'helper' => __('Doît être une date réelle et existante.'),
|
|
])
|
|
@elseif ($invoiceModel->signed_date)
|
|
<p class="fw-bold m-0 text-center">
|
|
{{ __('Signé le :date (client)', ['date' => \Carbon\Carbon::parse($invoiceModel->signed_date)->format('d/m/Y') ?? 'xxx']) }}
|
|
</p>
|
|
@endif
|
|
</div>
|
|
{{-- SENT_ACCOUNTING_DATE --}}
|
|
<div class="col-12 col-sm-6 col-md-4 pe-md-3 p-0">
|
|
@if ($invoiceModel->status === \App\Enums\Invoices\InvoiceStatusEnum::opened)
|
|
@include('bo.partials.inputs.date', [
|
|
'id' => 'invoiceSentaccountingdate',
|
|
'label' => __('Date d\'envoi du :model à la comptabilité', [
|
|
'model' => __('models.classes.invoices'),
|
|
]),
|
|
'name' => 'sent_accounting_date',
|
|
'defaultValue' => false,
|
|
'required' => true,
|
|
'model' => $invoiceModel ?? null,
|
|
'helper' => __('Doît être une date réelle et existante.'),
|
|
])
|
|
@endif
|
|
</div>
|
|
{{-- STATUS --}}
|
|
@if ($invoiceModel->status === \App\Enums\Invoices\InvoiceStatusEnum::opened)
|
|
<div class="col-12 col-md-6 pe-md-3 p-0">
|
|
@include('bo.partials.inputs.tinyint-enum', [
|
|
'id' => 'invoiceStatus',
|
|
'label' => __('crud.minicrud.associated', [
|
|
'entity' => 'État',
|
|
]),
|
|
'name' => 'status',
|
|
'model' => $invoiceModel ?? null,
|
|
'required' => true,
|
|
'associatedModels' => $invoiceStatusArray,
|
|
'helper' => __('crud.minicrud.select', [
|
|
'entity' => 'État',
|
|
]),
|
|
])
|
|
@else
|
|
<div class="col-12 pe-md-3 p-0">
|
|
<p class="fw-bold text-warning m-0 mt-3 text-center">{{ $invoiceModel->status->label() }}</p>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
@endif
|
|
{{-- USER ASSOCIATED --}}
|
|
<div class="col-12 mb-3">
|
|
<fieldset class="row w-100 h-100 mx-auto border bg-white p-3" @if ($invoiceModel->sent_client_date) disabled @endif>
|
|
<legend class="p-0">{{ __('Informations sur la personne associée') }}</legend>
|
|
<div class="row w-100 mx-auto p-0">
|
|
{{-- FIRSTNAME --}}
|
|
<div class="col-12 col-md-6 pe-md-3 p-0">
|
|
@include('bo.partials.inputs.varchar', [
|
|
'id' => 'invoiceFirstname',
|
|
'label' => __(':field de la personne auquel le :model est associé', [
|
|
'field' => Str::ucfirst(__('validation.attributes.firstname')),
|
|
'model' => __('models.classes.invoices'),
|
|
]),
|
|
'hasWordCounter' => true,
|
|
'name' => 'firstname',
|
|
'required' => true,
|
|
'model' => $invoiceModel ?? null,
|
|
'helper' => __('validation.between.string', [
|
|
'attribute' => Str::ucfirst(__('validation.attributes.firstname')),
|
|
'min' => 3,
|
|
'max' => 255,
|
|
]),
|
|
'placeholder' => __(':field du :model', [
|
|
'field' => Str::ucfirst(__('validation.attributes.firstname')),
|
|
'model' => __('models.classes.invoices'),
|
|
]),
|
|
])
|
|
</div>
|
|
{{-- LASTNAME --}}
|
|
<div class="col-12 col-md-6 ps-md-3 p-0">
|
|
@include('bo.partials.inputs.varchar', [
|
|
'id' => 'invoiceLastname',
|
|
'label' => __(':field de la personne auquel le :model est associé', [
|
|
'field' => Str::ucfirst(__('validation.attributes.lastname')),
|
|
'model' => __('models.classes.invoices'),
|
|
]),
|
|
'hasWordCounter' => true,
|
|
'name' => 'lastname',
|
|
'required' => true,
|
|
'model' => $invoiceModel ?? null,
|
|
'helper' => __('validation.between.string', [
|
|
'attribute' => Str::ucfirst(__('validation.attributes.lastname')),
|
|
'min' => 3,
|
|
'max' => 255,
|
|
]),
|
|
'placeholder' => __(':field du :model', [
|
|
'field' => Str::ucfirst(__('validation.attributes.lastname')),
|
|
'model' => __('models.classes.invoices'),
|
|
]),
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- OBJECT --}}
|
|
<div class="col-12 col-md-6 mb-3">
|
|
<fieldset class="h-100 border bg-white p-3" @if ($invoiceModel->sent_client_date) disabled @endif>
|
|
<legend>{{ Str::ucfirst(__('validation.attributes.object')) }}</legend>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
@include('bo.partials.inputs.varchar', [
|
|
'id' => 'invoiceObject',
|
|
'label' => __(':field du :model', [
|
|
'field' => Str::ucfirst(__('validation.attributes.object')),
|
|
'model' => __('models.classes.invoices'),
|
|
]),
|
|
'hasWordCounter' => true,
|
|
'name' => 'object',
|
|
'required' => true,
|
|
'model' => $invoiceModel ?? null,
|
|
'helper' => __('validation.between.string', [
|
|
'attribute' => Str::ucfirst(__('validation.attributes.object')),
|
|
'min' => 3,
|
|
'max' => 255,
|
|
]),
|
|
'placeholder' => __(':field du :model', [
|
|
'field' => Str::ucfirst(__('validation.attributes.object')),
|
|
'model' => __('models.classes.invoices'),
|
|
]),
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- TASKS --}}
|
|
<div class="col-12 pb-3">
|
|
<fieldset class="h-100 border bg-white p-3" @if ($invoiceModel->sent_client_date) disabled @endif>
|
|
<legend>{{ __('validation.attributes.tasks') }}</legend>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
@php
|
|
$data = [
|
|
'companies' => $companyModels,
|
|
'packages' => $packageModels,
|
|
'taskTypeEnums' => collect(\App\Enums\Invoices\TaskTypeEnum::toArray())->values(),
|
|
'taskRowModel' => $taskRowModel,
|
|
'tasks' => $invoiceModel->tasks ?? [],
|
|
];
|
|
@endphp
|
|
<div class="invoice-tasks" data-json='@json($data)'></div>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- COMMENT --}}
|
|
<div class="col-12 pb-3">
|
|
<fieldset class="h-100 border bg-white p-3">
|
|
<legend>{{ Str::ucfirst(__('validation.attributes.comment')) }}</legend>
|
|
<div class="row mb-3">
|
|
<div class="col-12">
|
|
@include('bo.partials.inputs.text-html', [
|
|
'id' => 'invoiceComment',
|
|
'label' => __('Commentaire du :model', [
|
|
'model' => __('models.classes.invoices'),
|
|
]),
|
|
'name' => 'comment',
|
|
'model' => $invoiceModel,
|
|
'required' => false,
|
|
'helper' => __('crud.minicrud.text_warning', [
|
|
'number' => 15,
|
|
]),
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- SITE_ID --}}
|
|
<div class="col-12 col-md-6 pb-3">
|
|
<fieldset class="h-100 border bg-white p-3" @if ($invoiceModel->sent_client_date) disabled @endif>
|
|
<legend>{{ Str::singular(trans('models.classes.sites')) }}</legend>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
@include('bo.partials.inputs.search-belongs-to-dropdown', [
|
|
'id' => 'invoiceSites',
|
|
'label' => __(':model associé', [
|
|
'model' => Str::singular(trans('models.classes.sites')),
|
|
]),
|
|
'name' => 'site_id',
|
|
'targetModel' => 'App\Models\Site',
|
|
'routeName' => 'invoices.json-paginate',
|
|
'modelRelated' => $siteModels ?? [],
|
|
'modelSelected' => $invoiceModel->site ?? [],
|
|
'readonly' => $invoiceModel->sent_client_date ? true : false,
|
|
'placeholder' => __('Rechercher une :model', [
|
|
'model' => Str::singular(trans('models.classes.sites')),
|
|
]),
|
|
'helper' => __(
|
|
'Sélectionner un :model qui sera associé parmis la liste (un seul et unique :model doit être choisi).',
|
|
[
|
|
'model' => Str::singular(__('models.classes.sites')),
|
|
]),
|
|
'required' => true,
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- COMPANY_ID --}}
|
|
<div class="col-12 col-md-6 pb-3">
|
|
<fieldset class="h-100 border bg-white p-3" @if ($invoiceModel->sent_client_date) disabled @endif>
|
|
<legend>{{ Str::singular(trans('models.classes.companies')) }}</legend>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
@include('bo.partials.inputs.search-belongs-to-dropdown', [
|
|
'id' => 'invoiceCompany',
|
|
'label' => __(':model associé', [
|
|
'model' => Str::singular(trans('models.classes.companies')),
|
|
]),
|
|
'name' => 'company_id',
|
|
'targetModel' => 'App\Models\Company',
|
|
'routeName' => 'invoices.json-paginate',
|
|
'modelRelated' => $companyModels ?? [],
|
|
'modelSelected' => $invoiceModel->company ?? [],
|
|
'readonly' => $invoiceModel->sent_client_date ? true : false,
|
|
'placeholder' => __('Rechercher une :model', [
|
|
'model' => Str::singular(trans('models.classes.companies')),
|
|
]),
|
|
'helper' => __(
|
|
'Sélectionner une :model qui sera associée parmis la liste (une seule et unique :model doit être choisie).',
|
|
[
|
|
'model' => Str::singular(__('models.classes.companies')),
|
|
]),
|
|
'required' => true,
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- INVOICED_TO_ID --}}
|
|
<div class="col-12 col-md-6 pb-3">
|
|
<fieldset class="h-100 border bg-white p-3">
|
|
<legend>{{ __('Entité à facturer') }}</legend>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
@include('bo.partials.inputs.search-belongs-to-dropdown', [
|
|
'id' => 'invoiceInvoicedtoid',
|
|
'label' => __(':model associé', ['model' => Str::singular(trans('models.classes.companies'))]),
|
|
'name' => 'invoiced_to_id',
|
|
'targetModel' => 'App\Models\Company',
|
|
'routeName' => 'invoices.json-paginate',
|
|
'modelRelated' => $companyModels ?? [],
|
|
'modelSelected' => $invoiceModel->companyInvoiced ?? [],
|
|
'readonly' => $invoiceModel->sent_client_date ? true : false,
|
|
'placeholder' => __('Rechercher une :model', [
|
|
'model' => Str::singular(trans('models.classes.companies')),
|
|
]),
|
|
'helper' => __(
|
|
'Sélectionner une :model qui sera associée parmis la liste (une seule et unique :model doit être choisie).',
|
|
[
|
|
'model' => Str::singular(__('models.classes.companies')),
|
|
]),
|
|
'required' => true,
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- SHOW DAYS --}}
|
|
<div class="col-12 col-md-6 mb-3">
|
|
<fieldset class="h-100 border bg-white p-3" @if ($invoiceModel->sent_client_date) disabled @endif>
|
|
<legend>{{ __('Visibilité') }}</legend>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
@include('bo.partials.inputs.tinyint-boolean', [
|
|
'id' => 'invoiceShowdays',
|
|
'name' => 'show_days',
|
|
'label' => __('Afficher les jours sur le :model', [
|
|
'model' => __('models.classes.invoices'),
|
|
]),
|
|
'helper' => __('Deux réponses possibles : oui ou non.'),
|
|
'model' => $invoiceModel ?? null,
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
</div>
|
|
|
|
@if ($invoiceModel->status === \App\Enums\Invoices\InvoiceStatusEnum::opened || $invoiceModel->status === null)
|
|
@push('scripts')
|
|
<script nonce="{{ $nonce }}">
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
// Submit button clone.
|
|
const submit = document.getElementById('formSubmit')
|
|
submitClone = document.getElementById('formSubmitClone');
|
|
submitClone.addEventListener('click', (event) => {
|
|
event.preventDefault();
|
|
submit.click('');
|
|
})
|
|
});
|
|
</script>
|
|
@endpush
|
|
@endif
|