fadlyshafa

Untitled

Sep 2nd, 2019
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 3.20 KB | None | 0 0
  1. @extends('layouts.master')
  2.  
  3. @section('content')
  4.  
  5. <div class="row">
  6.     <div class="col-md-8 col-md-offset-2">
  7.         <p>
  8.             <a href="{{ url('master/kategori/add') }}" class="btn btn-flat btn-sm btn-primary"><i class="fa fa-plus"></i> Tambah Kategori</a>
  9.         </p>
  10.         <div class="box box-warning">
  11.             <div class="box-header">
  12.                
  13.             </div>
  14.             <div class="box-body">
  15.                
  16.                 <table class="table table-hover myTable">
  17.                     <thead>
  18.                         <tr>
  19.                             <th>#</th>
  20.                             <th>Nama Kategori</th>
  21.                             <th>Created At</th>
  22.                             <th>Action</th>
  23.                         </tr>
  24.                     </thead>
  25.                     <tbody>
  26.                         @foreach($data as $e=>$dt)
  27.                         <tr>
  28.                             <td>{{ $e+1 }}</td>
  29.                             <td>{{ $dt->nama }}</td>
  30.                             <td>{{ $dt->created_at }}</td>
  31.                             <td>
  32.                                 <div style="width:60px"><a href="{{ url('master/kategori/'.$dt->id) }}" class="btn btn-warning btn-xs btn-edit" id="edit"><i class="fa fa-pencil-square-o"></i></a> <button href="{{ url('master/kategori/'.$dt->id) }}" class="btn btn-default btn-xs btn-hapus" id="delete"><i class="fa fa-trash-o"></i></button></div>
  33.                             </td>
  34.                         </tr>
  35.                         @endforeach
  36.                     </tbody>
  37.                 </table>
  38.  
  39.             </div>
  40.         </div>
  41.     </div>
  42. </div>
  43.  
  44. <!-- Modal Hapus kategori -->
  45. <div class="modal fade" id="modal-notification" tabindex="-1" role="dialog" aria-labelledby="modal-notification" aria-hidden="true">
  46.       <div class="modal-dialog modal-default modal-dialog-centered modal-" role="document">
  47.         <div class="modal-content bg-gradient-danger">
  48.  
  49.           <div class="modal-header">
  50.             <h6 class="modal-title" id="modal-title-notification">Your attention is required</h6>
  51.             <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  52.               <span aria-hidden="true">×</span>
  53.             </button>
  54.           </div>
  55.  
  56.           <div class="modal-body">
  57.  
  58.             <div class="py-3 text-center">
  59.               <i class="ni ni-bell-55 ni-3x"></i>
  60.               <h4 class="heading mt-4">Apakah kamu yakin ingin menghapus data ini?</h4>
  61.             </div>
  62.  
  63.           </div>
  64.  
  65.           <div class="modal-footer">
  66.             <form action="" method="post">
  67.               {{ csrf_field() }}
  68.               {{ method_field('delete') }}
  69.               <button type="submit" class="btn btn-white">Ok, Got it</button>
  70.             </form>
  71.             <button type="button" class="btn btn-link text-white ml-auto" data-dismiss="modal">Close</button>
  72.           </div>
  73.  
  74.         </div>
  75.       </div>
  76.     </div>
  77.  
  78. @endsection
  79.  
  80. @section('scripts')
  81.  
  82. <script type="text/javascript">
  83.     $(document).ready(function(){
  84.  
  85.         var flash = "{{ Session::has('sukses') }}";
  86.         if(flash){
  87.             var pesan = "{{ Session::get('sukses') }}"
  88.             alert(pesan);
  89.         }
  90.  
  91.         var gagal = "{{ Session::has('gagal') }}";
  92.         if(gagal){
  93.             var pesan = "{{ Session::get('gagal') }}"
  94.             swal("Error", pesan, "error");
  95.         }
  96.  
  97.         $('body').on('click','.btn-hapus',function(e){
  98.             e.preventDefault();
  99.             var url = $(this).attr('href');
  100.             $('#modal-notification').find('form').attr('action',url);
  101.  
  102.             $('#modal-notification').modal();
  103.         })
  104.        
  105.     })
  106. </script>
  107.  
  108. @endsection
Add Comment
Please, Sign In to add comment