<?php 
$pID=$_REQUEST['pID'];

#### COMPLETE A PROJECT ####

if(isset($_POST['projcpte_id'])){
    try{
        $projcpte_id=$_REQUEST['projcpte_id'];
        $cptetrm = date('Y-m-d H:i:s');
        $sql = $db->query("UPDATE `tbl_projects` SET prjsts=10,cptetrm='$cptetrm' WHERE `projid` = '$projcpte_id'");
       
    }catch(PDOException $e){
        echo $e->getMessage();
    }

    echo'<script type="text/javascript">
    jQuery(function validation(){
    swal("Successfully", "Data saved! Go to dashboard to view completed project", "success", {
    button: "Continue",
    });
    });
    </script>';

    echo'<meta http-equiv="refresh"'.'content="2;URL=gate?b=home">'; 
}
?>

<div class="card mb-g border shadow-0">
    <div class="card-header bg-white p-0 header">
        <div class="p-3 d-flex flex-row">
            <div class="d-block ml-2">
                <span class="h6 font-weight-bold text-uppercase d-block m-0">
                    <?php echo $title;?> | <?php echo $_REQUEST['pName'];?>
                </span>

                <div class="d-flex mr-4">
                    <li class="position-absolute pos-top pos-right d-none d-sm-block"  style="padding: 10px;">
                     <a href="gate?b=ongoingp" class="flex-shrink-0 ml-auto" style="font-weight: bold;">Go back <i class="fa fa-mail-reply ml-2"></i> </a>
                    </li>
                </div>

                <div class="clearfix"></div>  
            </div>
        </div>
    </div>

    <div class="card-body">
     <br>

     <ul class="nav nav-pills" role="tablist">
        <li class="nav-item"><a class="nav-link active" data-toggle="pill" href="#wp"><i class="fa fa-cogs mr-1"></i> Set Work Progress</a></li>       
    
        <li class="nav-item"><a class="nav-link" data-toggle="pill" href="#matreq"><i class="fa fa-wrench mr-1"></i> Material Request</a></li>
     
        <li class="nav-item"><a class="nav-link" data-toggle="pill" href="#copteproj" onclick="loadcptemodal();"><i class="fa fa-thumbs-up mr-1"></i> Complete a Project</a></li>
     
    </ul>
    <div class="tab-content py-3">
        <div class="tab-pane fade show active" id="wp" role="tabpanel">
            <?php
                include 'wps.php';
            ?>           
        </div>
   
        <div class="tab-pane fade" id="matreq" role="tabpanel">
            <?php 
                //include 'wps.php';
            ?>
        </div>

        <div class="tab-pane fade" id="copteproj" role="tabpanel">
            <?php 
                include 'cpteProj.php';
            ?>
        </div>
        

    </div>    

    </div>
</div>