Merge branch 'develop' into trunk

This commit is contained in:
Vincent BRIDIER 2024-06-11 10:07:26 +02:00
commit 6c8cc25bae
No known key found for this signature in database
GPG key ID: 8571BFA20420D512
15 changed files with 1644 additions and 1715 deletions

View file

@ -22,7 +22,7 @@ enum TicketStatusEnum: int
*/
private const LABELS = [
self::new->name => "Nouveau",
self::estimateTodo->name => "Devis à faire",
self::estimateTodo->name => "Étude chef(s) de projet",
self::takenInAccount->name => "Pris en compte",
self::waiting->name => "En attente de réponse",
self::waitingValidation->name => "En attente de validation",

View file

@ -26,7 +26,7 @@ class InvoiceController extends Controller
public function index(Request $request): \Illuminate\Contracts\View\View
{
/** @var \Illuminate\Database\Eloquent\Builder $invoiceModels */
$invoiceModels = Invoice::query();
$invoiceModels = Invoice::query()->orderByDesc('created_at');
$status = intval($request->status);
$invoiceModels = $invoiceModels->when($status, function ($query) use ($status) {
$query->where('status', $status);
@ -42,9 +42,10 @@ class InvoiceController extends Controller
'firstname',
'lastname',
'ref',
'site_id',
);
}
$searchFields = trans('Nom, Prénom, Référence');
$searchFields = trans('Nom, Prénom, Référence, Site');
/** Sort columns with a query */
$this->sortQuery($invoiceModels);

View file

@ -15,6 +15,7 @@ use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Str;
class Controller extends BaseController
{
@ -117,28 +118,80 @@ class Controller extends BaseController
* @param array $fields
* @return \Illuminate\Database\Eloquent\Builder
*/
private function searchOnFields(Builder $query, string $search, array $fields): Builder
{
private function searchOnFields(
Builder $query,
string $search,
array $fields
): \Illuminate\Database\Eloquent\Builder {
$table = $query->getModel()->getTable();
foreach ($fields as $f) {
$f = str_replace('?', '\?', $f);
if (is_array($f)) {
foreach ($fields as $field) {
$field = str_replace('?', '\?', $field);
if (is_array($field)) {
$query->orWhereRaw(
sprintf("UPPER(CONCAT(%s)) LIKE UPPER(?)", collect($f)->map(function ($q) use ($table) {
sprintf("UPPER(CONCAT(%s)) LIKE UPPER(?)", collect($field)->map(function ($q) use ($table) {
return "`$table`.`$q`";
})->implode(', \' \', ')),
['%' . filter_var($search, FILTER_SANITIZE_STRING) . '%']
);
} else {
$query->orWhereRaw(
"UPPER(`$table`.`$f`) LIKE UPPER(?)",
['%' . filter_var($search, FILTER_SANITIZE_STRING) . '%']
['%' . htmlspecialchars($search) . '%']
);
return $query;
}
}
// Get models woth enum's label.
if (is_array($this->getSearchValue($query, $search, $field))) {
foreach ($this->getSearchValue($query, $search, $field) as $array) {
$query->orWhereRaw(
"UPPER(`$table`.`$field`) LIKE UPPER(?)",
['%' . htmlspecialchars($array->value) . '%']
);
}
return $query;
}
// Get models with relation's name/label.
if (Str::endsWith($field, '_id')) {
$query->orWhereHas(Str::remove('_id', $field), function ($queryRelation) use ($field, $search) {
if (Schema::hasColumn(Str::remove('_id', $field) . 's', 'name')) {
$queryRelation->where('name', 'like', '%' . $search . '%');
} elseif (Schema::hasColumn(Str::remove('_id', $field) . 's', 'label')) {
$queryRelation->where('label', 'like', '%' . $search . '%');
}
});
return $query;
}
$query->orWhereRaw(
"UPPER(`$table`.`$field`) LIKE UPPER(?)",
['%' . htmlspecialchars($this->getSearchValue($query, $search, $field)) . '%']
);
} //end foreach
return $query;
}
/**
* Get the search value (on string or Enum).
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $search
* @param string $field
* @return string|array
*/
protected function getSearchValue(Builder $query, string $search, string $field): string|array
{
$cast = $query->getModel()->getCasts()[$field] ?? null;
if (
count($query->getModel()->getCasts()) and // Check if the model has casts.
$cast and // Check if there is cast about specific field.
enum_exists($cast) // Check if the cast is an enum.
) {
/** @var \App\Traits\Enums $cast */
// @phpstan-ignore-next-line
$cases = collect($cast::toArray());
$enum = $cases->filter(function ($item) use ($search) {
return preg_match('/' . Str::lower($search) . '/', Str::lower($item->label));
});
return $enum->toArray();
} else {
return $search;
}
}
/**
* Sort columns with a query
*

View file

@ -29,7 +29,7 @@ class AssignTicketToUserRequest extends FormRequest
return [
'assign' => [
'nullable', 'exists:users,id',
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) {
/** @var \App\Models\User $user */
if ($user = User::whereId($value)->first() and !$user->isAdmin()) {

View file

@ -29,7 +29,7 @@ class ChangeTicketStatus extends FormRequest
return [
'status' => [
'required',
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) {
if (!in_array($value, TicketStatusEnum::toValues())) {
$fail(__('Veuillez choisir entre :values', [

View file

@ -26,7 +26,7 @@ class StoreCreditLogRequest extends FormRequest
{
return [
'amount' => [
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
'required', 'numeric', 'min:0', 'max:255', function ($attribute, $value, $fail) {
if (($value * 10) % 5 !== 0) {
$fail("Le Montant de l'opération doit être divisible par 0.5 jour/homme");

View file

@ -28,7 +28,7 @@ class UpdateInvoiceRequest extends StoreInvoiceRequest
'status' => [
'required',
new Enum(InvoiceStatusEnum::class),
//phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
//phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) use ($model) {
if (
(intval($value) === InvoiceStatusEnum::archived->value) &&

View file

@ -29,7 +29,7 @@ class SortTickets extends FormRequest
'sort_way' => 'sometimes|in:asc,desc',
'status' => [
'sometimes',
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) {
if (!in_array($value, TicketStatusEnum::toValues())) {
$fail(__('Veuillez choisir entre :values', [

View file

@ -60,7 +60,7 @@ class StoreTicket extends FormRequest
'site_id' => [
'required',
'exists:sites,id',
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) {
/** @var \App\Models\User */
$user = auth()->user();
@ -76,7 +76,7 @@ class StoreTicket extends FormRequest
],
'type' => [
'required',
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) {
if (!in_array($value, TicketTypeEnum::toValues())) {
$fail(__('Veuillez choisir entre :values', [
@ -87,7 +87,7 @@ class StoreTicket extends FormRequest
],
'status' => [
'required',
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) {
if (!in_array($value, TicketStatusEnum::toValues())) {
$fail(__('Veuillez choisir entre :values', [
@ -103,7 +103,7 @@ class StoreTicket extends FormRequest
'is_internal' => 'required|boolean',
'labels' => 'sometimes|array',
'labels.*' => [
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
'required', 'exists:labels,id', function ($attribute, $value, $fail) use ($user) {
if (!$user->can('assignLabels', Ticket::class)) {
$fail(trans('Vous n\'êtes pas autorisé à modifier cette valeur'));

2837
composer.lock generated

File diff suppressed because it is too large Load diff

2
package-lock.json generated
View file

@ -1,5 +1,5 @@
{
"name": "srcs",
"name": "support-web",
"lockfileVersion": 3,
"requires": true,
"packages": {

View file

@ -61,21 +61,23 @@
<div id="mainTable" cellpadding="0" cellspacing="0">
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" style="text-align: right;padding-bottom: 3mm;"><b>{{ Str::upper($lastname) }} {{ $firstname }}</b></td>
<td style="text-align: right;padding-bottom: 3mm;" colspan="2"><b>{{ Str::upper($lastname) }} {{ $firstname }}</b>
</td>
</tr>
<tr>
<td style="text-align: right;padding-right: 3mm;"><b>{{ Str::singular(__('models.classes.companies')) }}</b></td>
<td width="auto" style="white-space: nowrap;">{{ $company->name }}</td>
<td style="white-space: nowrap;" width="auto">{{ $company->name }}</td>
</tr>
<tr>
<td style="text-align: right;padding-right: 3mm;"><b>{{ __('Entité à facturer') }}</b></td>
<td width="auto" style="white-space: nowrap;">{{ $companyInvoiced->name }}</td>
<td style="white-space: nowrap;" width="auto">{{ $companyInvoiced->name }}</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td valign="middle" width="12mm" style="height: 23mm;">
<img style="width: 12mm;" src="{{ resource_path('assets/documents/invoice/logo_ldc.jpg') }}" alt="{{ trans('Logo LDC') }}" />
<td style="height: 23mm;" valign="middle" width="12mm">
<img src="{{ resource_path('assets/documents/invoice/logo_ldc.jpg') }}" alt="{{ trans('Logo LDC') }}"
style="width: 12mm;" />
</td>
<td width="50%">
<span style="font-size: 16px;font-weight: bold;">{{ __('SERVICE WEB MARKETING GROUPE') }}</span>
@ -103,116 +105,120 @@
</table>
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td height="26mm" style="text-align: center;">
<td style="text-align: center;" height="26mm">
<span style="font-size: 16px;font-weight: bold;">{{ __('Prestation WEB') }}</span>
</td>
</tr>
</table>
@php
$tasks = collect($tasks);
$columns = 2 + ( $show_days ? 1 : 0);
$page = 1;
$perPage = 8;
$lastPage = App\Lib\Helpers\CollectionHelper::paginateManually($tasks, $perPage)->lastPage();
$tasks = collect($tasks);
$columns = 2 + ($show_days ? 1 : 0);
$page = 1;
$perPage = 8;
$lastPage = App\Lib\Helpers\CollectionHelper::paginateManually($tasks, $perPage)->lastPage();
@endphp
@while($lastPage >= $page)
@php $taskList = App\Lib\Helpers\CollectionHelper::paginateManually($tasks, $perPage, $page); @endphp
@while ($lastPage >= $page)
@php $taskList = App\Lib\Helpers\CollectionHelper::paginateManually($tasks, $perPage, $page); @endphp
@if($page !== 1)
<table width="100%" style="height: 10mm;">
<tr>
<td>&nbsp;</td>
</tr>
</table>
@endif
<table width="100%" cellspacing="0" cellpadding="2" class="bordered" @if($page !==1) style="margin-top: 30mm;" @endif>
@if($page === 1)
<tr>
<td class="with-bg" style="padding-left: 2mm;"><strong>{{ __('Tâches') }}</strong></td>
@if($show_days)
<td width="22mm" class="with-bg" style="padding-left: 2mm;"><strong>{{ __('Jours') }}</strong></td>
@endif
<td width="22mm" class="with-bg" style="padding-left: 2mm;"><strong>{{ __('Montant') }}</strong></td>
</tr>
<tr style="display:none;">
<td colspan="{{ $columns }}"></td>
</tr>
@if ($page !== 1)
<table style="height: 10mm;" width="100%">
<tr>
<td>&nbsp;</td>
</tr>
</table>
@endif
@foreach($taskList as $task)
<tr>
<td valign="top" style="padding: 3mm 2mm;">
@if($task['package'] ?? 0)
<b>{{ __('Forfait : :package', [
'package' => $packages[$task['package']]->name ?? __('non existant')
]) }}</b>
<br>
@endif
{{ $task['desc'] }}
</td>
@if($show_days)
<td style="text-align: center;">{{ number_format($task['days'], 2, ',', '') }}</td>
@endif
<td style="text-align: center;">{{ number_format($task['amount'], 2, ',', '') }}</td>
</tr>
@endforeach
@for ($i = $perPage - $taskList->count(); $i > 0; $i--)
<tr>
@for ($k = $columns; $k > 0; $k--)
<td valign="top">&nbsp;</td>
@endfor
</tr>
@endfor
</table>
@php $page++; @endphp
@if($taskList->currentPage() < $taskList->lastPage())
<pagebreak>
@endif
@endwhile
<table width="100%" cellspacing="0" cellpadding="2" class="bordered">
<table class="bordered" width="100%" cellspacing="0" cellpadding="2"
@if ($page !== 1) style="margin-top: 30mm;" @endif>
@if ($page === 1)
<tr>
<td style="padding-left: 2mm;"><span style="font-size: 14px;font-weight: bold;">{{ __('Total') }}</span></td>
@if($show_days)
<td width="22mm" align="center"><strong>{{ __(':total Jours', [
'total' => number_format($total_days, 2, ',', '')
]) }}</strong></td>
<td class="with-bg" style="padding-left: 2mm;"><strong>{{ __('Tâches') }}</strong></td>
@if ($show_days)
<td class="with-bg" style="padding-left: 2mm;" width="22mm"><strong>{{ __('Jours') }}</strong></td>
@endif
<td width="22mm" align="center"><strong>{{ __(':total €', [
'total' => number_format($total, 2, ',', '')
]) }}</strong></td>
<td class="with-bg" style="padding-left: 2mm;" width="22mm"><strong>{{ __('Montant') }}</strong></td>
</tr>
</table>
@if($comment)
<br>
<div>
<span style="font-size: 13px;font-weight: bold;">{{ __('Commentaire') }}</span>
</div>
<table width="100%" cellspacing="0" cellpadding="2" class="bordered">
<tr>
<td style="padding: 2mm;">
{{-- Impossible d\'appliquer ck-content ici --}}
{!! clean($comment) !!}
</td>
<tr style="display:none;">
<td colspan="{{ $columns }}"></td>
</tr>
</table>
@endif
@foreach ($taskList as $task)
<tr>
<td style="padding: 3mm 2mm;" valign="top">
@if ($task['package'] ?? 0)
<b>{{ __('Forfait : :package', [
'package' => $packages[$task['package']]->name ?? __('non existant'),
]) }}</b>
<br>
@endif
{!! nl2br($task['desc']) !!}
</td>
@if ($show_days)
<td style="text-align: center;">{{ number_format($task['days'], 2, ',', '') }}</td>
@endif
<td style="text-align: center;">{{ number_format($task['amount'], 2, ',', '') }}</td>
</tr>
@endforeach
@for ($i = $perPage - $taskList->count(); $i > 0; $i--)
<tr>
@for ($k = $columns; $k > 0; $k--)
<td valign="top">&nbsp;</td>
@endfor
</tr>
@endfor
</table>
@php $page++; @endphp
@if ($taskList->currentPage() < $taskList->lastPage())
<pagebreak>
@endif
@endwhile
<table class="bordered" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td style="padding-left: 2mm;"><span style="font-size: 14px;font-weight: bold;">{{ __('Total') }}</span></td>
@if ($show_days)
<td width="22mm" align="center">
<strong>{{ __(':total Jours', [
'total' => number_format($total_days, 2, ',', ''),
]) }}</strong>
</td>
@endif
<td width="22mm" align="center">
<strong>{{ __(':total €', [
'total' => number_format($total, 2, ',', ''),
]) }}</strong>
</td>
</tr>
</table>
@if ($comment)
<br>
<div>
<span style="font-size: 13px;font-weight: bold;">{{ __('Commentaire') }}</span>
</div>
<table class="bordered" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td style="padding: 2mm;">
{{-- Impossible d\'appliquer ck-content ici --}}
{!! clean($comment) !!}
</td>
</tr>
</table>
@endif
</div>
<htmlpagefooter name="page-footer">
<table width="90%" cellspacing="0" cellpadding="2" style="margin: auto;margin-bottom: 10mm;">
<table style="margin: auto;margin-bottom: 10mm;" width="90%" cellspacing="0" cellpadding="2">
<tr>
<td width="33%" style="border-top:double medium #CCCCCC;padding-top: 2mm;" valign="top">
{{ __("LDC Web Service") }}<br />
<td style="border-top:double medium #CCCCCC;padding-top: 2mm;" width="33%" valign="top">
{{ __('LDC Web Service') }}<br />
</td>
<td width="33%" style="text-align: center;border-top:double medium #CCCCCC;padding-top: 2mm;" valign="top">
<td style="text-align: center;border-top:double medium #CCCCCC;padding-top: 2mm;" width="33%" valign="top">
</td>
<td valign="bottom" width="34%" style="text-align: right;border-top:double medium #CCCCCC;padding-top: 2mm;">
<td style="text-align: right;border-top:double medium #CCCCCC;padding-top: 2mm;" valign="bottom" width="34%">
<span>{{ __('page') }}&nbsp;{PAGENO}</span>
</td>
</tr>

View file

@ -5,118 +5,114 @@
@section('breadcrumb', request()->route()->getName())
@section('content')
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-3">
<div class="d-flex flex-row align-items-start">
<a href="{{ route('bo.invoices.index', ['status' => \App\Enums\Invoices\InvoiceStatusEnum::opened]) }}"
class="btn btn-primary text-decoration-none m-0 me-2"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.helpers.list_all', ['model' => __('models.classes.invoices')]) }}">
<i class="fa-solid fa-arrow-left"></i>
</a>
@include('breadcrumbs.breadcrumb-body', ['brParam' => $invoiceModel])
</div>
<div class="mb-2 mb-md-0">
<div class="btn-group" role="group">
<a class="btn btn-primary"
href="{{ route('bo.invoices.edit', ['invoice' => $invoiceModel->id]) }}"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.helpers.update_model', ['model' => __('models.classes.invoices')]) }}">
<i class="fa-solid fa-pencil"></i>
<div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap pb-3">
<div class="d-flex align-items-start flex-row">
<a class="btn btn-primary text-decoration-none m-0 me-2" data-bs-toggle="tooltip" data-bs-placement="top"
href="{{ route('bo.invoices.index', ['status' => \App\Enums\Invoices\InvoiceStatusEnum::opened]) }}"
title="{{ __('crud.helpers.list_all', ['model' => __('models.classes.invoices')]) }}">
<i class="fa-solid fa-arrow-left"></i>
</a>
@include('breadcrumbs.breadcrumb-body', ['brParam' => $invoiceModel])
</div>
<div class="mb-md-0 mb-2">
<div class="btn-group" role="group">
<a class="btn btn-primary" data-bs-toggle="tooltip" data-bs-placement="top"
href="{{ route('bo.invoices.edit', ['invoice' => $invoiceModel->id]) }}"
title="{{ __('crud.helpers.update_model', ['model' => __('models.classes.invoices')]) }}">
<i class="fa-solid fa-pencil"></i>
</a>
</div>
</div>
</div>
</div>
<table class="table table-hover table-borderless">
<tbody>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.ref')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->ref }}</td>
</tr>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.firstname')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->firstname }}</td>
</tr>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.lastname')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->lastname }}</td>
</tr>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.object')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->object }}</td>
</tr>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.tasks')) }}</td>
<td class="text-center align-middle py-0 pe-0">
<table class="table table-hover table-borderless m-0">
<tbody>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ __('Commentaire') }}</td>
<td class="text-center align-middle">{{ __('Type') }}</td>
<td class="text-center align-middle">{{ __('Jours') }}</td>
<td class="text-center align-middle">{{ __('Montant') }}</td>
</tr>
@foreach ($invoiceModel->tasks as $task)
<tr class="list-item @if(!$loop->last) border-bottom @endif">
<td class="text-center align-middle">{{ $task['desc'] }}</td>
<td class="text-center align-middle">{{ $task['type'] }}</td>
<td class="text-center align-middle">{{ $task['days'] }}</td>
<td class="text-center align-middle">{{ $task['amount'] }}</td>
</tr>
@endforeach
</tbody>
</table>
</td>
</tr>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.total')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->total }}</td>
</tr>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.total_days')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->total_days }}</td>
</tr>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.comment')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->comment }}</td>
</tr>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.show_days')) }}</td>
<td class="text-center align-middle">{{ ($invoiceModel->show_days) ? "oui" : "non" }}</td>
</tr>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.signed_date')) }}</td>
<td class="text-center align-middle"><span class="badge bg-info">{{ $invoiceModel->signed_date }}</span></td>
</tr>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.sent_client_date')) }}</td>
<td class="text-center align-middle"><span class="badge bg-info">{{ $invoiceModel->sent_client_date }}</span></td>
</tr>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.sent_accounting_date')) }}</td>
<td class="text-center align-middle"><span class="badge bg-info">{{ $invoiceModel->sent_accounting_date }}</span></td>
</tr>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.sites')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->site->name }}</td>
</tr>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.company_id')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->company->name }}</td>
</tr>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.invoiced_to_id')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->companyInvoiced->name }}</td>
</tr>
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.created_at')) }}</td>
<td class="text-center align-middle"><span class="badge bg-info">{{ $invoiceModel->created_at }}</span></td>
</tr>
<tr class="list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.updated_at')) }}</td>
<td class="text-center align-middle"><span class="badge bg-info">{{ $invoiceModel->updated_at }}</span></td>
</tr>
</tbody>
</table>
<table class="table-hover table-borderless table">
<tbody>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.ref')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->ref }}</td>
</tr>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.firstname')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->firstname }}</td>
</tr>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.lastname')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->lastname }}</td>
</tr>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.object')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->object }}</td>
</tr>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.tasks')) }}</td>
<td class="py-0 pe-0 text-center align-middle">
<table class="table-hover table-borderless m-0 table">
<tbody>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ __('Commentaire') }}</td>
<td class="text-center align-middle">{{ __('Type') }}</td>
<td class="text-center align-middle">{{ __('Jours') }}</td>
<td class="text-center align-middle">{{ __('Montant') }}</td>
</tr>
@foreach ($invoiceModel->tasks as $task)
<tr class="@if (!$loop->last) border-bottom @endif list-item">
<td class="text-center align-middle">{!! nl2br($task['desc']) !!}</td>
<td class="text-center align-middle">{{ $task['type'] }}</td>
<td class="text-center align-middle">{{ $task['days'] }}</td>
<td class="text-center align-middle">{{ $task['amount'] }}</td>
</tr>
@endforeach
</tbody>
</table>
</td>
</tr>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.total')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->total }}</td>
</tr>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.total_days')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->total_days }}</td>
</tr>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.comment')) }}</td>
<td class="text-center align-middle">{!! clean($invoiceModel->comment) !!}</td>
</tr>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.show_days')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->show_days ? 'oui' : 'non' }}</td>
</tr>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.signed_date')) }}</td>
<td class="text-center align-middle"><span class="badge bg-info">{{ $invoiceModel->signed_date }}</span></td>
</tr>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.sent_client_date')) }}</td>
<td class="text-center align-middle"><span class="badge bg-info">{{ $invoiceModel->sent_client_date }}</span></td>
</tr>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.sent_accounting_date')) }}</td>
<td class="text-center align-middle"><span class="badge bg-info">{{ $invoiceModel->sent_accounting_date }}</span></td>
</tr>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.sites')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->site->name }}</td>
</tr>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.company_id')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->company->name }}</td>
</tr>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.invoiced_to_id')) }}</td>
<td class="text-center align-middle">{{ $invoiceModel->companyInvoiced->name }}</td>
</tr>
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.created_at')) }}</td>
<td class="text-center align-middle"><span class="badge bg-info">{{ $invoiceModel->created_at }}</span></td>
</tr>
<tr class="list-item">
<td class="text-center align-middle">{{ Str::ucfirst(__('validation.attributes.updated_at')) }}</td>
<td class="text-center align-middle"><span class="badge bg-info">{{ $invoiceModel->updated_at }}</span></td>
</tr>
</tbody>
</table>
@endsection

View file

@ -176,7 +176,7 @@
@if ($message->file !== null)
<br><a @if(\App\Lib\Helpers\ToolboxHelper::isImageFile($message->file))data-fslightbox="gallery" @endif href="{{ asset($message->file) }}" target="_blank">Ouvrir la pièce jointe</a><br>
@endif<br><br>
<small class="text-bg-dark fw-bold">
<small class="@if($message->user_id === Auth::user()->id)text-bg-dark @else text-body-secondary @endif fw-bold">
{!! __('Créé le :date par <b>:userName</b>', [
'date' => \Carbon\Carbon::parse($message->created_at)->format('d/m/Y à H:i'),
'userName' => $message->user ? $message->user->name : __('Utilisateur supprimé')

View file

@ -8,9 +8,11 @@
<div class="form-group mb-5">
<label for="creditAccount"><b>{{ __('Compte à débiter') }}</b></label>
<select class="form-select" name="credit_account_id" id="creditAccount" aria-describedby="creditAccountHelp">
<option value="" @if(!old('credit_account_id')) selected @endif disabled>{{ __('Veuillez sélectionner un compte à débiter') }}</option>
<option value="" @selected(!old('credit_account_id')) disabled>{{ __('Veuillez sélectionner un compte à débiter') }}</option>
@foreach($ticket->site->brand->accounts as $account)
<option value="{{ $account->id }}" @if(old('credit_account_id') == $account->id) selected @endif>{{ $account->label }}</option>
<option value="{{ $account->id }}" @selected(old('credit_account_id') === $account->id)>
<?= sprintf('%s &nbsp;&nbsp; (Solde restant: %s)', $account->label, number_format($account->balance, 2, ',', ' ')); ?>
</option>
@endforeach
</select>
@include('modules.input-error', [