SHOW:
|
|
- or go back to the newest paste.
| 1 | <script type="text/javascript" > | |
| 2 | $(document).ready(function () {
| |
| 3 | $('#table_id').DataTable({
| |
| 4 | "dom": 'f<"toolbar">rtip' | |
| 5 | }); | |
| 6 | ||
| 7 | $('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>');
| |
| 8 | $('#export').click(function () {
| |
| 9 | // alert('woooy');
| |
| 10 | window.location.href = "<?php echo base_url('wms/item_master/export');?>";
| |
| 11 | }); | |
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | $('#import').click(function() {
| |
| 16 | $('#hidden_file_browser').click();
| |
| 17 | }); | |
| 18 | ||
| 19 | ||
| 20 | $('#hidden_file_browser').change(function () {
| |
| 21 | document.getElementById("hidden_submit_file").submit();
| |
| 22 | }); | |
| 23 | $("a#select").click(function(e){
| |
| 24 | e.preventDefault(); | |
| 25 | $("td span input").toggle("slow");
| |
| 26 | $("th span").toggle("slow");
| |
| 27 | $("tr#all").toggle("slow");
| |
| 28 | $("tr#all th").each(function () {
| |
| 29 | this.style.setProperty( 'background-color', '#3276B1', 'important' ); | |
| 30 | this.style.setProperty( 'border-top', 'none', 'important' ); | |
| 31 | this.style.setProperty( 'border-left', 'none', 'important' ); | |
| 32 | }); | |
| 33 | $( 'th.numb' ).each(function () {
| |
| 34 | this.style.setProperty( 'display', 'none', 'important' ); | |
| 35 | }); | |
| 36 | $( 'td.numb' ).each(function () {
| |
| 37 | this.style.setProperty( 'display', 'none', 'important' ); | |
| 38 | }); | |
| 39 | }); | |
| 40 | ||
| 41 | ||
| 42 | }); | |
| 43 | </script> | |
| 44 | <style> | |
| 45 | thead th {
| |
| 46 | padding: 10px 0px !important; | |
| 47 | text-align: center !important; | |
| 48 | } | |
| 49 | </style> | |
| 50 | <div class="col-sm-12"> | |
| 51 | <div class="panel panel-primary"> | |
| 52 | <div class="panel-heading"> | |
| 53 | <div class="pull-right" style="margin:-5px -5px 0px;"> | |
| 54 | <a href="<?php echo base_url('wms/item_master/add');?>" title="Add data" style= "font-size: 24px;">
| |
| 55 | <i class="glyphicon glyphicon-plus-sign" style="color:white"></i> | |
| 56 | </a> | |
| 57 | </div> | |
| 58 | <h3 class="panel-title">Item Master</h3> | |
| 59 | </div> | |
| 60 | <?php | |
| 61 | // masukan Pesan | |
| 62 | $flash = $this->session->flashdata('pesan');
| |
| 63 | if ($flash!= false){
| |
| 64 | $flash_berhasil = $flash['berhasil']; | |
| 65 | $flash_text = $flash['text']; | |
| 66 | ||
| 67 | if ($flash_berhasil ==true){
| |
| 68 | echo "<div class='alert alert-success alert-dismissible' role='alert'> | |
| 69 | <button type='button' class='close' data-dismiss='alert'><span aria-hidden='true'>×</span><span class='sr-only'>Close</span></button> | |
| 70 | <strong>Success!</strong>".$flash_text. | |
| 71 | "</div>"; | |
| 72 | } | |
| 73 | else{
| |
| 74 | echo "<div class='alert alert-warning alert-dismissible' role='alert'> | |
| 75 | <button type='button' class='close' data-dismiss='alert'><span aria-hidden='true'>×</span><span class='sr-only'>Close</span></button> | |
| 76 | <strong>Warning!</strong>".$flash_text. | |
| 77 | "</div>"; | |
| 78 | } | |
| 79 | } | |
| 80 | if(isset($_SESSION['import']) && $_SESSION['import']['berhasil'] == false){
| |
| 81 | echo "<div class='alert alert-warning alert-dismissible' role='alert'> | |
| 82 | <button type='button' class='close' data-dismiss='alert'><span aria-hidden='true'>×</span><span class='sr-only'>Close</span></button> | |
| 83 | <strong>Warning!</strong>".$_SESSION['import']['text']. | |
| 84 | "</div>"; | |
| 85 | }elseif(isset($_SESSION['import']) && $_SESSION['import']['berhasil'] == true){
| |
| 86 | echo "<div class='alert alert-success alert-dismissible' role='alert'> | |
| 87 | <button type='button' class='close' data-dismiss='alert'><span aria-hidden='true'>×</span><span class='sr-only'>Close</span></button> | |
| 88 | <strong>Success!</strong> Import</div>"; | |
| 89 | } | |
| 90 | ||
| 91 | if(isset($_SESSION['import'])){
| |
| 92 | unset($_SESSION['import']); | |
| 93 | } | |
| 94 | ?> | |
| 95 | ||
| 96 | <div class="panel-body"> | |
| 97 | <div style="display:none"> | |
| 98 | <form id="hidden_submit_file" action="<?php echo base_url('wms/item_master/import_csv');?>" method="post" enctype="multipart/form-data">
| |
| 99 | <input type="file" accept=".csv" id="hidden_file_browser" name="data"></input> | |
| 100 | </form> | |
| 101 | </div> | |
| 102 | <a class="btn" id="select">Select To Print</a> | |
| 103 | <!--<div style="display:inline;"> | |
| 104 | <form id="export_file" action="wms/item_master/export" method="post"> | |
| 105 | <button type="submit" id="export" class="btn" style="background-color:cyan; margin-bottom:5px"><i class="glyphicon glyphicon-export"></i> Export CSV File </button> | |
| 106 | </form> | |
| 107 | </div>--> | |
| 108 | <div style='width:150%;overflow:auto'> | |
| 109 | - | <table width="100%" id="table_id" class="table table-bordered table-striped table-hover table-heading table-datatable"> |
| 109 | + | <table 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 CODE </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 All <input type="checkbox" onchange="checkAll(this)" name="chk[]" /> </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> ' . $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> | |
| 200 | <div><button type="submit" class="btn" value="" style=""><i class='glyphicon glyphicon-print'></i> Print</button></div> | |
| 201 | </div> | |
| 202 | </div> | |
| 203 | </div> |