Guest User

Untitled

a guest
Feb 16th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.42 KB | None | 0 0
  1.  
  2. <script type="text/javascript" >
  3. $(document).ready(function () {
  4. $('#table_id').DataTable({
  5. "dom": 'f<"toolbar">rtip'
  6. });
  7.  
  8. $('div.toolbar').html('<button type="submit" id="export" class="btn"><i class="glyphicon glyphicon-export"></i> Export CSV File </button><button type="submit" id="import" class="btn" style="margin-left:10px"><i class="glyphicon glyphicon-import"></i> Import CSV File </button>');
  9. $('#export').click(function () {
  10. // alert('woooy');
  11. window.location.href = "<?php echo base_url('wms/item_master/export');?>";
  12. });
  13.  
  14.  
  15.  
  16. $('#import').click(function() {
  17. $('#hidden_file_browser').click();
  18. });
  19.  
  20.  
  21. $('#hidden_file_browser').change(function () {
  22. document.getElementById("hidden_submit_file").submit();
  23. });
  24. $("a#select").click(function(e){
  25. e.preventDefault();
  26. $("td span input").toggle("slow");
  27. $("th span").toggle("slow");
  28. $("tr#all").toggle("slow");
  29. $("tr#all th").each(function () {
  30. this.style.setProperty( 'background-color', '#3276B1', 'important' );
  31. this.style.setProperty( 'border-top', 'none', 'important' );
  32. this.style.setProperty( 'border-left', 'none', 'important' );
  33. });
  34. $( 'th.numb' ).each(function () {
  35. this.style.setProperty( 'display', 'none', 'important' );
  36. });
  37. $( 'td.numb' ).each(function () {
  38. this.style.setProperty( 'display', 'none', 'important' );
  39. });
  40. });
  41.  
  42.  
  43. });
  44. </script>
  45. <style>
  46. thead th {
  47. padding: 10px 0px !important;
  48. text-align: center !important;
  49. }
  50. </style>
  51. <div class="col-sm-12">
  52. <div class="panel panel-primary">
  53. <div class="panel-heading">
  54. <div class="pull-right" style="margin:-5px -5px 0px;">
  55. <a href="<?php echo base_url('wms/item_master/add');?>" title="Add data" style= "font-size: 24px;">
  56. <i class="glyphicon glyphicon-plus-sign" style="color:white"></i>
  57. </a>
  58. </div>
  59. <h3 class="panel-title">Item Master</h3>
  60. </div>
  61. <?php
  62. // masukan Pesan
  63. $flash = $this->session->flashdata('pesan');
  64. if ($flash!= false){
  65. $flash_berhasil = $flash['berhasil'];
  66. $flash_text = $flash['text'];
  67.  
  68. if ($flash_berhasil ==true){
  69. echo "<div class='alert alert-success alert-dismissible' role='alert'>
  70. <button type='button' class='close' data-dismiss='alert'><span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button>
  71. <strong>Success!</strong>".$flash_text.
  72. "</div>";
  73. }
  74. else{
  75. echo "<div class='alert alert-warning alert-dismissible' role='alert'>
  76. <button type='button' class='close' data-dismiss='alert'><span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button>
  77. <strong>Warning!</strong>".$flash_text.
  78. "</div>";
  79. }
  80. }
  81. if(isset($_SESSION['import']) && $_SESSION['import']['berhasil'] == false){
  82. echo "<div class='alert alert-warning alert-dismissible' role='alert'>
  83. <button type='button' class='close' data-dismiss='alert'><span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button>
  84. <strong>Warning!</strong>".$_SESSION['import']['text'].
  85. "</div>";
  86. }elseif(isset($_SESSION['import']) && $_SESSION['import']['berhasil'] == true){
  87. echo "<div class='alert alert-success alert-dismissible' role='alert'>
  88. <button type='button' class='close' data-dismiss='alert'><span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button>
  89. <strong>Success!</strong> Import</div>";
  90. }
  91.  
  92. if(isset($_SESSION['import'])){
  93. unset($_SESSION['import']);
  94. }
  95. ?>
  96.  
  97. <div class="panel-body">
  98. <div style="display:none">
  99. <form id="hidden_submit_file" action="<?php echo base_url('wms/item_master/import_csv');?>" method="post" enctype="multipart/form-data">
  100. <input type="file" accept=".csv" id="hidden_file_browser" name="data"></input>
  101. </form>
  102. </div>
  103. <a class="btn" id="select">Select To Print</a>
  104. <!--<div style="display:inline;">
  105. <form id="export_file" action="wms/item_master/export" method="post">
  106. <button type="submit" id="export" class="btn" style="background-color:cyan; margin-bottom:5px"><i class="glyphicon glyphicon-export"></i> Export CSV File </button>
  107. </form>
  108. </div>-->
  109. <table width="100%" id="table_id" class="table table-bordered table-striped table-hover table-heading table-datatable">
  110. <thead>
  111. <tr>
  112. <th class="numb">NO</th>
  113. <th>ITEM&nbsp;CODE&nbsp;</th>
  114. <th>ITEM NAME</th>
  115. <th>COMPANY</th>
  116. <th>ORDER LIMIT</th>
  117. <th>UNIT</th>
  118. <th style="width:160px">UNIT PRICE</th>
  119. <th>MIN STOCK</th>
  120. <th>COMMENT</th>
  121. <th>LAST UPDATE BY</th>
  122. <th>UPDATE TIME</th>
  123. <th>ACTION</th>
  124. </tr>
  125. </thead>
  126. <tbody>
  127. <tr style="display:none" id="all">
  128. <th class="numb"></th>
  129. <th>Select&nbsp;All <input type="checkbox" onchange="checkAll(this)" name="chk[]" />&nbsp;</th>
  130. <script>
  131. function checkAll(ele) {
  132. var checkboxes = document.getElementsByTagName('input');
  133. if (ele.checked) {
  134. for (var i = 0; i < checkboxes.length; i++) {
  135. if (checkboxes[i].type == 'checkbox') {
  136. checkboxes[i].checked = true;
  137. }
  138. }
  139. } else {
  140. for (var i = 0; i < checkboxes.length; i++) {
  141. console.log(i)
  142. if (checkboxes[i].type == 'checkbox') {
  143. checkboxes[i].checked = false;
  144. }
  145. }
  146. }
  147. }
  148. </script>
  149. <th></th>
  150. <th></th>
  151. <th></th>
  152. <th></th>
  153. <th></th>
  154. <th></th>
  155. <th></th>
  156. <th></th>
  157. <th></th>
  158. <th></th>
  159. </tr>
  160. <?php
  161. $no = 1;
  162. foreach ($item_master as $dat) {
  163.  
  164. echo '<tr width="20px"; height="10px">';
  165. echo '<td class="numb">' . $no . '</td>';
  166. echo '<td id="lengthways" name="chk[]"><span><input type="checkbox" style="display:none"></span>&nbsp;' . $dat->item_code . '</td>';
  167. echo '<td>' . $dat->item_name . '</td>';
  168. echo '<td>' . $dat->company . '</td>';
  169. echo '<td align="right">'.$this->format->decimal($dat->order_limit) . '</td>';
  170. echo '<td>' . $dat->unit . '</td>';
  171. echo '<td align="right">'.$this->money->format($dat->unit_price,'IDR',true). '</td>';
  172. echo '<td align="right">'.$this->format->decimal($dat->minimum_stock) . '</td>';
  173. echo '<td>' . nl2br($dat->comment) . '</td>';
  174. if(isset($dat->last_update)){
  175. echo '<td>'.$dat->last_update.'</td>';
  176. }else{
  177. echo '<td align="center"> - </td>';
  178. }
  179. if(isset($dat->last_update)){
  180. echo '<td>'.$dat->update_time.'</td>';
  181. }else{
  182. echo '<td align="center"> - </td>';
  183. }
  184. echo '
  185. <td>
  186. <a href="'. base_url('wms/item_master/edit/'. $dat->item_code) . '" title="Edit">
  187. <i class="glyphicon glyphicon-edit"></i>
  188. </a>
  189. <a href="'. base_url('wms/item_master/delete/'. $dat->item_code) . '" title="Delete" onclick="return confirm_delete()">
  190. <i class="glyphicon glyphicon-trash"></i>
  191. </a>
  192. </td>';
  193. echo '</tr>';
  194. $no++;
  195. }
  196. ?>
  197. </tbody>
  198. </table>
  199. <div><button type="submit" class="btn" value="" style=""><i class='glyphicon glyphicon-print'></i> Print</button></div>
  200. </div>
  201. </div>
  202. </div>
Advertisement
Add Comment
Please, Sign In to add comment