Add NFC chore submission feature and enhance family settings
- Introduced NFC support for chore submissions, allowing specific person credit after Head of Household approval. - Updated family settings to include NFC base URL, scan cooldown, and confirmation page options. - Enhanced chore management with options for anyone to complete chores and NFC link generation. - Improved API endpoints for handling NFC tokens and chore submissions. - Updated readme to reflect new NFC features and settings.
This commit is contained in:
@@ -164,10 +164,37 @@ $permanenceOptions = [
|
||||
value="<?= (int) ($familySettings['week_starts_on'] ?? 0) ?>"
|
||||
<?= !$canManage ? 'disabled' : '' ?>>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="nfc_base_url">NFC base URL override (optional)</label>
|
||||
<input class="form-control" id="nfc_base_url" name="nfc_base_url" placeholder="https://your-domain/familyHub"
|
||||
value="<?= sanitizeInput($familySettings['nfc_base_url'] ?? '') ?>"
|
||||
<?= !$canManage ? 'disabled' : '' ?>>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="nfc_scan_cooldown_seconds">NFC scan cooldown seconds</label>
|
||||
<input type="number" class="form-control" id="nfc_scan_cooldown_seconds" name="nfc_scan_cooldown_seconds" min="0" max="600"
|
||||
value="<?= (int) ($familySettings['nfc_scan_cooldown_seconds'] ?? 0) ?>"
|
||||
<?= !$canManage ? 'disabled' : '' ?>>
|
||||
</div>
|
||||
<div class="col-md-6 d-flex align-items-end">
|
||||
<div class="form-check mb-2">
|
||||
<input class="form-check-input" type="checkbox" id="nfc_show_confirmation" name="nfc_show_confirmation" value="1"
|
||||
<?= !empty($familySettings['nfc_show_confirmation']) ? 'checked' : '' ?>
|
||||
<?= !$canManage ? 'disabled' : '' ?>>
|
||||
<label class="form-check-label" for="nfc_show_confirmation">Show NFC confirmation page after scan</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($canManage): ?>
|
||||
<div class="col-12">
|
||||
<button type="submit" class="btn btn-primary">Save chore economy</button>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="small text-muted mb-2">Emergency NFC actions</div>
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<button type="button" class="btn btn-outline-warning btn-sm" id="btnDisableAllChoreNfc">Disable all chore NFC links</button>
|
||||
<button type="button" class="btn btn-outline-danger btn-sm" id="btnRotateAllPersonNfcTokens">Rotate all person NFC tokens</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="col-12">
|
||||
<div class="alert d-none" id="familySettingsFeedback" role="status"></div>
|
||||
@@ -266,6 +293,7 @@ $permanenceOptions = [
|
||||
<th>Name</th>
|
||||
<th>Role</th>
|
||||
<th class="text-end">Balance</th>
|
||||
<?php if ($canManage): ?><th>NFC submit token</th><?php endif; ?>
|
||||
<?php if ($canManage): ?><th></th><?php endif; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -276,6 +304,9 @@ $permanenceOptions = [
|
||||
<td><?= sanitizeInput($p['role'] ?? '') ?></td>
|
||||
<td class="text-end"><?= sanitizeInput((string) ($p['currency_balance'] ?? 0)) ?> <?= sanitizeInput($familySettings['currency_symbol'] ?? '') ?></td>
|
||||
<?php if ($canManage): ?>
|
||||
<td class="text-nowrap">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary btn-rotate-person-nfc-token" data-id="<?= htmlspecialchars($p['id'] ?? '', ENT_QUOTES, 'UTF-8') ?>" data-name="<?= htmlspecialchars((string) ($p['name'] ?? ''), ENT_QUOTES, 'UTF-8') ?>">Rotate token</button>
|
||||
</td>
|
||||
<td class="text-end text-nowrap">
|
||||
<?php if (($p['role'] ?? '') === ROLE_HEAD): ?>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary btn-reset-pin" data-id="<?= htmlspecialchars($p['id'] ?? '', ENT_QUOTES, 'UTF-8') ?>">Reset PIN</button>
|
||||
|
||||
Reference in New Issue
Block a user