Files
portal-api/resources/views/admin/post/index.blade.php
T
2025-07-24 16:18:27 +07:00

87 lines
4.3 KiB
PHP

@extends('admin.main')
@section('content')
@if(auth()->guard('admins')->user()->can("manager post"))
<div class="card card-primary card-outline">
<div class="card-header">
<a href="{{ route('post.create') }}" class="btn btn-outline-secondary">
<i class="fas fa-plus"></i> Add New Post
</a>
</div>
<div class="card-body">
<table class="table table-invoice table-bordered">
<thead>
<tr>
<th style="width: 10px">
<label for=""></label><input type="checkbox" name="check" class="check-all" id="">
</th>
<th style="width: 120px">Image</th>
<th>Name</th>
<th>Status</th>
<th>Created At</th>
<th style="width: 40px"></th>
<th style="width: 40px"></th>
</tr>
</thead>
<tbody>
@if(count($posts) > 0)
@foreach($posts->all() as $item)
<tr>
<td class="text-center">
<input type="checkbox" name="item_check" id="" value="{{ $item->id }}">
</td>
<td class="text-center p-3">
<img src="{{ $item->thumbnail ? asset('/template/'.$item->thumbnail) : asset('/template/assets/image/no-image.jpg') }}"
width="80"
alt="Image">
</td>
<td class="text-center">
<a href="{{ route('post.edit',['id' => $item->id]) }}"
title="{{ $item->name }}">{{ $item->name }}</a>
</td>
<td class="text-center">
{!! $item->getStatus() !!}
</td>
<td class="text-center">
@time($item->created_at)
</td>
<td class="text-center">
<a class="btn btn-warning btn-sm"
data-toggle="tooltip" data-placement="top" title="Edit Post"
href="{{ route('post.edit', ['id' => $item->id]) }}">
<i class="fas fa-search"></i>
</a>
</td>
<td class="text-center">
@if(auth()->guard('admins')->user()->can("delete post"))
<form method="post" class="d-inline"
action="{{ route('post.destroy',['id' => $item->id]) }}">
@csrf
@method('delete')
<button type="submit" data-toggle="tooltip" data-placement="top"
title="Remove Post" class="btn btn-sm btn-danger"
data-original-title="Xoá">
<i class="fas fa-trash"></i>
</button>
</form>
@endif
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
<div class="card-footer">
{{ $posts->withQueryString()->links() }}
</div>
</div>
@else
<div class="alert alert-danger alert-dismissible">
<h5 class="mb-0"><i class="icon fas fa-ban"></i> Access Denied - You are not assigned to any Post
management department</h5>
</div>
@endif
@endsection