penambahan button dan upload file pada tindak lanjut surat pengesahan CLEAR

This commit is contained in:
2024-07-15 09:29:26 +07:00
parent 77e95ff2ee
commit 7883fbeb02
18 changed files with 1268 additions and 1090 deletions
+52 -37
View File
@@ -1,23 +1,40 @@
<?php
include('../../koneksi.php');
$baseURL = '../../../public/doc/smasuk/dok/';
if ($_POST['surat_idzz']) {
$surat_id = $_POST['surat_idzz'];
} else {
$surat_id = '0';
}
// if ($_POST['gambar'] != 'img') {
$baseURL = '../../../public/doc/smasuk/dok/';
$data_pdf = pg_query($koneksi, "SELECT file,id FROM scan WHERE surat_id='$surat_id'
AND LOWER(file) NOT LIKE '%.jpg'
AND LOWER(file) NOT LIKE '%.JPG'
AND LOWER(file) NOT LIKE '%.png'
AND LOWER(file) NOT LIKE '%.PNG'
AND LOWER(file) NOT LIKE '%.jpeg'
AND LOWER(file) NOT LIKE '%.JPEG'
ORDER BY id DESC");
// } else {
// $baseURL = '../../../public/doc/smasuk/img/';
// $data_pdf = pg_query($koneksi, "SELECT file,id FROM scan WHERE surat_id='$surat_id'
// AND ( LOWER(file) LIKE '%.jpg'
// OR LOWER(file) LIKE '%.jpeg'
// OR LOWER(file) LIKE '%.png' )
// ORDER BY id DESC");
// }
?>
<input type="text" value="<?php echo $surat_id; ?>" id="surat_idxx">
<input type="hidden" value="<?php echo $surat_id; ?>" id="surat_idxx">
<?php
$data_pdf = pg_query($koneksi, "SELECT file,id FROM scan WHERE surat_id='$surat_id' AND LOWER(file) LIKE '%.pdf' ORDER BY id DESC");
while ($rdata_pdf = pg_fetch_array($data_pdf)) {
$pdf = $rdata_pdf[0];
if (($pdf == NULL) || ($pdf == '')) {/*echo "File PDF belum diupload..";*/
} else {
while ($rdata_pdf = pg_fetch_assoc($data_pdf)) {
$pdf = $rdata_pdf['file'];
if (!empty($pdf)) {
?>
<div class="gal-detail thumb" style="height:345px;background-color:#ece9d8;">
<embed src="<?= $baseURL.$pdf; ?>#toolbar=0" width="100%" height="300"></embed>
<button type="button" name="cv_delete" style="height:22px;border-radius: 50%" class="btn btn-danger btn-xs pull-right" id="<?php echo $rdata_pdf[1]; ?>" data-content="Hapus" rel="popover" data-placement="bottom" data-trigger="hover">
<input type="hidden" id="id_file" value="<?=$rdata_pdf['id']?>">
<embed src="<?= htmlspecialchars($baseURL . $pdf); ?>#toolbar=0" width="100%" height="300"></embed>
<button type="button" name="cv_delete" style="height:22px;border-radius: 50%" class="btn btn-danger btn-xs pull-right" id="<?= htmlspecialchars($rdata_pdf['id']); ?>" data-content="Hapus" rel="popover" data-placement="bottom" data-trigger="hover">
<i class="fa fa-remove"></i>
</button>
</div>
@@ -32,36 +49,34 @@ while ($rdata_pdf = pg_fetch_array($data_pdf)) {
if (x) {
var key = "delete_cv";
var id = $(this).attr('id');
var rowElement = $(this).parent().parent();
var rowElement = $(this).closest('.gal-detail');
$.ajax({
type: "POST",
url: "app/smasuk/pdf/crud.php",
data: 'id=' + id +
'&key=' + key,
success: function(response) {
var result=JSON.parse(response);
infoToast(result.icon,result.message);
var surat_id = $('#surat_idxx').val();
$('#tabel_upl_cv').load("app/smasuk/pdf/tabel_upl_cv.php", {
surat_id: surat_id
});
},
error:function(xhr){
var result = JSON.parse(xhr.responseText);
infoToast(result.icon,result.message);
}
});
}
type: "POST",
url: "app/smasuk/pdf/crud.php",
data: { id: id, key: key },
success: function(response) {
var result = JSON.parse(response);
// if (result.icon === 'success') {
infoToast(result.icon, result.message);
$('#tabel_upl_cv').load("app/smasuk/pdf/tabel_upl_cv.php",
{ surat_idzz: result.surat_id });
// }
},
error: function(xhr) {
var result = JSON.parse(xhr.responseText);
infoToast(result.icon, result.message);
}
});
}
});
function infoToast(icone, infone) {
Swal.fire({
// position: posisine,
icon: icone,
title: infone,
showConfirmButton: false,
timer: 2500
});
}
Swal.fire({
// position: posisine,
icon: icone,
title: infone,
showConfirmButton: false,
timer: 2500
});
}
</script>