fix: update travel type management
This commit is contained in:
@@ -1,3 +1,55 @@
|
||||
<div>
|
||||
<!-- Act only according to that maxim whereby you can, at the same time, will that it should become a universal law. - Immanuel Kant -->
|
||||
</div>
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@section('title', 'ثبت نوع سفر جدید')
|
||||
|
||||
@section('content')
|
||||
<div class="card" style="max-width: 600px;">
|
||||
<div class="card-header"><h5 class="mb-0">ثبت نوع سفر جدید</h5></div>
|
||||
<div class="card-body">
|
||||
<form action="{{ route('admin.travelTypes.store') }}" method="POST">
|
||||
@csrf
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">عنوان<span class="text-danger">*</span></label>
|
||||
<input type="text" name="title" class="form-control @error('title') is-invalid @enderror"
|
||||
value="{{ old('title') }}">
|
||||
@error('title')
|
||||
<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">اسلاگ<span class="text-danger">*</span></label>
|
||||
<input type="text" name="slug" class="form-control @error('slug') is-invalid @enderror"
|
||||
value="{{ old('slug') }}" placeholder="مثلاً domestic / foreign / charter">
|
||||
@error('slug')
|
||||
<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||
</div>
|
||||
|
||||
{{-- <div class="mb-3 form-check">--}}
|
||||
{{-- <input type="checkbox" name="status" value="1" class="form-check-input"--}}
|
||||
{{-- id="status" @checked(old('status', true))>--}}
|
||||
{{-- <label class="form-check-label" for="status">فعال باشد</label>--}}
|
||||
{{-- </div>--}}
|
||||
<input type="hidden" name="status" value="0">
|
||||
|
||||
<div class="form-check">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
name="status"
|
||||
value="1"
|
||||
id="status"
|
||||
{{ old('status', $travelType->status ?? 1) == 1 ? 'checked' : '' }}
|
||||
>
|
||||
<label class="form-check-label" for="status">
|
||||
فعال
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
<button class="btn btn-primary">ذخیره</button>
|
||||
<a href="{{ route('admin.travelTypes.index') }}" class="btn btn-secondary">بازگشت</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@@ -1,3 +1,57 @@
|
||||
<div>
|
||||
<!-- Well begun is half done. - Aristotle -->
|
||||
</div>
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@section('title', 'ویرایش نوع سفر')
|
||||
|
||||
@section('content')
|
||||
<div class="card" style="max-width: 600px;">
|
||||
<div class="card-header"><h5 class="mb-0">ویرایش: {{ $travelType->title }}</h5></div>
|
||||
<div class="card-body">
|
||||
<form action="{{ route('admin.travelTypes.update', $travelType) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">عنوان<span class="text-danger">*</span></label>
|
||||
<input type="text" name="title" class="form-control @error('title') is-invalid @enderror"
|
||||
value="{{ old('title', $travelType->title) }}">
|
||||
@error('title')
|
||||
<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">اسلاگ<span class="text-danger">*</span></label>
|
||||
<input type="text" name="slug" class="form-control @error('slug') is-invalid @enderror"
|
||||
value="{{ old('slug', $travelType->slug) }}">
|
||||
@error('slug')
|
||||
<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||
</div>
|
||||
|
||||
{{-- <div class="mb-3 form-check">--}}
|
||||
{{-- <input type="checkbox" name="status" value="1" class="form-check-input"--}}
|
||||
{{-- id="status" @checked($travelType->status)>--}}
|
||||
{{-- <label class="form-check-label" for="status">فعال باشد</label>--}}
|
||||
{{-- </div>--}}
|
||||
<input type="hidden" name="status" value="0">
|
||||
|
||||
<div class="form-check">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
name="status"
|
||||
value="1"
|
||||
id="status"
|
||||
{{ old('status', $travelType->status ?? 1) == 1 ? 'checked' : '' }}
|
||||
>
|
||||
<label class="form-check-label" for="status">
|
||||
فعال
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
<button class="btn btn-primary">بهروزرسانی</button>
|
||||
<a href="{{ route('admin.travelTypes.index') }}" class="btn btn-secondary">بازگشت</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -1,3 +1,83 @@
|
||||
<div>
|
||||
<!-- Act only according to that maxim whereby you can, at the same time, will that it should become a universal law. - Immanuel Kant -->
|
||||
</div>
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@section('title', 'انواع سفر')
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h5 class="mb-0">انواع سفر</h5>
|
||||
<a href="{{ route('admin.travelTypes.create') }}" class="btn btn-primary btn-sm">+ نوع سفر جدید</a>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{-- جستجو --}}
|
||||
<form method="GET" action="{{ route('admin.travelTypes.index') }}" class="row g-2 mb-3">
|
||||
<div class="col-md-4">
|
||||
<input type="text" name="search" class="form-control"
|
||||
placeholder="جستجوی عنوان یا اسلاگ..." value="{{ request('search') }}">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<select name="status" class="form-control">
|
||||
<option value="">همه وضعیتها</option>
|
||||
<option value="1" @selected(request('status') == '1')>فعال</option>
|
||||
<option value="0" @selected(request('status') === '0')>غیرفعال</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-auto">
|
||||
<button class="btn btn-secondary" type="submit">جستجو</button>
|
||||
<a href="{{ route('admin.travelTypes.index') }}" class="btn btn-outline-secondary">پاککردن</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover align-middle">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>عنوان</th>
|
||||
<th>اسلاگ</th>
|
||||
<th>وضعیت</th>
|
||||
<th>تاریخ ثبت</th>
|
||||
<th>عملیات</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($travelTypes as $type)
|
||||
<tr>
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ $type->title }}</td>
|
||||
<td><span class="badge bg-info">{{ $type->slug }}</span></td>
|
||||
<td>
|
||||
@if($type->status)
|
||||
<span class="badge bg-success">فعال</span>
|
||||
@else
|
||||
<span class="badge bg-secondary">غیرفعال</span>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<td>{{ $type->created_at ? $type->created_at->toJalali()->format('Y/m/d H:i') : '-' }}</td>
|
||||
<td>
|
||||
<a href="{{ route('admin.travelTypes.edit', $type) }}" class="btn btn-warning btn-sm">ویرایش</a>
|
||||
<form action="{{ route('admin.travelTypes.destroy', $type) }}" method="POST"
|
||||
class="d-inline"
|
||||
onsubmit="return confirm('آیا مطمئن هستید؟')">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button class="btn btn-danger btn-sm">حذف</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="6" class="text-center text-muted">موردی یافت نشد.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{{ $travelTypes->links() }}
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
Reference in New Issue
Block a user