Advertisement
Guest User

view/gate/index.blade.php

a guest
Oct 24th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 13.50 KB | None | 0 0
  1. @extends('layout.index')
  2. @section('content')    
  3.             <div class="container-fluid">
  4.                 <!-- ============================================================== -->
  5.                 <!-- Bread crumb and right sidebar toggle -->
  6.                 <!-- ============================================================== -->
  7.                 <div class="row page-titles">
  8.                     <div class="col-md-5 col-8 align-self-center">
  9.                         <h3 class="text-themecolor m-b-0 m-t-0">Pintu/Gate Masuk</h3>
  10.                         <ol class="breadcrumb">
  11.                             <li class="breadcrumb-item"><a href="{{url('/home')}}">Dashboard</a></li>
  12.                             <li class="breadcrumb-item active">Pintu/Gate Masuk</li>
  13.                         </ol>
  14.                     </div>
  15.                 </div>
  16.  
  17.  
  18.  
  19.                 <div class="row">
  20.                     <div class="col-12">
  21.                         <div class="card">
  22.                             <div class="card-body">
  23.                                 <button type="button" data-toggle="modal" data-target="#addModal" class="btn btn-success"><i class="fa fa-plus"></i> Tambah Gate</button><br/><br/>
  24.                                 <div class="table-responsive">
  25.                                     <table class="table table-bordered table-hover">
  26.                                         <thead>
  27.                                             <tr>
  28.                                                 <td><b>Lokasi</b></td>
  29.                                                 <td><b>Gate Name</b></td>
  30.                                                 <td><b>Created</b></td>
  31.                                                 <td><b>Created By</b></td>
  32.                                                 <td><b>Updated</b></td>
  33.                                                 <td><b>Updated By</b></td>
  34.                                                 <td class="text-nowrap"><b>Action</b></td>
  35.                                             </tr>
  36.                                         </thead>
  37.                                         <tbody>
  38.                                             @if(isset($list_gate))
  39.                                                 @foreach($list_gate as $dt)
  40.                                             <tr>
  41.                                                 <td>{{$dt->location->location_name}}</td>
  42.                                                 <td>{{$dt->gate_name}}</td>
  43.                                                 <td>{{$dt->created_at}}</td>
  44.                                                 <td>{{$dt->created_by}}</td>
  45.                                                 <td>{{$dt->updated_at}}</td>
  46.                                                 <td>{{$dt->updated_by}}</td>
  47.                                                 <td class="text-nowrap">
  48.                                                     <a data-toggle="tooltip" data-original-title="Edit" style="cursor:pointer;" onclick="do_edit('{{$dt->id_gate}}')">
  49.                                                         <i class="fas fa-pencil-alt text-inverse m-r-10" ></i>
  50.                                                     </a> &nbsp; &nbsp;
  51.                                                     <a style="cursor:pointer;" onclick="do_delete('{{$dt->id_gate}}')" data-toggle="tooltip" data-original-title="Close">
  52.                                                         <i class="fas fa-window-close text-danger"></i>
  53.                                                     </a>
  54.                                                 </td>
  55.                                             </tr>
  56.                                                 @endforeach
  57.                                              @endif  
  58.                                         </tbody>
  59.                                     </table>
  60.                                 </div>
  61.  
  62.                                 <!--Add Modal-->
  63.                                 <div class="modal fade" id="addModal"  tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel1">
  64.                                     <div class="modal-dialog" role="document">
  65.                                         <div class="modal-content">
  66.                                             <div class="modal-header">
  67.                                                 <h4 class="modal-title" id="exampleModalLabel1">Tambah Gate</h4>
  68.                                                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  69.                                             </div>
  70.                                             <form method="POST" id="form_add" autocomplete="off">
  71.                                                 <div class="modal-body">
  72.                                                     <div class="form-group row">
  73.                                                         <div class="col-lg-12">
  74.                                                             <label for="lokasi">Lokasi</label>
  75.                                                             <select name="lokasi" id="lokasi" class="form-control" required>
  76.                                                                 <option value="">Pilih Lokasi</option>
  77.                                                                   @if(isset($list_location))
  78.                                                                     @foreach($list_location as $res)
  79.                                                                          <option value="{{$res->id_location}}">{{$res->location_name}}</option>
  80.                                                                     @endforeach
  81.                                                                   @endif      
  82.                                                             </select>
  83.                                                         </div>
  84.                                                     </div>
  85.                                                     <div class="form-group row">
  86.                                                         <div class="col-lg-12">
  87.                                                             <label for="gate_name">Gate Name</label>
  88.                                                             <input type="text" id="gate_name" name="gate_name" class="form-control" placeholder="Gate Name" maxlength="100" required>
  89.                                                         </div>
  90.                                                     </div>
  91.                                                 </div>
  92.                                                 {{csrf_field()}}
  93.                                                 <div class="modal-footer">
  94.                                                     <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
  95.                                                     <button type="submit" class="btn btn-info">Submit</button>
  96.                                                 </div>
  97.                                             </form>
  98.                                         </div>
  99.                                     </div>
  100.                                 </div>  
  101.  
  102.                                 <!--Update Modal-->
  103.                                 <div class="modal fade" id="updateModal"  tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel1">
  104.                                     <div class="modal-dialog" role="document">
  105.                                         <div class="modal-content">
  106.                                             <div class="modal-header">
  107.                                                 <h4 class="modal-title" id="exampleModalLabel1">Ubah Gate</h4>
  108.                                                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  109.                                             </div>
  110.                                             <form method="POST" id="form_update" autocomplete="off">
  111.                                                 <input type="hidden"  name="id_parameter" id="id_parameter" required>
  112.                                                 <div class="modal-body">
  113.                                                     <div class="form-group row">
  114.                                                         <div class="col-lg-12">
  115.                                                             <label for="lokasi_edit">Lokasi</label>
  116.                                                             <select name="lokasi" id="lokasi_edit" class="form-control" required>
  117.                                                                 <option value="">Pilih Lokasi</option>
  118.                                                                   @if(isset($list_location))
  119.                                                                     @foreach($list_location as $res)
  120.                                                                          <option value="{{$res->id_location}}">{{$res->location_name}}</option>
  121.                                                                     @endforeach
  122.                                                                   @endif      
  123.                                                             </select>
  124.                                                         </div>
  125.                                                     </div>
  126.                                                     <div class="form-group row">
  127.                                                         <div class="col-lg-12">
  128.                                                             <label for="gate_name_edit">Gate Name</label>
  129.                                                             <input type="text" name="gate_name" id="gate_name_edit" class="form-control" placeholder="Gate Name" maxlength="100" required>
  130.                                                         </div>
  131.                                                     </div>
  132.                                                 </div>
  133.                                                 {{csrf_field()}}
  134.                                                 <div class="modal-footer">
  135.                                                     <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
  136.                                                     <button type="submit" class="btn btn-info">Submit</button>
  137.                                                 </div>
  138.                                             </form>
  139.                                         </div>
  140.                                     </div>
  141.                                 </div>  
  142.  
  143.  
  144.                                 <script type="text/javascript">
  145.                                     $("#form_add").on("submit", function (event) {
  146.                                         event.preventDefault();
  147.                                             do_act('form_add','{{url('/gate/save')}}','no_refresh','Tambah Gate','Apakah anda ingin tambah jenis Gate ?','info','refresh_table');
  148.                                     });
  149.                                     $("#form_update").on("submit", function (event) {
  150.                                         event.preventDefault();
  151.                                             do_act('form_update','{{url('/gate/save')}}','no_refresh','Ubah Jenis Gate','Apakah anda ingin ubah jenis gate ?','info','refresh_table');
  152.                                     });
  153.                                     function do_delete(send_param){
  154.                                         do_act_delete(send_param,'{{url('/gate/delete')}}','no_refresh','Hapus Jenis Gate','Apakah anda ingin jenis gate ?','warning','refresh_table');
  155.                                     }
  156.                                     function refresh_table(){
  157.                                         //Datatables
  158.                                         //$('#example').DataTable().ajax.reload();
  159.  
  160.                                         //Close Modal
  161.                                         $("#addModal").modal('hide');
  162.                                         $("#UpdateModal").modal('hide');
  163.  
  164.                                         //Reset Form
  165.                                         $('#form_add').trigger("reset");
  166.                                         $('#form_edit').trigger("reset");
  167.                                         location.reload();
  168.                                     }  
  169.                                     function do_edit(id){
  170.                                         $.ajax({
  171.                                             url: '{{url('/gate/detail')}}',
  172.                                             type: 'POST',
  173.                                             data: {"_token": "{{ csrf_token() }}",'id':id},
  174.                                             dataType: 'JSON',
  175.                                             success: function(data) {
  176.                                                 $("#id_parameter").val(data.id);
  177.                                                 $("#lokasi_edit").val(data.id_location);
  178.                                                 $("#gate_name_edit").val(data.gate);
  179.                                                 $("#updateModal").modal('show');
  180.                                             }
  181.                                         });
  182.                                     }
  183.                                 </script>
  184.  
  185.                             </div>
  186.                         </div>
  187.                     </div>
  188.                 </div>
  189.              
  190.             </div>
  191.            
  192. @endsection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement