114 lines
6.1 KiB
PHP
114 lines
6.1 KiB
PHP
@extends($viewLayout)
|
|
|
|
@section('title', sprintf('%s - %s', transFb(sprintf('models.classes.%s', strtolower(Str::plural(class_basename($modelClass)))), Str::plural(class_basename($modelClass))), __('crud-policies::crud.edit')))
|
|
@section('description', sprintf('%s %s', __('crud-policies::crud.edit'), trans(class_basename($modelClass))))
|
|
@section('metaIndex', 'noindex,nofollow')
|
|
|
|
@section('content')
|
|
<div class="card">
|
|
@include('crud-policies::crud.modules.flashMessage')
|
|
<div class="card-header">
|
|
@include('crud-policies::crud.modules.breadcrumb', ['action' => CrudAction::update()])
|
|
@include('crud-policies::crud.modules.actionbar.bar', ['action' => CrudAction::update()])
|
|
<div class="row text-end">
|
|
<div class="col">
|
|
@if(!$model->signed_date)
|
|
<form action="{{ route('invoices.sign.setSignedDate', $model) }}" method="POST">
|
|
@csrf
|
|
<div class="input-group">
|
|
<input name="date" type="date" class="form-control" aria-label="{{ __('Signé par le service') }}" aria-describedby="signed_date">
|
|
<button class="btn {{ !$model->signed_date ? 'btn-outline-warning' : 'btn-outline-secondary' }}" type="submit" id="signed_date">{{ __('Service Web') }}</button>
|
|
</div>
|
|
</form>
|
|
@else
|
|
<span class="d-block h5 fw-bold pt-2">{{ __('Signé le :date', [
|
|
'date' => $model->signed_date->isoFormat('DD/MM/YYYY')
|
|
]) }}</span>
|
|
@endif
|
|
</div>
|
|
<div class="col">
|
|
@if(!$model->sent_client_date)
|
|
<form action="{{ route('invoices.sign.setClientSentDate', $model) }}" method="POST">
|
|
@csrf
|
|
<div class="input-group">
|
|
<input name="date" type="date" class="form-control" aria-label="{{ __('Signé par le client') }}" aria-describedby="sent_client_date" @if($model->sent_client_date)readonly @endif>
|
|
<button class="btn {{ !$model->sent_client_date ? 'btn-outline-success' : 'btn-outline-secondary' }}" type="submit" id="sent_client_date">{{ __('Client') }}</button>
|
|
</div>
|
|
</form>
|
|
@else
|
|
<span class="d-block h5 fw-bold pt-2">{{ __('Signé le :date (client)', [
|
|
'date' => $model->sent_client_date->isoFormat('DD/MM/YYYY')
|
|
]) }}</span>
|
|
@endif
|
|
</div>
|
|
<div class="col">
|
|
@if(!$model->sent_accounting_date)
|
|
<form action="{{ route('invoices.sign.setComptaSentDate', $model) }}" method="POST">
|
|
@csrf
|
|
<div class="input-group">
|
|
<input name="date" type="date" class="form-control" aria-label="{{ __('Signé par la compta') }}" aria-describedby="sent_accounting_date" @if($model->sent_accounting_date)readonly @endif>
|
|
<button class="btn {{ !$model->sent_accounting_date ? 'btn-outline-info' : 'btn-outline-secondary' }}" type="submit" id="sent_accounting_date">{{ __('Compta') }}</button>
|
|
</div>
|
|
</form>
|
|
@else
|
|
<span class="d-block h5 fw-bold pt-2">{{ __('Signé le :date (compta)', [
|
|
'date' => $model->sent_accounting_date->isoFormat('DD/MM/YYYY')
|
|
]) }}</span>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
<form action="{{ CrudController::getRoutePrefixed("$modelTable.update", $model) }}" method="POST" @if($hasFile) enctype="multipart/form-data" @endif>
|
|
@method('put')
|
|
@csrf
|
|
<div class="container text-center">
|
|
<div class="row">
|
|
<div class="col-3 border border-secondary py-1 px-1">{{ __('crud-policies::crud.property') }}</div>
|
|
<div class="col-9 border border-secondary py-1 px-1">{{ __('crud-policies::crud.value') }}</div>
|
|
</div>
|
|
@foreach ($modelClass::getEditableProperties() as $fieldName => $prop)
|
|
@if(in_array(CrudAction::update(), $prop['actions']))
|
|
@if($fieldName === 'tasks')
|
|
<div class="row">
|
|
<div class="col-3 border border-secondary py-1 px-1">
|
|
<label for="total" class="form-label">{{ $prop['label'] ?? $fieldName }}</label>
|
|
</div>
|
|
<div class="col-9 border border-secondary py-1 px-1">
|
|
@php
|
|
$taskTypeEnums = collect(App\Enums\Invoice\TaskType::toArray())->map(function($enum) {
|
|
return [
|
|
'value' => $enum->value,
|
|
'label' => $enum->label,
|
|
'price' => $enum->price,
|
|
];
|
|
});
|
|
$dataVue = [
|
|
'tasks'=> old($fieldName) ? json_decode(old($fieldName), true): $model->{$fieldName} ?? [],
|
|
'companies' => $companies,
|
|
'packages' => $packages,
|
|
'taskRowModel' => $taskRowModel,
|
|
'taskTypeEnums' => $taskTypeEnums,
|
|
];
|
|
@endphp
|
|
<div
|
|
id="invoice-tasks"
|
|
data-json='@json($dataVue)'></div>
|
|
</div>
|
|
</div>
|
|
@else
|
|
<div class="row">
|
|
@include('crud-policies::crud.formfield')
|
|
</div>
|
|
@endif
|
|
@endif
|
|
@endforeach
|
|
</div>
|
|
<div class="col text-center">
|
|
<button class="btn btn-info" type="submit" @if($model->signed_date) disabled @endif>{{ __('crud-policies::crud.update') }}</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
@include('crud-policies::crud.modules.scriptConstants')
|
|
@endsection
|