Fix: Invoices new lines are now displayed

This commit is contained in:
Noah Lancien 2024-06-11 09:45:12 +02:00
parent 704551c165
commit 5128ba471b
3 changed files with 206 additions and 204 deletions

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