Viewing File: D:\INETPUB\VHOSTS\officespacebangalore.com\httpdocs\admin\index.php

<?php
$title = 'Dashboard';
require_once __DIR__ . '/_header.php';

$pdo = db();
$properties = (int)$pdo->query('SELECT COUNT(*) FROM property')->fetchColumn();
$available = (int)$pdo->query("SELECT COUNT(*) FROM property WHERE LOWER(status) IN ('available','active')")->fetchColumn();
$users = (int)$pdo->query('SELECT COUNT(*) FROM `user`')->fetchColumn();
$enquiries = (int)$pdo->query('SELECT COUNT(*) FROM contact')->fetchColumn();

$latest = $pdo->query(
    'SELECT pid,title,city,price,stype,status,date,isFeatured
     FROM property ORDER BY pid DESC LIMIT 8'
)->fetchAll();
?>
<div class="admin-cards">
    <div><span>Total properties</span><strong><?=number_format($properties)?></strong><small>All inventory records</small></div>
    <div><span>Available</span><strong><?=number_format($available)?></strong><small>Currently searchable</small></div>
    <div><span>Users / agents</span><strong><?=number_format($users)?></strong><small>Existing accounts</small></div>
    <div><span>Enquiries</span><strong><?=number_format($enquiries)?></strong><small>Customer leads</small></div>
</div>

<section class="admin-panel">
<div class="panel-head">
    <div><h2>Latest properties</h2><p class="muted">Live records from your existing property table.</p></div>
    <a class="admin-btn small" href="<?=url('admin/property-edit.php')?>">+ Add property</a>
</div>
<div class="table-wrap">
<table>
<thead><tr><th>ID</th><th>Property</th><th>City</th><th>Purpose</th><th>Price</th><th>Status</th><th></th></tr></thead>
<tbody>
<?php foreach ($latest as $p): ?>
<tr>
<td>#<?=e($p['pid'])?></td>
<td><strong><?=e($p['title'])?></strong><?=!empty($p['isFeatured'])?'<span class="mini-badge">Featured</span>':''?></td>
<td><?=e($p['city'])?></td>
<td><?=e($p['stype'])?></td>
<td><?=money($p['price'])?></td>
<td><span class="status-dot"><?=e($p['status'])?></span></td>
<td><a class="table-link" href="<?=url('admin/property-edit.php?id='.$p['pid'])?>">Edit</a></td>
</tr>
<?php endforeach; ?>
<?php if (!$latest): ?><tr><td colspan="7" class="empty">No properties found.</td></tr><?php endif; ?>
</tbody>
</table>
</div>
</section>
<?php require __DIR__ . '/_footer.php'; ?>
Back to Directory File Manager