@extends('layouts.app')
@section('content')
<div class="container my-5 body-content">
<div class="row">
<div class="col-lg-3 col-sm-12">
@include('account.sidebar')
</div>
<div class="col-lg-9 col-sm-12">
<div class="card">
<h5 class="card-header">{{ __('Tickets') }}
<span class="float-end">
<a href="{{ route('account.tickets.create') }}" class="btn btn-sm btn-primary">
<span class="fa fa-plus"></span> {{ __('Add') }}
</a>
</span>
</h5>
<div class="card-body">
<table class="table table-sm">
<thead class="thead-dark">
<tr>
<th scope="col">{{ __('Ticket number') }}</th>
<th scope="col">{{ __('Title') }}</th>
<th scope="col">{{ __('Priority') }}</th>
<th scope="col">{{ __('Status') }}</th>
<th scope="col">{{ __('Edit date') }}</th>
<th scope="col">{{ __('Actions') }}</th>
</tr>
</thead>
<tbody>
@foreach($tickets as $ticket)
<tr>
<td>{{ $ticket->slug }}</td>
<td>{{ $ticket->title }}</td>
<td>
<span class="badge bg-{{ $ticket->priority->color() }}">
{{ $ticket->priority->description }}
</span>
</td>
<td>
<span class="badge bg-{{ $ticket->status->color() }}">
{{ $ticket->status->description }}
</span>
</td>
<td>{{ to_persian_numbers(jdate($ticket->updated_at)) }}</td>
<td>
<a href="{{ route('account.tickets.edit', $ticket->slug) }}"
class="btn btn-info btn-sm">
<span class="fa fa-eye"></span> {{ __('View') }}
</a>
@unless($ticket->status->is(\App\Enums\TicketStatus::CLOSED))
<form class="d-inline" method="POST" action="{{ route('account.tickets.update', $ticket->slug) }}">
@csrf
@method('PATCH')
<button type="submit" class="btn btn-sm btn-danger"
onclick="return confirm('{{ __('Are you sure?') }}');">
<span class="fa fa-times"></span> {{ __('Close the ticket') }}
</button>
</form>
@endunless
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
{{ $tickets->links() }}
</div>
</div>
</div>
</div>
@endsection