<?php
// Database connection details
$db_server = "localhost";
$db_username = "thevault_landing";
$db_password = "";
$db_name = "thevault_landing";

// Create a database connection
$conn = new mysqli($db_server, $db_username, $db_password, $db_name);

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// $sql = "SELECT id, name, email, phone, date_created FROM customer_tbl";
$sql = "SELECT id, name, email, phone, page_url, date_created 
        FROM customer_tbl 
        WHERE page_url = 'the-vault-storage' 
        ORDER BY date_created DESC";

$result = $conn->query($sql);
$records = [];

if ($result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        $records[] = $row;
    }
}

// Step 2: Display Records in a jQuery DataTable
?>
<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<title>Find Secure Self Storage in Dubai | The Vault Storage</title>
	<link rel="icon" href="assets/images/favicon-32x32.png?v=1.41.35" sizes="32x32" type="image/png">
	<link rel="icon" href="assets/images/favicon-16x16.png?v=1.41.35" sizes="16x16" type="image/png">
	<link rel="apple-touch-icon" href="assets/images/apple-touch-icon.png?v=1.41.35">
	<meta name="description" content="Book clean, secure self-storage units in Dubai online. Choose your location, size, and move-in date — manage bookings and payments from the Vault Storage app." />
	<link rel="canonical" href="https://vaultstorage.qodictech.in/" />
	<meta property="og:locale" content="en_US" />
	<meta property="og:type" content="website" />
	<meta property="og:site_name" content="The Vault Storage" />
	<meta property="og:title" content="The Vault Storage — Secure Self Storage in Dubai" />
	<meta property="og:description" content="Book clean, secure self-storage units in Dubai online. Choose your location, size, and move-in date — manage bookings and payments from the Vault Storage app." />
	<meta property="og:url" content="https://vaultstorage.qodictech.in/" />
	<meta property="og:image" content="https://vaultstorage.qodictech.in/wp-content/themes/vault-storage/assets/images/DIP_Rendering_Night.png" />
	<meta property="og:image:alt" content="Clean self-storage facility corridor" />
	<meta name="twitter:card" content="summary_large_image" />
	<meta name="twitter:title" content="The Vault Storage — Secure Self Storage in Dubai" />
	<meta name="twitter:description" content="Book clean, secure self-storage units in Dubai online. Choose your location, size, and move-in date — manage bookings and payments from the Vault Storage app." />
	<meta name="twitter:image" content="https://vaultstorage.qodictech.in/wp-content/themes/vault-storage/assets/images/DIP_Rendering_Night.png" />

	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="preconnect" href="https://fonts.googleapis.com">
	<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
	<link href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Cormorant:ital,wght@0,300..700;1,300..700&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=League+Spartan:wght@100..900&family=Manrope:wght@200..800&display=swap" rel="stylesheet">
	<link rel="stylesheet" href="assets/css/default.css" />
	<link rel="stylesheet" href="assets/css/responsive.css" />
</head>

<body>
	<ul class="fixedBtn scrll">
	<li>
		<a class="poetic-phone vaultphone phoneGclid" href="tel:+971557297560" target="_blank" rel="noopener" aria-label="Call with thevaultstorage on Phone">
			<span class="ph-ring ph-ring-one vaultphone"></span>
			<span class="ph-ring ph-ring-two vaultphone"></span>
			<span class="ph-icon vaultphone">
				<svg class="vaultphone" viewBox="0 0 24 24"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6A19.79 19.79 0 0 1 2.12 4.18 2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.69 2.8a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.9.33 1.84.56 2.8.69A2 2 0 0 1 22 16.92z" fill="none" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path></svg>
			</span>
		</a>
	</li>
	<li>
		<a class="poetic-whatsapp vaultwhatsapp whatsappGclid" href="https://wa.me/971557297560" target="_blank" rel="noopener" aria-label="Chat with thevaultstorage on whatsApp">
			<span class="wa-ring wa-ring-one vaultwhatsapp"></span>
			<span class="wa-ring wa-ring-two vaultwhatsapp"></span>
			<span class="wa-icon vaultwhatsapp">
				<svg class="vaultwhatsapp" viewBox="0 0 32 32" aria-hidden="true">
					<path fill="#fff" d="M16.04 3C8.86 3 3 8.72 3 15.76c0 2.48.73 4.9 2.12 6.96L3.74 27.8l5.24-1.34a13.18 13.18 0 0 0 7.05 2.04H16c7.18 0 13-5.72 13-12.76S23.18 3 16.04 3Zm7.58 18.02c-.32.9-1.86 1.72-2.56 1.82-.66.1-1.5.14-2.42-.14-.56-.18-1.28-.42-2.2-.82-3.86-1.64-6.38-5.44-6.58-5.7-.2-.26-1.58-2.06-1.58-3.94 0-1.88 1-2.8 1.36-3.18.36-.38.78-.48 1.04-.48.26 0 .52 0 .74.02.24.02.56-.08.88.66.32.76 1.08 2.62 1.18 2.82.1.2.16.44.04.7-.12.26-.18.42-.36.64-.18.22-.38.5-.54.66-.18.18-.36.38-.16.74.2.36.9 1.44 1.94 2.34 1.34 1.16 2.46 1.52 2.82 1.7.36.18.56.16.78-.1.22-.26.9-1.02 1.14-1.38.24-.36.48-.3.82-.18.34.12 2.12.98 2.48 1.16.36.18.6.26.68.4.08.14.08.82-.24 1.72Z"></path>
				</svg>
			</span>
		</a>
	</li>		
</ul>

<body>
	<header class="header position-sticky top-0 bg-white w-100">
			<div class="container">
				<div class="row align-items-center justify-content-between">
					<div class="col-6 col-lg-3">
						<div class="headerlogo">
							<a class="logo d-block" href="/">
								<img src="assets/images/logo.png" alt="Logo" class="w-100">
							</a>
						</div>
					</div>
					<div class="col-lg-6 d-none d-lg-block">
						<ul class="d-flex align-items-center justify-content-center gap-4">
							<li><a href="#unit-sizes">Unit Sizes</a></li>
							<li><a href="#why-the-vault">Why The Vault</a></li>
							<li><a href="#faqs">FAQs</a></li>
							<li><a href="#location">Location</a></li>
						</ul>
					</div>
					<div class="col-6 col-lg-3">
						<div class="landing-header-actions">
							<a class="btn" href="javascript:;" data-bs-toggle="modal" data-bs-target="#book">Book Storage</a>
						</div>
					</div>
				</div>
			</div>
		</header>

 <section class="main-section">
        <div class="container pt-5">
            <div class="main-heading text-center">
                <h2 class="text-capitalize">Inquiries</h2>
            </div>
            <table id="data-table" class="display w-100">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Name</th>
                        <th>Phone</th>
                        <th>Email</th>
                        <th>Date</th>
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    $serial = 1;
                    foreach ($records as $record) {
                    ?>
                        <tr>
                            <td><?= $serial++ ?></td>
                            <td><?= $record['name'] ?></td>
                            <td><?= $record['phone'] ?></td>
                            <td><?= $record['email'] ?></td>
                           <td><?= (new DateTime($record['date_created']))->format('d-m-Y h:i:s'); ?></td>
                            <td><button class="delete-button btn btn-danger" data-id="<?= $record['id'] ?>">Delete</button></td>
                        </tr>
                    <?php } ?>
                </tbody>
            </table>
        </div>
    </section>
   

<footer class="footer bg-color-dark">
				<div class="container">
					<div class="midFooter">
						<div class="contactInfo">
							<ul class="d-flex justify-content-between align-items-start align-items-md-center flex-column flex-md-row flex-wrap gap-3 gap-md-0">
								<li>
									<a href="https://thevault.storage/self-storage-dubai/" class="logo d-block">
										<img src="assets/images/logo.png" alt="*" class="w-100">
									</a>
								</li>
								<li>
									<strong class="h5">Phone:</strong>
									<a href="tel:+971557297560" class="link phone_vault">+971 5 572 97560</a>
								</li>
								<li>
									<strong class="h5">Email:</strong>
									<a href="mailto:info@thevaultstorage.ae" class="link mail_vault">info@thevaultstorage.ae</a>
								</li>
								<li>
									<strong class="h5">Address:</strong>
									<a href="https://maps.app.goo.gl/BgtGe8GmnTqq1dz98" target="_blank" class="link">The Vault Storage FZCO 533-3459,<br>Dubai Industrial City, Saih Shuaib 4, Dubai, UAE</a>
								</li>
							</ul>
						</div>
					</div>
					<div class="bottomFooter">
						<div class="row justify-content-between">
							<div class="col-md-6">
								<p>© <a href="" class="link">The Vault Storage</a> <i id="year"></i>. All rights reserved</p>
							</div>
							<div class="col-md-6 text-md-end">
								<p>Designed by DigitalsetGo</p>
							</div>
						</div>
					</div>
				</div>
			</footer>
 <script src="assets/js/xJquery.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
 <script>
 	document.getElementById("year").textContent = new Date().getFullYear();
    // Step 3: Add Delete Action
        jQuery(document).ready(function () {
            jQuery('#data-table').DataTable();

            jQuery('.delete-button').on('click', function () {
                var id = jQuery(this).data('id');
            var deleteButton = jQuery(this); // Store the current button for later reference
            
            if (confirm('Are you sure you want to delete this record?')) {
                // If the user confirms the delete action, send an AJAX request to delete the record.
                jQuery.ajax({
                    url: 'delete_record.php', // Create a separate PHP file for the delete action.
                    method: 'POST',
                    data: { id: id },
                    success: function () {
                        // Refresh the DataTable or remove the row manually using the stored button
                        jQuery('#data-table').DataTable().row(deleteButton.parents('tr')).remove().draw();
                    }
                });
            }
            
            return false; // Prevent the default form submission behavior
        });
        });
    </script>
</body>
</html>
