small fixes
This commit is contained in:
@@ -96,9 +96,10 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
padding: 1rem 0.75rem;
|
padding: 0 0.75rem;
|
||||||
border-bottom: 1px solid #3730a3;
|
border-bottom: 1px solid #3730a3;
|
||||||
min-height: 52px;
|
height: 52px;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
.app-icon {
|
.app-icon {
|
||||||
font-size: 1.3rem;
|
font-size: 1.3rem;
|
||||||
@@ -155,7 +156,7 @@
|
|||||||
}
|
}
|
||||||
.sidebar-header {
|
.sidebar-header {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 1rem 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
.app-name {
|
.app-name {
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
@@ -64,12 +64,10 @@ async function createRecord(collection: string, data: any): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Seed a default season (Holidays) per family so the family-admin season
|
// Seed two default seasons (Term + Holidays) per family so the family-admin
|
||||||
// picker always has at least one option. "Term time" is intentionally NOT
|
// season picker always has options from day one and they can tick either on/off.
|
||||||
// auto-seeded — it's a UK-school-specific term that not every family wants,
|
// Only seeds when a family has zero seasons, so user deletions stick (a deleted
|
||||||
// and force-seeding it meant a deleted "Term time" kept coming back on every
|
// default never comes back on boot as long as at least one season remains).
|
||||||
// boot. Families that want it can add it themselves.
|
|
||||||
// Only seeds when a family has zero seasons, so user deletions stick.
|
|
||||||
async function ensureDefaultSeasons(): Promise<void> {
|
async function ensureDefaultSeasons(): Promise<void> {
|
||||||
const famsCol = await getCollection('fams');
|
const famsCol = await getCollection('fams');
|
||||||
if (!famsCol) return;
|
if (!famsCol) return;
|
||||||
@@ -78,7 +76,10 @@ async function ensureDefaultSeasons(): Promise<void> {
|
|||||||
headers: { Authorization: `Bearer ${t}` }
|
headers: { Authorization: `Bearer ${t}` }
|
||||||
});
|
});
|
||||||
const fams = (await famsRes.json()).items || [];
|
const fams = (await famsRes.json()).items || [];
|
||||||
const defaults = [{ name: 'Holidays', color: '#f59e0b', active: true }];
|
const defaults = [
|
||||||
|
{ name: 'Term', color: '#6366f1', active: true },
|
||||||
|
{ name: 'Holidays', color: '#f59e0b', active: true }
|
||||||
|
];
|
||||||
for (const fam of fams) {
|
for (const fam of fams) {
|
||||||
const sRes = await fetch(
|
const sRes = await fetch(
|
||||||
`${PB_ENDPOINT}/api/collections/seasons/records?filter=(famId='${fam.id}')&fields=name&perPage=200`,
|
`${PB_ENDPOINT}/api/collections/seasons/records?filter=(famId='${fam.id}')&fields=name&perPage=200`,
|
||||||
|
|||||||
@@ -269,6 +269,10 @@
|
|||||||
let doneConfigs = $derived(
|
let doneConfigs = $derived(
|
||||||
configs.filter((c: BonusConfig) => c.status === 'completed') as BonusConfig[]
|
configs.filter((c: BonusConfig) => c.status === 'completed') as BonusConfig[]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let isPocketMoney = $derived(
|
||||||
|
!!editingConfig?.isPocketMoney || !!creatingFromTemplate?.isPocketMoney
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ViewHeader title="Rewards" hero />
|
<ViewHeader title="Rewards" hero />
|
||||||
@@ -598,10 +602,12 @@
|
|||||||
<span class="field-label">{@html stepIcon(1)} Name</span>
|
<span class="field-label">{@html stepIcon(1)} Name</span>
|
||||||
<input name="name" bind:value={editVals.name} required />
|
<input name="name" bind:value={editVals.name} required />
|
||||||
</label>
|
</label>
|
||||||
|
{#if !isPocketMoney}
|
||||||
<label>
|
<label>
|
||||||
<span class="field-label">{@html stepIcon(1)} Description</span>
|
<span class="field-label">{@html stepIcon(1)} Description</span>
|
||||||
<input name="description" bind:value={editVals.description} />
|
<input name="description" bind:value={editVals.description} />
|
||||||
</label>
|
</label>
|
||||||
|
{/if}
|
||||||
<label>
|
<label>
|
||||||
<span class="field-label"><UsersRound size={14} /> Target (who)</span>
|
<span class="field-label"><UsersRound size={14} /> Target (who)</span>
|
||||||
<select name="target" bind:value={editVals.target}>
|
<select name="target" bind:value={editVals.target}>
|
||||||
@@ -625,6 +631,7 @@
|
|||||||
|
|
||||||
<!-- STEP 2 — How (rules + progress) -->
|
<!-- STEP 2 — How (rules + progress) -->
|
||||||
<div class="step-body" hidden={step !== 2}>
|
<div class="step-body" hidden={step !== 2}>
|
||||||
|
{#if !isPocketMoney}
|
||||||
<label>
|
<label>
|
||||||
<span class="field-label"><Settings2 size={14} /> Type</span>
|
<span class="field-label"><Settings2 size={14} /> Type</span>
|
||||||
<select name="type" bind:value={editVals.type}>
|
<select name="type" bind:value={editVals.type}>
|
||||||
@@ -633,7 +640,8 @@
|
|||||||
<option value="manual">Manual</option>
|
<option value="manual">Manual</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
{#if editVals.type === 'threshold'}
|
{/if}
|
||||||
|
{#if editVals.type === 'threshold' && !isPocketMoney}
|
||||||
<label>
|
<label>
|
||||||
<span class="field-label"><Target size={14} /> Threshold by</span>
|
<span class="field-label"><Target size={14} /> Threshold by</span>
|
||||||
<select name="thresholdType" bind:value={editVals.thresholdType}>
|
<select name="thresholdType" bind:value={editVals.thresholdType}>
|
||||||
@@ -691,6 +699,7 @@
|
|||||||
>
|
>
|
||||||
</label>
|
</label>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if !isPocketMoney}
|
||||||
<label>
|
<label>
|
||||||
<span class="field-label"><Settings2 size={14} /> Occurrence</span>
|
<span class="field-label"><Settings2 size={14} /> Occurrence</span>
|
||||||
<select name="occurrence" bind:value={editVals.occurrence}>
|
<select name="occurrence" bind:value={editVals.occurrence}>
|
||||||
@@ -698,7 +707,8 @@
|
|||||||
<option value="once">Once</option>
|
<option value="once">Once</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
{#if showPeriod}
|
{/if}
|
||||||
|
{#if showPeriod && !isPocketMoney}
|
||||||
<label>
|
<label>
|
||||||
<span class="field-label"><CalendarDays size={14} /> Period</span>
|
<span class="field-label"><CalendarDays size={14} /> Period</span>
|
||||||
<select name="period" bind:value={editVals.period}>
|
<select name="period" bind:value={editVals.period}>
|
||||||
@@ -847,7 +857,7 @@
|
|||||||
<button type="button" class="nav-btn" onclick={() => (step = 2)}>
|
<button type="button" class="nav-btn" onclick={() => (step = 2)}>
|
||||||
<ArrowLeft size={14} /> Back
|
<ArrowLeft size={14} /> Back
|
||||||
</button>
|
</button>
|
||||||
{#if editingConfig}
|
{#if editingConfig && !isPocketMoney}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="toggle-btn"
|
class="toggle-btn"
|
||||||
|
|||||||
Reference in New Issue
Block a user