progress penyesuaian
This commit is contained in:
parent
7aa749216c
commit
8654e70e9a
@ -347,4 +347,29 @@ class DashboardController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function dashboardVersion2(){
|
||||||
|
$data = [
|
||||||
|
'title' => 'Dashboard',
|
||||||
|
];
|
||||||
|
return view('dashboardV2.index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function dataDocumentLast(){
|
||||||
|
$perPage = request('per_page', 10);
|
||||||
|
$data = FileDirectory::where('statusenabled', true)
|
||||||
|
->orderBy('entry_at', 'desc')
|
||||||
|
->paginate($perPage);
|
||||||
|
$payload = [
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Berhasil mendapatkan data',
|
||||||
|
'data' => $data->items(),
|
||||||
|
'pagination' => [
|
||||||
|
'current_page' => $data->currentPage(),
|
||||||
|
'next_page' => $data->hasMorePages() ? $data->currentPage() + 1 : null,
|
||||||
|
'has_more' => $data->hasMorePages()
|
||||||
|
]
|
||||||
|
];
|
||||||
|
return response()->json($payload);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,9 +12,10 @@ class FileDirectory extends Model
|
|||||||
protected $primaryKey = 'file_directory_id';
|
protected $primaryKey = 'file_directory_id';
|
||||||
protected $guarded = ['file_directory_id'];
|
protected $guarded = ['file_directory_id'];
|
||||||
|
|
||||||
protected $with = ['klasifikasi'];
|
// protected $with = ['klasifikasi'];
|
||||||
|
|
||||||
|
// // public function klasifikasi(){
|
||||||
|
// // return $this->belongsTo(MasterKlasifikasi::class, 'master_klasifikasi_directory_id', 'master_klasifikasi_directory_id');
|
||||||
|
// // }
|
||||||
|
|
||||||
public function klasifikasi(){
|
|
||||||
return $this->belongsTo(MasterKlasifikasi::class, 'master_klasifikasi_directory_id', 'master_klasifikasi_directory_id');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
function renderTree(units, katDok, keyword) {
|
function renderTree(units, katDok, keyword) {
|
||||||
if (!Array.isArray(units)) return '';
|
if (!Array.isArray(units)) return '';
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ function renderTree(units, katDok, keyword) {
|
|||||||
data-klasifikasi="${file?.klasifikasi?.nama_klasifikasi_directory}"
|
data-klasifikasi="${file?.klasifikasi?.nama_klasifikasi_directory}"
|
||||||
data-id="${file?.file_directory_id}"
|
data-id="${file?.file_directory_id}"
|
||||||
title="Diupload oleh: ${uploadedBy} pada ${uploadedAt}">
|
title="Diupload oleh: ${uploadedBy} pada ${uploadedAt}">
|
||||||
${fileName} - <strong>(${file?.klasifikasi?.nama_klasifikasi_directory})</strong>
|
${fileName}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<small class="text-muted fst-italic">
|
<small class="text-muted fst-italic">
|
||||||
|
|||||||
85
resources/views/dashboardV2/index.blade.php
Normal file
85
resources/views/dashboardV2/index.blade.php
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
@extends('layout.main')
|
||||||
|
@section('body_main')
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h4 class="mb-0">Data Terakhir</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-2">
|
||||||
|
<div class="d-flex mb-3">
|
||||||
|
<input type="text" onchange="searchData(this)" class="form-control form-control-sm" placeholder="Search">
|
||||||
|
<button type="button" class="btn btn-primary ms-2">Cari</button>
|
||||||
|
</div>
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Nama</th>
|
||||||
|
<th>File Folder</th>
|
||||||
|
<th>Tanggal Modifikasi</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="tableFolderLastUpdated">
|
||||||
|
<!-- data dari fetch masuk sini -->
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function fetchData(){
|
||||||
|
fetch(`/last-document`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
const tbody = document.getElementById('tableFolderLastUpdated');
|
||||||
|
const resData = data?.data || [];
|
||||||
|
|
||||||
|
if (resData.length === 0) {
|
||||||
|
tbody.innerHTML = `
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" class="text-center text-muted">
|
||||||
|
Tidak ada data
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tbody.innerHTML = resData.map(item => {
|
||||||
|
const fullPath = item.file;
|
||||||
|
|
||||||
|
const parts = fullPath.split('/');
|
||||||
|
|
||||||
|
const fileName = parts.pop(); // ambil paling belakang
|
||||||
|
const folderPath = parts.join('/'); // gabung sisanya
|
||||||
|
|
||||||
|
return `
|
||||||
|
<tr>
|
||||||
|
<td>${fileName}</td>
|
||||||
|
<td>${folderPath}</td>
|
||||||
|
<td>${formatTanggal(item.entry_at)}</td>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
}).join('');
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(error => console.error('Error : ', error))
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatTanggal(dateString) {
|
||||||
|
const d = new Date(dateString);
|
||||||
|
|
||||||
|
return d.toLocaleDateString('id-ID', {
|
||||||
|
day: '2-digit',
|
||||||
|
month: 'short',
|
||||||
|
year: 'numeric',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
fetchData()
|
||||||
|
</script>
|
||||||
|
@endsection
|
||||||
@ -22,6 +22,12 @@
|
|||||||
<span class="hide-menu">Dashboard</span>
|
<span class="hide-menu">Dashboard</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="sidebar-item">
|
||||||
|
<a class="sidebar-link" href="/new" aria-expanded="false">
|
||||||
|
<i class="ti ti-atom"></i>
|
||||||
|
<span class="hide-menu">Dashboard V2</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<!-- ---------------------------------- -->
|
<!-- ---------------------------------- -->
|
||||||
<!-- Dashboard -->
|
<!-- Dashboard -->
|
||||||
<!-- ---------------------------------- -->
|
<!-- ---------------------------------- -->
|
||||||
|
|||||||
@ -10,6 +10,8 @@ use Illuminate\Support\Facades\Route;
|
|||||||
Route::middleware(['auth'])->group(function(){
|
Route::middleware(['auth'])->group(function(){
|
||||||
|
|
||||||
Route::get('/', [DashboardController::class, 'index']);
|
Route::get('/', [DashboardController::class, 'index']);
|
||||||
|
Route::get('/new', [DashboardController::class, 'dashboardVersion2']);
|
||||||
|
Route::get('/last-document', [DashboardController::class, 'dataDocumentLast']);
|
||||||
Route::post('/upload', [DashboardController::class, 'store']);
|
Route::post('/upload', [DashboardController::class, 'store']);
|
||||||
Route::get('/data-unit-kerja', [DashboardController::class, 'dataUnitKerja']);
|
Route::get('/data-unit-kerja', [DashboardController::class, 'dataUnitKerja']);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user