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

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