Advertisement
Guest User

Untitled

a guest
Dec 4th, 2018
1,092
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.26 KB | None
  1. <table class="table table-hover order-list">
  2. <tr>
  3. <th>Item</th>
  4. <th>Harga</th>
  5. <th>Qty</th>
  6. <th>Diskon (%)</th>
  7. <th>Total</th>
  8. <th></th>
  9. </tr>
  10. <tr>
  11. <td><input type="text" style="width: 200px;" autocomplete="off" id="item" name="item[0]" placeholder="Item"></td>
  12. <td><input type="text" style="width: 100px;" id="harga0" name="harga[0]" placeholder="Harga"> </td>
  13. <td><input type="text" style="width: 50px;" id="qty0" name="qty[0]" placeholder="Qty" onkeyup="findTotal(); findJumlah()"> </td>
  14. <td><input type="text" style="width: 100px;" id="diskon0" name="diskon[0]" placeholder="Diskon"> </td>
  15. <td><input type="text" id="total0" name="total[0]" placeholder="Total"></td>
  16. <td><input type="button" style="width: 50px;" class="btn btn-success" id="addrow" value="+"></input></td>
  17. </tr>
  18. <tr class="isi">
  19. </tr>
  20. <tr class="ongkir">
  21. <td><select style="width: 200px;" name="kurir"><option>-- Pilih Kurir --</option><option value="jne">JNE</option><option value="tiki">TIKI</option><option value="pos">POS INDONESIA</option></select></td>
  22. <td></td>
  23. <td></td>
  24. <td></td>
  25. <td><input type="text" id="totalongkir" name="totalongkir" placeholder="Total"></td>
  26. <td><input type="button" style="width: 50px;" class="ibtnDel btn btn-md btn-danger" value="-"></td>
  27. </tr>
  28. </table>
  29. <table class="table table-hover" border="0">
  30. <tr width="100%">
  31. <td align="right" width="85%"><h4>Jumlah : Rp. <input id="totalsemua" name="totalsemua" style="width: 180px;" readonly></input></h4></td>
  32. <td align="left" width="15%"><h4></h4></td>
  33. </tr>
  34. <tr>
  35. <td align="right"><h3 class="box-title"><input type="submit" class="btn btn-success" value=" + Buat Pesanan"></input></h3></td>
  36. <td><h3 class="box-title"> <a href="<?php echo site_url('Pesanan') ?>"><button type="button" class="btn btn-primary"><i class="fa fa-reply"></i> Kembali</button></a></h3></td>
  37. </tr>
  38. </table>
  39.  
  40. <script type="text/javascript">
  41.  
  42. $(document).ready(function () {
  43. var counter = 1;
  44.  
  45. $("#addrow").on("click", function () {
  46. var newRow = $("<tr>");
  47. var cols = "";
  48. cols += '<td><input type="text" style="width: 200px;" id="item' + counter + '" name="item[' + counter + ']" autocomplete="off" placeholder="Item"></td>';
  49. cols += '<td><input type="text" style="width: 100px;" id="harga' + counter + '" name="harga[' + counter + ']" placeholder="Harga"> </td>';
  50. cols += '<td><input type="text" style="width: 50px;" id="qty' + counter + '" name="qty[' + counter + ']" placeholder="Qty" onkeyup="findTotal(); findJumlah()"> </td>';
  51. cols += '<td><input type="text" style="width: 100px;" id="diskon' + counter + '" name="diskon[' + counter + ']" placeholder="Diskon"> </td>';
  52. cols += '<td><input type="text" id="total' + counter + '" name="total[' + counter + ']" placeholder="Total"></td>';
  53. cols += '<td><input type="button" style="width: 50px;" class="ibtnDel btn btn-md btn-danger" value="-" onclick="findJumlah()"></td>';
  54. newRow.append(cols);
  55. newRow.insertBefore("tr.isi");
  56. $("#item"+counter).autocomplete({
  57. source: function(request, response) {
  58. $.ajax({
  59. url: "<?php echo site_url('Produk/data'); ?>",
  60. data: { id_barang: $("#item"+counter).val()},
  61. dataType: "json",
  62. type: "POST",
  63. success: function(data){
  64. console.log(data);
  65. response(data);
  66. }
  67. });
  68. },
  69. });
  70. counter++;
  71. });
  72.  
  73. $("table.order-list").on("click", ".ibtnDel", function (event) {
  74. $(this).closest("tr").remove();
  75. counter -= 1;
  76. });
  77. </script>
Advertisement
RAW Paste Data Copied
Advertisement