Dashboard sipadu mbip
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

inventory_detail.blade.php 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. @extends('layout.officer', ['uid' => $user->_id, 'token' => $user->token_firebase])
  2. @section('page_title', 'Kompaun (Kertas Siasatan)')
  3. @section('sub_page_title', '')
  4. @section('name', $user->StaffDetail->full_name)
  5. @section('img_profile', $user->StaffDetail->profile_img)
  6. @section('content')
  7. <style type="text/css">
  8. select.form-control, select.form-control:focus, select.form-control:hover {
  9. border: 1px solid #ccc !important;
  10. height: auto !important;
  11. }
  12. .panel-group .panel {
  13. margin-bottom: 0;
  14. overflow: hidden;
  15. border-radius: 4px;
  16. }
  17. .panel-default {
  18. border-color: #ddd;
  19. }
  20. .panel-default>.panel-heading {
  21. color: #333;
  22. background-color: #f5f5f5;
  23. border-color: #ddd;
  24. }
  25. .panel-title {
  26. margin-top: 0;
  27. margin-bottom: 0;
  28. font-size: 16px;
  29. color: inherit;
  30. }
  31. .panel-body .table>thead>tr>th, .panel-body .table>tbody>tr>th, .panel-body .table>tfoot>tr>th, .panel-body .table>thead>tr>td, .panel-body .table>tbody>tr>td, .panel-body .table>tfoot>tr>td , .panel-body div{
  32. padding: 8px 15px;
  33. line-height: 1.428571429;
  34. vertical-align: top;
  35. border-top: 1px solid #ddd;
  36. }
  37. .panel-body { padding:0px; }
  38. .panel-body table tr td { padding-left: 15px }
  39. .panel-body table tr td a:hover , .panel-body div a:hover{ color: #d84315 !important; }
  40. .panel-body .table, .panel-body div {margin-bottom: 0px; }
  41. .glyphicon { margin-right:10px; }
  42. .active { color: #d84315; }
  43. .active:hover { color: #d84315; }
  44. #custom table {
  45. table-layout:fixed !important;
  46. border-collapse: collapse !important;
  47. width: 100%;
  48. word-wrap:break-word !important;
  49. }
  50. #custom td, #custom th {
  51. border-top: 1px solid #dee2e6;
  52. border-bottom: 1px solid #dee2e6;
  53. }
  54. .longtext{
  55. word-wrap: break-word !important;
  56. word-break: break-word !important;
  57. padding: 0.6rem 2rem;
  58. }
  59. .btn i {
  60. margin-right: 0px;
  61. }
  62. </style>
  63. <div class="inner-page">
  64. <!-- Display message -->
  65. <div class="row">
  66. <div class="col-md-12">
  67. <div class="fluid">
  68. @if(count($errors) > 0)
  69. <div class="alert alert-danger icons-alert">
  70. @foreach($errors->all() as $error)
  71. <p>{{$error}}</p>
  72. @endforeach
  73. </div>
  74. @endif
  75. @if(Session::get('error_msg'))
  76. <div class="alert alert-danger icons-alert">
  77. {!! Session::get('error_msg') !!}
  78. </div>
  79. @elseif(Session::get('success_msg'))
  80. <div class="alert alert-success icons-alert">
  81. {!! Session::get('success_msg') !!}
  82. </div>
  83. @endif
  84. </div>
  85. </div>
  86. </div>
  87. <!-- End Display message -->
  88. <div class="row">
  89. <div class="col-xl-2 col-md-12">
  90. <div class="panel panel-default">
  91. <div class="panel-heading">
  92. <h4 class="panel-title"> Maklumat Terperinci </h4>
  93. </div>
  94. <div class="panel-body">
  95. @if($compound->status == 'Belum Bayar')
  96. <div><a href="{{ url('officer/compound') }}/{{ $compound->kpd }}/index" class="{{ Request::is('officer/compound/*/index') ? 'active' : '' }}">Garis Masa/Sejarah</a></div>
  97. <div><a href="{{ url('/officer/compound') }}/{{$compound->kpd}}">Kompaun</a></div>
  98. @if($compound->modul == '04')
  99. <div><a href="{{ url('/officer/compound') }}/{{$compound->kpd}}/investigation" class="{{ Request::is('officer/compound/*/investigation') ? 'active' : '' }}">Pengesahan Kompaun</a></div>
  100. <div><a href="{{ url('/officer/compound') }}/{{$compound->kpd}}/memo" class="{{ Request::is('officer/compound/*/memo') ? 'active' : '' }}">Memo/Nota</a></div>
  101. @elseif($compound->modul == '05')
  102. <div><a href="{{ url('/officer/compound') }}/{{$compound->kpd}}/notice" class="{{ Request::is('officer/compound/*/notice') ? 'active' : '' }}">Notis Amaran</a></div>
  103. <div><a href="{{ url('/officer/compound') }}/{{$compound->kpd}}/memo" class="{{ Request::is('officer/compound/*/memo') ? 'active' : '' }}">Memo/Nota</a></div>
  104. @elseif($compound->modul == '06')
  105. <div><a href="{{ url('/officer/compound') }}/{{$compound->kpd}}/inventory" class="{{ Request::is('officer/compound/*/inventory') ? 'active' : '' }}">Inventori</a></div>
  106. <div><a href="{{ url('/officer/compound') }}/{{$compound->kpd}}/memo" class="{{ Request::is('officer/compound/*/memo') ? 'active' : '' }}">Memo/Nota</a></div>
  107. @elseif($compound->modul == '07')
  108. <div><a href="{{ url('officer/compound') }}/{{$compound->kpd}}/inventory/auction" class="{{ Request::is('officer/compound/*/inventory/auction') ? 'active' : '' }}">Jualan Lelong</a></div>
  109. <div><a href="{{ url('/officer/compound') }}/{{$compound->kpd}}/memo" class="{{ Request::is('officer/compound/*/memo') ? 'active' : '' }}">Memo/Nota</a></div>
  110. @endif
  111. <div><a target="_blank" href="{{ url('/officer/compound') }}/{{$compound->kpd}}/pdf">Cetak/Papar PDF</a></div>
  112. <div><a href="{{ url('/officer/compound') }}/{{$compound->kpd}}/task" class="{{ Request::is('officer/compound/*/task') ? 'active' : '' }}">Serahan Modul/PenguatKuasa</a></div>
  113. @elseif($compound->status == 'Berbayar')
  114. <div><a href="{{ url('officer/compound') }}/{{ $compound->kpd }}/index" class="{{ Request::is('officer/compound/*/index') ? 'active' : '' }}">Garis Masa/Sejarah</a></div>
  115. <div><a href="{{ url('/officer/compound') }}/{{$compound->kpd}}">Kompaun</a></div>
  116. <div><a target="_blank" href="{{ url('/officer/compound') }}/{{$compound->kpd}}/pdf">Cetak/Papar PDF</a></div>
  117. @endif
  118. </div>
  119. </div>
  120. </div>
  121. <div class="col-xl-10 col-md-12">
  122. <div class="row">
  123. <div class="col-md-12">
  124. <div class="card">
  125. <div class="card-header">
  126. <h5 class="card-header-text">
  127. Maklumat Inventori [ No.Kompaun : <code>{{ $compound->kpd }}</code> | No.Siri : <code>{{ $file->no_siri }}</code> | Modul: <code>{{ $role->name }}</code>]
  128. </h5>
  129. <span><code>Perhatian!!</code> Semua maklumat inventori boleh diakses sekiranya kompaun ini berada di dalam kategori <code>modul sitaan - inventori</code></span>
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. <div class="row">
  135. <div class="col-md-12">
  136. <div class="card">
  137. <div class="card-block">
  138. <div class="row">
  139. <div class="col-md-12">
  140. <a target="_blank" href="{{ url('/officer/compound') }}/{{ $compound->kpd }}/inventory/pdf" class="btn btn-sm btn-out-dashed waves-effect waves-light btn-success btn-square f-right" data-toggle="tooltip" data-placement="top" title="Lihat Inventori">
  141. <i class="ti-zoom-in"></i>
  142. </a>
  143. @if($compound->modul == '06')
  144. <button id="inventori-btn" type="button" class="btn btn-sm btn-outline-danger waves-effect waves-light f-right" data-toggle="tooltip" data-placement="top" title="Tambah Inventori">
  145. <i class="icofont icofont-edit"></i>
  146. </button>
  147. @endif
  148. </div>
  149. </div>
  150. <hr>
  151. <div id="view-inventori" class="row">
  152. <div class="col-xl-12">
  153. <div class="data_table_main dt-responsive table-responsive">
  154. <table id="parentInventori" class="table table-sm table-striped table-bordered nowrap" width="100%">
  155. <thead>
  156. <tr>
  157. <th>Tarikh</th>
  158. <th>Masa</th>
  159. <th>Jenis</th>
  160. <th>Bilangan</th>
  161. <th>Harga</th>
  162. <th>Lokasi Gudang</th>
  163. <th>Status</th>
  164. <th>Tindakan</th>
  165. </tr>
  166. </thead>
  167. <tfoot>
  168. <tr>
  169. <th>Tarikh</th>
  170. <th>Masa</th>
  171. <th>Jenis</th>
  172. <th>Bilangan</th>
  173. <th>Harga</th>
  174. <th>Lokasi Gudang</th>
  175. <th>Status</th>
  176. <th>Tindakan</th>
  177. </tr>
  178. </tfoot>
  179. </table>
  180. </div>
  181. </div>
  182. </div>
  183. <!-- <div class="animation-modal"> -->
  184. <div class="modal fade" id="ViewDetail" tabindex="-1" role="dialog">
  185. <div class="modal-dialog modal-lg" role="document">
  186. <div class="modal-content">
  187. <div class="modal-header">
  188. <h4 class="modal-title">Maklumat Item Inventori</h4>
  189. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  190. <span aria-hidden="true">&times;</span>
  191. </button>
  192. </div>
  193. <div class="modal-body" style="padding-left: 2rem;padding-right: 2rem;">
  194. <div class="row">
  195. <div class="col-md-3">
  196. <b>Jenis: </b>
  197. </div>
  198. <div class="col-md-3">
  199. <div id="jenis"></div>
  200. </div>
  201. <div class="col-md-3">
  202. <b>Bilangan: </b>
  203. </div>
  204. <div class="col-md-3">
  205. <div id="bilangan"></div>
  206. </div>
  207. </div>
  208. <hr>
  209. <div class="row">
  210. <div class="col-md-3">
  211. <b>Harga 1 item: </b>
  212. </div>
  213. <div class="col-md-3">
  214. <div id="harga"></div>
  215. </div>
  216. <div class="col-md-3">
  217. <b>Status: </b>
  218. </div>
  219. <div class="col-md-3">
  220. <div id="status"></div>
  221. </div>
  222. </div>
  223. <hr>
  224. <div class="row">
  225. <div class="col-md-3">
  226. <b>Lokasi Gudang: </b>
  227. </div>
  228. <div class="col-md-9">
  229. <div id="lokasi"></div>
  230. </div>
  231. </div>
  232. <hr>
  233. <div class="row">
  234. <div class="col-md-12">
  235. <table class="table">
  236. </table>
  237. </div>
  238. </div>
  239. </div>
  240. </div>
  241. </div>
  242. </div>
  243. <!-- End Modal -->
  244. <div id="edit-inventori" class="row">
  245. <div class="col-lg-12 col-md-12">
  246. <div class="form-group form-primary">
  247. <label class="float-label"><b>Kategori</b></label>
  248. <select id="inv-kategori" name="" class="form-control form-control-inverse">
  249. <option value="">Sila Pilih Kategori</option>
  250. <option value="alih">Barang Boleh Alih</option>
  251. <option value="xalih">Barang Tidak Boleh Alih</option>
  252. </select>
  253. <span class="form-bar"></span>
  254. </div>
  255. <form method="POST" action="{{ url('officer/compound/inventory/add') }}" id="boleh-alih">
  256. <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
  257. <input type="hidden" name="kpd" value="{{ $compound->kpd }}">
  258. <input type="hidden" name="kategori" value="alih">
  259. <div class="row">
  260. <div class="col-lg-6 col-md-12">
  261. <div class="form-group form-primary">
  262. <label class="float-label">Jenis</label>
  263. <input type="text" name="jenis" class="form-control" required="">
  264. <span class="form-bar"></span>
  265. </div>
  266. </div>
  267. <div class="col-lg-6 col-md-12">
  268. <div class="form-group form-primary">
  269. <label class="float-label">Bilangan</label>
  270. <input type="number" name="bilangan" class="form-control" required="">
  271. <span class="form-bar"></span>
  272. </div>
  273. </div>
  274. <div class="col-lg-6 col-md-12">
  275. <div class="form-group form-primary">
  276. <label class="float-label">Harga</label>
  277. <input type="number" name="harga" class="form-control" required="" step="0.01">
  278. <code>Sila masukkan harga item, bukan jumlah bilangan</code>
  279. <span class="form-bar"></span>
  280. </div>
  281. </div>
  282. <div class="col-lg-6 col-md-12">
  283. <div class="form-group form-primary">
  284. <label class="float-label">Lokasi Gudang</label>
  285. <input type="text" name="lokasi" class="form-control" required="">
  286. <span class="form-bar"></span>
  287. </div>
  288. </div>
  289. </div>
  290. <hr>
  291. <div class="f-right">
  292. <button type="submit" class="btn btn-sm btn-outline-danger waves-effect">Simpan Rekod Inventori</button>
  293. <a href="javascript:;" id="inventori-cancel1" class="btn btn-sm btn-out-dashed waves-effect waves-light btn-default btn-square">Batal</a>
  294. </div>
  295. </form>
  296. <form method="POST" action="{{ url('officer/compound/inventory/add') }}" id="tak-alih">
  297. <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
  298. <input type="hidden" name="kpd" value="{{ $compound->kpd }}">
  299. <input type="hidden" name="lokasi" value="">
  300. <input type="hidden" name="kategori" value="xalih">
  301. <div class="row">
  302. <div class="col-lg-6 col-md-12">
  303. <div class="form-group form-primary">
  304. <label class="float-label">Jenis</label>
  305. <input type="text" name="jenis" class="form-control" required="">
  306. <span class="form-bar"></span>
  307. </div>
  308. </div>
  309. <div class="col-lg-6 col-md-12">
  310. <div class="form-group form-primary">
  311. <label class="float-label">Bilangan</label>
  312. <input type="number" name="bilangan" class="form-control" required="" >
  313. <span class="form-bar"></span>
  314. </div>
  315. </div>
  316. <div class="col-lg-6 col-md-12">
  317. <div class="form-group form-primary">
  318. <label class="float-label">Harga</label>
  319. <input type="number" name="harga" class="form-control" required="" step="0.01">
  320. <code>Sila masukkan harga item, bukan jumlah bilangan</code>
  321. <span class="form-bar"></span>
  322. </div>
  323. </div>
  324. </div>
  325. <hr>
  326. <div class="f-right">
  327. <button type="submit" class="btn btn-sm btn-outline-danger waves-effect">Simpan Rekod Inventori</button>
  328. <a href="javascript:;" id="inventori-cancel" class="btn btn-sm btn-out-dashed waves-effect waves-light btn-default btn-square">Batal</a>
  329. </div>
  330. </form>
  331. </div>
  332. </div>
  333. <div class="modal fade" id="KemaskiniInventori" tabindex="-1" role="dialog">
  334. <div class="modal-dialog modal-lg" role="document">
  335. <div class="modal-content">
  336. <div class="modal-header">
  337. <h4 class="modal-title">Kemaskini Item Inventori</h4>
  338. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  339. <span aria-hidden="true">&times;</span>
  340. </button>
  341. </div>
  342. <div class="modal-body">
  343. <form method="POST" action="{{ url('/officer/compound/inventory/edit') }}">
  344. <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
  345. <input type="hidden" name="kpd" value="{{ $compound->kpd }}">
  346. <input type="hidden" id="_id" name="_id" value="" required="">
  347. <div class="row">
  348. <div class="col-lg-6 col-md-12">
  349. <div class="form-group form-primary">
  350. <label class="float-label">Jenis</label>
  351. <input type="text" id="jenis_barang" name="jenis" class="form-control" required="" value="">
  352. <span class="form-bar"></span>
  353. </div>
  354. </div>
  355. <div class="col-lg-6 col-md-12">
  356. <div class="form-group form-primary">
  357. <label class="float-label">Bilangan</label>
  358. <input type="number" id="bilangan_barang" name="bilangan" class="form-control" required="" value="">
  359. <span class="form-bar"></span>
  360. </div>
  361. </div>
  362. <div class="col-lg-6 col-md-12">
  363. <div class="form-group form-primary">
  364. <label class="float-label">Harga</label>
  365. <input type="number" id="harga_barang" name="harga" class="form-control" required="" step="0.01" value="">
  366. <code>Sila masukkan harga item, bukan jumlah bilangan</code>
  367. <span class="form-bar"></span>
  368. </div>
  369. </div>
  370. <div class="col-lg-6 col-md-12" id="need_location">
  371. <div class="form-group form-primary">
  372. <label class="float-label">Lokasi Gudang</label>
  373. <input type="text" id="lokasi_barang" name="lokasi" class="form-control" value="">
  374. <span class="form-bar"></span>
  375. </div>
  376. </div>
  377. </div>
  378. <hr>
  379. <div class="f-right">
  380. <button type="submit" class="btn btn-sm btn-outline-danger waves-effect">Kemaskini Rekod Item</button>
  381. </div>
  382. </form>
  383. </div>
  384. </div>
  385. </div>
  386. </div>
  387. <div class="md-overlay"></div>
  388. </div>
  389. </div>
  390. </div>
  391. </div>
  392. </div>
  393. </div>
  394. </div>
  395. @endsection
  396. @section('external_js')
  397. <script type="text/javascript" src="{{ asset('js/toggle_button_edit.js') }}"></script>
  398. <script type="text/javascript">
  399. $('#need_location').hide();
  400. var table = $('#parentInventori').DataTable({
  401. "ordering": false,
  402. "serverSide": true,
  403. "processing": true,
  404. "ajax": "{{ url('api/inventory') }}/{{$file->no_siri}}/list",
  405. "columns": [
  406. { "data": "tarikh","name": "tarikh"},
  407. { "data": "masa","name": "masa"},
  408. { "data": "jenis","name": "jenis"},
  409. { "data": "bilangan", "name": "bilangan" },
  410. { "data": "harga", "name": "harga"},
  411. { "data": "lokasi", "name": "lokasi"},
  412. { "data": "status", "name": "status"},
  413. { "data": "tindakan","name": "tindakan"}
  414. ],
  415. "columnDefs": [
  416. {
  417. "render": function ( data, type, row ) {
  418. if (data.indexOf("Baru/") >= 0) {
  419. var split = data.split('/');
  420. return '<label class="label label-success">'+split[0]+'</label>&nbsp;'+split[1];
  421. }else {
  422. return data;
  423. }
  424. },
  425. "targets": 0,
  426. },
  427. {
  428. "render": function ( data, type, row ) {
  429. var kpd = '{{ $compound->kpd }}';
  430. var modul = "{{ $file->modul }}";
  431. if(modul != '06'){
  432. return '<div class="btn-group btn-group-sm" style="float: none;"><a onclick="getDetail(\''+data+'\')" class="tabledit-edit-button btn btn-success waves-effect waves-light" style="float: none;" data-toggle="tooltip" data-placement="top" title="Maklumat Item Inventori"><span class="icofont icofont-eye-alt" style="color:white"></span></a></div>';
  433. }else {
  434. return '<div class="btn-group btn-group-sm" style="float: none;"><a onclick="getDetail(\''+data+'\')" class="tabledit-edit-button btn btn-success waves-effect waves-light" style="float: none;" data-toggle="tooltip" data-placement="top" title="Maklumat Item Inventori"><span class="icofont icofont-eye-alt" style="color:white"></span></a> <a onclick="editDetail(\''+data+'\')" class="tabledit-edit-button btn btn-primary waves-effect waves-light" style="float: none;" data-toggle="tooltip" data-placement="top" title="Kemaskini Item Inventori"><span class="icofont icofont-ui-edit" style="color:white"></span></a> <a onclick="deleteA(\''+kpd+'\',\''+data+'\',\'' + row.jenis + '\')" data-toggle="tooltip" data-placement="top" title="Buang Item Inventori" class="tabledit-delete-button btn btn-danger waves-effect waves-light" style="float: none;"><span class="icofont icofont-ui-delete" style="color:white"></span></a></div>';
  435. }
  436. },
  437. "targets": 7,
  438. },
  439. ],
  440. "language": {
  441. "paginate": {
  442. "previous": "Sebelum",
  443. "next": "Selepas"
  444. },
  445. "sLengthMenu": "Tunjukkan _MENU_ entri",
  446. "zeroRecords": "Tiada Data Ditemui",
  447. "infoEmpty": "Tiada Rekod Yang Wujud",
  448. "infoFiltered": "(Ditapis daripada _MAX_ jumlah rekod)",
  449. "info": "Tunjuk _START_ hingga _END_ daripada _TOTAL_ entri",
  450. "sSearch": "Cari:",
  451. }
  452. });
  453. function getDetail(id) {
  454. $.ajax({
  455. url: "{{ url('api/inventory/detail') }}",
  456. method: "POST",
  457. data: { "_token": "{{ csrf_token() }}", id: id },
  458. success: function(data){
  459. if(data['status'] == "true"){
  460. $('#jenis').html(data['desc'].jenis);
  461. $('#bilangan').html(data['desc'].bilangan);
  462. $('#harga').html(data['desc'].harga);
  463. $('#status').html(data['desc'].status);
  464. $('#lokasi').html(data['desc'].lokasi);
  465. $('#ViewDetail').modal({
  466. show: true
  467. })
  468. }else if(data['status'] == "false"){
  469. swal("Error Get data!", data['desc'], "error");
  470. }
  471. }
  472. });
  473. };
  474. function editDetail(id) {
  475. $.ajax({
  476. url: "{{ url('api/inventory/detail') }}",
  477. method: "POST",
  478. data: { "_token": "{{ csrf_token() }}", id: id },
  479. success: function(data){
  480. if(data['status'] == "true"){
  481. if(data['desc'].kategori == "alih"){
  482. $('#lokasi_barang').val(data['desc'].lokasi);
  483. $('#need_location').show();
  484. $( "#lokasi_barang" ).prop( "checked", true);
  485. }else{
  486. $('#need_location').hide();
  487. $( "#lokasi_barang" ).prop( "checked", false);
  488. }
  489. $('#_id').val(data['desc']._id);
  490. $('#jenis_barang').val(data['desc'].jenis);
  491. $('#bilangan_barang').val(data['desc'].bilangan);
  492. $('#harga_barang').val(data['desc'].harga);
  493. $('#KemaskiniInventori').modal({
  494. show: true
  495. });
  496. }else if(data['status'] == "false"){
  497. swal("Error Get data!", data['desc'], "error");
  498. }
  499. }
  500. });
  501. };
  502. function deleteA(kpd,cid,jenis) {
  503. var kpd = kpd;
  504. var cid = cid;
  505. var jenis = jenis;
  506. var _id = '{{ $user->_id }}';
  507. var kpd = '{{ $compound->kpd }}';
  508. swal({
  509. title: "Adakah anda pasti?",
  510. text: "Anda tidak akan dapat memulihkan rekod item ini ( " + jenis + " )",
  511. html: true,
  512. type: "warning",
  513. showCancelButton: true,
  514. confirmButtonClass: "btn-danger",
  515. confirmButtonText: "Ya!",
  516. cancelButtonText: "Batal!",
  517. closeOnConfirm: false
  518. },
  519. function(isConfirm){
  520. if (!isConfirm) return;
  521. $.ajax({
  522. type: "POST",
  523. url: "{{ url('api/inventory/delete') }}",
  524. data: { "_token": "{{ csrf_token() }}", id: cid, kpd: kpd, _id: _id },
  525. success:function(data){
  526. if(data['status'] == "true"){
  527. swal({
  528. title: "Berjaya",
  529. text: data['desc'],
  530. type: "success",
  531. showCancelButton: false,
  532. confirmButtonText: "OK!",
  533. closeOnConfirm: true
  534. },
  535. function(){
  536. table.ajax.url("{{ url('api/inventory') }}/{{$file->no_siri}}/list").load();
  537. });
  538. }else if(data['status'] == "false"){
  539. swal({
  540. title: "Tidak Berjaya",
  541. text: data['desc'],
  542. type: "error",
  543. showCancelButton: false,
  544. confirmButtonText: "OK!",
  545. closeOnConfirm: true
  546. },
  547. function(){
  548. table.ajax.url("{{ url('api/inventory') }}/{{$file->no_siri}}/list").load();
  549. });
  550. }
  551. },
  552. error: function (xhr, ajaxOptions, thrownError) {
  553. swal("Error deleting!", "Rekod tidak berjaya di buang", "error");
  554. }
  555. });
  556. });
  557. };
  558. $.ajaxSetup({
  559. headers: {
  560. 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  561. }
  562. });
  563. $('#boleh-alih').hide();
  564. $('#tak-alih').hide();
  565. $(document).ready(function() {
  566. var origin = window.location.origin;
  567. $(".theme-loader").animate({
  568. opacity: "0"
  569. },1000);
  570. setTimeout(function() {
  571. $(".theme-loader").remove();
  572. }, 800);
  573. $('[data-toggle="tooltip"]').tooltip();
  574. /** Inventori **/
  575. $('#edit-inventori').hide();
  576. $('#inventori-cancel').on('click', function() {
  577. var c = $('#inventori-btn').find("i");
  578. c.removeClass('icofont-close');
  579. c.addClass('icofont-edit');
  580. $('#view-inventori').show();
  581. $('#edit-inventori').hide();
  582. });
  583. $('#inventori-save').on('click', function() {
  584. var c = $('#inventori-btn').find("i");
  585. c.removeClass('icofont-close');
  586. c.addClass('icofont-edit');
  587. $('#view-inventori').show();
  588. $('#edit-inventori').hide();
  589. });
  590. $('#inventori-btn').on('click', function() {
  591. var b = $(this).find("i");
  592. var edit_class = b.attr('class');
  593. if (edit_class == 'icofont icofont-edit') {
  594. b.removeClass('icofont-edit');
  595. b.addClass('icofont-close');
  596. $('#view-inventori').hide();
  597. $('#edit-inventori').show();
  598. } else {
  599. b.removeClass('icofont-close');
  600. b.addClass('icofont-edit');
  601. $('#view-inventori').show();
  602. $('#edit-inventori').hide();
  603. }
  604. });
  605. $('#inv-kategori').change(function(){
  606. if( $(this).val()=="alih"){
  607. $('#boleh-alih').show();
  608. $('#tak-alih').hide();
  609. };
  610. if( $(this).val()=="xalih"){
  611. $('#boleh-alih').hide();
  612. $('#tak-alih').show();
  613. };
  614. })
  615. });
  616. </script>
  617. @endsection