241 lines
11 KiB
PHP
241 lines
11 KiB
PHP
@extends('layouts.main')
|
|
|
|
@section('breadcrumbs')
|
|
{{ Breadcrumbs::render('penilai') }}
|
|
@endsection
|
|
|
|
@section('content')
|
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
|
|
|
|
|
<div class="card border border-agi-100 card-grid min-w-full" data-datatable="false" data-datatable-page-size="10"
|
|
data-datatable-state-save="false" id="penilai-table" data-api-url="{{ route('penilai.dataForTables') }}">
|
|
<div class="card-header bg-agi-50 py-5 flex-wrap">
|
|
<h3 class="card-title">
|
|
Penilai
|
|
</h3>
|
|
<div class="flex flex-wrap gap-2 lg:gap-5">
|
|
<div class="flex">
|
|
<label class="input input-sm"> <i class="ki-filled ki-magnifier"> </i>
|
|
<input placeholder="Search Penilai" id="search" type="text" value="">
|
|
</label>
|
|
</div>
|
|
<div class="flex flex-wrap gap-2.5">
|
|
<div class="h-[24px] border border-r-gray-200"></div>
|
|
<a class="btn btn-sm btn-light" href="#"> Export to Excel </a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
<div class="scrollable-x-auto">
|
|
<table class="table table-auto table-border align-middle text-gray-700 font-medium text-sm"
|
|
data-datatable-table="true">
|
|
<thead>
|
|
<tr>
|
|
<th class="w-14">
|
|
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox" />
|
|
</th>
|
|
<th class="min-w-[150px]" data-datatable-column="nomor_registrasi">
|
|
<span class="sort"> <span class="sort-label"> Nomor Registrasi </span>
|
|
<span class="sort-icon"> </span> </span>
|
|
</th>
|
|
<th class="min-w-[150px]" data-datatable-column="debitur_id">
|
|
<span class="sort"> <span class="sort-label"> Debitur </span>
|
|
<span class="sort-icon"> </span> </span>
|
|
</th>
|
|
<th class="min-w-[150px]" data-datatable-column="branch_id">
|
|
<span class="sort"> <span class="sort-label"> Pemohon(Cabang/Direktorat) </span>
|
|
<span class="sort-icon"> </span> </span>
|
|
</th>
|
|
<th class="min-w-[150px]" data-datatable-column="user_id">
|
|
<span class="sort"> <span class="sort-label"> AO </span>
|
|
<span class="sort-icon"> </span> </span>
|
|
</th>
|
|
<th class="min-w-[150px]" data-datatable-column="tujuan_penilaian_id">
|
|
<span class="sort"> <span class="sort-label"> Tujuan Penilaian </span>
|
|
<span class="sort-icon"> </span> </span>
|
|
</th>
|
|
<th class="min-w-[150px]" data-datatable-column="jenis_fasilitas_kredit_id">
|
|
<span class="sort"> <span class="sort-label"> Fasilitas Kredit </span>
|
|
<span class="sort-icon"> </span> </span>
|
|
</th>
|
|
<th class="min-w-[150px]" data-datatable-column="tanggal_survei">
|
|
<span class="sort"> <span class="sort-label"> Tanggal Survei </span>
|
|
<span class="sort-icon"> </span> </span>
|
|
</th>
|
|
<th class="min-w-[150px]" data-datatable-column="due_date_sla">
|
|
<span class="sort"> <span class="sort-label"> Due Date SLA </span>
|
|
<span class="sort-icon"> </span> </span>
|
|
</th>
|
|
<th class="min-w-[150px]" data-datatable-column="status">
|
|
<span class="sort"> <span class="sort-label"> Status</span>
|
|
<span class="sort-icon"> </span> </span>
|
|
</th>
|
|
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
<div
|
|
class="card-footer justify-center md:justify-between flex-col md:flex-row gap-3 text-gray-600 text-2sm font-medium">
|
|
<div class="flex items-center gap-2">
|
|
Show
|
|
<select class="select select-sm w-16" data-datatable-size="true" name="perpage"> </select> per
|
|
page
|
|
</div>
|
|
<div class="flex items-center gap-4">
|
|
<span data-datatable-info="true"> </span>
|
|
<div class="pagination" data-datatable-pagination="true">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
@endsection
|
|
|
|
|
|
@push('scripts')
|
|
<script type="text/javascript">
|
|
function formatDate(date) {
|
|
const day = date.getDate().toString().padStart(2, '0');
|
|
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
// Months are 0-indexed
|
|
const year = date.getFullYear();
|
|
|
|
return `${day} ${getIndonesianMonth(month)} ${year}`;
|
|
}
|
|
|
|
function getIndonesianMonth(month) {
|
|
const months = ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni',
|
|
'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'
|
|
];
|
|
return months[month -
|
|
1];
|
|
}
|
|
</script>
|
|
<script type="module">
|
|
const element = document.querySelector('#penilai-table');
|
|
const searchInput = document.getElementById('search');
|
|
|
|
const apiUrl = element.getAttribute('data-api-url');
|
|
const dataTableOptions = {
|
|
apiEndpoint: apiUrl,
|
|
pageSize: 5,
|
|
columns: {
|
|
select: {
|
|
render: (item, data, context) => {
|
|
const checkbox = document.createElement('input');
|
|
checkbox.className = 'checkbox checkbox-sm';
|
|
checkbox.type = 'checkbox';
|
|
checkbox.value = data.id.toString();
|
|
checkbox.setAttribute('data-datatable-row-check', 'true');
|
|
return checkbox.outerHTML.trim();
|
|
},
|
|
},
|
|
nomor_registrasi: {
|
|
title: 'Nomor Registrasi',
|
|
},
|
|
debitur_id: {
|
|
title: 'Debitur',
|
|
render: (item, data) => {
|
|
return data.debiture && data.debiture.name ? `${data.debiture.name}` : '-';
|
|
},
|
|
},
|
|
branch_id: {
|
|
title: 'Cabang Pemohon',
|
|
render: (item, data) => {
|
|
return data.branch && data.branch.name ? `${data.branch.name}` : '-';
|
|
},
|
|
},
|
|
user_id: {
|
|
title: 'User Pemohon',
|
|
render: (item, data) => {
|
|
return data.user && data.user.name ? `${data.user.name}` : '-';
|
|
},
|
|
},
|
|
tujuan_penilaian_id: {
|
|
title: 'Tujuan Penilaian',
|
|
render: (item, data) => {
|
|
return data.tujuan_penilaian && data.tujuan_penilaian.name ? `${data.tujuan_penilaian.name}` : '-';
|
|
},
|
|
},
|
|
jenis_fasilitas_kredit_id: {
|
|
title: 'Fasilitas Kredit',
|
|
render: (item, data) => {
|
|
return data.jenisfasilitas_kredit && data.jenisfasilitas_kredit.name ? `${data.jenisfasilitas_kredit.name}` : '-';
|
|
},
|
|
},
|
|
tanggal_survei: {
|
|
title: 'Tanggal Survei',
|
|
render: (item, data) => {
|
|
return `${formatDate(new Date(data.created_at))}`;
|
|
},
|
|
},
|
|
due_date_sla: {
|
|
title: 'Due Date SLA',
|
|
render: (item, data) => {
|
|
return `${formatDate(new Date(data.created_at))}`;
|
|
},
|
|
},
|
|
status: {
|
|
title: 'Status',
|
|
render: (item, data) => {
|
|
return `<span class="badge badge-sm badge-default uppercase flex justify-center">${data.status.replace(/-/g, ' ')}</span>`;
|
|
},
|
|
},
|
|
actions: {
|
|
title: 'Action',
|
|
render: (item, data) => {
|
|
if (data.status === 'survey-completed' || data.status === 'proses-laporan' || data.status === 'paparan' || data.status === 'proses-paparan' || data.status === 'paparan' || data.status == 'revisi-laporan') {
|
|
return `
|
|
<div class="flex flex-nowrap justify-center gap-1.5">
|
|
<a class="btn btn-sm btn-outline btn-info" href="penilai/${data.id}/show">
|
|
<i class="ki-outline ki-eye"></i>
|
|
</a>
|
|
</div>`;
|
|
} else {
|
|
return `<div class="flex flex-nowrap justify-center">
|
|
<a class="btn btn-sm btn-icon btn-clear btn-success" onclick="showLoadingSwal('Masih Menunggu proses inspeksi dari surveyor...')">
|
|
<i class="ki-filled ki-watch"></i>
|
|
</a>
|
|
</div>`
|
|
}
|
|
|
|
},
|
|
}
|
|
},
|
|
};
|
|
|
|
let dataTable = new KTDataTable(element, dataTableOptions);
|
|
// Custom search functionality
|
|
searchInput.addEventListener('input', function() {
|
|
const searchValue = this.value.trim();
|
|
dataTable.search(searchValue, true);
|
|
|
|
});
|
|
</script>
|
|
|
|
<script>
|
|
function showLoadingSwal(message, duration = 5000) {
|
|
Swal.fire({
|
|
title: message,
|
|
allowOutsideClick: false,
|
|
didOpen: () => {
|
|
Swal.showLoading();
|
|
},
|
|
timer: duration, // Durasi dalam milidetik
|
|
timerProgressBar: true, // Menampilkan progres bar timer
|
|
}).then((result) => {
|
|
if (result.dismiss === Swal.DismissReason.timer) {
|
|
console.log('Dialog loading otomatis ditutup.');
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
@endpush
|