progress
This commit is contained in:
parent
ba857bea05
commit
f19a414f22
@ -1991,7 +1991,7 @@ class DashboardController extends Controller
|
||||
$start = request('start_date');
|
||||
$end = request('end_date');
|
||||
$isHistory = filter_var(request('history'), FILTER_VALIDATE_BOOLEAN);
|
||||
$query = FileDirectory::where('statusenabled', true)
|
||||
$query = FileDirectory::with('kategori')->where('statusenabled', true)
|
||||
->where('pegawai_id_entry', auth()->user()->objectpegawaifk)
|
||||
->when($isHistory, function($q){
|
||||
$q->where('status_action', 'approved');
|
||||
@ -2014,7 +2014,6 @@ class DashboardController extends Controller
|
||||
if($end){
|
||||
$query->whereDate('entry_at','<=',$end);
|
||||
}
|
||||
|
||||
$paginated = $query->paginate($perPage);
|
||||
$data = $paginated->getCollection()->map(function($item){
|
||||
$dataSlice = array_values(array_filter(explode('/', $item->file)));
|
||||
@ -2037,7 +2036,10 @@ class DashboardController extends Controller
|
||||
'id_sub_unit_kerja' => $item->id_sub_unit_kerja,
|
||||
'master_kategori_directory_id' => $item->master_kategori_directory_id,
|
||||
'is_akre' => $item->is_akre,
|
||||
'kategori_hukum' => $item->kategori_hukum
|
||||
'kategori_hukum' => $item->kategori_hukum,
|
||||
'name_kategori' => $item->kategori_hukum ?? $item->kategori?->nama_kategori_directory ?? null,
|
||||
'name_unit' => $item->unit?->name ?? null,
|
||||
'unit_kerja_name' => $item->unit?->name ?? null
|
||||
];
|
||||
});
|
||||
return response()->json([
|
||||
@ -2237,6 +2239,8 @@ class DashboardController extends Controller
|
||||
'id_unit_kerja' => $data ? $data->id_unit_kerja : null,
|
||||
'id_sub_unit_kerja' => $data ? $data->id_sub_unit_kerja : null,
|
||||
'action_type' => 'Revisi Dokumen',
|
||||
'is_akre' => $data->is_akre ?? null,
|
||||
'kategori_hukum' => $data->kategori_hukum ?? null
|
||||
];
|
||||
LogActivity::create($payloadLog);
|
||||
|
||||
@ -2390,8 +2394,7 @@ class DashboardController extends Controller
|
||||
{
|
||||
$keyword = $request->query('keyword');
|
||||
$perPage = (int) $request->query('per_page', 10);
|
||||
$query = FileDirectory::withOut('unit')
|
||||
->where('statusenabled', true)
|
||||
$query = FileDirectory::where('statusenabled', true)
|
||||
->where('status_action', 'approved')
|
||||
->where('is_akre', true);
|
||||
|
||||
|
||||
@ -118,8 +118,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
data-permission_file="${item.permission_file || '-'}">${item.nama_dokumen}</a></td>
|
||||
${item.is_akre ? `<td colspan="2" class="text-center">Dokumen akreditasi</td>` :
|
||||
`
|
||||
<td>${item.folder || '-'}</td>
|
||||
<td>${item.part || '-'}</td>
|
||||
<td>${item.name_kategori || '-'}</td>
|
||||
<td>${item.name_unit || '-'}</td>
|
||||
`
|
||||
}
|
||||
|
||||
@ -404,6 +404,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
if (window.$ && $.fn.select2) $(selectEl).trigger('change');
|
||||
}
|
||||
|
||||
function arrayFilterEmpty(arr){
|
||||
return (arr || []).filter((val) => val !== null && val !== undefined && String(val).trim() !== '');
|
||||
}
|
||||
|
||||
function initSelect2($el, options){
|
||||
if (!$el || !$el.length || !window.$ || !$.fn.select2) return;
|
||||
$el.select2(options);
|
||||
@ -426,7 +430,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
processResults: function (data) {
|
||||
return {
|
||||
results: (data?.data || []).map(item => ({
|
||||
id: `${item.id}/${item.name}`,
|
||||
id: String(item.id),
|
||||
text: item.name
|
||||
}))
|
||||
};
|
||||
@ -449,8 +453,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
editUnitSelect.on('change', function(){
|
||||
const val = $(this).val();
|
||||
if (!val) return;
|
||||
const unitId = String(val).split('/')[0];
|
||||
loadEditSubUnit(unitId, null, null);
|
||||
loadEditSubUnit(String(val), null, null);
|
||||
});
|
||||
}
|
||||
|
||||
@ -494,13 +497,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
success: function(response) {
|
||||
if (response?.data) {
|
||||
response.data.forEach(unit => {
|
||||
const optVal = `${unit.id}/${unit.name}`;
|
||||
const optVal = String(unit.id);
|
||||
const isSelected = selectedSubId && String(unit.id) === String(selectedSubId);
|
||||
const option = new Option(unit.name, optVal, false, isSelected);
|
||||
editSubUnitSelect.append(option);
|
||||
});
|
||||
if (selectedSubId && selectedSubName && editSubUnitSelect.find(`option[value="${selectedSubId}/${selectedSubName}"]`).length === 0) {
|
||||
editSubUnitSelect.append(new Option(selectedSubName, `${selectedSubId}/${selectedSubName}`, true, true));
|
||||
if (selectedSubId && selectedSubName && editSubUnitSelect.find(`option[value="${selectedSubId}"]`).length === 0) {
|
||||
editSubUnitSelect.append(new Option(selectedSubName, String(selectedSubId), true, true));
|
||||
}
|
||||
editSubUnitSelect.trigger('change');
|
||||
}
|
||||
@ -513,7 +516,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
if (!akreEl) return;
|
||||
loadAkreData().then(() => {
|
||||
fillAkreSelect(akreEl);
|
||||
setSelectValue(akreEl, value, value);
|
||||
if (value && akreValueExists(value)) {
|
||||
setSelectValue(akreEl, value, value);
|
||||
} else {
|
||||
akreEl.value = '';
|
||||
}
|
||||
triggerSelect2(akreEl);
|
||||
});
|
||||
}
|
||||
@ -527,9 +534,16 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
function setEditKategoriDir(item, kategoriName){
|
||||
const katEl = byId('edit_kategori');
|
||||
if (!katEl || !item.master_kategori_directory_id) return;
|
||||
const katVal = `${item.master_kategori_directory_id}/${kategoriName}`;
|
||||
setSelectValue(katEl, katVal, kategoriName || 'Kategori');
|
||||
const katId = item?.master_kategori_directory_id;
|
||||
if (!katEl || !katId) return;
|
||||
const match = Array.from(katEl.options).find((opt) => String(opt.value).startsWith(`${katId}/`));
|
||||
if (match) {
|
||||
katEl.value = match.value;
|
||||
} else {
|
||||
const label = kategoriName || 'Kategori';
|
||||
const katVal = `${katId}/${label}`;
|
||||
setSelectValue(katEl, katVal, label);
|
||||
}
|
||||
triggerSelect2(katEl);
|
||||
}
|
||||
|
||||
@ -556,21 +570,24 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const displayName = item.fileName || (item.file ? String(item.file).split('/').pop() : '');
|
||||
setTextValue(byId('edit_current_file'), displayName ? `File saat ini: ${displayName}` : '');
|
||||
|
||||
const parts = (item.file || '').split('/');
|
||||
const parts = arrayFilterEmpty((item.file || '').split('/'));
|
||||
const unitNameFromPath = parts[0] || '';
|
||||
const subNameFromPath = parts[1] || '';
|
||||
const kategoriName = parts[2] || '';
|
||||
const unitName = item.unit_kerja_name || item.nama_unit_kerja || item.unit_name || item.unit_kerja || '';
|
||||
|
||||
const unitName = item.unit_kerja_name || item.name_unit || item.nama_unit_kerja || item.unit_name || item.unit_kerja || '';
|
||||
if (editUnitSelect.length && item.id_unit_kerja) {
|
||||
const unitLabel = unitName || `Unit ${item.id_unit_kerja}`;
|
||||
const unitVal = `${item.id_unit_kerja}/${unitLabel}`;
|
||||
const unitLabel = unitName || String(item.id_unit_kerja);
|
||||
const unitVal = String(item.id_unit_kerja);
|
||||
setSelectValue(editUnitSelect[0], unitVal, unitLabel);
|
||||
editUnitSelect.trigger('change');
|
||||
loadEditSubUnit(String(item.id_unit_kerja), item.id_sub_unit_kerja, null);
|
||||
triggerSelect2(editUnitSelect[0]);
|
||||
const subLabel = item.sub_unit_kerja_name || item.nama_sub_unit_kerja || item.sub_unit_name || item.sub_unit_kerja || String(item.id_sub_unit_kerja || '');
|
||||
loadEditSubUnit(String(item.id_unit_kerja), item.id_sub_unit_kerja, subLabel || null);
|
||||
}
|
||||
|
||||
setEditKategoriDir(item, kategoriName);
|
||||
if (item.kategori_hukum) setEditKategoriHukum(item.kategori_hukum);
|
||||
setEditAkreValue(item.akre || '');
|
||||
const akreFromFile = parts.length > 1 ? parts.slice(0, -1).join('/') : '';
|
||||
setEditAkreValue(item.akre || akreFromFile || '');
|
||||
|
||||
$("#modalEditPengajuanFile").modal('show');
|
||||
}
|
||||
@ -695,6 +712,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
return akreFlat;
|
||||
}
|
||||
|
||||
function akreValueExists(value){
|
||||
if (!value) return false;
|
||||
return getAkreFlat().some(opt => String(opt.value) === String(value));
|
||||
}
|
||||
|
||||
function fillAkreSelect(selectEl){
|
||||
if(!selectEl) return;
|
||||
selectEl.innerHTML = '<option value="">Pilih Instrumen</option>';
|
||||
|
||||
@ -96,6 +96,7 @@
|
||||
<th style="width: 80px;">Aksi</th>
|
||||
<th style="width: 40%;">Nama Dokumen / Folder</th>
|
||||
<th>Tipe</th>
|
||||
<th>Unit</th>
|
||||
<th>Tgl Unggah</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -258,6 +259,7 @@
|
||||
</div>
|
||||
</td>
|
||||
<td><span class="badge bg-light text-primary border">${typeDok}</span></td>
|
||||
<td></td>
|
||||
<td>${item.entry_at || '-'}</td>
|
||||
</tr>`;
|
||||
}
|
||||
@ -319,7 +321,7 @@
|
||||
</div>
|
||||
</td>
|
||||
<td><span class="badge bg-light text-muted border-0">FOLDER</span></td>
|
||||
<td class="text-muted small">-</td> <td class="text-muted small">-</td> </tr>
|
||||
<td class="text-muted small"></td> <td class="text-muted small"></td> </tr>
|
||||
`;
|
||||
|
||||
if (isExpanded) {
|
||||
@ -389,6 +391,7 @@
|
||||
</div>
|
||||
</td>
|
||||
<td><span class="badge bg-danger">${typeDok}</span></td>
|
||||
<td>${item.unit?.name || '-'}</td>
|
||||
<td class="text-muted small">${formatDateTime(item.entry_at)}</td>
|
||||
</tr>`;
|
||||
}
|
||||
|
||||
@ -41,14 +41,14 @@
|
||||
<span class="hide-menu">Dokumen Umum</span>
|
||||
</a>
|
||||
</li>
|
||||
@if(auth()->user()->dataUser->mappingUnitKerjaPegawai()->where('objectunitkerjapegawaifk', 51)->exists())
|
||||
{{-- @if(auth()->user()->dataUser->mappingUnitKerjaPegawai()->where('objectunitkerjapegawaifk', 51)->exists()) --}}
|
||||
<li class="sidebar-item">
|
||||
<a class="sidebar-link" href="{{ url('/data-akreditasi') }}" aria-expanded="false">
|
||||
<i class="fa-solid fa-sliders"></i>
|
||||
<span class="hide-menu">Dokumen Akreditasi</span>
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
{{-- @endif --}}
|
||||
{{-- AKTIVITAS --}}
|
||||
<li class="nav-small-cap"><span class="hide-menu">Aktivitas</span></li>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user