fix: update user management

This commit is contained in:
2026-08-17 19:57:08 +03:30
parent 3ec77fd4d8
commit ca745df725
3 changed files with 804 additions and 9 deletions
+121 -3
View File
@@ -1,3 +1,121 @@
<div>
<!-- The only way to do great work is to love what you do. - Steve Jobs -->
</div>
@extends('admin.layouts.app')
@section('title', 'ویرایش کاربر')
@section('breadcrumb')
<div>
<h1 class="page-title fw-medium fs-18 mb-2">ویرایش کاربر</h1>
<nav>
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item">
<a href="{{ route('admin.dashboard.index') }}">داشبورد</a>
</li>
<li class="breadcrumb-item">
<a href="{{ route('admin.users.index') }}">مدیریت کاربران</a>
</li>
<li class="breadcrumb-item active">ویرایش کاربر</li>
</ol>
</nav>
</div>
@endsection
@section('content')
<div class="container-fluid pt-4">
@if($errors->any())
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<ul class="mb-0">
@foreach($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
@endif
<div class="row justify-content-center">
<div class="col-xl-8 col-lg-10">
<div class="card custom-card">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="mb-0">ویرایش کاربر</h5>
<a href="{{ route('admin.users.index') }}" class="btn btn-sm btn-secondary">بازگشت</a>
</div>
<div class="card-body">
<form method="POST" action="{{ route('admin.users.update', $user) }}">
@csrf
@method('PUT')
{{-- نام کامل --}}
<div class="mb-3">
<label class="form-label">نام کامل <span class="text-danger">*</span></label>
<input type="text"
name="full_name"
value="{{ old('full_name', $user->full_name ?? $user->name) }}"
class="form-control @error('full_name') is-invalid @enderror">
@error('full_name')
<small class="text-danger">{{ $message }}</small>
@enderror
</div>
{{-- ایمیل --}}
<div class="mb-3">
<label class="form-label">ایمیل <span class="text-danger">*</span></label>
<input type="email"
name="email"
value="{{ old('email', $user->email) }}"
class="form-control @error('email') is-invalid @enderror">
@error('email')
<small class="text-danger">{{ $message }}</small>
@enderror
</div>
{{-- موبایل --}}
<div class="mb-3">
<label class="form-label">موبایل</label>
<input type="text"
name="mobile"
value="{{ old('mobile', $user->mobile ?? '') }}"
class="form-control @error('mobile') is-invalid @enderror">
@error('mobile')
<small class="text-danger">{{ $message }}</small>
@enderror
</div>
{{-- وضعیت --}}
<div class="mb-3">
<label class="form-label">وضعیت حساب</label>
<div class="form-check form-switch">
<input type="checkbox"
name="status"
value="1"
class="form-check-input"
id="status"
{{ (int) old('status', $user->status) === 1 ? 'checked' : '' }}>
<label class="form-check-label" for="status">حساب فعال باشد</label>
</div>
@error('status')
<small class="text-danger">{{ $message }}</small>
@enderror
</div>
<div class="mt-4 d-flex gap-2">
<button type="submit" class="btn btn-primary">
ذخیره تغییرات
</button>
<a href="{{ route('admin.users.index') }}" class="btn btn-secondary">
انصراف
</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
+534 -3
View File
@@ -1,3 +1,534 @@
<div>
<!-- Simplicity is the consequence of refined emotions. - Jean D'Alembert -->
</div>
@extends('admin.layouts.app')
@section('title', 'مدیریت کاربران')
@section('breadcrumb')
<div>
<h1 class="page-title fw-medium fs-18 mb-2">مدیریت ثبت‌نامی‌ها</h1>
<nav>
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item">
<a href="{{ route('admin.dashboard.index') }}">داشبورد</a>
</li>
<li class="breadcrumb-item active">ثبت‌نامی‌ها</li>
</ol>
</nav>
</div>
@endsection
@section('content')
<div class="container-fluid pt-4">
@if(session('success'))
<div class="alert alert-success alert-dismissible fade show" role="alert">
{{ session('success') }}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
@endif
@if(session('error'))
<div class="alert alert-danger alert-dismissible fade show" role="alert">
{{ session('error') }}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
@endif
{{-- فیلتر جستجوی چندپارامتری --}}
<div class="row">
<div class="col-xl-12">
<div class="card custom-card">
<div class="card-body p-3">
<form method="GET" action="{{ route('admin.users.index') }}" class="row g-3 align-items-end">
<div class="col-md-4">
<label class="form-label">کلمه کلیدی (نام / ایمیل / موبایل)</label>
<input type="text" name="search" value="{{ request('search') }}"
class="form-control" placeholder="جستجو...">
</div>
<div class="col-md-2">
<label class="form-label">وضعیت</label>
<select name="status" class="form-select">
<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-2">
<label class="form-label">از تاریخ عضویت</label>
<input type="date" name="from_date" value="{{ request('from_date') }}"
class="form-control">
</div>
<div class="col-md-2">
<label class="form-label">تا تاریخ عضویت</label>
<input type="date" name="to_date" value="{{ request('to_date') }}"
class="form-control">
</div>
<div class="col-md-2">
<div class="d-flex gap-2">
<button type="submit" class="btn btn-primary">جستجو</button>
@if(request()->hasAny(['search', 'status', 'from_date', 'to_date']))
<a href="{{ route('admin.users.index') }}"
class="btn btn-secondary">پاک‌کردن</a>
@endif
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{{-- جدول --}}
<div class="row">
<div class="col-xl-12">
<div class="card custom-card">
<div class="card-body p-3 d-flex justify-content-between align-items-center">
<h5 class="mb-0">لیست ثبت‌نامی‌ها</h5>
<span class="badge bg-primary-transparent">{{ $users->total() }} کاربر</span>
</div>
<div class="table-responsive">
<table class="table text-nowrap table-hover table-bordered mb-0">
<thead>
<tr>
<th>#</th>
<th>نام کاربر</th>
<th>ایمیل</th>
<th>موبایل</th>
<th>وضعیت</th>
<th>تاریخ عضویت</th>
<th class="text-center">عملیات</th>
</tr>
</thead>
<tbody>
@forelse($users as $user)
<tr>
<td>{{ $user->id }}</td>
<td>
<div class="fw-semibold">{{ $user->full_name ?? $user->name }}</div>
<small class="text-muted">کاربر سایت</small>
</td>
<td>{{ $user->email }}</td>
<td>{{ $user->mobile ?? '-' }}</td>
<td>
@if((int) $user->status === 1)
<span class="badge bg-success-subtle text-success">فعال</span>
@else
<span class="badge bg-danger-subtle text-danger">غیرفعال</span>
@endif
</td>
<td>
{{ $user->created_at?->toJalali()->format('Y/m/d') ?? '-' }}
</td>
{{-- عملیات (بر اساس دسترسی) --}}
<td class="text-center">
<div class="d-flex justify-content-center gap-2">
@can('users.edit')
<a href="{{ route('admin.users.edit', $user) }}"
class="btn btn-sm btn-primary fw-semibold">ویرایش</a>
@endcan
@can('users.change-password')
<a href="{{ route('admin.users.change-password', $user) }}"
class="btn btn-sm btn-warning fw-semibold">تغییر رمز</a>
@endcan
@can('users.delete')
<form action="{{ route('admin.users.destroy', $user) }}"
method="POST" class="d-inline"
onsubmit="return confirm('آیا از حذف این کاربر مطمئن هستید؟')">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-sm btn-danger fw-semibold">
حذف
</button>
</form>
@endcan
</div>
</td>
</tr>
@empty
<tr>
<td colspan="7" class="text-center py-5 text-muted">
کاربری برای نمایش وجود ندارد.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@if($users->hasPages())
<div class="card-footer">
{{ $users->links() }}
</div>
@endif
</div>
</div>
</div>
</div>
@endsection
{{--@extends('admin.layouts.app')--}}
{{--@section('title', 'مدیریت کاربران')--}}
{{--@section('breadcrumb')--}}
{{-- <div>--}}
{{-- <h1 class="page-title fw-medium fs-18 mb-2">مدیریت کاربران</h1>--}}
{{-- <nav>--}}
{{-- <ol class="breadcrumb mb-0">--}}
{{-- <li class="breadcrumb-item">--}}
{{-- <a href="{{ route('admin.dashboard.index') }}">داشبورد</a>--}}
{{-- </li>--}}
{{-- <li class="breadcrumb-item active">مدیریت کاربران</li>--}}
{{-- </ol>--}}
{{-- </nav>--}}
{{-- </div>--}}
{{--@endsection--}}
{{--@section('content')--}}
{{-- <div class="container-fluid pt-4">--}}
{{-- @if(session('success'))--}}
{{-- <div class="alert alert-success alert-dismissible fade show" role="alert">--}}
{{-- {{ session('success') }}--}}
{{-- <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>--}}
{{-- </div>--}}
{{-- @endif--}}
{{-- @if(session('error'))--}}
{{-- <div class="alert alert-danger alert-dismissible fade show" role="alert">--}}
{{-- {{ session('error') }}--}}
{{-- <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>--}}
{{-- </div>--}}
{{-- @endif--}}
{{-- --}}{{-- جستجو --}}
{{-- <div class="row">--}}
{{-- <div class="col-xl-12">--}}
{{-- <div class="card custom-card">--}}
{{-- <div class="card-body p-3">--}}
{{-- <form method="GET" action="{{ route('admin.users.index') }}"--}}
{{-- class="d-flex flex-wrap gap-2 align-items-center">--}}
{{-- <div class="flex-grow-1" style="min-width: 200px;">--}}
{{-- <input type="text"--}}
{{-- name="search"--}}
{{-- value="{{ request('search') }}"--}}
{{-- class="form-control"--}}
{{-- placeholder="جستجو بر اساس نام، ایمیل یا موبایل...">--}}
{{-- </div>--}}
{{-- <button type="submit" class="btn btn-primary">جستجو</button>--}}
{{-- @if(request('search'))--}}
{{-- <a href="{{ route('admin.users.index') }}" class="btn btn-secondary">پاک‌کردن</a>--}}
{{-- @endif--}}
{{-- </form>--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- --}}{{-- جدول کاربران --}}
{{-- <div class="row">--}}
{{-- <div class="col-xl-12">--}}
{{-- <div class="card custom-card">--}}
{{-- <div class="card-body p-3 d-flex justify-content-between align-items-center">--}}
{{-- <h5 class="mb-0">لیست کاربران</h5>--}}
{{-- <span class="badge bg-primary-transparent">{{ $users->total() }} کاربر</span>--}}
{{-- </div>--}}
{{-- <div class="table-responsive">--}}
{{-- <table class="table text-nowrap table-hover table-bordered mb-0">--}}
{{-- <thead>--}}
{{-- <tr>--}}
{{-- <th>#</th>--}}
{{-- <th>نام کاربر</th>--}}
{{-- <th>ایمیل</th>--}}
{{-- <th>موبایل</th>--}}
{{-- <th>وضعیت</th>--}}
{{-- <th>تاریخ عضویت</th>--}}
{{-- <th class="text-center">عملیات</th>--}}
{{-- </tr>--}}
{{-- </thead>--}}
{{-- <tbody>--}}
{{-- @forelse($users as $user)--}}
{{-- <tr>--}}
{{-- <td>{{ $user->id }}</td>--}}
{{-- --}}{{-- نام --}}
{{-- <td>--}}
{{-- <div class="d-flex align-items-center">--}}
{{-- <div class="avatar avatar-sm bg-primary-transparent me-2 fw-semibold">--}}
{{-- {{ mb_substr($user->full_name ?? $user->name, 0, 1) }}--}}
{{-- </div>--}}
{{-- <div>--}}
{{-- <div class="fw-semibold">{{ $user->full_name ?? $user->name }}</div>--}}
{{-- <small class="text-muted">کاربر سایت</small>--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- </td>--}}
{{-- --}}{{-- ایمیل --}}
{{-- <td>{{ $user->email }}</td>--}}
{{-- --}}{{-- موبایل --}}
{{-- <td>{{ $user->mobile ?? '-' }}</td>--}}
{{-- --}}{{-- وضعیت --}}
{{-- <td>--}}
{{-- @if((int) $user->status === 1)--}}
{{-- <span class="badge bg-success-subtle text-success">فعال</span>--}}
{{-- @else--}}
{{-- <span class="badge bg-danger-subtle text-danger">غیرفعال</span>--}}
{{-- @endif--}}
{{-- </td>--}}
{{-- --}}{{-- تاریخ عضویت --}}
{{-- <td>--}}
{{-- @if($user->created_at)--}}
{{-- {{ $user->created_at->toJalali()->format('Y/m/d H:i') }}--}}
{{-- @else--}}
{{-- ---}}
{{-- @endif--}}
{{-- </td>--}}
{{-- --}}{{-- عملیات --}}
{{-- <td class="text-center">--}}
{{-- <div class="d-flex justify-content-center gap-2">--}}
{{-- --}}{{-- ویرایش --}}
{{-- <a href="{{ route('admin.users.edit', $user) }}"--}}
{{-- class="btn btn-sm btn-primary fw-semibold">--}}
{{-- ویرایش--}}
{{-- </a>--}}
{{-- --}}{{-- حذف --}}
{{-- <form action="{{ route('admin.users.destroy', $user) }}"--}}
{{-- method="POST"--}}
{{-- class="d-inline"--}}
{{-- onsubmit="return confirm('آیا از حذف این کاربر مطمئن هستید؟')">--}}
{{-- @csrf--}}
{{-- @method('DELETE')--}}
{{-- <button type="submit" class="btn btn-sm btn-danger fw-semibold">--}}
{{-- حذف--}}
{{-- </button>--}}
{{-- </form>--}}
{{-- </div>--}}
{{-- </td>--}}
{{-- </tr>--}}
{{-- @empty--}}
{{-- <tr>--}}
{{-- <td colspan="7" class="text-center py-5 text-muted">--}}
{{-- کاربری برای نمایش وجود ندارد.--}}
{{-- </td>--}}
{{-- </tr>--}}
{{-- @endforelse--}}
{{-- </tbody>--}}
{{-- </table>--}}
{{-- </div>--}}
{{-- --}}{{-- صفحه‌بندی --}}
{{-- @if($users->hasPages())--}}
{{-- <div class="card-footer">--}}
{{-- {{ $users->links() }}--}}
{{-- </div>--}}
{{-- @endif--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- </div>--}}
{{--@endsection--}}
{{--@extends('admin.layouts.app')--}}
{{--@section('title', 'مدیریت کاربران')--}}
{{--@section('breadcrumb')--}}
{{-- <div>--}}
{{-- <h1 class="page-title fw-medium fs-18 mb-2">مدیریت کاربران</h1>--}}
{{-- <nav>--}}
{{-- <ol class="breadcrumb mb-0">--}}
{{-- <li class="breadcrumb-item">--}}
{{-- <a href="{{ route('admin.dashboard.index') }}">داشبورد</a>--}}
{{-- </li>--}}
{{-- <li class="breadcrumb-item active">مدیریت کاربران</li>--}}
{{-- </ol>--}}
{{-- </nav>--}}
{{-- </div>--}}
{{--@endsection--}}
{{--@section('content')--}}
{{-- <div class="container-fluid pt-4">--}}
{{-- @if(session('success'))--}}
{{-- <div class="alert alert-success alert-dismissible fade show" role="alert">--}}
{{-- {{ session('success') }}--}}
{{-- <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>--}}
{{-- </div>--}}
{{-- @endif--}}
{{-- @if(session('error'))--}}
{{-- <div class="alert alert-danger alert-dismissible fade show" role="alert">--}}
{{-- {{ session('error') }}--}}
{{-- <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>--}}
{{-- </div>--}}
{{-- @endif--}}
{{-- --}}{{----}}{{-- جستجو --}}
{{-- <div class="row">--}}
{{-- <div class="col-xl-12">--}}
{{-- <div class="card custom-card">--}}
{{-- <div class="card-body p-3">--}}
{{-- <form method="GET" action="{{ route('admin.users.index') }}"--}}
{{-- class="d-flex flex-wrap gap-2 align-items-center">--}}
{{-- <div class="flex-grow-1" style="min-width: 200px;">--}}
{{-- <input type="text"--}}
{{-- name="search"--}}
{{-- value="{{ request('search') }}"--}}
{{-- class="form-control"--}}
{{-- placeholder="جستجو بر اساس نام، ایمیل یا موبایل...">--}}
{{-- </div>--}}
{{-- <button type="submit" class="btn btn-primary">جستجو</button>--}}
{{-- @if(request('search'))--}}
{{-- <a href="{{ route('admin.users.index') }}" class="btn btn-secondary">پاک‌کردن</a>--}}
{{-- @endif--}}
{{-- </form>--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- --}}{{----}}{{-- جدول کاربران --}}
{{-- <div class="row">--}}
{{-- <div class="col-xl-12">--}}
{{-- <div class="card custom-card">--}}
{{-- <div class="card-body p-3 d-flex justify-content-between align-items-center">--}}
{{-- <h5 class="mb-0">لیست کاربران</h5>--}}
{{-- <span class="badge bg-primary-transparent">{{ $users->total() }} کاربر</span>--}}
{{-- </div>--}}
{{-- <div class="table-responsive">--}}
{{-- <table class="table text-nowrap table-hover table-bordered mb-0">--}}
{{-- <thead>--}}
{{-- <tr>--}}
{{-- <th>#</th>--}}
{{-- <th>نام کاربر</th>--}}
{{-- <th>ایمیل</th>--}}
{{-- <th>موبایل</th>--}}
{{-- <th>وضعیت</th>--}}
{{-- <th>تاریخ عضویت</th>--}}
{{-- <th class="text-center">عملیات</th>--}}
{{-- </tr>--}}
{{-- </thead>--}}
{{-- <tbody>--}}
{{-- @forelse($users as $user)--}}
{{-- <tr>--}}
{{-- <td>{{ $user->id }}</td>--}}
{{-- --}}{{----}}{{-- نام --}}
{{-- <td>--}}
{{-- <div class="d-flex align-items-center">--}}
{{-- <div class="avatar avatar-sm bg-primary-transparent me-2 fw-semibold">--}}
{{-- {{ mb_substr($user->full_name ?? $user->name, 0, 1) }}--}}
{{-- </div>--}}
{{-- <div>--}}
{{-- <div class="fw-semibold">{{ $user->full_name ?? $user->name }}</div>--}}
{{-- <small class="text-muted">کاربر سایت</small>--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- </td>--}}
{{-- --}}{{----}}{{-- ایمیل --}}
{{-- <td>{{ $user->email }}</td>--}}
{{-- --}}{{----}}{{-- موبایل --}}
{{-- <td>{{ $user->mobile ?? '-' }}</td>--}}
{{-- --}}{{----}}{{-- وضعیت --}}
{{-- <td>--}}
{{-- @if((int) $user->status === 1)--}}
{{-- <span class="badge bg-success-subtle text-success">فعال</span>--}}
{{-- @else--}}
{{-- <span class="badge bg-danger-subtle text-danger">غیرفعال</span>--}}
{{-- @endif--}}
{{-- </td>--}}
{{-- --}}{{----}}{{-- تاریخ عضویت --}}
{{-- <td>--}}
{{-- @if($user->created_at)--}}
{{-- {{ $user->created_at->toJalali()->format('Y/m/d H:i') }}--}}
{{-- @else--}}
{{-- ---}}
{{-- @endif--}}
{{-- </td>--}}
{{-- --}}{{----}}{{-- عملیات --}}
{{-- <td class="text-center">--}}
{{-- <div class="d-flex justify-content-center gap-2">--}}
{{-- --}}{{----}}{{-- نمایش --}}
{{-- <a href="{{ route('admin.users.show', $user) }}"--}}
{{-- class="btn btn-sm btn-secondary fw-semibold">--}}
{{-- نمایش--}}
{{-- </a>--}}
{{-- --}}{{----}}{{-- ویرایش --}}
{{-- <a href="{{ route('admin.users.edit', $user) }}"--}}
{{-- class="btn btn-sm btn-primary fw-semibold">--}}
{{-- ویرایش--}}
{{-- </a>--}}
{{-- --}}{{----}}{{-- حذف --}}
{{-- <form action="{{ route('admin.users.destroy', $user) }}"--}}
{{-- method="POST"--}}
{{-- class="d-inline"--}}
{{-- onsubmit="return confirm('آیا از حذف این کاربر مطمئن هستید؟')">--}}
{{-- @csrf--}}
{{-- @method('DELETE')--}}
{{-- <button type="submit" class="btn btn-sm btn-danger fw-semibold">--}}
{{-- حذف--}}
{{-- </button>--}}
{{-- </form>--}}
{{-- </div>--}}
{{-- </td>--}}
{{-- </tr>--}}
{{-- @empty--}}
{{-- <tr>--}}
{{-- <td colspan="7" class="text-center py-5 text-muted">--}}
{{-- کاربری برای نمایش وجود ندارد.--}}
{{-- </td>--}}
{{-- </tr>--}}
{{-- @endforelse--}}
{{-- </tbody>--}}
{{-- </table>--}}
{{-- </div>--}}
{{-- --}}{{----}}{{-- صفحه‌بندی --}}
{{-- @if($users->hasPages())--}}
{{-- <div class="card-footer">--}}
{{-- {{ $users->links() }}--}}
{{-- </div>--}}
{{-- @endif--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- </div>--}}
{{--@endsection--}}
+149 -3
View File
@@ -1,3 +1,149 @@
<div>
<!-- Live as if you were to die tomorrow. Learn as if you were to live forever. - Mahatma Gandhi -->
</div>
@extends('admin.layouts.app')
@section('title', 'مشاهده کاربر')
@section('breadcrumb')
<div>
<h1 class="page-title fw-medium fs-18 mb-2">مشاهده کاربر</h1>
<nav>
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item">
<a href="{{ route('admin.dashboard.index') }}">داشبورد</a>
</li>
<li class="breadcrumb-item">
<a href="{{ route('admin.users.index') }}">مدیریت کاربران</a>
</li>
<li class="breadcrumb-item active">مشاهده کاربر</li>
</ol>
</nav>
</div>
@endsection
@section('content')
<div class="container-fluid pt-4">
{{-- کارت پروفایل --}}
<div class="row">
<div class="col-xl-4 col-lg-5">
<div class="card custom-card">
<div class="card-body text-center">
<div
class="avatar avatar-xl bg-primary-transparent mx-auto mb-3 d-flex align-items-center justify-content-center fw-bold fs-4"
style="width:80px;height:80px;border-radius:50%;">
{{ mb_substr($user->full_name ?? $user->name, 0, 1) }}
</div>
<h5 class="mb-1">{{ $user->full_name ?? $user->name }}</h5>
<p class="text-muted mb-2">{{ $user->email }}</p>
@if((int) $user->status === 1)
<span class="badge bg-success-subtle text-success mb-3">فعال</span>
@else
<span class="badge bg-danger-subtle text-danger mb-3">غیرفعال</span>
@endif
<div class="mt-3 d-grid gap-2">
<a href="{{ route('admin.users.edit', $user) }}" class="btn btn-primary">
ویرایش اطلاعات
</a>
<a href="{{ route('admin.users.index') }}" class="btn btn-secondary">
بازگشت به لیست
</a>
</div>
</div>
</div>
</div>
{{-- اطلاعات کاربر --}}
<div class="col-xl-8 col-lg-7">
<div class="card custom-card">
<div class="card-header">
<h5 class="mb-0">اطلاعات کاربر</h5>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered mb-0">
<tr>
<th class="w-25 bg-light">شناسه</th>
<td>{{ $user->id }}</td>
</tr>
<tr>
<th class="bg-light">نام</th>
<td>{{ $user->full_name ?? $user->name }}</td>
</tr>
<tr>
<th class="bg-light">ایمیل</th>
<td>{{ $user->email }}</td>
</tr>
<tr>
<th class="bg-light">موبایل</th>
<td>{{ $user->mobile ?? '-' }}</td>
</tr>
<tr>
<th class="bg-light">وضعیت</th>
<td>
@if((int) $user->status === 1)
<span class="badge bg-success-subtle text-success">فعال</span>
@else
<span class="badge bg-danger-subtle text-danger">غیرفعال</span>
@endif
</td>
</tr>
<tr>
<th class="bg-light">تاریخ عضویت</th>
<td>{{ $user->created_at ? $user->created_at->toJalali()->format('Y/m/d H:i') : '-' }}</td>
</tr>
@if($user->updated_at)
<tr>
<th class="bg-light">آخرین بروزرسانی</th>
<td>{{ $user->updated_at->toJalali()->format('Y/m/d H:i') }}</td>
</tr>
@endif
</table>
</div>
</div>
</div>
{{-- کامنت‌های کاربر (اگه رابطه تعریف شده) --}}
@if($user->comments && $user->comments->count())
<div class="card custom-card mt-3">
<div class="card-header">
<h5 class="mb-0">نظرات ثبت‌شده ({{ $user->comments->count() }})</h5>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-hover table-bordered mb-0">
<thead>
<tr>
<th>نظر</th>
<th>تاریخ</th>
<th class="text-center">وضعیت</th>
</tr>
</thead>
<tbody>
@foreach($user->comments as $comment)
<tr>
<td>{{ \Illuminate\Support\Str::limit($comment->body, 80) }}</td>
<td>{{ $comment->created_at->toJalali()->format('Y/m/d') }}</td>
<td class="text-center">
@if((int) $comment->status === 1)
<span
class="badge bg-success-subtle text-success">پذیرفته‌شده</span>
@else
<span class="badge bg-warning-subtle text-dark">در انتظار</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endif
</div>
</div>
</div>
@endsection