kohjhjhصثقصثقصثقgdfgdg
Ele57885fddfgdfgfghgقفغفغفقhfg555434536
/
home
/
u542670534
/
domains
/
inddigprintx1.com
/
public_html
/
Upload FileeE
HOME
<!DOCTYPE html> <html lang="en"> <!-- Mirrored from workload-node.scriptlelo.com/node/demo/index by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 03 May 2025 11:10:00 GMT --> <!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack --> <head> <?php include("top.php"); ?> </head> <body> <?php session_start(); if (!isset($_SESSION['user_id'])) { header("Location: login.php"); exit; } ?> <?php include("popup.php"); ?> <!--**** Preloader start *******--> <div id="preloader"> <div class="lds-ripple"> <div></div> <div></div> </div> </div> <!--***** Preloader end *******--> <div id="main-wrapper"> <!--**** Nav header start *******--> <div class="nav-header"> <a href="index.php"><img style=" margin-top: 10px; width: 221px;" src="images/logo-full.png" alt=""></a> <div class="nav-control"> <div class="hamburger"> <span class="line"></span><span class="line"></span><span class="line"></span> </div> </div> </div> <!--**** Nav header end ********--> <!--******* Chat box start ********--> <!--****** Chat box End **********--> <!--******** Header start **********--> <div class="header border-bottom"> <div class="header-content"> <nav class="navbar navbar-expand"> <div class="collapse navbar-collapse justify-content-between"> <div class="header-left"> <div class="dashboard_bar"> Dashboard </div> </div> <ul class="navbar-nav header-right"> <li class="nav-item d-flex align-items-center"> <div class="input-group search-area"> <input type="text" class="form-control" placeholder="Search here..."> <span class="input-group-text"> <a href="javascript:void(0)"> <i class="flaticon-381-search-2"></i> </a> </span> </div> </li> <li class="nav-item dropdown header-profile"> <a class="nav-link" href="javascript:void(0);" role="button" data-bs-toggle="dropdown"> <img src="images/userlogo.png" width="20" alt="" /> <div class="header-info ms-3"> <span class="fs-18 font-w500 mb-2"> <?php echo isset($_SESSION['username']) ? htmlspecialchars($_SESSION['username']) : 'Guest'; ?> </span> <small class="fs-12 font-w400"> <?php echo isset($_SESSION['email']) ? htmlspecialchars($_SESSION['email']) : 'No email'; ?> </small> </div> </a> <div class="dropdown-menu dropdown-menu-end"> <a href="#" class="dropdown-item ai-icon"> <svg id="icon-user1" xmlns="http://www.w3.org/2000/svg" class="text-primary" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path> <circle cx="12" cy="7" r="4"></circle> </svg> <span class="ms-2">Profile </span> </a> <a href="logout.php" class="dropdown-item ai-icon"> <svg id="icon-logout" xmlns="http://www.w3.org/2000/svg" class="text-danger" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path> <polyline points="16 17 21 12 16 7"></polyline> <line x1="21" y1="12" x2="9" y2="12"></line> </svg> <span class="ms-2">Logout </span> </a> </div> </li> </ul> </div> </nav> </div> </div> <!--******* Header end *************--> <!--******* Sidebar start **********--> <div class="dlabnav"> <div class="dlabnav-scroll"> <ul class="metismenu" id="menu"> <li> <a class=" " href="dashboard.php" aria-expanded="false"> <i class="fas fa-home"></i> <span class="nav-text">Dashboard</span> </a> <ul aria-expanded="false"> <!-- <li> <a href="index.html">Dashboard Light</a> </li> </ul> --> </li> </ul> </div> </div> <!--******** Sidebar end ***********--> <!-- Container starts--> <div class="content-body"> <!-- row --> <div class="container-fluid"> <div class="row"> <div class="col-xl-6"> <div class="row"> <div class="col-xl-12"> <div class="row"> <?php if (isset($_SESSION['role']) && $_SESSION['role'] === 'client'): ?> <?php include('db.php'); $user_id = $_SESSION['user_id'] ?? null; $role = $_SESSION['role'] ?? ''; $total_uploaded = 0; if ($role === 'client' && $user_id) { $sql = "SELECT COUNT(*) as total FROM card_image WHERE client_id = '$user_id' AND display = 0"; $res = mysqli_query($conn, $sql); if ($res && $row = mysqli_fetch_assoc($res)) { $total_uploaded = $row['total']; } $sql2 = "SELECT COUNT(*) as total2 FROM business_details WHERE client_id = '$user_id' AND display = 0"; $res2 = mysqli_query($conn, $sql2); if ($res2 && $row2 = mysqli_fetch_assoc($res2)) { $total_uploaded2 = $row2['total2']; } $sql3 = "SELECT 'card_image' AS source, price AS total_price, revenue AS total_revenue FROM card_image WHERE client_id = $user_id AND display = 0 UNION ALL SELECT 'business_details' AS source, price AS total_price, revenue AS total_revenue FROM business_details WHERE client_id = $user_id AND display = 0 "; $res3 = mysqli_query($conn, $sql3); $total_price = 0; $price_per_revenue = 0; $total_revenue = 0; if ($res3) { while ($row3 = mysqli_fetch_assoc($res3)) { if ($row3['total_revenue'] != 0) { $price_per_revenue += ($row3['total_price'] * $row3['total_revenue'])/100 ; } $total_price += $row3['total_price']; $total_revenue += $row3['total_revenue']; } } // $total_price and $total_revenue now contain the grand totals from both tables } ?> <div class="col-xl-6 col-sm-6"> <div class="card shadow-sm"> <div class="card-body d-flex justify-content-between align-items-center px-4 py-3"> <div> <h4 class="fs-18 font-weight-semibold mb-4 text-nowrap">Uploaded Cards</h4> <div class="d-flex align-items-center"> <h2 class="fs-32 font-weight-bold mb-0"><?= $total_uploaded; ?></h2> <span class="ms-4 d-block"> <svg width="21" height="11" viewBox="0 0 21 11" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M1.49217 11C0.590508 11 0.149368 9.9006 0.800944 9.27736L9.80878 0.66117C10.1954 0.29136 10.8046 0.291359 11.1912 0.661169L20.1991 9.27736C20.8506 9.9006 20.4095 11 19.5078 11H1.49217Z" fill="#09BD3C"></path> </svg> <!-- <small class="fs-16 font-weight-normal text-success">+0.5%</small> --> </span> </div> </div> <!-- <div class="bg-gradient rounded p-3 text-center"> <div class="position-relative donut-chart-sale mb-3"> <small class="text-primary">71%</small> </div> </div> --> </div> </div> </div> <div class="col-xl-6 col-sm-6"> <div class="card shadow-sm"> <div class="card-body d-flex justify-content-between align-items-center px-4 py-3"> <div> <h4 class="fs-18 font-weight-semibold mb-4 text-nowrap">Uploaded Details</h4> <div class="d-flex align-items-center"> <h2 class="fs-32 font-weight-bold mb-0"><?= $total_uploaded2; ?></h2> <span class="ms-4 d-block"> <svg width="21" height="11" viewBox="0 0 21 11" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M1.49217 11C0.590508 11 0.149368 9.9006 0.800944 9.27736L9.80878 0.66117C10.1954 0.29136 10.8046 0.291359 11.1912 0.661169L20.1991 9.27736C20.8506 9.9006 20.4095 11 19.5078 11H1.49217Z" fill="#09BD3C"></path> </svg> </span> </div> </div> </div> </div> </div> <div class="col-xl-6 col-sm-6"> <div class="card shadow-sm"> <div class="card-body d-flex justify-content-between align-items-center px-4 py-3"> <div> <h4 class="fs-18 font-weight-semibold mb-4 text-nowrap">Total Revenue Amount</h4> <div class="d-flex align-items-center"> <h2 class="fs-32 font-weight-bold mb-0"><?= $price_per_revenue; ?></h2> <span class="ms-4 d-block"> <svg width="21" height="11" viewBox="0 0 21 11" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M1.49217 11C0.590508 11 0.149368 9.9006 0.800944 9.27736L9.80878 0.66117C10.1954 0.29136 10.8046 0.291359 11.1912 0.661169L20.1991 9.27736C20.8506 9.9006 20.4095 11 19.5078 11H1.49217Z" fill="#09BD3C"></path> </svg> </span> </div> </div> </div> </div> </div> <div class="col-xl-6 col-sm-6 col-xxl-12"> <div class="card shadow-lg border-0" id="user-activity"> <div class="card-header border-0 pb-0 flex-wrap bg-primary text-white"> <h5 class="card-title">Business Card Upload</h5> </div> <div class="card-body p-4"> <form id="uploadForm" action="upload.php" method="POST" enctype="multipart/form-data"> <!-- Hidden client_id from the session --> <input type="hidden" name="client_id" value="<?php echo $_SESSION['user_id']; ?>"> <!-- File Upload Section --> <div class="mb-3"> <label for="fileUpload" class="form-label font-weight-bold">Choose file</label> <input type="file" class="form-control-file" id="fileUpload" name="fileUpload" required accept=".jpg,.jpeg,.png,.pdf"> <small class="form-text text-muted">Only JPG, PNG, and PDF files are allowed.</small> </div> <!-- File Upload Preview --> <div id="filePreview" class="mt-3" style="display: none;"> <p><strong>Selected file:</strong> <span id="fileName"></span></p> <div id="previewContent" class="mt-2"></div> </div> <!-- Submit Button --> <button type="submit" class="btn btn-success btn-block mt-4">Upload</button> </form> </div> </div> </div> <?php endif; ?> <!-- JavaScript to Preview File --> <script> document.getElementById("fileUpload").addEventListener("change", function () { var fileName = this.files[0].name; document.getElementById("fileName").textContent = fileName; document.getElementById("filePreview").style.display = "block"; }); document.addEventListener('DOMContentLoaded', function() { const fileInput = document.getElementById('fileUpload'); const previewPanel = document.getElementById('filePreview'); const fileNameSpan = document.getElementById('fileName'); const previewContent= document.getElementById('previewContent'); fileInput.addEventListener('change', function() { const file = this.files[0]; if (!file) { previewPanel.style.display = 'none'; return; } // Show panel previewPanel.style.display = 'block'; fileNameSpan.textContent = file.name; // Clear any old preview previewContent.innerHTML = ''; const ext = file.name.split('.').pop().toLowerCase(); if (['jpg','jpeg','png','gif','webp'].includes(ext)) { // Image preview const img = document.createElement('img'); img.classList.add('img-fluid','rounded'); img.style.maxHeight = '150px'; img.src = URL.createObjectURL(file); img.onload = () => URL.revokeObjectURL(img.src); previewContent.appendChild(img); } else if (ext === 'pdf') { // PDF icon const icon = document.createElement('i'); icon.classList.add('fas','fa-file-pdf','fa-3x','text-danger'); previewContent.appendChild(icon); } else { previewContent.textContent = 'No preview available'; } }); }); </script> </div> </div> </div> </div> <?php if (isset($_SESSION['role']) && $_SESSION['role'] === 'client'): ?> <div class="col-xl-6"> <div class="row"> <div class="col-xl-12"> <div class="card"> <div class="card-body" style="position: relative;"> <div class="mt-4 text-center"> <h4 class="fs-20 font-w700">Submit Your Business Details</h4> <p class="mb-0">If you don’t have a business card, please fill out this form with your business name, mobile number, and address so we can process your details accurately.</p> </div> <!-- New Business Info Form --> <form class="mt-4" style="max-width: 400px; margin: 0 auto;" method="POST" action="submit_business.php" novalidate> <!-- Business Name Field --> <div class="mb-3"> <label for="businessName" class="form-label fw-bold">Business Name</label> <input type="text" class="form-control" id="businessName" name="businessName" placeholder="Enter your business name" required> <div class="invalid-feedback">Please provide your business name.</div> </div> <!-- Mobile Number Field --> <div class="mb-3"> <label for="mobileNumber" class="form-label fw-bold">Mobile Number</label> <input type="tel" class="form-control" id="mobileNumber" name="mobileNumber" placeholder="Enter mobile number" maxlength="10" pattern="\d{10}" required> <div class="invalid-feedback">Please enter a valid 10-digit mobile number.</div> </div> <!-- Address Field --> <div class="mb-3"> <label for="address" class="form-label fw-bold">Address</label> <textarea class="form-control" id="address" name="address" rows="3" placeholder="Enter address" required></textarea> <div class="invalid-feedback">Please provide your business address.</div> </div> <!-- Submit Button --> <div class="text-center"> <button type="submit" class="btn btn-primary px-4">Submit</button> </div> </form> </div> </div> </div> </div> </div> <?php endif; ?> <div class="col-lg-12"> <div class="card"> <div class="card-header"> <h4 class="card-title">Business Details</h4> </div> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered table-striped verticle-middle table-responsive-sm"> <thead class="thead-light"> <tr> <th>#</th> <th>Business Name</th> <th>Mobile Number</th> <th>Address</th> <th>Amount (Price)</th> <th>Revenue (%)</th> <th>Revenue </th> <th>Status</th> <th>Created At</th> <th>Action</th> </tr> </thead> <tbody> <?php include('db.php'); $user_id = $_SESSION['user_id']; $role = $_SESSION['role'] ?? ''; if ($role === 'client') { $sql = "SELECT * FROM `business_details` WHERE client_id = '$user_id' AND display = 0 ORDER BY id DESC"; } elseif ($role === 'sales') { $sql = "SELECT * FROM `business_details` WHERE client_id IN (SELECT `id` FROM `users` WHERE `reference_id` = $user_id)AND `display` = 0 ORDER BY `id` DESC"; } else { echo "<p class='text-danger'>Unauthorized access.</p>"; exit; } $res = mysqli_query($conn, $sql); $count = 1; while ($row = mysqli_fetch_array($res)) { $price = (float)$row['price']; $revenue = (float)$row['revenue']; $revenue_percentage = $revenue > 0 ? ($price * $revenue)/100 : 0; ?> <tr> <td><?= $count++; ?></td> <td><?= htmlspecialchars($row['business_name']); ?></td> <td><?= htmlspecialchars($row['mobile_number']); ?></td> <td><?= htmlspecialchars($row['address']); ?></td> <td>₹<?= number_format($price, 2); ?></td> <td><?= htmlspecialchars($row['revenue']); ?> %</td> <td>₹<?= number_format($revenue_percentage); ?> </td> <td> <span class="badge <?php switch ($row['status']) { case 'started': echo 'bg-primary'; break; case 'paused': echo 'bg-warning text-dark'; break; case 'on_going': echo 'bg-info'; break; case 'completed': echo 'bg-success'; break; case 'rejected': echo 'bg-danger'; break; default: echo 'bg-secondary'; } ?>"> <?= htmlspecialchars(ucwords(str_replace('_', ' ', $row['status']))); ?> </span> </td> <td><?= date('d-m-Y', strtotime($row['created_at'])); ?></td> <td> <span> <a href="javascript:void(0)" class="btn btn-xs btn-primary me-2 business-edit-btn" data-id="<?= $row['id']; ?>" data-name="<?= htmlspecialchars($row['business_name']); ?>" data-mobile="<?= htmlspecialchars($row['mobile_number']); ?>" data-address="<?= htmlspecialchars($row['address']); ?>" data-status="<?= htmlspecialchars($row['status']); ?>" data-price="<?= htmlspecialchars($row['price']); ?>" data-revenue="<?= htmlspecialchars($row['revenue']); ?>" title="Edit"> <i class="fas fa-pencil-alt"></i> </a> <a href="business.php?delete=<?= $row['id']; ?>" onclick="return confirm('Are you sure you want to delete this item?');" class="btn btn-xs btn-danger"> <i class="fas fa-trash color-danger"></i> </a> </span> </td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> <!-- Edit Business Modal --> <div class="modal fade" id="editBusinessModal" tabindex="-1" aria-labelledby="editBusinessLabel" aria-hidden="true"> <div class="modal-dialog"> <form method="POST" id="editBusinessForm"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">Edit Business</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <input type="hidden" name="edit_id" id="editId"> <?php if (isset($_SESSION['role'])): ?> <input type="hidden" name="user_role" value="<?= htmlspecialchars($_SESSION['role']) ?>"> <?php endif; ?> <div class="mb-3"> <label class="form-label">Business Name</label> <input type="text" class="form-control" name="edit_business_name" id="editBusinessName" required> </div> <div class="mb-3"> <label class="form-label">Mobile Number</label> <input type="tel" maxlength="10" class="form-control" name="edit_mobile_number" id="editMobileNumber" required> </div> <?php if (isset($_SESSION['role']) && $_SESSION['role'] === 'sales') : ?> <div class="mb-3"> <label class="form-label">Status</label> <select class="form-select" name="edit_status" id="editStatus" required> <option value="inactive">Inactive</option> <option value="started">Started</option> <option value="paused">Paused</option> <option value="on_going">On Going</option> <option value="completed">Completed</option> <option value="rejected">Rejected</option> </select> </div> <div class="mb-3"> <label class="form-label">Amount (Price)</label> <input type="number" class="form-control" id="baseAmount" name="price" placeholder="Enter amount" required> </div> <div class="mb-3"> <label class="form-label">Revenue Percentage</label> <select class="form-select" id="revenuePercentage" name="revenue" required> <option value="0">0%</option> <option value="10">10%</option> <option value="15">15%</option> <option value="20">20%</option> <option value="30">30%</option> </select> </div> <?php endif; ?> <div class="mb-3"> <label class="form-label">Address</label> <textarea class="form-control" name="edit_address" id="editAddress" required></textarea> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-primary">Save Changes</button> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button> </div> </div> </form> </div> </div> <script> document.querySelectorAll('.business-edit-btn').forEach(button => { button.addEventListener('click', function () { document.getElementById('editId').value = this.dataset.id; document.getElementById('editBusinessName').value = this.dataset.name; document.getElementById('editMobileNumber').value = this.dataset.mobile; document.getElementById('editAddress').value = this.dataset.address; if (document.getElementById('editStatus')) { document.getElementById('editStatus').value = this.dataset.status; document.getElementById('baseAmount').value = this.dataset.price; document.getElementById('revenuePercentage').value = this.dataset.revenue; } const modal = new bootstrap.Modal(document.getElementById('editBusinessModal')); modal.show(); }); }); document.getElementById('editBusinessForm').addEventListener('submit', function (e) { e.preventDefault(); const formData = new FormData(this); fetch('business.php', { method: 'POST', body: formData }) .then(response => response.text()) .then(result => { if (result.trim() === 'success') { Swal.fire({ title: 'Success!', text: 'Business information updated successfully.', icon: 'success', confirmButtonText: 'OK' }).then(() => window.location.reload()); } else { Swal.fire({ icon: 'error', title: 'Update Failed', text: result }); } }) .catch(error => { console.error('Error:', error); Swal.fire({ icon: 'error', title: 'Request Failed', text: 'Something went wrong!' }); }); }); </script> <?php include('db.php'); $user_id = $_SESSION['user_id']; $role = $_SESSION['role'] ?? ''; // Check if role is set // Build query based on role if ($role === 'client') { $sql = "SELECT * FROM card_image WHERE client_id = '$user_id' AND display = 0 ORDER BY id DESC"; } elseif ($role === 'sales') { $sql = "SELECT * FROM `card_image` WHERE client_id IN (SELECT `id` FROM `users` WHERE `reference_id` = $user_id)AND `display` = 0 ORDER BY `id` DESC"; } else { echo "<p class='text-danger'>Unauthorized access.</p>"; exit; } $res = mysqli_query($conn, $sql); $res = mysqli_query($conn, $sql); ?> <div class="col-lg-12"> <div class="card"> <div class="card-header"> <h4 class="card-title">Uploaded Files</h4> </div> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered table-striped align-middle"> <thead class="thead-dark"> <tr> <th style="width: 20%;">Images</th> <th style="width: 10%;">Price</th> <th style="width: 10%;">Revenue (%)</th> <th style="width: 10%;">Revenue </th> <th style="width: 20%;">Status</th> <th style="width: 20%;">Actions</th> </tr> </thead> <tbody> <?php while ($row = mysqli_fetch_assoc($res)) { $filePath = $row['image']; $fileName = basename($filePath); $fileExt = strtolower(pathinfo($filePath, PATHINFO_EXTENSION)); $price = (float)$row['price']; $revenue = (float)$row['revenue']; $revenue_percentage = $revenue > 0 ? ($price * $revenue)/100 : 0; ?> <tr> <td> <?php if (in_array($fileExt, ['jpg', 'jpeg', 'png', 'gif', 'webp'])) { ?> <img src="<?php echo $filePath; ?>" alt="" style="width:100px; border-radius:6px;"> <?php } elseif ($fileExt === 'pdf') { ?> <a href="<?php echo $filePath; ?>" target="_blank"> <i class="fas fa-file-pdf fa-3x text-danger"></i> </a> <?php } else { ?> <span>Unsupported</span> <?php } ?> </td> <td>₹<?= number_format($price); ?></td> <td><?= htmlspecialchars($row['revenue']); ?> %</td> <td>₹<?= number_format($revenue_percentage); ?> </td> <td> <span class="badge <?php switch ($row['status']) { case 'started': echo 'bg-primary'; break; case 'paused': echo 'bg-warning text-dark'; break; case 'on_going': echo 'bg-info'; break; case 'completed': echo 'bg-success'; break; case 'rejected': echo 'bg-danger'; break; default: echo 'bg-secondary'; } ?>"> <?php echo htmlspecialchars(ucwords(str_replace('_', ' ', $row['status']))); ?> </span> </td> <td> <!-- View Button --> <a href="#" class="btn btn-sm btn-success mb-1 view-btn" data-img="<?php echo $filePath; ?>" > <i class="fas fa-eye"></i> </a> <a href="#" class="btn btn-sm btn-primary mb-1 image-edit-btn" data-id="<?= htmlspecialchars($row['id']) ?>" data-image="<?= htmlspecialchars($row['image']) ?>" data-status="<?= htmlspecialchars($row['status']) ?>" data-price="<?= htmlspecialchars($row['price']) ?>" data-revenue="<?= htmlspecialchars($row['revenue']) ?>" title="Edit Image" data-bs-toggle="modal" data-bs-target="#imageEditNewModal"> <i class="fas fa-edit"></i> </a> <a href="image.php?delete=<?php echo $row['id']; ?>" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure you want to delete this file?');"> <i class="fas fa-trash"></i> </a> </td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> <div class="modal fade" id="imageModal" tabindex="-1" aria-labelledby="imageModalLabel" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered modal-lg"> <!-- Centered modal --> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">Image Preview</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <!-- Bootstrap 5 style close --> </div> <div class="modal-body d-flex justify-content-center"> <img src="" id="previewImage" class="img-fluid rounded shadow" alt="Preview Image" style="max-height: 80vh;"> </div> </div> </div> </div> </div> </div> </div> <!-- New Edit Modal --><div class="modal fade" id="imageEditNewModal" tabindex="-1" aria-labelledby="imageEditNewLabel" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered"> <div class="modal-content"> <form id="imageEditNewForm" class="needs-validation" novalidate method="POST" enctype="multipart/form-data"> <div class="modal-header"> <h5 class="modal-title" id="imageEditNewLabel">Edit Image Details</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body text-center"> <!-- Hidden Fields --> <input type="hidden" name="edit_image_id" id="editImageId"> <input type="hidden" name="edit_current_image" id="editCurrentImage"> <input type="hidden" name="edit_user_role" id="editUserRole" value="<?= htmlspecialchars($_SESSION['role'] ?? '') ?>"> <!-- Image Preview --> <img id="editImagePreview" src="" class="img-fluid rounded mb-3" style="max-height: 250px;" alt="Image Preview"> <!-- Image File Input --> <div class="mb-3 text-start"> <label for="editImageFile" class="form-label">Choose New Image (optional):</label> <input type="file" class="form-control" name="edit_new_image" id="editImageFile" accept="image/*"> <div class="invalid-feedback">Please choose a valid image file.</div> </div> <?php if (isset($_SESSION['role']) && $_SESSION['role'] === 'sales') : ?> <!-- Price & Revenue in One Row --> <div class="row mb-3 text-start"> <div class="col-md-6"> <label for="editPrice" class="form-label">Price (₹)</label> <input type="number" class="form-control" id="editPrice" name="edit_price" placeholder="Enter price" required> <div class="invalid-feedback">Please enter a valid price.</div> </div> <div class="col-md-6"> <label for="editRevenue" class="form-label">Revenue (%)</label> <select class="form-select" id="editRevenue" name="edit_revenue" required> <option value="" disabled selected>Select percentage</option> <option value="0">0%</option> <option value="10">10%</option> <option value="15">15%</option> <option value="20">20%</option> <option value="30">30%</option> </select> <div class="invalid-feedback">Please select a revenue percentage.</div> </div> </div> <!-- Status Dropdown --> <div class="mb-3 text-start"> <label for="editStatusNew" class="form-label">Status</label> <select class="form-select" name="edit_status_new" id="editStatusNew" required> <option value="" disabled selected>Select status</option> <option value="inactive">Inactive</option> <option value="started">Started</option> <option value="paused">Paused</option> <option value="on_going">On Going</option> <option value="completed">Completed</option> <option value="rejected">Rejected</option> </select> <div class="invalid-feedback">Please select a status.</div> </div> </div> <?php endif; ?> <div class="modal-footer"> <button type="submit" class="btn btn-primary">Save Changes</button> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button> </div> </form> </div> </div> </div> <!-- Container Ends--> <!-- Image Preview Modal --> <!-- Modal HTML --> <div class="modal fade" id="imageModal" tabindex="-1" aria-labelledby="imageModalLabel" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered modal-lg"> <!-- Centered modal --> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">Image Preview</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <!-- Bootstrap 5 style close --> </div> <div class="modal-body d-flex justify-content-center"> <img src="" id="previewImage" class="img-fluid rounded shadow" alt="Preview Image" style="max-height: 80vh;"> </div> </div> </div> </div> <!--****** Footer start *******--> <div class="footer"> <div class="copyright"> <p>Copyright © Designed & Developed by <a href="#" target="_blank">Inddig Media Pvt. Ltd.</a> <span class="current-year">2025</span></p> </div> </div> <!--***** Footer end ********--> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> document.querySelectorAll('.view-btn').forEach(function (btn) { btn.addEventListener('click', function (e) { e.preventDefault(); const imgSrc = this.getAttribute('data-img'); const previewImage = document.getElementById('previewImage'); previewImage.src = imgSrc; const imageModal = new bootstrap.Modal(document.getElementById('imageModal')); imageModal.show(); }); }); </script> <script> document.addEventListener('DOMContentLoaded', function () { const editButtons = document.querySelectorAll('.image-edit-btn'); const modal = new bootstrap.Modal(document.getElementById('imageEditNewModal')); const form = document.getElementById('imageEditNewForm'); editButtons.forEach(button => { button.addEventListener('click', function () { // Get data attributes from the clicked button const id = this.getAttribute('data-id'); const image = this.getAttribute('data-image'); const price = this.getAttribute('data-price'); const revenue = this.getAttribute('data-revenue'); const status = this.getAttribute('data-status'); // Set modal values based on the button's data attributes document.getElementById('editImageId').value = id; document.getElementById('editCurrentImage').value = image; document.getElementById('editImagePreview').src = image; document.getElementById('editPrice').value = price || ''; document.getElementById('editRevenue').value = revenue || ''; document.getElementById('editStatusNew').value = status || ''; // Set form action (optional, can be customized if needed) form.setAttribute('action', 'image.php'); // Make sure 'image.php' is the correct action URL // Show modal modal.show(); }); }); // Validate form submission form.addEventListener('submit', function (event) { event.preventDefault(); if (!form.checkValidity()) { event.stopPropagation(); } else { // Form is valid, proceed with submission form.submit(); } form.classList.add('was-validated'); // Bootstrap validation feedback }); }); </script> </div> <!--**** Scripts ***********--> <script src="vendor/global/global.min.js"></script> <script src="vendor/chart.js/Chart.bundle.min.js"></script> <script src="vendor/jquery-nice-select/js/jquery.nice-select.min.js"></script> <!-- Plugins JS start--> <!-- Apex Chart --> <script src="vendor/apexchart/apexchart.js"></script> <script src="vendor/chart.js/Chart.bundle.min.js"></script> <!-- Chart piety plugin files --> <script src="vendor/peity/jquery.peity.min.js"></script> <!-- Dashboard 1 --> <script src="js/dashboard/dashboard-1.js"></script> <script src="vendor/owl-carousel/owl.carousel.js"></script> <script src="js/custom.min.js"></script> <script src="js/dlabnav-init.js"></script> <script src="js/demo.js"></script> <script> function cardsCenter() { /* testimonial one function by = owl.carousel.js */ jQuery('.card-slider').owlCarousel({ loop:true, margin:10, nav:false, //center:true, slideSpeed: 3000, paginationSpeed: 3000, dots: false, navText: ['', ''], responsive:{ 0:{ items:1 }, 576:{ items:2 }, 800:{ items:2 }, 991:{ items:2 }, 1200:{ items:3 }, 1600:{ items:4 } } }) } jQuery(window).on('load',function(){ setTimeout(function(){ cardsCenter(); }, 1000); }); </script> <!-- Plugins JS Ends--> <script src="js/styleSwitcher.js"></script> </body> <!-- Mirrored from workload-node.scriptlelo.com/node/demo/index by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 03 May 2025 11:10:00 GMT --> </html>