Files
crm_php/.hta_slug/forms/_home.php
dev sp ca6af2f5e2 init
2024-04-29 12:55:11 +00:00

52 lines
1.9 KiB
PHP

<?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>";
}
?>