Server IP : 162.214.80.37 / Your IP : 216.73.216.68 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/Quickex/builty/vendor/ |
[ 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"> <div class="col-12 col-sm-12"> <div class="row mb-4"> <div class="col-12 col-md-12"> <div class="card redial-border-light redial-shadow mb-4"> <div class="card-body"> <h6 class="header-title pl-3 redial-relative">Data Table</h6> <?php // Fetch employees from the employees table $employees_query = "SELECT id, femp_name, lemp_name FROM employees"; $employees_result = mysqli_query($conn, $employees_query); $employees = []; while ($emp = mysqli_fetch_assoc($employees_result)) { $employees[] = $emp; } ?> <table id="example" class="table table-bordered" cellspacing="0" width="100%"> <thead> <tr> <th>#</th> <th>Gr No.</th> <th>Invoice File</th> <th>Pdf File</th> <th>Action</th> </tr> </thead> <tbody> <?php $se = $_SESSION["id"]; // Get logged-in user ID $query = "SELECT * FROM builties WHERE assign_emp_id = '$se'"; // Fetch only assigned records $query_run = mysqli_query($conn, $query); if (mysqli_num_rows($query_run) > 0) { $index = 1; foreach ($query_run as $row) { // Define invoice and image file paths $invoice_file = "invoices/invoice_" . $row['id'] . ".pdf"; $invoice_exists = file_exists($invoice_file); // Check if invoice exists $image_file = "buimg/" . $row['verify_image']; $image_exists = !empty($row['verify_image']) && file_exists($image_file); // Check if image exists ?> <tr> <td><?php echo $index++; ?></td> <td><?php echo $row['grno']; ?></td> <!-- Invoice Link --> <td> <?php if (!$image_exists && $invoice_exists) { ?> <a href="<?php echo $invoice_file; ?>" class="btn btn-primary" target="_blank">View Invoice</a> <?php } else { ?> <span class="text-danger">Not Available</span> <?php } ?> </td> <!-- PDF Link --> <td> <?php if (!$image_exists) { ?> <a href="generate_pdf.php?id=<?php echo $row['id']; ?>" class="btn btn-primary"> PDF </a> <?php } else { ?> <span class="text-danger">Not Available</span> <?php } ?> </td> <!-- Actions --> <td> <form action="upload_image.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="builty_id" value="<?php echo $row['id']; ?>"> <input type="file" name="verify_image" required> <button type="submit" name="upload" class="btn btn-primary">Submit</button> </form> <?php if ($image_exists) { ?> <br> <a href="<?php echo $image_file; ?>" target="_blank"> <img src="<?php echo $image_file; ?>" width="50" height="50" alt="Uploaded Image"> </a> <?php } ?> </td> </tr> <?php } } else { echo "<tr><td colspan='5' class='text-center'>No assigned builties found.</td></tr>"; } ?> </tbody> </table> <!-- <table id="example" class="table table-bordered" cellspacing="0" width="100%"> <thead> <tr> <th>#</th> <th>Gr No.</th> <th>Action</th> <th>Destination</th> <th>Origin Phone</th> <th>origin e-way Bill</th> </tr> </thead> <tbody> <?php $se = $_SESSION["id"]; $query = "SELECT * FROM builties WHERE emp_id = '$se'"; $query_run =mysqli_query($conn, $query); if(mysqli_num_rows($query_run) > 0){ foreach($query_run as $row){ ?> <tr> <td><?php echo $row['id']; ?></td> <td><?php echo $row['grno']; ?></td> <td> <div class='btn-group mb-2'> <a href="generate_pdf.php?id=<?php echo $row['id']; ?>" class="btn btn-primary"><i class='fa fa-file'></i></a> <a href="update-builty.php?id=<?php echo $row['id']; ?>" class="btn btn-success"><i class='fa fa-pencil'></i></a> <form action="add_builty.php" method="post"> <input type="hidden" name="delete_id" value="<?php echo $row['id']; ?>"> <button type="submit" name="delete_builty" class="btn btn-danger"><i class='fa fa-trash'></i></button> </div> </form> <div class='btn-group mb-2'> <a href="javascript:void(0);" class="btn btn-warning" onclick="confirmInvoice('<?php echo $row['id']; ?>')"> Invoice </a> </div> </td> <td><?php echo $row['destination']; ?></td> <td><?php echo $row['origin_phone']; ?></td> <td><?php echo $row['origin_eway']; ?></td> </tr> <?php }} ?> </tbody> </table> --> </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--> <!-- jQuery Script to Handle Employee Assignment --> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> $(document).ready(function() { $(".assign-employee-dropdown").change(function() { var builtyId = $(this).data("id"); var assignedEmpId = $(this).val(); console.log("Builty ID:", builtyId, "Assigned Employee ID:", assignedEmpId); // Debugging $.ajax({ url: "assign_builty.php", type: "POST", data: { builty_id: builtyId, assign_emp_id: assignedEmpId }, success: function(response) { console.log("Server Response:", response); // Debugging if (response.trim() === "Success") { alert("Builty assigned successfully!"); } else { alert("Error: " + response); } }, error: function(xhr, status, error) { console.error("AJAX Error:", status, error); alert("AJAX request failed. Check console for details."); } }); }); }); </script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> $(document).ready(function() { $(".status-dropdown").change(function() { var newStatus = $(this).val(); var recordId = $(this).data("id"); $.ajax({ url: "update_status.php", type: "POST", data: { id: recordId, status: newStatus }, success: function(response) { alert(response); } }); }); }); </script> <script> function confirmInvoice(id) { if (confirm("Are you sure you want to create an Invoice?")) { window.location.href = "invoice.php?id=" + id; } } </script> <!-- jQuery --> <script src="dist/js/plugins.min.js"></script> <script src="dist/js/common.js"></script> </body> </html>