<?php include('include/auth.php');?>
<!doctype html>
<html class="fixed dark">
<?php 
	$pagerole="user";
	 $fid=$_GET['id'];

	include('include/head.php');
$sql2 = $db2->query("SELECT * FROM tasks WHERE tasks.task_id='$fid' ") or die(mysql_error());
$row3 = mysqli_fetch_array( $sql2 );
$fromuser=$row3['task_from'];
					$sqlu2 = $db->query("SELECT * FROM users WHERE users.id='$fromuser' ") or die(mysql_error());
					$rowu2 = mysqli_fetch_array( $sqlu2 );
					$sst2=date("d/m/y", strtotime($row3['task_start_date']));
					$eet2=date("d/m/y", strtotime($row3['task_end_date']));
                    $startdatetime=$sst2." @ ".$row3['task_start_time'];
                    $enddatetime=$eet2." @ ".$row3['task_end_time'];
                    if($row3['task_status']==0){$status="in Progress";$colorst="orange";}
                    elseif($row3['task_status']==1){$status="Completed";$colorst="green";}
		?>

<body>
    <style>
        .colorstatus{color:<?php echo $colorst;?>;}
        </style>

    <section class="body">

        <!-- start: header -->
        <header class="header">
            <div class="logo-container">
                <a href="index.php" class="logo">
                    <img src="img/logo-light.png" width="75" height="35" alt="Web Voyage" />
                </a>
                <div class="d-md-none toggle-sidebar-left" data-toggle-class="sidebar-left-opened" data-target="html"
                    data-fire-event="sidebar-left-opened">
                    <i class="fas fa-bars" aria-label="Toggle sidebar"></i>
                </div>
            </div>

            <!-- start: search & user box -->
            <div class="header-right">
                <?php include('include/search.php');?>


                <span class="separator"></span>
                <?php include('include/notifications.php');?>


                <span class="separator"></span>
                <?php include('include/userbox.php');?>

            </div>
            <!-- end: search & user box -->
        </header>
        <!-- end: header -->

        <div class="inner-wrapper">
            <!-- start: sidebar -->
            <?php include('include/nav.php');?>
            <!-- end: sidebar -->

            <section role="main" class="content-body">
                <header class="page-header">
                    <h2>View Task </h2>

                    <div class="right-wrapper text-right">
                        <ol class="breadcrumbs">
                            <li>
                                <a href="index.php">
                                    <i class="fas fa-home"></i>
                                </a>
                            </li>
                            <li><span>WV Admin</span></li>
                            <li><span>View Task</span></li>
                        </ol>

                        <a class="sidebar-right-toggle" data-open="sidebar-right"><i
                                class="fas fa-chevron-left"></i></a>
                    </div>
                </header>

                               <!-- start: page -->
                               <div class="mailbox-email-header mb-3">
									<h3 class="mailbox-email-subject m-0 font-weight-light">
                                    Task: <?php echo $row3['task_name'];?>
									</h3>
							
									<p class="mt-2 mb-0 text-5">From <?php echo $rowu2['username'];?> to <?php echo htmlspecialchars($_SESSION["username"]); ?>, Starting on: <?php echo $startdatetime." Until: ".$enddatetime;?></p>
								</div>
                                <div class="mailbox-email-container">
									<div class="mailbox-email-screen pt-4">
										<div class="card mb-3">
											<div class="card-header">
											<div class="card-actions">
                                            <h2 class="card-title">Status: <span class="colorstatus"><?php echo $status;?></span></h2>
													
												</div>
                                            <h2 class="card-title">Task: <?php echo $row3['task_name'];?> --Details</h2>
											</div>
											<div class="card-body" style="color:#fff;">
                                            <?php echo $row3['task_details'];?>
											</div>
											<div class="card-footer">
												<p class="m-0"><small>Assigned on:<?php echo date('d/m/Y H:i', $row3['task_ts']);?></small></p>
                                               <?php if($row3['task_status']==1){?>
                                                <p class="m-0"><small>Completed on: <?php echo date('d/m/Y H:i', $row3['task_completed']);?></small></p>
                                                <?php }?>
											</div>
										</div>
							
										
							
										
									</div>
							<br>
                                    <hr>
                                  
							<br>
                <form class="order-details action-buttons-fixed" action="actions/taskstatus.php?id=<?php echo $fid;?>"
                    method="post" name="form1">

                    <div class="row">
                        <div class="col-xl-12 mb-3 ">
                            <div class="card card ">
                                <div class="card-header">
                                    <h2 class="card-title">Actions: <?php echo $row3['task_title'];?></h2>
                                </div>
                                <div class="card-body">


                                  
                                    <div class="form-row">
                                        <div class="form-group col-xl-6 mb-3">
                                        <label>Status</label>
                                 <select data-plugin-selectTwo class="form-control populate" name=task_status
                                 <?php if($row3['task_status']==1) { echo "selected";} ?> >
                            <option
                                value="" disabled selected
                               >
                                Select Status</option>
                            
                            <option value="1"<?php if($row3['task_status']==1) { echo "selected";} ?>>
                                Completed</option>
                                <option value="0"<?php if($row3['task_status']==0) { echo "selected";} ?>>
                                In Progress</option>

                        </select>
                                        </div>
                                        <div class="form-group col-xl-6 mb-3" style="border-top:none;padding-top:0rem;">
                                        <label>Show in List View</label>
                                 <select data-plugin-selectTwo class="form-control populate" name=task_seen
                            >
                            <option
                                value="" disabled selected
                               >
                                Select</option>
                            
                            <option value="1"<?php if($row3['task_seen']==1) { echo "selected";} ?>>
                                Show</option>
                                <option value="0"<?php if($row3['task_seen']==0) { echo "selected";} ?>>
                                Hide</option>

                        </select>
                                        </div>
                                    </div>



                                   
                                </div>
                            </div>

                        </div>
                     
               
                    </div>
                    <input type="hidden" name="fid" value="<?php echo $fid;?>">
                    <div class="row action-buttons">

                        <div class="col-12 col-md-auto">
                            <button type="submit"
                                class="submit-button btn btn-primary btn-px-4 py-3 d-flex align-items-center font-weight-semibold line-height-1"
                                data-loading-text="Loading...">
                                <i class="bx bx-save text-4 mr-2"></i> Save
                            </button>
                        </div>
<?php if($userid==$row3['task_from']){?>
    <div class="col-12 col-md-auto ">
                            <a href="taskedit.php?id=<?php echo $row3["task_id"];?>"
                                class="cancel-button btn btn-success btn-px-4 py-3 d-flex align-items-center font-weight-semibold line-height-1">Edit Task</a>
                        </div>
<?php }?>
                        <div class="col-12 col-md-auto px-md-0 mt-3 mt-md-0">
                            <a href="fleet.php"
                                class="cancel-button btn btn-light btn-px-4 py-3 d-flex align-items-center font-weight-semibold line-height-1">Return</a>
                        </div>

                    </div>

                </form>
                <!-- end: page -->
            </section>
        </div>

        <?php include('include/aside.php');?>

    </section>


    <!-- Vendor -->
    <script src="vendor/jquery/jquery.js"></script>
    <script src="vendor/jquery-browser-mobile/jquery.browser.mobile.js"></script>
    <script src="vendor/popper/umd/popper.min.js"></script>
    <script src="vendor/bootstrap/js/bootstrap.js"></script>
    <script src="vendor/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
    <script src="vendor/common/common.js"></script>
    <script src="vendor/nanoscroller/nanoscroller.js"></script>
    <script src="vendor/magnific-popup/jquery.magnific-popup.js"></script>
    <script src="vendor/jquery-placeholder/jquery.placeholder.js"></script>

    <!-- Specific Page Vendor -->
    <script src="vendor/select2/js/select2.js"></script>
    <script src="vendor/pnotify/pnotify.custom.js"></script>

    <!--(remove-empty-lines-end)-->

    <!-- Theme Base, Components and Settings -->
    <script src="js/theme.js"></script>

    <!-- Theme Custom -->
    <script src="js/custom.js"></script>

    <!-- Theme Initialization Files -->
    <script src="js/theme.init.js"></script>

    <!-- Examples -->
    <script src="js/examples/examples.header.menu.js"></script>
    <script src="js/examples/examples.ecommerce.orders.detail.js"></script>


</body>

</html>
<?php include('include/footer.php');?>