deliveries.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php include "api/v1/Deliveries/selectDeliveryVw.php" ?>
  2. <table id="example" class="table display table-striped table-bordered table-hover table-sm" cellspacing="0" width="100%">
  3. <thead>
  4. <tr>
  5. <th></th>
  6. <th>Action</th>
  7. <th>Message</th>
  8. <th>id</th>
  9. <th>Tank</th>
  10. <th>Status</th>
  11. <th>Start</th>
  12. <th>End</th>
  13. </tr>
  14. </thead>
  15. <tfoot>
  16. <tr>
  17. <th></th>
  18. <th>Action</th>
  19. <th>Message</th>
  20. <th>id</th>
  21. <th>Tank</th>
  22. <th>Status</th>
  23. </tr>
  24. </tfoot>
  25. </table>
  26. <script type="text/javascript">
  27. /* Formatting function for row details - modify as you need */
  28. function format ( d ) {
  29. // `d` is the original data object for the row
  30. return '<table id="example" class="table table-bordered table-sm" cellspacing="0" width="100%" style="background-color:#3F51B5;color:white;">'+
  31. '<tr>'+
  32. '<th>Product:</th>'+
  33. '<td>'+d.Product+'</td>'+
  34. '</tr>'+
  35. '<tr>'+
  36. '<th>Supplier Id:</th>'+
  37. '<td>'+d.SupplierId+'</td>'+
  38. '</tr>'+
  39. '<tr>'+
  40. '<th>Supplier Name:</th>'+
  41. '<td>'+d.SupplierName+'</td>'+
  42. '</tr>'+
  43. '<tr>'+
  44. '<th>Delivery Car Number:</th>'+
  45. '<td>'+d.DeliveryCarNumber+'</td>'+
  46. '</tr>'+
  47. '<tr>'+
  48. '<th>OrderPrice:</th>'+
  49. '<td>'+d.OrderPrice+'</td>'+
  50. '</tr>'+
  51. '<tr>'+
  52. '<th>OrderVolume:</th>'+
  53. '<td>'+d.OrderVolume+'</td>'+
  54. '</tr>'+
  55. '<tr>'+
  56. '<th>DeliverVolume:</th>'+
  57. '<td>'+d.DeliverVolume+'</td>'+
  58. '</tr>'+
  59. '<tr>'+
  60. '<th>FuelPoints:</th>'+
  61. '<td>'+d.FuelPoints+'</td>'+
  62. '</tr>'+
  63. '<tr>'+
  64. '<th>TankGroup:</th>'+
  65. '<td>'+d.TankGroup+'</td>'+
  66. '</tr>'+'<hr>'+
  67. '<tr>'+
  68. '<th>Tank id</th>'+
  69. '<th>Start Volume</th>'+
  70. '<th>End Volume</th>'+
  71. '<th>Input Volume</th>'+
  72. '</tr>'+
  73. '<tr>'+
  74. '<th>Fp id</th>'+
  75. '<th>Start Volume</th>'+
  76. '<th>End Volume</th>'+
  77. '<th>Output Volume</th>'+
  78. '</tr>'+
  79. '</table>';
  80. }
  81. $(document).ready(function() {
  82. var table = $('#example').DataTable( {
  83. "ajax": "api/v1/Deliveries/deliveryDetails.txt",
  84. "columns": [
  85. {
  86. "className": 'details-control',
  87. "orderable": false,
  88. "data": null,
  89. "defaultContent": ''
  90. },
  91. { "data": "Action" },
  92. { "data": "Message" },
  93. { "data": "Id" },
  94. { "data": "Tank" },
  95. { "data": "Status" },
  96. { "data": "Start" },
  97. { "data": "End" },
  98. ],
  99. "order": [[1, 'asc']]
  100. } );
  101. // Add event listener for opening and closing details
  102. $('#example tbody').on('click', 'td.details-control', function () {
  103. var tr = $(this).closest('tr');
  104. var row = table.row( tr );
  105. if ( row.child.isShown() ) {
  106. // This row is already open - close it
  107. row.child.hide();
  108. tr.removeClass('shown');
  109. }
  110. else {
  111. // Open this row
  112. row.child( format(row.data()) ).show();
  113. tr.addClass('shown');
  114. }
  115. } );
  116. } );
  117. </script>