Refactor settings UI for improved first-time setup experience
- Introduced conditional display logic for the first-time setup section based on the presence of household members. - Enhanced navigation with tabbed interface for settings, allowing easier access to different configuration areas. - Maintained existing functionality while improving layout and user interaction for profile creation.
This commit is contained in:
parent
6d10cb4726
commit
c9828d8ff3
@ -17,6 +17,8 @@ $canManage = count($people) === 0
|
|||||||
&& ($activePerson['role'] ?? '') === ROLE_HEAD
|
&& ($activePerson['role'] ?? '') === ROLE_HEAD
|
||||||
&& isHohVerified()
|
&& isHohVerified()
|
||||||
);
|
);
|
||||||
|
$hasPeople = count($people) > 0;
|
||||||
|
$showSetup = !$hasPeople;
|
||||||
|
|
||||||
$permanenceOptions = [
|
$permanenceOptions = [
|
||||||
'permanent' => 'Permanent',
|
'permanent' => 'Permanent',
|
||||||
@ -32,110 +34,129 @@ $permanenceOptions = [
|
|||||||
<h2 class="mb-3">Family settings</h2>
|
<h2 class="mb-3">Family settings</h2>
|
||||||
<p class="text-muted">People and chore currency defaults apply across the whole hub. Heads of household verify with a PIN when switching profiles at the top of the page.</p>
|
<p class="text-muted">People and chore currency defaults apply across the whole hub. Heads of household verify with a PIN when switching profiles at the top of the page.</p>
|
||||||
|
|
||||||
<?php if (count($people) === 0): ?>
|
<div class="row g-4 align-items-start">
|
||||||
<div class="card mb-4 border-primary" id="firstSetupCard">
|
<div class="col-lg-3">
|
||||||
<div class="card-header bg-primary text-white">First-time setup</div>
|
<div class="nav nav-pills flex-lg-column gap-2" id="settingsSectionTabs" role="tablist" aria-orientation="vertical">
|
||||||
<div class="card-body">
|
<?php if ($showSetup): ?>
|
||||||
<p>Create the first <strong>Head of household</strong> profile so you can manage family members and settings.</p>
|
<button class="nav-link active text-start" id="settings-tab-setup" data-bs-toggle="pill" data-bs-target="#settings-pane-setup" type="button" role="tab" aria-controls="settings-pane-setup" aria-selected="true">First-time setup</button>
|
||||||
<form id="firstHeadForm" class="row g-3">
|
<?php endif; ?>
|
||||||
<div class="col-md-6">
|
<button class="nav-link text-start <?= !$showSetup ? 'active' : '' ?>" id="settings-tab-calendar" data-bs-toggle="pill" data-bs-target="#settings-pane-calendar" type="button" role="tab" aria-controls="settings-pane-calendar" aria-selected="<?= !$showSetup ? 'true' : 'false' ?>">Calendar and dates</button>
|
||||||
<label class="form-label" for="first_name">Name</label>
|
<button class="nav-link text-start" id="settings-tab-economy" data-bs-toggle="pill" data-bs-target="#settings-pane-economy" type="button" role="tab" aria-controls="settings-pane-economy" aria-selected="false">Chore economy</button>
|
||||||
<input class="form-control" id="first_name" name="name" required autocomplete="name">
|
<button class="nav-link text-start" id="settings-tab-stores" data-bs-toggle="pill" data-bs-target="#settings-pane-stores" type="button" role="tab" aria-controls="settings-pane-stores" aria-selected="false">Grocery stores</button>
|
||||||
</div>
|
<?php if ($hasPeople): ?>
|
||||||
<div class="col-md-6">
|
<button class="nav-link text-start" id="settings-tab-people" data-bs-toggle="pill" data-bs-target="#settings-pane-people" type="button" role="tab" aria-controls="settings-pane-people" aria-selected="false">People</button>
|
||||||
<label class="form-label" for="first_pin">PIN (4+ characters)</label>
|
<?php endif; ?>
|
||||||
<input type="password" class="form-control" id="first_pin" name="pin" required minlength="4" autocomplete="new-password">
|
</div>
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<label class="form-label" for="first_favoriteColor">Favorite color</label>
|
|
||||||
<input type="color" class="form-control form-control-color" id="first_favoriteColor" name="favoriteColor" value="#4a90e2">
|
|
||||||
</div>
|
|
||||||
<div class="col-12">
|
|
||||||
<button type="submit" class="btn btn-primary btn-lg">Create profile</button>
|
|
||||||
</div>
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="alert d-none" id="firstHeadFeedback" role="status"></div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-lg-9">
|
||||||
<?php endif; ?>
|
<div class="tab-content" id="settingsSectionTabContent">
|
||||||
|
<?php if ($showSetup): ?>
|
||||||
<div class="card mb-4">
|
<div class="tab-pane fade show active" id="settings-pane-setup" role="tabpanel" aria-labelledby="settings-tab-setup" tabindex="0">
|
||||||
<div class="card-header">Calendar and dates</div>
|
<div class="card border-primary">
|
||||||
<div class="card-body">
|
<div class="card-header bg-primary text-white">First-time setup</div>
|
||||||
<p class="text-muted small">Used for the <strong>Calendar</strong> tab agenda (today, due dates, and bill reminders). US timezones only.</p>
|
<div class="card-body">
|
||||||
<?php if (!$canManage && count($people) > 0): ?>
|
<p>Create the first <strong>Head of household</strong> profile so you can manage family members and settings.</p>
|
||||||
<p class="text-muted">Switch to a verified Head of household to edit these settings.</p>
|
<form id="firstHeadForm" class="row g-3">
|
||||||
<?php endif; ?>
|
<div class="col-md-6">
|
||||||
<form id="calendarSettingsForm" class="row g-3">
|
<label class="form-label" for="first_name">Name</label>
|
||||||
<div class="col-md-6">
|
<input class="form-control" id="first_name" name="name" required autocomplete="name">
|
||||||
<label class="form-label" for="family_timezone">Family timezone</label>
|
</div>
|
||||||
<select class="form-select" id="family_timezone" name="timezone" <?= !$canManage ? 'disabled' : '' ?>>
|
<div class="col-md-6">
|
||||||
<?php
|
<label class="form-label" for="first_pin">PIN (4+ characters)</label>
|
||||||
$curTz = (string) ($familySettings['timezone'] ?? 'America/New_York');
|
<input type="password" class="form-control" id="first_pin" name="pin" required minlength="4" autocomplete="new-password">
|
||||||
foreach ($usTimezones as $zid):
|
</div>
|
||||||
?>
|
<div class="col-md-4">
|
||||||
<option value="<?= htmlspecialchars($zid, ENT_QUOTES, 'UTF-8') ?>" <?= $curTz === $zid ? 'selected' : '' ?>>
|
<label class="form-label" for="first_favoriteColor">Favorite color</label>
|
||||||
<?= htmlspecialchars(str_replace('_', ' ', $zid), ENT_QUOTES, 'UTF-8') ?>
|
<input type="color" class="form-control form-control-color" id="first_favoriteColor" name="favoriteColor" value="#4a90e2">
|
||||||
</option>
|
</div>
|
||||||
<?php endforeach; ?>
|
<div class="col-12">
|
||||||
</select>
|
<button type="submit" class="btn btn-primary btn-lg">Create profile</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 d-flex align-items-end">
|
<div class="col-12">
|
||||||
<div class="form-check mb-2">
|
<div class="alert d-none" id="firstHeadFeedback" role="status"></div>
|
||||||
<input class="form-check-input" type="checkbox" id="calendar_two_way_google" name="calendar_two_way_google" value="1"
|
</div>
|
||||||
<?= !empty($familySettings['calendar_two_way_google']) ? 'checked' : '' ?>
|
</form>
|
||||||
<?= !$canManage ? 'disabled' : '' ?>>
|
</div>
|
||||||
<label class="form-check-label" for="calendar_two_way_google">Enable two-way Google Calendar sync</label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12">
|
<?php endif; ?>
|
||||||
<label class="form-label">Monthly bill reminders</label>
|
<div class="tab-pane fade <?= !$showSetup ? 'show active' : '' ?>" id="settings-pane-calendar" role="tabpanel" aria-labelledby="settings-tab-calendar" tabindex="0">
|
||||||
<p class="small text-muted mb-2">Shown on the family agenda on the same day each month (e.g. rent). Leave a row blank or clear the title to skip.</p>
|
<div class="card">
|
||||||
<div id="billDaysRows" class="d-flex flex-column gap-2">
|
<div class="card-header">Calendar and dates</div>
|
||||||
<?php foreach ($billDays as $i => $bd): ?>
|
<div class="card-body">
|
||||||
<?php
|
<p class="text-muted small">Used for the <strong>Calendar</strong> tab agenda (today, due dates, and bill reminders). US timezones only.</p>
|
||||||
$dom = (int) ($bd['dayOfMonth'] ?? 1);
|
<?php if (!$canManage && $hasPeople): ?>
|
||||||
$bt = (string) ($bd['title'] ?? '');
|
<p class="text-muted">Switch to a verified Head of household to edit these settings.</p>
|
||||||
?>
|
<?php endif; ?>
|
||||||
<div class="bill-day-row row g-2 align-items-end">
|
<form id="calendarSettingsForm" class="row g-3">
|
||||||
<div class="col-4 col-md-3">
|
<div class="col-md-6">
|
||||||
<label class="form-label small text-muted">Day of month</label>
|
<label class="form-label" for="family_timezone">Family timezone</label>
|
||||||
<select class="form-select bill-day-dom" aria-label="Bill day of month">
|
<select class="form-select" id="family_timezone" name="timezone" <?= !$canManage ? 'disabled' : '' ?>>
|
||||||
<?php for ($d = 1; $d <= 31; $d++): ?>
|
<?php
|
||||||
<option value="<?= $d ?>" <?= $dom === $d ? 'selected' : '' ?>><?= $d ?></option>
|
$curTz = (string) ($familySettings['timezone'] ?? 'America/New_York');
|
||||||
<?php endfor; ?>
|
foreach ($usTimezones as $zid):
|
||||||
|
?>
|
||||||
|
<option value="<?= htmlspecialchars($zid, ENT_QUOTES, 'UTF-8') ?>" <?= $curTz === $zid ? 'selected' : '' ?>>
|
||||||
|
<?= htmlspecialchars(str_replace('_', ' ', $zid), ENT_QUOTES, 'UTF-8') ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col-md-6 d-flex align-items-end">
|
||||||
<label class="form-label small text-muted">Reminder title</label>
|
<div class="form-check mb-2">
|
||||||
<input type="text" class="form-control bill-day-title" maxlength="120" placeholder="e.g. Rent" value="<?= htmlspecialchars($bt, ENT_QUOTES, 'UTF-8') ?>">
|
<input class="form-check-input" type="checkbox" id="calendar_two_way_google" name="calendar_two_way_google" value="1"
|
||||||
|
<?= !empty($familySettings['calendar_two_way_google']) ? 'checked' : '' ?>
|
||||||
|
<?= !$canManage ? 'disabled' : '' ?>>
|
||||||
|
<label class="form-check-label" for="calendar_two_way_google">Enable two-way Google Calendar sync</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-12">
|
||||||
<?php endforeach; ?>
|
<label class="form-label">Monthly bill reminders</label>
|
||||||
</div>
|
<p class="small text-muted mb-2">Shown on the family agenda on the same day each month (e.g. rent). Leave a row blank or clear the title to skip.</p>
|
||||||
<?php if ($canManage): ?>
|
<div id="billDaysRows" class="d-flex flex-column gap-2">
|
||||||
<button type="button" class="btn btn-outline-secondary btn-sm mt-2" id="btnAddBillDayRow">Add reminder row</button>
|
<?php foreach ($billDays as $i => $bd): ?>
|
||||||
<div class="col-12 mt-3">
|
<?php
|
||||||
<button type="submit" class="btn btn-primary">Save calendar settings</button>
|
$dom = (int) ($bd['dayOfMonth'] ?? 1);
|
||||||
</div>
|
$bt = (string) ($bd['title'] ?? '');
|
||||||
<?php endif; ?>
|
?>
|
||||||
<div class="col-12">
|
<div class="bill-day-row row g-2 align-items-end">
|
||||||
<div class="alert d-none" id="calendarSettingsFeedback" role="status"></div>
|
<div class="col-4 col-md-3">
|
||||||
|
<label class="form-label small text-muted">Day of month</label>
|
||||||
|
<select class="form-select bill-day-dom" aria-label="Bill day of month">
|
||||||
|
<?php for ($d = 1; $d <= 31; $d++): ?>
|
||||||
|
<option value="<?= $d ?>" <?= $dom === $d ? 'selected' : '' ?>><?= $d ?></option>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<label class="form-label small text-muted">Reminder title</label>
|
||||||
|
<input type="text" class="form-control bill-day-title" maxlength="120" placeholder="e.g. Rent" value="<?= htmlspecialchars($bt, ENT_QUOTES, 'UTF-8') ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php if ($canManage): ?>
|
||||||
|
<button type="button" class="btn btn-outline-secondary btn-sm mt-2" id="btnAddBillDayRow">Add reminder row</button>
|
||||||
|
<div class="col-12 mt-3">
|
||||||
|
<button type="submit" class="btn btn-primary">Save calendar settings</button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="alert d-none" id="calendarSettingsFeedback" role="status"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
<div class="tab-pane fade" id="settings-pane-economy" role="tabpanel" aria-labelledby="settings-tab-economy" tabindex="0">
|
||||||
</div>
|
<div class="card">
|
||||||
</div>
|
<div class="card-header">Chore economy</div>
|
||||||
|
<div class="card-body">
|
||||||
<div class="card mb-4">
|
<?php if (!$canManage && $hasPeople): ?>
|
||||||
<div class="card-header">Chore economy</div>
|
<p class="text-muted">Switch to a verified Head of household to edit these settings.</p>
|
||||||
<div class="card-body">
|
<?php endif; ?>
|
||||||
<?php if (!$canManage && count($people) > 0): ?>
|
<form id="familySettingsForm" class="row g-3">
|
||||||
<p class="text-muted">Switch to a verified Head of household to edit these settings.</p>
|
|
||||||
<?php endif; ?>
|
|
||||||
<form id="familySettingsForm" class="row g-3">
|
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<label class="form-label" for="currency_symbol">Currency symbol</label>
|
<label class="form-label" for="currency_symbol">Currency symbol</label>
|
||||||
<input class="form-control" id="currency_symbol" name="currency_symbol" maxlength="8"
|
<input class="form-control" id="currency_symbol" name="currency_symbol" maxlength="8"
|
||||||
@ -246,127 +267,135 @@ $permanenceOptions = [
|
|||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="alert d-none" id="familySettingsFeedback" role="status"></div>
|
<div class="alert d-none" id="familySettingsFeedback" role="status"></div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$storesList = normalizeStoresList(readJsonFile('stores.json'));
|
$storesList = normalizeStoresList(readJsonFile('stores.json'));
|
||||||
?>
|
?>
|
||||||
<div class="card mb-4">
|
<div class="tab-pane fade" id="settings-pane-stores" role="tabpanel" aria-labelledby="settings-tab-stores" tabindex="0">
|
||||||
<div class="card-header">Grocery stores</div>
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-header">Grocery stores</div>
|
||||||
<p class="small text-muted">Each store has its own list in the <strong>Grocery list</strong> tab.</p>
|
<div class="card-body">
|
||||||
<?php if ($canManage): ?>
|
<p class="small text-muted">Each store has its own list in the <strong>Grocery list</strong> tab.</p>
|
||||||
<form id="storeAddForm" class="row g-2 align-items-end mb-3">
|
|
||||||
<div class="col-md-8">
|
|
||||||
<label class="form-label" for="new_store_name">New store name</label>
|
|
||||||
<input class="form-control" id="new_store_name" required maxlength="80" placeholder="e.g. Costco">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<button type="submit" class="btn btn-primary">Add store</button>
|
|
||||||
</div>
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="alert d-none" id="storeAddFeedback" role="status"></div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<?php else: ?>
|
|
||||||
<p class="text-muted small">Only a verified Head of household can manage stores.</p>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if (count($storesList) === 0): ?>
|
|
||||||
<p class="text-muted mb-0">No stores yet. Add one above (or open the Grocery list tab to get a default Home store).</p>
|
|
||||||
<?php else: ?>
|
|
||||||
<ul class="list-group">
|
|
||||||
<?php foreach ($storesList as $st): ?>
|
|
||||||
<?php $stid = htmlspecialchars((string) ($st['id'] ?? ''), ENT_QUOTES, 'UTF-8'); ?>
|
|
||||||
<li class="list-group-item d-flex flex-wrap justify-content-between align-items-center gap-2">
|
|
||||||
<span><?= sanitizeInput($st['name'] ?? '') ?></span>
|
|
||||||
<?php if ($canManage): ?>
|
<?php if ($canManage): ?>
|
||||||
<span class="btn-group">
|
<form id="storeAddForm" class="row g-2 align-items-end mb-3">
|
||||||
<button type="button" class="btn btn-sm btn-outline-secondary btn-store-rename" data-id="<?= $stid ?>" data-name="<?= htmlspecialchars((string) ($st['name'] ?? ''), ENT_QUOTES, 'UTF-8') ?>">Rename</button>
|
<div class="col-md-8">
|
||||||
<button type="button" class="btn btn-sm btn-outline-danger btn-store-delete" data-id="<?= $stid ?>">Delete</button>
|
<label class="form-label" for="new_store_name">New store name</label>
|
||||||
</span>
|
<input class="form-control" id="new_store_name" required maxlength="80" placeholder="e.g. Costco">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<button type="submit" class="btn btn-primary">Add store</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="alert d-none" id="storeAddFeedback" role="status"></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<?php else: ?>
|
||||||
|
<p class="text-muted small">Only a verified Head of household can manage stores.</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</li>
|
<?php if (count($storesList) === 0): ?>
|
||||||
<?php endforeach; ?>
|
<p class="text-muted mb-0">No stores yet. Add one above (or open the Grocery list tab to get a default Home store).</p>
|
||||||
</ul>
|
<?php else: ?>
|
||||||
<?php endif; ?>
|
<ul class="list-group">
|
||||||
</div>
|
<?php foreach ($storesList as $st): ?>
|
||||||
</div>
|
<?php $stid = htmlspecialchars((string) ($st['id'] ?? ''), ENT_QUOTES, 'UTF-8'); ?>
|
||||||
|
<li class="list-group-item d-flex flex-wrap justify-content-between align-items-center gap-2">
|
||||||
|
<span><?= sanitizeInput($st['name'] ?? '') ?></span>
|
||||||
|
<?php if ($canManage): ?>
|
||||||
|
<span class="btn-group">
|
||||||
|
<button type="button" class="btn btn-sm btn-outline-secondary btn-store-rename" data-id="<?= $stid ?>" data-name="<?= htmlspecialchars((string) ($st['name'] ?? ''), ENT_QUOTES, 'UTF-8') ?>">Rename</button>
|
||||||
|
<button type="button" class="btn btn-sm btn-outline-danger btn-store-delete" data-id="<?= $stid ?>">Delete</button>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php if (count($people) > 0): ?>
|
<?php if ($hasPeople): ?>
|
||||||
<div class="card mb-4">
|
<div class="tab-pane fade" id="settings-pane-people" role="tabpanel" aria-labelledby="settings-tab-people" tabindex="0">
|
||||||
<div class="card-header d-flex justify-content-between align-items-center">
|
<div class="card">
|
||||||
<span>People</span>
|
<div class="card-header d-flex justify-content-between align-items-center">
|
||||||
</div>
|
<span>People</span>
|
||||||
<div class="card-body">
|
</div>
|
||||||
<?php if ($canManage): ?>
|
<div class="card-body">
|
||||||
<form id="addPersonForm" class="row g-3 mb-4 pb-3 border-bottom">
|
<?php if ($canManage): ?>
|
||||||
<div class="col-md-4">
|
<form id="addPersonForm" class="row g-3 mb-4 pb-3 border-bottom">
|
||||||
<label class="form-label" for="add_name">Name</label>
|
<div class="col-md-4">
|
||||||
<input class="form-control" id="add_name" required>
|
<label class="form-label" for="add_name">Name</label>
|
||||||
</div>
|
<input class="form-control" id="add_name" required>
|
||||||
<div class="col-md-4">
|
</div>
|
||||||
<label class="form-label" for="add_role">Role</label>
|
<div class="col-md-4">
|
||||||
<select class="form-select" id="add_role">
|
<label class="form-label" for="add_role">Role</label>
|
||||||
<option value="<?= ROLE_CHILD ?>">Child</option>
|
<select class="form-select" id="add_role">
|
||||||
<option value="<?= ROLE_ADULT ?>">Adult</option>
|
<option value="<?= ROLE_CHILD ?>">Child</option>
|
||||||
<option value="<?= ROLE_HEAD ?>">Head of household</option>
|
<option value="<?= ROLE_ADULT ?>">Adult</option>
|
||||||
</select>
|
<option value="<?= ROLE_HEAD ?>">Head of household</option>
|
||||||
</div>
|
</select>
|
||||||
<div class="col-md-4" id="add_pin_wrap">
|
</div>
|
||||||
<label class="form-label" for="add_pin">PIN (required for Head of household)</label>
|
<div class="col-md-4" id="add_pin_wrap">
|
||||||
<input type="password" class="form-control" id="add_pin" minlength="4" autocomplete="new-password">
|
<label class="form-label" for="add_pin">PIN (required for Head of household)</label>
|
||||||
</div>
|
<input type="password" class="form-control" id="add_pin" minlength="4" autocomplete="new-password">
|
||||||
<div class="col-md-4">
|
</div>
|
||||||
<label class="form-label" for="add_favoriteColor">Favorite color</label>
|
<div class="col-md-4">
|
||||||
<input type="color" class="form-control form-control-color" id="add_favoriteColor" value="#4a90e2">
|
<label class="form-label" for="add_favoriteColor">Favorite color</label>
|
||||||
</div>
|
<input type="color" class="form-control form-control-color" id="add_favoriteColor" value="#4a90e2">
|
||||||
<div class="col-12">
|
</div>
|
||||||
<button type="submit" class="btn btn-success">Add person</button>
|
<div class="col-12">
|
||||||
</div>
|
<button type="submit" class="btn btn-success">Add person</button>
|
||||||
<div class="col-12">
|
</div>
|
||||||
<div class="alert d-none" id="addPersonFeedback" role="status"></div>
|
<div class="col-12">
|
||||||
</div>
|
<div class="alert d-none" id="addPersonFeedback" role="status"></div>
|
||||||
</form>
|
</div>
|
||||||
<?php else: ?>
|
</form>
|
||||||
<p class="text-muted">Only a verified Head of household can add or edit people.</p>
|
<?php else: ?>
|
||||||
<?php endif; ?>
|
<p class="text-muted">Only a verified Head of household can add or edit people.</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table align-middle" id="peopleTable">
|
<table class="table align-middle" id="peopleTable">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Role</th>
|
<th>Role</th>
|
||||||
<th class="text-end">Balance</th>
|
<th class="text-end">Balance</th>
|
||||||
<?php if ($canManage): ?><th>NFC submit token</th><?php endif; ?>
|
<?php if ($canManage): ?><th>NFC submit token</th><?php endif; ?>
|
||||||
<?php if ($canManage): ?><th></th><?php endif; ?>
|
<?php if ($canManage): ?><th></th><?php endif; ?>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($people as $p): ?>
|
<?php foreach ($people as $p): ?>
|
||||||
<tr data-person-id="<?= htmlspecialchars($p['id'] ?? '', ENT_QUOTES, 'UTF-8') ?>">
|
<tr data-person-id="<?= htmlspecialchars($p['id'] ?? '', ENT_QUOTES, 'UTF-8') ?>">
|
||||||
<td><?= sanitizeInput($p['name'] ?? '') ?></td>
|
<td><?= sanitizeInput($p['name'] ?? '') ?></td>
|
||||||
<td><?= sanitizeInput($p['role'] ?? '') ?></td>
|
<td><?= sanitizeInput($p['role'] ?? '') ?></td>
|
||||||
<td class="text-end"><?= sanitizeInput((string) ($p['currency_balance'] ?? 0)) ?> <?= sanitizeInput($familySettings['currency_symbol'] ?? '') ?></td>
|
<td class="text-end"><?= sanitizeInput((string) ($p['currency_balance'] ?? 0)) ?> <?= sanitizeInput($familySettings['currency_symbol'] ?? '') ?></td>
|
||||||
<?php if ($canManage): ?>
|
<?php if ($canManage): ?>
|
||||||
<td class="text-nowrap">
|
<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>
|
<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>
|
||||||
<td class="text-end text-nowrap">
|
<td class="text-end text-nowrap">
|
||||||
<?php if (($p['role'] ?? '') === ROLE_HEAD): ?>
|
<?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>
|
<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>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<button type="button" class="btn btn-sm btn-outline-danger btn-delete-person" data-id="<?= htmlspecialchars($p['id'] ?? '', ENT_QUOTES, 'UTF-8') ?>">Remove</button>
|
<button type="button" class="btn btn-sm btn-outline-danger btn-delete-person" data-id="<?= htmlspecialchars($p['id'] ?? '', ENT_QUOTES, 'UTF-8') ?>">Remove</button>
|
||||||
</td>
|
</td>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user