edit.blade.php 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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. input, select {
  6. border: 0 !important;
  7. background: transparent !important;
  8. border-bottom: 1px solid #cdcdcd !important;
  9. }
  10. .tb-container{
  11. background: #fff;
  12. margin-top: 1em;
  13. }
  14. tbody > tr {
  15. line-height: 45px !important;
  16. min-height: 45px !important;
  17. height: 45px !important;
  18. }
  19. .ic {
  20. width: 1.5rem;
  21. height: 1.3rem;
  22. border-radius: .5rem;
  23. text-align: center;
  24. cursor:pointer;
  25. /* background: #cdcdcd; */
  26. /* padding-top: .3rem; */
  27. font-size: 1em;
  28. list-style: none;
  29. color: #000;
  30. }
  31. </style>
  32. <br/>
  33. <br/>
  34. <form action="{{route('penentuan-target.update',$data->id)}}" method="POST" id="form-edit">
  35. @csrf
  36. <div class="col">
  37. <div class="form-group">
  38. <label for="exampleInputEmail1">Program *</label>
  39. <input type="text" class="form-control" value="{{!empty($data->templateProgram)?$data->templateProgram->nama:'-'}}" readonly>
  40. <small id="tahunProgramHelp" class="form-text text-muted" style="color:red !important"></small>
  41. <!-- <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small> -->
  42. </div>
  43. <div class="form-group">
  44. <label for="exampleInputEmail1">Sub Program *</label>
  45. <input type="text" class="form-control" value="{{!empty($data->templateProgramDetail)?$data->templateProgramDetail->nama:'-'}}" readonly>
  46. <small id="tahunProgramHelp" class="form-text text-muted" style="color:red !important"></small>
  47. <!-- <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small> -->
  48. </div>
  49. <div class="form-group">
  50. <label for="exampleInputEmail1">Tipe Target *</label>
  51. <select class="form-control" id="opt-tipe-target" name="tipe_target">
  52. <option value="0" {{$data->tipe_target==0?'selected':''}}>Spesifik UPT</option>
  53. <option value="1" {{$data->tipe_target==1?'selected':''}}>Semua</option>
  54. </select>
  55. </div>
  56. <div class="form-group" id="div-opt-periode">
  57. <label for="exampleInputEmail1">Periode *</label>
  58. <select class="form-control" id="opt-periode" name="periode">
  59. @for($i=1;$i<=$data->jumlah;$i++)
  60. <option value="{{$i}}"}} {{(!empty(Session::has('previous_periode')) && session('previous_periode')==$i)?'selected':''}}>Periode {{$i}}</option>
  61. @endfor
  62. </select>
  63. </div>
  64. <div class="form-group">
  65. <label for="exampleInputEmail1">Satuan</label>
  66. <input type="text" class="form-control" name="satuan_target" id="satuan-target" value="{{$data->satuan_target}}">
  67. </div>
  68. <div class="btn btn-primary btn-lg btn-block" style="background: #193865;margin-top: 1em">TARGET</div>
  69. <div class="tb-container" id="table_semua" style="display:none">
  70. <table class="table table-bordered">
  71. <thead >
  72. <tr class="table-dark">
  73. <th scope="col">Periode</th>
  74. <th scope="col">Target</th>
  75. </tr>
  76. </thead>
  77. <tbody>
  78. @for($row_periode=1;$row_periode<=$data->jumlah;$row_periode++)
  79. <?php
  80. $row = App\Model\TahunProgramDetailUpt::where('id_tahun_program_detail',$data->id)->where('periode',$row_periode)->first();
  81. ?>
  82. @if(!empty($row))
  83. <tr>
  84. <td>
  85. <input type="number" name="semua_periode_{{$row_periode}}" value="{{$row_periode}}" class="form-control" readonly>
  86. </td>
  87. <td>
  88. <input type="number" name="semua_target_{{$row_periode}}" class="form-control" value="{{$row->target}}">
  89. </td>
  90. </tr>
  91. @else
  92. <tr>
  93. <td>
  94. <input type="number" name="semua_periode_{{$row_periode}}" value="{{$row_periode}}" class="form-control" readonly>
  95. </td>
  96. <td>
  97. <input type="number" name="semua_target_{{$row_periode}}" class="form-control" value="0">
  98. </td>
  99. </tr>
  100. @endif
  101. @endfor
  102. </tbody>
  103. </table>
  104. </div>
  105. @for($row_periode=1;$row_periode<=$data->jumlah;$row_periode++)
  106. <div class="tb-container table_spesifik_upt_periode" id="table_spesifik_upt_periode_{{$row_periode}}" style="display:none">
  107. <table class="table table-bordered">
  108. <thead >
  109. <tr class="table-dark">
  110. <th scope="col">Periode</th>
  111. <th scope="col">UPT</th>
  112. <th scope="col">Target</th>
  113. </tr>
  114. </thead>
  115. <tbody>
  116. @foreach($upt as $row_upt)
  117. <?php
  118. $row = App\Model\TahunProgramDetailUpt::where('id_tahun_program_detail',$data->id)->where('periode',$row_periode)->where('id_upt',$row_upt->office_id)->first();
  119. ?>
  120. @if(!empty($row))
  121. <tr>
  122. <td>
  123. <input type="number" name="spesifik_periode_{{$row_periode}}_{{$row_upt->office_id}}" value="{{$row_periode}}" class="form-control" readonly>
  124. </td>
  125. <td>
  126. <input type="hidden" name="spesifik_id_upt_{{$row_periode}}_{{$row_upt->office_id}}" value="{{$row_upt->office_id}}">
  127. <input type="text" class="form-control" value="{{$row_upt->office_name}}">
  128. </td>
  129. <td>
  130. <input type="number" name="spesifik_target_{{$row_periode}}_{{$row_upt->office_id}}" class="form-control" value="{{$row->target}}" min=0>
  131. </td>
  132. </tr>
  133. @else
  134. <tr>
  135. <td>
  136. <input type="number" name="spesifik_periode_{{$row_periode}}_{{$row_upt->office_id}}" value="{{$row_periode}}" class="form-control" readonly>
  137. </td>
  138. <td>
  139. <input type="hidden" name="spesifik_id_upt_{{$row_periode}}_{{$row_upt->office_id}}" value="{{$row_upt->office_id}}">
  140. <input type="text" class="form-control" value="{{$row_upt->office_name}}">
  141. </td>
  142. <td>
  143. <input type="number" name="spesifik_target_{{$row_periode}}_{{$row_upt->office_id}}" class="form-control" value="0" min=0>
  144. </td>
  145. </tr>
  146. @endif
  147. @endforeach
  148. </tbody>
  149. </table>
  150. </div>
  151. @endfor
  152. <div class="tb-container">
  153. <div class="row" style="padding:20px">
  154. <div class="col-md-8"></div>
  155. <div class="col-md-4">
  156. <button type="button" data-target="form-edit" class="btn btn-primary confirmation" id="btn-submit" style="background: #193865"><i class="fa fa-save"></i> Simpan Perubahan</button>
  157. <a href="{{route('penentuan-target')}}" class="btn btn-primary" id="btn-back" style="background: #fff;color: #193865">Batal</a>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. </form>
  163. <script>
  164. $('#opt-tipe-target').on('change',function(){
  165. var tipe_target = $(this).val();
  166. //tipe target 0 = spesifik upt, tipe target 1 = semua
  167. if(tipe_target == 0){
  168. $('#table_spesifik_upt').css('display','block');
  169. $('#table_semua').css('display','none');
  170. $('#div-opt-periode').css('display','block');
  171. $('#opt-periode').css('display','block');
  172. $('#opt-periode').trigger('change');
  173. }else{
  174. $('#table_spesifik_upt').css('display','none');
  175. $('#table_semua').css('display','block');
  176. $('#div-opt-periode').css('display','none');
  177. $('#opt-periode').css('display','none');
  178. $('.table_spesifik_upt_periode').css('display','none');
  179. }
  180. });
  181. $('#opt-periode').on('change',function(){
  182. var periode = $(this).val();
  183. $('.table_spesifik_upt_periode').css('display','none');
  184. $('#table_spesifik_upt_periode_'+periode).css('display','block');
  185. });
  186. $('input[type=number]').on('input', function() {
  187. $(this).val($(this).val().replace(/[^a-z0-9]/gi, ''));
  188. });
  189. $('#opt-tipe-target').trigger('change');
  190. </script>
  191. @endsection