<?php require_once __DIR__ . '/../../layouts/header.php'; ?>

<div style="margin-bottom: 2rem;">
    <h2>Edit Branch</h2>
</div>

<div class="card">
    <form action="/branches/update/<?php echo htmlspecialchars($branch['id']); ?>" method="POST">
        <div class="input-group">
            <label for="name">Branch Name *</label>
            <input type="text" id="name" name="name" value="<?php echo htmlspecialchars($branch['name']); ?>" required>
        </div>
        <div class="input-group">
            <label for="address">Address</label>
            <input type="text" id="address" name="address" value="<?php echo htmlspecialchars($branch['address'] ?? ''); ?>">
        </div>
        <div class="input-group">
            <label for="phone">Phone</label>
            <input type="text" id="phone" name="phone" value="<?php echo htmlspecialchars($branch['phone'] ?? ''); ?>">
        </div>

        <div style="display: flex; gap: 1rem; margin-top: 2rem;" class="form-row">
            <button type="submit" class="btn-primary" style="flex: 1; margin-top: 0; width: auto;">Update Branch</button>
            <a href="/branches" class="btn-primary" style="flex: 1; margin-top: 0; background: transparent; border: 1px solid var(--glass-border); color: var(--text-light); text-decoration: none; width: auto; display: inline-block; text-align: center;">Cancel</a>
        </div>
    </form>
</div>

<?php require_once __DIR__ . '/../../layouts/footer.php'; ?>
