aktivasi-program.blade.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?php $getStatus = \App\Model\Privillage\Role::where('id',Auth::user()->role_id)->value('akses'); ?>
  2. @extends('dev.core.using')
  3. @section('content')
  4. <style>
  5. .ic {
  6. width: 1.5rem;
  7. height: 1.3rem;
  8. border-radius: .5rem;
  9. text-align: center;
  10. cursor:pointer;
  11. /* background: #cdcdcd; */
  12. /* padding-top: .3rem; */
  13. font-size: 1em;
  14. list-style: none;
  15. color: #000;
  16. }
  17. .ic:hover {
  18. background: #eee;
  19. color: #000;
  20. }
  21. .dataTables_wrapper, .dataTables_info, .dataTables_length {
  22. background: #f8f9fe !important;
  23. color: #000 !important;
  24. }
  25. </style>
  26. <br/>
  27. <br/>
  28. <div class="col">
  29. <div class="input-group mb-3">
  30. <div class="input-group-prepend" style="height: 2.63em">
  31. <span class="input-group-text" id="basic-addon1"><i class="fas fa-search"></i></span>
  32. </div>
  33. <input type="text" class="form-control" style="height: 3em" placeholder="Search" aria-label="Search" aria-describedby="basic-addon1">
  34. </div>
  35. <div class="row">
  36. <div class="col-md-12">
  37. <a type="button" href="{{route('aktivasi-program.add')}}" class="btn btn-primary" style="background: #193865;color: #fff"><i class="fa fa-plus"></i> Tambah Baru</a>
  38. </div>
  39. </div>
  40. <table class="table table-striped" id="tbl" style="text-align:center">
  41. <thead>
  42. <tr class="table-dark">
  43. <th scope="col">Tahun</th>
  44. <th scope="col">Label</th>
  45. <th scope="col" class="stts">Status</th>
  46. <th scope="col" class="dgcActions">Aksi</th>
  47. </tr>
  48. </thead>
  49. <tbody>
  50. </tbody>
  51. </table>
  52. <div id="demo"></div>
  53. </div>
  54. <div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" id="modal-delete">
  55. <form action="" method="POST" id="form-delete">
  56. @csrf
  57. <div class="modal-dialog" role="document">
  58. <div class="modal-content">
  59. <div class="modal-header">
  60. <h5 class="modal-title" id="exampleModalLabel">Konfirmasi</h5>
  61. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  62. <span aria-hidden="true">&times;</span>
  63. </button>
  64. </div>
  65. <div class="modal-body">
  66. <input type="hidden" id="delete-id">
  67. <center>Anda yakin akan menghapus Tahun Program <span id="delete-nama" style="font-weight:bold"></span> ?</center>
  68. </div>
  69. <div class="modal-footer">
  70. <div class="form-group center">
  71. <button type="button" class="btn btn-secondary" data-dismiss="modal">Batalkan</button>
  72. <button type="submit" class="btn btn-danger">Hapus Data</button>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </form>
  78. </div>
  79. <script src="{{ asset('public/js/pagination-min.js')}}" type="text/javascript"></script>
  80. <script>
  81. let table =''
  82. $(document).ready( async function () {
  83. let totalPage
  84. table = await $('#tbl').DataTable({
  85. "serverSide": true,
  86. "processing": true,
  87. "paging": true,
  88. "ordering": false,
  89. "searching": false,
  90. iTotalDisplayRecords: 15,
  91. "lengthMenu": [ [10, 25, 50, 100], [10, 25, 50, 100] ],
  92. "pageLength": 10,
  93. ajax: {
  94. url: '{{url("/api/aktivasi-program")}}' + '?' + $.param({ paramInQuery: 1 }),
  95. },
  96. columns: [
  97. { data: 'value' },
  98. { data: 'label_tahun_program' },
  99. // { data: 'status' },
  100. { data: null, searchable: false, orderable: false },
  101. { data: null, searchable: false, orderable: false }
  102. ],
  103. columnDefs: [
  104. {
  105. targets: "dgcActions",
  106. //data: null,
  107. render: function (data, type, row) {
  108. var html = `
  109. <a href="{{url('pengaturan/aktivasi-program/edit')}}/${data.id}" class="ic"><i class="fas fa-edit" style="color: #3C8F61"></i></a>
  110. <a href="{{url('pengaturan/aktivasi-program/detail')}}/${data.id}" class="ic"><i class="fas fa-eye" style="color: #0093DD"></i></a>
  111. <a href="#" data-toggle="modal" class="ic" id="btn-delete-${data.id}" data-nama="${data.value}" data-target="#modal-delete" onClick="deleteData(${data.id})"><i class="fas fa-trash" style="color: #E12D2D" ></i></a>
  112. `;
  113. return html;
  114. }
  115. },
  116. {
  117. targets: "stts",
  118. //data: null,
  119. render: function (data, type, row) {
  120. var html;
  121. if(row.status ==0){
  122. html = '<span class="badge badge-warning">Draft</span>';
  123. }else if(row.status ==1){
  124. html = '<span class="badge badge-success text-dark">Aktif</span>';
  125. }else if(row.status ==2){
  126. html = '<span class="badge badge-primary text-dark">Selesai</span>';
  127. }
  128. return html;
  129. }
  130. }
  131. ]
  132. });
  133. } );
  134. function deleteData(id){
  135. var nama = $('#btn-delete-'+id).attr('data-nama');
  136. $('#form-delete').attr("action","{{url('pengaturan/aktivasi-program/delete')}}/"+id);
  137. $('#delete-id').val(id);
  138. $('#delete-nama').text();
  139. $('#delete-nama').text(nama);
  140. }
  141. </script>
  142. @endsection