update data pemanding dan otorisator, pembuatan seeder kjpp mengunakan exel

This commit is contained in:
majid
2024-12-11 17:34:51 +07:00
parent 5dc95d3339
commit bb1ad785a5
14 changed files with 1136 additions and 766 deletions

View File

@@ -1,16 +1,18 @@
@extends('layouts.main')
@section('breadcrumbs')
{{ Breadcrumbs::render('otorisator.'. strtolower($header)) }}
{{ Breadcrumbs::render('otorisator.' . strtolower($header)) }}
@endsection
@section('content')
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
<div class="card pb-2.5">
<div class=" card-grid min-w-full" data-datatable="false" data-datatable-page-size="5" data-datatable-state-save="false" id="permohonan-table" data-api-url="{{ route('otorisator.datatables', ['otorisator' => $header ]) }}">
<div class=" card-grid min-w-full" data-datatable="false" data-datatable-page-size="5"
data-datatable-state-save="false" id="permohonan-table"
data-api-url="{{ route('otorisator.datatables', ['otorisator' => $header]) }}">
<div class="card-header py-5 flex-wrap">
<h3 class="card-title">
Daftar {{$header}}
Daftar {{ $header }}
</h3>
<div class="flex flex-wrap gap-2 lg:gap-5">
<div class="flex">
@@ -27,46 +29,56 @@
<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">
<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="tanggal_permohonan">
<span class="sort"> <span class="sort-label"> Tanggal Permohonan </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"> User Pemohon </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"> Cabang Pemohon </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="tujuan_penilaian_id">
<span class="sort"> <span class="sort-label"> Tujuan Penilaian </span>
<span class="sort-icon"> </span> </span>
</th>
<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="tanggal_permohonan">
<span class="sort"> <span class="sort-label"> Tanggal Permohonan </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"> User Pemohon </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"> Cabang Pemohon </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="tujuan_penilaian_id">
<span class="sort"> <span class="sort-label"> Tujuan Penilaian </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
</tr>
@if ($header == 'Pembayaran')
<th class="min-w-[150px]" data-datatable-column="tujuan_penilaian_id">
<span class="sort"> <span class="sort-label"> Status Bayar </span>
<span class="sort-icon"> </span> </span>
</th>
@endif
<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="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
<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>
@@ -83,9 +95,8 @@
@push('scripts')
<script>
function otorisator(){
function otorisator() {
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
@@ -119,10 +130,11 @@
<script type="module">
<script type="module">
const element = document.querySelector('#permohonan-table');
const searchInput = document.getElementById('search');
const dataHeader = @json($header);
const apiUrl = element.getAttribute('data-api-url');
@@ -170,14 +182,43 @@
return `${data.tujuan_penilaian.name}`;
},
},
...(dataHeader === 'Pembayaran' && {
status_bayar: {
title: 'Status Bayar',
render: (item, data) => {
const status = data.status_bayar.replace(/_/g,
' ');
const statusClass = data.status_bayar === 'belum_bayar' ? 'text-red-600' :
'text-green-600';
return `<span class="text-md font-bold ${statusClass} uppercase">
${status}
</span>`;
},
},
}),
actions: {
title: 'Status',
render: (item, data) => {
return `<div class="flex flex-nowrap justify-center">
<a class="btn btn-sm btn-icon btn-clear btn-warning " href="otorisator/show/${data.id}">
if (data.status != 'proses laporan' && dataHeader != 'Pelaporan') {
return `<div class="flex flex-nowrap justify-center">
<a class="btn btn-sm btn-icon btn-clear btn-warning " href="otorisator/show/${data.id}/${dataHeader}">
<i class="ki-outline ki-eye"></i>
</a>
<a class="btn btn-sm btn-icon btn-clear btn-primary " onclick="otorisatorData(${data.id})">
<i class="ki-filled ki-double-check"></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 selesai dari penilai...')">
<i class="ki-filled ki-watch"></i>
</a>
</div>`
}
},
}
},
@@ -185,10 +226,65 @@
let dataTable = new KTDataTable(element, dataTableOptions);
// Custom search functionality
searchInput.addEventListener('input', function () {
searchInput.addEventListener('input', function() {
const searchValue = this.value.trim();
dataTable.search(searchValue, true);
});
</script>
<script>
function otorisatorData(dataId) {
const dataHeader = @json($header);
Swal.fire({
title: 'Apakah Anda yakin?',
text: `Untuk melakukan otorisator ${dataHeader}!`,
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ya, Lanjutkan!',
cancelButtonText: 'Batal',
}).then((result) => {
if (result.isConfirmed) {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
},
});
$.ajax({
url: `/otorisator/otorisator/${dataId}/${dataHeader}`,
type: 'POST',
success: (response) => {
Swal.fire('Berhasil!', 'Data berhasil diotorisasi.', 'success').then(() => {
window.location.reload();
});
console.log(response);
},
error: (error) => {
console.error('Error:', error);
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
'error');
}
});
}
});
}
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

View File

@@ -1,193 +1,67 @@
@extends('layouts.main')
{{-- @section('breadcrumbs')
{{ Breadcrumbs::render(request()->route()->getName()) }}
@endsection --}}
@section('breadcrumbs')
{{ Breadcrumbs::render(request()->route()->getName(), $permohonan->id, $header) }}
@endsection
@section('content')
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
<div class="card">
<div class="card-header" id="advanced_settings_appearance">
<h3 class="card-title">
Data Permohonan
</h3>
@php
$dataHeader = strtolower($header ?? '');
@endphp
@include('lpj::component.detail-jaminan', ['backLink' => 'otorisator.'. $dataHeader . '.index'])
<div>
<div>
<button onclick="otorisatorData({{ $permohonan->id }})" type="button" class="btn btn-primary">
<i class="ki-filled ki-double-check"></i>
Otorisator {{ $header ?? '' }}
</button>
</div>
<div class="card-body lg:py-7.5 grid grid-cols-3">
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Nomor Register Permohonan:
</h3>
<span class="text-2sm text-gray-700">
{{ $permohonan->nomor_registrasi }}
</span>
</div>
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Pemohon:
</h3>
<span class="text-2sm text-gray-700">
{{ $permohonan->user->nik }} | {{ $permohonan->user->name }} | {{ $permohonan->user->branch->name }}
</span>
</div>
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Tujan Permohonan:
</h3>
<span class="text-2sm text-gray-700">
{{ $permohonan->tujuanPenilaian->name }}
</span>
</div>
</div>
</div>
<div class="card min-w-full">
<div class="card-header">
<h3 class="card-title">
Detail Debutur
</h3>
</div>
<div class="card-table scrollable-x-auto pb-3">
<div class="grid grid-cols-1 xl:grid-cols-2 gap-5 lg:gap-7.5">
<div class="col-span-1">
<table class="table align-middle text-sm text-gray-500">
<tr>
<td class="py-2 text-gray-600 font-normal">
Name
</td>
<td class="py-2 text-gray-800 font-normaltext-sm">
{{ $permohonan->debiture->name ?? "" }}
</td>
</tr>
<tr>
<td class="py-3">
Email
</td>
<td class="py-3 text-gray-700 text-2sm font-normal">
{{ $permohonan->debiture->email ?? "" }}
</td>
</tr>
<tr>
<td class="py-3">
Phone
</td>
<td class="py-3 text-gray-700 text-2sm font-normal">
{{ $permohonan->debiture->phone ?? "" }}
</td>
</tr>
<tr>
<td class="py-3 text-gray-600 font-normal">
Address
</td>
<td class="py-3 text-gray-700 text-sm font-normal">
{{ $permohonan->debiture->address ?? "" }}
</td>
</tr>
<tr>
<td class="py-3 text-gray-600 font-normal">
&nbsp;
</td>
<td class="py-3 text-gray-700 text-sm font-normal">
{{ $permohonan->debiture->village->name ?? "" }}, {{ $permohonan->debiture->district->name ?? "" }}, {{ $permohonan->debiture->city->name ?? "" }}, {{ $permohonan->debiture->province->name ?? "" }} - {{ $permohonan->debiture->village->postal_code ?? "" }}
</td>
</tr>
</table>
</div>
<div class="col-span-1">
<table class="table align-middle text-sm text-gray-500">
<tr>
<td class="py-3 text-gray-600 font-normal">
Cabang
</td>
<td class="py-2 text-gray-800 font-normaltext-sm">
{{ $permohonan->debiture->branch->name ?? "" }}
</td>
</tr>
<tr>
<td class="py-3 text-gray-600 font-normal">
CIF
</td>
<td class="py-2 text-gray-800 font-normaltext-sm">
{{ $permohonan->debiture->cif ?? "" }}
</td>
</tr>
<tr>
<td class="py-3 text-gray-600 font-normal">
Nomor Rekening
</td>
<td class="py-3 text-gray-700 text-sm font-normal">
{{ $permohonan->debiture->nomor_rekening ?? "" }}
</td>
</tr>
<tr>
<td class="py-3">
NPWP
</td>
<td class="py-3 text-gray-700 text-2sm font-normal">
{{ $permohonan->debiture->npwp ?? "" }}
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="card min-w-full">
<div class="card-header">
<h3 class="card-title">
Laporan
</h3>
</div>
</div>
<div class="card">
<form id="approveForm" action="{{ route('authorization.update', $permohonan->id) }}" method="POST">
<input type="hidden" name="_method" value="PUT">
@csrf
<div class="card-body lg:py-7.5">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Catatan
</label>
<div class="flex flex-wrap items-baseline w-full">
<textarea class="textarea" rows="3" type="number" id="address" name="address"></textarea>
</div>
</div>
</div>
<div class="card-footer flex justify-end">
<button onclick="return otorisator()" type="button" name="status" value="preregister" class="btn btn-success">
Approve
</button>
</div>
</form>
</div>
</div>
@endsection
@push('scripts')
<script>
function otorisatorData(dataId) {
const dataHeader = {!! json_encode($header ?? '') !!};
<script>
function otorisator(){
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes!'
}).then((result) => {
if (result.isConfirmed) {
document.getElementById('approveForm').submit();
}
})
}
</script>
Swal.fire({
title: 'Apakah Anda yakin?',
text: `Untuk melakukan otorisator ${dataHeader}!`,
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ya, Lanjutkan!',
cancelButtonText: 'Batal',
}).then((result) => {
if (result.isConfirmed) {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
},
});
$.ajax({
url: `/otorisator/otorisator/${dataId}/${dataHeader}`,
type: 'POST',
success: (response) => {
Swal.fire('Berhasil!', 'Data berhasil diotorisasi.', 'success').then(() => {
window.location.reload();
});
console.log(response);
},
error: (error) => {
console.error('Error:', error);
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
'error');
}
});
}
});
}
</script>
@endpush