detail.blade.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. </style>
  20. <br/>
  21. <br/>
  22. <form action="#" method="POST" enctype="multipart/form-data" id="form-edit">
  23. @csrf
  24. <div class="col">
  25. <div class="form-group">
  26. <label for="">Nama Option *</label>
  27. <input type="text" class="form-control" id="label" name="label" placeholder="No Data Available" value="{{$data->label}}" disabled>
  28. <!-- <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small> -->
  29. </div>
  30. <button type="button" class="btn btn-primary btn-lg btn-block" style="background: #193865;margin-top: 1em">Value Option</button>
  31. <div class="tb-container">
  32. <table class="table table-bordered">
  33. <thead >
  34. <tr class="table-dark">
  35. <th scope="col">Value</th>
  36. </tr>
  37. </thead>
  38. <tbody id="body">
  39. <input type="hidden" name="uniqids" id="uniqids">
  40. @foreach($data->masterOptionDetail as $key => $row)
  41. @php $uniqid = sprintf("%06d", mt_rand(1, 999999)); @endphp
  42. <tr id="tr-{{$uniqid}}" class="item-program" item-id="{{$row->id}}">
  43. <input type="hidden" name="id_{{$uniqid}}" value="{{$row->id}}">
  44. <input type="hidden" class="uniqid" value="{{$uniqid}}">
  45. <td scope="row">
  46. <input type="text" class="form-control value" value="{{$row->value}}" name="value_{{$uniqid}}" disabled>
  47. </td>
  48. </tr>
  49. @endforeach
  50. </tbody>
  51. </table>
  52. </div>
  53. </form>
  54. <div class="tb-container">
  55. <div class="row" style="padding:20px">
  56. <div class="col-md-10"></div>
  57. <div class="col-md-2">
  58. <a href="{{route('definisi-satuan')}}" class="btn btn-primary" id="btn-back" style="background: #fff;color: #193865">Kembali</a>
  59. </div>
  60. </div>
  61. </div>
  62. <script>
  63. </script>
  64. <script>
  65. //action tambah item
  66. $('#add-item').on('click',function(){
  67. var uniqid = Date.now();
  68. //initialize attribute
  69. var id = '<input type="hidden" class="uniqid" value="'+uniqid+'">';
  70. //orderBy
  71. var value = '<td><input type="text" class="form-control value" value="" required name="value_'+uniqid+'"></td>';
  72. var aksi = '<td><center><a data-id="'+uniqid+'" onClick="removeData('+uniqid+')"><i class="fas fa-trash" style="color: #E12D2D" ></i></a></center></td>';
  73. var attribute = '<tr id="tr-'+uniqid+'">'+id+value+aksi+'</tr>';
  74. $('#body').append(attribute);
  75. });
  76. $('#btn-submit').on('click',function(){
  77. var uniqids = '';
  78. $('.uniqid').each(function(i, obj) {
  79. if(uniqids!=''){
  80. uniqids += ',';
  81. }
  82. uniqids += obj.value;
  83. });
  84. $('#uniqids').val(uniqids);
  85. $('#form-edit').submit();
  86. });
  87. function removeData(uniqid){
  88. $('#tr-'+uniqid).remove();
  89. }
  90. </script>
  91. @endsection