feat: Update Ticket UI/UX
This commit is contained in:
parent
99744045e9
commit
e06558d8c6
11 changed files with 302 additions and 228 deletions
|
|
@ -27,11 +27,11 @@ use App\Models\User;
|
|||
use GrahamCampbell\GitLab\Facades\GitLab;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class TicketController extends Controller
|
||||
{
|
||||
|
|
@ -107,8 +107,12 @@ class TicketController extends Controller
|
|||
$tickets = $this->customPaginate($tickets, $request->pagination);
|
||||
|
||||
$sites = Site::select('id', 'name')->orderBy('name')->get();
|
||||
$status = TicketStatusEnum::cases();
|
||||
$types = TicketTypeEnum::cases();
|
||||
$status = Arr::sort(TicketStatusEnum::cases(), function (TicketStatusEnum $value) {
|
||||
return $value->label();
|
||||
});
|
||||
$types = Arr::sort(TicketTypeEnum::cases(), function (TicketTypeEnum $value) {
|
||||
return $value->label();
|
||||
});
|
||||
|
||||
return view('bo.pages.tickets.index', compact('tickets', 'sites', 'status', 'types'));
|
||||
}
|
||||
|
|
@ -609,8 +613,6 @@ class TicketController extends Controller
|
|||
|
||||
if (Session::has('tickets.or')) {
|
||||
$tickets->orderBy('order', 'ASC');
|
||||
} else {
|
||||
$tickets->orderBy('last_activity', 'DESC');
|
||||
}
|
||||
|
||||
return $tickets;
|
||||
|
|
|
|||
|
|
@ -148,8 +148,8 @@ class User extends Authenticatable
|
|||
*/
|
||||
public static function adminUsers(): Collection
|
||||
{
|
||||
return Cache::rememberForever('AdminUsers', function () {
|
||||
return self::whereIn('role', [RoleEnum::admin, RoleEnum::developper])->get();
|
||||
return Cache::remember('AdminUsers', 86400, function () {
|
||||
return self::whereIn('role', [RoleEnum::admin, RoleEnum::developper])->orderBy('name')->get();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use App\Enums\Tickets\TicketTypeEnum;
|
|||
use App\Enums\Users\RoleEnum;
|
||||
use App\Models\Ticket;
|
||||
use App\Models\User;
|
||||
use Error;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class TicketPolicy
|
||||
|
|
@ -287,4 +288,18 @@ class TicketPolicy
|
|||
&& !\is_null($ticket->site->gitlab_project_id)
|
||||
&& \is_null($ticket->gitlab_issue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine if the user can changeOrder
|
||||
*
|
||||
* @param User $user
|
||||
* @return bool
|
||||
* @throws Error
|
||||
*/
|
||||
public function changeOrder(User $user)
|
||||
{
|
||||
return $user->role->equals(RoleEnum::developper);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class TranslationServiceProvider extends ServiceProvider
|
|||
{
|
||||
foreach ($this->collectLocalesStrings() as $locale) {
|
||||
// * Supported locales
|
||||
Cache::rememberForever(sprintf('translations.%s', $locale), function () use ($locale) {
|
||||
Cache::remember(sprintf('translations.%s', $locale), 84600, function () use ($locale) {
|
||||
$translations = [
|
||||
'php' => $this->phpTranslations($locale),
|
||||
'json' => $this->jsonTranslations($locale),
|
||||
|
|
|
|||
|
|
@ -221,7 +221,6 @@ return [
|
|||
'order' => 'order',
|
||||
'priority' => 'priority',
|
||||
'default' => 'default',
|
||||
'date_mep' => 'desired MEP date',
|
||||
'date_mep_empty' => 'no date entered'
|
||||
'date_mep' => 'Desired Launch'
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -56,5 +56,6 @@
|
|||
"Whoops!": "Oups !",
|
||||
"You are logged in!": "Vous êtes connecté·e !",
|
||||
"You are receiving this email because we received a password reset request for your account.": "Vous recevez cet e-mail car nous avons reçu une demande de réinitialisation de mot de passe pour votre compte.",
|
||||
"see_mode": "voir mode :mode"
|
||||
"see_mode": "voir mode :mode",
|
||||
"Website": "Site"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -257,7 +257,6 @@ return [
|
|||
'order' => 'ordre',
|
||||
'priority' => 'priorité',
|
||||
'default' => 'défaut',
|
||||
'date_mep' => 'date de MEP souhaitée',
|
||||
'date_mep_empty' => 'aucune date renseignée'
|
||||
'date_mep' => 'MEP souhaitée'
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
.container-xxl {
|
||||
max-width: 1340px !important;
|
||||
max-width: 1600px !important;
|
||||
}
|
||||
|
||||
#app {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
<td class="text-center align-middle">
|
||||
@if (isset($value))
|
||||
{{ $value }}
|
||||
@endif
|
||||
<b>{{ $value ?? '' }}</b>
|
||||
@can('changeOrder', $model)
|
||||
<div class="d-flex justify-content-center align-items-center">
|
||||
<form @class(['invisible' => $loop->first and $models->onFirstPage()])
|
||||
|
|
|
|||
|
|
@ -9,69 +9,48 @@
|
|||
$userPr = Auth::user()->sites ?? collect([]);
|
||||
@endphp
|
||||
<div class="container-xxl container">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1 class="fw-bold">{{ __('Tickets') }}
|
||||
@if (Session::get('tickets.st') == \App\Enums\Tickets\TicketStatusEnum::archived->value)
|
||||
(Archivés)
|
||||
@endif
|
||||
</h1>
|
||||
</div>
|
||||
<div class="col">
|
||||
<a class="btn btn-primary float-end" href="{{ route('bo.ticket.create') }}">
|
||||
<i class="fa-solid fa-square-plus"></i> {{ __('ticket') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2 class="d-inline">
|
||||
{{ __('Gestion des tickets') }}
|
||||
@if (Session::get('tickets.st') == \App\Enums\Tickets\TicketStatusEnum::archived->value)
|
||||
(Archivés)
|
||||
@endif
|
||||
</h2>
|
||||
<div class="float-end">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="btn-group float-end">
|
||||
@can('isAdmin')
|
||||
<a class="btn btn-info" href="{{ route('bo.labels.index') }}"><i class="fa-solid fa-tags"></i></a>
|
||||
@endcan
|
||||
<a class="btn btn-primary" href="{{ route('bo.ticket.create') }}">
|
||||
<i class="fa-solid fa-square-plus"></i> {{ __('ticket') }}
|
||||
</a>
|
||||
@if (session('tickets.pr') && session('tickets.st') != \App\Enums\Tickets\TicketStatusEnum::archived->value)
|
||||
@if (session('tickets.or'))
|
||||
<a class="btn btn-info float-end" href="{{ route('bo.ticket.index', ['ord' => -1]) }}">
|
||||
<i class="fa-solid fa-equals"></i> {{ __('see_mode', ['mode' => __('validation.custom.default')]) }}
|
||||
</a>
|
||||
@else
|
||||
<a class="btn btn-danger" href="{{ route('bo.ticket.index', ['or' => 1]) }}">
|
||||
<i class="fa-solid fa-triangle-exclamation"></i> {{ __('see_mode', ['mode' => __('validation.custom.priority')]) }}
|
||||
</a>
|
||||
@endif
|
||||
@endif
|
||||
@if (session('tickets.st') == \App\Enums\Tickets\TicketStatusEnum::archived->value)
|
||||
<a class="btn btn-success" href="{{ route('bo.ticket.index', ['sts' => -1]) }}">
|
||||
<i class="fa-solid fa-inbox"></i>
|
||||
</a>
|
||||
@else
|
||||
<a class="btn btn-secondary float-end"
|
||||
href="{{ route('bo.ticket.index', ['st' => \App\Enums\Tickets\TicketStatusEnum::archived]) }}">
|
||||
<i class="fa-solid fa-box-archive"></i>
|
||||
</a>
|
||||
@endif
|
||||
<a class="btn btn-dark" href="{{ route('bo.ticket.index', ['rst' => 1]) }}">
|
||||
<i class="fa-solid fa-eraser"></i> {{ __(' le tri') }}
|
||||
</a>
|
||||
</div>
|
||||
<div class="float-end me-2">
|
||||
<div class="row mt-3">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
{{-- All sites --}}
|
||||
<div class="col">
|
||||
<div class="input-group">
|
||||
<label class="input-group-text" for="selectProject">
|
||||
<i class="fa-solid fa-diagram-project"></i>
|
||||
</label>
|
||||
<select class="form-select" id="selectProject">
|
||||
<option value="-1">{{ __('Tous') }}</option>
|
||||
<option value="-1">{{ __('Tous les sites') }}</option>
|
||||
@foreach ($sites as $site)
|
||||
@if (Auth::user()->isAdmin())
|
||||
<option value="{{ $site->id }}"
|
||||
@if (intval(session('tickets.pr')) == $site->id) selected="selected" @endif>{{ $site->name }}
|
||||
@if (intval(session('tickets.pr')) == $site->id) selected="selected" @endif>
|
||||
{{ $site->name }}
|
||||
</option>
|
||||
@elseif (
|
||||
$userPr->filter(function ($pr) use ($site) {
|
||||
return $pr->id === $site->id;
|
||||
})->count())
|
||||
<option value="{{ $site->id }}"
|
||||
@if (intval(session('tickets.pr')) == $site->id) selected="selected" @endif>{{ $site->name }}
|
||||
@if (intval(session('tickets.pr')) == $site->id) selected="selected" @endif>
|
||||
{{ $site->name }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
|
|
@ -79,102 +58,144 @@
|
|||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.getElementById('selectProject').addEventListener('change', function(e) {
|
||||
window.location = '{{ route('bo.ticket.index') }}?' + (this.value == -1 ? 'prs=-1' : 'pr=' + this.value);
|
||||
window.location = '{{ route('bo.ticket.index') }}?' + (this.value == -1 ? 'prs=-1' : 'pr=' + this
|
||||
.value);
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
</div>
|
||||
</div>
|
||||
<div class="float-end me-2">
|
||||
<div class="input-group">
|
||||
<label class="input-group-text" for="selectStatus"><i class="fa-solid fa-sign-hanging"></i></label>
|
||||
<select class="form-select" id="selectStatus">
|
||||
<option value="-1">{{ __('Tous') }}</option>
|
||||
@foreach ($status as $statut)
|
||||
<option value="{{ $statut->value }}"
|
||||
@if (intval(session('tickets.st')) == $statut->value) selected="selected" @endif>{{ $statut->label() }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.getElementById('selectStatus').addEventListener('change', function(e) {
|
||||
window.location = '{{ route('bo.ticket.index') }}?' + (this.value == -1 ? 'sts=-1' : 'st=' + this.value);
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@can('assignTickets', App\Models\Ticket::class)
|
||||
{{-- All types --}}
|
||||
<div class="col">
|
||||
<div class="float-end me-2 mt-3">
|
||||
<div class="input-group">
|
||||
<label class="input-group-text" for="selectAssign"><i class="fa-solid fa-hat-wizard"></i></label>
|
||||
<select class="form-select" id="selectAssign">
|
||||
<option value="-1">{{ __('Tous') }}</option>
|
||||
@foreach (\App\Models\User::adminUsers() as $user)
|
||||
<option value="{{ $user->id }}"
|
||||
@if (intval(session('tickets.ass')) == $user->id) selected="selected" @endif>{{ $user->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.getElementById('selectAssign').addEventListener('change', function(e) {
|
||||
window.location = '{{ route('bo.ticket.index') }}?' + (this.value == -1 ? 'assr=-1' : 'ass=' + this.value);
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endcan
|
||||
<div class="col">
|
||||
<div class="float-end me-2 mt-3">
|
||||
<div class="input-group">
|
||||
<label class="input-group-text" for="selectType"><i class="fa-solid fa-ticket"></i></label>
|
||||
<label class="input-group-text" for="selectType"><i
|
||||
class="fa-solid fa-ticket"></i></label>
|
||||
<select class="form-select" id="selectType">
|
||||
<option value="-1">{{ __('Tous les types') }}</option>
|
||||
@foreach ($types as $type)
|
||||
<option value="{{ $type->value }}"
|
||||
@if (intval(session('tickets.ty')) == $type->value) selected="selected" @endif>{{ $type->label() }}
|
||||
@if (intval(session('tickets.ty')) == $type->value) selected="selected" @endif>
|
||||
{{ $type->label() }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.getElementById('selectType').addEventListener('change', function(e) {
|
||||
window.location = '{{ route('bo.ticket.index') }}?' + (this.value == -1 ? 'tys=-1' : 'ty=' + this.value);
|
||||
window.location = '{{ route('bo.ticket.index') }}?' + (this.value == -1 ? 'tys=-1' : 'ty=' + this
|
||||
.value);
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<form class="float-end mt-3" id="searchTicketForm"
|
||||
action="{{ request()->fullUrlWithQuery(['search' => '']) }}">
|
||||
<div class="input-group mb-3">
|
||||
<input class="form-control" id="searchTicket" name="search" type="text"
|
||||
value="{{ session()->get('tickets.search') }}" aria-label="{{ __('Recherche de ticket...') }}"
|
||||
aria-describedby="searchTicket" placeholder="{{ __('Recherche de ticket...') }}">
|
||||
<button class="btn btn-outline-danger" id="searchDelete" type="button"><i
|
||||
class="fa-solid fa-delete-left"></i></button>
|
||||
<button class="btn btn-outline-primary" type="submit"><i
|
||||
class="fa-solid fa-magnifying-glass"></i></button>
|
||||
{{-- All status --}}
|
||||
<div class="col">
|
||||
<div class="input-group">
|
||||
<label class="input-group-text" for="selectStatus"><i
|
||||
class="fa-solid fa-sign-hanging"></i></label>
|
||||
<select class="form-select" id="selectStatus">
|
||||
<option value="-1">{{ __('Tous les statuts') }}</option>
|
||||
@foreach ($status as $statut)
|
||||
<option value="{{ $statut->value }}"
|
||||
@if (intval(session('tickets.st')) == $statut->value) selected="selected" @endif>
|
||||
{{ $statut->label() }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.getElementById('selectStatus').addEventListener('change', function(e) {
|
||||
window.location = '{{ route('bo.ticket.index') }}?' + (this.value == -1 ? 'sts=-1' : 'st=' + this
|
||||
.value);
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
</div>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.getElementById('searchDelete').addEventListener('click', function(e) {
|
||||
document.getElementById('searchTicket').value = '';
|
||||
document.getElementById('searchTicketForm').submit();
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
</form>
|
||||
</div>
|
||||
{{-- All assigned to --}}
|
||||
@can('assignTickets', App\Models\Ticket::class)
|
||||
<div class="col">
|
||||
<div class="input-group">
|
||||
<label class="input-group-text" for="selectAssign"><i
|
||||
class="fa-solid fa-hat-wizard"></i></label>
|
||||
<select class="form-select" id="selectAssign">
|
||||
<option value="-1">{{ __("Sans filtre d'assignation") }}</option>
|
||||
@foreach (\App\Models\User::adminUsers() as $user)
|
||||
<option value="{{ $user->id }}"
|
||||
@if (intval(session('tickets.ass')) == $user->id) selected="selected" @endif>
|
||||
{{ $user->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.getElementById('selectAssign').addEventListener('change', function(e) {
|
||||
window.location = '{{ route('bo.ticket.index') }}?' + (this.value == -1 ? 'assr=-1' : 'ass=' + this
|
||||
.value);
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
</div>
|
||||
</div>
|
||||
@endcan
|
||||
{{-- Search form --}}
|
||||
<div class="col">
|
||||
<form id="searchTicketForm"
|
||||
action="{{ request()->fullUrlWithQuery(['search' => '']) }}">
|
||||
<div class="input-group mb-3">
|
||||
<input class="form-control" id="searchTicket" name="search" type="text"
|
||||
value="{{ session()->get('tickets.search') }}"
|
||||
aria-label="{{ __('Recherche de ticket...') }}" aria-describedby="searchTicket"
|
||||
placeholder="{{ __('Recherche de ticket...') }}">
|
||||
<button class="btn btn-outline-danger" id="searchDelete" type="button"><i
|
||||
class="fa-solid fa-delete-left"></i></button>
|
||||
<button class="btn btn-outline-primary" type="submit"><i
|
||||
class="fa-solid fa-magnifying-glass"></i></button>
|
||||
</div>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.getElementById('searchDelete').addEventListener('click', function(e) {
|
||||
document.getElementById('searchTicket').value = '';
|
||||
document.getElementById('searchTicketForm').submit();
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="btn-group float-end">
|
||||
@if (session('tickets.pr') && session('tickets.st') != \App\Enums\Tickets\TicketStatusEnum::archived->value)
|
||||
@if (session('tickets.or'))
|
||||
<a class="btn btn-info float-end"
|
||||
href="{{ route('bo.ticket.index', ['ord' => -1]) }}">
|
||||
<i
|
||||
class="fa-solid fa-equals"></i> {{ __('see_mode', ['mode' => __('validation.custom.default')]) }}
|
||||
</a>
|
||||
@else
|
||||
<a class="btn btn-danger" href="{{ route('bo.ticket.index', ['or' => 1]) }}">
|
||||
<i
|
||||
class="fa-solid fa-triangle-exclamation"></i> {{ __('see_mode', ['mode' => __('validation.custom.priority')]) }}
|
||||
</a>
|
||||
@endif
|
||||
@endif
|
||||
@if (session('tickets.st') == \App\Enums\Tickets\TicketStatusEnum::archived->value)
|
||||
<a class="btn btn-success" href="{{ route('bo.ticket.index', ['sts' => -1]) }}">
|
||||
<i class="fa-solid fa-inbox"></i>
|
||||
</a>
|
||||
@else
|
||||
<a class="btn btn-secondary float-end"
|
||||
href="{{ route('bo.ticket.index', ['st' => \App\Enums\Tickets\TicketStatusEnum::archived]) }}">
|
||||
<i class="fa-solid fa-box-archive"></i>
|
||||
</a>
|
||||
@endif
|
||||
<a class="btn btn-dark" href="{{ route('bo.ticket.index', ['rst' => 1]) }}">
|
||||
<i class="fa-solid fa-eraser"></i> {{ __(' le tri') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -187,13 +208,21 @@
|
|||
$cols = [];
|
||||
if (session('tickets.or')) {
|
||||
$cols = array_merge($cols, [
|
||||
'order' => Str::ucfirst(__('validation.custom.priority'))
|
||||
'order' => Str::ucfirst(__('validation.custom.priority')),
|
||||
]);
|
||||
}
|
||||
$cols = array_merge($cols, [
|
||||
'id' => '#',
|
||||
]);
|
||||
if (!session()->has('tickets.pr') && !session('tickets.or')) {
|
||||
$cols = array_merge($cols, [
|
||||
'site' => Str::ucfirst(__('Website')),
|
||||
]);
|
||||
}
|
||||
$cols = array_merge($cols, [
|
||||
'id' => Str::ucfirst(__('validation.attributes.id')),
|
||||
'title' => Str::ucfirst(__('validation.attributes.name')),
|
||||
'type' => Str::ucfirst(__('validation.custom.type')),
|
||||
'status' => Str::ucfirst(__('validation.attributes.status')),
|
||||
'title' => Str::ucfirst(__('validation.attributes.name')),
|
||||
]);
|
||||
if (Auth::user()->isAdmin()) {
|
||||
$cols = array_merge($cols, [
|
||||
|
|
@ -208,13 +237,16 @@
|
|||
@endphp
|
||||
@include('bo.modules.table-col-sorter', [
|
||||
'cols' => $cols,
|
||||
'ignore' => ['id', 'tickets'],
|
||||
'ignore' => session('tickets.or')
|
||||
? array_keys($cols)
|
||||
: ['id', 'site', 'status', 'tickets'],
|
||||
])
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (!count($tickets))
|
||||
<tr>
|
||||
<td class="text-center" colspan="@if (Auth::user()->isAdmin()) 6 @else 5 @endif">
|
||||
<td class="text-center"
|
||||
colspan="@if (Auth::user()->isAdmin()) 9 @else 6 @endif">
|
||||
<h2>{{ __('Aucun ticket') }}</h2>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -227,26 +259,45 @@
|
|||
'routeName' => 'ticket',
|
||||
'model' => $ticket,
|
||||
'models' => $tickets,
|
||||
'value' => $key + 1,
|
||||
'value' => ($key + 1) + (($tickets->currentPage() - 1) * $tickets->perPage()),
|
||||
'noRightsVisible' => false,
|
||||
])
|
||||
@endif
|
||||
{{-- id --}}
|
||||
<td scope="row">
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="me-1">{{ $ticket->id }} @if ($ticket->is_internal)
|
||||
<div class="d-flex justify-content-center">
|
||||
<span>{{ $ticket->id }}
|
||||
@if ($ticket->is_internal)
|
||||
<i class="fa-solid fa-lock"></i>
|
||||
@endif
|
||||
</span>
|
||||
<span class="d-flex flex-column text-end">
|
||||
</div>
|
||||
</td>
|
||||
@if (!session()->has('tickets.pr') && !session('tickets.or'))
|
||||
{{-- site --}}
|
||||
<td scope="row">
|
||||
<div class="d-flex justify-content-center">
|
||||
@if (Auth::user()->isAdmin())
|
||||
<a href="{{ route('bo.sites.show', $ticket->site) }}"
|
||||
title="{{ __('Voir le site :sitename', [
|
||||
'sitename' => $ticket->site->name,
|
||||
]) }}">{{ $ticket->site->name }}</a>
|
||||
@else
|
||||
<span class="text-decoration-underline">{{ $ticket->site->name }}</span>
|
||||
<span
|
||||
class="text-decoration-underline">{{ $ticket->site->name }}</span>
|
||||
@endif
|
||||
</div>
|
||||
</td>
|
||||
@endif
|
||||
{{-- type --}}
|
||||
<td class="text-center">
|
||||
<span
|
||||
class="badge {{ $ticket->type->class() }}">{{ $ticket->type->label() }}</span>
|
||||
</td>
|
||||
{{-- status --}}
|
||||
<td scope="row">
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="d-flex flex-column">
|
||||
<span class="{{ $ticket->status->class() }} rounded text-center">
|
||||
{{ $ticket->status->label() }}
|
||||
</span>
|
||||
|
|
@ -254,13 +305,9 @@
|
|||
</div>
|
||||
</td>
|
||||
{{-- title --}}
|
||||
<td class="text-center">
|
||||
<td>
|
||||
<span class="me-1">{{ $ticket->title }}</span>
|
||||
</td>
|
||||
{{-- type --}}
|
||||
<td class="text-center">
|
||||
<span class="badge {{ $ticket->type->class() }}">{{ $ticket->type->label() }}</span>
|
||||
</td>
|
||||
{{-- tag --}}
|
||||
@php
|
||||
$routeName = request()->route()->getName();
|
||||
|
|
@ -277,10 +324,11 @@
|
|||
@endcan
|
||||
{{-- assigned_to / date_mep --}}
|
||||
@if (Auth::user()->isAdmin())
|
||||
<td>{{ $ticket->assignedUser ? $ticket->assignedUser->name : __('Personne') }}</td>
|
||||
<td>{{ $ticket->assignedUser ? $ticket->assignedUser->name : __('Personne') }}
|
||||
</td>
|
||||
@endif
|
||||
<td class="text-center">
|
||||
{{ is_null($ticket->date_mep) ? Str::ucfirst(__("validation.custom.date_mep_empty")) : $ticket->date_mep->format('d/m/Y') }}
|
||||
{{ is_null($ticket->date_mep) ? '-' : $ticket->date_mep->format('d/m/Y') }}
|
||||
</td>
|
||||
<td>{{ Carbon\Carbon::parse($ticket->created_at)->format('d/m/Y à H:i') }}</td>
|
||||
<td>
|
||||
|
|
@ -291,88 +339,97 @@
|
|||
$ticket_files = $ticket->getFiles();
|
||||
@endphp
|
||||
@foreach ($ticket_files as $key => $file)
|
||||
@if ($file !== null && (\App\Lib\Helpers\ToolboxHelper::isImageFile($file) || \App\Lib\Helpers\ToolboxHelper::isPdfFile($file)))
|
||||
@if (
|
||||
$file !== null &&
|
||||
(\App\Lib\Helpers\ToolboxHelper::isImageFile($file) || \App\Lib\Helpers\ToolboxHelper::isPdfFile($file)))
|
||||
<a class="glightbox btn btn-outline-dark"
|
||||
data-gallery="gallery{{ $ticket->id }}" href="{{ asset($file) }}"
|
||||
target="_blank"><i class="fa-solid fa-file-image"></i>
|
||||
data-gallery="gallery{{ $ticket->id }}"
|
||||
href="{{ asset($file) }}" target="_blank"><i
|
||||
class="fa-solid fa-file-image"></i>
|
||||
</a>
|
||||
@break
|
||||
@break
|
||||
@endif
|
||||
@endforeach
|
||||
{{-- Modal du ticket --}}
|
||||
<!-- Button trigger modal -->
|
||||
<button class="btn btn-outline-info" data-bs-toggle="modal"
|
||||
data-bs-target="#ticket{{ $ticket->id }}Modal"
|
||||
type="button"><i class="fa-solid fa-eye"></i></button>
|
||||
<a class="btn btn-outline-success"
|
||||
href="{{ route('bo.ticket.show', $ticket->id) }}"><i
|
||||
class="fa-solid fa-comment"></i></a>
|
||||
@if (auth()->user()->isAdmin())
|
||||
<a class="btn btn-outline-primary"
|
||||
href="{{ route('bo.ticket.edit', $ticket) }}"><i
|
||||
class="fa-solid fa-pen"></i></a>
|
||||
@endif
|
||||
@endforeach
|
||||
{{-- Modal du ticket --}}
|
||||
<!-- Button trigger modal -->
|
||||
<button class="btn btn-outline-info" data-bs-toggle="modal"
|
||||
data-bs-target="#ticket{{ $ticket->id }}Modal" type="button"><i
|
||||
class="fa-solid fa-eye"></i></button>
|
||||
<a class="btn btn-outline-success"
|
||||
href="{{ route('bo.ticket.show', $ticket->id) }}"><i
|
||||
class="fa-solid fa-comment"></i></a>
|
||||
@if (auth()->user()->isAdmin())
|
||||
<a class="btn btn-outline-primary"
|
||||
href="{{ route('bo.ticket.edit', $ticket) }}"><i
|
||||
class="fa-solid fa-pen"></i></a>
|
||||
@endif
|
||||
@can('changeStatus', $ticket)
|
||||
@if (!$ticket->status->equals(\App\Enums\Tickets\TicketStatusEnum::archived))
|
||||
<form class="confirmJS" method="POST"
|
||||
action="{{ route('bo.ticket.archive', $ticket) }}">
|
||||
@method('PUT')
|
||||
@csrf
|
||||
<button class="btn btn-outline-danger rounded-0 rounded-end" type="submit"><i
|
||||
class="fa-solid fa-box-archive"></i></button>
|
||||
</form>
|
||||
@endif
|
||||
@endcan
|
||||
@can('changeStatus', $ticket)
|
||||
@if (!$ticket->status->equals(\App\Enums\Tickets\TicketStatusEnum::archived))
|
||||
<form class="confirmJS" method="POST"
|
||||
action="{{ route('bo.ticket.archive', $ticket) }}">
|
||||
@method('PUT')
|
||||
@csrf
|
||||
<button
|
||||
class="btn btn-outline-danger rounded-0 rounded-end"
|
||||
type="submit"><i
|
||||
class="fa-solid fa-box-archive"></i></button>
|
||||
</form>
|
||||
@endif
|
||||
@endcan
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="ticket{{ $ticket->id }}Modal"
|
||||
aria-labelledby="ticket{{ $ticket->id }}ModalLabel" aria-hidden="true" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="ticket{{ $ticket->id }}ModalLabel">
|
||||
@can('isAdmin')
|
||||
<a href="{{ route('bo.sites.show', $ticket->site) }}"
|
||||
title="{{ __('Voir le site :sitename', [
|
||||
'sitename' => $ticket->site->name,
|
||||
]) }}"><b>{{ $ticket->site->name }}</b></a>
|
||||
@else
|
||||
<b>{{ $ticket->site->name }}</b>
|
||||
@endcan -
|
||||
<u>
|
||||
{{ __('Ticket n°') }} {{ $ticket->id }}
|
||||
@if ($ticket->is_internal)
|
||||
<i class="fa-solid fa-lock"></i>
|
||||
@endif
|
||||
</u> -
|
||||
<span class="badge {{ $ticket->type->class() }}">
|
||||
{{ $ticket->type->label() }}
|
||||
</span>
|
||||
</h5>
|
||||
<button class="btn btn-sm btn-primary bg-primary" data-bs-dismiss="modal"
|
||||
type="button" aria-label="Close">
|
||||
<i class="fa-solid fa-xmark text-white"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@can('assignLabels', App\Models\Ticket::class)
|
||||
<div class="mb-3 mt-1">
|
||||
@foreach ($ticket->labels as $label)
|
||||
<span class="badge label colorize"
|
||||
data-color="{{ $label->color }}">{{ $label->name }}</span>
|
||||
@endforeach
|
||||
</div>
|
||||
@endcan
|
||||
<p>{!! clean(nl2br($ticket->text)) !!}</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-sm btn-primary" data-bs-dismiss="modal"
|
||||
type="button">{{ __('Fermer') }}</button>
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="ticket{{ $ticket->id }}Modal"
|
||||
aria-labelledby="ticket{{ $ticket->id }}ModalLabel"
|
||||
aria-hidden="true" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"
|
||||
id="ticket{{ $ticket->id }}ModalLabel">
|
||||
@can('isAdmin')
|
||||
<a href="{{ route('bo.sites.show', $ticket->site) }}"
|
||||
title="{{ __('Voir le site :sitename', [
|
||||
'sitename' => $ticket->site->name,
|
||||
]) }}"><b>{{ $ticket->site->name }}</b></a>
|
||||
@else
|
||||
<b>{{ $ticket->site->name }}</b>
|
||||
@endcan -
|
||||
<u>
|
||||
{{ __('Ticket n°') }} {{ $ticket->id }}
|
||||
@if ($ticket->is_internal)
|
||||
<i class="fa-solid fa-lock"></i>
|
||||
@endif
|
||||
</u> -
|
||||
<span class="badge {{ $ticket->type->class() }}">
|
||||
{{ $ticket->type->label() }}
|
||||
</span>
|
||||
</h5>
|
||||
<button class="btn btn-sm btn-primary bg-primary"
|
||||
data-bs-dismiss="modal" type="button"
|
||||
aria-label="Close">
|
||||
<i class="fa-solid fa-xmark text-white"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@can('assignLabels', App\Models\Ticket::class)
|
||||
<div class="mb-3 mt-1">
|
||||
@foreach ($ticket->labels as $label)
|
||||
<span class="badge label colorize"
|
||||
data-color="{{ $label->color }}">{{ $label->name }}</span>
|
||||
@endforeach
|
||||
</div>
|
||||
@endcan
|
||||
<p>{!! clean(nl2br($ticket->text)) !!}</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-sm btn-primary"
|
||||
data-bs-dismiss="modal"
|
||||
type="button">{{ __('Fermer') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
|
@ -385,5 +442,5 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@
|
|||
@can('isAdmin')
|
||||
<a class="dropdown-item @if(Route::is('bo.ticket_types.*'))active @endif" href="{{ route('bo.ticket_types.index') }}">{{ trans_choice('models.classes.ticket_types', 2) }}</a>
|
||||
@endcan
|
||||
@can('isAdmin')
|
||||
<a class="dropdown-item @if(Route::is('bo.labels.*'))active @endif"href="{{ route('bo.labels.index') }}">{{ __('models.classes.labels') }}</a>
|
||||
@endcan
|
||||
</div>
|
||||
</li>
|
||||
@endcan
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue