init
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
$mariaServer = "10.0.0.108";
|
||||
$mariaUser = "siliconpin";
|
||||
$mariaPass = "bijaynagar";
|
||||
$mariaDb = "siliconpin_crm";
|
||||
?>
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
define("APP_PATH", getcwd());
|
||||
define("APP_DIR", __DIR__);
|
||||
define("domain", 'siliconpin.com');
|
||||
define("HTTP_HOST", "");//$_SERVER['HTTP_HOST'] == 'localhost:8080';$_SERVER['SERVER_NAME'] == 'localhost';
|
||||
$url = explode('/', $_SERVER['REQUEST_URI']);define("F_D",0);
|
||||
session_start();
|
||||
// include('DIZZ/engine.php');
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
$web_page_title='Home - MGM Enterprises';
|
||||
$web_page_meta_description='';
|
||||
$web_page_meta_keywords='';
|
||||
$web_page_author='';
|
||||
$web_page_meta_og_title='';
|
||||
$web_page_meta_og_description='';
|
||||
$web_page_meta_og_image='';
|
||||
$web_page_meta_og_url='';
|
||||
$web_page_meta_twitter_title='';
|
||||
$web_page_meta_twitter_description='';
|
||||
$web_page_meta_twitter_image='';
|
||||
$web_page_meta_twitter_card='';
|
||||
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
?>
|
||||
<div>
|
||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Distinctio quis numquam voluptatibus dolorem quo iste voluptate labore sapiente doloremque repudiandae impedit consectetur, perspiciatis exercitationem voluptates. Iste beatae nisi corrupti aspernatur.</p>
|
||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Distinctio quis numquam voluptatibus dolorem quo iste voluptate labore sapiente doloremque repudiandae impedit consectetur, perspiciatis exercitationem voluptates. Iste beatae nisi corrupti aspernatur.</p>
|
||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Distinctio quis numquam voluptatibus dolorem quo iste voluptate labore sapiente doloremque repudiandae impedit consectetur, perspiciatis exercitationem voluptates. Iste beatae nisi corrupti aspernatur.</p>
|
||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Distinctio quis numquam voluptatibus dolorem quo iste voluptate labore sapiente doloremque repudiandae impedit consectetur, perspiciatis exercitationem voluptates. Iste beatae nisi corrupti aspernatur.</p>
|
||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Distinctio quis numquam voluptatibus dolorem quo iste voluptate labore sapiente doloremque repudiandae impedit consectetur, perspiciatis exercitationem voluptates. Iste beatae nisi corrupti aspernatur.</p>
|
||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Distinctio quis numquam voluptatibus dolorem quo iste voluptate labore sapiente doloremque repudiandae impedit consectetur, perspiciatis exercitationem voluptates. Iste beatae nisi corrupti aspernatur.</p>
|
||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Distinctio quis numquam voluptatibus dolorem quo iste voluptate labore sapiente doloremque repudiandae impedit consectetur, perspiciatis exercitationem voluptates. Iste beatae nisi corrupti aspernatur.</p>
|
||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Distinctio quis numquam voluptatibus dolorem quo iste voluptate labore sapiente doloremque repudiandae impedit consectetur, perspiciatis exercitationem voluptates. Iste beatae nisi corrupti aspernatur.</p>
|
||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Distinctio quis numquam voluptatibus dolorem quo iste voluptate labore sapiente doloremque repudiandae impedit consectetur, perspiciatis exercitationem voluptates. Iste beatae nisi corrupti aspernatur.</p>
|
||||
<p style="text-align: center; font-size: 30px; font-weight: bold; margin-top:20%;">Beanstalkedu CRM</p>
|
||||
</div>
|
||||
<?
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
$web_page_title='Home - MGM Enterprises';
|
||||
$web_page_meta_description='';
|
||||
$web_page_meta_keywords='';
|
||||
$web_page_author='';
|
||||
$web_page_meta_og_title='';
|
||||
$web_page_meta_og_description='';
|
||||
$web_page_meta_og_image='';
|
||||
$web_page_meta_og_url='';
|
||||
$web_page_meta_twitter_title='';
|
||||
$web_page_meta_twitter_description='';
|
||||
$web_page_meta_twitter_image='';
|
||||
$web_page_meta_twitter_card='';
|
||||
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
?>
|
||||
<div>
|
||||
<p style="text-align: center; font-size: 30px; font-weight: bold; margin-top:20%;">About</p>
|
||||
</div>
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
// Check if file is uploaded
|
||||
if(isset($_FILES['file']) && $_FILES['file']['error'] === UPLOAD_ERR_OK) {
|
||||
$file_tmp = $_FILES['file']['tmp_name'];
|
||||
// Read CSV file
|
||||
$csvData = file_get_contents($file_tmp);
|
||||
$rows = explode("\n", $csvData);
|
||||
// Remove header row
|
||||
array_shift($rows);
|
||||
// Parse CSV data and insert into database
|
||||
foreach ($rows as $row) {
|
||||
$data = str_getcsv($row);
|
||||
// Prepare SQL statement
|
||||
$stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, details, origin, verticals, business_type, status) VALUES (:name, :email, :phone, 'crm-portal', :note, :details, :origin, '5', :business_type, 'New')");
|
||||
$stmt->bindParam(':name', $data[0]);
|
||||
$stmt->bindParam(':email', $data[1]);
|
||||
$stmt->bindParam(':phone', $data[2]);
|
||||
$stmt->bindParam(':note', $data[9]);
|
||||
$stmt->bindParam(':details', $data[5]);
|
||||
$stmt->bindParam(':origin', $data[6]);
|
||||
$stmt->bindParam(':business_type', $data[8]);
|
||||
|
||||
// Execute the SQL statement
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
echo "Records added successfully";
|
||||
} else {
|
||||
// echo "No file uploaded or an error occurred while uploading the file.";
|
||||
}
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
|
||||
// Close the database connection
|
||||
$conn = null;
|
||||
?>
|
||||
<div class="container mx-auto p-4">
|
||||
<p>TH(the first row) will not be added (Ignored), in every uploads the first row have to be there, as provided in the sample csv </p>
|
||||
<p><span style="font-weight: bold;">Origin:</span> Facebook-Ads, Google-Ads, Linkedin-Ads, Instagram, Messenger, Whatsapp, GMB, Linkedin, Inbound-Call, Outbound-Call, Others</p>
|
||||
<p><span style="font-weight: bold;">Verticals:</span> beanstalk, inhouse, teenybeans, iimtt, buzzapp, atheneum, teenybeans_curriculum</p>
|
||||
</div>
|
||||
<div class="flex flex-col place-items-center mt-10 mb-[20%]">
|
||||
<div class="flex flex-col justify-center bg-[#F6F6F6] p-6 rounded-xl" style="min-width: 600px;">
|
||||
<div class="flex flex-row place-content-between pb-8" style="border-bottom: 1px solid #DADADA;">
|
||||
<p style="font-size: 25px; font-weight: bold;">Upload CSV</p>
|
||||
<a href="/assets/Sample_CSV.csv" download="Sample_CSV.csv" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); color: #fff; padding: 10px 20px 10px 20px; border-radius: 10px;">Download CSV File</a>
|
||||
</div>
|
||||
<form method="post" enctype="multipart/form-data" class="flex flex-col pt-6" >
|
||||
<div id="fileInfo" class="mt-4 flex flex-col justify-center place-items-center p-[30px]" style="display: none; border: 2px solid #6F6BFF; border-style: dashed; border-radius: 10px; background-color: #fff; cursor: pointer;">
|
||||
<p id="fileName"></p>
|
||||
<p id="uploadStatus"></p>
|
||||
<div id="spinner" class="spinner" style="display: none;"></div>
|
||||
</div>
|
||||
<label for="file" id="lebel-id" class="flex flex-col justify-center place-items-center p-[30px]" style="border: 2px solid #6F6BFF; border-style: dashed; border-radius: 10px; background-color: #fff; cursor: pointer;">
|
||||
<input class="hidden" type="file" name="file" id="file" onchange="handleFileUpload(this.files)" accept=".csv" />
|
||||
<img src="/assets/csv_icon.svg" alt="" />
|
||||
<p style="font-size: 20px; font-weight: bold; color: #363650;">Select a CSV file to upload</p>
|
||||
<p style="font-size: 16px; font-weight: bold; color: #5F5F5F;">or drag and drop it here</p>
|
||||
</label>
|
||||
<div class="flex flex-row place-content-between mt-4">
|
||||
<p onclick="removeFile()" style="border: 3px solid #6F6BFF; padding: 10px 20px 10px 20px; border-radius: 6px; font-weight: bold; background: linear-gradient(90deg, #7B77FD 0%, #55498E 100%); -webkit-background-clip: text; background-clip: text; color: transparent; text-decoration: none; cursor: pointer;" >Cancel</p>
|
||||
<input type="submit" value="Upload Files" name="submit" id="submit" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); color: #fff; padding: 10px 20px 10px 20px; border-radius: 10px; cursor: pointer;"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function handleFileUpload(files) {
|
||||
const file = files[0];
|
||||
const fileName = file.name;
|
||||
document.getElementById('lebel-id').style.display = 'none';
|
||||
document.getElementById("fileInfo").style.display = "block";
|
||||
document.getElementById("fileName").textContent = "File Name: " + fileName;
|
||||
|
||||
document.getElementById("spinner").style.display = "block";
|
||||
|
||||
setTimeout(() => {
|
||||
document.getElementById("uploadStatus").textContent = "Upload Complete";
|
||||
// Hide spinner after upload completion
|
||||
document.getElementById("spinner").style.display = "none";
|
||||
}, 2000); // Simulated upload time 2 seconds
|
||||
}
|
||||
function removeFile() {
|
||||
document.getElementById('lebel-id').style.display = 'flex';
|
||||
document.getElementById('file').value = '';
|
||||
document.getElementById("fileInfo").style.display = "none";
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.spinner {
|
||||
border: 4px solid rgba(0, 0, 0, 0.1);
|
||||
border-left-color: #6F6BFF;
|
||||
border-radius: 50%;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
if($_SESSION['user_type'] == 'admin'){
|
||||
if(isset($url[2])){
|
||||
$slug2="";
|
||||
if (strpos($url[2], "?") !== false) {
|
||||
$url2 = explode('?', $url[2]);
|
||||
$slug2=$url2[0];
|
||||
} else $slug2=$url[2];
|
||||
if($slug2=="") require_once('admin/_home.php');
|
||||
elseif(file_exists(__DIR__."/admin/".$slug2.".php")) include __DIR__."/admin/".$slug2.".php";
|
||||
else require_once('admin/.htac_404.php');
|
||||
}
|
||||
else require_once('admin/_home.php');
|
||||
} else{
|
||||
echo '<script>window.location.href="/cleads"</script>';
|
||||
}
|
||||
|
||||
|
||||
// uri - slug handler ends
|
||||
?>
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
?>
|
|
@ -0,0 +1,273 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch(PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$select_access = ['beanstalk', 'inhouse', 'teenybeans', 'iimtt', 'buzzapp', 'atheneum', 'teenybeans_curriculum'];
|
||||
$access_values_array = [];
|
||||
|
||||
foreach ($select_access as $access) {
|
||||
if (isset($_POST[$access])) {
|
||||
$access_values_array[] = $_POST[$access];
|
||||
}
|
||||
}
|
||||
$access_value = implode(',', $access_values_array);
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$phone = $_POST['phone'];
|
||||
$password = md5($_POST['pass']);
|
||||
$selected_states = implode(',', $_POST['states']); // Collect selected state values
|
||||
|
||||
try {
|
||||
$stmt = $conn->prepare("INSERT INTO users (name, email, mobile, access, pass, states) VALUES (:name, :email, :mobile, :access, :pass, :states)");
|
||||
$stmt->bindParam(':name', $name);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':mobile', $phone);
|
||||
$stmt->bindParam(':access', $access_value);
|
||||
$stmt->bindParam(':pass', $password);
|
||||
$stmt->bindParam(':states', $selected_states); // Bind selected states
|
||||
$stmt->execute();
|
||||
|
||||
echo "Record added successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; margin-top: 30px; margin-bottom: 30px;">
|
||||
<form action="" method="post" style="width: 600px; max-width: 600px; border: 1px solid #36365050; padding: 20px; border-radius: 20px; box-shadow: 0px 0px 10px 0px #363650;">
|
||||
<p style="font-size: 25px; font-weight: bold; margin-top: 10px; margin-bottom: 10px;">Add new user</p>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" name="name" id="name" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="email">E-mail:</label>
|
||||
<input type="text" name="email" id="email" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="phone">Phone:</label>
|
||||
<input type="text" name="phone" id="phone" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label>
|
||||
Country:
|
||||
</label>
|
||||
<label for="national">National
|
||||
<input type="radio" name="country" id="national" onchange="checkCountry()" />
|
||||
</label>
|
||||
<label for="international">International
|
||||
<input type="radio" name="country" id="international" onchange="checkCountry()" />
|
||||
</label>
|
||||
</div>
|
||||
<!-- <div style="display: flex; flex-direction: column;">
|
||||
<label for="country">Country:</label>
|
||||
<select name="country" id="country" onchange="checkCountry();" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;">
|
||||
<option value="">Select Country</option>
|
||||
</select>
|
||||
</div> -->
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<p>Access:</p>
|
||||
<?php
|
||||
try {
|
||||
$stmt = $conn->prepare("SELECT * FROM business_verticals");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows >= 1) {
|
||||
foreach($rows as $row){ ?>
|
||||
<div>
|
||||
<input type="checkbox" name="<?php echo $row['bv']; ?>" id="<?php echo $row['bv']; ?>" value="<?php echo $row['bv']; ?>" />
|
||||
<label for="<?php echo $row['bv']; ?>" style="text-transform: uppercase;"><?php echo $row['bv']; ?></label>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
} else{
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div style="display: none; flex-direction: column;" id="state-access">
|
||||
<p style="font-size: 16px; font-weight: bold; margin-top: 10px;">Access by state:</p>
|
||||
<div id="selectedStateDisplay"></div>
|
||||
<div class="dropdown">
|
||||
<button class="dropbtn" id="selectStatesBtn">Select States</button>
|
||||
<div class="dropdown-content" id="stateDropdown">
|
||||
<!-- State options will be populated here -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="pass">Password:</label>
|
||||
<input type="text" name="pass" id="pass" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<input type="submit" name="submit" id="submit" value="Submit" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; padding: 10px 20px 10px 20px; color: #fff; border-radius: 6px; float: right; margin-top: 30px;" />
|
||||
</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 id="" value="">Select Country</option>';
|
||||
data.forEach(country => {
|
||||
const option = document.createElement('option');
|
||||
option.value = country.iso2;
|
||||
option.text = country.name;
|
||||
countryDropdown.appendChild(option);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fetchCountries();
|
||||
|
||||
// function checkCountry(){
|
||||
// let getCountry = document.getElementById('country').value;
|
||||
// console.log(getCountry);
|
||||
// if(getCountry === "national"){
|
||||
// document.getElementById('state-access').style.display = 'flex';
|
||||
// } else{
|
||||
// document.getElementById('state-access').style.display = 'none';
|
||||
// }
|
||||
// }
|
||||
function checkCountry() {
|
||||
if (document.getElementById('national').checked) {
|
||||
document.getElementById('state-access').style.display = 'flex';
|
||||
} else {
|
||||
document.getElementById('state-access').style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
function fetchStates() {
|
||||
fetch(`https://api.siliconpin.com/v3/list/country/state/?country=IN`)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
const dropdownContent = document.getElementById('stateDropdown');
|
||||
dropdownContent.innerHTML = ''; // Clear previous content
|
||||
|
||||
data.forEach(state => {
|
||||
const checkboxDiv = document.createElement('div');
|
||||
|
||||
const checkbox = document.createElement('input');
|
||||
checkbox.type = 'checkbox';
|
||||
checkbox.name = 'states[]'; // You might want to use an array here if submitting form
|
||||
checkbox.value = state.iso2;
|
||||
checkbox.id = state.iso2;
|
||||
const label = document.createElement('label');
|
||||
label.textContent = state.name;
|
||||
label.style = 'text-transform: uppercase';
|
||||
label.setAttribute('for', state.iso2);
|
||||
checkboxDiv.appendChild(checkbox);
|
||||
checkboxDiv.appendChild(label);
|
||||
dropdownContent.appendChild(checkboxDiv);
|
||||
|
||||
// Add event listener to checkbox change
|
||||
checkbox.addEventListener('change', function() {
|
||||
updateSelectedStateDisplay();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function toggleDropdown() {
|
||||
const dropdownContent = document.getElementById('stateDropdown');
|
||||
dropdownContent.classList.toggle('show');
|
||||
}
|
||||
|
||||
// Update the selected state display
|
||||
function updateSelectedStateDisplay() {
|
||||
const selectedStates = Array.from(document.querySelectorAll('input[name="states[]"]:checked'))
|
||||
.map(checkbox => checkbox.parentNode.querySelector('label').textContent);
|
||||
const selectedStateDisplay = document.getElementById('selectedStateDisplay');
|
||||
selectedStateDisplay.textContent = 'Selected States: ' + selectedStates.join(', ');
|
||||
}
|
||||
|
||||
// Add an event listener to the button
|
||||
document.getElementById('selectStatesBtn').addEventListener('click', function(event) {
|
||||
// Prevent the default form submission behavior
|
||||
event.preventDefault();
|
||||
// Toggle the dropdown visibility
|
||||
toggleDropdown();
|
||||
});
|
||||
fetchStates();
|
||||
</script>
|
||||
<style>
|
||||
.dropdown {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
border: 1px solid #363650;
|
||||
border-radius: 5px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dropbtn {
|
||||
border: 1px solid #363650;
|
||||
padding: 6px;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dropdown-content {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #f9f9f9;
|
||||
/* min-width: 160px; */
|
||||
width: 100%;
|
||||
overflow-y: auto;
|
||||
max-height: 230px; /* Adjust as needed */
|
||||
border: 1px solid #ddd;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.dropdown-content div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.dropdown-content div label {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.dropdown-content div:hover {
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
.show {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* For small screens */
|
||||
@media screen and (max-width: 767px) {
|
||||
#stateCheckboxes {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr); /* 2 columns */
|
||||
gap: 10px; /* Adjust the gap as needed */
|
||||
}
|
||||
}
|
||||
|
||||
/* For large screens */
|
||||
@media screen and (min-width: 768px) {
|
||||
#stateCheckboxes {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr); /* 3 columns */
|
||||
gap: 10px; /* Adjust the gap as needed */
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,138 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch(PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$select_access = ['beanstalk', 'inhouse', 'teenybeans', 'iimtt', 'buzzapp', 'atheneum', 'teenybeans_curriculum'];
|
||||
$access_values_array = [];
|
||||
|
||||
foreach ($select_access as $access) {
|
||||
if (isset($_POST[$access])) {
|
||||
$access_values_array[] = $_POST[$access];
|
||||
}
|
||||
}
|
||||
$access_value = implode(',', $access_values_array);
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$phone = $_POST['phone'];
|
||||
$password = md5($_POST['pass']);
|
||||
$selected_states = implode(',', $_POST['selectedStates']); // Collect selected state values
|
||||
|
||||
try {
|
||||
$stmt = $conn->prepare("INSERT INTO users (name, email, mobile, access, pass, states) VALUES (:name, :email, :mobile, :access, :pass, :states)");
|
||||
$stmt->bindParam(':name', $name);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':mobile', $phone);
|
||||
$stmt->bindParam(':access', $access_value);
|
||||
$stmt->bindParam(':pass', $password);
|
||||
$stmt->bindParam(':states', $selected_states); // Bind selected states
|
||||
$stmt->execute();
|
||||
|
||||
echo "Record added successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; margin-top: 30px; margin-bottom: 30px;">
|
||||
<form action="" method="post" style="width: 600px; max-width: 600px; border: 1px solid #36365050; padding: 20px; border-radius: 20px; box-shadow: 0px 0px 10px 0px #363650;">
|
||||
<p style="font-size: 25px; font-weight: bold; margin-top: 10px; margin-bottom: 10px;">Add new user</p>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" name="name" id="name" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="email">E-mail:</label>
|
||||
<input type="text" name="email" id="email" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="phone">Phone:</label>
|
||||
<input type="text" name="phone" id="phone" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<p>Access:</p>
|
||||
<?php
|
||||
try {
|
||||
$stmt = $conn->prepare("SELECT * FROM business_verticals");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows >= 1) {
|
||||
foreach($rows as $row){ ?>
|
||||
<div>
|
||||
<input type="checkbox" name="<?php echo $row['bv']; ?>" id="<?php echo $row['bv']; ?>" value="<?php echo $row['bv']; ?>" />
|
||||
<label for="<?php echo $row['bv']; ?>" style="text-transform: uppercase;"><?php echo $row['bv']; ?></label>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
} else{
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<p style="font-size: 16px; font-weight: bold; margin-top: 10px;">Access by state:</p>
|
||||
<div class="" id="stateList"><!-- State checkboxes will be dynamically added here --></div>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="pass">Password:</label>
|
||||
<input type="text" name="pass" id="pass" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<input type="submit" name="submit" id="submit" value="Submit" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; padding: 10px 20px 10px 20px; color: #fff; border-radius: 6px; float: right; margin-top: 30px;" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
// JavaScript code to fetch data and populate checkboxes
|
||||
fetch(`https://api.siliconpin.com/v3/list/country/state/?country=IN`)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
const stateList = document.getElementById('stateList');
|
||||
data.forEach(state => {
|
||||
const checkbox = document.createElement('input');
|
||||
checkbox.type = 'checkbox';
|
||||
checkbox.value = state.iso2;
|
||||
checkbox.name = 'selectedStates[]'; // Adjust name as per your form's needs
|
||||
|
||||
const label = document.createElement('label');
|
||||
label.appendChild(checkbox);
|
||||
label.appendChild(document.createTextNode('\u00A0' + state.name)); // Adding a non-breaking space before the state name
|
||||
|
||||
stateList.appendChild(label);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
|
||||
|
||||
/* For small screens */
|
||||
@media screen and (max-width: 767px) {
|
||||
#stateList {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr); /* 2 columns */
|
||||
gap: 10px; /* Adjust the gap as needed */
|
||||
}
|
||||
}
|
||||
|
||||
/* For large screens */
|
||||
@media screen and (min-width: 768px) {
|
||||
#stateList {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr); /* 3 columns */
|
||||
gap: 10px; /* Adjust the gap as needed */
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,127 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
|
||||
if($_SERVER['REQUEST_METHOD'] == "POST" && $_POST['bv'] && $_POST['save_lead'] ){
|
||||
try {
|
||||
$lowercase_bv = strtolower($_POST['bv']);
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("INSERT INTO business_verticals (bv) VALUES (:bv)");
|
||||
$stmt->bindParam(':bv', $lowercase_bv);
|
||||
$stmt->execute();
|
||||
echo "Record added successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<button onclick="toggleDisplay();" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; padding: 10px 20px 10px 20px; color: #fff; border-radius: 6px; float: right; margin-top: 100px; margin-bottom: 30px;">Add Business Verticals</button>
|
||||
</div>
|
||||
<div class="add-bv-form" id="add-bv-form">
|
||||
<div class="flex flex-row place-content-between" style="border-bottom: 2px solid #464E5F; border-style: dashed;">
|
||||
<h3 style="font-size: 25px; font-weight: bold;">Add new Business Verticals</h3>
|
||||
<p onclick="toggleDisplay();" class="rounded-lg px-1.5 text-[#464E5F] text-[25px] cursor-pointer" style="border: 2px solid #464E5F; border-radius: 50%;">✘</p>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="flex flex-col mt-4">
|
||||
<label for="bv">Business Verticals Name:</label>
|
||||
<input type="text" name="bv" id="bv" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" name="save_lead" id="submit" value="Save" style="color:#fff; border-radius: 6px; background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; margin-top: 10px; padding: 10px 20px 10px 20px;" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<table class="bg-[#fff] text-[#3F4254] rounded-lg font-bold" style="">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center border-b-2 p-3">Serial</th>
|
||||
<th class="text-center border-b-2 p-3">Business Verticals</th>
|
||||
<th class="text-center border-b-2 p-3">Time</th>
|
||||
<th class="text-center border-b-2 p-3">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<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 business_verticals ORDER BY time DESC");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
foreach($rows as $row){
|
||||
?>
|
||||
<tr>
|
||||
<td class="border-y-2 p-2 text-center"><?php echo $bv_counter; ?></td>
|
||||
<td class="border-y-2 p-2 uppercase"><?php echo $row['bv']; ?></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-business-verticals/?id=<?php echo $row['id']; ?>">Edit</a> |
|
||||
<a href="/admin/delete-business-verticals/?id=<?php echo $row['id']; ?>">Delete</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php $bv_counter++; }
|
||||
$num_rows = $stmt->rowCount();
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
function toggleDisplay() {
|
||||
var element = document.getElementById('add-bv-form');
|
||||
if (element.style.display === 'block') {
|
||||
element.style.display = 'none';
|
||||
} else {
|
||||
element.style.display = 'block';
|
||||
element.classList.add('slide-in-animation'); // Add class to trigger animation
|
||||
}
|
||||
}
|
||||
|
||||
// Event listener for the Esc key
|
||||
document.addEventListener('keydown', function(event) {
|
||||
if (event.keyCode === 27) {
|
||||
var modal = document.getElementById('add-bv-form');
|
||||
if (modal.style.display === 'block') {
|
||||
modal.style.display = 'none';
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.add-bv-form {
|
||||
background-color: #F8F8F8;
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0%;
|
||||
right: 0%;
|
||||
transform: translateX(100%);
|
||||
/* transform: translate(-0%, -50%); */
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
box-shadow: 0px 0px 20px 0px #443780;
|
||||
border-radius: 2px;
|
||||
z-index: 100;
|
||||
height: 100%;
|
||||
padding: 10px 20px 10px 20px;
|
||||
animation: slideInRight 0.5s forwards; /* Animation to slide in */
|
||||
/* overflow-x: auto; */
|
||||
}
|
||||
@keyframes slideInRight {
|
||||
from {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
to {
|
||||
transform: translateX(0%);
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,525 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
// deleteCofermation()
|
||||
$today_date = date("Y-m-d");
|
||||
$next_day = date("Y-m-d", strtotime("+1 day"));
|
||||
$yesterday = date("Y-m-d", strtotime("-1 day"));
|
||||
$this_week = date("Y-m-d", strtotime("-7 day"));
|
||||
$prev_month_date = date("Y-m-d", strtotime("first day of previous month", strtotime($today_date)));
|
||||
$firstDayOfCurrentMonth = date("Y-m-01");
|
||||
$firstDayOfLastMonth = date("Y-m-01", strtotime("first day of last month"));
|
||||
$firstDateOfYear = date("Y") . '-01-01';
|
||||
$previousYear = date("Y") - 1;
|
||||
$firstDateOfPreviousYear = $previousYear . '-01-01';
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch(PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['new_lead']) && $_POST['new_lead'] && isset($_POST['name']) && $_POST['name'] && isset($_POST['phone']) && $_POST['phone']) {
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$phone = $_POST['phone'];
|
||||
$formname = 'crm-portal';
|
||||
$note = $_POST['note'];
|
||||
$origin = $_POST['origin'];
|
||||
$gender = $_POST['gender'];
|
||||
$profession = $_POST['profession'];
|
||||
$country = $_POST['country'];
|
||||
$state = $_POST['state'];
|
||||
$city = $_POST['city'];
|
||||
$address = $_POST['address'];
|
||||
$status = 'New';
|
||||
try {
|
||||
$stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, origin, status, gender, profession, country, state, city, address ) VALUES (:name, :email, :phone, :formname, :note, :origin, :status, :gender, :profession, :country, :state, :city, :address)");
|
||||
$stmt->bindParam(':name', $name);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':phone', $phone);
|
||||
$stmt->bindParam(':formname', $formname);
|
||||
$stmt->bindParam(':note', $note);
|
||||
$stmt->bindParam(':origin', $origin);
|
||||
$stmt->bindParam(':status', $status);
|
||||
$stmt->bindParam(':gender', $gender);
|
||||
$stmt->bindParam(':profession', $profession);
|
||||
$stmt->bindParam(':country', $country);
|
||||
$stmt->bindParam(':state', $state);
|
||||
$stmt->bindParam(':city', $city);
|
||||
$stmt->bindParam(':address', $address);
|
||||
$stmt->execute();
|
||||
echo "Record added successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(isset($_POST['delete_records'])) {
|
||||
if(isset($_POST['selected_records']) && !empty($_POST['selected_records'])) {
|
||||
$selectedIds = $_POST['selected_records'];
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$delete_placeholders = rtrim(str_repeat('?,', count($selectedIds)), ',');
|
||||
$stmt = $conn->prepare("DELETE FROM cleads WHERE id IN ($delete_placeholders)");
|
||||
foreach($selectedIds as $key => $id) {
|
||||
$stmt->bindValue($key + 1, $id, PDO::PARAM_INT);
|
||||
}
|
||||
$stmt->execute();
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<p class="text-[28px] font-bold p-4">Lead Management</p>
|
||||
<div id="page-body" class="flex flex-row place-content-between px-4">
|
||||
<dialog>
|
||||
<button style="float: right; color: #FF0000; font-size: 25px; padding: 6px;">✘</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>
|
||||
</div>
|
||||
<form method="GET" class="p-6 flex flex-col pb-10">
|
||||
<p>Choose Date for filter</p>
|
||||
<div class="flex flex-row rounded-xl py-10">
|
||||
<div class="flex flex-row place-items-center">
|
||||
<label for="start_date">From Date</label>
|
||||
<input type="date" name="start_date" id="start_date" />
|
||||
</div> |
|
||||
<div class="flex flex-row place-items-center">
|
||||
<label for="end_date">To Date</label>
|
||||
<input type="date" name="end_date" id="end_date" />
|
||||
</div>
|
||||
</div>
|
||||
<button class="rounded-lg p-1 text-[#fff]" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center;" type="submit"><p class="text-center p-1.5">Search</p></button>
|
||||
</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>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<table class="bg-[#fff] text-[#3F4254] rounded-lg font-bold" style="width: 100%;" >
|
||||
<thead>
|
||||
<tr>
|
||||
<?php
|
||||
if($_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>
|
||||
<div class="flex flex-row space-x-4">
|
||||
<p onclick="deleteCofermation();" class="rounded-lg p-2 text-[#443780] mr-4" style="border: 2px solid #443780; cursor: pointer;">No</p>
|
||||
<button class="rounded-lg p-3 text-[#fff]" type="submit" name="delete_records" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%);">Yes</button>
|
||||
</div>
|
||||
</div>
|
||||
</th>';
|
||||
?>
|
||||
<th class="text-center border-b-2 p-3">Name</th>
|
||||
<th class="text-center border-b-2 p-3">ID</th>
|
||||
<th class="text-center border-b-2 p-3">Status Update</th>
|
||||
<!-- <th class="text-center border-b-2 p-3">Contact Detail</th> -->
|
||||
<th class="text-center border-b-2 p-3">Form Name</th>
|
||||
<th class="text-center border-b-2 p-3">Date</th>
|
||||
<th class="text-center border-b-2 p-3">Quick Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody >
|
||||
<?php
|
||||
// Number of records per page
|
||||
$recordsPerPage = 500;
|
||||
|
||||
// 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);
|
||||
$searchQuery = isset($_GET['search']) ? trim($_GET['search']) : '';
|
||||
$start_date = isset($_GET['start_date']) ? $_GET['start_date'] : '';
|
||||
$end_date = isset($_GET['end_date']) ? $_GET['end_date'] : '';
|
||||
|
||||
$accessArray = explode(",", $_SESSION['access']);
|
||||
$placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,?
|
||||
$placeholderString = implode(',', array_fill(0, count($accessArray), '?'));
|
||||
|
||||
if (!empty($searchQuery)) {
|
||||
// this is keywords search
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE (id LIKE ? OR name LIKE ? OR email LIKE ? OR phone LIKE ?) ORDER BY time DESC LIMIT ?, ?");
|
||||
$stmt->bindValue(1, "%$searchQuery%", PDO::PARAM_STR);
|
||||
$stmt->bindValue(2, "%$searchQuery%", PDO::PARAM_STR);
|
||||
$stmt->bindValue(3, "%$searchQuery%", PDO::PARAM_STR);
|
||||
$stmt->bindValue(4, "%$searchQuery%", PDO::PARAM_STR);
|
||||
|
||||
$stmt->bindValue( 5, 0, PDO::PARAM_INT); // Offset for pagination
|
||||
$stmt->bindValue( 6, $recordsPerPage, PDO::PARAM_INT); // Records per page
|
||||
// this is for date serch
|
||||
}elseif (!empty($start_date) && !empty($end_date)) {
|
||||
$start_date = date('Y-m-d', strtotime($start_date));
|
||||
$end_date = date('Y-m-d', strtotime($end_date));
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE time BETWEEN ? AND ?");
|
||||
$stmt->bindValue(1, $start_date);
|
||||
$stmt->bindValue(2, $end_date);
|
||||
}else{
|
||||
// if user type admin then show all lead
|
||||
if($_SESSION['user_type'] == 'admin'){
|
||||
$stmt = $conn->prepare("SELECT COUNT(*) FROM cleads");
|
||||
$stmt->execute();
|
||||
$totalRecords = $stmt->fetchColumn();
|
||||
|
||||
$totalPages = ceil($totalRecords / $recordsPerPage);
|
||||
|
||||
$offset = ($currentPage - 1) * $recordsPerPage;
|
||||
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads ORDER BY time DESC LIMIT :offset, :recordsPerPage");
|
||||
$stmt->bindParam(':offset', $offset, PDO::PARAM_INT);
|
||||
$stmt->bindParam(':recordsPerPage', $recordsPerPage, PDO::PARAM_INT);
|
||||
}else{
|
||||
}
|
||||
}
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$row_count = count($rows);
|
||||
for ($i = 0; $i < $row_count; $i++) {
|
||||
// echo $row_count . " ";
|
||||
}
|
||||
echo "<p class='px-4'>Total ".$row_count." Rows Found</p>";
|
||||
// Status Conditional Color
|
||||
foreach($rows as $row){
|
||||
$only_date = explode(' ', $row['time']);
|
||||
$lead_id = $row['id'];
|
||||
if($row['status'] == 'New'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';}
|
||||
elseif($row['status'] == 'Contacted'){$conditional_background_color = 'background-color: #D4FFFF; border: 2px solid #2C9C9C; border-radius: 20px; text-align: center; color: #2C9C9C;';}
|
||||
elseif($row['status'] == 'Disqualified'){$conditional_background_color = 'background-color: #CECECE; border: 2px solid #3F4254; border-radius: 20px; text-align: center; color: #3F4254;';}
|
||||
elseif($row['status'] == 'Converted'){$conditional_background_color = 'background-color: #D4FDE7; border: 2px solid #40916C; border-radius: 20px; text-align: center; color: #40916C;';}
|
||||
elseif($row['status'] == 'Warm'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';}
|
||||
// if status = warm then select
|
||||
// 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>
|
||||
<?php if($_SESSION['user_type'] == 'admin'){?>
|
||||
<td class="border-y-2 p-2">
|
||||
<input type="checkbox" name="selected_records[]" value="<?php echo $row['id']; ?>" id="<?php echo $row['id']; ?>" />
|
||||
</td>
|
||||
<?php }?>
|
||||
<td class="border-y-2 p-2"><label for="<?php echo $row['id']; ?>"><?php echo $row['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 $row['id'] ?>"><?php echo $row['id'] ?></a></td>
|
||||
<td class="border-y-2 p-2"><div style="<?php echo $conditional_background_color; ?> font-weight: bold;"><?php echo $row['status'];?></div></td>
|
||||
<!-- <td class="border-y-2 p-2">
|
||||
<p><i class="fa fa-envelope"> <?php // echo $row['email'] ?></i></p>
|
||||
<p><i class="fa fa-phone"> <?php // echo $row['phone'] ?></i></p>
|
||||
</td> -->
|
||||
<td class="border-y-2 p-2"><?php echo $row['formname'] ?></td>
|
||||
<td class="border-y-2 p-2"><?php echo $only_date[0]; ?></td>
|
||||
<td class="border-y-2 p-2">
|
||||
<div class="flex flex-row justify-center place-items-center">
|
||||
<i class="fa fa-envelope" style="font-size: 20px"></i>
|
||||
<div>
|
||||
<a href="https://wa.me/<?php echo $row['phone'] ?>?text=Hello%2C%20how%20are%20you%3F"><i class="fab fa-whatsapp" style="font-size: 20px"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<!-- Pagination Links -->
|
||||
<div class="pagination">
|
||||
<?php if ($currentPage > 1): ?>
|
||||
<a href="?page=<?php echo ($currentPage - 1); ?>">Previous</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php for ($i = 1; $i <= $totalPages; $i++): ?>
|
||||
<a href="?page=<?php echo $i; ?>" <?php if ($i === $currentPage) echo 'class="active"'; ?>><?php echo $i; ?></a>
|
||||
<?php endfor; ?>
|
||||
|
||||
<?php if ($currentPage < $totalPages): ?>
|
||||
<a href="?page=<?php echo ($currentPage + 1); ?>">Next</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- New Lead Form Section -->
|
||||
<div id="add-lead-form" class="add-lead-form">
|
||||
<div class="flex flex-row place-content-between p-2" style="border-bottom: 2px solid #464E5F; border-style: dashed;">
|
||||
<p class="text-[25px] font-bold">Add Lead</p>
|
||||
<p onclick="toggleDisplay();" class="rounded-lg px-1.5 text-[#464E5F] text-[25px] cursor-pointer" style="border: 2px solid #464E5F; border-radius: 50%;">✘</p>
|
||||
</div>
|
||||
<form action="" method="post" class="p-4">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2">
|
||||
<div class="flex flex-col mr-4">
|
||||
<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>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="state"> State:</label>
|
||||
<select name="state" id="state" onchange="fetchCities()" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;">
|
||||
<option value="">Select State</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="city"> City:</label>
|
||||
<select name="city" id="city" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;">
|
||||
<option value="">Select City</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="address">Address:</label>
|
||||
<input class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="address" id="address" />
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="name">Name:</label>
|
||||
<input class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="name" id="name" />
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="gender">Gender:</label>
|
||||
<select class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="gender" id="gender" >
|
||||
<option value="Male">Male</option>
|
||||
<option value="Female">Female</option>
|
||||
<option value="Others">Others</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="profession">Profession:</label>
|
||||
<input class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="profession" id="profession" />
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="email">E-mail:</label>
|
||||
<input class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="email" id="email" />
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="phone">Phone:</label>
|
||||
<input class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="phone" id="phone" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row place-content-between p-2 text-[25px] font-bold" style="border-bottom: 2px solid #464E5F; border-style: dashed;">Lead Information</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2">
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="origin">Details:</label>
|
||||
<select class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="origin" id="origin" >
|
||||
<option value="Facebook Ads">Facebook Ads</option>
|
||||
<option value="Google Ads">Google Ads</option>
|
||||
<option value="Linkedin Ads">Linkedin Ads</option>
|
||||
<option value="Instagram">Instagram</option>
|
||||
<option value="Messenger">Messenger</option>
|
||||
<option value="Whatsapp">Whatsapp</option>
|
||||
<option value="GMB">GMB</option>
|
||||
<option value="Linkedin">Linkedin</option>
|
||||
<option value="Inbound Call">Inbound Call</option>
|
||||
<option value="Outbound Call">Outbound Call</option>
|
||||
<option value="Others">Others</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="user">Lead Owner:</label>
|
||||
<select class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="user" id="user" >
|
||||
<?php
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("SELECT * FROM users");
|
||||
$stmt->execute();
|
||||
$users_rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$row_count = count($users_rows);
|
||||
if($row_count > 0){
|
||||
foreach($users_rows as $users_data){
|
||||
echo '<option value="'.$users_data['email'].'">'.$users_data['email'].'</option>';
|
||||
}
|
||||
} else{
|
||||
echo '<p>No users Found</p>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="note">Note:</label>
|
||||
<textarea type="text" name="note" id="note" rows="6" cols="10" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;"></textarea>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<input class="p-2" type="submit" name="new_lead" id="new_lead" value="Submit" style="color:#fff; border-radius: 6px; background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; margin-top: 10px;"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
// 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 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();
|
||||
|
||||
const dialog = document.querySelector("dialog");
|
||||
const showButton = document.querySelector("dialog + button");
|
||||
const closeButton = document.querySelector("dialog button");
|
||||
|
||||
// "Show the dialog" button opens the dialog modally
|
||||
showButton.addEventListener("click", () => {
|
||||
dialog.showModal();
|
||||
});
|
||||
|
||||
// "Close" button closes the dialog
|
||||
closeButton.addEventListener("click", () => {
|
||||
dialog.close();
|
||||
});
|
||||
function toggleDisplay() {
|
||||
var element = document.getElementById('add-lead-form');
|
||||
if (element.style.display === 'block') {
|
||||
element.style.display = 'none';
|
||||
} else {
|
||||
element.style.display = 'block';
|
||||
element.classList.add('slide-in-animation'); // Add class to trigger animation
|
||||
}
|
||||
}
|
||||
|
||||
// Event listener for the Esc key
|
||||
document.addEventListener('keydown', function(event) {
|
||||
if (event.keyCode === 27) {
|
||||
var modal = document.getElementById('add-lead-form');
|
||||
if (modal.style.display === 'block') {
|
||||
modal.style.display = 'none';
|
||||
}
|
||||
}
|
||||
});
|
||||
function deleteCofermation(){
|
||||
let deleteButton = document.getElementById('delete-button');
|
||||
let leadID = document.getElementById('<?php echo $row['id']; ?>').value;
|
||||
if(leadID != null){
|
||||
if(deleteButton.style.display === 'flex'){
|
||||
deleteButton.style.display = 'none';
|
||||
}else{
|
||||
deleteButton.style.display = 'flex'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.add-lead-form {
|
||||
background-color: #F8F8F8;
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0%;
|
||||
right: 0%;
|
||||
transform: translateX(100%);
|
||||
/* transform: translate(-0%, -50%); */
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
box-shadow: 0px 0px 20px 0px #443780;
|
||||
border-radius: 2px;
|
||||
z-index: 100;
|
||||
height: 100%;
|
||||
animation: slideInRight 0.5s forwards; /* Animation to slide in */
|
||||
/* overflow-x: auto; */
|
||||
}
|
||||
|
||||
@keyframes slideInRight {
|
||||
from {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
to {
|
||||
transform: translateX(0%);
|
||||
}
|
||||
}
|
||||
/* .add-lead-form{
|
||||
background-color: #F8F8F8;
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
right: 0%;
|
||||
transform: translate(-0%, -50%);
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
box-shadow: 0px 0px 20px 0px #443780;
|
||||
border-radius: 5px;
|
||||
z-index: 100;
|
||||
height: 100%;
|
||||
} */
|
||||
.delete-confirm{
|
||||
position: fixed;
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
background-color: #E6E5F4;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
padding: 40px 50px 40px 50px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
if($_SERVER['REQUEST_METHOD'] == "POST"){
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$stmt = $conn->prepare("DELETE FROM business_verticals WHERE id = :id");
|
||||
$stmt->bindParam(':id', $_POST['id']);
|
||||
$stmt->execute();
|
||||
|
||||
echo '<script>window.location.href = "/admin/business-verticals";</script>';
|
||||
exit();
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="delete-div">
|
||||
<form method="post">
|
||||
<p style="font-size: 20px; padding: 10px 0px 10px 0px;">Confirm to Delete id <?php echo $_GET['id']; ?>? </p>
|
||||
<input type="hidden" name="id" value="<?php echo $_GET['id']; ?>">
|
||||
<input type="submit" name="submit" id="submit" value="YES" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; padding: 9px 20px 9px 20px; color: #fff; border-radius: 6px; cursor: pointer;" />
|
||||
<a href="/admin/business-verticals" style="border:3px solid #443780; text-align: center; padding: 10px 20px 10px 20px; color: #443780; border-radius: 6px;">NO</a>
|
||||
</form>
|
||||
</div>
|
||||
<style>
|
||||
.delete-div{
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background: #E6E5F4;
|
||||
max-width: 500px;
|
||||
min-width: 400px;
|
||||
padding: 30px 50px 30px 50px;
|
||||
border-radius: 9px
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
if($_SERVER['REQUEST_METHOD'] == "POST"){
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$stmt = $conn->prepare("DELETE FROM users WHERE id = :id");
|
||||
$stmt->bindParam(':id', $_POST['id']);
|
||||
$stmt->execute();
|
||||
echo '<script>window.location.href = "/admin/users";</script>';
|
||||
exit();
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="delete-div">
|
||||
<form method="post">
|
||||
<p style="font-size: 20px; padding: 10px 0px 10px 0px;">Confirm to Delete id <?php echo $_GET['id']; ?>? </p>
|
||||
<input type="hidden" name="id" value="<?php echo $_GET['id']; ?>">
|
||||
<input type="submit" name="submit" id="submit" value="YES" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; padding: 9px 20px 9px 20px; color: #fff; border-radius: 6px; cursor: pointer;" />
|
||||
<a href="/admin/users" style="border:3px solid #443780; text-align: center; padding: 10px 20px 10px 20px; color: #443780; border-radius: 6px;">NO</a>
|
||||
</form>
|
||||
</div>
|
||||
<style>
|
||||
.delete-div{
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background: #E6E5F4;
|
||||
max-width: 500px;
|
||||
min-width: 400px;
|
||||
padding: 30px 50px 30px 50px;
|
||||
border-radius: 9px
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
|
||||
if($_SERVER['REQUEST_METHOD']=="POST"){
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("UPDATE business_verticals SET bv = :bv WHERE id = :id");
|
||||
$stmt->bindParam(':bv', $_POST['bv']);
|
||||
$stmt->bindParam(':id', $_GET['id']);
|
||||
$stmt->execute();
|
||||
|
||||
echo "Record 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);
|
||||
$stmt = $conn->prepare("SELECT * FROM business_verticals WHERE id=:id");
|
||||
$stmt->bindParam(":id", $_GET['id']);
|
||||
$stmt->execute();
|
||||
$bvrows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
foreach($bvrows as $bvname){ ?>
|
||||
<div>
|
||||
<form method="post">
|
||||
<input type="text" name="bv" id="bv" value="<?php echo $bvname['bv']; ?>" />
|
||||
<input type="submit" value="Update" id="submit" name="submit" />
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,130 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch(PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
|
||||
// $name = $_POST['name'];
|
||||
// $email = $_POST['email'];
|
||||
// $phone = $_POST['phone'];
|
||||
// $password = md5($_POST['pass']);
|
||||
try {
|
||||
$select_access = ['beanstalk', 'inhouse', 'teenybeans', 'iimtt', 'buzzapp', 'atheneum', 'teenybeans_curriculum'];
|
||||
$access_values_array = [];
|
||||
|
||||
foreach ($select_access as $access) {
|
||||
if (isset($_POST[$access])) {
|
||||
$access_values_array[] = $_POST[$access];
|
||||
}
|
||||
}
|
||||
$access_value = implode(',', $access_values_array);
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$phone = $_POST['phone'];
|
||||
$password = md5($_POST['pass']);
|
||||
$user_id = $_GET['id'];
|
||||
$stmt = $conn->prepare("UPDATE users SET name = :name, email = :email, mobile = :mobile, access = :access, pass = :pass WHERE id = :id");
|
||||
$stmt->bindParam(':name', $name);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':mobile', $phone);
|
||||
$stmt->bindParam(':access', $access_value);
|
||||
$stmt->bindParam(':pass', $password);
|
||||
$stmt->bindParam(':id', $user_id);
|
||||
$stmt->execute();
|
||||
|
||||
echo "Record Updated successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?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 users WHERE id = :id");
|
||||
$stmt->bindParam(':id', $_GET['id']);
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows >= 1) {
|
||||
foreach($rows as $row){?>
|
||||
<div style="max-width: 600px;">
|
||||
<form action="" method="post">
|
||||
<p>Edit User</p>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" name="name" id="name" value="<?php echo $row['name'] ?>" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="email">E-mail:</label>
|
||||
<input type="text" name="email" id="email" value="<?php echo $row['email'] ?>" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="phone">Phone:</label>
|
||||
<input type="text" name="phone" id="phone" value="<?php echo $row['mobile'] ?>" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<p>Access:</p>
|
||||
<?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 business_verticals");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows >= 1) {
|
||||
$user_stmt = $conn->prepare("SELECT `access` FROM `users` WHERE `id` = '".$_GET["id"]."'");
|
||||
$user_stmt->execute();
|
||||
$user_bvs = $user_stmt->fetchAll(PDO::FETCH_COLUMN);
|
||||
$user_bvs=explode(",", $user_bvs[0]); // you need to make the CSV to array.
|
||||
foreach($rows as $row) {
|
||||
$isChecked = in_array($row['bv'], $user_bvs);
|
||||
?>
|
||||
<div>
|
||||
<input type="checkbox" name="<?php echo $row['bv']; ?>" id="<?php echo $row['bv']; ?>" value="<?php echo $row['bv']; ?>" <?php if($isChecked) echo "checked"; ?> />
|
||||
<label for="<?php echo $row['bv']; ?>" style="text-transform: uppercase;"><?php echo $row['bv']; ?></label>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="pass">Password:</label>
|
||||
<input type="text" name="pass" id="pass" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<input type="submit" name="submit" id="submit" value="Submit"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
} else{
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,191 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.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 users WHERE `id` = '".$_GET["id"]."'");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
foreach($rows as $row){
|
||||
$seletedState = explode(",", $row['states']);
|
||||
}
|
||||
}catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch(PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
|
||||
// $name = $_POST['name'];
|
||||
// $email = $_POST['email'];
|
||||
// $phone = $_POST['phone'];
|
||||
// $password = md5($_POST['pass']);
|
||||
try {
|
||||
$select_access = ['beanstalk', 'inhouse', 'teenybeans', 'iimtt', 'buzzapp', 'atheneum', 'teenybeans_curriculum'];
|
||||
$access_values_array = [];
|
||||
foreach ($select_access as $access) {
|
||||
if (isset($_POST[$access])) {
|
||||
$access_values_array[] = $_POST[$access];
|
||||
}
|
||||
}
|
||||
$access_value = implode(',', $access_values_array);
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$phone = $_POST['phone'];
|
||||
$password = md5($_POST['pass']);
|
||||
$user_id = $_GET['id'];
|
||||
$stmt = $conn->prepare("UPDATE users SET name = :name, email = :email, mobile = :mobile, access = :access, pass = :pass WHERE id = :id");
|
||||
$stmt->bindParam(':name', $name);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':mobile', $phone);
|
||||
$stmt->bindParam(':access', $access_value);
|
||||
$stmt->bindParam(':pass', $password);
|
||||
$stmt->bindParam(':id', $user_id);
|
||||
$stmt->execute();
|
||||
echo "Record 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);
|
||||
$stmt = $conn->prepare("SELECT * FROM users WHERE id = :id");
|
||||
$stmt->bindParam(':id', $_GET['id']);
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows >= 1) {
|
||||
foreach($rows as $row){?>
|
||||
<div class="flex flex-col place-items-center mt-4">
|
||||
<form action="" method="post" class="max-w-2xl shadow-xl p-4 rounded-lg">
|
||||
<p class="my-4" style="border-bottom: 2px solid #464E5F; border-style: dashed; font-size: 20px; font-weight: bold" >Edit User</p>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" name="name" id="name" value="<?php echo $row['name'] ?>" />
|
||||
</div>
|
||||
<div class="flex flex-row">
|
||||
<div style="display: flex; flex-direction: column; width: 100%;">
|
||||
<label for="email">E-mail:</label>
|
||||
<input type="text" name="email" id="email" value="<?php echo $row['email'] ?>" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column; width: 100%;">
|
||||
<label for="phone">Phone:</label>
|
||||
<input type="text" name="phone" id="phone" value="<?php echo $row['mobile'] ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<p style="font-weight: bold; ">Access:</p>
|
||||
<div class="bv-list">
|
||||
<?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 business_verticals");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows >= 1) {
|
||||
$user_stmt = $conn->prepare("SELECT `access` FROM `users` WHERE `id` = '".$_GET["id"]."'");
|
||||
$user_stmt->execute();
|
||||
$user_bvs = $user_stmt->fetchAll(PDO::FETCH_COLUMN);
|
||||
$user_bvs=explode(",", $user_bvs[0]); // you need to make the CSV to array.
|
||||
foreach($rows as $row) {
|
||||
$isChecked = in_array($row['bv'], $user_bvs);
|
||||
?>
|
||||
<div class="flex flex-row">
|
||||
<input type="checkbox" name="<?php echo $row['bv']; ?>" id="<?php echo $row['bv']; ?>" value="<?php echo $row['bv']; ?>" <?php if($isChecked) echo "checked"; ?> />
|
||||
<label for="<?php echo $row['bv']; ?>" style="text-transform: uppercase;"><?php echo $row['bv']; ?></label>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<p style="font-size: 16px; font-weight: bold; margin-top: 10px;">Access by state:</p>
|
||||
<div class="flex" id="stateList"><!-- State checkboxes will be dynamically added here --></div>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="pass">Password:</label>
|
||||
<input type="text" name="pass" id="pass" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<input type="submit" name="submit" id="submit" value="Submit" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; padding: 6px; color: #fff; border-radius: 6px; margin-top: 6px;" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
} else{
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
|
||||
?>
|
||||
<script>
|
||||
// JavaScript code to fetch data and populate checkboxes
|
||||
fetch(`https://api.siliconpin.com/v3/list/country/state/?country=IN`)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
const stateList = document.getElementById('stateList');
|
||||
data.forEach(state => {
|
||||
const checkbox = document.createElement('input');
|
||||
checkbox.type = 'checkbox';
|
||||
checkbox.value = state.iso2;
|
||||
checkbox.name = 'selectedStates[]'; // Adjust name as per your form's needs
|
||||
|
||||
const label = document.createElement('label');
|
||||
label.appendChild(checkbox);
|
||||
label.appendChild(document.createTextNode('\u00A0' + state.name)); // Adding a non-breaking space before the state name
|
||||
<?php
|
||||
foreach($seletedState as $pre_state){
|
||||
?>
|
||||
if("<?php echo $pre_state; ?>".includes(state.iso2)) {
|
||||
checkbox.checked = true;
|
||||
}
|
||||
<?php } ?>
|
||||
stateList.appendChild(label);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
/* For small screens */
|
||||
@media screen and (max-width: 767px) {
|
||||
#stateList, .bv-list {
|
||||
font-size: 15px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr); /* 2 columns */
|
||||
gap: 6px; /* Adjust the gap as needed */
|
||||
}
|
||||
}
|
||||
|
||||
/* For large screens */
|
||||
@media screen and (min-width: 768px) {
|
||||
#stateList, .bv-list {
|
||||
font-size: 15px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr); /* 3 columns */
|
||||
gap: 6px; /* Adjust the gap as needed */
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,240 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch(PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST['name'] && $_POST['pass'] && $_POST['email']) {
|
||||
$select_access = ['beanstalk', 'inhouse', 'teenybeans', 'iimtt', 'buzzapp', 'atheneum', 'teenybeans_curriculum'];
|
||||
$access_values_array = [];
|
||||
|
||||
foreach ($select_access as $access) {
|
||||
if (isset($_POST[$access])) {
|
||||
$access_values_array[] = $_POST[$access];
|
||||
}
|
||||
}
|
||||
$access_value = implode(',', $access_values_array);
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$phone = $_POST['phone'];
|
||||
$password = md5($_POST['pass']);
|
||||
$selected_states = implode(',', $_POST['selectedStates']); // Collect selected state values
|
||||
|
||||
try {
|
||||
$stmt = $conn->prepare("INSERT INTO users (name, email, mobile, access, pass, states) VALUES (:name, :email, :mobile, :access, :pass, :states)");
|
||||
$stmt->bindParam(':name', $name);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':mobile', $phone);
|
||||
$stmt->bindParam(':access', $access_value);
|
||||
$stmt->bindParam(':pass', $password);
|
||||
$stmt->bindParam(':states', $selected_states); // Bind selected states
|
||||
$stmt->execute();
|
||||
|
||||
echo "Record added successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<button onclick="toggleDisplay();" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; padding: 10px 20px 10px 20px; color: #fff; border-radius: 6px; float: right; margin-top: 100px; margin-bottom: 30px;">Add Business Verticals</button>
|
||||
<a href="/admin/add-user" class="" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; padding: 10px 20px 10px 20px; color: #fff; border-radius: 6px; float: right; margin-top: 30px;">Add User</a>
|
||||
</div>
|
||||
<table class="bg-[#fff] text-[#3F4254] rounded-lg font-bold">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center border-b-2 p-3">Name</th>
|
||||
<th class="text-center border-b-2 p-3">Email</th>
|
||||
<th class="text-center border-b-2 p-3">Mobile</th>
|
||||
<th class="text-center border-b-2 p-3">Time</th>
|
||||
<th class="text-center border-b-2 p-3">Access</th>
|
||||
<th class="text-center border-b-2 p-3">Access by State</th>
|
||||
<th class="text-center border-b-2 p-3">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?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 users");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
foreach($rows as $row){
|
||||
?>
|
||||
<tr>
|
||||
<td class="border-y-2 p-2"><?php echo $row['name']; ?></td>
|
||||
<td class="border-y-2 p-2"><?php echo $row['email']; ?></td>
|
||||
<td class="border-y-2 p-2"><?php echo $row['mobile']; ?></td>
|
||||
<td class="border-y-2 p-2"><?php echo $row['time']; ?></td>
|
||||
<td class="border-y-2 p-2"><?php echo $row['access']; ?></td>
|
||||
<td class="border-y-2 p-2"><?php echo $row['states']; ?></td>
|
||||
<td class="border-y-2 p-2">
|
||||
<div class="flex flex-row justify-center">
|
||||
<a href="/admin/edit-user/?id=<?php echo $row['id']; ?>">Edit</a> |
|
||||
<a href="/admin/delete-user/?id=<?php echo $row['id']; ?>">Delete</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
$num_rows = $stmt->rowCount();
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="add-user-form" id="add-user-form">
|
||||
<form action="" method="post" style="">
|
||||
<div class="flex flex-row place-content-between" style="border-bottom: 2px solid #464E5F; border-style: dashed;">
|
||||
<p style="font-size: 25px; font-weight: bold;">Add new user</p>
|
||||
<p onclick="toggleDisplay();" class="rounded-lg px-1.5 text-[#464E5F] text-[25px] cursor-pointer" style="border: 2px solid #464E5F; border-radius: 50%;">✘</p>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" name="name" id="name" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div class="flex flex-row space-x-2">
|
||||
<div style="display: flex; flex-direction: column; width: 100%;">
|
||||
<label for="email">E-mail:</label>
|
||||
<input type="text" name="email" id="email" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column; width: 100%;">
|
||||
<label for="phone">Phone:</label>
|
||||
<input type="text" name="phone" id="phone" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column; border-bottom: 1px solid #7E8299;">
|
||||
<p>Access:</p>
|
||||
<div class="bv-list">
|
||||
<?php
|
||||
try {
|
||||
$stmt = $conn->prepare("SELECT * FROM business_verticals");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows >= 1) {
|
||||
foreach($rows as $row){ ?>
|
||||
<div class="flex flex-row">
|
||||
<input type="checkbox" name="<?php echo $row['bv']; ?>" id="<?php echo $row['bv']; ?>" value="<?php echo $row['bv']; ?>" />
|
||||
<label for="<?php echo $row['bv']; ?>" style="text-transform: uppercase;"><?php echo $row['bv']; ?></label>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
} else{
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<p style="font-size: 16px; font-weight: bold; margin-top: 10px;">Access by state:</p>
|
||||
<div class="" id="stateList">
|
||||
<!-- State checkboxes will be dynamically added here -->
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="pass">Password:</label>
|
||||
<input type="text" name="pass" id="pass" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<input type="submit" name="submit" id="submit" value="Submit" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; padding: 10px 20px 10px 20px; color: #fff; border-radius: 6px; float: right; margin-top: 30px;" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
// JavaScript code to fetch data and populate checkboxes
|
||||
fetch(`https://api.siliconpin.com/v3/list/country/state/?country=IN`)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
const stateList = document.getElementById('stateList');
|
||||
data.forEach(state => {
|
||||
const checkbox = document.createElement('input');
|
||||
checkbox.type = 'checkbox';
|
||||
checkbox.value = state.iso2;
|
||||
checkbox.name = 'selectedStates[]'; // Adjust name as per your form's needs
|
||||
|
||||
const label = document.createElement('label');
|
||||
label.appendChild(checkbox);
|
||||
label.appendChild(document.createTextNode('\u00A0' + state.name)); // Adding a non-breaking space before the state name
|
||||
|
||||
stateList.appendChild(label);
|
||||
});
|
||||
});
|
||||
function toggleDisplay() {
|
||||
var element = document.getElementById('add-user-form');
|
||||
if (element.style.display === 'block') {
|
||||
element.style.display = 'none';
|
||||
} else {
|
||||
element.style.display = 'block';
|
||||
element.classList.add('slide-in-animation'); // Add class to trigger animation
|
||||
}
|
||||
}
|
||||
|
||||
// Event listener for the Esc key
|
||||
document.addEventListener('keydown', function(event) {
|
||||
if (event.keyCode === 27) {
|
||||
var modal = document.getElementById('add-user-form');
|
||||
if (modal.style.display === 'block') {
|
||||
modal.style.display = 'none';
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
|
||||
|
||||
/* For small screens */
|
||||
@media screen and (max-width: 767px) {
|
||||
#stateList, .bv-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr); /* 2 columns */
|
||||
gap: 10px; /* Adjust the gap as needed */
|
||||
}
|
||||
}
|
||||
|
||||
/* For large screens */
|
||||
@media screen and (min-width: 768px) {
|
||||
#stateList, .bv-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr); /* 3 columns */
|
||||
gap: 10px; /* Adjust the gap as needed */
|
||||
}
|
||||
}
|
||||
.add-user-form {
|
||||
background-color: #F8F8F8;
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0%;
|
||||
right: 0%;
|
||||
transform: translateX(100%);
|
||||
/* transform: translate(-0%, -50%); */
|
||||
width: 100%;
|
||||
max-width: 700px;
|
||||
box-shadow: 0px 0px 20px 0px #443780;
|
||||
border-radius: 2px;
|
||||
z-index: 100;
|
||||
height: 100%;
|
||||
padding: 10px 20px 10px 20px;
|
||||
animation: slideInRight 0.5s forwards; /* Animation to slide in */
|
||||
overflow-y: scroll;
|
||||
font-size: 15px;
|
||||
}
|
||||
@keyframes slideInRight {
|
||||
from {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
to {
|
||||
transform: translateX(0%);
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
if(isset($url[2])){
|
||||
$slug2="";
|
||||
if (strpos($url[2], "?") !== false) {
|
||||
$url2 = explode('?', $url[2]);
|
||||
$slug2=$url2[0];
|
||||
} else $slug2=$url[2];
|
||||
if($slug2=="") require_once('bv/_home.php');
|
||||
elseif(file_exists(__DIR__."/bv/".$slug2.".php")) include __DIR__."/bv/".$slug2.".php";
|
||||
else require_once('bv/.htac_404.php');
|
||||
}
|
||||
else require_once('bv/_home.php');
|
||||
|
||||
// uri - slug handler ends
|
||||
?>
|
|
@ -0,0 +1,3 @@
|
|||
<div>
|
||||
<a href="/bv/add-bv">Add Business Verticals</a>
|
||||
</div>
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
if(isset($url[2])){
|
||||
$slug2="";
|
||||
if (strpos($url[2], "?") !== false) {
|
||||
$url2 = explode('?', $url[2]);
|
||||
$slug2=$url2[0];
|
||||
} else $slug2=$url[2];
|
||||
if($slug2=="") require_once('cleads/_home.php');
|
||||
elseif(file_exists(__DIR__."/cleads/".$slug2.".php")) include __DIR__."/cleads/".$slug2.".php";
|
||||
else require_once('cleads/.htac_404.php');
|
||||
}
|
||||
else require_once('cleads/_home.php');
|
||||
|
||||
// uri - slug handler ends
|
||||
?>
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
// echo $_SESSION['access'];
|
||||
?>
|
||||
<?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 business_verticals");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if (count($rows) >= 1) {
|
||||
foreach($rows as $row){
|
||||
echo ' <div style="display: flex; flex-direction: row;">
|
||||
<a href="/cleads/by-business-verticals/?bv='.$row['bv'].'">'.$row['bv'].'</a>
|
||||
</div>';
|
||||
}
|
||||
} else {
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$accessArray = explode(",", $_SESSION['access']);
|
||||
$placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,?
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type IN ($placeholders) LIMIT 10");
|
||||
foreach ($accessArray as $key => $value) {
|
||||
$stmt->bindValue($key + 1, $value);
|
||||
}
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
echo '
|
||||
<div id="example-table"></div>
|
||||
|
||||
<link href="https://unpkg.com/tabulator-tables@6.2.0/dist/css/tabulator.min.css" rel="stylesheet">
|
||||
<script type="text/javascript" src="https://unpkg.com/tabulator-tables@6.2.0/dist/js/tabulator.min.js"></script>
|
||||
<script>
|
||||
//define data
|
||||
var tabledata = '.json_encode($rows).';
|
||||
|
||||
//define table
|
||||
var table = new Tabulator("#example-table", {
|
||||
data:tabledata,
|
||||
autoColumns:true,
|
||||
});
|
||||
</script>
|
||||
';
|
||||
$num_rows = $stmt->rowCount();
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
// echo $_SESSION['access'];
|
||||
?>
|
||||
|
||||
<div>
|
||||
<a style="float: right; padding: 10px;" href="/cleads/add-lead">Add Leads</a>
|
||||
</div>
|
||||
<?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 users WHERE email=:email");
|
||||
// $stmt->bindParam(':email', $_SESSION['email']);
|
||||
// $stmt->execute();
|
||||
// $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
// $num_rows = $stmt->rowCount();
|
||||
// foreach($rows as $row){
|
||||
// $user_access_data = explode(",", $row['access']);
|
||||
// foreach($user_access_data as $access_data){
|
||||
// echo '<div style="display: flex; flex-direction: row;"><a href="/cleads/by-business-verticals/?bv='.$access_data.'" style="margin: 10px;">'.$access_data.'</a></div>';
|
||||
// }
|
||||
// }
|
||||
// } catch (PDOException $e) {
|
||||
// echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
// };
|
||||
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
if($_SESSION['user_type'] == 'admin'){
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads ORDER BY time DESC");
|
||||
}else{
|
||||
$accessArray = explode(",", $_SESSION['access']);
|
||||
$placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,?
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type IN ($placeholders) ORDER BY time DESC");
|
||||
foreach ($accessArray as $key => $value) {
|
||||
$stmt->bindValue($key + 1, $value);
|
||||
}
|
||||
// $stmt->bindValue(":user", $_SESSION['email']);
|
||||
}
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
?>
|
||||
<div id="grid"></div>
|
||||
<script>
|
||||
const grid = new gridjs.Grid({
|
||||
columns: ["Name",{name: "ID", formatter: (cell) => {return gridjs.html(`<a href="/cleads/edit-lead/?id=${cell}">${cell}</a>`);}},"Status", "Email", "Phone", "Time", {name: "ID", formatter: (cell) => {return gridjs.html(`<a href="/cleads/delete-lead/?id=${cell}">Delete</a>`);}}],
|
||||
pagination: {limit: 100},
|
||||
search: true,
|
||||
sort: true,
|
||||
resizable: true,
|
||||
data: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve(<?php echo json_encode($rows); ?>);
|
||||
}, 1000);
|
||||
});
|
||||
},
|
||||
loading: true
|
||||
});
|
||||
grid.render(document.getElementById("grid"));
|
||||
</script>
|
||||
<?php
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
// echo $_SESSION['access'];
|
||||
?>
|
||||
<?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 business_verticals");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if (count($rows) >= 1) {
|
||||
foreach($rows as $row){
|
||||
echo ' <div style="display: flex; flex-direction: row;">
|
||||
<a href="/cleads/by-business-verticals/?bv='.$row['bv'].'">'.$row['bv'].'</a>
|
||||
</div>';
|
||||
}
|
||||
} else {
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<table style="overflow-x: auto;" id="myTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align: center;">Name</th>
|
||||
<th style="text-align: center;">ID</th>
|
||||
<th style="text-align: center;">Status</th>
|
||||
<th style="text-align: center;">Email</th>
|
||||
<th style="text-align: center;">Phone</th>
|
||||
<th style="text-align: center;">business_type</th>
|
||||
<th style="text-align: center;">Time</th>
|
||||
<th style="text-align: center;">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$accessArray = explode(",", $_SESSION['access']);
|
||||
$placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,?
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type IN ($placeholders)");
|
||||
foreach ($accessArray as $key => $value) {
|
||||
$stmt->bindValue($key + 1, $value);
|
||||
}
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows >= 1) {
|
||||
foreach($rows as $row){
|
||||
echo ' <tr>
|
||||
<td style="text-align: center;">'.$row['name'].'</td>
|
||||
<td style="text-align: center;"><a href="/edit-lead/?id='.$row['id'].'">'.$row['id'].'</a></td>
|
||||
<td style="text-align: center;">'.$row['status'].'</td>
|
||||
<td style="text-align: center;">'.$row['email'].'</td>
|
||||
<td style="text-align: center;">'.$row['phone'].'</td>
|
||||
<td style="text-align: center;">'.$row['business_type'].'</td>
|
||||
<td style="text-align: center;">'.$row['time'].'</td>
|
||||
<td style="text-align: center;">Delete</td>
|
||||
</tr>';
|
||||
}
|
||||
} else{
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
|
@ -0,0 +1,548 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
// deleteCofermation()
|
||||
$today_date = date("Y-m-d");
|
||||
$next_day = date("Y-m-d", strtotime("+1 day"));
|
||||
$yesterday = date("Y-m-d", strtotime("-1 day"));
|
||||
$this_week = date("Y-m-d", strtotime("-7 day"));
|
||||
$prev_month_date = date("Y-m-d", strtotime("first day of previous month", strtotime($today_date)));
|
||||
$firstDayOfCurrentMonth = date("Y-m-01");
|
||||
$firstDayOfLastMonth = date("Y-m-01", strtotime("first day of last month"));
|
||||
$firstDateOfYear = date("Y") . '-01-01';
|
||||
$previousYear = date("Y") - 1;
|
||||
$firstDateOfPreviousYear = $previousYear . '-01-01';
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch(PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['new_lead']) && $_POST['new_lead'] && isset($_POST['name']) && $_POST['name'] && isset($_POST['phone']) && $_POST['phone']) {
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$phone = $_POST['phone'];
|
||||
$formname = 'crm-portal';
|
||||
$note = $_POST['note'];
|
||||
$origin = $_POST['origin'];
|
||||
$gender = $_POST['gender'];
|
||||
$profession = $_POST['profession'];
|
||||
$country = $_POST['country'];
|
||||
$state = $_POST['state'];
|
||||
$city = $_POST['city'];
|
||||
$address = $_POST['address'];
|
||||
$status = 'New';
|
||||
try {
|
||||
$stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, origin, status, gender, profession, country, state, city, address ) VALUES (:name, :email, :phone, :formname, :note, :origin, :status, :gender, :profession, :country, :state, :city, :address)");
|
||||
$stmt->bindParam(':name', $name);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':phone', $phone);
|
||||
$stmt->bindParam(':formname', $formname);
|
||||
$stmt->bindParam(':note', $note);
|
||||
$stmt->bindParam(':origin', $origin);
|
||||
$stmt->bindParam(':status', $status);
|
||||
$stmt->bindParam(':gender', $gender);
|
||||
$stmt->bindParam(':profession', $profession);
|
||||
$stmt->bindParam(':country', $country);
|
||||
$stmt->bindParam(':state', $state);
|
||||
$stmt->bindParam(':city', $city);
|
||||
$stmt->bindParam(':address', $address);
|
||||
$stmt->execute();
|
||||
echo "Record added successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(isset($_POST['delete_records'])) {
|
||||
if(isset($_POST['selected_records']) && !empty($_POST['selected_records'])) {
|
||||
$selectedIds = $_POST['selected_records'];
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$delete_placeholders = rtrim(str_repeat('?,', count($selectedIds)), ',');
|
||||
$stmt = $conn->prepare("DELETE FROM cleads WHERE id IN ($delete_placeholders)");
|
||||
foreach($selectedIds as $key => $id) {
|
||||
$stmt->bindValue($key + 1, $id, PDO::PARAM_INT);
|
||||
}
|
||||
$stmt->execute();
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<p class="text-[28px] font-bold p-4">Lead Management</p>
|
||||
<div id="page-body" class="flex flex-row place-content-between px-4">
|
||||
<dialog>
|
||||
<button style="float: right; color: #FF0000; font-size: 25px; padding: 6px;">✘</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>
|
||||
</div>
|
||||
<form method="GET" class="p-6 flex flex-col pb-10">
|
||||
<p>Choose Date for filter</p>
|
||||
<div class="flex flex-row rounded-xl py-10">
|
||||
<div class="flex flex-row place-items-center">
|
||||
<label for="start_date">From Date</label>
|
||||
<input type="date" name="start_date" id="start_date" />
|
||||
</div> |
|
||||
<div class="flex flex-row place-items-center">
|
||||
<label for="end_date">To Date</label>
|
||||
<input type="date" name="end_date" id="end_date" />
|
||||
</div>
|
||||
</div>
|
||||
<button class="rounded-lg p-1 text-[#fff]" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center;" type="submit"><p class="text-center p-1.5">Search</p></button>
|
||||
</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>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<table class="bg-[#fff] text-[#3F4254] rounded-lg font-bold" style="width: 100%;" >
|
||||
<thead>
|
||||
<tr>
|
||||
<?php
|
||||
if($_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>
|
||||
<div class="flex flex-row space-x-4">
|
||||
<p onclick="deleteCofermation();" class="rounded-lg p-2 text-[#443780] mr-4" style="border: 2px solid #443780; cursor: pointer;">No</p>
|
||||
<button class="rounded-lg p-3 text-[#fff]" type="submit" name="delete_records" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%);">Yes</button>
|
||||
</div>
|
||||
</div>
|
||||
</th>';
|
||||
?>
|
||||
<th class="text-center border-b-2 p-3">Name</th>
|
||||
<th class="text-center border-b-2 p-3">ID</th>
|
||||
<th class="text-center border-b-2 p-3">Status Update</th>
|
||||
<!-- <th class="text-center border-b-2 p-3">Contact Detail</th> -->
|
||||
<th class="text-center border-b-2 p-3">Form Name</th>
|
||||
<th class="text-center border-b-2 p-3">Date</th>
|
||||
<th class="text-center border-b-2 p-3">Quick Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody >
|
||||
<?php
|
||||
// Number of records per page
|
||||
$recordsPerPage = 500;
|
||||
|
||||
// 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);
|
||||
$searchQuery = isset($_GET['search']) ? trim($_GET['search']) : '';
|
||||
$start_date = isset($_GET['start_date']) ? $_GET['start_date'] : '';
|
||||
$end_date = isset($_GET['end_date']) ? $_GET['end_date'] : '';
|
||||
|
||||
$accessArray = explode(",", $_SESSION['access']);
|
||||
$placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,?
|
||||
$placeholderString = implode(',', array_fill(0, count($accessArray), '?'));
|
||||
if (!empty($searchQuery)) {
|
||||
// this is keywords search
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE (id LIKE ? OR name LIKE ? OR email LIKE ? OR phone LIKE ?) AND business_type IN ($placeholders) ORDER BY time DESC LIMIT ?, ?");
|
||||
$stmt->bindValue(1, "%$searchQuery%", PDO::PARAM_STR);
|
||||
$stmt->bindValue(2, "%$searchQuery%", PDO::PARAM_STR);
|
||||
$stmt->bindValue(3, "%$searchQuery%", PDO::PARAM_STR);
|
||||
$stmt->bindValue(4, "%$searchQuery%", PDO::PARAM_STR);
|
||||
foreach ($accessArray as $key => $value) {
|
||||
$stmt->bindValue($key + 5, $value);
|
||||
}
|
||||
$stmt->bindValue(count($accessArray) + 5, 0, PDO::PARAM_INT); // Offset for pagination
|
||||
$stmt->bindValue(count($accessArray) + 6, $recordsPerPage, PDO::PARAM_INT); // Records per page
|
||||
// this is for date serch
|
||||
}elseif (!empty($start_date) && !empty($end_date)) {
|
||||
$start_date = date('Y-m-d', strtotime($start_date));
|
||||
$end_date = date('Y-m-d', strtotime($end_date));
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE time BETWEEN ? AND ? AND business_type IN ($placeholders)");
|
||||
$stmt->bindValue(1, $start_date);
|
||||
$stmt->bindValue(2, $end_date);
|
||||
|
||||
foreach ($accessArray as $key => $value) {
|
||||
$stmt->bindValue($key + 3, $value);
|
||||
}
|
||||
}else{
|
||||
// if user type admin then show all lead
|
||||
if($_SESSION['user_type'] == 'admin'){
|
||||
$stmt = $conn->prepare("SELECT COUNT(*) FROM cleads");
|
||||
$stmt->execute();
|
||||
$totalRecords = $stmt->fetchColumn();
|
||||
|
||||
$totalPages = ceil($totalRecords / $recordsPerPage);
|
||||
|
||||
$offset = ($currentPage - 1) * $recordsPerPage;
|
||||
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads ORDER BY time DESC LIMIT :offset, :recordsPerPage");
|
||||
$stmt->bindParam(':offset', $offset, PDO::PARAM_INT);
|
||||
$stmt->bindParam(':recordsPerPage', $recordsPerPage, PDO::PARAM_INT);
|
||||
}else{
|
||||
// if user type user then show only given access lead
|
||||
$stmt = $conn->prepare("SELECT COUNT(*) FROM cleads WHERE business_type IN ($placeholders)");
|
||||
foreach ($accessArray as $key => $value) {
|
||||
$stmt->bindValue($key + 1, $value);
|
||||
}
|
||||
$stmt->execute();
|
||||
|
||||
$totalRecords = $stmt->fetchColumn();
|
||||
$totalPages = ceil($totalRecords / $recordsPerPage);
|
||||
$offset = ($currentPage - 1) * $recordsPerPage;
|
||||
|
||||
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type IN ($placeholders) ORDER BY time DESC LIMIT ?, ?");
|
||||
$paramCount = count($accessArray);
|
||||
for ($i = 0; $i < $paramCount; $i++) {
|
||||
$stmt->bindValue($i + 1, $accessArray[$i]);
|
||||
}
|
||||
$stmt->bindValue($paramCount + 1, $offset, PDO::PARAM_INT);
|
||||
$stmt->bindValue($paramCount + 2, $recordsPerPage, PDO::PARAM_INT);
|
||||
}
|
||||
}
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$row_count = count($rows);
|
||||
for ($i = 0; $i < $row_count; $i++) {
|
||||
// echo $row_count . " ";
|
||||
}
|
||||
echo "<p class='px-4'>Total ".$row_count." Rows Found</p>";
|
||||
// Status Conditional Color
|
||||
foreach($rows as $row){
|
||||
$only_date = explode(' ', $row['time']);
|
||||
$lead_id = $row['id'];
|
||||
if($row['status'] == 'New'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';}
|
||||
elseif($row['status'] == 'Contacted'){$conditional_background_color = 'background-color: #D4FFFF; border: 2px solid #2C9C9C; border-radius: 20px; text-align: center; color: #2C9C9C;';}
|
||||
elseif($row['status'] == 'Disqualified'){$conditional_background_color = 'background-color: #CECECE; border: 2px solid #3F4254; border-radius: 20px; text-align: center; color: #3F4254;';}
|
||||
elseif($row['status'] == 'Converted'){$conditional_background_color = 'background-color: #D4FDE7; border: 2px solid #40916C; border-radius: 20px; text-align: center; color: #40916C;';}
|
||||
elseif($row['status'] == 'Warm'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';}
|
||||
// if status = warm then select
|
||||
// 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>
|
||||
<?php if($_SESSION['user_type'] == 'admin'){?>
|
||||
<td class="border-y-2 p-2">
|
||||
<input type="checkbox" name="selected_records[]" value="<?php echo $row['id']; ?>" id="<?php echo $row['id']; ?>" />
|
||||
</td>
|
||||
<?php }?>
|
||||
<td class="border-y-2 p-2"><label for="<?php echo $row['id']; ?>"><?php echo $row['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 $row['id'] ?>"><?php echo $row['id'] ?></a></td>
|
||||
<td class="border-y-2 p-2"><div style="<?php echo $conditional_background_color; ?> font-weight: bold;"><?php echo $row['status'];?></div></td>
|
||||
<!-- <td class="border-y-2 p-2">
|
||||
<p><i class="fa fa-envelope"> <?php // echo $row['email'] ?></i></p>
|
||||
<p><i class="fa fa-phone"> <?php // echo $row['phone'] ?></i></p>
|
||||
</td> -->
|
||||
<td class="border-y-2 p-2"><?php echo $row['formname'] ?></td>
|
||||
<td class="border-y-2 p-2"><?php echo $only_date[0]; ?></td>
|
||||
<td class="border-y-2 p-2">
|
||||
<div class="flex flex-row justify-center place-items-center">
|
||||
<a href="mailto:<?php echo $row['email'] ?>"><i class="fa fa-envelope" style="font-size: 20px"></i></a>
|
||||
<a href="https://wa.me/<?php echo $row['phone'] ?>?text=Hello%2C%20how%20are%20you%3F"><i class="fab fa-whatsapp" style="font-size: 20px"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<!-- Pagination Links -->
|
||||
<div class="pagination">
|
||||
<?php if ($currentPage > 1): ?>
|
||||
<a href="?page=<?php echo ($currentPage - 1); ?>">Previous</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php for ($i = 1; $i <= $totalPages; $i++): ?>
|
||||
<a href="?page=<?php echo $i; ?>" <?php if ($i === $currentPage) echo 'class="active"'; ?>><?php echo $i; ?></a>
|
||||
<?php endfor; ?>
|
||||
|
||||
<?php if ($currentPage < $totalPages): ?>
|
||||
<a href="?page=<?php echo ($currentPage + 1); ?>">Next</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- New Lead Form Section -->
|
||||
<div id="add-lead-form" class="add-lead-form">
|
||||
<div class="flex flex-row place-content-between p-2" style="border-bottom: 2px solid #464E5F; border-style: dashed;">
|
||||
<p class="text-[25px] font-bold">Add Lead</p>
|
||||
<p onclick="toggleDisplay();" class="rounded-lg px-1.5 text-[#464E5F] text-[25px] cursor-pointer" style="border: 2px solid #464E5F; border-radius: 50%;">✘</p>
|
||||
</div>
|
||||
<form action="" method="post" class="p-4">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2">
|
||||
<div class="flex flex-col mr-4">
|
||||
<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>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="state"> State:</label>
|
||||
<select name="state" id="state" onchange="fetchCities()" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;">
|
||||
<option value="">Select State</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="city"> City:</label>
|
||||
<select name="city" id="city" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;">
|
||||
<option value="">Select City</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="address">Address:</label>
|
||||
<input class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="address" id="address" />
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="name">Name:</label>
|
||||
<input class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="name" id="name" />
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="gender">Gender:</label>
|
||||
<select class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="gender" id="gender" >
|
||||
<option value="Male">Male</option>
|
||||
<option value="Female">Female</option>
|
||||
<option value="Others">Others</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="profession">Profession:</label>
|
||||
<input class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="profession" id="profession" />
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="email">E-mail:</label>
|
||||
<input class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="email" id="email" />
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="phone">Phone:</label>
|
||||
<input class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="phone" id="phone" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row place-content-between p-2 text-[25px] font-bold" style="border-bottom: 2px solid #464E5F; border-style: dashed;">Lead Information</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2">
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="origin">Details:</label>
|
||||
<select class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="origin" id="origin" >
|
||||
<option value="Facebook Ads">Facebook Ads</option>
|
||||
<option value="Google Ads">Google Ads</option>
|
||||
<option value="Linkedin Ads">Linkedin Ads</option>
|
||||
<option value="Instagram">Instagram</option>
|
||||
<option value="Messenger">Messenger</option>
|
||||
<option value="Whatsapp">Whatsapp</option>
|
||||
<option value="GMB">GMB</option>
|
||||
<option value="Linkedin">Linkedin</option>
|
||||
<option value="Inbound Call">Inbound Call</option>
|
||||
<option value="Outbound Call">Outbound Call</option>
|
||||
<option value="Others">Others</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="user">Lead Owner:</label>
|
||||
<select class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="user" id="user" >
|
||||
<?php
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("SELECT * FROM users");
|
||||
$stmt->execute();
|
||||
$users_rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$row_count = count($users_rows);
|
||||
if($row_count > 0){
|
||||
foreach($users_rows as $users_data){
|
||||
echo '<option value="'.$users_data['email'].'">'.$users_data['email'].'</option>';
|
||||
}
|
||||
} else{
|
||||
echo '<p>No users Found</p>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="note">Note:</label>
|
||||
<textarea type="text" name="note" id="note" rows="6" cols="10" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;"></textarea>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<input class="p-2" type="submit" name="new_lead" id="new_lead" value="Submit" style="color:#fff; border-radius: 6px; background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; margin-top: 10px;"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
// 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 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();
|
||||
|
||||
const dialog = document.querySelector("dialog");
|
||||
const showButton = document.querySelector("dialog + button");
|
||||
const closeButton = document.querySelector("dialog button");
|
||||
|
||||
// "Show the dialog" button opens the dialog modally
|
||||
showButton.addEventListener("click", () => {
|
||||
dialog.showModal();
|
||||
});
|
||||
|
||||
// "Close" button closes the dialog
|
||||
closeButton.addEventListener("click", () => {
|
||||
dialog.close();
|
||||
});
|
||||
function toggleDisplay() {
|
||||
var element = document.getElementById('add-lead-form');
|
||||
if (element.style.display === 'block') {
|
||||
element.style.display = 'none';
|
||||
} else {
|
||||
element.style.display = 'block';
|
||||
element.classList.add('slide-in-animation'); // Add class to trigger animation
|
||||
}
|
||||
}
|
||||
|
||||
// Event listener for the Esc key
|
||||
document.addEventListener('keydown', function(event) {
|
||||
if (event.keyCode === 27) {
|
||||
var modal = document.getElementById('add-lead-form');
|
||||
if (modal.style.display === 'block') {
|
||||
modal.style.display = 'none';
|
||||
}
|
||||
}
|
||||
});
|
||||
function deleteCofermation(){
|
||||
let deleteButton = document.getElementById('delete-button');
|
||||
let leadID = document.getElementById('<?php echo $row['id']; ?>').value;
|
||||
if(leadID != null){
|
||||
if(deleteButton.style.display === 'flex'){
|
||||
deleteButton.style.display = 'none';
|
||||
}else{
|
||||
deleteButton.style.display = 'flex'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.add-lead-form {
|
||||
background-color: #F8F8F8;
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0%;
|
||||
right: 0%;
|
||||
transform: translateX(100%);
|
||||
/* transform: translate(-0%, -50%); */
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
box-shadow: 0px 0px 20px 0px #443780;
|
||||
border-radius: 2px;
|
||||
z-index: 100;
|
||||
height: 100%;
|
||||
animation: slideInRight 0.5s forwards; /* Animation to slide in */
|
||||
/* overflow-x: auto; */
|
||||
}
|
||||
|
||||
@keyframes slideInRight {
|
||||
from {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
to {
|
||||
transform: translateX(0%);
|
||||
}
|
||||
}
|
||||
/* .add-lead-form{
|
||||
background-color: #F8F8F8;
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
right: 0%;
|
||||
transform: translate(-0%, -50%);
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
box-shadow: 0px 0px 20px 0px #443780;
|
||||
border-radius: 5px;
|
||||
z-index: 100;
|
||||
height: 100%;
|
||||
} */
|
||||
.delete-confirm{
|
||||
position: fixed;
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
background-color: #E6E5F4;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
padding: 40px 50px 40px 50px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch(PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$phone = $_POST['phone'];
|
||||
$formname = 'crm-portal';
|
||||
$note = $_POST['note'];
|
||||
$details = $_POST['details'];
|
||||
$status = 'New';
|
||||
try {
|
||||
$stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, details, status) VALUES (:name, :email, :phone, :formname, :note, :details, :status)");
|
||||
$stmt->bindParam(':name', $name);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':phone', $phone);
|
||||
$stmt->bindParam(':formname', $formname);
|
||||
$stmt->bindParam(':note', $note);
|
||||
$stmt->bindParam(':details', $details);
|
||||
$stmt->bindParam(':status', $status);
|
||||
$stmt->execute();
|
||||
echo "Record added successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div style="max-width: 600px;">
|
||||
<form action="" method="post">
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" name="name" id="name" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="email">E-mail:</label>
|
||||
<input type="text" name="email" id="email" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="phone">Phone:</label>
|
||||
<input type="text" name="phone" id="phone" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="details">Details:</label>
|
||||
<input type="text" name="details" id="details" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="note">Note:</label>
|
||||
<textarea type="text" name="note" id="note" rows="6" cols="10"></textarea>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<input type="submit" name="submit" id="submit" value="Submit"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
// echo $_SESSION['access'];
|
||||
?>
|
||||
<?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 business_verticals");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if (count($rows) >= 1) {
|
||||
foreach($rows as $row){ echo '<div>
|
||||
<a href="/cleads/by-business-verticals/?bv='.$row['bv'].'">'.$row['bv'].'</a>
|
||||
</div>'; ?>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
// echo $_SESSION['access'];
|
||||
?>
|
||||
<?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 users WHERE email=:email");
|
||||
// $stmt->bindParam(':email', $_SESSION['email']);
|
||||
// $stmt->execute();
|
||||
// $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
// $num_rows = $stmt->rowCount();
|
||||
// foreach($rows as $row){
|
||||
// $user_access_data = explode(",", $row['access']);
|
||||
// foreach($user_access_data as $access_data){
|
||||
// echo '<div style="display: flex; flex-direction: row;"><a href="/cleads/by-business-verticals/?bv='.$access_data.'" style="margin: 10px;">'.$access_data.'</a></div>';
|
||||
// }
|
||||
// }
|
||||
// } catch (PDOException $e) {
|
||||
// echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
// }
|
||||
?>
|
||||
|
||||
<?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 cleads WHERE business_type = :business_type ORDER BY time DESC");
|
||||
$stmt->bindParam(':business_type', $_GET['bv']);
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
?>
|
||||
<div id="grid"></div>
|
||||
<script>
|
||||
const grid = new gridjs.Grid({
|
||||
columns: ["Name", {name: "ID", formatter: (cell) => {return gridjs.html(`<a href="/cleads/edit-lead/?id=${cell}">${cell}</a>`);}},"Status", "Email", "Phone", "Time", {name: "ID", formatter: (cell) => {return gridjs.html(`<a href="/cleads/delete-lead/?id=${cell}">Delete</a>`);}}],
|
||||
pagination: {limit: 100},
|
||||
search: true,
|
||||
sort: true,
|
||||
resizable: true,
|
||||
data: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve(<?php echo json_encode($rows); ?>);
|
||||
}, 1000);
|
||||
});
|
||||
},
|
||||
loading: true
|
||||
});
|
||||
grid.render(document.getElementById("grid"));
|
||||
</script>
|
||||
<?php
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,446 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
|
||||
$today_date = date("Y-m-d");
|
||||
$next_day = date("Y-m-d", strtotime("+1 day"));
|
||||
$yesterday = date("Y-m-d", strtotime("-1 day"));
|
||||
$this_week = date("Y-m-d", strtotime("-7 day"));
|
||||
$prev_month_date = date("Y-m-d", strtotime("first day of previous month", strtotime($today_date)));
|
||||
$firstDayOfCurrentMonth = date("Y-m-01");
|
||||
$firstDayOfLastMonth = date("Y-m-01", strtotime("first day of last month"));
|
||||
$firstDateOfYear = date("Y") . '-01-01';
|
||||
$previousYear = date("Y") - 1;
|
||||
$firstDateOfPreviousYear = $previousYear . '-01-01';
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch(PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['new_lead']) && $_POST['new_lead'] && isset($_POST['name']) && $_POST['name'] && isset($_POST['phone']) && $_POST['phone']) {
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$phone = $_POST['phone'];
|
||||
$formname = 'crm-portal';
|
||||
$note = $_POST['note'];
|
||||
$origin = $_POST['origin'];
|
||||
$gender = $_POST['gender'];
|
||||
$profession = $_POST['profession'];
|
||||
$country = $_POST['country'];
|
||||
$state = $_POST['state'];
|
||||
$city = $_POST['city'];
|
||||
$address = $_POST['address'];
|
||||
$status = 'New';
|
||||
try {
|
||||
$stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, origin, status, gender, profession, country, state, city, address ) VALUES (:name, :email, :phone, :formname, :note, :origin, :status, :gender, :profession, :country, :state, :city, :address)");
|
||||
$stmt->bindParam(':name', $name);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':phone', $phone);
|
||||
$stmt->bindParam(':formname', $formname);
|
||||
$stmt->bindParam(':note', $note);
|
||||
$stmt->bindParam(':origin', $origin);
|
||||
$stmt->bindParam(':status', $status);
|
||||
$stmt->bindParam(':gender', $gender);
|
||||
$stmt->bindParam(':profession', $profession);
|
||||
$stmt->bindParam(':country', $country);
|
||||
$stmt->bindParam(':state', $state);
|
||||
$stmt->bindParam(':city', $city);
|
||||
$stmt->bindParam(':address', $address);
|
||||
$stmt->execute();
|
||||
echo "Record added successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<p class="text-[28px] font-bold p-4">Lead Management</p>
|
||||
<div class="flex flex-row place-content-between pb-1 px-4">
|
||||
<dialog>
|
||||
<button style="float: right; color: #FF0000; font-size: 25px; padding: 6px;">✘</button>
|
||||
<div class="flex flex-row">
|
||||
<div class="flex flex-col p-6 space-y-4">
|
||||
<a href="/cleads/by-business-verticals/?bv=<?php echo $_GET['bv']; ?>&start_date=<?php echo $today_date ?>&end_date=<?php echo $next_day ?>">Today</a>
|
||||
<a href="/cleads/by-business-verticals/?bv=<?php echo $_GET['bv']; ?>&start_date=<?php echo $yesterday ?>&end_date=<?php echo $today_date ?>">Yesterday</a>
|
||||
<a href="/cleads/by-business-verticals/?bv=<?php echo $_GET['bv']; ?>&start_date=<?php echo $this_week ?>&end_date=<?php echo $today_date ?>">This Week</a>
|
||||
<a href="/cleads/by-business-verticals/?bv=<?php echo $_GET['bv']; ?>&start_date=<?php echo $firstDayOfCurrentMonth ?>&end_date=<?php echo $today_date ?>">This Month</a>
|
||||
<a href="/cleads/by-business-verticals/?bv=<?php echo $_GET['bv']; ?>&start_date=<?php echo $prev_month_date ?>&end_date=<?php echo $today_date ?>">Last Month</a>
|
||||
<a href="/cleads/by-business-verticals/?bv=<?php echo $_GET['bv']; ?>&start_date=<?php echo $firstDateOfYear ?>&end_date=<?php echo $today_date ?>">This Year</a>
|
||||
<a href="/cleads/by-business-verticals/?bv=<?php echo $_GET['bv']; ?>&start_date=<?php echo $firstDateOfPreviousYear ?>&end_date=<?php echo $today_date ?>">Last Year</a>
|
||||
<a href="/cleads">All Time</a>
|
||||
</div>
|
||||
<form method="GET" class="p-6 flex flex-col pb-10">
|
||||
<p>Choose Date for filter</p>
|
||||
<div class="flex flex-row rounded-xl py-10">
|
||||
<div class="flex flex-row place-items-center">
|
||||
<input type="text" name="bv" value="<?php echo $_GET['bv']; ?>">
|
||||
<label for="start_date">From Date</label>
|
||||
<input type="date" name="start_date" id="start_date" />
|
||||
</div> |
|
||||
<div class="flex flex-row place-items-center">
|
||||
<label for="end_date">To Date</label>
|
||||
<input type="date" name="end_date" id="end_date" />
|
||||
</div>
|
||||
</div>
|
||||
<button class="rounded-lg p-1 text-[#fff]" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center;" type="submit"><p class="text-center p-1.5">Search</p></button>
|
||||
</form>
|
||||
</div>
|
||||
</dialog>
|
||||
<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 type="hidden" name="bv" id="bv" value="<?php echo $_GET['bv']; ?>">
|
||||
<input class="p-2.5 rounded-l-lg focus:outline-none w-[320px]" type="text" name="search" placeholder="Search by Name, lead ID, Mobile, Email..." style="border: 2px solid #8E8E8E;">
|
||||
<button class="rounded-r-lg text-[#fff]" 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>
|
||||
<!-- <a class="rounded-lg p-2 text-[#fff]" href="/cleads/add-lead" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center;">Add Leads</a> -->
|
||||
</div>
|
||||
|
||||
<table class="bg-[#fff] text-[#3F4254] rounded-lg font-bold" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center border-b-2 p-3">Name</th>
|
||||
<th class="text-center border-b-2 p-3">ID</th>
|
||||
<th class="text-center border-b-2 p-3">Status Update</th>
|
||||
<th class="text-center border-b-2 p-3">Contact Detail</th>
|
||||
<th class="text-center border-b-2 p-3">Form Name</th>
|
||||
<th class="text-center border-b-2 p-3">Date & Time</th>
|
||||
<th class="text-center border-b-2 p-3">Quick Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody >
|
||||
<?php
|
||||
// Number of records per page
|
||||
$recordsPerPage = 500;
|
||||
|
||||
// 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);
|
||||
$searchQuery = isset($_GET['search']) ? trim($_GET['search']) : '';
|
||||
$start_date = isset($_GET['start_date']) ? $_GET['start_date'] : '';
|
||||
$end_date = isset($_GET['end_date']) ? $_GET['end_date'] : '';
|
||||
$accessArray = explode(",", $_SESSION['access']);
|
||||
$placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,?
|
||||
$placeholderString = implode(',', array_fill(0, count($accessArray), '?'));
|
||||
if (!empty($searchQuery)) {
|
||||
// this is keywords search
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE (id LIKE ? OR name LIKE ? OR email LIKE ? OR phone LIKE ?) AND business_type = ? ORDER BY time DESC LIMIT ?, ?");
|
||||
$stmt->bindValue(1, "%$searchQuery%", PDO::PARAM_STR);
|
||||
$stmt->bindValue(2, "%$searchQuery%", PDO::PARAM_STR);
|
||||
$stmt->bindValue(3, "%$searchQuery%", PDO::PARAM_STR);
|
||||
$stmt->bindValue(4, "%$searchQuery%", PDO::PARAM_STR);
|
||||
$stmt->bindValue(5, $_GET['bv']);
|
||||
$stmt->bindValue(6, 0, PDO::PARAM_INT); // Offset for pagination
|
||||
$stmt->bindValue(7, $recordsPerPage, PDO::PARAM_INT); // Records per page
|
||||
// this is for date serch
|
||||
}elseif (!empty($start_date) && !empty($end_date)) {
|
||||
$start_date = date('Y-m-d', strtotime($start_date));
|
||||
$end_date = date('Y-m-d', strtotime($end_date));
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type = ? AND `time` BETWEEN ? AND ?");
|
||||
$stmt->bindValue(1, $_GET['bv']);
|
||||
$stmt->bindValue(2, $start_date);
|
||||
$stmt->bindValue(3, $end_date);
|
||||
}else{
|
||||
// if user type admin then show all lead
|
||||
if($_SESSION['user_type'] == 'admin'){
|
||||
$stmt = $conn->prepare("SELECT COUNT(*) FROM cleads");
|
||||
$stmt->execute();
|
||||
$totalRecords = $stmt->fetchColumn();
|
||||
|
||||
$totalPages = ceil($totalRecords / $recordsPerPage);
|
||||
|
||||
$offset = ($currentPage - 1) * $recordsPerPage;
|
||||
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type = :business_type ORDER BY time DESC LIMIT :offset, :recordsPerPage");
|
||||
$stmt->bindParam(':business_type', $_GET['bv'], PDO::PARAM_INT);
|
||||
$stmt->bindParam(':offset', $offset, PDO::PARAM_INT);
|
||||
$stmt->bindParam(':recordsPerPage', $recordsPerPage, PDO::PARAM_INT);
|
||||
}else{
|
||||
// if user type user then show only given access lead
|
||||
$stmt = $conn->prepare("SELECT COUNT(*) FROM cleads WHERE business_type = ?");
|
||||
$stmt->bindValue(1, $_GET['bv']);
|
||||
$stmt->execute();
|
||||
|
||||
$totalRecords = $stmt->fetchColumn();
|
||||
$totalPages = ceil($totalRecords / $recordsPerPage);
|
||||
$offset = ($currentPage - 1) * $recordsPerPage;
|
||||
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type = :business_type ORDER BY time DESC LIMIT :offset, :recordsPerPage");
|
||||
$stmt->bindParam(':business_type', $_GET['bv']);
|
||||
$stmt->bindParam(':offset', $offset, PDO::PARAM_INT);
|
||||
$stmt->bindParam(':recordsPerPage', $recordsPerPage, PDO::PARAM_INT);
|
||||
}
|
||||
}
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$row_count = count($rows);
|
||||
for ($i = 0; $i < $row_count; $i++) {
|
||||
// echo $row_count . " ";
|
||||
}
|
||||
echo "<p class='px-4'>Total ".$row_count." Rows Found</p>";
|
||||
// Status Conditional Color
|
||||
foreach($rows as $row){
|
||||
if($row['status'] == 'New'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';}
|
||||
elseif($row['status'] == 'Contacted'){$conditional_background_color = 'background-color: #D4FFFF; border: 2px solid #2C9C9C; border-radius: 20px; text-align: center; color: #2C9C9C;';}
|
||||
elseif($row['status'] == 'Disqualified'){$conditional_background_color = 'background-color: #CECECE; border: 2px solid #3F4254; border-radius: 20px; text-align: center; color: #3F4254;';}
|
||||
elseif($row['status'] == 'Converted'){$conditional_background_color = 'background-color: #D4FDE7; border: 2px solid #40916C; border-radius: 20px; text-align: center; color: #40916C;';}
|
||||
elseif($row['status'] == 'Warm'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';}
|
||||
// if status = warm then select
|
||||
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 class="border-y-2 p-2"><?php echo $row['name'] ?></td>
|
||||
<td class="border-y-2 p-2"><a href="/cleads/edit-lead/?id=<?php echo $row['id'] ?>"><?php echo $row['id'] ?></a></td>
|
||||
<td class="border-y-2 p-2"><div style="<?php echo $conditional_background_color; ?> font-weight: bold;"><?php echo $conditional_status;?></div></td>
|
||||
<td class="border-y-2 p-2">
|
||||
<p><i class="fa fa-envelope"> <?php echo $row['email'] ?></i></p>
|
||||
<p><i class="fa fa-phone"> <?php echo $row['phone'] ?></i></p>
|
||||
</td>
|
||||
<td class="border-y-2 p-2"><?php echo $row['formname'] ?></td>
|
||||
<td class="border-y-2 p-2"><?php echo $row['time'] ?></td>
|
||||
<td class="border-y-2 p-2">
|
||||
<div class="flex flex-row">
|
||||
<a href="<?php echo $row['email'] ?>"><i class="fa fa-whatsapp"></a></i>
|
||||
<a href="<?php echo $row['phone'] ?>"><i class="fa fa-envelope"></a></i>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- Pagination Links -->
|
||||
<div class="pagination">
|
||||
<?php if ($currentPage > 1): ?>
|
||||
<a href="?page=<?php echo ($currentPage - 1); ?>">Previous</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php for ($i = 1; $i <= $totalPages; $i++): ?>
|
||||
<a href="?page=<?php echo $i; ?>" <?php if ($i === $currentPage) echo 'class="active"'; ?>><?php echo $i; ?></a>
|
||||
<?php endfor; ?>
|
||||
|
||||
<?php if ($currentPage < $totalPages): ?>
|
||||
<a href="?page=<?php echo ($currentPage + 1); ?>">Next</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- New Lead Form Section -->
|
||||
<div id="add-lead-form" class="add-lead-form">
|
||||
<div class="flex flex-row place-content-between p-2" style="border-bottom: 2px solid #464E5F; border-style: dashed;">
|
||||
<p class="text-[25px] font-bold">Add Lead</p>
|
||||
<p onclick="toggleDisplay();" class="rounded-lg px-1.5 text-[#464E5F] text-[25px] cursor-pointer" style="border: 2px solid #464E5F; border-radius: 50%;">✘</p>
|
||||
</div>
|
||||
<form action="" method="post" class="p-4">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2">
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="country"> Country:</label>
|
||||
<select name="country" id="country" onchange="fetchStates()" style="border: 2px solid #363650; border-radius: 5px; padding: 6px;">
|
||||
<option value="">Select Country</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="state"> State:</label>
|
||||
<select name="state" id="state" onchange="fetchCities()" style="border: 2px solid #363650; border-radius: 5px; padding: 6px;">
|
||||
<option value="">Select State</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="city"> City:</label>
|
||||
<select name="city" id="city" style="border: 2px solid #363650; border-radius: 5px; padding: 6px;">
|
||||
<option value="">Select City</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="address">Address:</label>
|
||||
<input class="" style="border: 2px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="address" id="address" />
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="name">Name:</label>
|
||||
<input class="" style="border: 2px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="name" id="name" />
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="gender">Gender:</label>
|
||||
<select class="" style="border: 2px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="gender" id="gender" >
|
||||
<option value="Male">Male</option>
|
||||
<option value="Female">Female</option>
|
||||
<option value="Others">Others</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="profession">Profession:</label>
|
||||
<input class="" style="border: 2px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="profession" id="profession" />
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="email">E-mail:</label>
|
||||
<input class="" style="border: 2px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="email" id="email" />
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="phone">Phone:</label>
|
||||
<input class="" style="border: 2px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="phone" id="phone" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row place-content-between p-2 text-[25px] font-bold" style="border-bottom: 2px solid #464E5F; border-style: dashed;">Lead Information</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2">
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="origin">Details:</label>
|
||||
<select class="" style="border: 2px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="origin" id="origin" >
|
||||
<option value="Facebook Ads">Facebook Ads</option>
|
||||
<option value="Google Ads">Google Ads</option>
|
||||
<option value="Linkedin Ads">Linkedin Ads</option>
|
||||
<option value="Instagram">Instagram</option>
|
||||
<option value="Messenger">Messenger</option>
|
||||
<option value="Whatsapp">Whatsapp</option>
|
||||
<option value="GMB">GMB</option>
|
||||
<option value="Linkedin">Linkedin</option>
|
||||
<option value="Inbound Call">Inbound Call</option>
|
||||
<option value="Outbound Call">Outbound Call</option>
|
||||
<option value="Others">Others</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="user">Lead Owner:</label>
|
||||
<select class="" style="border: 2px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="user" id="user" >
|
||||
<?php
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("SELECT * FROM users");
|
||||
$stmt->execute();
|
||||
$users_rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$row_count = count($users_rows);
|
||||
if($row_count > 0){
|
||||
foreach($users_rows as $users_data){
|
||||
echo '<option value="'.$users_data['email'].'">'.$users_data['email'].'</option>';
|
||||
}
|
||||
} else{
|
||||
echo '<p>No users Found</p>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="note">Note:</label>
|
||||
<textarea type="text" name="note" id="note" rows="6" cols="10" style="border: 2px solid #363650; border-radius: 5px; padding: 6px;"></textarea>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<input class="p-2" type="submit" name="new_lead" id="new_lead" value="Submit" style="color:#fff; border-radius: 6px; background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; margin-top: 10px;"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
// 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 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();
|
||||
|
||||
const dialog = document.querySelector("dialog");
|
||||
const showButton = document.querySelector("dialog + button");
|
||||
const closeButton = document.querySelector("dialog button");
|
||||
|
||||
// "Show the dialog" button opens the dialog modally
|
||||
showButton.addEventListener("click", () => {
|
||||
dialog.showModal();
|
||||
});
|
||||
|
||||
// "Close" button closes the dialog
|
||||
closeButton.addEventListener("click", () => {
|
||||
dialog.close();
|
||||
});
|
||||
// Function to toggle display of the modal
|
||||
function toggleDisplay() {
|
||||
var element = document.getElementById('add-lead-form');
|
||||
if (element.style.display === 'block') {
|
||||
element.style.display = 'none';
|
||||
} else {
|
||||
element.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
// Event listener for the Esc key
|
||||
document.addEventListener('keydown', function(event) {
|
||||
if (event.keyCode === 27) {
|
||||
var modal = document.getElementById('add-lead-form');
|
||||
if (modal.style.display === 'block') {
|
||||
modal.style.display = 'none';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.add-lead-form{
|
||||
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;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
if($_SERVER['REQUEST_METHOD'] == "POST"){
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$stmt = $conn->prepare("DELETE FROM cleads WHERE id = :id");
|
||||
$stmt->bindParam(':id', $_POST['id']);
|
||||
$stmt->execute();
|
||||
echo '<script>window.location.href = "/cleads";</script>';
|
||||
exit();
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<form method="post">
|
||||
<p>Confirm to Delete id <?php echo $_GET['id']; ?>? </p>
|
||||
<input type="hidden" name="id" value="<?php echo $_GET['id']; ?>">
|
||||
<input type="submit" name="submit" id="submit" value="YES" />
|
||||
<a href="/cleads">NO</a>
|
||||
</form>
|
||||
</div>
|
|
@ -0,0 +1,171 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
// echo $_GET['id'];
|
||||
// Below two fetch for edit data
|
||||
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){ ?>
|
||||
<div>
|
||||
<p>ID:<?php echo $row['id']; ?></p>
|
||||
<p>FormName:<?php echo $row['formname']; ?></p>
|
||||
<p>Name:<?php echo $row['name']; ?></p>
|
||||
<p>Email:<?php echo $row['email']; ?></p>
|
||||
<p>Phone:<?php echo $row['phone']; ?></p>
|
||||
<p>Subject:<?php echo $row['subject']; ?></p>
|
||||
<p>Message:<?php echo $row['message']; ?></p>
|
||||
<p>Details:<?php echo $row['details']; ?></p>
|
||||
<p>Origin:<?php echo $row['origin']; ?></p>
|
||||
<p>Time:<?php echo $row['time']; ?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
};
|
||||
|
||||
if($_SERVER['REQUEST_METHOD']=="POST" && $_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 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(':id', $_GET['id']);
|
||||
$stmt->execute();
|
||||
|
||||
echo "Record Updated successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div style="max-width: 500px;">
|
||||
<form method="post">
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" name="name" id="name" value="<?php echo $row['name']; ?>" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="email">E-mail:</label>
|
||||
<input type="text" name="email" id="email" value="<?php echo $row['email']; ?>" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="phone">Phone:</label>
|
||||
<input type="text" name="phone" id="phone" value="<?php echo $row['phone']; ?>" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="date">FOLLOW UPDATE:</label>
|
||||
<input type="date" name="date" id="date" value="<?php echo $row['date']; ?>" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="phone">Lead Status:</label>
|
||||
<select name="status" id="status" slec value="<?php echo $row['status']; ?>">
|
||||
<option value=""></option>
|
||||
<option value="new">New</option>
|
||||
<option value="contacted">Contacted</option>
|
||||
<option value="warm">Warm</option>
|
||||
<option value="converted">Converted</option>
|
||||
<option value="inactive">Inactive</option>
|
||||
<option value="disqualified">Disqualified</option>
|
||||
</select>
|
||||
</div>
|
||||
<?php
|
||||
if($_SESSION['user_type'] == "admin"){?>
|
||||
<div>
|
||||
<label for="user">Attach this Lead to a user:</label><br>
|
||||
<select name="user" id="user">
|
||||
<option value="0">-Select-</option>
|
||||
<?php
|
||||
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 users");
|
||||
$stmt->execute();
|
||||
$users_lead = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
// var_dump($rows);
|
||||
foreach($users_lead as $user_lead){ ?>
|
||||
<option value="<?php echo $user_lead['email']; ?>"><?php echo $user_lead['email']; ?></option>
|
||||
<?php
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
};
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<input type="submit" id="update_data" name="update_data" value="Update">
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
// This is for save comment
|
||||
if($_SERVER['REQUEST_METHOD'] == "POST" && $_POST['save_comment'] && $_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();
|
||||
}
|
||||
};
|
||||
|
||||
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 comments WHERE leadid = :leadid ORDER BY created_at DESC");
|
||||
$stmt->bindParam(':leadid', $_GET['id']);
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
// var_dump($rows);
|
||||
foreach($rows as $row){ ?>
|
||||
<div>
|
||||
<p><?php echo $row['comments']; ?></p>
|
||||
<p><?php echo $row['user'].' '.date("Y-m-d", strtotime($row['created_at'])) ?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
};
|
||||
?>
|
||||
|
||||
<form method="post">
|
||||
<div>
|
||||
<label for="comments">Comment:</label><br>
|
||||
<textarea name="comments" id="comments" cols="50" rows="10"></textarea>
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" value="Save Comment" name="save_comment" id="save_comment" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
|
@ -0,0 +1,588 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.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" && $_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" 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" && $_POST['save_comment'] && $_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>";
|
||||
};
|
||||
|
||||
if($_SERVER['REQUEST_METHOD'] == "POST" && $_POST['appt_comment'] && $_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" && $_POST['appt_comment_update'] && $_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;">+</button>
|
||||
</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 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;">✘</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;">✘</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>
|
|
@ -0,0 +1,568 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
// deleteCofermation()
|
||||
$today_date = date("Y-m-d");
|
||||
$next_day = date("Y-m-d", strtotime("+1 day"));
|
||||
$yesterday = date("Y-m-d", strtotime("-1 day"));
|
||||
$this_week = date("Y-m-d", strtotime("-7 day"));
|
||||
$prev_month_date = date("Y-m-d", strtotime("first day of previous month", strtotime($today_date)));
|
||||
$firstDayOfCurrentMonth = date("Y-m-01");
|
||||
$firstDayOfLastMonth = date("Y-m-01", strtotime("first day of last month"));
|
||||
$firstDateOfYear = date("Y") . '-01-01';
|
||||
$previousYear = date("Y") - 1;
|
||||
$firstDateOfPreviousYear = $previousYear . '-01-01';
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch(PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['new_lead']) && $_POST['new_lead'] && isset($_POST['name']) && $_POST['name'] && isset($_POST['phone']) && $_POST['phone']) {
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$phone = $_POST['phone'];
|
||||
$formname = 'crm-portal';
|
||||
$note = $_POST['note'];
|
||||
$origin = $_POST['origin'];
|
||||
$gender = $_POST['gender'];
|
||||
$profession = $_POST['profession'];
|
||||
$country = $_POST['country'];
|
||||
$state = $_POST['state'];
|
||||
$city = $_POST['city'];
|
||||
$address = $_POST['address'];
|
||||
$status = 'New';
|
||||
try {
|
||||
$stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, origin, status, gender, profession, country, state, city, address ) VALUES (:name, :email, :phone, :formname, :note, :origin, :status, :gender, :profession, :country, :state, :city, :address)");
|
||||
$stmt->bindParam(':name', $name);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':phone', $phone);
|
||||
$stmt->bindParam(':formname', $formname);
|
||||
$stmt->bindParam(':note', $note);
|
||||
$stmt->bindParam(':origin', $origin);
|
||||
$stmt->bindParam(':status', $status);
|
||||
$stmt->bindParam(':gender', $gender);
|
||||
$stmt->bindParam(':profession', $profession);
|
||||
$stmt->bindParam(':country', $country);
|
||||
$stmt->bindParam(':state', $state);
|
||||
$stmt->bindParam(':city', $city);
|
||||
$stmt->bindParam(':address', $address);
|
||||
$stmt->execute();
|
||||
echo "Record added successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(isset($_POST['delete_records'])) {
|
||||
if(isset($_POST['selected_records']) && !empty($_POST['selected_records'])) {
|
||||
$selectedIds = $_POST['selected_records'];
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$delete_placeholders = rtrim(str_repeat('?,', count($selectedIds)), ',');
|
||||
$stmt = $conn->prepare("DELETE FROM cleads WHERE id IN ($delete_placeholders)");
|
||||
foreach($selectedIds as $key => $id) {
|
||||
$stmt->bindValue($key + 1, $id, PDO::PARAM_INT);
|
||||
}
|
||||
$stmt->execute();
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<p class="text-[28px] font-bold p-4">Lead Management</p>
|
||||
<div id="page-body" class="flex flex-row place-content-between px-4">
|
||||
<dialog>
|
||||
<button style="float: right; color: #FF0000; font-size: 25px; padding: 6px;">✘</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>
|
||||
</div>
|
||||
<form method="GET" class="p-6 flex flex-col pb-10">
|
||||
<p>Choose Date for filter</p>
|
||||
<div class="flex flex-row rounded-xl py-10">
|
||||
<div class="flex flex-row place-items-center">
|
||||
<label for="start_date">From Date</label>
|
||||
<input type="date" name="start_date" id="start_date" />
|
||||
</div> |
|
||||
<div class="flex flex-row place-items-center">
|
||||
<label for="end_date">To Date</label>
|
||||
<input type="date" name="end_date" id="end_date" />
|
||||
</div>
|
||||
</div>
|
||||
<button class="rounded-lg p-1 text-[#fff]" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center;" type="submit"><p class="text-center p-1.5">Search</p></button>
|
||||
</form>
|
||||
</div>
|
||||
</dialog>
|
||||
<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="Search by 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>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<table class="bg-[#fff] text-[#3F4254] rounded-lg font-bold" style="width: 100%;" >
|
||||
<thead>
|
||||
<tr>
|
||||
<?php if($_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>
|
||||
<div class="flex flex-row space-x-4">
|
||||
<p onclick="deleteCofermation();" class="rounded-lg p-2 text-[#443780] mr-4" style="border: 2px solid #443780; cursor: pointer;">No</p>
|
||||
<button class="rounded-lg p-3 text-[#fff]" type="submit" name="delete_records" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%);">Yes</button>
|
||||
</div>
|
||||
</div>
|
||||
</th>';
|
||||
?>
|
||||
<th class="text-center border-b-2 p-3">Name</th>
|
||||
<th class="text-center border-b-2 p-3">ID</th>
|
||||
<th class="text-center border-b-2 p-3">Status Update</th>
|
||||
<!-- <th class="text-center border-b-2 p-3">Contact Detail</th> -->
|
||||
<th class="text-center border-b-2 p-3">Form Name</th>
|
||||
<th class="text-center border-b-2 p-3">Date & Time</th>
|
||||
<th class="text-center border-b-2 p-3">Quick Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody >
|
||||
<?php
|
||||
// Number of records per page
|
||||
$recordsPerPage = 500;
|
||||
|
||||
// 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);
|
||||
$searchQuery = isset($_GET['search']) ? trim($_GET['search']) : '';
|
||||
$start_date = isset($_GET['start_date']) ? $_GET['start_date'] : '';
|
||||
$end_date = isset($_GET['end_date']) ? $_GET['end_date'] : '';
|
||||
$accessArray = explode(",", $_SESSION['access']);
|
||||
$placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,?
|
||||
$placeholderString = implode(',', array_fill(0, count($accessArray), '?'));
|
||||
|
||||
$all_states = "WB, SK";
|
||||
$state_array = explode(',', $all_states);
|
||||
$state_placeholder = rtrim(str_repeat('?,', count($state_array)), ',');
|
||||
|
||||
if (!empty($searchQuery)) {
|
||||
// this is keywords search
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE (id LIKE ? OR name LIKE ? OR email LIKE ? OR phone LIKE ?) AND business_type IN ($placeholders) ORDER BY time DESC LIMIT ?, ?");
|
||||
$stmt->bindValue(1, "%$searchQuery%", PDO::PARAM_STR);
|
||||
$stmt->bindValue(2, "%$searchQuery%", PDO::PARAM_STR);
|
||||
$stmt->bindValue(3, "%$searchQuery%", PDO::PARAM_STR);
|
||||
$stmt->bindValue(4, "%$searchQuery%", PDO::PARAM_STR);
|
||||
foreach ($accessArray as $key => $value) {
|
||||
$stmt->bindValue($key + 5, $value);
|
||||
}
|
||||
$stmt->bindValue(count($accessArray) + 5, 0, PDO::PARAM_INT); // Offset for pagination
|
||||
$stmt->bindValue(count($accessArray) + 6, $recordsPerPage, PDO::PARAM_INT); // Records per page
|
||||
// this is for date serch
|
||||
}elseif (!empty($start_date) && !empty($end_date)) {
|
||||
$start_date = date('Y-m-d', strtotime($start_date));
|
||||
$end_date = date('Y-m-d', strtotime($end_date));
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE time BETWEEN ? AND ? AND business_type IN ($placeholders)");
|
||||
$stmt->bindValue(1, $start_date);
|
||||
$stmt->bindValue(2, $end_date);
|
||||
foreach ($accessArray as $key => $value) {
|
||||
$stmt->bindValue($key + 3, $value);
|
||||
}
|
||||
}else{
|
||||
// if user type admin then show all lead
|
||||
if($_SESSION['user_type'] == 'admin'){
|
||||
$stmt = $conn->prepare("SELECT COUNT(*) FROM cleads");
|
||||
$stmt->execute();
|
||||
$totalRecords = $stmt->fetchColumn();
|
||||
|
||||
$totalPages = ceil($totalRecords / $recordsPerPage);
|
||||
|
||||
$offset = ($currentPage - 1) * $recordsPerPage;
|
||||
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads ORDER BY time DESC LIMIT :offset, :recordsPerPage");
|
||||
$stmt->bindParam(':offset', $offset, PDO::PARAM_INT);
|
||||
$stmt->bindParam(':recordsPerPage', $recordsPerPage, PDO::PARAM_INT);
|
||||
}else{
|
||||
$stmt = $conn->prepare("SELECT COUNT(*) FROM cleads WHERE business_type IN ($placeholders) AND state IN ($state_placeholder)");
|
||||
|
||||
// Bind values for business types
|
||||
foreach ($accessArray as $key => $value) {
|
||||
$stmt->bindValue($key + 1, $value);
|
||||
}
|
||||
|
||||
// Bind values for states
|
||||
$statePlaceholderStartIndex = count($accessArray) + 1; // Start index for state placeholders
|
||||
foreach ($state_array as $key => $state_value) {
|
||||
$stmt->bindValue($statePlaceholderStartIndex + $key, $state_value);
|
||||
}
|
||||
|
||||
$stmt->execute();
|
||||
|
||||
$totalRecords = $stmt->fetchColumn();
|
||||
$totalPages = ceil($totalRecords / $recordsPerPage);
|
||||
$offset = ($currentPage - 1) * $recordsPerPage;
|
||||
|
||||
// Adjusting the SQL query to remove duplicate state placeholders
|
||||
$state_placeholders = implode(',', array_fill(0, count($state_array), '?')); // Generate placeholders for states
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type IN ($placeholders) AND state IN ($state_placeholders) ORDER BY time DESC LIMIT ?, ?");
|
||||
|
||||
// Bind values for business types
|
||||
$paramCount = count($accessArray);
|
||||
for ($i = 0; $i < $paramCount; $i++) {
|
||||
$stmt->bindValue($i + 1, $accessArray[$i]);
|
||||
}
|
||||
|
||||
// Bind values for states
|
||||
$statePlaceholderStartIndex = $paramCount + 1; // Start index for state placeholders
|
||||
for ($i = 0; $i < count($state_array); $i++) {
|
||||
$stmt->bindValue($statePlaceholderStartIndex + $i, $state_array[$i]);
|
||||
}
|
||||
|
||||
// Bind the offset and recordsPerPage parameters
|
||||
$stmt->bindValue($paramCount + count($state_array) + 1, $offset, PDO::PARAM_INT);
|
||||
$stmt->bindValue($paramCount + count($state_array) + 2, $recordsPerPage, PDO::PARAM_INT);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
var_dump($rows);
|
||||
$row_count = count($rows);
|
||||
for ($i = 0; $i < $row_count; $i++) {
|
||||
// echo $row_count . " ";
|
||||
}
|
||||
echo "<p class='px-4'>Total ".$row_count." Rows Found</p>";
|
||||
// Status Conditional Color
|
||||
foreach($rows as $row){
|
||||
$lead_id = $row['id'];
|
||||
if($row['status'] == 'New'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';}
|
||||
elseif($row['status'] == 'Contacted'){$conditional_background_color = 'background-color: #D4FFFF; border: 2px solid #2C9C9C; border-radius: 20px; text-align: center; color: #2C9C9C;';}
|
||||
elseif($row['status'] == 'Disqualified'){$conditional_background_color = 'background-color: #CECECE; border: 2px solid #3F4254; border-radius: 20px; text-align: center; color: #3F4254;';}
|
||||
elseif($row['status'] == 'Converted'){$conditional_background_color = 'background-color: #D4FDE7; border: 2px solid #40916C; border-radius: 20px; text-align: center; color: #40916C;';}
|
||||
elseif($row['status'] == 'Warm'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';}
|
||||
// if status = warm then select
|
||||
// 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>
|
||||
<?php if($_SESSION['user_type'] == 'admin'){?>
|
||||
<td class="border-y-2 p-2">
|
||||
<input type="checkbox" name="selected_records[]" value="<?php echo $row['id']; ?>" id="<?php echo $row['id']; ?>" />
|
||||
</td>
|
||||
<?php }?>
|
||||
<td class="border-y-2 p-2"><label for="<?php echo $row['id']; ?>"><?php echo $row['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 $row['id'] ?>"><?php echo $row['id'] ?></a></td>
|
||||
<td class="border-y-2 p-2"><div style="<?php echo $conditional_background_color; ?> font-weight: bold;"><?php echo $row['status'];?></div></td>
|
||||
<!-- <td class="border-y-2 p-2">
|
||||
<p><i class="fa fa-envelope"> <?php // echo $row['email'] ?></i></p>
|
||||
<p><i class="fa fa-phone"> <?php // echo $row['phone'] ?></i></p>
|
||||
</td> -->
|
||||
<td class="border-y-2 p-2"><?php echo $row['formname'] ?></td>
|
||||
<td class="border-y-2 p-2"><?php echo $row['time'] ?></td>
|
||||
<td class="border-y-2 p-2">
|
||||
<div class="flex flex-row justify-center place-items-center">
|
||||
<a href="mailto:<?php echo $row['email'] ?>"><i class="fa fa-envelope" style="font-size: 20px"></i></a>
|
||||
<a href="https://wa.me/<?php echo $row['phone'] ?>?text=Hello%2C%20how%20are%20you%3F"><i class="fab fa-whatsapp" style="font-size: 20px"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<!-- Pagination Links -->
|
||||
<div class="pagination">
|
||||
<?php if ($currentPage > 1): ?>
|
||||
<a href="?page=<?php echo ($currentPage - 1); ?>">Previous</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php for ($i = 1; $i <= $totalPages; $i++): ?>
|
||||
<a href="?page=<?php echo $i; ?>" <?php if ($i === $currentPage) echo 'class="active"'; ?>><?php echo $i; ?></a>
|
||||
<?php endfor; ?>
|
||||
|
||||
<?php if ($currentPage < $totalPages): ?>
|
||||
<a href="?page=<?php echo ($currentPage + 1); ?>">Next</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- New Lead Form Section -->
|
||||
<div id="add-lead-form" class="add-lead-form">
|
||||
<div class="flex flex-row place-content-between p-2" style="border-bottom: 2px solid #464E5F; border-style: dashed;">
|
||||
<p class="text-[25px] font-bold">Add Lead</p>
|
||||
<p onclick="toggleDisplay();" class="rounded-lg px-1.5 text-[#464E5F] text-[25px] cursor-pointer" style="border: 2px solid #464E5F; border-radius: 50%;">✘</p>
|
||||
</div>
|
||||
<form action="" method="post" class="p-4">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2">
|
||||
<div class="flex flex-col mr-4">
|
||||
<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>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="state"> State:</label>
|
||||
<select name="state" id="state" onchange="fetchCities()" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;">
|
||||
<option value="">Select State</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="city"> City:</label>
|
||||
<select name="city" id="city" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;">
|
||||
<option value="">Select City</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="address">Address:</label>
|
||||
<input class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="address" id="address" />
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="name">Name:</label>
|
||||
<input class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="name" id="name" />
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="gender">Gender:</label>
|
||||
<select class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="gender" id="gender" >
|
||||
<option value="Male">Male</option>
|
||||
<option value="Female">Female</option>
|
||||
<option value="Others">Others</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="profession">Profession:</label>
|
||||
<input class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="profession" id="profession" />
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="email">E-mail:</label>
|
||||
<input class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="email" id="email" />
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="phone">Phone:</label>
|
||||
<input class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="phone" id="phone" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row place-content-between p-2 text-[25px] font-bold" style="border-bottom: 2px solid #464E5F; border-style: dashed;">Lead Information</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2">
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="origin">Details:</label>
|
||||
<select class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="origin" id="origin" >
|
||||
<option value="Facebook Ads">Facebook Ads</option>
|
||||
<option value="Google Ads">Google Ads</option>
|
||||
<option value="Linkedin Ads">Linkedin Ads</option>
|
||||
<option value="Instagram">Instagram</option>
|
||||
<option value="Messenger">Messenger</option>
|
||||
<option value="Whatsapp">Whatsapp</option>
|
||||
<option value="GMB">GMB</option>
|
||||
<option value="Linkedin">Linkedin</option>
|
||||
<option value="Inbound Call">Inbound Call</option>
|
||||
<option value="Outbound Call">Outbound Call</option>
|
||||
<option value="Others">Others</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="user">Lead Owner:</label>
|
||||
<select class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="user" id="user" >
|
||||
<?php
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("SELECT * FROM users");
|
||||
$stmt->execute();
|
||||
$users_rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$row_count = count($users_rows);
|
||||
if($row_count > 0){
|
||||
foreach($users_rows as $users_data){
|
||||
echo '<option value="'.$users_data['email'].'">'.$users_data['email'].'</option>';
|
||||
}
|
||||
} else{
|
||||
echo '<p>No users Found</p>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="note">Note:</label>
|
||||
<textarea type="text" name="note" id="note" rows="6" cols="10" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;"></textarea>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<input class="p-2" type="submit" name="new_lead" id="new_lead" value="Submit" style="color:#fff; border-radius: 6px; background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; margin-top: 10px;"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
// 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 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();
|
||||
|
||||
const dialog = document.querySelector("dialog");
|
||||
const showButton = document.querySelector("dialog + button");
|
||||
const closeButton = document.querySelector("dialog button");
|
||||
|
||||
// "Show the dialog" button opens the dialog modally
|
||||
showButton.addEventListener("click", () => {
|
||||
dialog.showModal();
|
||||
});
|
||||
|
||||
// "Close" button closes the dialog
|
||||
closeButton.addEventListener("click", () => {
|
||||
dialog.close();
|
||||
});
|
||||
function toggleDisplay() {
|
||||
var element = document.getElementById('add-lead-form');
|
||||
if (element.style.display === 'block') {
|
||||
element.style.display = 'none';
|
||||
} else {
|
||||
element.style.display = 'block';
|
||||
element.classList.add('slide-in-animation'); // Add class to trigger animation
|
||||
}
|
||||
}
|
||||
|
||||
// Event listener for the Esc key
|
||||
document.addEventListener('keydown', function(event) {
|
||||
if (event.keyCode === 27) {
|
||||
var modal = document.getElementById('add-lead-form');
|
||||
if (modal.style.display === 'block') {
|
||||
modal.style.display = 'none';
|
||||
}
|
||||
}
|
||||
});
|
||||
function deleteCofermation(){
|
||||
let deleteButton = document.getElementById('delete-button');
|
||||
let leadID = document.getElementById('<?php echo $row['id']; ?>').value;
|
||||
if(leadID != null){
|
||||
if(deleteButton.style.display === 'flex'){
|
||||
deleteButton.style.display = 'none';
|
||||
}else{
|
||||
deleteButton.style.display = 'flex'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.add-lead-form {
|
||||
background-color: #F8F8F8;
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0%;
|
||||
right: 0%;
|
||||
transform: translateX(100%);
|
||||
/* transform: translate(-0%, -50%); */
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
box-shadow: 0px 0px 20px 0px #443780;
|
||||
border-radius: 2px;
|
||||
z-index: 100;
|
||||
height: 100%;
|
||||
animation: slideInRight 0.5s forwards; /* Animation to slide in */
|
||||
/* overflow-x: auto; */
|
||||
}
|
||||
|
||||
@keyframes slideInRight {
|
||||
from {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
to {
|
||||
transform: translateX(0%);
|
||||
}
|
||||
}
|
||||
/* .add-lead-form{
|
||||
background-color: #F8F8F8;
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
right: 0%;
|
||||
transform: translate(-0%, -50%);
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
box-shadow: 0px 0px 20px 0px #443780;
|
||||
border-radius: 5px;
|
||||
z-index: 100;
|
||||
height: 100%;
|
||||
} */
|
||||
.delete-confirm{
|
||||
position: fixed;
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
background-color: #E6E5F4;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
padding: 40px 50px 40px 50px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>WhatsApp Message Link</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Replace "1234567890" with the phone number and "Hello!" with the message you want to send -->
|
||||
<a href="https://wa.me/919635598420?text=Hello!" target="_blank">Click here to message</a>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
// echo $_SESSION['access'];
|
||||
?>
|
||||
<div>
|
||||
<table style="overflow-x: auto;" id="myTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align: center;">Name</th>
|
||||
<th style="text-align: center;">ID</th>
|
||||
<th style="text-align: center;">Status</th>
|
||||
<th style="text-align: center;">Email</th>
|
||||
<th style="text-align: center;">Phone</th>
|
||||
<th style="text-align: center;">business_type</th>
|
||||
<th style="text-align: center;">Time</th>
|
||||
<th style="text-align: center;">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$accessArray = explode(",", $_SESSION['access']);
|
||||
$placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,?
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type IN ($placeholders) LIMIT 2");
|
||||
foreach ($accessArray as $key => $value) {
|
||||
$stmt->bindValue($key + 1, $value);
|
||||
}
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
// var_dump($rows);
|
||||
echo json_encode($rows);
|
||||
echo '
|
||||
<div id="example-table"></div>
|
||||
|
||||
<link href="https://unpkg.com/tabulator-tables@6.2.0/dist/css/tabulator.min.css" rel="stylesheet">
|
||||
<script type="text/javascript" src="https://unpkg.com/tabulator-tables@6.2.0/dist/js/tabulator.min.js"></script>
|
||||
<script>
|
||||
//define data
|
||||
var tabledata = '.json_encode($rows).';
|
||||
|
||||
//define table
|
||||
var table = new Tabulator("#example-table", {
|
||||
data:tabledata,
|
||||
autoColumns:true,
|
||||
});
|
||||
</script>
|
||||
';
|
||||
$num_rows = $stmt->rowCount();
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- <script src="https://cdn.datatables.net/2.0.3/js/dataTables.js"></script>
|
||||
<script>
|
||||
let table = new DataTable('#myTable', {
|
||||
// options
|
||||
});
|
||||
</script> -->
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Grid.js Row Selection Example</title>
|
||||
<!-- Include Grid.js CDN link -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/gridjs/dist/gridjs.production.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gridjs/dist/theme/mermaid.min.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="grid"></div>
|
||||
|
||||
<script>
|
||||
const grid = new gridjs.Grid({
|
||||
columns: ['ID', 'Name', 'Age'],
|
||||
data: [
|
||||
[1, 'John', 30],
|
||||
[2, 'Doe', 25],
|
||||
[3, 'Jane', 35]
|
||||
],
|
||||
plugins: [
|
||||
gridjs.plugins.selection({
|
||||
enabled: true,
|
||||
// Optional: handle selection change
|
||||
onChange: (selectedRows, selectedRowIds) => {
|
||||
console.log("Selected Rows:", selectedRows);
|
||||
console.log("Selected Row IDs:", selectedRowIds);
|
||||
}
|
||||
})
|
||||
]
|
||||
}).render(document.getElementById('grid'));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
if(isset($url[2])){
|
||||
$slug2="";
|
||||
if (strpos($url[2], "?") !== false) {
|
||||
$url2 = explode('?', $url[2]);
|
||||
$slug2=$url2[0];
|
||||
} else $slug2=$url[2];
|
||||
if($slug2=="") require_once('forms/_home.php');
|
||||
elseif(file_exists(__DIR__."/forms/".$slug2.".php")) include __DIR__."/forms/".$slug2.".php";
|
||||
else require_once('forms/.htac_404.php');
|
||||
}
|
||||
else require_once('forms/_home.php');
|
||||
|
||||
// uri - slug handler ends
|
||||
?>
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
?>
|
||||
<div>
|
||||
<a style="float: right; padding: 10px;" href="/forms/add-forms">Add Forms</a>
|
||||
</div>
|
||||
<?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 addforms");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
?>
|
||||
<div id="grid"></div>
|
||||
<script>
|
||||
const grid = new gridjs.Grid({
|
||||
columns: ["ID", "formname", "bverticals"
|
||||
// { name: "ID", formatter: (cell) => {return gridjs.html(`<a href="/bv/edit-bv/?id=${cell}">Edit</a>`);}}, "Time"
|
||||
],
|
||||
pagination: {limit: 10},
|
||||
search: true,
|
||||
sort: true,
|
||||
resizable: true,
|
||||
data: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve(<?php echo json_encode($rows); ?>);
|
||||
}, 1000);
|
||||
});
|
||||
},
|
||||
loading: true
|
||||
});
|
||||
grid.render(document.getElementById("grid"));
|
||||
</script>
|
||||
<?php
|
||||
// if (count($rows) >= 1) {
|
||||
// foreach($rows as $row){
|
||||
// echo ' <div style="display: flex; flex-direction: row;">
|
||||
// <a href="/cleads/by-business-verticals/?bv='.$row['bv'].'">'.$row['bv'].'</a>
|
||||
// </div>';
|
||||
// }
|
||||
// } else {
|
||||
// echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
// }
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
if($_SERVER['REQUEST_METHOD'] == "POST" ){
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("INSERT INTO addforms (formname, bverticals) VALUES (:formname, :bverticals)");
|
||||
$stmt->bindParam(':formname', $_POST['formname']);
|
||||
$stmt->bindParam(':bverticals', $_POST['bverticals']);
|
||||
$stmt->execute();
|
||||
echo "New Form added successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div style="max-width: 500px;">
|
||||
<form method="post">
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="formname">Form Name:</label>
|
||||
<input type="text" name="formname" id="formname" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="bverticals">Select Business Verticals:</label><br>
|
||||
<select name="bverticals" id="bverticals">
|
||||
<option value="0">-Select-</option>
|
||||
<?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 business_verticals");
|
||||
$stmt->execute();
|
||||
$bvrows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
foreach($bvrows as $bvdata){?>
|
||||
<option value="<?php echo $bvdata['bv']; ?>"><?php echo $bvdata['bv']; ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" name="submit" id="submit" value="Save" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
|
@ -0,0 +1,93 @@
|
|||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
// require_once('/var/www/html/.htac_header.php');
|
||||
if($_SESSION['log_status'] == 1){
|
||||
echo '<script>window.location.href = "/cleads";</script>';
|
||||
// exit();
|
||||
}
|
||||
if ($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['pass']) && isset($_POST['email'])) {
|
||||
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 users WHERE email = :email AND pass = :pass");
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':pass', $password);
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
// var_dump($rows);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows == 1) {
|
||||
foreach($rows as $row){
|
||||
$_SESSION["loggedin"] = true;
|
||||
$_SESSION["log_status"] = 1;
|
||||
$_SESSION["user_type"] = $row['type'];
|
||||
$_SESSION["access"] = $row['access'];
|
||||
$_SESSION["name"] = $row['name'];
|
||||
$_SESSION["email"] = $row['email'];
|
||||
echo '<script>window.location.href = "/cleads";</script>';
|
||||
// echo $_SESSION["loggedin"].$_SESSION["log_status"].$_SESSION["access"].$_SESSION["name"].$_SESSION["email"];
|
||||
}
|
||||
} else{
|
||||
echo "<p class='text-danger'>Credentials did not match</p>";
|
||||
}
|
||||
|
||||
// else echo "credentials did not match";+
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="container-fluid" style="background-image: url('/assets/login-back1.jpg'); background-position: center; background-size: cover; background-repeat: no-repeat; height: 100vh; width: 100%;">
|
||||
<div class="login-section-center flex flex-col">
|
||||
<div class="blur-background text-[#fff]" style="width: 100%;">
|
||||
<div class="text-[#fff] px-6 pt-6 pb-[50px]">
|
||||
<h3 class="text-3xl font-bold">Welcome Back</h3>
|
||||
<h2 class="">Enter your email and password to access your account</h2>
|
||||
</div>
|
||||
<form action="" method="post" class="space-y-4 rounded-md">
|
||||
<div class="">
|
||||
<label for="email">Email:</label>
|
||||
<input type="text" class="p-2 bg-transparent text-[#fff] border-[2px] border-[#fff] rounded-lg focus:outline-none w-full" name="email" placeholder="Email ID">
|
||||
</div>
|
||||
<div class="">
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" class="p-2 bg-transparent text-[#fff] border-[2px] border-[#fff] rounded-lg focus:outline-none w-full" name="pass" placeholder="Password">
|
||||
</div>
|
||||
<div class="flex flex-row place-content-between font-extralight ">
|
||||
<div class="flex flex-row justify-center">
|
||||
<input type="checkbox" name="remem" id="remem" />
|
||||
<label for="remem">Remember me</label>
|
||||
</div>
|
||||
<a href="#">Forgot Password?</a>
|
||||
</div>
|
||||
<div class="flex flex-col bg-[#7875F4] rounded-lg p-2">
|
||||
<button type="submit" class="">Login</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.login-section-center{
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
position: absolute;
|
||||
background-color: transparent;
|
||||
|
||||
}
|
||||
.blur-background{
|
||||
backdrop-filter: blur(2px);
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 20px;
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
|
||||
// Start the session
|
||||
session_start();
|
||||
|
||||
// Unset all session variables
|
||||
$_SESSION = array();
|
||||
|
||||
// Destroy the session
|
||||
session_destroy();
|
||||
echo '<div class="logout-did">
|
||||
<p>Login Again? <a href="/login">Click Here</a></p>
|
||||
</div>';
|
||||
?>
|
||||
|
||||
<style>
|
||||
.logout-did{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 300px;
|
||||
font-size: 25px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
if(isset($url[2])){
|
||||
$slug2="";
|
||||
if (strpos($url[2], "?") !== false) {
|
||||
$url2 = explode('?', $url[2]);
|
||||
$slug2=$url2[0];
|
||||
} else $slug2=$url[2];
|
||||
if($slug2=="") require_once('notifications/_home.php');
|
||||
elseif(file_exists(__DIR__."/notifications/".$slug2.".php")) include __DIR__."/notifications/".$slug2.".php";
|
||||
else require_once('notifications/.htac_404.php');
|
||||
}
|
||||
else require_once('notifications/_home.php');
|
||||
|
||||
// uri - slug handler ends
|
||||
?>
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
?>
|
||||
<div>
|
||||
<div class="flex flex-row place-content-between">
|
||||
<p>Notifications</p>
|
||||
<button>Mark all as read</button>
|
||||
</div>
|
||||
<?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");
|
||||
// $stmt->bindParam(':leadid', $_GET['id']);
|
||||
$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>
|
||||
<?php
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
};
|
||||
|
||||
?>
|
||||
</div>
|
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
// echo $_SESSION['access'];
|
||||
?>
|
||||
<div>
|
||||
<table style="overflow-x: auto;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align: center;">Name</th>
|
||||
<th style="text-align: center;">ID</th>
|
||||
<th style="text-align: center;">Status</th>
|
||||
<th style="text-align: center;">Email</th>
|
||||
<th style="text-align: center;">Phone</th>
|
||||
<th style="text-align: center;">business_type</th>
|
||||
<th style="text-align: center;">Time</th>
|
||||
<th style="text-align: center;">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$accessArray = explode(",", $_SESSION['access']);
|
||||
$placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,?
|
||||
|
||||
$stmt = $conn->prepare("SELECT COUNT(*) as total FROM cleads WHERE business_type IN ($placeholders)");
|
||||
foreach ($accessArray as $key => $value) {
|
||||
$stmt->bindValue($key + 1, $value);
|
||||
}
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$totalRecords = $result['total'];
|
||||
|
||||
$recordsPerPage = 100; // Number of records per page
|
||||
$totalPages = ceil($totalRecords / $recordsPerPage);
|
||||
$page = isset($_GET['page']) ? $_GET['page'] : 1; // Current page number
|
||||
$offset = ($page - 1) * $recordsPerPage;
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type IN ($placeholders) LIMIT $recordsPerPage OFFSET $offset");
|
||||
foreach ($accessArray as $key => $value) {
|
||||
$stmt->bindValue($key + 1, $value);
|
||||
}
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows >= 1) {
|
||||
foreach($rows as $row){
|
||||
echo ' <tr>
|
||||
<td style="text-align: center;">'.$row['name'].'</td>
|
||||
<td style="text-align: center;"><a href="/edit-lead/?id='.$row['id'].'">'.$row['id'].'</a></td>
|
||||
<td style="text-align: center;">'.$row['status'].'</td>
|
||||
<td style="text-align: center;">'.$row['email'].'</td>
|
||||
<td style="text-align: center;">'.$row['phone'].'</td>
|
||||
<td style="text-align: center;">'.$row['business_type'].'</td>
|
||||
<td style="text-align: center;">'.$row['time'].'</td>
|
||||
<td style="text-align: center;">Delete</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
// Pagination links
|
||||
// echo '<tr><td colspan="8" style="text-align: center;">';
|
||||
// for ($i = 1; $i <= $totalPages; $i++) {
|
||||
// echo '<a href="?page='.$i.'">'.$i.'</a> ';
|
||||
// }
|
||||
// echo '</td></tr>';
|
||||
} else{
|
||||
echo "<tr><td colspan='8' class='text-danger'>Not Found any Data</td></tr>";
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<tr><td colspan='8' class='text-danger'>Error: " . $e->getMessage() . "</td></tr>";
|
||||
};
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
|
@ -0,0 +1,25 @@
|
|||
<div id="example-table"></div>
|
||||
|
||||
<link href="https://unpkg.com/tabulator-tables@6.2.0/dist/css/tabulator.min.css" rel="stylesheet">
|
||||
<script type="text/javascript" src="https://unpkg.com/tabulator-tables@6.2.0/dist/js/tabulator.min.js"></script>
|
||||
<script>
|
||||
//define data
|
||||
var tabledata = [
|
||||
{id:1, name:"Oli Bob", location:"United Kingdom", gender:"male", rating:1, col:"red", dob:"14/04/1984"},
|
||||
{id:2, name:"Mary May", location:"Germany", gender:"female", rating:2, col:"blue", dob:"14/05/1982"},
|
||||
{id:3, name:"Christine Lobowski", location:"France", gender:"female", rating:0, col:"green", dob:"22/05/1982"},
|
||||
{id:4, name:"Brendon Philips", location:"USA", gender:"male", rating:1, col:"orange", dob:"01/08/1980"},
|
||||
{id:5, name:"Margret Marmajuke", location:"Canada", gender:"female", rating:5, col:"yellow", dob:"31/01/1999"},
|
||||
{id:6, name:"Frank Harbours", location:"Russia", gender:"male", rating:4, col:"red", dob:"12/05/1966"},
|
||||
{id:7, name:"Jamie Newhart", location:"India", gender:"male", rating:3, col:"green", dob:"14/05/1985"},
|
||||
{id:8, name:"Gemma Jane", location:"China", gender:"female", rating:0, col:"red", dob:"22/05/1982"},
|
||||
{id:9, name:"Emily Sykes", location:"South Korea", gender:"female", rating:1, col:"maroon", dob:"11/11/1970"},
|
||||
{id:10, name:"James Newman", location:"Japan", gender:"male", rating:5, col:"red", dob:"22/03/1998"},
|
||||
];
|
||||
|
||||
//define table
|
||||
var table = new Tabulator("#example-table", {
|
||||
data:tabledata,
|
||||
autoColumns:true,
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
?>
|
||||
|
||||
<div>
|
||||
<table style="overflow-x: auto;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align: center;">Name</th>
|
||||
<th style="text-align: center;">Email</th>
|
||||
<th style="text-align: center;">Phone</th>
|
||||
<th style="text-align: center;">Access</th>
|
||||
<th style="text-align: center;">Time</th>
|
||||
<th style="text-align: center;">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?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 users");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows >= 1) {
|
||||
foreach($rows as $row){
|
||||
echo ' <tr>
|
||||
<td style="text-align: center;">'.$row['name'].'</td>
|
||||
<td style="text-align: center;">'.$row['email'].'</td>
|
||||
<td style="text-align: center;">'.$row['mobile'].'</td>
|
||||
<td style="text-align: center;">'.$row['access'].'</td>
|
||||
<td style="text-align: center;">'.$row['time'].'</td>
|
||||
<td style="text-align: center;"><a href="/users/edit-user/?id='.$row['id'].'">Edit</a> | <a href="/users/delete-user/?id='.$row['id'].'">Delete</a> </td>
|
||||
</tr>';
|
||||
}
|
||||
} else{
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
?>
|
||||
<div>
|
||||
<a href="/users/add-user" class="" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; padding: 10px 20px 10px 20px; color: #fff; border-radius: 6px; float: right; margin-top: 30px;">Add User</a>
|
||||
</div>
|
||||
<table class="bg-[#fff] text-[#3F4254] rounded-lg font-bold">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center border-b-2 p-3">Name</th>
|
||||
<th class="text-center border-b-2 p-3">Email</th>
|
||||
<th class="text-center border-b-2 p-3">Mobile</th>
|
||||
<th class="text-center border-b-2 p-3">Time</th>
|
||||
<th class="text-center border-b-2 p-3">Access</th>
|
||||
<th class="text-center border-b-2 p-3">Access by State</th>
|
||||
<th class="text-center border-b-2 p-3">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?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 users");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
foreach($rows as $row){
|
||||
?>
|
||||
<tr>
|
||||
<td class="border-y-2 p-2"><?php echo $row['name']; ?></td>
|
||||
<td class="border-y-2 p-2"><?php echo $row['email']; ?></td>
|
||||
<td class="border-y-2 p-2"><?php echo $row['mobile']; ?></td>
|
||||
<td class="border-y-2 p-2"><?php echo $row['time']; ?></td>
|
||||
<td class="border-y-2 p-2"><?php echo $row['access']; ?></td>
|
||||
<td class="border-y-2 p-2"><?php echo $row['access']; ?></td>
|
||||
<td class="border-y-2 p-2">
|
||||
<div class="flex flex-row justify-center">
|
||||
<a href="/admin/edit-user/?id=<?php echo $row['id']; ?>">Edit</a> |
|
||||
<a href="/admin/delete-user/?id=<?php echo $row['id']; ?>">Delete</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<?php }
|
||||
$num_rows = $stmt->rowCount();
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
|
@ -0,0 +1,145 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch(PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$select_access = ['beanstalk', 'inhouse', 'teenybeans', 'iimtt', 'buzzapp', 'atheneum', 'teenybeans_curriculum'];
|
||||
$access_values_array = [];
|
||||
|
||||
foreach ($select_access as $access) {
|
||||
if (isset($_POST[$access])) {
|
||||
$access_values_array[] = $_POST[$access];
|
||||
}
|
||||
}
|
||||
$access_value = implode(',', $access_values_array);
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$phone = $_POST['phone'];
|
||||
$password = md5($_POST['pass']);
|
||||
try {
|
||||
$stmt = $conn->prepare("INSERT INTO users (name, email, mobile, access, pass) VALUES (:name, :email, :mobile, :access, :pass)");
|
||||
$stmt->bindParam(':name', $name);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':mobile', $phone);
|
||||
$stmt->bindParam(':access', $access_value);
|
||||
$stmt->bindParam(':pass', $password);
|
||||
$stmt->execute();
|
||||
|
||||
echo "Record added successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; margin-top: 30px; margin-bottom: 30px;">
|
||||
<form action="" method="post" style="width: 600px; max-width: 600px; border: 1px solid #36365050; padding: 20px; border-radius: 20px; box-shadow: 0px 0px 10px 0px #363650;">
|
||||
<p style="font-size: 25px; font-weight: bold; margin-top: 10px; margin-bottom: 10px;">Add new user</p>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" name="name" id="name" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="email">E-mail:</label>
|
||||
<input type="text" name="email" id="email" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="phone">Phone:</label>
|
||||
<input type="text" name="phone" id="phone" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<p>Access:</p>
|
||||
<?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 business_verticals");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows >= 1) {
|
||||
foreach($rows as $row){ ?>
|
||||
<div>
|
||||
<input type="checkbox" name="<?php echo $row['bv']; ?>" id="<?php echo $row['bv']; ?>" value="<?php echo $row['bv']; ?>" />
|
||||
<label for="<?php echo $row['bv']; ?>" style="text-transform: uppercase;"><?php echo $row['bv']; ?></label>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
} else{
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<p style="font-size: 16px; font-weight: bold; margin-top: 10px;">Access by state:</p>
|
||||
<div id="stateCheckboxes"></div>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="pass">Password:</label>
|
||||
<input type="text" name="pass" id="pass" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<input type="submit" name="submit" id="submit" value="Submit" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; padding: 10px 20px 10px 20px; color: #fff; border-radius: 6px; float: right; margin-top: 30px;" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function fetchStates() {
|
||||
fetch(`https://api.siliconpin.com/v3/list/country/state/?country=IN`)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
const stateCheckboxes = document.getElementById('stateCheckboxes');
|
||||
stateCheckboxes.innerHTML = ''; // Clear previous checkboxes
|
||||
|
||||
data.forEach(state => {
|
||||
const checkboxDiv = document.createElement('div');
|
||||
|
||||
const checkbox = document.createElement('input');
|
||||
checkbox.type = 'checkbox';
|
||||
checkbox.name = 'states[]'; // You might want to use an array here if submitting form
|
||||
checkbox.value = state.iso2;
|
||||
|
||||
const label = document.createElement('label');
|
||||
label.textContent = ' ' + state.name;
|
||||
label.style = 'text-transform: uppercase'
|
||||
|
||||
checkboxDiv.appendChild(checkbox);
|
||||
checkboxDiv.appendChild(label);
|
||||
|
||||
stateCheckboxes.appendChild(checkboxDiv);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fetchStates();
|
||||
|
||||
</script>
|
||||
<style>
|
||||
/* For small screens */
|
||||
@media screen and (max-width: 767px) {
|
||||
#stateCheckboxes {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr); /* 2 columns */
|
||||
gap: 10px; /* Adjust the gap as needed */
|
||||
}
|
||||
}
|
||||
|
||||
/* For large screens */
|
||||
@media screen and (min-width: 768px) {
|
||||
#stateCheckboxes {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr); /* 3 columns */
|
||||
gap: 10px; /* Adjust the gap as needed */
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,223 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch(PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$select_access = ['beanstalk', 'inhouse', 'teenybeans', 'iimtt', 'buzzapp', 'atheneum', 'teenybeans_curriculum'];
|
||||
$access_values_array = [];
|
||||
|
||||
foreach ($select_access as $access) {
|
||||
if (isset($_POST[$access])) {
|
||||
$access_values_array[] = $_POST[$access];
|
||||
}
|
||||
}
|
||||
$access_value = implode(',', $access_values_array);
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$phone = $_POST['phone'];
|
||||
$password = md5($_POST['pass']);
|
||||
$selected_states = implode(',', $_POST['states']); // Collect selected state values
|
||||
|
||||
try {
|
||||
$stmt = $conn->prepare("INSERT INTO users (name, email, mobile, access, pass, states) VALUES (:name, :email, :mobile, :access, :pass, :states)");
|
||||
$stmt->bindParam(':name', $name);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':mobile', $phone);
|
||||
$stmt->bindParam(':access', $access_value);
|
||||
$stmt->bindParam(':pass', $password);
|
||||
$stmt->bindParam(':states', $selected_states); // Bind selected states
|
||||
$stmt->execute();
|
||||
|
||||
echo "Record added successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; margin-top: 30px; margin-bottom: 30px;">
|
||||
<form action="" method="post" style="width: 600px; max-width: 600px; border: 1px solid #36365050; padding: 20px; border-radius: 20px; box-shadow: 0px 0px 10px 0px #363650;">
|
||||
<p style="font-size: 25px; font-weight: bold; margin-top: 10px; margin-bottom: 10px;">Add new user</p>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" name="name" id="name" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="email">E-mail:</label>
|
||||
<input type="text" name="email" id="email" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="phone">Phone:</label>
|
||||
<input type="text" name="phone" id="phone" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<p>Access:</p>
|
||||
<?php
|
||||
try {
|
||||
$stmt = $conn->prepare("SELECT * FROM business_verticals");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows >= 1) {
|
||||
foreach($rows as $row){ ?>
|
||||
<div>
|
||||
<input type="checkbox" name="<?php echo $row['bv']; ?>" id="<?php echo $row['bv']; ?>" value="<?php echo $row['bv']; ?>" />
|
||||
<label for="<?php echo $row['bv']; ?>" style="text-transform: uppercase;"><?php echo $row['bv']; ?></label>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
} else{
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<p style="font-size: 16px; font-weight: bold; margin-top: 10px;">Access by state:</p>
|
||||
<div id="selectedStateDisplay"></div>
|
||||
<div class="dropdown">
|
||||
<button class="dropbtn" id="selectStatesBtn">Select States</button>
|
||||
<div class="dropdown-content" id="stateDropdown">
|
||||
<!-- State options will be populated here -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="pass">Password:</label>
|
||||
<input type="text" name="pass" id="pass" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<input type="submit" name="submit" id="submit" value="Submit" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; padding: 10px 20px 10px 20px; color: #fff; border-radius: 6px; float: right; margin-top: 30px;" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
function fetchStates() {
|
||||
fetch(`https://api.siliconpin.com/v3/list/country/state/?country=IN`)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
const dropdownContent = document.getElementById('stateDropdown');
|
||||
dropdownContent.innerHTML = ''; // Clear previous content
|
||||
|
||||
data.forEach(state => {
|
||||
const checkboxDiv = document.createElement('div');
|
||||
|
||||
const checkbox = document.createElement('input');
|
||||
checkbox.type = 'checkbox';
|
||||
checkbox.name = 'states[]'; // You might want to use an array here if submitting form
|
||||
checkbox.value = state.iso2;
|
||||
checkbox.id = state.iso2;
|
||||
|
||||
const label = document.createElement('label');
|
||||
label.textContent = state.name;
|
||||
label.style = 'text-transform: uppercase';
|
||||
label.setAttribute('for', state.iso2);
|
||||
checkboxDiv.appendChild(checkbox);
|
||||
checkboxDiv.appendChild(label);
|
||||
dropdownContent.appendChild(checkboxDiv);
|
||||
|
||||
// Add event listener to checkbox change
|
||||
checkbox.addEventListener('change', function() {
|
||||
updateSelectedStateDisplay();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function toggleDropdown() {
|
||||
const dropdownContent = document.getElementById('stateDropdown');
|
||||
dropdownContent.classList.toggle('show');
|
||||
}
|
||||
|
||||
// Update the selected state display
|
||||
function updateSelectedStateDisplay() {
|
||||
const selectedStates = Array.from(document.querySelectorAll('input[name="states[]"]:checked'))
|
||||
.map(checkbox => checkbox.parentNode.querySelector('label').textContent);
|
||||
const selectedStateDisplay = document.getElementById('selectedStateDisplay');
|
||||
selectedStateDisplay.textContent = 'Selected States: ' + selectedStates.join(', ');
|
||||
}
|
||||
|
||||
// Add an event listener to the button
|
||||
document.getElementById('selectStatesBtn').addEventListener('click', function(event) {
|
||||
// Prevent the default form submission behavior
|
||||
event.preventDefault();
|
||||
// Toggle the dropdown visibility
|
||||
toggleDropdown();
|
||||
});
|
||||
fetchStates();
|
||||
</script>
|
||||
<style>
|
||||
.dropdown {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
border: 1px solid #363650;
|
||||
border-radius: 5px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dropbtn {
|
||||
border: 1px solid #363650;
|
||||
padding: 6px;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dropdown-content {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #f9f9f9;
|
||||
/* min-width: 160px; */
|
||||
width: 100%;
|
||||
overflow-y: auto;
|
||||
max-height: 230px; /* Adjust as needed */
|
||||
border: 1px solid #ddd;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.dropdown-content div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.dropdown-content div label {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.dropdown-content div:hover {
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
.show {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* For small screens */
|
||||
@media screen and (max-width: 767px) {
|
||||
#stateCheckboxes {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr); /* 2 columns */
|
||||
gap: 10px; /* Adjust the gap as needed */
|
||||
}
|
||||
}
|
||||
|
||||
/* For large screens */
|
||||
@media screen and (min-width: 768px) {
|
||||
#stateCheckboxes {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr); /* 3 columns */
|
||||
gap: 10px; /* Adjust the gap as needed */
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
if($_SERVER['REQUEST_METHOD'] == "POST"){
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$stmt = $conn->prepare("DELETE FROM users WHERE id = :id");
|
||||
$stmt->bindParam(':id', $_POST['id']);
|
||||
$stmt->execute();
|
||||
echo '<script>window.location.href = "/admin/users";</script>';
|
||||
exit();
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<form method="post">
|
||||
<p>Confirm to Delete id <?php echo $_GET['id']; ?>? </p>
|
||||
<input type="hidden" name="id" value="<?php echo $_GET['id']; ?>">
|
||||
<input type="submit" name="submit" id="submit" value="YES" />
|
||||
<a href="/users">NO</a>
|
||||
</form>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$select_access = ['beanstalk', 'inhouse', 'teenybeans', 'iimtt', 'buzzapp', 'atheneum', 'teenybeans_curriculum'];
|
||||
$access_values_array = [];
|
||||
|
||||
foreach ($select_access as $access) {
|
||||
if (isset($_POST[$access])) {
|
||||
$access_values_array[] = $_POST[$access];
|
||||
}
|
||||
}
|
||||
$access_value = implode(',', $access_values_array);
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$phone = $_POST['phone'];
|
||||
$password = md5($_POST['pass']);
|
||||
$user_id = $_GET['id'];
|
||||
|
||||
$stmt = $conn->prepare("UPDATE users SET name = :name, email = :email, mobile = :mobile, access = :access, pass = :pass WHERE id = :id");
|
||||
$stmt->bindParam(':name', $name);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':mobile', $phone);
|
||||
$stmt->bindParam(':access', $access_value);
|
||||
$stmt->bindParam(':pass', $password);
|
||||
$stmt->bindParam(':id', $user_id);
|
||||
$stmt->execute();
|
||||
|
||||
echo "Record updated successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?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 users WHERE id = :id");
|
||||
$stmt->bindParam(':id', $_GET['id']);
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows >= 1) {
|
||||
foreach($rows as $row){?>
|
||||
<div style="max-width: 600px;">
|
||||
<form action="" method="post">
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" name="name" id="name" value="<?php echo $row['name'] ?>" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="email">E-mail:</label>
|
||||
<input type="text" name="email" id="email" value="<?php echo $row['email'] ?>" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="phone">Phone:</label>
|
||||
<input type="text" name="phone" id="phone" value="<?php echo $row['mobile'] ?>" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<p>Access:</p>
|
||||
<?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 business_verticals");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows >= 1) {
|
||||
$user_stmt = $conn->prepare("SELECT `access` FROM `users` WHERE `id` = '".$_GET["id"]."'");
|
||||
$user_stmt->execute();
|
||||
$user_bvs = $user_stmt->fetchAll(PDO::FETCH_COLUMN);
|
||||
$user_bvs=explode(",", $user_bvs[0]); // you need to make the CSV to array.
|
||||
foreach($rows as $row) {
|
||||
$isChecked = in_array($row['bv'], $user_bvs);
|
||||
?>
|
||||
<div>
|
||||
<input type="checkbox" name="bvs[]" id="<?php echo $row['bv']; ?>" value="<?php echo $row['bv']; ?>" <?php if($isChecked) echo "checked"; ?> />
|
||||
<label for="<?php echo $row['bv']; ?>" style="text-transform: uppercase;"><?php echo $row['bv']; ?></label>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="pass">Password:</label>
|
||||
<input type="text" name="pass" id="pass" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<input type="submit" name="submit" id="submit" value="Submit"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
} else{
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,130 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch(PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
|
||||
// $name = $_POST['name'];
|
||||
// $email = $_POST['email'];
|
||||
// $phone = $_POST['phone'];
|
||||
// $password = md5($_POST['pass']);
|
||||
try {
|
||||
$select_access = ['beanstalk', 'inhouse', 'teenybeans', 'iimtt', 'buzzapp', 'atheneum', 'teenybeans_curriculum'];
|
||||
$access_values_array = [];
|
||||
|
||||
foreach ($select_access as $access) {
|
||||
if (isset($_POST[$access])) {
|
||||
$access_values_array[] = $_POST[$access];
|
||||
}
|
||||
}
|
||||
$access_value = implode(',', $access_values_array);
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$phone = $_POST['phone'];
|
||||
$password = md5($_POST['pass']);
|
||||
$user_id = $_GET['id'];
|
||||
$stmt = $conn->prepare("UPDATE users SET name = :name, email = :email, mobile = :mobile, access = :access, pass = :pass WHERE id = :id");
|
||||
$stmt->bindParam(':name', $name);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':mobile', $phone);
|
||||
$stmt->bindParam(':access', $access_value);
|
||||
$stmt->bindParam(':pass', $password);
|
||||
$stmt->bindParam(':id', $user_id);
|
||||
$stmt->execute();
|
||||
|
||||
echo "Record Updated successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?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 users WHERE id = :id");
|
||||
$stmt->bindParam(':id', $_GET['id']);
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows >= 1) {
|
||||
foreach($rows as $row){?>
|
||||
<div style="max-width: 600px;">
|
||||
<form action="" method="post">
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" name="name" id="name" value="<?php echo $row['name'] ?>" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="email">E-mail:</label>
|
||||
<input type="text" name="email" id="email" value="<?php echo $row['email'] ?>" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="phone">Phone:</label>
|
||||
<input type="text" name="phone" id="phone" value="<?php echo $row['mobile'] ?>" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<p>Access:</p>
|
||||
<?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 business_verticals");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
if ($num_rows >= 1) {
|
||||
$user_stmt = $conn->prepare("SELECT `access` FROM `users` WHERE `id` = '".$_GET["id"]."'");
|
||||
$user_stmt->execute();
|
||||
$user_bvs = $user_stmt->fetchAll(PDO::FETCH_COLUMN);
|
||||
$user_bvs=explode(",", $user_bvs[0]); // you need to make the CSV to array.
|
||||
foreach($rows as $row) {
|
||||
$isChecked = in_array($row['bv'], $user_bvs);
|
||||
?>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" name="<?php echo $row['bv']; ?>" id="<?php echo $row['bv']; ?>" value="<?php echo $row['bv']; ?>" <?php if($isChecked) echo "checked"; ?> />
|
||||
<label for="<?php echo $row['bv']; ?>" style="text-transform: uppercase;"><?php echo $row['bv']; ?></label>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="pass">Password:</label>
|
||||
<input type="text" name="pass" id="pass" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<input type="submit" name="submit" id="submit" value="Submit"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
} else{
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
echo '404';
|
|
@ -0,0 +1,75 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
<link rel="stylesheet" href="https://unpkg.com/gridjs/dist/theme/mermaid.min.css" />
|
||||
<script src="https://unpkg.com/gridjs/dist/gridjs.production.min.js"></script>
|
||||
<script src="https://unpkg.com/gridjs/plugins/selection/dist/selection.umd.js"></script>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" />
|
||||
|
||||
<!-- <link rel="stylesheet" type="text/css" href="/assets/main.css" /> -->
|
||||
<?php
|
||||
if($_SESSION['loggedin'] != true && $_SESSION['log_status'] != 1){
|
||||
echo '<script>window.location.href = "/login";</script>';
|
||||
// exit();
|
||||
|
||||
}
|
||||
function isMobileDevice() {
|
||||
// return preg_match('/(android|iphone|ipod|ipad|windows phone)/i', $_SERVER['HTTP_USER_AGENT']);
|
||||
return preg_match('/(Mobile|iphone|ipod|ipad|windows phone)/i', $_SERVER['HTTP_USER_AGENT']); // removed android as "request desktop site" removes
|
||||
}
|
||||
|
||||
if(isset($web_page_title)) echo '<title>'.$web_page_title.'</title>';
|
||||
if(isset($web_page_meta_description)) echo '<meta name="description" content="'.$web_page_meta_description.'">';
|
||||
if(isset($web_page_meta_keywords)) echo '<meta name="keywords" content="'.$web_page_meta_keywords.'">';
|
||||
if(isset($web_page_meta_author)) echo '<meta name="author" content="'.$web_page_author.'">';
|
||||
if(isset($web_page_meta_og_title)) echo '<meta property="og:title" content="'.$web_page_meta_og_title.'">';
|
||||
if(isset($web_page_meta_og_description)) echo '<meta property="og:description" content="'.$web_page_meta_og_description.'">';
|
||||
if(isset($web_page_meta_og_image)) echo '<meta property="og:image" content="'.$web_page_meta_og_image.'">';
|
||||
if(isset($web_page_meta_og_url)) echo '<meta property="og:url" content="'.$web_page_meta_og_url.'">';
|
||||
if(isset($web_page_meta_twitter_title)) echo '<meta name="twitter:title" content="'.$web_page_meta_twitter_title.'">';
|
||||
if(isset($web_page_meta_twitter_description)) echo '<meta name="twitter:description" content="'.$web_page_meta_twitter_description.'">';
|
||||
if(isset($web_page_meta_twitter_image)) echo '<meta name="twitter:image" content="'.$web_page_meta_twitter_image.'">';
|
||||
if(isset($web_page_meta_twitter_card)) echo '<meta name="twitter:card" content="'.$web_page_meta_twitter_card.'">';
|
||||
?>
|
||||
|
||||
</head>
|
||||
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
color: #363650;
|
||||
|
||||
background-color: #FBFBFB;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
max-width: 100%;
|
||||
}
|
||||
input[type="text"],input[type="password"], input[type="date"], textarea{
|
||||
/* color: #000; */
|
||||
/* background-color: #fff; */
|
||||
/* border: 2px solid #fff; */
|
||||
/* border-radius: 5px; */
|
||||
}
|
||||
select{
|
||||
border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;
|
||||
}
|
||||
label, option, input{
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* a {
|
||||
color: #ffc28a;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
color: #eb7000;
|
||||
} */
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
</head>
|
||||
<div class="topnav" id="myTopnav">
|
||||
<a href="/logout">Logout</a>
|
||||
<div class="dropdown">
|
||||
<button class="dropbtn">Leads by type<i class="fa fa-caret-down"></i></button>
|
||||
<div class="dropdown-content">
|
||||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.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 users WHERE email=:email");
|
||||
$stmt->bindParam(':email', $_SESSION['email']);
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
foreach($rows as $row){
|
||||
$user_access_data = explode(",", $row['access']);
|
||||
foreach($user_access_data as $access_data){
|
||||
$access_data_not_undescore = str_replace("_", " ", $access_data);
|
||||
echo '<a href="/cleads/by-business-verticals/?bv='.$access_data.'" style="text-transform: capitalize;">'.$access_data_not_undescore.'</a>';
|
||||
}
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($_SESSION['user_type'] == "admin"){echo '<a href="/forms">Forms</a><a href="/bv">Business Verticals</a><a href="/users">Users</a>';} ?>
|
||||
<?php
|
||||
// if($_SESSION['user_type'] == "admin"){echo '<a href="/cleads/?type=admin">All Leads</a>';}else{echo '<a href="/cleads/?type=user">All Leads</a>';}
|
||||
?>
|
||||
<a href="/cleads">All Leads</a>
|
||||
<a href="/" class="">Home</a>
|
||||
<a href="/notifications" class="">Notifications</a>
|
||||
<a href="javascript:void(0);" style="font-size:15px;" class="icon" onclick="myFunction()">☰</a>
|
||||
</div>
|
||||
<!-- <div style="padding-bottom: 64px;"></div> -->
|
||||
<script>
|
||||
function myFunction() {
|
||||
var x = document.getElementById("myTopnav");
|
||||
if (x.className === "topnav") {
|
||||
x.className += " responsive";
|
||||
} else {
|
||||
x.className = "topnav";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
/* body {margin:0;font-family:Arial} */
|
||||
|
||||
.topnav {
|
||||
overflow: hidden;
|
||||
background-color: #333;
|
||||
}
|
||||
|
||||
.topnav a {
|
||||
float: right;
|
||||
display: block;
|
||||
color: #f2f2f2;
|
||||
text-align: center;
|
||||
padding: 14px 16px;
|
||||
text-decoration: none;
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.active {
|
||||
background-color: #04AA6D;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.topnav .icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.dropdown {
|
||||
float: right;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.dropdown .dropbtn {
|
||||
font-size: 17px;
|
||||
border: none;
|
||||
outline: none;
|
||||
color: white;
|
||||
padding: 14px 16px;
|
||||
background-color: inherit;
|
||||
font-family: inherit;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.dropdown-content {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #f9f9f9;
|
||||
min-width: 138px;
|
||||
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.dropdown-content a {
|
||||
float: none;
|
||||
color: black;
|
||||
padding: 6px 16px;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.topnav a:hover, .dropdown:hover .dropbtn {
|
||||
background-color: #555;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.dropdown-content a:hover {
|
||||
background-color: #ddd;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.dropdown:hover .dropdown-content {
|
||||
display: block;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
.topnav a:not(:first-child), .dropdown .dropbtn {
|
||||
display: none;
|
||||
}
|
||||
.topnav a.icon {
|
||||
float: right;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
.topnav.responsive {position: relative;}
|
||||
.topnav.responsive .icon {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
.topnav.responsive a {
|
||||
float: none;
|
||||
display: block;
|
||||
text-align: left;
|
||||
}
|
||||
.topnav.responsive .dropdown {float: none;}
|
||||
.topnav.responsive .dropdown-content {position: relative;}
|
||||
.topnav.responsive .dropdown .dropbtn {
|
||||
display: block;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,203 @@
|
|||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
</head>
|
||||
<nav class="navbar">
|
||||
<div class="navbar-container container">
|
||||
<input type="checkbox" name="" id="">
|
||||
<div class="hamburger-lines">
|
||||
<span class="line line1"></span>
|
||||
<span class="line line2"></span>
|
||||
<span class="line line3"></span>
|
||||
</div>
|
||||
<ul class="menu-items">
|
||||
<li><a href="/">Home</a></li>
|
||||
<?php if($_SESSION['user_type'] == "admin"){echo '<li><a href="/users">Users</a></li>';} ?>
|
||||
<li><a href="/cleads">Leads</a></li>
|
||||
<li><a href="#">Product</a></li>
|
||||
<li><a href="#">Testimonial</a></li>
|
||||
</ul>
|
||||
|
||||
<h1 class="logo">Logo
|
||||
<!-- <img style="height: 50px;" src="/assets/mgm_logo.jpg" alt="" /> -->
|
||||
</h1>
|
||||
</div>
|
||||
</nav>
|
||||
<div style="padding-bottom: 64px;"></div>
|
||||
<style>
|
||||
*,
|
||||
*::after,
|
||||
*::before{
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.navbar input[type="checkbox"],
|
||||
.navbar .hamburger-lines{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.container{
|
||||
max-width: 1200px;
|
||||
width: 90%;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.navbar{
|
||||
box-shadow: 0px 5px 10px 0px #aaa;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
color: #000;
|
||||
opacity: 0.85;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.navbar-container{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 64px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.menu-items{
|
||||
order: 2;
|
||||
display: flex;
|
||||
}
|
||||
.logo{
|
||||
order: 1;
|
||||
font-size: 2.3rem;
|
||||
}
|
||||
|
||||
.menu-items li{
|
||||
list-style: none;
|
||||
margin-left: 1.5rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.navbar a{
|
||||
color: #444;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
transition: color 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.navbar a:hover{
|
||||
color: #117964;
|
||||
}
|
||||
|
||||
@media (max-width: 768px){
|
||||
.navbar{
|
||||
opacity: 0.95;
|
||||
}
|
||||
|
||||
.navbar-container input[type="checkbox"],
|
||||
.navbar-container .hamburger-lines{
|
||||
display: block;
|
||||
}
|
||||
|
||||
.navbar-container{
|
||||
display: block;
|
||||
position: relative;
|
||||
height: 64px;
|
||||
}
|
||||
|
||||
.navbar-container input[type="checkbox"]{
|
||||
position: absolute;
|
||||
display: block;
|
||||
height: 32px;
|
||||
width: 30px;
|
||||
top: 20px;
|
||||
left: 20px;
|
||||
z-index: 5;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.navbar-container .hamburger-lines{
|
||||
display: block;
|
||||
height: 28px;
|
||||
width: 35px;
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
left: 20px;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.navbar-container .hamburger-lines .line{
|
||||
display: block;
|
||||
height: 4px;
|
||||
width: 100%;
|
||||
border-radius: 10px;
|
||||
background: #333;
|
||||
}
|
||||
|
||||
.navbar-container .hamburger-lines .line1{
|
||||
transform-origin: 0% 0%;
|
||||
transition: transform 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.navbar-container .hamburger-lines .line2{
|
||||
transition: transform 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
.navbar-container .hamburger-lines .line3{
|
||||
transform-origin: 0% 100%;
|
||||
transition: transform 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.navbar .menu-items{
|
||||
padding-top: 100px;
|
||||
background: #fff;
|
||||
height: 100vh;
|
||||
max-width: 300px;
|
||||
transform: translate(-150%);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: -40px;
|
||||
padding-left: 40px;
|
||||
transition: transform 0.5s ease-in-out;
|
||||
box-shadow: 5px 0px 10px 0px #aaa;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.navbar .menu-items li{
|
||||
margin-bottom: 1.8rem;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.logo{
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 15px;
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
|
||||
.navbar-container input[type="checkbox"]:checked ~ .menu-items{
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
.navbar-container input[type="checkbox"]:checked ~ .hamburger-lines .line1{
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.navbar-container input[type="checkbox"]:checked ~ .hamburger-lines .line2{
|
||||
transform: scaleY(0);
|
||||
}
|
||||
|
||||
.navbar-container input[type="checkbox"]:checked ~ .hamburger-lines .line3{
|
||||
transform: rotate(-45deg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 500px){
|
||||
.navbar-container input[type="checkbox"]:checked ~ .logo{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,301 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
if($_SESSION['user_type']=='admin'){
|
||||
$all_leads_url = '/admin/cleads';
|
||||
} else
|
||||
$all_leads_url = '/cleads';{}
|
||||
?>
|
||||
<section class="bg-[#443780] py-1.5 px-4" style="position: fixed; width: 100%; z-index: 10;">
|
||||
<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">
|
||||
<!-- <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
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("SELECT * FROM users WHERE email=:email");
|
||||
$stmt->bindParam(':email', $_SESSION['email']);
|
||||
$stmt->execute();
|
||||
$usersNames = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
foreach($usersNames as $user_name){
|
||||
$nameParts = explode(" ", $user_name['name']);
|
||||
$firstInitial = substr($nameParts[0], 0, 1);
|
||||
$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>
|
||||
<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>
|
||||
</div>';
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div style="display: flex; flex-direction: row;">
|
||||
<div style="position: fixed; height: 100%;">
|
||||
<nav class="main-menu">
|
||||
<ul style="padding-top: 100px;">
|
||||
<li>
|
||||
<a href="<?php echo $all_leads_url; ?>">
|
||||
<i class="fa fa-2x"><img src="/assets/all-lead.png" alt="" /></i>
|
||||
<span class="nav-text" style="text-transform: capitalize;">All Leads</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<?php
|
||||
if($_SESSION['user_type']=='user'){
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("SELECT * FROM users WHERE email=:email");
|
||||
$stmt->bindParam(':email', $_SESSION['email']);
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$num_rows = $stmt->rowCount();
|
||||
foreach($rows as $row){
|
||||
$user_access_data = explode(",", $row['access']);
|
||||
foreach($user_access_data as $access_data){
|
||||
$access_data_not_undescore = str_replace("_", " ", $access_data);
|
||||
?>
|
||||
<li>
|
||||
<a href="/cleads/by-business-verticals/?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;">
|
||||
<?php echo $access_data_not_undescore; ?>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
}else{
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("SELECT * FROM business_verticals");
|
||||
$stmt->execute();
|
||||
$bv_rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$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']; ?>">
|
||||
<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;">
|
||||
<?php echo $access_data_not_undescore; ?>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<li>
|
||||
<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> -->
|
||||
<span class="nav-text">
|
||||
My Leads
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/add-csv">
|
||||
<i class="fa fa-2x"><img src="/assets/csv.png" alt="" /></i>
|
||||
<!-- <i class="fa fa-file fa-2x"></i> -->
|
||||
<span class="nav-text">
|
||||
Upload CSV
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
if($_SESSION['user_type']=='admin'){?>
|
||||
<li>
|
||||
<a href="/admin/users">
|
||||
<i class="fa fa-user fa-2x"></i>
|
||||
<span class="nav-text">
|
||||
Users
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/admin/business-verticals">
|
||||
<i class="fa fa-2x"><img src="/assets/all-lead.png" alt="" /></i>
|
||||
<span class="nav-text">
|
||||
Business Verticals
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php }
|
||||
?>
|
||||
</ul>
|
||||
<ul class="logout">
|
||||
<li>
|
||||
<a href="/logout">
|
||||
<i class="fa fa-power-off fa-2x"></i>
|
||||
<span class="nav-text">
|
||||
Logout
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="right pl-12 pt-6" style="width: 100%; display: flex; flex-direction: column; margin: 30px; background-color: #FFF; border-radius: 10px; box-shadow: 0px 0px 20px 0px #E6E5F4;">
|
||||
<style>
|
||||
@import url(//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css);
|
||||
/* @import url(https://fonts.googleapis.com/css?family=Titillium+Web:300); */
|
||||
.fa-2x {
|
||||
font-size: 2em;
|
||||
}
|
||||
.fa {
|
||||
position: relative;
|
||||
display: table-cell;
|
||||
width: 60px;
|
||||
height: 36px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
font-size:20px;
|
||||
}
|
||||
|
||||
li>a>i>img{
|
||||
padding-left: 10px;
|
||||
}
|
||||
.main-menu:hover,nav.main-menu.expanded {
|
||||
width:250px;
|
||||
overflow:visible;
|
||||
}
|
||||
|
||||
.main-menu {
|
||||
/* background:#212121; */
|
||||
background: #E6E5F4;
|
||||
border-right:1px solid #e5e5e5;
|
||||
position:relative;
|
||||
top:0;
|
||||
bottom:0;
|
||||
height:100%;
|
||||
left:0;
|
||||
width:60px;
|
||||
overflow:hidden;
|
||||
-webkit-transition:width .05s linear;
|
||||
transition:width .05s linear;
|
||||
-webkit-transform:translateZ(0) scale(1,1);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.main-menu>ul {
|
||||
/* margin:7px 0; */
|
||||
}
|
||||
|
||||
.main-menu li {
|
||||
position:relative;
|
||||
display:block;
|
||||
width:250px;
|
||||
}
|
||||
|
||||
.main-menu li>a {
|
||||
position:relative;
|
||||
display:table;
|
||||
border-collapse:collapse;
|
||||
border-spacing:0;
|
||||
color:#363650;
|
||||
font-family: arial;
|
||||
font-size: 14px;
|
||||
text-decoration:none;
|
||||
-webkit-transform:translateZ(0) scale(1,1);
|
||||
-webkit-transition:all .1s linear;
|
||||
transition:all .1s linear;
|
||||
|
||||
}
|
||||
|
||||
.main-menu .nav-icon {
|
||||
position:relative;
|
||||
display:table-cell;
|
||||
width:60px;
|
||||
height:36px;
|
||||
text-align:center;
|
||||
vertical-align:middle;
|
||||
font-size:18px;
|
||||
}
|
||||
|
||||
.main-menu .nav-text {
|
||||
position:relative;
|
||||
display:table-cell;
|
||||
vertical-align:middle;
|
||||
width:190px;
|
||||
font-family: 'Titillium Web', sans-serif;
|
||||
}
|
||||
|
||||
.main-menu>ul.logout {
|
||||
position:absolute;
|
||||
left:0;
|
||||
bottom:0;
|
||||
}
|
||||
|
||||
.no-touch .scrollable.hover {
|
||||
overflow-y:hidden;
|
||||
}
|
||||
|
||||
.no-touch .scrollable.hover:hover {
|
||||
overflow-y:auto;
|
||||
overflow:visible;
|
||||
}
|
||||
|
||||
a:hover,a:focus {
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
nav {
|
||||
-webkit-user-select:none;
|
||||
-moz-user-select:none;
|
||||
-ms-user-select:none;
|
||||
-o-user-select:none;
|
||||
user-select:none;
|
||||
}
|
||||
|
||||
nav ul,nav li {
|
||||
outline:0;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
.main-menu li:hover>a,nav.main-menu li.active>a,.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus,.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus,.no-touch .dashboard-page nav.dashboard-menu ul li:hover a,.dashboard-page nav.dashboard-menu ul li.active a {
|
||||
color:#fff;
|
||||
background: linear-gradient(90deg, rgba(70, 68, 142, 0.91) 0%, rgba(120, 117, 244, 0.91) 100%);
|
||||
border-radius: 20px;
|
||||
/* background-color:#000000; */
|
||||
}
|
||||
/* .area {
|
||||
float: left;
|
||||
background: #E6E5F4;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
} */
|
||||
@font-face {
|
||||
font-family: 'Titillium Web';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Titillium WebLight'), local('TitilliumWeb-Light'), url(http://themes.googleusercontent.com/static/fonts/titilliumweb/v2/anMUvcNT0H1YN4FII8wpr24bNCNEoFTpS2BTjF6FB5E.woff) format('woff');
|
||||
}
|
||||
|
||||
</style>
|
|
@ -0,0 +1,8 @@
|
|||
RewriteEngine On
|
||||
#RewriteCond %{HTTPS} !=on
|
||||
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
|
||||
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
|
||||
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*) index.php
|
|
@ -0,0 +1,2 @@
|
|||
name,email,phone,subject,message,details,origin,verticals,business_type,note,user,coupon_code,coupon
|
||||
Sample Name,sample@email.com,0,Sample Subject,Sample Message,Sample Details,Sample Origin ,Sample verticals,Sample business_type,Sample Note,user@siliconpin.com,Sample coupon_code,Sample coupon
|
|
After Width: | Height: | Size: 830 B |
After Width: | Height: | Size: 888 B |
After Width: | Height: | Size: 519 B |
|
@ -0,0 +1 @@
|
|||
<svg height="97px" width="97px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 56 56" xml:space="preserve" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <path style="fill:#aeadad;" d="M36.985,0H7.963C7.155,0,6.5,0.655,6.5,1.926V55c0,0.345,0.655,1,1.463,1h40.074 c0.808,0,1.463-0.655,1.463-1V12.978c0-0.696-0.093-0.92-0.257-1.085L37.607,0.257C37.442,0.093,37.218,0,36.985,0z"></path> <polygon style="fill:#d1d1d1;" points="37.5,0.151 37.5,12 49.349,12 "></polygon> <path style="fill:#7875F4;" d="M48.037,56H7.963C7.155,56,6.5,55.345,6.5,54.537V39h43v15.537C49.5,55.345,48.845,56,48.037,56z"></path> <g> <path style="fill:#FFFFFF;" d="M21.58,51.975c-0.374,0.364-0.798,0.638-1.271,0.82c-0.474,0.183-0.984,0.273-1.531,0.273 c-0.602,0-1.155-0.109-1.661-0.328s-0.948-0.542-1.326-0.971c-0.378-0.429-0.675-0.966-0.889-1.613 c-0.214-0.647-0.321-1.395-0.321-2.242s0.107-1.593,0.321-2.235c0.214-0.643,0.51-1.178,0.889-1.606 c0.378-0.429,0.822-0.754,1.333-0.978c0.51-0.224,1.062-0.335,1.654-0.335c0.547,0,1.057,0.091,1.531,0.273 c0.474,0.183,0.897,0.456,1.271,0.82l-1.135,1.012c-0.228-0.265-0.481-0.456-0.759-0.574c-0.278-0.118-0.567-0.178-0.868-0.178 c-0.337,0-0.659,0.063-0.964,0.191c-0.306,0.128-0.579,0.344-0.82,0.649c-0.242,0.306-0.431,0.699-0.567,1.183 s-0.21,1.075-0.219,1.777c0.009,0.684,0.08,1.267,0.212,1.75c0.132,0.483,0.314,0.877,0.547,1.183s0.497,0.528,0.793,0.67 c0.296,0.142,0.608,0.212,0.937,0.212s0.636-0.06,0.923-0.178s0.549-0.31,0.786-0.574L21.58,51.975z"></path> <path style="fill:#FFFFFF;" d="M29.633,50.238c0,0.364-0.075,0.718-0.226,1.06s-0.362,0.643-0.636,0.902s-0.611,0.467-1.012,0.622 c-0.401,0.155-0.857,0.232-1.367,0.232c-0.219,0-0.444-0.012-0.677-0.034s-0.467-0.062-0.704-0.116 c-0.237-0.055-0.463-0.13-0.677-0.226c-0.214-0.096-0.399-0.212-0.554-0.349l0.287-1.176c0.127,0.073,0.289,0.144,0.485,0.212 c0.196,0.068,0.398,0.132,0.608,0.191c0.209,0.06,0.419,0.107,0.629,0.144c0.209,0.036,0.405,0.055,0.588,0.055 c0.556,0,0.982-0.13,1.278-0.39c0.296-0.26,0.444-0.645,0.444-1.155c0-0.31-0.105-0.574-0.314-0.793 c-0.21-0.219-0.472-0.417-0.786-0.595s-0.654-0.355-1.019-0.533c-0.365-0.178-0.707-0.388-1.025-0.629 c-0.319-0.241-0.583-0.526-0.793-0.854c-0.21-0.328-0.314-0.738-0.314-1.23c0-0.446,0.082-0.843,0.246-1.189 s0.385-0.641,0.663-0.882c0.278-0.241,0.602-0.426,0.971-0.554s0.759-0.191,1.169-0.191c0.419,0,0.843,0.039,1.271,0.116 c0.428,0.077,0.774,0.203,1.039,0.376c-0.055,0.118-0.119,0.248-0.191,0.39c-0.073,0.142-0.142,0.273-0.205,0.396 c-0.064,0.123-0.119,0.226-0.164,0.308c-0.046,0.082-0.073,0.128-0.082,0.137c-0.055-0.027-0.116-0.063-0.185-0.109 s-0.167-0.091-0.294-0.137c-0.128-0.046-0.296-0.077-0.506-0.096c-0.21-0.019-0.479-0.014-0.807,0.014 c-0.183,0.019-0.355,0.07-0.52,0.157s-0.31,0.193-0.438,0.321c-0.128,0.128-0.228,0.271-0.301,0.431 c-0.073,0.159-0.109,0.313-0.109,0.458c0,0.364,0.104,0.658,0.314,0.882c0.209,0.224,0.469,0.419,0.779,0.588 c0.31,0.169,0.647,0.333,1.012,0.492c0.364,0.159,0.704,0.354,1.019,0.581s0.576,0.513,0.786,0.854 C29.528,49.261,29.633,49.7,29.633,50.238z"></path> <path style="fill:#FFFFFF;" d="M34.035,53.055l-3.131-10.131h1.873l2.338,8.695l2.475-8.695h1.859l-3.281,10.131H34.035z"></path> </g> <path style="fill:#d1d1d1;" d="M23.5,16v-4h-12v4v2v2v2v2v2v2v2v4h10h2h21v-4v-2v-2v-2v-2v-2v-4H23.5z M13.5,14h8v2h-8V14z M13.5,18h8v2h-8V18z M13.5,22h8v2h-8V22z M13.5,26h8v2h-8V26z M21.5,32h-8v-2h8V32z M42.5,32h-19v-2h19V32z M42.5,28h-19v-2h19V28 z M42.5,24h-19v-2h19V24z M23.5,20v-2h19v2H23.5z"></path> </g> </g></svg>
|
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 544 KiB |
After Width: | Height: | Size: 325 B |
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
require_once('/var/www/html/.hta_config/var.php');
|
||||
$url = explode('/', $_SERVER['REQUEST_URI']);
|
||||
if (strpos($url[1], "?") !== false) {
|
||||
$url2 = explode('?', $url[1]);
|
||||
$slug=$url2[0];
|
||||
} else $slug=$url[1];
|
||||
|
||||
|
||||
if($slug=="") require_once('.hta_slug/_home.php');
|
||||
elseif(file_exists(".hta_slug/".$slug.".php")) include ".hta_slug/".$slug.".php";
|
||||
else require_once('/var/www/html/.htac_404.php');
|
||||
require_once('/var/www/html/.htac_footer.php');
|
||||
|
|
@ -0,0 +1 @@
|
|||
<svg width="64px" height="64px" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" fill="#ff0000" stroke="#ff0000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g id="Layer_2" data-name="Layer 2"> <g id="invisible_box" data-name="invisible box"> <rect width="48" height="48" fill="none"></rect> </g> <g id="Icons"> <g> <path d="M38.9,8.1A20.9,20.9,0,0,0,3.2,22.8,19.8,19.8,0,0,0,6,33.2L3,44l11.1-2.9a20.3,20.3,0,0,0,10,2.5A20.8,20.8,0,0,0,38.9,8.1Zm-14.8,32a17.1,17.1,0,0,1-9.5-2.8L8,39.1l1.8-6.4a17.9,17.9,0,0,1-3.1-9.9A17.4,17.4,0,1,1,24.1,40.1Z"></path> <path d="M33.6,27.2A29.2,29.2,0,0,0,30,25.5c-.4-.2-.8-.3-1.1.2s-1.4,1.7-1.7,2.1a.8.8,0,0,1-1.1.1,15.2,15.2,0,0,1-4.2-2.6A15,15,0,0,1,19,21.7a.7.7,0,0,1,.2-1l.8-1a3.5,3.5,0,0,0,.5-.8.9.9,0,0,0,0-.9c-.2-.3-1.2-2.8-1.6-3.9s-.9-.9-1.2-.9h-1a1.7,1.7,0,0,0-1.4.7,5.5,5.5,0,0,0-1.8,4.3,10.4,10.4,0,0,0,2.1,5.4c.3.3,3.7,5.6,8.9,7.8a16.4,16.4,0,0,0,3,1.1,6.4,6.4,0,0,0,3.3.2c1-.1,3.1-1.2,3.5-2.4s.5-2.3.3-2.5A2.1,2.1,0,0,0,33.6,27.2Z"></path> </g> </g> </g> </g></svg>
|
After Width: | Height: | Size: 1.1 KiB |