<?= $this->extend('layouts/main') ?>
<?= $this->section('content') ?>

<h1 class="h3 mb-3"><?= $client ? 'Edit Event Client' : 'New Event Client' ?></h1>

<div class="card shadow-sm" style="max-width: 560px;">
    <div class="card-body">
        <form action="<?= $client ? site_url('event-clients/' . $client->id) : site_url('event-clients') ?>" method="post">
            <?= csrf_field() ?>

            <div class="mb-3">
                <label class="form-label">Company Name</label>
                <input type="text" class="form-control" name="company_name" required value="<?= esc(old('company_name', $client->company_name ?? '')) ?>">
            </div>
            <div class="row">
                <div class="col-md-6 mb-3">
                    <label class="form-label">Contact Name</label>
                    <input type="text" class="form-control" name="contact_name" value="<?= esc(old('contact_name', $client->contact_name ?? '')) ?>">
                </div>
                <div class="col-md-6 mb-3">
                    <label class="form-label">Phone</label>
                    <input type="text" class="form-control" name="phone" value="<?= esc(old('phone', $client->phone ?? '')) ?>">
                </div>
            </div>
            <div class="mb-3">
                <label class="form-label">Email</label>
                <input type="email" class="form-control" name="email" value="<?= esc(old('email', $client->email ?? '')) ?>">
            </div>
            <div class="mb-3">
                <label class="form-label">Catering Preferences</label>
                <textarea class="form-control" name="catering_preferences" rows="3"><?= esc(old('catering_preferences', $client->catering_preferences ?? '')) ?></textarea>
            </div>

            <div class="d-flex gap-2">
                <button type="submit" class="btn btn-primary">Save</button>
                <a href="<?= site_url('event-clients') ?>" class="btn btn-outline-secondary">Cancel</a>
            </div>
        </form>
    </div>
</div>

<?= $this->endSection() ?>
