ldc-crm/resources/views/bo/modules/claim-tools.blade.php

56 lines
2.9 KiB
PHP

@php
$selectedSubject = request()->subject ?? (isset($modelTable) ? Session::get("crud.$modelTable.subject") : null);
@endphp
<div class="row align-items-center mb-3">
<div class="col-1">
<button class="btn btn-primary d-flex flex-column" id="export-btn" data-bs-toggle="modal" data-bs-target="#exportModal" data-bs-claim-list="@json($claimModels->pluck('id')->toArray())">
<i class="fa-solid fa-file-export"></i>
{{ __('Exporter')}}
</button>
</div>
@if (!empty($claimSubjectModels))
<div class="col-3 offset-8">
<form action="{{ request()->fullUrlWithQuery(['rstFltrs' => null]) }}" class="row gx-2 mb-2">
{{-- SUBJECT SELECT --}}
<select class="form-select mb-1 mb-lg-0"
id="subjectSelect" role="button" name="subject">
<option value="0" @selected(!$selectedSubject)>{{ __('Sélectionnez un sujet...') }}</option>
@foreach ($claimSubjectModels as $claimSubjectModel)
<option value="{{ $claimSubjectModel->getKey() }}" @selected($selectedSubject == $claimSubjectModel->getKey())>
{{ $claimSubjectModel->label }}
</option>
@endforeach
</select>
</form>
</div>
@endif
</div>
{{-- EXPORT MODAL --}}
<div class="modal fade" id="exportModal" tabindex="-1" aria-labelledby="exportModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title fs-5" id="exportModalLabel">{{ __('Exporter les réclamations')}}</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
@foreach(\App\Enums\ExportFormat::cases() as $supportedFormat)
<form action="{{ route('bo.claims.export', ['format' => $supportedFormat->name]) }}" class="row gx-2 mb-2" method="POST">
@csrf
<input hidden name="format" value="{{ $supportedFormat }}">
<input hidden class="claim-list-input" name="claimList" value="">
<button class="btn btn-{{ $supportedFormat->class()}} d-flex flex-column" id="export-{{ $supportedFormat->name }}" type="submit">
<i class="{{ $supportedFormat->picto() }}"></i>
{{ __('Exporter en .:format', ['format' => $supportedFormat->label()])}}
</button>
</form>
@endforeach
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ __('Fermer')}}</button>
</div>
</div>
</div>
</div>