@@ -182,7 +195,7 @@
+ echo '
';
?>
- Quick Action
- Name
- ID
- Status Update
-
- Form Name
- Date
+ Name
+ ID
+ Status Update
+
+ Form Name
+ Date
@@ -211,7 +223,7 @@
$start_date = isset($_GET['start_date']) ? $_GET['start_date'] : '2014-05-05';
$end_date = isset($_GET['end_date']) ? $_GET['end_date'] : date('Y-m-d');
$start_time = microtime(true);
- $resultsPerPage = 100;
+ $resultsPerPage = 200;
$page =isset($_GET['page']) ? $_GET['page'] : 1;
$offset = ($page - 1) * $resultsPerPage ;
$accessArray = explode(",", $_SESSION['access']);
@@ -242,8 +254,12 @@
$leads = $stmt->fetchAll(PDO::FETCH_ASSOC);
$totalResults = count($leads);
$totalPages = ceil($totalRows / $resultsPerPage);
- if($resultsPerPage <= $totalRows) echo "".$resultsPerPage." Out of ".$totalRows." Leads
";
- else echo "".$totalRows." Leads
";
+
+ $end_time = microtime(true);
+ $execution_time = ($end_time - $start_time);
+ $executionTime = substr($execution_time, 0, 6);
+ // if($resultsPerPage <= $totalRows) echo "".$resultsPerPage." Out of ".$totalRows." Leads in ".$executionTime." Seconds
";
+ // else echo "".$totalRows." Leads
";
// Status Conditional Color
foreach($leads as $lead){
$only_date =isset($lead['time']) ? substr($lead['time'], 0, 10): 'Not Available';
@@ -257,30 +273,6 @@
// if($row['status'] == 'Warm'){$conditional_status = ''.$row['status'].'
Option 1 Option 2 ';}elseif($row['status'] != 'Warm'){$conditional_status = $row['status'];}
?>
-
-
-
@@ -297,19 +289,12 @@
Error: " . $e->getMessage() . "";
}
-
- $end_time = microtime(true);
-
- // Calculate execution time
- $execution_time = ($end_time - $start_time);
// Output execution time
- echo "Page executed in: " . $execution_time . " seconds";
?>
@@ -317,15 +302,16 @@
+echo'
});
});
}
-
// 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');
@@ -511,6 +482,37 @@ echo'
}
}
}
+ const data = ;
+ const filename = `leads_data.csv`;
+
+ function downloadCSV(data, filename) {
+ const csv = convertToCSV(data);
+ const blob = new Blob([csv], { type: 'text/csv' });
+ const link = document.createElement('a');
+ link.href = URL.createObjectURL(blob);
+ link.download = filename;
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ }
+
+ function convertToCSV(data) {
+ const csvRows = [];
+ const headers = Object.keys(data[0]);
+ csvRows.push(headers.join(','));
+ data.forEach(row => {
+ const values = headers.map(header => {
+ const escaped = ('' + row[header]).replace(/"/g, '\\"');
+ return `"${escaped}"`;
+ });
+ csvRows.push(values.join(','));
+ });
+
+ return csvRows.join('\n');
+
+ // downloadCSV(data, filename);
+
+ }