Files

89 lines
3.7 KiB
PHP

<div class="page-header">
<div>
<h1 class="page-title">Customer Directory</h1>
<p class="page-subtitle">Manage customer profiles and contact details</p>
</div>
</div>
<div style="display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; align-items: start;">
<!-- Customers Table -->
<div class="card">
<div class="card-header">
<h2 class="card-title">Registered Customers (<?= count($customers) ?>)</h2>
</div>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Customer</th>
<th>Phone</th>
<th>Address</th>
<th>Registered</th>
</tr>
</thead>
<tbody>
<?php if (empty($customers)): ?>
<tr>
<td colspan="4" style="text-align: center; color: var(--text-muted); padding: 2rem;">
No customers registered yet.
</td>
</tr>
<?php else: ?>
<?php foreach ($customers as $cust): ?>
<tr>
<td>
<div style="font-weight: 600;"><?= e($cust['name']) ?></div>
<div style="font-size: 0.8rem; color: var(--text-muted);"><?= e($cust['email']) ?></div>
</td>
<td><?= e($cust['phone'] ?: '—') ?></td>
<td style="font-size: 0.85rem; color: var(--text-muted); max-width: 250px;">
<?= e($cust['address'] ?: '—') ?>
</td>
<td style="color: var(--text-muted); font-size: 0.85rem;">
<?= date('M d, Y', strtotime($cust['created_at'])) ?>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
<!-- Add Customer Form -->
<div class="card">
<div class="card-header">
<h2 class="card-title">Register Customer</h2>
</div>
<div class="card-body">
<form method="POST" action="/customers">
<?= \App\Core\View::csrfField() ?>
<div class="form-group">
<label class="form-label">Full Name <span style="color: var(--danger);">*</span></label>
<input type="text" name="name" class="form-control" placeholder="e.g. Sarah Connor" required>
</div>
<div class="form-group">
<label class="form-label">Email Address <span style="color: var(--danger);">*</span></label>
<input type="email" name="email" class="form-control" placeholder="sarah@example.com" required>
</div>
<div class="form-group">
<label class="form-label">Phone Number</label>
<input type="tel" name="phone" class="form-control" placeholder="+1-555-0199">
</div>
<div class="form-group">
<label class="form-label">Shipping / Billing Address</label>
<textarea name="address" class="form-textarea" rows="3" placeholder="Street, City, State, ZIP..."></textarea>
</div>
<button type="submit" class="btn btn-primary" style="width: 100%;">Add Customer</button>
</form>
</div>
</div>
</div>