initial commit

This commit is contained in:
2025-11-11 14:55:29 +07:00
commit 7c17aa7843
2490 changed files with 606138 additions and 0 deletions

View File

@@ -0,0 +1,357 @@
@extends('layouts.backendTemplate')
@section('content')
<!--begin::Main-->
<div class="app-main flex-column flex-row-fluid" id="kt_app_main">
<div class="d-flex flex-column flex-column-fluid">
@include('uc.admin.breadcrumbList', [
'title' => 'Users Management',
'pageName' => 'User Management',
])
<div id="kt_app_content" class="app-content flex-column-fluid">
<!--begin::Content container-->
<div id="kt_app_content_container" class="app-container container-xxl">
<!--begin::Card-->
<div class="card">
@if (Session::has('messageSuccess'))
<div class="card-body">
@include('uc/messageSuccess')
</div>
@endif
@if (Session::has('messageFail'))
<div class="card-body">
@include('uc/messageFail')
</div>
@endif
<!--begin::Card header-->
<div class="card-header border-0 pt-6">
<!--begin::Card title-->
<div class="card-title">
<div class="d-flex align-items-center position-relative my-1">
<span class="svg-icon svg-icon-1 position-absolute ms-6">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none"
xmlns="http://www.w3.org/2000/svg">
<rect opacity="0.5" x="17.0365" y="15.1223" width="8.15546" height="2"
rx="1" transform="rotate(45 17.0365 15.1223)" fill="currentColor" />
<path
d="M11 19C6.55556 19 3 15.4444 3 11C3 6.55556 6.55556 3 11 3C15.4444 3 19 6.55556 19 11C19 15.4444 15.4444 19 11 19ZM11 5C7.53333 5 5 7.53333 5 11C5 14.4667 7.53333 17 11 17C14.4667 17 17 14.4667 17 11C17 7.53333 14.4667 5 11 5Z"
fill="currentColor" />
</svg>
</span>
<input type="text" table-filter="search"
class="form-control form-control-solid w-250px ps-15" placeholder="Search" />
</div>
</div>
<!--begin::Card title-->
<!--begin::Card toolbar-->
<div class="card-toolbar">
<div class="w-150px me-3">
<select class="form-select form-select-solid" data-control="select2"
data-hide-search="true" data-placeholder="Status" table-filter="status">
<option></option>
<option value="all">All</option>
<option value="active">Active</option>
<option value="inactive">Inactive</option>
</select>
</div>
<!--begin::Toolbar-->
<div class="d-flex justify-content-end" data-kt-customer-table-toolbar="base">
<a href="{{ url('user/add') }}" class="btn btn-primary">Add </a>
</div>
<!--end::Toolbar-->
</div>
<!--end::Card toolbar-->
</div>
<!--end::Card header-->
<div class="card-body py-4">
<!--begin::Table-->
<table class="table align-middle table-row-dashed fs-6 gy-5" id="data-table-user">
<!--begin::Table head-->
<thead>
<!--begin::Table row-->
<tr class="text-start text-muted fw-bold fs-7 text-uppercase gs-0">
<th class="min-w-150px">Pic</th>
<th class="min-w-150px">Role</th>
<th class="min-w-150px">First Name</th>
<th class="min-w-150px">Last Name</th>
<th class="min-w-150px">Email</th>
<th class="min-w-150px">Status</th>
<th class="min-w-150px">Created At</th>
<th class="min-w-100px text-end">Actions</th>
</tr>
<!--end::Table row-->
</thead>
<tbody class="fw-bold text-gray-600">
@foreach ($userView as $key => $obj)
<tr>
<td class="d-flex align-items-center">
<div class="symbol symbol-100px symbol-2by3 me-4">
@if ($obj->image_url && $obj->image_name)
<a class="show-image-preview d-block overlay"
href="{{ url($obj->image_url . '/original/' . $obj->image_name) }}">
<div class="symbol-label"
style="background-image: url('{{ url($obj->image_url . '/thumbnail/' . $obj->image_name) }}')">
</div>
</a>
@else
<div class="symbol-label"
style="background-image: url('{{ url('assets/media/avatars/blank.png') }}')">
</div>
@endif
</div>
</td>
<td>
@if ($obj->role == 1)
<span class="badge py-3 px-4 fs-7 badge-light-warning"> EDITOR </span>
@elseif($obj->role == 2)
<span class="badge py-3 px-4 fs-7 badge-light-info"> CONTRIBUTOR </span>
@else
<span class="badge py-3 px-4 fs-7 badge-light-success"> ADMIN </span>
@endif
</td>
<td class="">{{ $obj->first_name }}</td>
<td class="">{{ $obj->last_name }}</td>
<td class="">{{ $obj->email }}</td>
<td class="">
@if ($obj->active == 1)
<span class="badge py-3 px-4 fs-7 badge-light-success">Active</span>
@else
<span class="badge py-3 px-4 fs-7 badge-light-danger">Locked</span>
@endif
</td>
<td class="">{{ date('d M, Y', strtotime($obj->created_at)) }}</td>
<td class="min-w-100px text-end">
{{-- Edit --}}
<a href="{{ url('user/edit/' . $obj->id) }}"
class="btn btn-icon btn-bg-light btn-active-color-primary btn-sm me-1">
<span class="svg-icon svg-icon-3">
<svg width="24" height="24" viewBox="0 0 24 24"
fill="none" xmlns="http://www.w3.org/2000/svg">
<path opacity="0.3"
d="M21.4 8.35303L19.241 10.511L13.485 4.755L15.643 2.59595C16.0248 2.21423 16.5426 1.99988 17.0825 1.99988C17.6224 1.99988 18.1402 2.21423 18.522 2.59595L21.4 5.474C21.7817 5.85581 21.9962 6.37355 21.9962 6.91345C21.9962 7.45335 21.7817 7.97122 21.4 8.35303ZM3.68699 21.932L9.88699 19.865L4.13099 14.109L2.06399 20.309C1.98815 20.5354 1.97703 20.7787 2.03189 21.0111C2.08674 21.2436 2.2054 21.4561 2.37449 21.6248C2.54359 21.7934 2.75641 21.9115 2.989 21.9658C3.22158 22.0201 3.4647 22.0084 3.69099 21.932H3.68699Z"
fill="currentColor" />
<path
d="M5.574 21.3L3.692 21.928C3.46591 22.0032 3.22334 22.0141 2.99144 21.9594C2.75954 21.9046 2.54744 21.7864 2.3789 21.6179C2.21036 21.4495 2.09202 21.2375 2.03711 21.0056C1.9822 20.7737 1.99289 20.5312 2.06799 20.3051L2.696 18.422L5.574 21.3ZM4.13499 14.105L9.891 19.861L19.245 10.507L13.489 4.75098L4.13499 14.105Z"
fill="currentColor" />
</svg>
</span>
</a>
{{-- Delete --}}
@if ($obj->active == 1)
<a href="#" data-id="{{ $obj->id }}"
class="btn btn-icon btn-bg-light btn-active-color-primary btn-sm delete-item">
<span class="svg-icon svg-icon-3">
<svg width="24" height="24" viewBox="0 0 24 24"
fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M5 9C5 8.44772 5.44772 8 6 8H18C18.5523 8 19 8.44772 19 9V18C19 19.6569 17.6569 21 16 21H8C6.34315 21 5 19.6569 5 18V9Z"
fill="currentColor" />
<path opacity="0.5"
d="M5 5C5 4.44772 5.44772 4 6 4H18C18.5523 4 19 4.44772 19 5V5C19 5.55228 18.5523 6 18 6H6C5.44772 6 5 5.55228 5 5V5Z"
fill="currentColor" />
<path opacity="0.5"
d="M9 4C9 3.44772 9.44772 3 10 3H14C14.5523 3 15 3.44772 15 4V4H9V4Z"
fill="currentColor" />
</svg>
</span>
</a>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
{{-- <div class="modal fade" id="deleteModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered mw-650px">
<form class="form-horizontal" action="{{ url('user/delete') }}" method="POST">
<input type="hidden" id="item_id" name="item_id" value="">
<input type="hidden" name="_method" value="POST">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="modal-content">
<!--begin::Modal body-->
<div class="modal-body scroll-y mx-5 mx-xl-15 my-7">
<!--begin::Notice-->
<!--begin::Notice-->
<div class="notice d-flex bg-light-warning rounded border-warning border border-dashed mb-9 p-6">
<!--begin::Icon-->
<!--begin::Svg Icon | path: icons/duotune/general/gen044.svg-->
<span class="svg-icon svg-icon-2tx svg-icon-warning me-4">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none"
xmlns="http://www.w3.org/2000/svg">
<rect opacity="0.3" x="2" y="2" width="20" height="20"
rx="10" fill="currentColor" />
<rect x="11" y="14" width="7" height="2" rx="1"
transform="rotate(-90 11 14)" fill="currentColor" />
<rect x="11" y="17" width="2" height="2" rx="1"
transform="rotate(-90 11 17)" fill="currentColor" />
</svg>
</span>
<div class="d-flex flex-stack flex-grow-1">
<!--begin::Content-->
<div class="fw-semibold">
<div class="fs-6 text-gray-700">
<strong class="me-1">Confirm Delete</strong>
Please ensure you're absolutely certain
before proceeding.
</div>
</div>
<!--end::Content-->
</div>
<!--end::Wrapper-->
</div>
<!--end::Notice-->
<!--begin::Actions-->
<div class="text-center pt-15">
<div class="swal2-actions" style="display: flex;">
<div class="swal2-loader"></div>
<button type="submit" class="btn fw-bold btn-danger" aria-label=""
style="display: inline-block;">Yes
</button>
<button type="reset" class="btn btn-light fw-bold btn-active-light-primary hide-item"
aria-label="" style="display: inline-block; margin-left:10px;">No
</button>
</div>
</div>
<!--end::Actions-->
</div>
<!--end::Modal body-->
</div>
</form>
</div>
</div> --}}
@stop
@section('script')
<script type="text/javascript">
var datatable;
datatable = $("#data-table-user").DataTable({
"info": false,
"order": [],
"pageLength": 25,
lengthMenu: [
[10, 25, 50, 100, 500, 1000],
[10, 25, 50, 100, 500, 1000]
]
});
// Filter by search
const filterSearch = document.querySelector('[table-filter="search"]');
filterSearch.addEventListener('keyup', function(e) {
datatable.search(e.target.value).draw();
});
// filter by status
const filterStatus = document.querySelector('[table-filter="status"]');
$(filterStatus).on('change', e => {
let value = e.target.value;
if (value === 'all') {
value = '';
}
datatable.column(5).search(value).draw();
});
// Remove
$(document).on('click', '.delete-item', function() {
// $('#deleteModal #item_id').val($(this).data('id'));
// showModal('#deleteModal');
swal.fire({
allowOutsideClick: false,
text: "Are you sure you would like to Delete?",
icon: "warning",
buttonsStyling: false,
showDenyButton: true,
confirmButtonText: "Yes",
denyButtonText: 'No',
customClass: {
confirmButton: "btn btn-primary",
denyButton: "btn btn-light-danger"
}
}).then((result) => {
if (result.isConfirmed) {
alertLoading("Loading")
// set up ajax
initAjaxSetupToken();
const ajaxProp = {
url: "{{ url('user/delete') }}",
type: 'POST',
data: {
item_id: $(this).data('id')
},
};
$.ajax(ajaxProp).done(function(res) {
if (isAjaxStatusSuccess(res.status)) {
const url = "{{ url('user') }}";
alertSuccessWithUrl('Notice', "Delete success", url);
hideLoading();
} else {
alertFail('Notice', res.message ?? "Unsuccessfully");
hideLoading();
}
}).fail(function(xhr, status, error) {
logAjaxError(xhr, status, error);
alertFail('Notice', error.message ?? "Unsuccessfully");
hideLoading();
});
}
});
});
// $(document).on('click', '.hide-item', function() {
// hideModal('#deleteModal');
// });
</script>
@endsection