Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @extends('layout.index')
- @section('content')
- <div class="container-fluid">
- <!-- ============================================================== -->
- <!-- Bread crumb and right sidebar toggle -->
- <!-- ============================================================== -->
- <div class="row page-titles">
- <div class="col-md-5 col-8 align-self-center">
- <h3 class="text-themecolor m-b-0 m-t-0">Pintu/Gate Masuk</h3>
- <ol class="breadcrumb">
- <li class="breadcrumb-item"><a href="{{url('/home')}}">Dashboard</a></li>
- <li class="breadcrumb-item active">Pintu/Gate Masuk</li>
- </ol>
- </div>
- </div>
- <div class="row">
- <div class="col-12">
- <div class="card">
- <div class="card-body">
- <button type="button" data-toggle="modal" data-target="#addModal" class="btn btn-success"><i class="fa fa-plus"></i> Tambah Gate</button><br/><br/>
- <div class="table-responsive">
- <table class="table table-bordered table-hover">
- <thead>
- <tr>
- <td><b>Lokasi</b></td>
- <td><b>Gate Name</b></td>
- <td><b>Created</b></td>
- <td><b>Created By</b></td>
- <td><b>Updated</b></td>
- <td><b>Updated By</b></td>
- <td class="text-nowrap"><b>Action</b></td>
- </tr>
- </thead>
- <tbody>
- @if(isset($list_gate))
- @foreach($list_gate as $dt)
- <tr>
- <td>{{$dt->location->location_name}}</td>
- <td>{{$dt->gate_name}}</td>
- <td>{{$dt->created_at}}</td>
- <td>{{$dt->created_by}}</td>
- <td>{{$dt->updated_at}}</td>
- <td>{{$dt->updated_by}}</td>
- <td class="text-nowrap">
- <a data-toggle="tooltip" data-original-title="Edit" style="cursor:pointer;" onclick="do_edit('{{$dt->id_gate}}')">
- <i class="fas fa-pencil-alt text-inverse m-r-10" ></i>
- </a>
- <a style="cursor:pointer;" onclick="do_delete('{{$dt->id_gate}}')" data-toggle="tooltip" data-original-title="Close">
- <i class="fas fa-window-close text-danger"></i>
- </a>
- </td>
- </tr>
- @endforeach
- @endif
- </tbody>
- </table>
- </div>
- <!--Add Modal-->
- <div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel1">
- <div class="modal-dialog" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h4 class="modal-title" id="exampleModalLabel1">Tambah Gate</h4>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
- </div>
- <form method="POST" id="form_add" autocomplete="off">
- <div class="modal-body">
- <div class="form-group row">
- <div class="col-lg-12">
- <label for="lokasi">Lokasi</label>
- <select name="lokasi" id="lokasi" class="form-control" required>
- <option value="">Pilih Lokasi</option>
- @if(isset($list_location))
- @foreach($list_location as $res)
- <option value="{{$res->id_location}}">{{$res->location_name}}</option>
- @endforeach
- @endif
- </select>
- </div>
- </div>
- <div class="form-group row">
- <div class="col-lg-12">
- <label for="gate_name">Gate Name</label>
- <input type="text" id="gate_name" name="gate_name" class="form-control" placeholder="Gate Name" maxlength="100" required>
- </div>
- </div>
- </div>
- {{csrf_field()}}
- <div class="modal-footer">
- <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
- <button type="submit" class="btn btn-info">Submit</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- <!--Update Modal-->
- <div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel1">
- <div class="modal-dialog" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h4 class="modal-title" id="exampleModalLabel1">Ubah Gate</h4>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
- </div>
- <form method="POST" id="form_update" autocomplete="off">
- <input type="hidden" name="id_parameter" id="id_parameter" required>
- <div class="modal-body">
- <div class="form-group row">
- <div class="col-lg-12">
- <label for="lokasi_edit">Lokasi</label>
- <select name="lokasi" id="lokasi_edit" class="form-control" required>
- <option value="">Pilih Lokasi</option>
- @if(isset($list_location))
- @foreach($list_location as $res)
- <option value="{{$res->id_location}}">{{$res->location_name}}</option>
- @endforeach
- @endif
- </select>
- </div>
- </div>
- <div class="form-group row">
- <div class="col-lg-12">
- <label for="gate_name_edit">Gate Name</label>
- <input type="text" name="gate_name" id="gate_name_edit" class="form-control" placeholder="Gate Name" maxlength="100" required>
- </div>
- </div>
- </div>
- {{csrf_field()}}
- <div class="modal-footer">
- <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
- <button type="submit" class="btn btn-info">Submit</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- <script type="text/javascript">
- $("#form_add").on("submit", function (event) {
- event.preventDefault();
- do_act('form_add','{{url('/gate/save')}}','no_refresh','Tambah Gate','Apakah anda ingin tambah jenis Gate ?','info','refresh_table');
- });
- $("#form_update").on("submit", function (event) {
- event.preventDefault();
- do_act('form_update','{{url('/gate/save')}}','no_refresh','Ubah Jenis Gate','Apakah anda ingin ubah jenis gate ?','info','refresh_table');
- });
- function do_delete(send_param){
- do_act_delete(send_param,'{{url('/gate/delete')}}','no_refresh','Hapus Jenis Gate','Apakah anda ingin jenis gate ?','warning','refresh_table');
- }
- function refresh_table(){
- //Datatables
- //$('#example').DataTable().ajax.reload();
- //Close Modal
- $("#addModal").modal('hide');
- $("#UpdateModal").modal('hide');
- //Reset Form
- $('#form_add').trigger("reset");
- $('#form_edit').trigger("reset");
- location.reload();
- }
- function do_edit(id){
- $.ajax({
- url: '{{url('/gate/detail')}}',
- type: 'POST',
- data: {"_token": "{{ csrf_token() }}",'id':id},
- dataType: 'JSON',
- success: function(data) {
- $("#id_parameter").val(data.id);
- $("#lokasi_edit").val(data.id_location);
- $("#gate_name_edit").val(data.gate);
- $("#updateModal").modal('show');
- }
- });
- }
- </script>
- </div>
- </div>
- </div>
- </div>
- </div>
- @endsection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement