Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript" >
- $(document).ready(function () {
- $('#table_id').DataTable({
- "dom": 'f<"toolbar">rtip'
- });
- $('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>');
- $('#export').click(function () {
- // alert('woooy');
- window.location.href = "<?php echo base_url('wms/item_master/export');?>";
- });
- $('#import').click(function() {
- $('#hidden_file_browser').click();
- });
- $('#hidden_file_browser').change(function () {
- document.getElementById("hidden_submit_file").submit();
- });
- $("a#select").click(function(e){
- e.preventDefault();
- $("td span input").toggle("slow");
- $("th span").toggle("slow");
- $("tr#all").toggle("slow");
- $("tr#all th").each(function () {
- this.style.setProperty( 'background-color', '#3276B1', 'important' );
- this.style.setProperty( 'border-top', 'none', 'important' );
- this.style.setProperty( 'border-left', 'none', 'important' );
- });
- $( 'th.numb' ).each(function () {
- this.style.setProperty( 'display', 'none', 'important' );
- });
- $( 'td.numb' ).each(function () {
- this.style.setProperty( 'display', 'none', 'important' );
- });
- });
- });
- </script>
- <style>
- thead th {
- padding: 10px 0px !important;
- text-align: center !important;
- }
- </style>
- <div class="col-sm-12">
- <div class="panel panel-primary">
- <div class="panel-heading">
- <div class="pull-right" style="margin:-5px -5px 0px;">
- <a href="<?php echo base_url('wms/item_master/add');?>" title="Add data" style= "font-size: 24px;">
- <i class="glyphicon glyphicon-plus-sign" style="color:white"></i>
- </a>
- </div>
- <h3 class="panel-title">Item Master</h3>
- </div>
- <?php
- // masukan Pesan
- $flash = $this->session->flashdata('pesan');
- if ($flash!= false){
- $flash_berhasil = $flash['berhasil'];
- $flash_text = $flash['text'];
- if ($flash_berhasil ==true){
- echo "<div class='alert alert-success alert-dismissible' role='alert'>
- <button type='button' class='close' data-dismiss='alert'><span aria-hidden='true'>×</span><span class='sr-only'>Close</span></button>
- <strong>Success!</strong>".$flash_text.
- "</div>";
- }
- else{
- echo "<div class='alert alert-warning alert-dismissible' role='alert'>
- <button type='button' class='close' data-dismiss='alert'><span aria-hidden='true'>×</span><span class='sr-only'>Close</span></button>
- <strong>Warning!</strong>".$flash_text.
- "</div>";
- }
- }
- if(isset($_SESSION['import']) && $_SESSION['import']['berhasil'] == false){
- echo "<div class='alert alert-warning alert-dismissible' role='alert'>
- <button type='button' class='close' data-dismiss='alert'><span aria-hidden='true'>×</span><span class='sr-only'>Close</span></button>
- <strong>Warning!</strong>".$_SESSION['import']['text'].
- "</div>";
- }elseif(isset($_SESSION['import']) && $_SESSION['import']['berhasil'] == true){
- echo "<div class='alert alert-success alert-dismissible' role='alert'>
- <button type='button' class='close' data-dismiss='alert'><span aria-hidden='true'>×</span><span class='sr-only'>Close</span></button>
- <strong>Success!</strong> Import</div>";
- }
- if(isset($_SESSION['import'])){
- unset($_SESSION['import']);
- }
- ?>
- <div class="panel-body">
- <div style="display:none">
- <form id="hidden_submit_file" action="<?php echo base_url('wms/item_master/import_csv');?>" method="post" enctype="multipart/form-data">
- <input type="file" accept=".csv" id="hidden_file_browser" name="data"></input>
- </form>
- </div>
- <a class="btn" id="select">Select To Print</a>
- <!--<div style="display:inline;">
- <form id="export_file" action="wms/item_master/export" method="post">
- <button type="submit" id="export" class="btn" style="background-color:cyan; margin-bottom:5px"><i class="glyphicon glyphicon-export"></i> Export CSV File </button>
- </form>
- </div>-->
- <div style='width:150%;overflow:auto'>
- <table id="table_id" class="table table-bordered table-striped table-hover table-heading table-datatable">
- <thead>
- <tr>
- <th class="numb">NO</th>
- <th>ITEM CODE </th>
- <th>ITEM NAME</th>
- <th>COMPANY</th>
- <th>ORDER LIMIT</th>
- <th>UNIT</th>
- <th style="width:160px">UNIT PRICE</th>
- <th>MIN STOCK</th>
- <th>COMMENT</th>
- <th>LAST UPDATE BY</th>
- <th>UPDATE TIME</th>
- <th>ACTION</th>
- </tr>
- </thead>
- <tbody>
- <tr style="display:none" id="all">
- <th class="numb"></th>
- <th>Select All <input type="checkbox" onchange="checkAll(this)" name="chk[]" /> </th>
- <script>
- function checkAll(ele) {
- var checkboxes = document.getElementsByTagName('input');
- if (ele.checked) {
- for (var i = 0; i < checkboxes.length; i++) {
- if (checkboxes[i].type == 'checkbox') {
- checkboxes[i].checked = true;
- }
- }
- } else {
- for (var i = 0; i < checkboxes.length; i++) {
- console.log(i)
- if (checkboxes[i].type == 'checkbox') {
- checkboxes[i].checked = false;
- }
- }
- }
- }
- </script>
- <th></th>
- <th></th>
- <th></th>
- <th></th>
- <th></th>
- <th></th>
- <th></th>
- <th></th>
- <th></th>
- <th></th>
- </tr>
- <?php
- $no = 1;
- foreach ($item_master as $dat) {
- echo '<tr width="20px"; height="10px">';
- echo '<td class="numb">' . $no . '</td>';
- echo '<td id="lengthways" name="chk[]"><span><input type="checkbox" style="display:none"></span> ' . $dat->item_code . '</td>';
- echo '<td>' . $dat->item_name . '</td>';
- echo '<td>' . $dat->company . '</td>';
- echo '<td align="right">'.$this->format->decimal($dat->order_limit) . '</td>';
- echo '<td>' . $dat->unit . '</td>';
- echo '<td align="right">'.$this->money->format($dat->unit_price,'IDR',true). '</td>';
- echo '<td align="right">'.$this->format->decimal($dat->minimum_stock) . '</td>';
- echo '<td>' . nl2br($dat->comment) . '</td>';
- if(isset($dat->last_update)){
- echo '<td>'.$dat->last_update.'</td>';
- }else{
- echo '<td align="center"> - </td>';
- }
- if(isset($dat->last_update)){
- echo '<td>'.$dat->update_time.'</td>';
- }else{
- echo '<td align="center"> - </td>';
- }
- echo '
- <td>
- <a href="'. base_url('wms/item_master/edit/'. $dat->item_code) . '" title="Edit">
- <i class="glyphicon glyphicon-edit"></i>
- </a>
- <a href="'. base_url('wms/item_master/delete/'. $dat->item_code) . '" title="Delete" onclick="return confirm_delete()">
- <i class="glyphicon glyphicon-trash"></i>
- </a>
- </td>';
- echo '</tr>';
- $no++;
- }
- ?>
- </tbody>
- </table>
- </div>
- <div><button type="submit" class="btn" value="" style=""><i class='glyphicon glyphicon-print'></i> Print</button></div>
- </div>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement