realisasi verifikasi
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
<div
|
||||
class="offcanvas offcanvas-end"
|
||||
tabindex="-1"
|
||||
id="offcanvasListVerifikasi"
|
||||
aria-labelledby="offcanvasListVerifikasiLabel">
|
||||
<div class="offcanvas-header border-bottom">
|
||||
<h5 id="offcanvasListVerifikasiLabel" class="offcanvas-title">Daftar Dokumen Verifikasi</h5>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-close text-reset"
|
||||
data-bs-dismiss="offcanvas"
|
||||
aria-label="Tutup"></button>
|
||||
</div>
|
||||
<div class="offcanvas-body mx-0 flex-grow-0 p-6 h-100">
|
||||
<form class="t-0" id="historyVerifikasiForm">
|
||||
|
||||
<input type="hidden" id="list-verifikasi-transformasi-id" name="transformasi_id"/>
|
||||
<input type="hidden" id="list-verifikasi-aktivitas-id" name="aktivitas_id"/>
|
||||
<input type="hidden" id="list-verifikasi-target-id" name="target_id"/>
|
||||
<input type="hidden" id="list-verifikasi-realisasi-id" name="realisasi_id"/>
|
||||
|
||||
<div class="mb-6 form-control-validation">
|
||||
<label class="form-label" for="list-verifikasi-variabel">Variabel Target<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="list-verifikasi-variabel" name="variabel" placeholder="Cth: AK1" readonly />
|
||||
</div>
|
||||
|
||||
<table class="table table-hover" id="historyVerifikasiTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Dokumen</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="historyVerifikasiTableBody">
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button type="reset" class="btn btn-label-danger" data-bs-dismiss="offcanvas">Tutup</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
const offcanvasListVerifikasi = new bootstrap.Offcanvas(document.getElementById('offcanvasListVerifikasi'));
|
||||
|
||||
$(".list-verifikasi").click(function () {
|
||||
const targetId = $(this).data('target-id');
|
||||
const aktivitasId = $(this).data('aktivitas-id');
|
||||
const transformasiId = $(this).data('transformasi-id');
|
||||
const realisasiId = $(this).data('realisasi-id');
|
||||
$('#list-verifikasi-aktivitas-id').val(aktivitasId);
|
||||
$('#list-verifikasi-transformasi-id').val(transformasiId);
|
||||
$('#list-verifikasi-target-id').val(targetId);
|
||||
$('#list-verifikasi-realisasi-id').val(realisasiId);
|
||||
|
||||
$.get("{{ route('realisasi.show', ':id') }}"
|
||||
.replace(':id', realisasiId), function (res) {
|
||||
if (res.status === 'success') {
|
||||
$('#list-verifikasi-variabel').val(res.data.target.variabel);
|
||||
|
||||
let rows = '';
|
||||
if (res.data.tipe === 'integer') {
|
||||
realisasiValue = res.data.realisasi_integer;
|
||||
} else if (res.data.tipe === 'float') {
|
||||
realisasiValue = res.data.realisasi_float;
|
||||
} else if (res.data.tipe === 'boolean') {
|
||||
realisasiValue = res.data.realisasi_boolean ? 'Ya' : 'Tidak';
|
||||
}
|
||||
|
||||
res.data.verifikasi.forEach(function (verifikasi) {
|
||||
rows += '<tr><td>' + verifikasi.dokumen + '</td><td>'
|
||||
+ '<a href="' + verifikasi.link_dokumen + '" target="_blank" class="btn btn-icon btn-text-secondary rounded-pill">'
|
||||
+ '<i class="ti tabler-file ti-md"></i></a>'
|
||||
+ '<a href="javascript:;" class="btn btn-icon btn-text-danger rounded-pill delete-verifikasi" data-id="' + verifikasi.id + '" data-nama="' + verifikasi.dokumen + '">'
|
||||
+ '<i class="ti tabler-trash ti-md"></i></a>'
|
||||
+ '</td></tr>';
|
||||
});
|
||||
$('#historyVerifikasiTableBody').html(rows);
|
||||
|
||||
offcanvasListVerifikasi.show();
|
||||
}
|
||||
});
|
||||
|
||||
$('#historyVerifikasiTable').on('click', '.delete-verifikasi', function () {
|
||||
const id = $(this).data('id');
|
||||
const nama = $(this).data('nama');
|
||||
Swal.fire({
|
||||
title: 'Hapus?',
|
||||
text: `Dokumen Verifikasi: ${nama} akan dihapus!`,
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Ya, Hapus!',
|
||||
customClass: { confirmButton: 'btn btn-danger me-3', cancelButton: 'btn btn-label-secondary' },
|
||||
buttonsStyling: false
|
||||
}).then(function (result) {
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
url: "{{ route('verifikasi.destroy', ':id') }}".replace(':id', id),
|
||||
type: 'POST',
|
||||
data: {
|
||||
_token: '{{ csrf_token() }}',
|
||||
_method: 'DELETE'
|
||||
},
|
||||
success: function () {
|
||||
Swal.fire({ icon: 'success', title: 'Terhapus!', showConfirmButton: false, timer: 1500 })
|
||||
.then(() => location.reload());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
Reference in New Issue
Block a user