77 lines
1.8 KiB
PHP
77 lines
1.8 KiB
PHP
<?php
|
|
include ('../koneksi.php');
|
|
$id=$_POST['id'];
|
|
$satuan_kerja_id=$_POST['satuan_kerja_id'];
|
|
$d=pg_query("SELECT perihal,no_surat FROM surat WHERE id='$id'");
|
|
while($r=pg_fetch_array($d)) {
|
|
$perihal=$r[0];
|
|
$no_surat=$r[1];
|
|
}
|
|
?>
|
|
|
|
|
|
|
|
|
|
|
|
<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><br>
|
|
<span style="color:red;font-family:InterSB">Jika Nomor Surat tidak ada, Silakan isi tanda strip ( - ) </span>
|
|
<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>
|
|
|
|
|
|
<script type="text/javascript">
|
|
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);
|
|
});
|
|
|
|
|
|
$('#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!=a) {} else {
|
|
if (data=='-') {} else {
|
|
alert('Nomor Surat sudah ada..');$('#no_surat').val('');$('#no_surat').focus();
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|