<div class="row">
    <div class="col-lg-8">
        <div class="card glass-card">
            <div class="card-header">
                <h5 class="card-title">Edit Branch: <?= e($branch->name) ?></h5>
            </div>
            <div class="card-body">
                <form method="POST" action="<?= url('branches/update/' . $branch->id) ?>" class="needs-validation" novalidate>
                    <?= csrf_field() ?>

                    <div class="row">
                        <div class="col-md-6 mb-3">
                            <label class="form-label">Branch Name <span class="text-danger">*</span></label>
                            <input type="text" name="name" class="form-control" required value="<?= e($branch->name) ?>">
                        </div>
                        <div class="col-md-6 mb-3">
                            <label class="form-label">Phone</label>
                            <input type="text" name="phone" class="form-control" value="<?= e($branch->phone ?? '') ?>">
                        </div>
                        <div class="col-md-6 mb-3">
                            <label class="form-label">Email</label>
                            <input type="email" name="email" class="form-control" value="<?= e($branch->email ?? '') ?>">
                        </div>
                        <div class="col-md-6 mb-3">
                            <label class="form-label">Tax ID</label>
                            <input type="text" name="tax_id" class="form-control" value="<?= e($branch->tax_id ?? '') ?>">
                        </div>
                        <div class="col-md-6 mb-3">
                            <label class="form-label">City</label>
                            <input type="text" name="city" class="form-control" value="<?= e($branch->city ?? '') ?>">
                        </div>
                        <div class="col-md-6 mb-3">
                            <label class="form-label">State</label>
                            <input type="text" name="state" class="form-control" value="<?= e($branch->state ?? '') ?>">
                        </div>
                        <div class="col-md-4 mb-3">
                            <label class="form-label">Zip Code</label>
                            <input type="text" name="zip" class="form-control" value="<?= e($branch->zip ?? '') ?>">
                        </div>
                        <div class="col-md-4 mb-3">
                            <label class="form-label">Status</label>
                            <select name="status" class="form-select">
                                <option value="active" <?= $branch->status === 'active' ? 'selected' : '' ?>>Active</option>
                                <option value="inactive" <?= $branch->status === 'inactive' ? 'selected' : '' ?>>Inactive</option>
                            </select>
                        </div>
                    </div>

                    <div class="mb-3">
                        <label class="form-label">Address</label>
                        <textarea name="address" class="form-control" rows="2"><?= e($branch->address ?? '') ?></textarea>
                    </div>

                    <button type="submit" class="btn btn-gold">
                        <i class="fas fa-save me-1"></i>Update Branch
                    </button>
                    <a href="<?= url('branches') ?>" class="btn btn-ghost ms-2">Cancel</a>
                </form>
            </div>
        </div>
    </div>
</div>
