Add technical check history
A car's mandatory roadworthiness inspections — przegląd techniczny, MOT, TÜV — had nowhere to live. Log them behind Service history, which this mirrors minus the odometer: an inspection falls due on a date whatever the mileage reads. The cycle is legal rather than mechanical, and it is not constant — a new car's first check falls due years later than its third. So the car's technical_check_interval_days only prefills the next date, and any check overrides it with the valid-until printed on its own certificate. A failed check derives no next date at all: reading one off a failure would stamp a reassuring "valid until" on a car that just flunked. The next-due date and its status are derived on every read rather than stored, for the same reason documents are — a stored verdict goes stale as the date passes. The response carries the same expiry shape documents use, so the web app reuses the existing badge rather than growing a second one. Each check records result, cost, station and notes, and holds the certificate as its single attachment on the same terms as every other record. Needs `node scripts/setup-pocketbase.mjs` to create technical_checks and add the interval to cars. The reformatting in records.go is gofmt realigning the car struct around a longer field name. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
03738f08dc
commit
21c99ad762
@@ -27,6 +27,7 @@ const form = ref({
|
||||
coolantSpec: props.car?.coolantSpec ?? "",
|
||||
serviceIntervalDays: props.car?.serviceIntervalDays || 365,
|
||||
serviceIntervalKm: props.car?.serviceIntervalKm || 15000,
|
||||
technicalCheckIntervalDays: props.car?.technicalCheckIntervalDays || 365,
|
||||
currentKm: props.car?.currentKm || "",
|
||||
});
|
||||
|
||||
@@ -52,6 +53,7 @@ async function submit() {
|
||||
coolantSpec: form.value.coolantSpec.trim(),
|
||||
serviceIntervalDays: Number(form.value.serviceIntervalDays) || 365,
|
||||
serviceIntervalKm: Number(form.value.serviceIntervalKm) || 15000,
|
||||
technicalCheckIntervalDays: Number(form.value.technicalCheckIntervalDays) || 365,
|
||||
currentKm: form.value.currentKm ? Number(form.value.currentKm) : 0,
|
||||
};
|
||||
const saved = isEdit
|
||||
@@ -162,6 +164,14 @@ async function submit() {
|
||||
<input v-model="form.serviceIntervalKm" type="number" class="dh-input data" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="dh-label">Technical check interval (days)</label>
|
||||
<input v-model="form.technicalCheckIntervalDays" type="number" class="dh-input data" />
|
||||
<p class="mt-1 text-xs text-muted">
|
||||
Prefills each check's next-due date. Any check can override it with the date printed on
|
||||
its certificate.
|
||||
</p>
|
||||
</div>
|
||||
<div class="mt-4 flex justify-end gap-2">
|
||||
<button type="button" class="dh-btn dh-btn-ghost" @click="emit('close')">Cancel</button>
|
||||
<button type="submit" :disabled="saving" class="dh-btn dh-btn-primary">
|
||||
|
||||
Reference in New Issue
Block a user