
<div class="row">

    <div class="col-lg-3 col-md-3 col-sm-3">        
        <a href="<?php echo web_root;?>res/gate?b=getmytsk">
            <div class="p-3 bg-primary-500 rounded overflow-hidden position-relative text-white mb-g">
                <div class="">
                    <h3 class="display-4 d-block l-h-n m-0 fw-500">
                        <?php 
                        $infQue = $db->prepare('SELECT *FROM tbl_info_register i
                        INNER JOIN tbl_con_infos c ON c.reg_info_id=i.regst_id 
                        WHERE dRcv="'.$role_id.'" AND con_doctype=3 AND i.stts_reg=1');
                        $infQue->execute();
                        echo $infQue->rowCount();
                        ?>
                        <small class="m-0 l-h-n">My Task(s)</small>
                    </h3>
                </div>
                <i class="fa fa-bell position-absolute pos-right pos-bottom opacity-15 mb-n1 mr-n1" style="font-size:6rem"></i>
            </div>        
        </a>   
    </div>

    
    <div class="col-lg-3 col-md-3 col-sm-3">        
        <a href="<?php echo web_root;?>/res/gate?b=ongoingp">
            <div class="p-3 bg-primary-500 rounded overflow-hidden position-relative text-white mb-g">
                <div class="">
                    <h3 class="display-4 d-block l-h-n m-0 fw-500">
                        <?php 
                        $newpj=$db->prepare('SELECT *FROM tbl_projects WHERE prjsts=12');      
                        $newpj->execute();    
                        echo $newpj->rowCount();         
                        ?>                        
                        <small class="m-0 l-h-n">Ongoing Project(s)</small>
                    </h3>
                </div>

                <i class="fa fa-circle-o-notch position-absolute pos-right pos-bottom opacity-15 mb-n1 mr-n1" style="font-size:6rem"></i>
            </div>        
        </a>   
    </div>

    <div class="col-lg-3 col-md-3 col-sm-3">        
        <a href="<?php echo web_root;?>/res/gate?b=cpteproj">
            <div class="p-3 bg-primary-500 rounded overflow-hidden position-relative text-white mb-g">
                <div class="">
                    <h3 class="display-4 d-block l-h-n m-0 fw-500">
                        <?php 
                        $newpj=$db->prepare('SELECT *FROM tbl_projects WHERE prjsts=10');      
                        $newpj->execute();    
                        echo $newpj->rowCount();         
                        ?>                        
                        <small class="m-0 l-h-n">Completed Project(s)</small>
                    </h3>
                </div>

                <i class="fa fa-check-circle position-absolute pos-right pos-bottom opacity-15 mb-n1 mr-n1" style="font-size:6rem"></i>
            </div>        
        </a>   
    </div>

</div>


<div class="card">
        <div class="panel-container show">
            <div class="panel-content">         
            
                <div class="tab-content p-3">
                <br>
                    <table id="dt-basic-example" class="table table-bordered table-striped w-100" style="font-size: 11px;">
                        <thead class="header">
                            <tr>
                                <th></th>
                                <th style="font-weight: bold;">TRACKING CODE</th>
                                <th style="font-weight: bold;">DOCUMENT ORGINATOR</th>
                                <th style="font-weight: bold;">SUBJECT MATTER</th>
                                <th style="font-weight: bold;">TYPE</th>
                                <th style="font-weight: bold;">TASK NOTE</th>
                                <th style="font-weight: bold;">REQUEST DATE</th>
                                <th style="font-weight: bold;width: 30%;">OFFICE</th>

                            </tr>
                        </thead>

                        <tbody id="rests">
                            <?php 
                                $rn=0;
                                ####### FETCH ######                                
                                $stmtReq = $db->prepare('SELECT DISTINCT(regst_id) AS regid, track_id, ct_names, sub_matt, reqtype_name,
                                requestDate,tsknotes FROM tbl_info_register i
                                INNER JOIN tbl_con_infos cn ON cn.reg_info_id=i.regst_id 
                                INNER JOIN tbl_clients c ON c.ct_id=i.clnt_id 
                                INNER JOIN tbl_reqs_type r ON r.reqtype_id=i.reqtype
                                WHERE con_doctype=3 ORDER BY regst_id DESC');

                                $stmtReq->execute();
                                while($ffReq = $stmtReq->fetch()):
                                $regid = $ffReq['regid'];
                                $rn++;

                                ####### Check Receiver #####
                                $recvr=$db->prepare('SELECT *FROM tbl_role r
                                INNER JOIN tbl_con_infos c ON c.dRcv=r.role_id WHERE reg_info_id="'.$regid.'"');
                                $recvr->execute();
                                $gtnum=$recvr->rowCount();                        
                            ?>
                            <tr>
                                <td><?php echo $rn;?></td>
                                <td><?php echo $ffReq['track_id'];?></td>
                                <td>
                                    <?php echo $ffReq['ct_names'];?>
                                    <br>
                                    <?php include 'recdoc.php';?>
                                </td>
                                <td><?php echo $ffReq['sub_matt'];?></td>            
                                <td><?php echo "REQUEST FOR ".$ffReq['reqtype_name'];?></td>                                  
                                
                                <td><p><?php echo $ffReq['tsknotes'];?></p></td>
                                <td><?php echo date('d/m/Y',strtotime($ffReq['requestDate']));?></td>
                            <td>
                            <ul id="js-emails" class="notification notification-layout-2">   
                            <?php 
                                while($getRcvr=$recvr->fetch()){
                                $rcvName=$getRcvr['role_name'];
                                if($getRcvr['receivTrm']!=NULL){
                                    $receivTrm=date('d/m/Y',strtotime($getRcvr['receivTrm']));
                                }else{
                                    $receivTrm="---";
                                }
                                $infosts=$getRcvr['info_sts'];
                                $stsQue = $db->prepare('SELECT *FROM tbl_status WHERE status_id="'.$infosts.'"');
                                $stsQue->execute();
                                $getSts=$stsQue->fetch();

                                if($infosts == 2){
                                    $icon='<i class="fa fa-exclamation-circle" aria-hidden="true"></i>';
                                    $btn='btn-warning';
                                }elseif($infosts == 9){
                                    $icon='<i class="fa fa-check" aria-hidden="true"></i>';
                                    $btn='btn-success';
                                }else{
                                    $icon='<i class="fa fa-folder-open" aria-hidden="true"></i>';
                                    $btn='btn-default';
                                }

                                ?>
                                <li class="b-tr" style="list-style-position:inside;border: 1px solid black;padding: 10px;">
                                    <a href="javascript:void(0)" title="starred" class="d-flex align-items-center py-1 ml-2 mt-4 mt-lg-0
                                    ml-lg-0 mr-lg-4 fs-lg color-primary-500 order-3 order-lg-2">
                                    <?php echo $rcvName;?>
                                    </a>
                                        
                                    <div class="d-flex flex-row flex-wrap flex-1 align-items-stretch align-self-stretch order-2 order-lg-3">
                                        <div class="row w-100">
                                            <a href="javascript:void(0)" class="name d-flex width-sm align-items-center pt-1 pb-0 py-lg-1 col-12 col-lg-auto">
                                            <i>Assigned date:</i> <?php echo date('d/m/Y',strtotime($getRcvr['conTrm']));?>
                                            </a>
                                            <a href="javascript:void(0)" class="name d-flex align-items-center pt-0 pb-1 py-lg-1 flex-1 col-12 col-lg-auto">
                                            <i>Received date:</i> <?php echo $receivTrm;?>
                                            </a>
                                        </div>
                                    </div>

                                    <div class="fs-sm text-muted ml-auto hide-on-hover-parent order-4 position-on-mobile-absolute
                                        pos-top pos-right mt-2 mr-3 mr-sm-4 mt-lg-0 mr-lg-0">
                                        <label class="btn <?php echo $btn;?> btn-xs" style="font-weight: bold;"><?php echo  $icon." ".$getSts['status_name'];?></label>
                                    </div>
                                </li>
                                <br>

                                <?php }?>
                                </ul>
                            </td>

                            </tr>
                            
                        <?php 
                            // endwhile;
                        endwhile;
                        ?>
                        </tbody>                           
                    </table>
              
                </div>
        </div>
    </div>
</div>


