245 lines
12 KiB
PHP
245 lines
12 KiB
PHP
@extends('layouts.main')
|
|
@section('breadcrumbs')
|
|
{{ Breadcrumbs::render('activity.progres') }}
|
|
@endsection
|
|
@section('content')
|
|
@push('styles')
|
|
<style>
|
|
.dropdown {
|
|
position: relative;
|
|
display: inline-block;
|
|
}
|
|
|
|
.dropdowns-content {
|
|
display: none;
|
|
position: absolute;
|
|
background-color: white;
|
|
min-width: 224px;
|
|
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
|
|
z-index: 1;
|
|
}
|
|
|
|
.dropdown:hover .dropdowns-content {
|
|
display: block;
|
|
}
|
|
|
|
.dropdowns-content a {
|
|
color: black;
|
|
padding: 12px 16px;
|
|
text-decoration: none;
|
|
display: block;
|
|
}
|
|
|
|
.dropdowns-content a:hover {
|
|
background-color: #f1f1f1;
|
|
}
|
|
</style>
|
|
@endpush
|
|
|
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
|
<div class="card min-w-full">
|
|
<div class="card-header">
|
|
<h3 class="card-title">Team Activity</h3>
|
|
</div>
|
|
<div data-accordion="true">
|
|
|
|
@php
|
|
|
|
$sortedTeamsActivity = $teamsActivity->sortBy(function ($item) {
|
|
return $item->team->penilaian
|
|
->filter(function ($penilaian) use ($item) {
|
|
return $penilaian->penilaian_id == $item->user->id ||
|
|
$penilaian->surveyor_id == $item->user->id ||
|
|
$penilaian->penilai_surveyor_id == $item->user->id;
|
|
})
|
|
->count();
|
|
});
|
|
@endphp
|
|
|
|
@foreach ($sortedTeamsActivity as $index => $item)
|
|
<div class="accordion-item [&:not(:last-child)]:border-b border-b-gray-200" data-accordion-item="true"
|
|
id="accordion_{{ $index }}">
|
|
<button class="accordion-toggle py-4 group mx-8"
|
|
data-accordion-toggle="#accordion_{{ $index }}content_{{ $index }}"
|
|
style="margin-start: 10px">
|
|
<table class="table table-auto align-middle text-gray-700 font-medium text-sm">
|
|
<tr>
|
|
<th class="min-w-[150px]">
|
|
<span class="text-base text-gray-900 font-normal">{{ $item->user->name }}</span>
|
|
</th>
|
|
<th class="min-w-[150px]">
|
|
<span class="text-base text-gray-900 font-normal">
|
|
@php
|
|
$totalTasks = $item->team->penilaian
|
|
->filter(function ($penilaian) use ($item) {
|
|
return $penilaian->penilaian_id == $item->user->id ||
|
|
$penilaian->surveyor_id == $item->user->id ||
|
|
$penilaian->penilai_surveyor_id == $item->user->id;
|
|
})
|
|
->count();
|
|
@endphp
|
|
<p>Total Task: {{ $totalTasks }}</p>
|
|
</span>
|
|
</th>
|
|
<th>
|
|
<i
|
|
class="ki-outline ki-plus text-gray-600 text-2sm accordion-active:hidden block"></i>
|
|
<i
|
|
class="ki-outline ki-minus text-gray-600 text-2sm accordion-active:block hidden"></i>
|
|
</th>
|
|
</tr>
|
|
</table>
|
|
</button>
|
|
<div class="accordion-content hidden" id="accordion_{{ $index }}content_{{ $index }}">
|
|
<div class="mx-8 pb-4" style="margin-bottom: 20px">
|
|
<div class="card card-grid min-w-full" data-datatable="false"
|
|
id="activity-table-{{ $index }}"
|
|
data-api-url="{{ route('activity.progres.datatables', ['id' => $item->user->id ]) }}">
|
|
<div class="card-body">
|
|
<div class="scrollable-x-auto">
|
|
<table
|
|
class="table table-auto align-middle text-gray-700 font-medium text-sm my-4"
|
|
data-datatable-table="true">
|
|
<thead>
|
|
<tr>
|
|
<th class="min-w-[100px]">Nama Debitur</th>
|
|
<th class="min-w-[100px]">Tujuan Penilaian</th>
|
|
<th class="min-w-[100px]">Jenis Asset</th>
|
|
<th class="min-w-[100px]">Jenis Report</th>
|
|
<th class="min-w-[100px]">Tgl Register</th>
|
|
<th class="min-w-[100px]">Tgl Assign</th>
|
|
<th class="min-w-[100px]">Tgl Kunjungan</th>
|
|
<th class="min-w-[100px]">Progress</th>
|
|
<th class="min-w-[100px]">Due Date SLA</th>
|
|
<th class="min-w-[100px]">Paparan</th>
|
|
<th class="min-w-[100px]">Approve</th>
|
|
<th class="min-w-[50px] text-center">Keterangan</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td colspan="12" class="text-center">No data available</td>
|
|
</tr>
|
|
</tbody>
|
|
</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>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<script type="module">
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
const accordions = document.querySelectorAll('[data-accordion-item]');
|
|
|
|
accordions.forEach((accordion, index) => {
|
|
accordion.querySelector('.accordion-toggle').addEventListener('click', () => {
|
|
const apiUrl = accordion.querySelector('.card-grid').getAttribute(
|
|
'data-api-url');
|
|
|
|
console.log("This is the API URL: " + apiUrl);
|
|
|
|
const dataTableOptions = {
|
|
apiEndpoint: apiUrl,
|
|
pageSize: 5,
|
|
order: [{
|
|
column: 'nomor_registrasi',
|
|
dir: 'asc'
|
|
}],
|
|
columns: {
|
|
nama_debitur: {
|
|
title: 'Nama Debitur',
|
|
render: (item, data) => {
|
|
return `${data.permohonan.debiture.name}`
|
|
},
|
|
},
|
|
tujuan_penilaian: {
|
|
title: 'Tujuan Penilaian',
|
|
render: (item, data) => {
|
|
return `${data.permohonan.tujuan_penilaian?.name || ''}`;
|
|
},
|
|
},
|
|
jenis_asset: {
|
|
title: 'Jenis Asset',
|
|
render: (item, data) => `${data.permohonan.debiture.documents.map(d => d.jenis_jaminan.name) || ''}`,
|
|
},
|
|
jenis_report: {
|
|
title: 'Jenis Report',
|
|
render: (item, data) => `${data.jenis_report || ''}`,
|
|
},
|
|
register: {
|
|
title: 'Register',
|
|
render: (item, data) =>
|
|
`${formatDateFromISO(data.permohonan.created_at) || ''}`,
|
|
|
|
},
|
|
assign: {
|
|
title: 'Assign',
|
|
render: (item, data) => `${formatDateFromISO(data.created_at)}`,
|
|
},
|
|
tanggal_kunjungan: {
|
|
title: 'Tgl Kunjungan',
|
|
render: (item, data) =>
|
|
`${formatDateFromISO(data.tanggal_kunjungan) || ''}`,
|
|
},
|
|
progress: {
|
|
title: 'Progress',
|
|
render: (item, data) => `${data.progress || ''}`,
|
|
},
|
|
due_date: {
|
|
title: 'Due Date',
|
|
render: (item, data) => `${data.due_date || ''}`,
|
|
},
|
|
paparan: {
|
|
title: 'Paparan',
|
|
render: (item, data) => `${data.paparan || ''}`,
|
|
},
|
|
approve: {
|
|
title: 'Approve',
|
|
render: (item, data) => `${data.approve || ''}`,
|
|
},
|
|
actions: {
|
|
title: 'Keterangan',
|
|
render: (item, data) => `${data.keterangan || ''}`,
|
|
},
|
|
},
|
|
};
|
|
|
|
// Initialize DataTable only for the active accordion
|
|
if (!accordion.querySelector('.dataTable')) {
|
|
const element = accordion.querySelector('.card-grid');
|
|
new KTDataTable(element, dataTableOptions);
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
function formatDateFromISO(isoDateString) {
|
|
const date = new Date(isoDateString);
|
|
const day = String(date.getDate()).padStart(2, '0');
|
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
const year = String(date.getFullYear()).slice(-2);
|
|
return `${day}-${month}-${year}`;
|
|
}
|
|
</script>
|
|
@endpush
|