|
|
|
@ -1,9 +1,9 @@ |
|
|
|
|
<div class="row"> |
|
|
|
|
<div class="col-12"> |
|
|
|
|
<div class="card mb-4"> |
|
|
|
|
|
|
|
|
|
{{-- Header --}} |
|
|
|
|
<div class="card-header d-flex justify-content-between align-items-center pb-0"> |
|
|
|
|
{{-- Tiêu đề động --}} |
|
|
|
|
<h6 class="mb-0">{{ $title }}</h6> |
|
|
|
|
|
|
|
|
|
@if ($mode === 'index') |
|
|
|
@ -33,10 +33,47 @@ |
|
|
|
|
@endif |
|
|
|
|
|
|
|
|
|
@if ($mode === 'index') |
|
|
|
|
<div class="table-responsive"> |
|
|
|
|
{{-- SKELETON TABLE --}} |
|
|
|
|
<div wire:loading class="w-100"> |
|
|
|
|
<div class="table-responsive"> |
|
|
|
|
<table class="table mb-0"> |
|
|
|
|
<thead> |
|
|
|
|
<tr style="visibility:hidden; height:3.5rem"> |
|
|
|
|
<th class="text-center">ID</th> |
|
|
|
|
<th>Name</th> |
|
|
|
|
<th class="text-center">Actions</th> |
|
|
|
|
</tr> |
|
|
|
|
</thead> |
|
|
|
|
<tbody> |
|
|
|
|
@for ($i = 0; $i < 5; $i++) |
|
|
|
|
<tr style="height:3.5rem"> |
|
|
|
|
<td class="text-center align-middle"> |
|
|
|
|
<div class="skeleton rounded" |
|
|
|
|
style="width:2rem; height:2rem; margin:0 auto;"></div> |
|
|
|
|
</td> |
|
|
|
|
<td class="align-middle"> |
|
|
|
|
<div class="skeleton rounded" style="width:90%; height:1.75rem;"></div> |
|
|
|
|
</td> |
|
|
|
|
<td class="text-center align-middle"> |
|
|
|
|
<div class="d-inline-flex gap-3"> |
|
|
|
|
<div class="skeleton rounded" style="width:3rem; height:2rem;"> |
|
|
|
|
</div> |
|
|
|
|
<div class="skeleton rounded" style="width:3rem; height:2rem;"> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</td> |
|
|
|
|
</tr> |
|
|
|
|
@endfor |
|
|
|
|
</tbody> |
|
|
|
|
</table> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
{{-- ACTUAL TABLE --}} |
|
|
|
|
<div wire:loading.remove class="table-responsive"> |
|
|
|
|
<table class="table align-items-center mb-0"> |
|
|
|
|
<thead> |
|
|
|
|
<tr> |
|
|
|
|
<tr style="height:3.5rem"> |
|
|
|
|
<th class="text-center">ID</th> |
|
|
|
|
<th>Name</th> |
|
|
|
|
<th class="text-center">Actions</th> |
|
|
|
@ -44,10 +81,10 @@ |
|
|
|
|
</thead> |
|
|
|
|
<tbody> |
|
|
|
|
@forelse($permissions as $p) |
|
|
|
|
<tr> |
|
|
|
|
<td class="text-center">{{ $p->id }}</td> |
|
|
|
|
<td>{{ $p->name }}</td> |
|
|
|
|
<td class="text-center"> |
|
|
|
|
<tr style="height:3.5rem"> |
|
|
|
|
<td class="text-center align-middle">{{ $p->id }}</td> |
|
|
|
|
<td class="align-middle">{{ $p->name }}</td> |
|
|
|
|
<td class="text-center align-middle"> |
|
|
|
|
<button wire:click="showForm({{ $p->id }})" |
|
|
|
|
class="btn btn-sm btn-outline-info me-1"> |
|
|
|
|
Edit |
|
|
|
@ -67,39 +104,56 @@ |
|
|
|
|
</table> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
{{-- Phân trang --}} |
|
|
|
|
<div class="mt-3"> |
|
|
|
|
{{-- Pagination --}} |
|
|
|
|
<div wire:loading.remove class="mt-3"> |
|
|
|
|
@if ($permissions->lastPage() > 1) |
|
|
|
|
{{ $permissions->links() }} |
|
|
|
|
@endif |
|
|
|
|
</div> |
|
|
|
|
@else |
|
|
|
|
{{-- Form --}} |
|
|
|
|
<h6 class="mb-3">{{ $editingId ? 'Edit Permission' : 'Create Permission' }}</h6> |
|
|
|
|
<form wire:submit.prevent="save"> |
|
|
|
|
<div class="mb-3"> |
|
|
|
|
<label class="form-label">Name</label> |
|
|
|
|
<input type="text" wire:model.defer="name" class="form-control" |
|
|
|
|
placeholder="Enter permission name"> |
|
|
|
|
@error('name') |
|
|
|
|
<div class="text-danger text-xs mt-1">{{ $message }}</div> |
|
|
|
|
@enderror |
|
|
|
|
{{-- SKELETON FORM --}} |
|
|
|
|
<div wire:loading class="w-100"> |
|
|
|
|
<div class="p-4 border rounded-lg shadow-sm max-w-md mx-auto space-y-4"> |
|
|
|
|
<div class="skeleton rounded" style="width:10rem; height:2rem;"></div> |
|
|
|
|
<div class="space-y-3"> |
|
|
|
|
<div class="skeleton rounded" style="width:100%; height:3.5rem;"></div> |
|
|
|
|
<div class="skeleton rounded" style="width:95%; height:3.5rem;"></div> |
|
|
|
|
</div> |
|
|
|
|
<div class="d-flex justify-content-end gap-3"> |
|
|
|
|
<div class="skeleton rounded" style="width:5.5rem; height:2.5rem;"></div> |
|
|
|
|
<div class="skeleton rounded" style="width:5.5rem; height:2.5rem;"></div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="d-flex justify-content-end"> |
|
|
|
|
<button wire:click="showIndex" type="button" class="btn btn-secondary btn-sm me-2"> |
|
|
|
|
Cancel |
|
|
|
|
</button> |
|
|
|
|
<button type="submit" class="btn btn-info btn-sm"> |
|
|
|
|
{{ $editingId ? 'Update' : 'Create' }} |
|
|
|
|
</button> |
|
|
|
|
</div> |
|
|
|
|
</form> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
{{-- ACTUAL FORM --}} |
|
|
|
|
<div wire:loading.remove> |
|
|
|
|
<h6 class="mb-3">{{ $editingId ? 'Edit Permission' : 'Create Permission' }}</h6> |
|
|
|
|
<form wire:submit.prevent="save"> |
|
|
|
|
<div class="mb-3"> |
|
|
|
|
<label class="form-label">Name</label> |
|
|
|
|
<input type="text" wire:model.defer="name" class="form-control" |
|
|
|
|
placeholder="Enter permission name"> |
|
|
|
|
@error('name') |
|
|
|
|
<div class="text-danger text-xs mt-1">{{ $message }}</div> |
|
|
|
|
@enderror |
|
|
|
|
</div> |
|
|
|
|
<div class="d-flex justify-content-end"> |
|
|
|
|
<button wire:click="showIndex" type="button" class="btn btn-secondary btn-sm me-2"> |
|
|
|
|
Cancel |
|
|
|
|
</button> |
|
|
|
|
<button type="submit" class="btn btn-info btn-sm"> |
|
|
|
|
{{ $editingId ? 'Update' : 'Create' }} |
|
|
|
|
</button> |
|
|
|
|
</div> |
|
|
|
|
</form> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
@endif |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
{{-- Livewire sẽ chèn và chạy block này sau mỗi lần component render xong --}} |
|
|
|
|
@script |
|
|
|
|
<script> |
|
|
|
|
document.title = @json($title); |
|
|
|
|