<?php
session_start();
// ============

include("../../asset/theme/css/myfunc.php");
include("../../php_crud/my_class.php");
$obj = new my_class();
// ============
$branchid = $_SESSION['LOGIN_BRANCH'];

?>
<div class="row-fluid">
    <table id="gw-station-table" class="table table-striped table-bordered table-hover">
        <thead>
            <th style="text-align: center; width:10%;">SI No.</th>
            <th style="text-align: center; width:15%;">Color Code</th>
            <th style="text-align: center; width:60%;">Color</th>
            <!-- <th style="text-align: center;">Status</th> -->
            <!-- <th style="text-align: center;">Description</th>
            <th style="text-align: center;">YL</th>
            <th style="text-align: center;">YM</th>
            <th style="text-align: center;">YH</th> -->
            <!-- <th style="text-align: center;">Insert By</th>
            <th style="text-align: center;">Insert Date</th>
            <th style="text-align: center;">Updtae By</th>
            <th style="text-align: center;">Update Date</th> -->
            <th style="text-align: center; width:15%;">Action</th>
        </thead>
        <tbody>
            <?php
            $sl = 0;
            //$cond = "HYDSUBDIVCODE LIKE 'GW%' ORDER BY WELL_ID";
            foreach ($obj->View_colmn_By_Cond("HYDROLOGY.COLOR_TBL@HYDRO10", "*", "1=1 ORDER BY COLOR_CODE") as $value) {
                $sl++;
                $color_code = $value['COLOR_CODE'];
                $color = $value['COLOR'];
                //$status = $value['STATUS'];
                // $description = $value['DESCRIPTION'];
                // $yl = $value['YL'];
                // $ym = $value['YM'];
                // $yh = $value['YH'];
                // $insertby = $value['INSERT_BY'];
                // $idate = $value['INSERT_DTM'];
                // $updateby= $value['UPDT_BY'];
                // $udate = $value['UPDT_DTM'];

                // if ($value['STATUS'] == 'A') {
                //     $status = "<span class='label label-success' style='width:40px;'>Active</span>";
                // }
                // if ($value['STATUS'] == 'I') {
                //     $status = "<span class='label label-pink'>Inactive</span>";
                // }

                echo "<tr>";
                echo "<td>" . $sl . "</td>";
                echo "<td>$color_code</td>";
                echo "<td>$color</td>";
                // echo "<td style='text-align:center'>$status</td>";
                // echo "<td>$description</td>";
                // echo "<td>$yl</td>";
                // echo "<td>$ym</td>";
                // echo "<td>$yh</td>";
                // echo "<td>$insertby</td>";
                // echo "<td>$idate</td>";
                // echo "<td>$updateby</td>";
                // echo "<td>$udate</td>";
                //echo "<td>$sd_name ($sub_div)</td>";

                echo '<td style="text-align:right;">';
                if ($_SESSION['edit'] == 'Y') {
                    echo '<a class="label label-info" style="hover:cursor;" href="#modal-stat-view" data-toggle="modal" onclick="load_litho_color_vw_modal(\'' . $color_code . '\')"> <i class="fa fa-eye"></i> View</a>';
                    echo '&nbsp;&nbsp;&nbsp;<a class="label label-success" style="hover:cursor;" href="#modal-litho-material-code-edit" data-toggle="modal" onclick="load_litho_color_edit_modal(\'' . $color_code . '\')"> <i class="fa fa-edit"></i> Edit</a>';
                    echo '&nbsp;&nbsp;&nbsp;<a class="label" style="cursor: pointer; background-color: #D15B47 !important;" onclick="load_litho_color_delete(\'' . $color_code . '\')"> <i class="icon-trash"></i> Delete</a>';
                }
                echo '</td>';
                echo "</tr>";
            }
            ?>
        </tbody>
    </table>
</div>
<script type="text/javascript">
    $(document).ready(function() {
        var oTable2 = $('#gw-station-table').DataTable({
            "columns": [{
                    "orderable": true
                },
                null, null, null, null,
                {
                    "orderable": true
                }
            ],
            "iDisplayLength": 50
        });
    });
</script>