Merge branch 'staging' into feature/senior-officer

This commit is contained in:
majid
2024-12-24 13:48:58 +07:00
10 changed files with 872 additions and 726 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -8,8 +8,8 @@
<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="10"
data-datatable-state-save="false" id="permohonan-table"
data-api-url="{{ route('otorisator.datatables', ['otorisator' => $header]) }}">
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 }}
@@ -30,46 +30,59 @@
<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">
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>
@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-[150px]" data-datatable-column="tujuan_penilaian_id">
<span class="sort"> <span class="sort-label"> Status Bayar </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
</tr>
<th class="min-w-[150px]" data-datatable-column="approval_so">
<span class="sort"> <span class="sort-label"> Approval SO </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="approval_eo">
<span class="sort"> <span class="sort-label"> Approval EO </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="approval_dd">
<span class="sort"> <span class="sort-label"> Approval DD </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>
@@ -182,34 +195,80 @@
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_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>`;
},
},
}),
},
approval_so: {
title: 'Approval SO',
render: (item, data) => {
if(data.approve_so) {
return `${data.approve_so.name} | ${window.formatTanggalIndonesia(data.approval_so_at)}`;
}
return '';
},
},
approval_eo: {
title: 'Approval EO',
render: (item, data) => {
if(data.approve_eo) {
return `${data.approve_eo.name} | ${window.formatTanggalIndonesia(data.approval_eo_at)}`;
}
return '';
},
},
approval_dd: {
title: 'Approval DD',
render: (item, data) => {
if(data.approve_dd) {
return `${data.approve_dd.name} | ${window.formatTanggalIndonesia(data.approval_dd_at)}`;
}
return '';
},
},
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}/${dataHeader}">
<i class="ki-outline ki-eye"></i>
</a>
const userRoles = @json(Auth::user()->getRoleNames());
const isAdmin = userRoles.includes('administrator');
<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>`;
let buttons = `
<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>
`;
if ((isAdmin || userRoles.includes('senior-officer')) && !data.approval_so) {
buttons += `
<a class="btn btn-sm btn-icon btn-clear btn-primary" onclick="otorisatorData(${data.id})">
<i class="ki-filled ki-double-check"></i>
</a>
`;
} else if ((isAdmin || userRoles.includes('EO Appraisal')) && data.approval_so && !data.approval_eo) {
buttons += `
<a class="btn btn-sm btn-icon btn-clear btn-primary" onclick="otorisatorData(${data.id})">
<i class="ki-filled ki-double-check"></i>
</a>
`;
} else if ((isAdmin || userRoles.includes('DD Appraisal')) && data.approval_eo && !data.approval_dd) {
buttons += `
<a class="btn btn-sm btn-icon btn-clear btn-primary" onclick="otorisatorData(${data.id})">
<i class="ki-filled ki-double-check"></i>
</a>
`;
}
buttons += `</div>`;
return buttons;
},
}
},
@@ -217,7 +276,7 @@
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);
@@ -257,7 +316,7 @@
message: userMessage // Kirim pesan sebagai bagian dari data
},
success: (response) => {
Swal.fire('Berhasil!', 'Data berhasil diotorisasi.', 'success').then(() => {
Swal.fire('Berhasil!', 'Data berhasil diotorisasi. Menunggu Approval EO dan atau DD', 'success').then(() => {
window.location.reload();
});
console.log(response);
@@ -265,7 +324,7 @@
error: (error) => {
console.error('Error:', error);
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
'error');
'error');
}
});
}

View File

@@ -16,16 +16,16 @@
@if($permohonan->approval_so)
<div class="card pb-2.5">
<div class="card-header" id="basic_settings">
<h3 class="card-title">
Approval
</h3>
</div>
<div class="card pb-2.5">
<div class="card-header" id="basic_settings">
<h3 class="card-title">
Approval
</h3>
</div>
<div class="card-body">
<table class="table table-border">
<tbody>
<div class="card-body">
<table class="table table-border">
<tbody>
<tr>
<td>Diperiksa Oleh</td>
<td>{{ getUser($permohonan->approval_so)->name ?? 'N/A' }}</td>
@@ -41,12 +41,13 @@
<td>{{ getUser($permohonan->approval_dd)->name ?? 'N/A' }}</td>
<td>{{ $permohonan->approval_dd_at ? formatTanggalIndonesia($permohonan->approval_dd_at,1) : 'N/A' }}</td>
</tr>
</tbody>
</table>
</tbody>
</table>
</div>
</div>
</div>
@endif
<div>
<div>
<div class="flex gap-2.5">
@php
$inspeksiId = null;
@@ -68,10 +69,26 @@
</a>
@endif
<button onclick="otorisatorData({{ $permohonan->id }})" type="button" class="btn btn-primary">
<i class="ki-filled ki-double-check"></i>
Otorisator {{ $header ?? '' }}
</button>
@if(Auth::user()->hasAnyRole(['administrator','senior-officer']) && $permohonan->approval_so==null)
<button onclick="otorisatorData({{ $permohonan->id }})" type="button" class="btn btn-primary">
<i class="ki-filled ki-double-check"></i>
Otorisator {{ $header ?? '' }}
</button>
@endif
@if(Auth::user()->hasAnyRole(['administrator','EO Appraisal']) && $permohonan->approval_so && $permohonan->approval_eo==null)
<button onclick="otorisatorData({{ $permohonan->id }})" type="button" class="btn btn-primary">
<i class="ki-filled ki-double-check"></i>
Otorisator {{ $header ?? '' }}
</button>
@endif
@if(Auth::user()->hasAnyRole(['administrator','DD Appraisal']) && $permohonan->approval_eo && $permohonan->approval_dd==null)
<button onclick="otorisatorData({{ $permohonan->id }})" type="button" class="btn btn-primary">
<i class="ki-filled ki-double-check"></i>
Otorisator {{ $header ?? '' }}
</button>
@endif
</div>
</div>
</div>
@@ -111,7 +128,7 @@
message: userMessage
},
success: (response) => {
Swal.fire('Berhasil!', 'Data berhasil diotorisasi.', 'success').then(() => {
Swal.fire('Berhasil!', 'Data berhasil diotorisasi. Menunggu Approval EO dan atau DD', 'success').then(() => {
window.location.reload();
});
console.log(response);

View File

@@ -418,11 +418,6 @@
<div class="input-group w-full flex gap-2">
<input type="hidden" name="name_lantai_unit[]" value="lantai">
<div class="preview-container">
<img id="foto_lantai-preview-{{ $loop->index }}"
src="{{ asset('storage/' . old('foto_lantai_unit', $item['foto_lantai_unit'])) }}"
alt="Foto Lantai" class="mt-2 h-auto"
style="{{ old('foto_lantai_unit', $item['foto_lantai_unit']) ? 'display: block;' : 'display: none;' }} width: 30rem;">
</div>
<input id="inputLantai" type="file" name="foto_lantai_unit[]"
class="file-input file-input-bordered w-full" accept="image/*"

View File

@@ -133,7 +133,7 @@
});
</script>
@@ -204,9 +204,9 @@
setupCanvas() {
// Set initial canvas size
this.canvas.width = 1280;
this.canvas.height = 960;
this.drawingCanvas.width = 1280;
this.drawingCanvas.height = 960;
this.canvas.height = (this.canvas.width * 3) / 4;
this.drawingCanvas.width = this.canvas.width;
this.drawingCanvas.height = this.canvas.height;
}
setupDrawingContext() {
@@ -277,6 +277,43 @@
this.saveDrawingState();
}
takePhoto() {
const context = this.canvas.getContext('2d');
// Determine if the video is in portrait or landscape mode
const isPortrait = this.video.videoHeight > this.video.videoWidth;
if (isPortrait) {
// Portrait mode
this.canvas.width = this.video.videoWidth;
this.canvas.height = this.video.videoHeight;
context.drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);
} else {
// Landscape mode
this.canvas.width = 1280;
this.canvas.height = (this.canvas.width * this.video.videoHeight) / this.video.videoWidth;
context.drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);
}
// Adjust drawing canvas to match main canvas
this.drawingCanvas.width = this.canvas.width;
this.drawingCanvas.height = this.canvas.height;
// Hide video, show canvases
this.video.style.display = 'none';
this.canvas.style.display = 'block';
this.drawingCanvas.style.display = 'block';
// Show editor controls, hide camera controls
document.getElementById('editorControls').classList.remove('hidden');
document.getElementById('cameraControls').classList.add('hidden');
// Clear drawing history
this.drawingHistory = [];
this.historyIndex = -1;
this.saveDrawingState();
}
switchCamera() {
this.currentFacingMode = this.currentFacingMode === 'environment' ? 'user' : 'environment';
this.startCamera();