done -> next up production

This commit is contained in:
JokoPrasetio 2026-03-31 07:55:26 +07:00
parent 99a34e8e59
commit a0b32672b4
2 changed files with 14 additions and 12 deletions

View File

@ -24,18 +24,17 @@ class LogActivityController extends Controller
$start = request('start_date');
$end = request('end_date');
$mapping = MappingUnitKerjaPegawai::where('statusenabled', true);
// dd(auth()->user());
if(!Auth::guard('admin')){
if(!Auth::guard('admin')->check()){
$mapping->where('objectpegawaifk', auth()->user()->dataUser->id);
}else{
$mapping->where('objectpegawaifk', 937);
}
$mapping->get(['objectunitkerjapegawaifk', 'objectsubunitkerjapegawaifk']);
$mapping->get(['objectunitkerjapegawaifk', 'objectsubunitkerjapegawaifk']);
$unitIds = $mapping->pluck('objectunitkerjapegawaifk')
->filter() // buang null
->unique()
->values()
->all();
->filter() // buang null
->unique()
->values()
->all();
$query = FileDirectory::withCount(['viewLogs as total_views' => function($q){
$q->select(DB::raw('COUNT(DISTINCT pegawai_id_entry)'));
}])->withCount(['downloadLogs as total_download' => function($q){
@ -43,9 +42,12 @@ class LogActivityController extends Controller
}])
->where('statusenabled', true)
->where('status_action', 'approved');
if(in_array(22, $unitIds) || Auth::guard('admin') && Auth::guard('admin')->user()->id == 300){
if (
in_array(22, $unitIds) ||
(Auth::guard('admin')->check() && Auth::guard('admin')->user()->id == 300)
) {
}else{
$query = $baseQuery->whereIn('id_unit_kerja', $unitIds);
$query = $query->whereIn('id_unit_kerja', $unitIds);
}
$query = $query->orderBy('entry_at','desc');

View File

@ -139,7 +139,7 @@ document.addEventListener('DOMContentLoaded', () => {
const paginationBtns = document.getElementById('logPaginationBtns');
const summaryText = document.getElementById('logSummaryText');
if(tbody) tbody.innerHTML = '<tr><td colspan="4" class="text-center text-muted py-3">Memuat...</td></tr>';
if(tbody) tbody.innerHTML = '<tr><td colspan="5" class="text-center text-muted py-3">Memuat...</td></tr>';
if(summaryText) summaryText.textContent = 'Memuat data...';
if(searchInput) searchInput.value = keyword || '';
@ -165,7 +165,7 @@ document.addEventListener('DOMContentLoaded', () => {
</tr>
`).join('');
const emptyState = logs.length === 0 ? '<tr><td colspan="5" class="text-center text-muted py-3">Belum ada aktivitas</td></tr>' : '';
const emptyState = logs.length === 0 ? '<tr><td colspan="6" class="text-center text-muted py-3">Belum ada aktivitas</td></tr>' : '';
if(tbody) tbody.innerHTML = logs.length ? rows : emptyState;
if(summaryText){
@ -256,7 +256,7 @@ document.addEventListener('DOMContentLoaded', () => {
if(pageData.length === 0){
tbody.innerHTML = `
<tr>
<td colspan="6" class="text-center text-muted py-4">
<td colspan="7" class="text-center text-muted py-4">
Tidak ada data
</td>
</tr>