Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <section class="content-header">
- <h1>
- <small></small>
- </h1>
- <ol class="breadcrumb">
- <li><a href="#"><i class="fa fa-suitcase"></i>Seting</a></li>
- <li class="active"></li>
- </ol>
- </section>
- <section class="content">
- <div class="box box-default">
- <div class="box-header with-border">
- <h3 class="box-title">FILTER BY</h3>
- <div class="box-tools pull-right">
- <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
- <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-remove"></i></button>
- </div>
- </div>
- <!-- /.box-header -->
- <div class="box-body">
- <div class="row">
- <div class="col-sm-12">
- <form id="formRute" class="form-horizontal"">
- <div class="form-group">
- <label class="control-label col-sm-3" for="nmsal">NAMA SALES:</label>
- <div class="col-md-4">
- <select name="nmsal" id="NMSAL" class="form-control form-control js-example-basic-single" onchange="getForm(this.value)" required>
- <?php echo $form_salesman; ?>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-sm-3" for="nohp">NO HP:</label>
- <div class="col-md-4">
- <select name="nohp" id="NOHP" class="form-control" required>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-sm-3" for="nmrs">NAMA TOKO:</label>
- <div class="col-md-4">
- <select name="nmrs" id="NMRS" class="form-control" onchange="getRS(this.value)"required>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-sm-3" for="nors">NO RS:</label>
- <div class="col-md-4">
- <select name="nors" id="NORS" class="form-control" required>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-sm-3" for="LNG">LONG LAT:</label>
- <div class="col-md-4">
- <select name="LNG" id="LNG" class="form-control" required>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-sm-3" for="hari">HARI:</label>
- <div class="col-md-4">
- <select name="hari" id="HARI" class="form-control" required>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label for="" class="col-sm-3 control-label"></label>
- <div class="col-md-4">
- <button type="button" onclick="simpan()" class="btn btn-primary">Tambah</button>
- <button type="button" id="btn-reset" class="btn btn-default">Kembali</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- <table id="table" class="display" style="width:100%">
- <thead>
- <tr>
- <th>NOHP</th>
- <th>NMSAL</th>
- <th>NMRS</th>
- <th>NORS</th>
- <th>USER</th>
- <th>HARI</th>
- </tr>
- </thead>
- <tfoot>
- <tr>
- <th>NOHP</th>
- <th>NMSAL</th>
- <th>NMRS</th>
- <th>NORS</th>
- <th>USER</th>
- <th>HARI</th>
- </tr>
- </tfoot>
- </table>
- </section>
- <script src="<?php echo base_url();?>assets/js/plugins/jQueryUI/jquery-ui.min.js"></script>
- <script src="<?php echo base_url('assets/js/plugins/datatables/extensions/Buttons/js/dataTables.buttons.min.js'); ?>"></script>
- <script src="<?php echo base_url();?>assets/js/plugins/select2/select2.min.js"></script>
- <script>
- /* Ajax Dropdown Jurusan Prodi */
- function getForm(value) {
- console.log(value);
- var row = value;
- $.ajax({
- type: "POST",
- url: "<?php echo site_url('Roadmap/get_Nohp');?>",
- data: {row},
- dataType: "json",
- success: function(data) {
- $("#NOHP").empty().html(data.nohp);
- $("#NMRS").empty().html(data.nmrs);
- $("#HARI").empty().html(data.hari);
- console.log(data);
- console.log(data.nohp);
- },
- error:function(XMLHttpRequest){
- alert(XMLHttpRequest.responseText);
- }
- });
- };
- function getRS(value) {
- console.log(value);
- var row = value;
- $.ajax({
- type: "POST",
- url: "<?php echo site_url('Roadmap/get_RS');?>",
- data: {row},
- dataType: "json",
- success: function(data) {
- $("#NORS").empty().html(data.nors);
- $("#LNG").empty().html(data.lng);
- console.log(data);
- },
- error:function(XMLHttpRequest){
- alert(XMLHttpRequest.responseText);
- }
- });
- };
- function simpan() {
- $.ajax({
- url: "<?php echo site_url('Roadmap/tambah');?>",
- type: "POST",
- dataType: "json",
- data: $('#formRute').serialize(),
- success: function(data) {
- if (data.status) {
- //alert(data.temp);
- $('#table').DataTable( {
- "ajax": data.temp,
- "columns": [
- { 0: "nohp" },
- { 0: "nmsal" },
- { 0: "nmrs" },
- { 0: "nors" },
- { 0: "user" },
- { 0: "hari" }
- ]
- } );
- //alert('Success Adding/Update data');
- } else {
- alert(data);
- }
- },
- error: function(jqXHR, textStatus, errorThrown) {
- console.log(textStatus);
- console.log(errorThrown);
- //alert("Gagal menambahkan/Edit user, mungkin user sudah ada/kesalahan data !!!");
- }
- });
- };
- $('.js-example-basic-single').select2();
- </script>
Advertisement
Add Comment
Please, Sign In to add comment