feat: add sidebar active-menu helper and users trash view
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\Tour;
|
use App\Models\Tour;
|
||||||
|
use App\Models\User;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
|
||||||
if (!function_exists('generateSortRouteParameter')) {
|
if (!function_exists('generateSortRouteParameter')) {
|
||||||
@@ -57,3 +58,28 @@ if (!function_exists('tourDateRange')) {
|
|||||||
return $start->format('Y/m/d') . ' - ' . $end->format('Y/m/d');
|
return $start->format('Y/m/d') . ' - ' . $end->format('Y/m/d');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('activeAdminSidebar')) {
|
||||||
|
function activeAdminSidebar(string|array $routeNames): string
|
||||||
|
{
|
||||||
|
$currentRouteName = Route::currentRouteName();
|
||||||
|
|
||||||
|
if (is_string($routeNames)) {
|
||||||
|
$routeNames = [$routeNames];
|
||||||
|
}
|
||||||
|
if (in_array($currentRouteName, $routeNames)) {
|
||||||
|
return 'active';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!function_exists('getUserFullName')) {
|
||||||
|
function getUserFullName(?User $user = null): string
|
||||||
|
{
|
||||||
|
if (!$user) {
|
||||||
|
$user = auth()->user();
|
||||||
|
}
|
||||||
|
return $user->first_name . ' ' . $user->last_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
@@ -0,0 +1,161 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
|
||||||
|
@section('breadcrumb')
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<h1 class="page-title fw-medium fs-18 mb-2">سطل زباله کاربران</h1>
|
||||||
|
<div class="">
|
||||||
|
<nav>
|
||||||
|
<ol class="breadcrumb mb-0">
|
||||||
|
<li class="breadcrumb-item"><a href="javascript:void(0);">مدیریت کاربران</a></li>
|
||||||
|
<li class="breadcrumb-item"><a href="{{ route('admin.users.index') }}">لیست کاربران</a></li>
|
||||||
|
<li class="breadcrumb-item active" aria-current="page">سطل زباله کاربران</li>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container-fluid pt-4">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xl-12">
|
||||||
|
<div class="card custom-card">
|
||||||
|
<div class="card-body p-3">
|
||||||
|
<div class="d-flex align-items-center justify-content-between flex-wrap gap-3">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h6 class="mb-0 fw-semibold">
|
||||||
|
کاربران حذفشده
|
||||||
|
</h6>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex">
|
||||||
|
<a href="{{ route('admin.users.index') }}" class="btn btn-primary me-2">
|
||||||
|
<i class="ri-arrow-go-back-line me-1 fw-medium align-middle"></i>
|
||||||
|
بازگشت به لیست کاربران
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Start::row -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xl-12">
|
||||||
|
<div class="card custom-card">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table text-nowrap table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>نام و نام خانوادگی</th>
|
||||||
|
<th>ایمیل</th>
|
||||||
|
<th>شماره موبایل</th>
|
||||||
|
<th>تاریخ ثبت نام</th>
|
||||||
|
<th>تاریخ حذف</th>
|
||||||
|
<th>عملیات</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
@if(session('success'))
|
||||||
|
<tr>
|
||||||
|
<td colspan="6">
|
||||||
|
<span style="color: green">{{ session('success') }}</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if($errors->any())
|
||||||
|
<tr>
|
||||||
|
<td colspan="6">
|
||||||
|
@foreach($errors->all() as $error)
|
||||||
|
<span style="color: red">{{ $error }}</span>
|
||||||
|
@endforeach
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@forelse($users as $user)
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="flex-fill">
|
||||||
|
<span class="fw-medium fs-14 d-block text-truncate">
|
||||||
|
{{ getUserFullName($user) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>{{ $user->email }}</td>
|
||||||
|
|
||||||
|
<td>{{ $user->mobile }}</td>
|
||||||
|
|
||||||
|
<td>{{ $user->created_at->toJalali()->format('H:i Y-m-d') }}</td>
|
||||||
|
|
||||||
|
<td>{{ $user->deleted_at?->toJalali()->format('H:i Y-m-d') }}</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<div class="hstack gap-2 fs-15">
|
||||||
|
|
||||||
|
<form action="{{ route('admin.users.restore', $user->id) }}"
|
||||||
|
method="POST">
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
<button type="submit"
|
||||||
|
class="btn btn-icon btn-sm btn-success-light"
|
||||||
|
data-bs-toggle="tooltip"
|
||||||
|
data-bs-placement="top"
|
||||||
|
title="بازگردانی">
|
||||||
|
<i class="ri-arrow-go-back-line"></i>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form action="{{ route('admin.users.forceDelete', $user->id) }}"
|
||||||
|
method="POST"
|
||||||
|
onsubmit="return confirm('آیا از حذف دائمی این کاربر مطمئن هستید؟')">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
|
||||||
|
<button type="submit"
|
||||||
|
class="btn btn-icon btn-sm btn-danger-light"
|
||||||
|
data-bs-toggle="tooltip"
|
||||||
|
data-bs-placement="top"
|
||||||
|
title="حذف دائمی">
|
||||||
|
<i class="ri-delete-bin-6-line"></i>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@empty
|
||||||
|
<tr>
|
||||||
|
<td colspan="6" class="text-center">
|
||||||
|
کاربری در سطل زباله وجود ندارد.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforelse
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="card-footer d-flex justify-content-center align-items-center">
|
||||||
|
<div>
|
||||||
|
{{ $users->links() }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- End::row -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
Reference in New Issue
Block a user