1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php

//read variabel on sky
$kd = "";  
extract($_GET);
$kd_peminjam = $kd;  // read kode

//Including PHP
include(ASANOER_FOLDER_PELENGKAP.'koneksi-nya.php');

//Tabel Peminjam
$tb_peminjam = ASANOER_DB_TABEL_PREFIX."peminjam";

//Ambil data peminjam
    $qry = "SELECT * FROM $tb_peminjam WHERE kd_peminjam = '$kd_peminjam' AND td_peminjam = '0'";
    $hasil = $xdatabase->query($qry);        
        $crud_asanoer = $hasil->fetch_array(MYSQL_ASSOC); //memecah hasil ke dalam array
        $nm_peminjam = $crud_asanoer['nm_peminjam'];
		$idc_peminjam = $crud_asanoer['idc_peminjam'];
		$amt_peminjam = $crud_asanoer['amt_peminjam'];
		$tlp_peminjam = $crud_asanoer['tlp_peminjam'];
    $hasil->close();
?>
<div class="modal fade" id="asanoer-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog"><div class="modal-content">
<form id="this_form" action="<?php echo ASANOER_MAIN_URL.'index-update-aksi.proses?kd='.$kd_peminjam;?>" method="post" role="form">
<div class="panel panel-primary">
           <div class="panel-heading">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" title="TUTUP">X</button>
                    <h4 class="modal-title">Edit Peminjam (Kode: <?php echo $kd_peminjam; ?>)</h4>
            </div>
         <div class="panel-body">
               <div class="row">
										<p>&nbsp;</p>
										<div class="form-group">
											<label>Nama Peminjam</label>
											<input class="form-control" placeholder="Nama Peminjam Di sini" name="nm_peminjam" value="<?php echo $nm_peminjam; ?>">
											<p class="help-block">Nama lengkap peminjam sesuai KTP / SIM.</p>
                                        </div>
										<div class="form-group">
											<label>Nomor KTP / SIM</label>
											<input class="form-control" placeholder="Nomor KTP / SIM" name="idc_peminjam" value="<?php echo $idc_peminjam; ?>">
										</div>
										<div class="form-group">
											<label>Alamat KTP / SIM</label>
											 <textarea class="form-control" rows="3" placeholder="Alamat Lengkap KTP / SIM"  name="amt_peminjam"><?php echo $amt_peminjam; ?></textarea>
										</div>	
										<div class="form-group">
											<label>Nomor Telpon</label>
											<input class="form-control" placeholder="Nomor Telpon Peminjam" name="tlp_peminjam" value="<?php echo $tlp_peminjam; ?>">
										</div>
                            </div>
							<!-- /.row -->
          </div>
          <!-- /.modal-body -->
                        <div class="panel-footer">
                        <p class="text-center">
                            <button type="submit" class="btn btn-primary"><i class="fa fa-save"></i> SIMPAN</button>&nbsp;&nbsp;
                            <button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-repeat"></i> BATAL</button>
                        </p>    
                        </div>
					</div>
                </form>

<script type="text/javascript">
    $(document).ready(function(){
	///Show Modal
	$("#asanoer-modal").modal({backdrop: 'static'});
    //////////// AJAX JS HANDLING
    $('#this_form').submit(function() {
		//$("#x-pesan").html('<img src="<?php echo ASANOER_MAIN_URL.ASANOER_FOLDER_GBR."load.gif"; ?>" />');
        $.ajax({
            type: 'POST',
            url: $(this).attr('action'),
            data: $(this).serialize(),
            success: function(data) {
				//alert(data);
					if (data == "UPDATE OKE") // Tersimpan
					{
						$("#x-respon").html('<div class=\"alert alert-info alert-dismissable\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">TUTUP [x]</button><B>Data Berhasil Diedit</B></div>');
						$("#asanoerload").load('<?php echo ASANOER_MAIN_URL.'index-read.html'; ?>'); // Load ulang modul Read
						$('#asanoer-modal').modal("hide"); // Hide formulir ini.
					}
                }
            })
        return false;
        });
    });
</script>
</div></div>
</div>
<?php $xdatabase->close(); ?>