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

View File

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