Files

162 lines
5.9 KiB
PHP

@extends('dashboard.layouts.app')
@section('title', 'لیست تورها')
@section('account-content')
<div class="user-profile-wrapper">
@if(session('success'))
<div class="col-lg-12 mb-3">
<div class="alert alert-success">
{{ session('success') }}
</div>
</div>
@endif
<div class="col-lg-12">
<div class="user-profile-card">
<h4 class="user-profile-card-title">
لیست تورها
</h4>
<div class="d-flex justify-content-end mb-4">
<a href="{{ route('admin.tours.create') }}" class="theme-btn">
ساخت تور
<i class="far fa-plus"></i>
</a>
</div>
<div class="user-profile-form">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>عنوان تور</th>
<th>مبدأ</th>
<th>مقصد</th>
<th>تاریخ حرکت</th>
<th>تاریخ برگشت</th>
<th>نوع تور</th>
<th>عملیات</th>
</tr>
</thead>
<tbody>
@forelse($tours as $tour)
@php
$detail = $tour->tour_details->first();
@endphp
<tr>
<td>
{{ $tours->firstItem() + $loop->index }}
</td>
<td>
{{ $tour->title }}
</td>
<td>
{{ $tour->originAirport?->city ?? '-' }}
</td>
<td>
{{ $tour->destinationAirport?->city ?? '-' }}
</td>
<td>
@if($detail && $detail->start_date)
{{ verta($detail->start_date)->format('Y/m/d') }}
@else
-
@endif
</td>
<td>
@if($detail && $detail->end_date)
{{ verta($detail->end_date)->format('Y/m/d') }}
@else
-
@endif
</td>
<td>
{{ $tour->tour_type }}
</td>
<td>
<div class="d-flex align-items-center gap-2">
<a href="{{ route('tour.show', $tour->id) }}"
title="مشاهده"
class="btn btn-outline-secondary btn-sm">
<i class="far fa-eye"></i>
</a>
<a href="{{ route('admin.tours.edit', $tour->id) }}"
title="ویرایش"
class="btn btn-outline-secondary btn-sm">
<i class="far fa-pen"></i>
</a>
<form action="{{ route('admin.tours.destroy', $tour->id) }}"
method="POST"
style="display: inline-block;">
@csrf
@method('DELETE')
<button type="submit"
title="حذف"
onclick="return confirm('آیا از حذف این تور مطمئن هستید؟')"
class="btn btn-outline-secondary btn-sm">
<i class="far fa-trash-can"></i>
</button>
</form>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="8" class="text-center">
هیچ توری ثبت نشده است.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="mt-4">
{{ $tours->links() }}
</div>
</div>
</div>
</div>
</div>
@endsection