Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 664c793eff |
@@ -15,7 +15,6 @@ use Modules\Usermanagement\Http\Requests\User as UserRequest;
|
||||
use Modules\Usermanagement\Models\Role;
|
||||
use Modules\Usermanagement\Models\User;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class UsersController
|
||||
@@ -74,13 +73,11 @@ class UsersController extends Controller
|
||||
public function dataForDatatables(Request $request)
|
||||
{
|
||||
if (is_null($this->user) || !$this->user->can('usermanagement.read')) {
|
||||
return response()->json([
|
||||
'message' => 'Sorry! You are not allowed to view users.',
|
||||
'success' => false
|
||||
]);
|
||||
return response()->json(['message' => 'Sorry! You are not allowed to view users.','success' => false]);
|
||||
}
|
||||
|
||||
$query = User::query()->with(['branches', 'roles']);
|
||||
// Retrieve data from the database
|
||||
$query = User::query();
|
||||
|
||||
if(!$this->user->hasRole('administrator')){
|
||||
$query->whereHas('roles', function($q){
|
||||
@@ -88,48 +85,52 @@ class UsersController extends Controller
|
||||
});
|
||||
}
|
||||
|
||||
// Apply search filter if provided
|
||||
if ($request->has('search') && !empty($request->get('search'))) {
|
||||
$search = $request->get('search');
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('name', 'like', '%' . $search . '%')
|
||||
->orWhere('email', 'like', '%' . $search . '%')
|
||||
->orWhereHas('branches', function ($qb) use ($search) {
|
||||
$qb->where('name', 'like', '%' . $search . '%');
|
||||
});
|
||||
});
|
||||
$query->whereAny(['name', 'email'], 'like', '%'.$search.'%');
|
||||
}
|
||||
|
||||
// Apply sorting if provided
|
||||
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||
$order = $request->get('sortOrder');
|
||||
$column = $request->get('sortField');
|
||||
$query->orderBy($column, $order);
|
||||
}
|
||||
|
||||
// Get the total count of records
|
||||
$totalRecords = $query->count();
|
||||
|
||||
$page = $request->get('page', 1);
|
||||
$size = $request->get('size', 10);
|
||||
$offset = ($page - 1) * $size;
|
||||
// Apply pagination if provided
|
||||
if ($request->has('page') && $request->has('size')) {
|
||||
$page = $request->get('page');
|
||||
$size = $request->get('size');
|
||||
$offset = ($page - 1) * $size; // Calculate the offset
|
||||
|
||||
$query->skip($offset)->take($size);
|
||||
}
|
||||
|
||||
// Get the filtered count of records
|
||||
$filteredRecords = $query->count();
|
||||
|
||||
$users = $query->get()->map(function ($user) {
|
||||
$user->branch_names = $user->branches->pluck('name')->join(', ');
|
||||
return $user;
|
||||
});
|
||||
// Get the data for the current page
|
||||
$data = $query->with(['branch', 'roles'])->get();
|
||||
|
||||
$pageCount = ceil($totalRecords / $size);
|
||||
// Calculate the page count
|
||||
$pageCount = ceil($totalRecords / $request->get('size'));
|
||||
|
||||
// Calculate the current page number
|
||||
$currentPage = 0 + 1;
|
||||
|
||||
// Return the response data as a JSON object
|
||||
return response()->json([
|
||||
'draw' => $request->get('draw'),
|
||||
'recordsTotal' => $totalRecords,
|
||||
'recordsFiltered' => $filteredRecords,
|
||||
'pageCount' => $pageCount,
|
||||
'page' => $page,
|
||||
'page' => $currentPage,
|
||||
'totalCount' => $totalRecords,
|
||||
'data' => $users,
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -217,23 +218,11 @@ class UsersController extends Controller
|
||||
|
||||
if ($validated) {
|
||||
$user = User::create($validated);
|
||||
|
||||
if ($user) {
|
||||
if ($request->roles) {
|
||||
$user->assignRole($request->roles);
|
||||
}
|
||||
|
||||
$branches = $request->input('branches', []);
|
||||
|
||||
$user->branches()->sync($branches);
|
||||
|
||||
if (!empty($branches)) {
|
||||
$firstBranchId = $branches[0];
|
||||
|
||||
$user->branch_id = $firstBranchId;
|
||||
$user->save();
|
||||
}
|
||||
|
||||
return redirect()->route('users.index')->with('success', 'User created successfully.');
|
||||
}
|
||||
}
|
||||
@@ -359,38 +348,25 @@ class UsersController extends Controller
|
||||
|
||||
if ($validated) {
|
||||
try {
|
||||
$user = User::findOrFail($id);
|
||||
|
||||
// Handle file upload e-sign
|
||||
$user = User::find($id);
|
||||
if ($request->hasFile('sign')) {
|
||||
$sign = $request->file('sign');
|
||||
|
||||
$signName = time() . '.' . $sign->getClientOriginalExtension();
|
||||
|
||||
// Simpan file ke storage
|
||||
$sign->storeAs(
|
||||
'public/signatures/' . $user->id . '/',
|
||||
$signName
|
||||
$signName,
|
||||
);
|
||||
|
||||
$validated['sign'] = $signName;
|
||||
}
|
||||
|
||||
// Update data user
|
||||
$user->update($validated);
|
||||
|
||||
// Update roles
|
||||
if ($request->roles) {
|
||||
$user->roles()->detach();
|
||||
$user->assignRole($request->roles);
|
||||
}
|
||||
|
||||
$user->branches()->sync($request->input('branches', []));
|
||||
|
||||
$branchIds = $user->branches()->pluck('branches.id')->toArray();
|
||||
|
||||
} catch (Exception $e) {
|
||||
Log::error('Failed to update user: ' . $e->getMessage());
|
||||
return redirect()->back()->withErrors(['error' => 'Failed to update user. Please try again.']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,15 +102,4 @@ class User extends Authenticatable
|
||||
{
|
||||
return $this->hasMany(Appointment::class, 'admin_id');
|
||||
}
|
||||
|
||||
public function appointment_cabangs()
|
||||
{
|
||||
return $this->hasMany(Appointment::class, 'admin_id');
|
||||
}
|
||||
|
||||
public function branches()
|
||||
{
|
||||
return $this->belongsToMany(Branch::class, 'user_branches', 'user_id', 'branch_id')
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Usermanagement\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Usermanagement\Models\User;
|
||||
use Modules\Basicdata\Models\Branch;
|
||||
|
||||
// use Modules\Usermanagement\Database\Factories\UserBranchFactory;
|
||||
|
||||
class UserBranch extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $table = 'user_branches';
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'branch_id',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function branch()
|
||||
{
|
||||
return $this->belongsTo(Branch::class);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,8 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
@@ -45,12 +46,8 @@ return new class extends Migration {
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
|
||||
Schema::dropIfExists('sessions');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('users');
|
||||
|
||||
Schema::enableForeignKeyConstraints();
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('user_branches', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->unsignedBigInteger('branch_id');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('branch_id')->references('id')->on('branches')->onDelete('cascade');
|
||||
|
||||
$table->unique(['user_id', 'branch_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_branches');
|
||||
}
|
||||
};
|
||||
@@ -28,10 +28,6 @@
|
||||
public function data()
|
||||
{
|
||||
return [
|
||||
['name' => 'adk'],
|
||||
['name' => 'basicdata'],
|
||||
['name' => 'location'],
|
||||
['name' => 'logs'],
|
||||
['name' => 'usermanagement']
|
||||
];
|
||||
}
|
||||
|
||||
@@ -9,40 +9,40 @@ use Spatie\Permission\Models\Role;
|
||||
|
||||
class PermissionsSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$data = $this->data();
|
||||
|
||||
foreach ($data as $value) {
|
||||
|
||||
$permission = Permission::updateOrCreate([
|
||||
'name' => $value['name'],
|
||||
'guard_name' => 'web',
|
||||
'guard_name' => 'web' // or 'api
|
||||
], [
|
||||
'permission_group_id' => $value['group_id'],
|
||||
'module' => $value['module'],
|
||||
'permission_group_id' => $value['group']
|
||||
]);
|
||||
|
||||
foreach (Role::all() as $role) {
|
||||
$roles = Role::all();
|
||||
foreach ($roles as $role) {
|
||||
$role->givePermissionTo($permission);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function data()
|
||||
{
|
||||
$data = [];
|
||||
// list of model permission
|
||||
$groups = PermissionGroup::all();
|
||||
|
||||
foreach ($groups as $group) {
|
||||
|
||||
foreach ($this->crudActions($group->name) as $action) {
|
||||
|
||||
$data[] = [
|
||||
'name' => $action,
|
||||
'group_id' => $group->id,
|
||||
'module' => $group->name,
|
||||
];
|
||||
$data[] = ['name' => $action, 'group' => $group->id];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,13 +51,15 @@ class PermissionsSeeder extends Seeder
|
||||
|
||||
public function crudActions($name)
|
||||
{
|
||||
$actions = ['create', 'read', 'update', 'delete', 'export', 'authorize', 'report', 'restore'];
|
||||
$result = [];
|
||||
$actions = [];
|
||||
// list of permission actions
|
||||
$crud = ['create', 'read', 'update', 'delete','export', 'authorize', 'report','restore'];
|
||||
|
||||
foreach ($actions as $value) {
|
||||
$result[] = $name . '.' . $value;
|
||||
|
||||
foreach ($crud as $value) {
|
||||
$actions[] = $name . '.' . $value;
|
||||
}
|
||||
|
||||
return $result;
|
||||
return $actions;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Usermanagement\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Modules\Usermanagement\Models\User;
|
||||
|
||||
class UserBranchesSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$users = User::all();
|
||||
|
||||
foreach ($users as $user) {
|
||||
if ($user->branch_id) {
|
||||
$exists = DB::table('user_branches')
|
||||
->where('user_id', $user->id)
|
||||
->where('branch_id', $user->branch_id)
|
||||
->exists();
|
||||
|
||||
if (!$exists) {
|
||||
DB::table('user_branches')->insert([
|
||||
'user_id' => $user->id,
|
||||
'branch_id' => $user->branch_id,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->command->info('User branches seeded successfully.');
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Modules\Usermanagement\Models\User;
|
||||
use Modules\Usermanagement\Database\Seeders\RolesSeeder;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class UsersSeeder extends Seeder
|
||||
{
|
||||
@@ -18,179 +17,26 @@ class UsersSeeder extends Seeder
|
||||
$roleSeeder = new RolesSeeder();
|
||||
$rolesData = $roleSeeder->data();
|
||||
|
||||
/**
|
||||
* ==================================================
|
||||
* STEP 0: Pastikan semua roles dari RolesSeeder sudah dibuat di tabel roles
|
||||
* ==================================================
|
||||
*/
|
||||
foreach ($rolesData as $roleData) {
|
||||
Role::firstOrCreate(
|
||||
['name' => $roleData['name']],
|
||||
['guard_name' => 'web']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* ==================================================
|
||||
* Helper function untuk membuat user
|
||||
* ==================================================
|
||||
*/
|
||||
$createUser = function ($roleName, $branchId = null, $includeBranchInEmail = true, $includeBranchInName = true) {
|
||||
$email = $roleName . ($includeBranchInEmail && $branchId ? $branchId : '') . '@ag.co.id';
|
||||
|
||||
$name = ucfirst($roleName);
|
||||
if ($includeBranchInName && $branchId) {
|
||||
$name .= ' ' . $branchId;
|
||||
}
|
||||
|
||||
if ($roleData['name'] === 'administrator') {
|
||||
$user = User::firstOrCreate(
|
||||
['email' => $email],
|
||||
['email' => $roleData['name'] . '@ag.co.id'],
|
||||
[
|
||||
'name' => $name,
|
||||
'name' => $roleData['name'],
|
||||
'password' => Hash::make('bagbag'),
|
||||
'branch_id' => $branchId,
|
||||
'nik' => rand(100000, 999999),
|
||||
'branch_id' => 1,
|
||||
'nik' => '000000',
|
||||
'email_verified_at' => now(),
|
||||
]
|
||||
);
|
||||
|
||||
$role = Role::where('name', $roleName)->first();
|
||||
if ($role) {
|
||||
$role = \Spatie\Permission\Models\Role::firstOrCreate(
|
||||
['name' => $roleData['name']],
|
||||
['guard_name' => 'web']
|
||||
);
|
||||
|
||||
$user->assignRole($role);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* ==================================================
|
||||
* STEP 1: Buat user per role (branch_id = 1)
|
||||
* ==================================================
|
||||
* - Tanpa angka "1" di email
|
||||
* - Tanpa angka "1" di nama
|
||||
*/
|
||||
foreach ($rolesData as $roleData) {
|
||||
$roleName = $roleData['name'];
|
||||
$createUser($roleName, 1, false, false); // tanpa 1 di email & nama
|
||||
}
|
||||
|
||||
/**
|
||||
* ==================================================
|
||||
* STEP 2: Jalankan logic lama (user per cabang)
|
||||
* ==================================================
|
||||
*/
|
||||
$branchLuar = [
|
||||
24,
|
||||
25,
|
||||
29,
|
||||
35,
|
||||
37,
|
||||
41,
|
||||
42,
|
||||
45,
|
||||
46,
|
||||
50,
|
||||
71,
|
||||
74,
|
||||
77,
|
||||
82,
|
||||
84,
|
||||
85,
|
||||
88,
|
||||
90,
|
||||
91,
|
||||
93,
|
||||
97,
|
||||
107,
|
||||
108,
|
||||
111,
|
||||
112,
|
||||
113,
|
||||
114,
|
||||
115
|
||||
];
|
||||
|
||||
$branchDalam = [
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
14,
|
||||
15,
|
||||
17,
|
||||
18,
|
||||
22,
|
||||
23,
|
||||
53,
|
||||
55,
|
||||
58,
|
||||
60,
|
||||
61,
|
||||
66,
|
||||
70,
|
||||
95,
|
||||
96,
|
||||
98,
|
||||
100,
|
||||
105
|
||||
];
|
||||
|
||||
$kpno = 6;
|
||||
|
||||
// LEGAL
|
||||
foreach ($branchLuar as $branchId) {
|
||||
$createUser('legal', $branchId);
|
||||
}
|
||||
$createUser('legal', $kpno);
|
||||
|
||||
// SPV LEGAL
|
||||
$createUser('spvlegal', $kpno);
|
||||
|
||||
// USER CABANG
|
||||
foreach (array_merge($branchLuar, $branchDalam) as $branchId) {
|
||||
$createUser('cabang', $branchId);
|
||||
}
|
||||
|
||||
// ADMIN DOKUMEN
|
||||
foreach ($branchLuar as $branchId) {
|
||||
$createUser('admindokumen', $branchId);
|
||||
}
|
||||
$createUser('admindokumen', $kpno);
|
||||
|
||||
// ADMIN KREDIT
|
||||
$createUser('adminkredit', $kpno);
|
||||
|
||||
// AUDITOR
|
||||
foreach ($branchLuar as $branchId) {
|
||||
$createUser('auditor', $branchId);
|
||||
}
|
||||
$createUser('auditor', $kpno);
|
||||
|
||||
/**
|
||||
* ==================================================
|
||||
* NEW STEP: BRANCHDIRECTOR UNTUK SEMUA BRANCH
|
||||
* ==================================================
|
||||
*/
|
||||
foreach (array_merge($branchLuar, $branchDalam) as $branchId) {
|
||||
$createUser('branchdirector', $branchId);
|
||||
}
|
||||
$createUser('branchdirector', $kpno);
|
||||
|
||||
/**
|
||||
* ==================================================
|
||||
* NEW STEP: SO ADMIN DOKUMEN UNTUK SEMUA BRANCH
|
||||
* ==================================================
|
||||
*/
|
||||
foreach (array_merge($branchLuar, $branchDalam) as $branchId) {
|
||||
$createUser('soadmindokumen', $branchId);
|
||||
}
|
||||
|
||||
// tetap buat juga untuk KPNO
|
||||
$createUser('soadmindokumen', $kpno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,7 @@
|
||||
Name
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input class="input @error('name') border-danger @enderror" type="text" name="name"
|
||||
value="{{ $user->name ?? '' }}">
|
||||
<input class="input @error('name') border-danger @enderror" type="text" name="name" value="{{ $user->name ?? '' }}">
|
||||
@error('name')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
@@ -47,8 +46,7 @@
|
||||
Email
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input class="w-full input @error('email') border-danger @enderror" type="email" name="email"
|
||||
value="{{ $user->email ?? '' }}">
|
||||
<input class="w-full input @error('email') border-danger @enderror" type="email" name="email" value="{{ $user->email ?? '' }}">
|
||||
@error('email')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
@@ -59,8 +57,7 @@
|
||||
NIK
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input class="w-full input @error('nik') border-danger @enderror" type="number" name="nik"
|
||||
value="{{ $user->nik ?? '' }}">
|
||||
<input class="w-full input @error('nik') border-danger @enderror" type="number" name="nik" value="{{ $user->nik ?? '' }}">
|
||||
@error('nik')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
@@ -71,17 +68,23 @@
|
||||
Branch
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<select class="input tomselect w-full @error('branches') border-danger @enderror" name="branches[]"
|
||||
id="branches" multiple>
|
||||
<option value="">-- Select Branch --</option>
|
||||
@foreach ($branches as $branch)
|
||||
<option value="{{ $branch->id }}"
|
||||
{{ isset($user) && $user->branches->pluck('id')->contains($branch->id) ? 'selected' : '' }}>
|
||||
{{ $branch->name }}
|
||||
<select class="input tomselect w-full @error('branch_id') border-danger @enderror" name="branch_id" id="branch_id">
|
||||
<option value="">Pilih Branch</option>
|
||||
@if(isset($branches))
|
||||
@foreach($branches as $row)
|
||||
@if(isset($user))
|
||||
<option value="{{ $row->id }}" {{ isset($user->branch_id) && $user->branch_id == $row->id?'selected' : '' }}>
|
||||
{{ $row->name }}
|
||||
</option>
|
||||
@else
|
||||
<option value="{{ $row->id }}">
|
||||
{{ $row->name }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
@error('branches')
|
||||
@error('branch_id')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
</div>
|
||||
@@ -102,8 +105,7 @@
|
||||
</label>
|
||||
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<div class="input @error('password') border-danger @enderror" data-toggle-password="true"
|
||||
data-toggle-password-permanent="true">
|
||||
<div class="input @error('password') border-danger @enderror" data-toggle-password="true" data-toggle-password-permanent="true">
|
||||
<input placeholder="Password" type="password" name="password"/>
|
||||
<div class="btn btn-icon" data-toggle-password-trigger="true">
|
||||
<i class="ki-outline ki-eye toggle-password-active:hidden"></i>
|
||||
@@ -120,8 +122,7 @@
|
||||
Password Confirmation
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<div class="input @error('password_confirmation') border-danger @enderror"
|
||||
data-toggle-password="true" data-toggle-password-permanent="true">
|
||||
<div class="input @error('password_confirmation') border-danger @enderror" data-toggle-password="true" data-toggle-password-permanent="true">
|
||||
<input placeholder="Password Confirmation" type="password" name="password_confirmation"/>
|
||||
<div class="btn btn-icon" data-toggle-password-trigger="true">
|
||||
<i class="ki-outline ki-eye toggle-password-active:hidden"></i>
|
||||
@@ -143,31 +144,23 @@
|
||||
<div class="rounded-xl border p-4 flex items-center justify-between gap-2.5">
|
||||
<div class="flex items-center gap-3.5">
|
||||
<div class="relative size-[45px] shrink-0">
|
||||
<svg class="w-full h-full stroke-gray-300 fill-gray-100" fill="none"
|
||||
height="48" viewBox="0 0 44 48" width="44"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M16 2.4641C19.7128 0.320509 24.2872 0.320508 28 2.4641L37.6506 8.0359C41.3634 10.1795 43.6506 14.141 43.6506
|
||||
<svg class="w-full h-full stroke-gray-300 fill-gray-100" fill="none" height="48" viewBox="0 0 44 48" width="44" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M16 2.4641C19.7128 0.320509 24.2872 0.320508 28 2.4641L37.6506 8.0359C41.3634 10.1795 43.6506 14.141 43.6506
|
||||
18.4282V29.5718C43.6506 33.859 41.3634 37.8205 37.6506 39.9641L28 45.5359C24.2872 47.6795 19.7128 47.6795 16 45.5359L6.34937
|
||||
39.9641C2.63655 37.8205 0.349365 33.859 0.349365 29.5718V18.4282C0.349365 14.141 2.63655 10.1795 6.34937 8.0359L16 2.4641Z"
|
||||
fill="">
|
||||
39.9641C2.63655 37.8205 0.349365 33.859 0.349365 29.5718V18.4282C0.349365 14.141 2.63655 10.1795 6.34937 8.0359L16 2.4641Z" fill="">
|
||||
</path>
|
||||
<path
|
||||
d="M16.25 2.89711C19.8081 0.842838 24.1919 0.842837 27.75 2.89711L37.4006 8.46891C40.9587 10.5232 43.1506 14.3196 43.1506
|
||||
<path d="M16.25 2.89711C19.8081 0.842838 24.1919 0.842837 27.75 2.89711L37.4006 8.46891C40.9587 10.5232 43.1506 14.3196 43.1506
|
||||
18.4282V29.5718C43.1506 33.6804 40.9587 37.4768 37.4006 39.5311L27.75 45.1029C24.1919 47.1572 19.8081 47.1572 16.25 45.1029L6.59937
|
||||
39.5311C3.04125 37.4768 0.849365 33.6803 0.849365 29.5718V18.4282C0.849365 14.3196 3.04125 10.5232 6.59937 8.46891L16.25 2.89711Z"
|
||||
stroke="">
|
||||
39.5311C3.04125 37.4768 0.849365 33.6803 0.849365 29.5718V18.4282C0.849365 14.3196 3.04125 10.5232 6.59937 8.46891L16.25 2.89711Z" stroke="">
|
||||
</path>
|
||||
</svg>
|
||||
<div
|
||||
class="absolute leading-none left-2/4 top-2/4 -translate-y-2/4 -translate-x-2/4">
|
||||
<div class="absolute leading-none left-2/4 top-2/4 -translate-y-2/4 -translate-x-2/4">
|
||||
<i class="ki-filled ki-category text-lg text-gray-500">
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<span
|
||||
class="flex items-center gap-1.5 leading-none font-medium text-sm text-gray-900">
|
||||
<span class="flex items-center gap-1.5 leading-none font-medium text-sm text-gray-900">
|
||||
{{ $role->name }}
|
||||
</span>
|
||||
<span class="text-2sm text-gray-700">
|
||||
@@ -177,9 +170,7 @@
|
||||
</div>
|
||||
<div class="switch switch-sm">
|
||||
@if(isset($user))
|
||||
<input
|
||||
{{ in_array($role->name, $user->roles->pluck('name')->toArray()) ? 'checked' : '' }}
|
||||
name="roles" type="radio" value="{{ $role->name }}">
|
||||
<input {{ in_array($role->name,$user->roles->pluck("name")->toArray()) ? 'checked' : '' }} name="roles" type="radio" value="{{ $role->name }}">
|
||||
@else
|
||||
<input name="roles" type="radio" value="{{ $role->name }}">
|
||||
@endif
|
||||
|
||||
@@ -160,10 +160,7 @@
|
||||
branch: {
|
||||
title: 'Branch',
|
||||
render: (item, data) => {
|
||||
if (data.branches && data.branches.length > 0) {
|
||||
return data.branches.map(b => b.name).join(', ');
|
||||
}
|
||||
return '-';
|
||||
return data.branch?.name || '-';
|
||||
},
|
||||
},
|
||||
role: {
|
||||
|
||||
Reference in New Issue
Block a user