sh1fralf4tih

V TEMP

Dec 15th, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.28 KB | None | 0 0
  1. <section class="content-header">
  2.     <h1>
  3.         <small></small>
  4.     </h1>
  5.     <ol class="breadcrumb">
  6.         <li><a href="#"><i class="fa fa-suitcase"></i>Seting</a></li>
  7.         <li class="active"></li>
  8.     </ol>
  9. </section>
  10. <section class="content">
  11.     <div class="box box-default">
  12.         <div class="box-header with-border">
  13.           <h3 class="box-title">FILTER BY</h3>
  14.  
  15.           <div class="box-tools pull-right">
  16.             <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
  17.             <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-remove"></i></button>
  18.           </div>
  19.         </div>
  20.         <!-- /.box-header -->
  21.         <div class="box-body">
  22.           <div class="row">
  23.             <div class="col-sm-12">
  24.                 <form id="formRute" class="form-horizontal"">
  25.                         <div class="form-group">
  26.                             <label class="control-label col-sm-3" for="nmsal">NAMA SALES:</label>
  27.                             <div class="col-md-4">          
  28.                                 <select name="nmsal" id="NMSAL" class="form-control form-control js-example-basic-single" onchange="getForm(this.value)" required>
  29.                                     <?php echo $form_salesman; ?>
  30.                                 </select>
  31.                             </div>
  32.                         </div>                                          
  33.                         <div class="form-group">
  34.                             <label class="control-label col-sm-3" for="nohp">NO HP:</label>
  35.                             <div class="col-md-4">
  36.                                 <select name="nohp" id="NOHP" class="form-control" required>
  37.                                 </select>
  38.                             </div>
  39.                         </div>
  40.                         <div class="form-group">
  41.                             <label class="control-label col-sm-3" for="nmrs">NAMA TOKO:</label>
  42.                             <div class="col-md-4">
  43.                                 <select name="nmrs" id="NMRS" class="form-control" onchange="getRS(this.value)"required>
  44.                                 </select>
  45.                             </div>
  46.                         </div>
  47.                         <div class="form-group">
  48.                             <label class="control-label col-sm-3" for="nors">NO RS:</label>
  49.                             <div class="col-md-4">
  50.                                 <select name="nors" id="NORS" class="form-control" required>
  51.                                 </select>
  52.                             </div>
  53.                         </div>
  54.                         <div class="form-group">
  55.                             <label class="control-label col-sm-3" for="LNG">LONG LAT:</label>
  56.                             <div class="col-md-4">
  57.                                 <select name="LNG" id="LNG" class="form-control" required>
  58.                                 </select>
  59.                             </div>
  60.                         </div>
  61.                         <div class="form-group">
  62.                             <label class="control-label col-sm-3" for="hari">HARI:</label>
  63.                             <div class="col-md-4">
  64.                                 <select name="hari" id="HARI" class="form-control" required>
  65.                                 </select>
  66.                             </div>
  67.                         </div>
  68.                         <div class="form-group">
  69.                             <label for="" class="col-sm-3 control-label"></label>
  70.                             <div class="col-md-4">
  71.                                 <button type="button" onclick="simpan()" class="btn btn-primary">Tambah</button>
  72.                                 <button type="button" id="btn-reset" class="btn btn-default">Kembali</button>
  73.                             </div>
  74.                         </div>
  75.                     </form>
  76.             </div>
  77.         </div>
  78.     </div>
  79. </div>
  80. <table id="table" class="display" style="width:100%">
  81.         <thead>
  82.             <tr>
  83.                 <th>NOHP</th>
  84.                 <th>NMSAL</th>
  85.                 <th>NMRS</th>
  86.                 <th>NORS</th>
  87.                 <th>USER</th>
  88.                 <th>HARI</th>
  89.             </tr>
  90.         </thead>
  91.         <tfoot>
  92.             <tr>
  93.                 <th>NOHP</th>
  94.                 <th>NMSAL</th>
  95.                 <th>NMRS</th>
  96.                 <th>NORS</th>
  97.                 <th>USER</th>
  98.                 <th>HARI</th>
  99.             </tr>
  100.         </tfoot>
  101.     </table>
  102. </section>
  103. <script src="<?php echo base_url();?>assets/js/plugins/jQueryUI/jquery-ui.min.js"></script>
  104. <script src="<?php echo base_url('assets/js/plugins/datatables/extensions/Buttons/js/dataTables.buttons.min.js'); ?>"></script>
  105. <script src="<?php echo base_url();?>assets/js/plugins/select2/select2.min.js"></script>
  106. <script>
  107.     /* Ajax Dropdown Jurusan Prodi */
  108.     function getForm(value) {
  109.       console.log(value);
  110.       var row = value;
  111.       $.ajax({
  112.         type: "POST",
  113.         url: "<?php echo site_url('Roadmap/get_Nohp');?>",
  114.         data: {row},
  115.         dataType: "json",
  116.         success: function(data) {
  117.             $("#NOHP").empty().html(data.nohp);
  118.             $("#NMRS").empty().html(data.nmrs);
  119.             $("#HARI").empty().html(data.hari);
  120.             console.log(data);
  121.             console.log(data.nohp);
  122.         },
  123.  
  124.         error:function(XMLHttpRequest){
  125.           alert(XMLHttpRequest.responseText);
  126.         }
  127.       });
  128.     };
  129.     function getRS(value) {
  130.       console.log(value);
  131.       var row = value;
  132.       $.ajax({
  133.         type: "POST",
  134.         url: "<?php echo site_url('Roadmap/get_RS');?>",
  135.         data: {row},
  136.         dataType: "json",
  137.         success: function(data) {
  138.             $("#NORS").empty().html(data.nors);
  139.             $("#LNG").empty().html(data.lng);
  140.             console.log(data);
  141.         },
  142.  
  143.         error:function(XMLHttpRequest){
  144.           alert(XMLHttpRequest.responseText);
  145.         }
  146.       });
  147.     };
  148.     function simpan() {
  149.         $.ajax({
  150.             url: "<?php echo site_url('Roadmap/tambah');?>",
  151.             type: "POST",
  152.             dataType: "json",
  153.             data: $('#formRute').serialize(),
  154.             success: function(data) {
  155.                 if (data.status) {
  156.                     //alert(data.temp);
  157.                     $('#table').DataTable( {
  158.                         "ajax": data.temp,
  159.                         "columns": [
  160.                             { 0: "nohp" },
  161.                             { 0: "nmsal" },
  162.                             { 0: "nmrs" },
  163.                             { 0: "nors" },
  164.                             { 0: "user" },
  165.                             { 0: "hari" }
  166.                         ]
  167.                     } );
  168.                     //alert('Success Adding/Update data');
  169.                 } else {
  170.                     alert(data);
  171.                 }
  172.             },
  173.             error: function(jqXHR, textStatus, errorThrown) {
  174.                 console.log(textStatus);
  175.                 console.log(errorThrown);
  176.                 //alert("Gagal menambahkan/Edit user, mungkin user sudah ada/kesalahan data !!!");
  177.             }
  178.         });
  179.     };
  180.     $('.js-example-basic-single').select2();
  181. </script>
Advertisement
Add Comment
Please, Sign In to add comment