Files
shahrzadzandi09/resources/views/admin/users/show.blade.php
T
2026-08-17 19:57:08 +03:30

150 lines
7.3 KiB
PHP

@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