- <div class="page-header">
- <h1>Edit Household</h1>
- <a class="button button-secondary button-sm" href="/households/<?= e($household['id']) ?>">← Back</a>
- </div>
-
- <div class="section-panel">
- <?php if (!empty($errors['_token'])): ?>
- <div class="alert alert-error"><?= e($errors['_token'][0]) ?></div>
- <?php endif; ?>
-
- <form method="POST" action="/households/<?= e($household['id']) ?>" novalidate>
- <?= csrf_field() ?>
-
- <div class="form-grid">
- <div class="field" style="grid-column:1/-1">
- <label for="territory_id">Territory <span style="color:#c0392b">*</span></label>
- <select class="input <?= isset($errors['territory_id']) ? 'input-error' : '' ?>"
- id="territory_id" name="territory_id" required>
- <option value="">Select a territory…</option>
- <?php foreach ($territories as $t): ?>
- <option value="<?= e($t['id']) ?>"
- <?= (string) $household['territory_id'] === (string) $t['id'] ? 'selected' : '' ?>>
- <?= e($t['name']) ?>
- </option>
- <?php endforeach; ?>
- </select>
- <?php if (isset($errors['territory_id'])): ?>
- <span class="field-error"><?= e($errors['territory_id'][0]) ?></span>
- <?php endif; ?>
- </div>
-
- <div class="field" style="grid-column:1/-1">
- <label for="address">Address <span style="color:#c0392b">*</span></label>
- <input class="input <?= isset($errors['address']) ? 'input-error' : '' ?>"
- type="text" id="address" name="address"
- value="<?= e((string) ($household['address'] ?? '')) ?>" required autofocus>
- <?php if (isset($errors['address'])): ?>
- <span class="field-error"><?= e($errors['address'][0]) ?></span>
- <?php endif; ?>
- </div>
-
- <div class="field">
- <label for="street_number">Street Number</label>
- <input class="input" type="number" id="street_number" name="street_number"
- value="<?= e((string) ($household['street_number'] ?? '')) ?>">
- </div>
-
- <div class="field">
- <label for="street_name">Street Name</label>
- <input class="input" type="text" id="street_name" name="street_name"
- value="<?= e((string) ($household['street_name'] ?? '')) ?>">
- </div>
-
- <div class="field">
- <label for="latitude">Latitude</label>
- <input class="input" type="text" id="latitude" name="latitude"
- value="<?= e((string) ($household['latitude'] ?? '')) ?>">
- </div>
-
- <div class="field">
- <label for="longitude">Longitude</label>
- <input class="input" type="text" id="longitude" name="longitude"
- value="<?= e((string) ($household['longitude'] ?? '')) ?>">
- </div>
-
- <div class="field" style="grid-column:1/-1">
- <label class="checkbox-label">
- <input type="checkbox" name="is_business" value="1"
- <?= $household['is_business'] ? 'checked' : '' ?>>
- This is a business
- </label>
- </div>
-
- <div class="field" style="grid-column:1/-1">
- <label class="checkbox-label">
- <input type="checkbox" name="do_not_call" value="1" id="dnc_check"
- <?= $household['do_not_call'] ? 'checked' : '' ?>
- onchange="document.getElementById('dnc_fields').style.display=this.checked?'grid':'none'">
- Do Not Call
- </label>
- </div>
-
- <div id="dnc_fields" class="form-grid" style="grid-column:1/-1;display:<?= $household['do_not_call'] ? 'grid' : 'none' ?>">
- <div class="field">
- <label for="do_not_call_date">DNC Date</label>
- <input class="input" type="date" id="do_not_call_date" name="do_not_call_date"
- value="<?= e((string) ($household['do_not_call_date'] ?? '')) ?>">
- </div>
-
- <div class="field" style="grid-column:1/-1">
- <label for="do_not_call_notes">Public Notes</label>
- <textarea class="input" id="do_not_call_notes" name="do_not_call_notes"
- rows="2"><?= e((string) ($household['do_not_call_notes'] ?? '')) ?></textarea>
- </div>
-
- <div class="field" style="grid-column:1/-1">
- <label for="do_not_call_private_notes">Private Notes</label>
- <textarea class="input" id="do_not_call_private_notes" name="do_not_call_private_notes"
- rows="2"><?= e((string) ($household['do_not_call_private_notes'] ?? '')) ?></textarea>
- </div>
- </div>
- </div>
-
- <div class="form-actions" style="margin-top:1.5rem">
- <button class="button button-primary" type="submit">Save Changes</button>
- <a class="button button-secondary" href="/households/<?= e($household['id']) ?>">Cancel</a>
- </div>
- </form>
- </div>
|