This commit is contained in:
Suvodip
2024-05-07 18:54:29 +05:30
parent 13133d2d2a
commit 56fb4cb4fe
9 changed files with 935 additions and 72 deletions

View File

@@ -69,6 +69,7 @@
<tbody>
<?php
try {
// $bv_counter = 1;
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM addforms ORDER BY created_at DESC");
@@ -80,7 +81,6 @@
<td class="border-y-2 p-2 text-center"><?php echo $row['id']; ?></td>
<td class="border-y-2 p-2 "><?php echo $row['formname']; ?></td>
<td class="border-y-2 p-2 "><?php echo $row['bverticals']; ?></td>
<td class="border-y-2 p-2 text-center"><?php echo $row['time']; ?></td>
<td class="border-y-2 p-2">
<div class="flex flex-row justify-center">
<a href="/admin/edit-form/?id=<?php echo $row['id']; ?>">Edit</a> &nbsp; | &nbsp;
@@ -88,7 +88,7 @@
</div>
</td>
</tr>
<?php $bv_counter++; }
<?php }
$num_rows = $stmt->rowCount();
} catch (PDOException $e) {
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";

View File

@@ -105,12 +105,12 @@
</form>
</div>
</dialog>
<button class="rounded-lg p-2 bg-[#fff] text-[#464E5F] shadow-lg" style="">Select Date</button>
<?php
if($_SESSION['user_type'] == 'admin'){
echo '<p onclick="deleteCofermation();" class="rounded-lg pt-2 px-6 text-[#fff] text-center" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); cursor: pointer;">Delete</p>';
}
?>
<button class="rounded-lg p-2 bg-[#fff] text-[#464E5F] shadow-lg" style="">Select Date</button>
?>
<div class="flex flex-row">
<form method="GET" action="" class="bg-[#fff] flex flex-row place-items-center">
<input class="p-2.5 rounded-l-lg focus:outline-none w-[320px]" type="text" name="search" placeholder="Name, lead ID, Mobile, Email..." style="border: 2px solid #8E8E8E;">

588
.hta_slug/edit-lead.php Normal file
View File

@@ -0,0 +1,588 @@
<?php
require_once('.hta_config/crm_config.php');
require_once('.htac_header.php');
require_once('.htac_nav.php');
// echo $_GET['id'];
// Below two fetch for edit data
// this is count notifications
$stmt = $conn->prepare("SELECT COUNT(*) FROM comments WHERE leadid = :leadid");
$stmt->bindParam(':leadid', $_GET['id']);
$stmt->execute();
$totalRecords = $stmt->fetchColumn();
// echo $totalRecords;
if($_SERVER['REQUEST_METHOD']=="POST" && isset($_POST['update_data']) && $_POST['update_data']){
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("UPDATE cleads SET name = :name, email = :email, phone = :phone, date = :date, status = :status, user = :user, country = :country, state= :state, city = :city, address = :address, profession = :profession, coupon_code = :coupon_code, gender = :gender, warm_status = :warm_status WHERE id = :id");
$stmt->bindParam(':name', $_POST['name']);
$stmt->bindParam(':email', $_POST['email']);
$stmt->bindParam(':phone', $_POST['phone']);
$stmt->bindParam(':date', $_POST['date']);
$stmt->bindParam(':status', $_POST['status']);
$stmt->bindParam(':user', $_POST['user']);
$stmt->bindParam(':country', $_POST['country']);
$stmt->bindParam(':state', $_POST['state']);
$stmt->bindParam(':city', $_POST['city']);
$stmt->bindParam(':address', $_POST['address']);
$stmt->bindParam(':profession', $_POST['profession']);
$stmt->bindParam(':coupon_code', $_POST['coupon_code']);
$stmt->bindParam(':gender', $_POST['gender']);
$stmt->bindParam(':warm_status', $_POST['warm_status']);
$stmt->bindParam(':id', $_GET['id']);
$stmt->execute();
echo "Record Updated successfully";
} catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
};
try {
// $password = md5($_POST['pass']);
// $email = $_POST['email'];
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM cleads WHERE id = :id");
$stmt->bindParam(':id', $_GET['id']);
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
// var_dump($rows);
foreach($rows as $row){
$nameParts = explode(" ", $row['name']);
$firstInitial = substr($nameParts[0], 0, 1);
$lastInitial = substr($nameParts[count($nameParts) - 1], 0, 1);
$name_letter = $firstInitial.$lastInitial;
if($row['status'] == 'New'){$conditional_background_color = 'background-color: #FFD9D9; border: 1px solid #FB5555; border-radius: 5px; color: #FB5555;';}
elseif($row['status'] == 'Contacted'){$conditional_background_color = 'background-color: #D4FFFF; border: 1px solid #2C9C9C; border-radius: 5px; color: #2C9C9C;';}
elseif($row['status'] == 'Disqualified'){$conditional_background_color = 'background-color: #CECECE; border: 1px solid #3F4254; border-radius: 5px; color: #3F4254;';}
elseif($row['status'] == 'Converted'){$conditional_background_color = 'background-color: #D4FDE7; border: 1px solid #40916C; border-radius: 5px; color: #40916C;';}
elseif($row['status'] == 'Warm'){$conditional_background_color = 'background-color: #FFD9D9; border: 1px solid #FB5555; border-radius: 5px; color: #FB5555;';}
?>
<div class="responsive-flex p-6 space-x-4">
<form method="post">
<div class="flex flex-col">
<div class="flex flex-col bg-[#F6F6F6] rounded-xl">
<div class="grid grid-cols-3 p-3 border-b-2 border-[#D9D9D9] space-x-6" style="text-align: left;">
<div class="flex flex-row justify-center place-items-center">
<p class="h-fit p-[10px] rounded-l-full uppercase" style="background: linear-gradient(180deg, #E4C1F9 0%, rgba(129, 126, 242, 0.91) 100%); font-size: 20px; color: #fff; font-weight: bold;"><?php echo $name_letter; ?></p>
<div class="flex flex-row justify-center place-items-center items-center rounded-r-[5px]" style="border: 1px solid #D9D9D9; padding: 6px;">
<input class="w-full rounded-r-[6px]" type="text" name="name" id="name" value="<?php echo $row['name']; ?>" style="background-color: #f6f6f6; border: none;" />
<button class="copy-btn fa fa-copy" data-input-id="name"></button>
</div>
</div>
<div class="flex flex-row justify-center place-items-center items-center" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;">
<input class="w-full" type="text" name="email" id="email" value="<?php echo $row['email']; ?>" style="background-color: #f6f6f6; border: none;" />
<button class="copy-btn fa fa-copy" data-input-id="email"></button>
</div>
<div class="flex flex-row justify-center place-items-center items-center" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;">
<input class="w-full" type="text" name="phone" id="phone" value="<?php echo $row['phone']; ?>" style="background-color: #f6f6f6; border: none;" />
<button class="copy-btn fa fa-copy" data-input-id="phone"></button>
</div>
</div>
<div class="grid grid-cols-2 p-3 border-b-2 border-[#D9D9D9] space-x-6" style="text-align: left;">
<div>
<p><b>Client ID</b></p>
<p style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;"><?php echo $row['id']; ?></p>
</div>
<div>
<p><b>Form Name</b></p>
<p style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;"><?php echo $row['formname']; ?></p>
</div>
</div>
<div class="grid grid-cols-3 p-3 border-b-2 border-[#D9D9D9] space-x-6" style="text-align: left;">
<div>
<p><b>Country</b></p>
<select class="w-full" name="country" id="country" onchange="fetchStates()" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;">
<option selected value="<?php echo $row['country']; ?>"><?php echo $row['country']; ?></option>
</select>
</div>
<div>
<p><b>State</b></p>
<select class="w-full" name="state" id="state" onchange="fetchCities()" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;">
<option selected value="<?php echo $row['state']; ?>"><?php echo $row['state']; ?></option>
</select>
</div>
<div>
<p><b>City</b></p>
<select class="w-full" name="city" id="city" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;">
<option selected value="<?php echo $row['city']; ?>"><?php echo $row['city']; ?></option>
</select>
</div>
</div>
<div class="grid grid-cols-2 p-3 border-b-2 border-[#D9D9D9] space-x-6" style="text-align: left;">
<div>
<p><b>Address</b></p>
<input class="w-full" type="text" name="address" id="address" value="<?php echo $row['address']; ?>" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;" />
</div>
<div>
<p><b>Profession</b></p>
<input class="w-full" type="text" name="profession" id="profession" value="<?php echo $row['profession']; ?>" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;" />
</div>
</div>
<div class="grid grid-cols-2 p-3 border-b-2 border-[#D9D9D9] space-x-6" style="text-align: left;">
<div>
<p><b>Origin</b></p>
<p style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;"><?php echo $row['origin']; ?></p>
</div>
<div>
<p><b>Lead Status</b></p>
<div class="flex flex-row">
<select class="w-full" name="status" id="status" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px; <?php echo $conditional_background_color; ?>">
<?php
$statusOptions = ['New', 'Contacted', 'Warm', 'Converted', 'Inactive', 'Disqualified'];
foreach ($statusOptions as $option) {
$selected = ($row['status'] === $option) ? 'selected' : '';
echo '<option value="' . $option . '" ' . $selected . '>' . ucfirst($option) . '</option>';
}
?>
</select>
<?php
if ($row['status'] == 'Warm') {
echo '<select class="w-full" name="warm_status" id="warm_status" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;">';
$options = array("Proposal Sent", "Meeting Conducted", "Interested");
foreach ($options as $option) {
$selected = ($option == $row['warm_status']) ? 'selected' : '';
echo '<option value="' . $option . '" ' . $selected . '>' . $option . '</option>';
}
echo '</select>';
}
?>
</div>
</div>
</div>
<div class="grid grid-cols-2 p-3 border-b-2 border-[#D9D9D9] space-x-6" style="text-align: left;">
<div>
<p><b>Coupon Code</b></p>
<input class="w-full" type="text" name="coupon_code" id="coupon_code" value="<?php echo $row['coupon_code']; ?>" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;" />
</div>
<div>
<p><b>Time</b></p>
<p style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;"><?php echo $row['time']; ?></p>
</div>
</div>
<div class="grid grid-cols-2 p-3 border-b-2 border-[#D9D9D9] space-x-6" style="text-align: left;">
<div>
<p><b>Follow Update</b></p>
<input class="w-full" type="date" name="date" id="date" value="<?php echo $row['date']; ?>" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;" />
</div>
</div>
<div style="padding: 10px; ">
<input type="submit" id="update_data" name="update_data" value="Update" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); color: #fff; border-radius: 6px; padding: 10px 30px 10px 30px; float: right; cursor: pointer;" />
</div>
</div>
</div>
</form>
<div class="flex flex-col div-custom-margin">
<div class="bg-[#F6F6F6] rounded-xl p-3">
<div class="flex flex-row place-content-between" style="border-bottom: 2px solid #7E8299; border-style: dashed; padding-bottom: 3px;">
<p style="font-size: 25px; font-weight: bold;">Comments: <span><?php echo$totalRecords; ?></span></p>
<button id="toggleButton" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); color: #fff; border-radius: 6px; padding: 6px 20px 6px 20px;">Add Comment</button>
</div>
<div>
<?php
if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['save_comment']) && $_POST['save_comment'] && isset($_POST['comments']) && $_POST['comments']){
try {
$local_lang = 'en';
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("INSERT INTO comments (comments, user, locale, leadid) VALUES (:comments, :user, :locale, :leadid)");
$stmt->bindParam(':comments', $_POST['comments']);
$stmt->bindParam(':user', $_SESSION['email']);
$stmt->bindParam(':locale', $local_lang);
$stmt->bindParam(':leadid', $_GET['id']);
$stmt->execute();
echo "New Comment save successfully";
} catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
};
?>
<form class="" method="post" id="content" style="display: none;">
<div class="flex flex-row" style="margin-top: 10px; border-bottom: 2px solid #7E8299; padding-bottom: 10px;">
<input class="rounded-l-xl focus:outline-none w-1/2" type="text" name="comments" id="comments" style="border: 2px solid #363650; padding: 6px;" />
<input class="rounded-r-xl focus:outline-none" type="submit" value="Save" name="save_comment" id="save_comment" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); color: #fff; padding: 8px 20px 8px 20px;" />
</div>
</form>
</div>
<div style="max-height: 265px; overflow-y: auto;">
<?php
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM comments WHERE leadid = :leadid ORDER BY created_at DESC");
$stmt->bindParam(':leadid', $_GET['id']);
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($rows as $row){
$commenter_name_parts = explode("@", $row['user']);
$commenter_first_name_letter = substr($commenter_name_parts[0], 0, 1);
$commenter_last_name_letter = substr($commenter_name_parts[count($commenter_name_parts) - 1], 0, 1);
?>
<div style="">
<div class="flex flex-row place-items-center" style="margin-top: 3px;">
<p class=" p-2" style="background: linear-gradient(180deg, #E4C1F9 0%, rgba(129, 126, 242, 0.91) 100%); border-radius: 50%; font-size: 20px; color: #fff; font-weight: bold; text-transform: uppercase;"><?php echo $commenter_first_name_letter.$commenter_last_name_letter; ?></p>
<p ><b style="font-size: 16px;"> <?php echo $row['user'] ?></b><br><?php echo date("Y-m-d", strtotime($row['created_at'])) ?></p>
<p style=""></p>
</div>
<p style="margin-top: 10px;"><?php echo $row['comments']; ?></p>
</div>
<?php
}
} catch (PDOException $e) {
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
};
$saved_message = "";
if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['appt_comment']) && $_POST['appt_comment'] && isset($_POST['appt_date']) && $_POST['appt_date'] ){
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("INSERT INTO appointment (appt_date, email, name, leadid, comment) VALUES (:appt_date, :email, :name, :leadid, :comment)");
$stmt->bindParam(':appt_date', $_POST['appt_date']);
$stmt->bindParam(':email', $_SESSION['email']);
$stmt->bindParam(':name', $_SESSION['name']);
$stmt->bindParam(':leadid', $_GET['id']);
$stmt->bindParam(':comment', $_POST['comment']);
$stmt->execute();
$saved_message = "New Appointment save successfully";
} catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
};
if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['appt_comment_update']) && $_POST['appt_comment_update'] && isset($_POST['appt_date']) && $_POST['appt_date'] ){
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("UPDATE appointment SET appt_date = :appt_date, comment = :comment WHERE id = :appointment_id AND leadid = :leadid");
$stmt->bindParam(':appt_date', $_POST['appt_date']);
$stmt->bindParam(':comment', $_POST['comment']);
$stmt->bindParam(':leadid', $_GET['id']);
$stmt->bindParam(':appointment_id', $_POST['appointment_id']);
$stmt->execute();
$saved_message = "Appointment updated successfully";
} catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
};
?>
</div>
</div>
<div class="flex flex-col mt-3 bg-[#F6F6F6] rounded-xl">
<div class="flex flex-row place-content-between p-3" style="border-bottom: 2px solid #7E8299; border-style: dashed;">
<div class="flex flex-col">
<p style="font-size: 20px; font-weight: bold;">Add Appointment</p>
<p><?php echo $saved_message; ?></p>
</div>
<button onclick="apptModal();" style="background: linear-gradient(180deg, #7875F4 0%, #46448E 100%); color: #fff; font-size: 20px; border-radius: 50%; padding: 0px 8px 0px 8px; height: fit-content;">&#x2b;</button>
</div>
<div class="" style="max-height: 265px; overflow-y: auto;">
<?php
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM appointment WHERE leadid = :leadid");
$stmt->bindParam(':leadid', $_GET['id']);
$stmt->execute();
$appt_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
// Custom function to compare appointment dates
function compareAppointmentDates($a, $b) {
$dateA = new DateTime($a['appt_date']);
$dateB = new DateTime($b['appt_date']);
$currentDateTime = new DateTime();
// Compare appointment dates
if ($dateA == $dateB) {
return 0;
}
// Check if appointments are in the future or past
if ($dateA > $currentDateTime && $dateB > $currentDateTime) {
return ($dateA < $dateB) ? -1 : 1; // Sort by ascending date
} elseif ($dateA < $currentDateTime && $dateB < $currentDateTime) {
return ($dateA < $dateB) ? 1 : -1; // Sort by descending date
} else {
// One appointment is in the future and one is in the past
return ($dateA > $dateB) ? -1 : 1; // Sort the future appointment first
}
}
// Sort appointments based on appointment date
usort($appt_data, 'compareAppointmentDates');
foreach($appt_data as $appt){
$apptID = $appt['id'];
// echo $appt['name'];
$apptDate = explode(" ", $appt['appt_date']);
$currentDateTime = new DateTime();
$appointmentDateTime = new DateTime($appt['appt_date']);
if ($appointmentDateTime > $currentDateTime) {
$app_status = 'Next Appointment';
} elseif ($appointmentDateTime < $currentDateTime) {
$app_status = 'Expired Appointment';
} else {
$app_status = 'Today\'s Appointment';
}
?>
<div class="flex flex-col px-6" style="border-bottom: 2px solid #D9D9D9; ">
<div class="flex flex-row place-content-between align-items-center">
<p style="font-size: 15px; font-weight: bold;"><?php echo $app_status; ?></p>
<button style="color:#6F6BFF; font-weight: bold;" onclick="apptEditModal(<?php echo $apptID; ?>)">Edit</button>
</div>
<div class="grid grid-cols-3">
<p><?php echo $appt['comment']; ?></p>
<div class="flex flex-col" style="border-left: 3px solid #7875F4;">
<p style="font-weight: bold; padding-left: 6px;"><?php echo $apptDate[0]; ?></p>
<p style="padding-left: 6px;"><?php echo $apptDate[1]; ?></p>
</div>
</div>
</div>
<div id="appt-edit-modal<?php echo $apptID; ?>" class="add-appt-edit-modal">
<div class="p-4">
<p onclick="apptEditModal(<?php echo $apptID; ?>)" style="font-size: 16px; color: #464E5F; border: 2px solid #464E5F; border-radius: 50%; float: right; padding: 2px 6px 2px 6px; cursor: pointer;">&#10008;</p>
</div>
<form method="post" enctype="multipart/form-data" class="p-6 space-y-4">
<div class="flex flex-col">
<label for="appt_date">Appointment Date</label>
<input type="datetime-local" name="appt_date" id="appt_date" value="<?php echo $appt['appt_date'] ?>" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;" />
</div>
<input type="text" name="appointment_id" id="appointment_id" value="<?php echo $appt['id']; ?>">
<div class="flex flex-col">
<label for="appt-comment">Description (if needed)</label>
<input type="text" name="comment" id="appt-comment" value="<?php echo $appt['comment'] ?>" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;" />
</div>
<div class="flex flex-col">
<input class="rounded-xl focus:outline-none" type="submit" value="Update" name="appt_comment_update" id="appt_comment_update" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); color: #fff; padding: 8px 20px 8px 20px; cursor: pointer;" />
</div>
</form>
</div>
<?php
}
} catch (PDOException $e) {
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
};
?>
</div>
</div>
<!-- This IS Right Side DIV -->
</div>
</div>
<?php
}
} catch (PDOException $e) {
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
};
?>
<div id="appt-modal" class="add-appt-modal">
<p onclick="apptModal();" style="font-size: 16px; color: #464E5F; border: 2px solid #464E5F; border-radius: 50%; float: right; padding: 2px 6px 2px 6px; cursor: pointer;">&#10008;</p>
<form method="post" enctype="multipart/form-data" class="p-6 space-y-4">
<div class="flex flex-col">
<label for="appt_date">Appointment Date</label>
<input type="datetime-local" name="appt_date" id="appt_date" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;" />
</div>
<div class="flex flex-col">
<label for="appt-comment">Description (if needed)</label>
<input type="text" name="comment" id="appt-comment" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;" />
</div>
<div class="flex flex-col">
<input class="rounded-xl focus:outline-none" type="submit" value="Add" name="appt_comment" id="appt_comment" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); color: #fff; padding: 8px 20px 8px 20px; cursor: pointer;" />
</div>
</form>
</div>
<script>
// Get all copy buttons
const copyButtons = document.querySelectorAll('.copy-btn');
// Attach click event listeners to each copy button
copyButtons.forEach(button => {
button.addEventListener('click', event => {
event.preventDefault(); // Prevent default button behavior
// Get the input ID associated with this button
const inputId = button.getAttribute('data-input-id');
// Get the input element by ID
const inputElement = document.getElementById(inputId);
// Check if the input element exists and has a value
if (inputElement && inputElement.value) {
// Copy the input value to the clipboard using Clipboard API
navigator.clipboard.writeText(inputElement.value)
.then(() => {
// Provide visual feedback to the user
button.classList.add('copied');
setTimeout(() => {
button.classList.remove('copied');
}, 1000); // Remove the 'copied' class after 2000ms
})
.catch(err => {
console.error('Unable to copy:', err);
});
}
});
});
// Function to fetch countries and populate the country dropdown
function fetchCountries() {
fetch('https://api.siliconpin.com/v3/list/country/')
.then(res => res.json())
.then(data => {
const countryDropdown = document.getElementById('country');
countryDropdown.innerHTML = '<option value="">Select Country</option>';
data.forEach(country => {
const option = document.createElement('option');
option.value = country.iso2;
option.text = country.name;
countryDropdown.appendChild(option);
});
});
}
function fetchStates() {
const selectedCountry = document.getElementById('country').value;
fetch(`https://api.siliconpin.com/v3/list/country/state/?country=${selectedCountry}`)
.then(res => res.json())
.then(data => {
const stateDropdown = document.getElementById('state');
stateDropdown.innerHTML = '<option value="">Select State</option>';
data.forEach(state => {
const option = document.createElement('option');
option.value = state.iso2;
option.text = state.name;
stateDropdown.appendChild(option);
});
});
}
function fetchCities() {
const selectedCountry = document.getElementById('country').value;
const selectedState = document.getElementById('state').value;
fetch(`https://api.siliconpin.com/v3/list/country/city/?country=${selectedCountry}&state=${selectedState}`)
.then(res => res.json())
.then(data => {
const cityDropdown = document.getElementById('city');
cityDropdown.innerHTML = '<option value="">Select City</option>';
data.forEach(city => {
const option = document.createElement('option');
option.value = city.name;
option.text = city.name;
cityDropdown.appendChild(option);
});
});
}
// fetchCountries();
let nameID = document.getElementById('name');
let addressID = document.getElementById('address');
let countryID = document.getElementById('country');
let stateID = document.getElementById('state');
let cityID = document.getElementById('city');
let phoneID = document.getElementById('phone');
let emailID = document.getElementById('email');
let professionID = document.getElementById('profession');
let statusID = document.getElementById('status');
let coupon_codeID = document.getElementById('coupon_code');
let dateID = document.getElementById('date');
// document.getElementById('editButton').addEventListener('click', function() {
// fetchCountries();
// nameID.disabled = false;
// addressID.disabled = false;
// countryID.disabled = false;
// stateID.disabled = false;
// cityID.disabled = false;
// phoneID.disabled = false;
// emailID.disabled = false;
// professionID.disabled = false;
// statusID.disabled = false;
// coupon_codeID.disabled = false;
// dateID.disabled = false;
// });
const toggleButton = document.getElementById('toggleButton');
const content = document.getElementById('content');
toggleButton.addEventListener('click', function() {
if (content.style.display === 'none') {
content.style.display = 'block';
toggleButton.textContent = 'Cancel';
} else {
content.style.display = 'none';
toggleButton.textContent = 'Add Comment';
}
});
function apptModal(){
let apptForm = document.getElementById('appt-modal');
if(apptForm.style.display === 'block'){
apptForm.style.display = 'none'
}else{
apptForm.style.display = 'block'
}
}
function apptEditModal(id){
let apptEditForm = document.getElementById('appt-edit-modal' + id);
if(apptEditForm.style.display === 'block'){
apptEditForm.style.display = 'none'
}else{
apptEditForm.style.display = 'block'
}
}
document.addEventListener('keydown', function(event){
if(event.keyCode === 27){
var apptModal = document.getElementById('appt-modal');
if(apptModal.style.display === 'block'){
apptModal.style.display = 'none';
};
var apptEditModal = document.getElementById('appt-edit-modal<?php echo $apptID; ?>');
if(apptEditModal.style.display === 'block'){
apptEditModal.style.display = 'none';
}
}
})
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape') {
let editModals = document.querySelectorAll('.add-appt-edit-modal');
editModals.forEach(function(modal) {
modal.style.display = 'none';
});
}
});
</script>
<style>
.add-appt-modal, .add-appt-edit-modal{
background-color: #F8F8F8;
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
max-width: 600px;
box-shadow: 0px 0px 20px 0px #443780;
border-radius: 10px;
}
.copied {
background: linear-gradient(180deg, #E4C1F9 0%, rgba(129, 126, 242, 0.91) 100%);
border-radius: 5px;
color: #fff;
}
.responsive-flex {
display: flex;
flex-direction: row; /* Default value for screens wider than 1150px */
}
/* Media query for screens narrower than 1150px */
@media (max-width: 1150px) {
.responsive-flex {
flex-direction: column;
}
.div-custom-margin{
margin-top: 1rem;
width: 100%;
}
}
</style>

205
.hta_slug/form.php Normal file
View File

@@ -0,0 +1,205 @@
<?php
require_once('.hta_config/crm_config.php');
require_once('.htac_header.php');
require_once('.htac_nav.php');
?>
<div class="container mx-auto border-2 rounded-xl shadow">
<form method="post" class="p-4">
<p class="text-[25px] my-6">Book a medical examination appointment</p>
<p class="text-[25px] my-6">Location</p>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2">
<div class="flex flex-col ">
<label for="country"> Country:</label>
<select name="country" id="country" onchange="fetchStates()" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;">
<option value="">Select Country</option>
</select>
<p id="selectMessage" style="display: none;"></p>
</div>
<div class="flex flex-col">
<label for="state"> State:</label>
<select name="state" id="state" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;">
<option value="">Select State</option>
</select>
</div>
<div class="flex flex-col">
<label for="travel_country"> Country Travelling to:</label>
<select name="travel_country" id="travel_country" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;">
<option value="">-Select-</option>;
<option value="Bahrain">Bahrain</option>
<option value="Kuwait">Kuwait</option>
<option value="Oman">Oman</option>
<option value="Qatar">Qatar</option>
<option value="Saudi Arabia">Saudi Arabia</option>
<option value="UAE">UAE</option>
<option value="Yemen">Yemen</option>
</select>
</div>
</div>
<p class="text-[25px] my-6">Candidate's information</p>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2">
<div class="flex flex-col ">
<label for="first_name">First Name:</label>
<input type="text" name="first_name" id="first_name" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
</div>
<div class="flex flex-col ">
<label for="last_name">Last Name:</label>
<input type="text" name="last_name" id="last_name" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
</div>
<div class="flex flex-col ">
<label for="dob">Date of Birth:</label>
<input type="date" name="dob" id="dob" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
</div>
<div class="flex flex-col ">
<label for="national"> Nationality:</label>
<select name="national" id="national" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;">
<option value="">Select Country</option>
</select>
</div>
<div class="flex flex-col ">
<label for="gender"> Gender:</label>
<select name="gender" id="gender" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;">
<option value="">-Select-</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</div>
<div class="flex flex-col ">
<label for="marital"> Marital Status:</label>
<select name="marital" id="marital" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;">
<option value="">-Select-</option>
<option value="Married">Married</option>
<option value="Single">Single</option>
</select>
</div>
<div class="flex flex-col ">
<label for="passport">Passport No.:</label>
<input type="text" name="passport" id="passport" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
</div>
<div class="flex flex-col ">
<label for="confirm_passport">Confirm Passport No.:</label>
<input type="text" name="confirm_passport" id="confirm_passport" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
</div>
<div class="flex flex-col ">
<label for="passport_issue">Passport Issue Date:</label>
<input type="text" name="passport_issue" id="passport_issue" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
</div>
<div class="flex flex-col ">
<label for="passport_place">Passport Issue Place:</label>
<input type="text" name="passport_place" id="passport_place" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
</div>
<div class="flex flex-col ">
<label for="passport_expiry">Passport Expiry Date:</label>
<input type="text" name="passport_expiry" id="passport_expiry" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
</div>
<div class="flex flex-col ">
<label for="visa_type"> Visa Type:</label>
<select name="visa_type" id="visa_type" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;">
<option value="">-Select-</option>
<option value="Work Visa">Work Visa</option>
<option value="Family Visa">Family Visa</option>
</select>
</div>
<div class="flex flex-col ">
<label for="email">Email ID:</label>
<input type="email" name="email" id="email" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
</div>
<div class="flex flex-col ">
<label for="phone">Phone No.:</label>
<input type="text" name="phone" id="phone" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
</div>
<div class="flex flex-col ">
<label for="phone">National ID: <span class="text-blue-500">(Optional)</span></label>
<input type="text" name="phone" id="phone" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
</div>
<div class="flex flex-col ">
<label for="visa_type"> Position Applied For:</label>
<select name="visa_type" id="visa_type" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;">
<option value="">-Select-</option>
<option value="Banking & Finance">Banking & Finance</option>
<option value="Carpenter">Carpenter</option>
<option value="Cashier">Cashier</option>
<option value="General Secretory">General Secretory</option>
<option value="Heavy Driver">Heavy Driver</option>
</select>
</div>
<div class="flex flex-col ">
<label for="other">Other:</label>
<input type="text" name="other" id="other" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
</div>
</div>
<div class="flex flex-row ">
<input type="checkbox" name="message" id="message" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
<label for="message">I confirm that the information given in this from is true, complete and accurate:</label>
</div>
<div class="flex flex-row gap-4 float-right">
<button style="border: 2px solid #000; border-radius: 10px; padding: 15px 45px 15px 45px;">Cancel</button>
<button style="background-color: #000; color: #fff; border: 2px solid #000; border-radius: 10px; padding: 15px 45px 15px 45px;">Save & Contunue</button>
</div>
</form>
</div>
<script>
function fetchCountries() {
fetch('https://api.siliconpin.com/v3/list/country/')
.then(res => res.json())
.then(data => {
const countryDropdown = document.getElementById('country');
countryDropdown.innerHTML = '<option value="">Select Country</option>';
data.forEach(country => {
const option = document.createElement('option');
option.value = country.iso2;
option.text = country.name;
countryDropdown.appendChild(option);
});
});
}
function fetchStates() {
const selectedCountry = document.getElementById('country').value;
fetch(`https://api.siliconpin.com/v3/list/country/state/?country=${selectedCountry}`)
.then(res => res.json())
.then(data => {
const stateDropdown = document.getElementById('state');
stateDropdown.innerHTML = '<option value="">Select State</option>';
data.forEach(state => {
const option = document.createElement('option');
option.value = state.iso2;
option.text = state.name;
stateDropdown.appendChild(option);
});
});
}
// Function to fetch cities based on selected country and state and populate the city dropdown
function fetchCities() {
const selectedCountry = document.getElementById('country').value;
const selectedState = document.getElementById('state').value;
fetch(`https://api.siliconpin.com/v3/list/country/city/?country=${selectedCountry}&state=${selectedState}`)
.then(res => res.json())
.then(data => {
const cityDropdown = document.getElementById('city');
cityDropdown.innerHTML = '<option value="">Select City</option>';
data.forEach(city => {
const option = document.createElement('option');
option.value = city.name;
option.text = city.name;
cityDropdown.appendChild(option);
});
});
}
// Fetch countries on page load
fetchCountries();
fetch('https://api.siliconpin.com/v3/list/country/')
.then(res => res.json())
.then(data => {
const nationalDropdown = document.getElementById('national');
nationalDropdown.innerHTML = '<option value="">Select Nationality</option>';
data.forEach(national => {
const option = document.createElement('option');
option.value = national.iso2;
option.text = national.name;
nationalDropdown.appendChild(option);
});
});
</script>

View File

@@ -137,14 +137,14 @@
<button style="float: right; color: #FF0000; font-size: 25px; padding: 6px;">&#10008;</button>
<div class="flex flex-row">
<div class="flex flex-col p-6 space-y-4">
<a href="/cleads?start_date=<?php echo $today_date ?>&end_date=<?php echo $next_day ?>">Today</a>
<a href="/cleads?start_date=<?php echo $yesterday ?>&end_date=<?php echo $today_date ?>">Yesterday</a>
<a href="/cleads?start_date=<?php echo $this_week ?>&end_date=<?php echo $today_date ?>">This Week</a>
<a href="/cleads?start_date=<?php echo $firstDayOfCurrentMonth ?>&end_date=<?php echo $today_date ?>">This Month</a>
<a href="/cleads?start_date=<?php echo $prev_month_date ?>&end_date=<?php echo $today_date ?>">Last Month</a>
<a href="/cleads?start_date=<?php echo $firstDateOfYear ?>&end_date=<?php echo $today_date ?>">This Year</a>
<a href="/cleads?start_date=<?php echo $firstDateOfPreviousYear ?>&end_date=<?php echo $today_date ?>">Last Year</a>
<a href="/cleads">All Time</a>
<a href="/leads?start_date=<?php echo $today_date ?>&end_date=<?php echo $next_day ?>">Today</a>
<a href="/leads?start_date=<?php echo $yesterday ?>&end_date=<?php echo $today_date ?>">Yesterday</a>
<a href="/leads?start_date=<?php echo $this_week ?>&end_date=<?php echo $today_date ?>">This Week</a>
<a href="/leads?start_date=<?php echo $firstDayOfCurrentMonth ?>&end_date=<?php echo $today_date ?>">This Month</a>
<a href="/leads?start_date=<?php echo $prev_month_date ?>&end_date=<?php echo $today_date ?>">Last Month</a>
<a href="/leads?start_date=<?php echo $firstDateOfYear ?>&end_date=<?php echo $today_date ?>">This Year</a>
<a href="/leads?start_date=<?php echo $firstDateOfPreviousYear ?>&end_date=<?php echo $today_date ?>">Last Year</a>
<a href="/leads">All Time</a>
</div>
<form method="GET" class="p-6 flex flex-col pb-10">
<p>Choose Date for filter</p>
@@ -162,19 +162,19 @@
</form>
</div>
</dialog>
<?php
if($_SESSION['user_type'] == 'admin'){
echo '<p onclick="deleteCofermation();" class="rounded-lg pt-2 px-6 text-[#fff] text-center" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); cursor: pointer;">Delete</p>';
}
?>
<button class="rounded-lg p-2 bg-[#fff] text-[#464E5F] shadow-lg" style="">Select Date</button>
<button class="rounded-lg p-2 h-fit bg-[#fff] text-[#464E5F] shadow-lg" style="">Select Date</button>
<div class="flex flex-row">
<form method="GET" action="" class="bg-[#fff] flex flex-row place-items-center">
<input class="p-2.5 rounded-l-lg focus:outline-none w-[320px]" type="text" name="search" placeholder="Name, lead ID, Mobile, Email..." style="border: 2px solid #8E8E8E;">
<button class="rounded-r-lg text-[#fff] p-1.5" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%);" type="submit"><i class="fa fa-search"></i></button>
</form>
</div>
<button onclick="toggleDisplay();" class="rounded-lg p-2 text-[#fff]" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center;">Add Leads</button>
<?php
if(isset($_SESSION['user_type']) && $_SESSION['user_type'] == 'admin'){
echo '<p onclick="deleteCofermation();" class="rounded-lg h-fit py-2 px-6 text-[#fff] text-center" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); cursor: pointer;">Delete</p>';
}
?>
<button onclick="toggleDisplay();" class="rounded-lg p-2 h-fit text-[#fff]" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center;">Add Leads</button>
</div>
<form method="post">
@@ -182,7 +182,7 @@
<thead>
<tr>
<?php
if($_SESSION['user_type'] == 'admin')
if(isset($_SESSION['user_type']) && $_SESSION['user_type'] == 'admin')
echo ' <th class="text-center border-b-2 p-3">
<div class="delete-confirm" id="delete-button" style="display: none;">
<p>Are you sure you want to delete this lead?</p>
@@ -193,6 +193,7 @@
</div>
</th>';
?>
<th class="text-center border-b-2 p-3">BV</th>
<th class="text-center border-b-2 p-3">Quick Action</th>
<th class="text-center border-b-2 p-3">Name</th>
<th class="text-center border-b-2 p-3">ID</th>
@@ -205,20 +206,12 @@
<tbody >
<?php
//?bv=teenybeans&start_date=2024-05-04&end_date=2024-05-18
// Current page
if (isset($_GET['page']) && is_numeric($_GET['page'])) {
$currentPage = intval($_GET['page']);
} else {
$currentPage = 1;
}
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$searchTerm =isset($_GET['search']) ? $_GET['search'] : "%";
$businessVertical =isset($_GET['bv']) ? $_GET['bv'] : "%";
// echo $businessVertical;
$start_date = isset($_GET['start_date']) ? $_GET['start_date'] : '2014-05-05';
$end_date = isset($_GET['end_date']) ? $_GET['end_date'] : date('Y-m-d');
$start_time = microtime(true);
@@ -231,21 +224,21 @@
//first query to get the total number for pagination
$sql = "SELECT COUNT(*) FROM cleads
WHERE name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm AND time BETWEEN :start_date AND :end_date AND verticals LIKE :businessVertical";
WHERE name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm AND time BETWEEN :start_date AND :end_date AND business_type LIKE 'iimtt'";
$stmt = $conn->prepare($sql);
$stmt->bindValue(':searchTerm', "%$searchTerm%");
$stmt->bindValue(':limit', $resultsPerPage, PDO::PARAM_INT);
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
$stmt->bindValue(':start_date', $start_date);
$stmt->bindValue(':end_date', $end_date);
$stmt->bindValue(':businessVertical', $businessVertical);
// $stmt->bindValue(':businessVertical', $businessVertical);
$stmt->execute();
$totalRows = $stmt->fetchColumn();
// second & final query to get the page_view data
$sql = "SELECT * FROM cleads
WHERE name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm AND time BETWEEN :start_date AND :end_date AND verticals LIKE :businessVertical
WHERE name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm AND time BETWEEN :start_date AND :end_date AND business_type LIKE 'iimtt'
ORDER BY id DESC LIMIT :limit OFFSET :offset";
$stmt = $conn->prepare($sql);
$stmt->bindValue(':searchTerm', "%$searchTerm%"); // PDO::PARAM_STR is the default data type binding so is not needed
@@ -253,7 +246,7 @@
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
$stmt->bindValue(':start_date', $start_date);
$stmt->bindValue(':end_date', $end_date);
$stmt->bindValue(':businessVertical', $businessVertical);
// $stmt->bindValue(':businessVertical', $businessVertical);
$stmt->execute();
$leads = $stmt->fetchAll(PDO::FETCH_ASSOC);
$totalResults = count($leads);
@@ -273,6 +266,7 @@
// if($row['status'] == 'Warm'){$conditional_status = '<div class="flex flex-row"><p>'.$row['status'].'</p><select class="focus: outline-none " style="'.$conditional_background_color.' border: none;"><option>Option 1</option><option>Option 2</option></select></div>';}elseif($row['status'] != 'Warm'){$conditional_status = $row['status'];}
?>
<tr>
<td><?php echo $lead['business_type'] ?></td>
<td class="border-y-2 p-2">
<div class="flex flex-row justify-center place-items-center">
<div class="xzmdropdown-wrapper">
@@ -297,13 +291,13 @@
</div>
</div>
</td>
<?php if($_SESSION['user_type'] == 'admin'){?>
<?php if(isset($_SESSION['user_type']) && $_SESSION['user_type'] == 'admin'){?>
<td class="border-y-2 p-2">
<input type="checkbox" name="selected_records[]" value="<?php echo $lead['id']; ?>" id="<?php echo $lead['id']; ?>" />
</td>
<?php }?>
<td class="border-y-2 p-2"><label for="<?php echo $lead['id']; ?>"><?php echo $lead['name'] ?></label></td>
<td class="border-y-2 p-2 text-blue-500 hover:text-blue-700 hover:underline"><a href="/cleads/edit-lead/?id=<?php echo $lead['id'] ?>"><?php echo $lead['id'] ?></a></td>
<td class="border-y-2 p-2 text-blue-500 hover:text-blue-700 hover:underline"><a href="/edit-lead/?id=<?php echo $lead['id'] ?>"><?php echo $lead['id'] ?></a></td>
<td class="border-y-2 p-2"><div style="<?php echo $conditional_background_color; ?> font-weight: bold;"><?php echo $lead['status'];?></div></td>
<!-- <td class="border-y-2 p-2">
<p><i class="fa fa-envelope">&nbsp;<?php // echo $lead['email'] ?></i></p>
@@ -334,14 +328,15 @@
<?php
$getParams = $_GET; unset($getParams['page']); $getParams['page'] = $page-1; $backPage= http_build_query($getParams); unset($getParams['page']); $getParams['page'] = $page+1; $nextkPage= http_build_query($getParams);
$getParams = $_GET; unset($getParams['page']); $getParams['page'] = $page-1; $backPage= http_build_query($getParams); unset($getParams['page']);
$getParams['page'] = $page+1; $nextkPage= http_build_query($getParams);
echo'
<div class="bg-white p-4 flex items-center flex-wrap">
<nav aria-label="Page navigation">
<ul class="inline-flex">
<li><button class="px-4 py-2 text-green-600 transition-colors duration-150 bg-white border border-r-0 border-green-600 rounded-l-lg focus:shadow-outline hover:bg-green-100"> &nbsp;'; if($page>1) echo '<a href="?',$backPage,'">&lt;','</a>'; echo ' &nbsp; </button></li>
<li><button class="px-4 py-2 text-white transition-colors duration-150 bg-green-600 border border-r-0 border-green-600 focus:shadow-outline"> &nbsp; '.$page.' &nbsp; </button></li>
<li><button class="px-4 py-2 text-green-600 transition-colors duration-150 bg-white border border-green-600 rounded-r-lg focus:shadow-outline hover:bg-green-100"> &nbsp;'; if($page<$totalPages) echo '<a href="?',$nextkPage,'">&gt;','</a>'; echo ' &nbsp;</button></li>
<ul class="flex flex-row ">
<li><button class="px-4 py-2 text-[#443780] border border-[#443780] rounded-l-lg" > &nbsp;'; if($page>1) echo '<a href="?',$backPage,'">&lt;','</a>'; echo ' &nbsp; </button></li>
<li><button class="px-4 py-2 text-white border-y border-[#443780]" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%);"> &nbsp; '.$page.' &nbsp; </button></li>
<li><button class="px-4 py-2 text-[#443780] border border-[#443780] rounded-r-lg" > &nbsp;'; if($page<$totalPages) echo '<a href="?',$nextkPage,'">&gt;','</a>'; echo ' &nbsp;</button></li>
</ul>
</nav>
</div>
@@ -499,8 +494,10 @@ echo'
closeButton.addEventListener("click", () => {
dialog.close();
});
function toggleDisplay() {
var element = document.getElementById('add-lead-form');
console.log(element);
if (element.style.display === 'block') {
element.style.display = 'none';
} else {
@@ -520,7 +517,7 @@ echo'
});
function deleteCofermation(){
let deleteButton = document.getElementById('delete-button');
let leadID = document.getElementById('<?php echo $row['id']; ?>').value; //getting Err: here
let leadID = document.getElementById('<?php echo $lead['id']; ?>').value; //getting Err: here
if(leadID != null){
if(deleteButton.style.display === 'flex'){
deleteButton.style.display = 'none';
@@ -544,7 +541,7 @@ echo'
max-width: 500px;
box-shadow: 0px 0px 20px 0px #443780;
border-radius: 2px;
z-index: 100;
z-index: 999;
height: 100%;
animation: slideInRight 0.5s forwards; /* Animation to slide in */
/* overflow-x: auto; */

View File

@@ -2,9 +2,8 @@
<?php
require_once('.hta_config/crm_config.php');
// require_once('.htac_header.php');
if($_SESSION['log_status'] == 1){
echo '<script>window.location.href = "/cleads";</script>';
// exit();
if(isset($_SESSION['log_status']) && $_SESSION['log_status'] == 1){
echo '<script>window.location.href = "/leads";</script>';
}
if ($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['pass']) && isset($_POST['email'])) {
try {
@@ -27,7 +26,7 @@
$_SESSION["access"] = $row['access'];
$_SESSION["name"] = $row['name'];
$_SESSION["email"] = $row['email'];
echo '<script>window.location.href = "/cleads";</script>';
echo '<script>window.location.href = "/leads";</script>';
// echo $_SESSION["loggedin"].$_SESSION["log_status"].$_SESSION["access"].$_SESSION["name"].$_SESSION["email"];
}
} else{

View File

@@ -3,7 +3,7 @@ require_once('.htac_header.php');
require_once('.htac_nav.php');
// Start the session
session_start();
// session_start();
// Unset all session variables
$_SESSION = array();

View File

@@ -2,28 +2,74 @@
require_once('.hta_config/crm_config.php');
require_once('.htac_header.php');
require_once('.htac_nav.php');
?>
<div>
<div class="flex flex-row place-content-between">
<p>Notifications</p>
<button>Mark all as read</button>
</div>
<?php
if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['mark_all_read']) && $_POST['mark_all_read']){
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM appointment");
// $stmt->bindParam(':leadid', $_GET['id']);
$stmt = $conn->prepare("UPDATE appointment SET view_status = 1 WHERE view_status = 0 AND email = :email");
$stmt->bindParam(':email', $_SESSION['email']);
$stmt->execute();
$saved_message = "Appointment updated successfully";
} catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
};
?>
<form method="post">
<div>
<div class="flex flex-row place-content-between py-2" style="border-bottom: 2px solid #A0A2AB; border-style: dashed;">
<p class="text-[25px] font-bold">Notifications</p>
<div>
<a href="/notifications?tab=past" class="text-[#6F6BFF]">Past Notifications</a> |
<input name="mark_all_read" type="submit" value="Mark all as read" class="text-[#6F6BFF] pr-6 cursor-pointer " />
</div>
</div>
</form>
<?php
if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['status_id']) && $_POST['status_id']){
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("UPDATE appointment SET view_status = 1 WHERE id = :status_id AND email = :email");
$stmt->bindParam(':status_id', $_POST['status_id']);
$stmt->bindParam(':email', $_SESSION['email']);
$stmt->execute();
$saved_message = "Appointment updated successfully";
} catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
};
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$oneWeekAgo = date('Y-m-d', strtotime('-1 week'));
$stmt = $conn->prepare("SELECT * FROM appointment WHERE email = :email AND appt_date > :appoinment_expiry ORDER BY appt_date ASC");
$stmt->bindParam(':email', $_SESSION['email']);
$stmt->bindParam(':appoinment_expiry', $oneWeekAgo);
$stmt->execute();
$appt_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($appt_data as $appt){
?>
<div class="flex flex-row">
<div class="flex flex-col">
<p>Reminders for <span><?php echo $appt['name'] ?></span></p>
<p><?php echo date("Y/m/d"); ?></p>
</div>
</div>
if($appt['view_status'] == 0){
$notification_bg = 'background: #F5F4FFE8;';
$notification_batch = '<div style="width: 8px; height: 8px; background-color: red; border-radius: 50%;"></div>';
}elseif($appt['view_status'] == 1){
$notification_bg = 'background: #fff;';
$notification_batch = '<div style="width: 8px; height: 8px; background-color: #fff; border-radius: 50%;"></div>';
}
?> <div class="p-2">
<form method="post">
<button type="submit" class="w-full text-left">
<div class="flex flex-col w-full p-2 rounded-md shadow" style="border: 3px solid #F5F4FFE8; <?php echo $notification_bg; ?>">
<div class="flex flex-row place-items-center">🕑 Reminders for &nbsp;<span><?php echo $appt['name'] ?> </span>&nbsp; <?php echo $notification_batch; ?></div>
<p><?php echo $appt['appt_date']; ?></p>
<input type="hidden" name="status_id" value="<?php echo $appt['id'] ?>" />
</div>
</button>
</form>
</div>
<?php
}

View File

@@ -1,21 +1,39 @@
<?php
require_once('.hta_config/crm_config.php');
if($_SESSION['user_type']=='admin'){
$all_leads_url = '/admin/all-leads';
$all_leads_url = '/leads';
} else
$all_leads_url = '/cleads';{}
$all_leads_url = '/leads';
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT COUNT(*) AS count FROM appointment WHERE email = :email AND view_status = 0");
$stmt->bindParam(':email', $_SESSION['email']);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$total_notice = $result['count'];
} catch (PDOException $e) {
echo "Error: " . $e->getMessage();
}
?>
<section class="bg-[#443780] py-1.5 px-4" style="position: fixed; width: 100%; z-index: 10;">
<section class="bg-[#443780] py-1.5 px-4" style="position: fixed; width: 100%; z-index: 999;">
<div class="container mx-auto flex flex-row place-content-between text-[#fff] ">
<div>
<p>CRM</p>
</div>
<div class="flex flex-row space-x-4 place-items-center">
<div class="flex flex-row space-x-4">
<a href="/notifications" class=""><i class="fa fa-bell">
<a href="/notifications" class="flex flex-row"><i class="fa fa-bell">
<?php
if($total_notice > 0){
echo '<span class="bg-[#FF0000] rounded-full px-1" style="margin-top: -10px;">'.$total_notice.'</span>';
}
?>
<!-- <span class="" style="background-color: #FF0000; padding-left: 4px; padding-right: 4px; border-radius: 50%; ">1</span> -->
</i></a>
<a href="/logout" class="bg-[#E4C1F9] text-[#443780] px-4 rounded-full"><i class="fa fa-sign-out">Logout</i></a>
</div>
<?php
@@ -33,7 +51,7 @@
$lastInitial = substr($nameParts[count($nameParts) - 1], 0, 1);
echo ' <div style="display: flex; flex-direction: row; place-items: center">
<p>Hi <span>'.$nameParts[0].'</span></p>&nbsp;
<p class="p-2" style="background: linear-gradient(180deg, #E4C1F9 0%, rgba(129, 126, 242, 0.91) 100%); border-radius: 50%; font-size: 20px; color: #fff; font-weight: bold;">'.$firstInitial.$lastInitial.'</p>
<p class="p-2 uppercase" style="background: linear-gradient(180deg, #E4C1F9 0%, rgba(129, 126, 242, 0.91) 100%); border-radius: 50%; font-size: 20px; color: #fff; font-weight: bold;">'.$firstInitial.$lastInitial.'</p>
</div>';
}
} catch (PDOException $e) {
@@ -44,7 +62,7 @@
</div>
</section>
<div style="display: flex; flex-direction: row;">
<div style="position: fixed; height: 100%; z-index: 999;">
<div style="position: fixed; height: 100%; z-index: 997;">
<nav class="main-menu">
<ul style="padding-top: 100px;">
<li>
@@ -70,7 +88,7 @@
$access_data_not_undescore = str_replace("_", " ", $access_data);
?>
<li>
<a href="/cleads/by-business-verticals/?bv=<?php echo $access_data; ?>">
<a href="/leads?bv=<?php echo $access_data; ?>">
<i class="fa fa-2x"><img src="/assets/bv.png" alt="" /></i>
<!-- <i class="fa fa-square fa-2x"></i> -->
<span class="nav-text" style="text-transform: capitalize;">
@@ -95,7 +113,7 @@
$num_rows = $stmt->rowCount();
foreach($bv_rows as $bv_row){ $access_data_not_undescore = str_replace("_", " ",$bv_row['bv']);?>
<li>
<a href="/cleads/by-business-verticals/?bv=<?php echo $bv_row['bv']; ?>">
<a href="/leads?bv=<?php echo $bv_row['bv']; ?>">
<i class="fa fa-2x"><img src="/assets/bv.png" alt="" /></i>
<!-- <i class="fa fa-square fa-2x"></i> -->
<span class="nav-text" style="text-transform: capitalize;">
@@ -112,6 +130,7 @@
}
?>
<li>
<?php if(isset($_SESSION['user_type']) && $_SESSION['user_type'] == 'user'){ ?>
<a href="/cleads/my-leads">
<i class="fa fa-2x"><img src="/assets/my-lead.png" alt="" /></i>
<!-- <i class="fa fa-square fa-2x"></i> -->
@@ -119,6 +138,7 @@
My Leads
</span>
</a>
<?php } ?>
</li>
<li>
<a href="/add-csv">
@@ -159,6 +179,14 @@
?>
</ul>
<ul class="logout">
<li>
<a href="/profile">
<i class="fa fa-user fa-2x"></i>
<span class="nav-text">
Profile
</span>
</a>
</li>
<li>
<a href="/logout">
<i class="fa fa-power-off fa-2x"></i>