feat: add the admin list for admin panel
This commit is contained in:
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Admins;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
class AdminUserPostRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*/
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'first_name' => [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
'min:3',
|
||||||
|
'max:150',
|
||||||
|
'persian_alpha',
|
||||||
|
|
||||||
|
],
|
||||||
|
'last_name' => [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
'min:3',
|
||||||
|
'max:150',
|
||||||
|
'persian_alpha',
|
||||||
|
],
|
||||||
|
'email'=> [
|
||||||
|
'required',
|
||||||
|
'email',
|
||||||
|
Rule::unique('users', 'email')->ignore($this->route('user'))],
|
||||||
|
'mobile'=> [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
'digits:11',
|
||||||
|
'ir_mobile:zero',
|
||||||
|
Rule::unique('users', 'mobile')->ignore($this->route('user'))],
|
||||||
|
|
||||||
|
'user_province' => [
|
||||||
|
'nullable'
|
||||||
|
],
|
||||||
|
'user_city' => [
|
||||||
|
'nullable'
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
@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 mb-4">
|
||||||
|
<div class="user-profile-card">
|
||||||
|
|
||||||
|
<h4 class="user-profile-card-title">
|
||||||
|
بروزرسانی مشخصات ادمین
|
||||||
|
</h4>
|
||||||
|
|
||||||
|
<div class="user-profile-form">
|
||||||
|
|
||||||
|
<form action="{{ route('admin.admins.update', $admin->id) }}" method="POST">
|
||||||
|
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>نام</label>
|
||||||
|
<input
|
||||||
|
type="text" name="first_name" class="form-control"
|
||||||
|
value="{{ old('first_name', $admin->first_name) }}" placeholder="نام شما"
|
||||||
|
>
|
||||||
|
@error('first_name')
|
||||||
|
<span class="text-danger">{{ $message }}</span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>نام خانوادگی</label>
|
||||||
|
<input
|
||||||
|
type="text" name="last_name" class="form-control"
|
||||||
|
value="{{ old('last_name', $admin->last_name) }}" placeholder="نام خانوادگی"
|
||||||
|
>
|
||||||
|
@error('last_name')
|
||||||
|
<span class="text-danger">
|
||||||
|
{{ $message }}
|
||||||
|
</span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>ایمیل</label>
|
||||||
|
<input
|
||||||
|
type="email" name="email" class="form-control"
|
||||||
|
value="{{ old('email', $admin->email) }}" placeholder="ایمیل" >
|
||||||
|
@error('email')
|
||||||
|
<span class="text-danger">{{ $message }}</span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="theme-btn mt-4">
|
||||||
|
تایید مشخصات ادمین
|
||||||
|
<i class="far fa-user"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="user-profile-card">
|
||||||
|
<h4 class="user-profile-card-title">عوض کردن رمز عبور</h4>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="user-profile-form">
|
||||||
|
<form action="{{ route('setting.password.update') }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
<div class="form-group">
|
||||||
|
<label>رمز عبور فعلی</label>
|
||||||
|
<input type="password" name="current_password" class="form-control"
|
||||||
|
placeholder="رمز عبور فعلی">
|
||||||
|
@error('current_password') <span class="text-danger">{{ $message }}</span> @enderror
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>رمز عبور جدید</label>
|
||||||
|
<input type="password" name="new_password" class="form-control"
|
||||||
|
placeholder="رمز عبور جدید">
|
||||||
|
@error('new_password') <span class="text-danger">{{ $message }}</span> @enderror
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>تکرار رمز عبور جدید</label>
|
||||||
|
<input type="password" name="new_password_confirmation" class="form-control"
|
||||||
|
placeholder="تکرار رمز عبور جدید">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="theme-btn mt-4">عوض کردن رمز عبور <i class="far fa-key"></i>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
@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="user-profile-card user-profile-listing">
|
||||||
|
<div class="user-profile-card-header">
|
||||||
|
<h4 class="user-profile-card-title">لیست مدیران سایت</h4>
|
||||||
|
|
||||||
|
<div class="user-profile-card-header-right">
|
||||||
|
<div class="user-profile-search">
|
||||||
|
<form action="{{ route('admin.admins.index') }}" method="GET">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text"
|
||||||
|
name="search"
|
||||||
|
class="form-control"
|
||||||
|
value="{{ request('search') }}"
|
||||||
|
placeholder="جستجو...">
|
||||||
|
<button type="submit" style="border: none; background: none;">
|
||||||
|
<i class="far fa-search"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table text-nowrap">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>نام</th>
|
||||||
|
<th>نام خانوادگی</th>
|
||||||
|
<th>ایمیل</th>
|
||||||
|
<th>عمل</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
@forelse($admins as $admin)
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<h6>{{ $admin->first_name }}</h6>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<h6>{{ $admin->last_name }}</h6>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<h6>{{ $admin->email }}</h6>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<a href="{{route('admin.admins.edit' , $admin->id)}}"
|
||||||
|
class="btn btn-outline-secondary btn-sm">
|
||||||
|
<i class="far fa-pen"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<form action="{{route('admin.admins.destroy' , $admin->id)}}"
|
||||||
|
method="POST"
|
||||||
|
style="display: inline;"
|
||||||
|
onsubmit="return confirm('آیا از حذف این مدیر مطمئن هستید؟');">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
|
||||||
|
<button type="submit"
|
||||||
|
class="btn btn-outline-secondary btn-sm">
|
||||||
|
<i class="far fa-trash-can"></i>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@empty
|
||||||
|
<tr>
|
||||||
|
<td colspan="4" class="text-center">
|
||||||
|
مدیری پیدا نشد.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforelse
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pagination-area my-3">
|
||||||
|
{{ $admins->links() }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
Reference in New Issue
Block a user