170 lines
4.9 KiB
PHP
170 lines
4.9 KiB
PHP
<?php
|
|
include('../koneksi.php');
|
|
|
|
$id = isset($_POST['id']) ? $_POST['id'] : '';
|
|
$satuan_kerja_id = isset($_POST['satuan_kerja_id']) ? $_POST['satuan_kerja_id'] : '';
|
|
$d = pg_query($koneksi, "SELECT perihal, no_surat FROM surat WHERE id='$id'");
|
|
$perihal = '';
|
|
$no_surat = '';
|
|
while ($r = pg_fetch_array($d)) {
|
|
$perihal = $r['perihal'];
|
|
$no_surat = $r['no_surat'];
|
|
}
|
|
?>
|
|
|
|
<form role="form">
|
|
<input type="hidden" id="surat_id_cek" value="<?php echo $id; ?>">
|
|
<input type="hidden" id="satuan_kerja_id_cek" value="<?php echo $satuan_kerja_id; ?>">
|
|
<input type="hidden" id="no_surat_cek" value="<?php echo $no_surat; ?>">
|
|
<div class="form-group">
|
|
<label>Nomor Surat</label>
|
|
<input type="text" class="form-control" id="no_surat" value="<?php echo $no_surat; ?>">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>Perihal</label>
|
|
<textarea class="form-control" rows="4" id="perihal"><?php echo $perihal; ?></textarea>
|
|
</div>
|
|
</form>
|
|
|
|
<br>
|
|
<span style="font-family:InterSB;font-size:16px;color:black">TUJUAN</span><br><br>
|
|
<div id="kpdedit"></div><br>
|
|
<span style="font-family:InterSB;font-size:16px;color:black">LAMPIRAN</span><br><br>
|
|
<div id="lampedit"></div><br>
|
|
<div id="scanedit"></div>
|
|
|
|
<script type="text/javascript">
|
|
var surat_id = $('#surat_id_cek').val();
|
|
var satuan_kerja_id = $('#satuan_kerja_id_cek').val();
|
|
$('#kpdedit').load('app/kirim/modal_kepada.php', {
|
|
id: surat_id,
|
|
satuan_kerja_id: satuan_kerja_id
|
|
});
|
|
$('#lampedit').load('app/kirim/upd_file.php', {
|
|
id: surat_id
|
|
});
|
|
$('#scanedit').load('app/kirim/modal_dok.php', {
|
|
id: surat_id
|
|
});
|
|
|
|
function angka(e) {
|
|
if (!/^[0-9\.,()-/\a-zA-Z \b]+$/.test(e.value)) {
|
|
e.value = e.value.substring(0, e.value.length - 1);
|
|
}
|
|
}
|
|
|
|
$("textarea").keyup(function() {
|
|
angka(this);
|
|
});
|
|
|
|
function simpkr() {
|
|
var surat_id2 = $('#surat_id_cek').val();
|
|
if (!surat_id2) {
|
|
surat_id = '0';
|
|
} else {
|
|
surat_id = surat_id2;
|
|
}
|
|
var perihal = $('#perihal').val();
|
|
var no_surat1 = $('#no_surat').val();
|
|
var no_surat = no_surat1.replace(/\s/g, '');
|
|
var sat = $('#sat').val();
|
|
if (sat == '172') {
|
|
var satuan_kerja_id = sat;
|
|
} else {
|
|
var satuan_kerja_id = sess_satker;
|
|
}
|
|
// var key = 'simpan_kirim';
|
|
if ((!no_surat) && (!perihal)) {} else {
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/kirim/crud.php",
|
|
data: {
|
|
surat_id: surat_id,
|
|
perihal: perihal,
|
|
no_surat: no_surat,
|
|
satuan_kerja_id: satuan_kerja_id,
|
|
key: 'simpan_kirim'
|
|
},
|
|
success: function(data) {
|
|
$('#surat_id_cek').val(data);
|
|
var surat_id = $('#surat_id_cek').val();
|
|
var satuan_kerja_id = $('#satuan_kerja_id_cek').val();
|
|
$('#kpdedit').load('app/kirim/modal_kepada.php', {
|
|
id: surat_id,
|
|
satuan_kerja_id: satuan_kerja_id
|
|
});
|
|
$('#lampedit').load('app/kirim/upd_file.php', {
|
|
id: surat_id,
|
|
satuan_kerja_id: satuan_kerja_id
|
|
});
|
|
$('#scanedit').load('app/kirim/modal_dok.php', {
|
|
id: surat_id,
|
|
satuan_kerja_id: satuan_kerja_id
|
|
});
|
|
var thn2 = $('#thn').val();
|
|
var bln2 = $('#bln').val();
|
|
$('#tabel_kirim').load("app/kirim/tabel.php", {
|
|
satker: sess_satker,
|
|
jenis: sess_jenis,
|
|
sess_nama: sess_nama,
|
|
thn2: thn2,
|
|
bln2: bln2
|
|
});
|
|
if (sat == '172') {
|
|
$('#tabel_kirim').load("app/kirim/tabel.php", {
|
|
satker: sat,
|
|
jenis: sess_jenis,
|
|
sess_nama: sess_nama,
|
|
thn2: thn2,
|
|
bln2: bln2
|
|
});
|
|
} else {
|
|
$('#tabel_kirim').load("app/kirim/tabel.php", {
|
|
satker: sess_satker,
|
|
jenis: sess_jenis,
|
|
sess_nama: sess_nama,
|
|
thn2: thn2,
|
|
bln2: bln2
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
// $('#no_surat').focusout(function() {
|
|
// var d = $('#no_surat_cek').val();
|
|
// var b = $('#no_surat').val();
|
|
// var c = $.trim(b);
|
|
// if (c == d) {} else {
|
|
|
|
// var a = c.replace(/ /g, '');
|
|
// var satuan_kerja_id = $('#satuan_kerja_id_cek').val();
|
|
// if (!a) {} else {
|
|
// var key = 'cek_no_surat'
|
|
// $.ajax({
|
|
// type: "POST",
|
|
// url: "app/kirim/crud.php",
|
|
// data: {
|
|
// no_surat: a,
|
|
// satuan_kerja_id: satuan_kerja_id,
|
|
// key: key
|
|
// },
|
|
// success: function(data) {
|
|
// if (data == 0) {
|
|
// simpkr();
|
|
// } else {
|
|
// alert('Nomor Surat sudah ada.');
|
|
// $('#no_surat').val('').focus();
|
|
// }
|
|
// }
|
|
// });
|
|
// }
|
|
// }
|
|
// });
|
|
|
|
$('#perihal').focusout(function() {
|
|
simpkr();
|
|
});
|
|
</script>
|