<?php /***
Auth: Vastvikta Nishad
Description:Display project
*/?>
<div class="style2-table">
    <div class="style-title">
        <h3>Department</h3>
        <div class="row">
             <?php $new_project = base64_encode('new_project');?>
            <div class="col-sm-3" style="text-align: end;">
            
                <a href="admin_index.php?token=<?php echo $new_project;?>" class="button-orange1">New Department</a>
                </div>
         </div>  
    <div id="success"></div>
    <form name="frmService" action="" method="post">
        <div class="table" id="SRallview">
            <div class="">
                <div class="div2">
                    <table class="tableview tableview-2" id="admin_table">
                        <thead>
                            <tr class="background">
                                <td align="left">S.No.</td>
                                <td align="left"><?php echo $display_name ?> Name</td>
                                <td align="left">Category</td>
                                <td align="left">Created By</td>
                                <td align="left">Created On</td>
                                <td align="left">Action</td>
                            </tr>
                        </thead>
                                <tbody>
                                <?php
                                    $search = '';
                                    $subCat = array();
                                    $result_set = view_project();
                                    while ($res = mysqli_fetch_array($result_set)) {
                                         $subCat[] = $res;
                                    }
                                        $no = 1;
                                        $i = 0;
                                    while ($i < count($subCat)) {
                                        $res = $subCat[$i];
                                        $type_arr = explode(',', $res['Type']);
                                        $new_project = base64_encode('new_project');
                                        $id = base64_encode($res['pId']);
                                    ?>
                                <tr>
                                <td align="left"><?= $no++; ?></td>
                                <td align="left"><?= ucfirst(strtolower($res['vProjectName'])) ?></td>
                                <td align="left">
                                    <?php
                                    $j = 0;
                                    while ($j < count($type_arr)) {
                                        $id = $type_arr[$j];
                                        echo $cat = category($id) . ',';
                                        $j++;
                                    }
                                    ?>
                                </td>
                                    <td align="left"><?= $res['v_CreateBY'] ?></td>
                                    <td align="left"><?= $res['d_datetime']?></td>
                                <td>
                                    <a href="admin_index.php?token=<?php echo $new_project;?>&id=<?= base64_encode($res['pId']); ?>">
                                        <img src="<?=$SiteURL?>public/images/edit-icon.png" border="0" alt="Edit" />
                                    </a>
                                    <a href='javascript:void(0);' data-id="<?=$res['pId']?>" class="project_delete">
                                        <img src="<?=$SiteURL?>public/images/delete-icon.png" border="0" alt="delete">
                                    </a>
                                </td>

                                </tr>
                                <?php
                                $i++;
                                }
                                ?>
                                </tbody>
                    </table>
                </div>
            </div>
        </div>
        <input type="hidden" name="Action" />
        <input type="hidden" name="I_ServiceID" />
    </form>
</div>
