Add LPG bi-fuel and hydrogen fuel types
Add petrol_lpg, diesel_lpg and hydrogen to the fuel_type choices, across the six places that define them: the PocketBase schema, the car form and detail view in both the Web App and the Phone App, and the two doc comments that enumerate the values. The Go API needed no change — it passes fuel_type through as a free string, so PocketBase is the only validator. Model the LPG conversions as their own choices rather than a separate "has LPG" flag: the car runs on either tank, so "petrol + LPG" is what an owner picks it out as. Order each variant next to its base fuel so the dropdowns read naturally. Purely additive — existing rows keep their values and need no migration. The live PocketBase schema does still need scripts/setup-pocketbase.mjs re-run before the new choices will save, since its select field allows only the old four; the script reconciles select values on existing fields, so re-running migrates it in place. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
98acd7d121
commit
f77cbf0e73
@@ -54,7 +54,7 @@ type Car struct {
|
|||||||
BrakeFluidSpec string `json:"brakeFluidSpec"` // e.g. "DOT 4"
|
BrakeFluidSpec string `json:"brakeFluidSpec"` // e.g. "DOT 4"
|
||||||
CoolantSpec string `json:"coolantSpec"` // e.g. "Toyota Super Long Life Coolant"
|
CoolantSpec string `json:"coolantSpec"` // e.g. "Toyota Super Long Life Coolant"
|
||||||
|
|
||||||
FuelType string `json:"fuelType"` // petrol | diesel | hybrid | electric
|
FuelType string `json:"fuelType"` // petrol | petrol_lpg | diesel | diesel_lpg | hybrid | electric | hydrogen
|
||||||
BuildDate string `json:"buildDate"` // ISO YYYY-MM-DD (date-only)
|
BuildDate string `json:"buildDate"` // ISO YYYY-MM-DD (date-only)
|
||||||
FirstRegistrationDate string `json:"firstRegistrationDate"` // ISO YYYY-MM-DD (date-only)
|
FirstRegistrationDate string `json:"firstRegistrationDate"` // ISO YYYY-MM-DD (date-only)
|
||||||
|
|
||||||
|
|||||||
@@ -245,7 +245,17 @@ const DESIRED = {
|
|||||||
F.text("brake_fluid_spec"),
|
F.text("brake_fluid_spec"),
|
||||||
F.text("coolant_spec"),
|
F.text("coolant_spec"),
|
||||||
F.number("current_km"),
|
F.number("current_km"),
|
||||||
F.select("fuel_type", ["petrol", "diesel", "hybrid", "electric"]),
|
// Bi-fuel LPG conversions are their own choice rather than a flag: the car
|
||||||
|
// runs on either tank, so "petrol + LPG" is what an owner picks it out as.
|
||||||
|
F.select("fuel_type", [
|
||||||
|
"petrol",
|
||||||
|
"petrol_lpg",
|
||||||
|
"diesel",
|
||||||
|
"diesel_lpg",
|
||||||
|
"hybrid",
|
||||||
|
"electric",
|
||||||
|
"hydrogen",
|
||||||
|
]),
|
||||||
F.text("build_date"), // ISO YYYY-MM-DD (date-only; VIN 10th digit ≈ model year)
|
F.text("build_date"), // ISO YYYY-MM-DD (date-only; VIN 10th digit ≈ model year)
|
||||||
F.text("first_registration_date"), // ISO YYYY-MM-DD
|
F.text("first_registration_date"), // ISO YYYY-MM-DD
|
||||||
// Owner of this car. Non-cascading on purpose: deleting a user must not
|
// Owner of this car. Non-cascading on purpose: deleting a user must not
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Car {
|
|||||||
final String differentialOilSpec;
|
final String differentialOilSpec;
|
||||||
final String brakeFluidSpec;
|
final String brakeFluidSpec;
|
||||||
final String coolantSpec;
|
final String coolantSpec;
|
||||||
final String fuelType; // petrol | diesel | hybrid | electric
|
final String fuelType; // petrol | petrol_lpg | diesel | diesel_lpg | hybrid | electric | hydrogen
|
||||||
final String buildDate; // ISO YYYY-MM-DD (date-only)
|
final String buildDate; // ISO YYYY-MM-DD (date-only)
|
||||||
final String firstRegistrationDate; // ISO YYYY-MM-DD (date-only)
|
final String firstRegistrationDate; // ISO YYYY-MM-DD (date-only)
|
||||||
final int serviceIntervalDays;
|
final int serviceIntervalDays;
|
||||||
|
|||||||
@@ -456,9 +456,12 @@ class _InfoTab extends StatelessWidget {
|
|||||||
|
|
||||||
static const Map<String, String> _fuelLabels = {
|
static const Map<String, String> _fuelLabels = {
|
||||||
"petrol": "Petrol (gasoline)",
|
"petrol": "Petrol (gasoline)",
|
||||||
|
"petrol_lpg": "Petrol (gasoline) + LPG",
|
||||||
"diesel": "Diesel",
|
"diesel": "Diesel",
|
||||||
|
"diesel_lpg": "Diesel + LPG",
|
||||||
"hybrid": "Hybrid",
|
"hybrid": "Hybrid",
|
||||||
"electric": "Electric",
|
"electric": "Electric",
|
||||||
|
"hydrogen": "Hydrogen",
|
||||||
};
|
};
|
||||||
static String _fuelLabel(String v) => _fuelLabels[v] ?? "—";
|
static String _fuelLabel(String v) => _fuelLabels[v] ?? "—";
|
||||||
|
|
||||||
|
|||||||
@@ -198,9 +198,12 @@ class _CarFormSheetState extends State<CarFormSheet> {
|
|||||||
labelText: "Fuel type", border: OutlineInputBorder(), isDense: true),
|
labelText: "Fuel type", border: OutlineInputBorder(), isDense: true),
|
||||||
items: const [
|
items: const [
|
||||||
DropdownMenuItem(value: "petrol", child: Text("Petrol (gasoline)")),
|
DropdownMenuItem(value: "petrol", child: Text("Petrol (gasoline)")),
|
||||||
|
DropdownMenuItem(value: "petrol_lpg", child: Text("Petrol (gasoline) + LPG")),
|
||||||
DropdownMenuItem(value: "diesel", child: Text("Diesel")),
|
DropdownMenuItem(value: "diesel", child: Text("Diesel")),
|
||||||
|
DropdownMenuItem(value: "diesel_lpg", child: Text("Diesel + LPG")),
|
||||||
DropdownMenuItem(value: "hybrid", child: Text("Hybrid")),
|
DropdownMenuItem(value: "hybrid", child: Text("Hybrid")),
|
||||||
DropdownMenuItem(value: "electric", child: Text("Electric")),
|
DropdownMenuItem(value: "electric", child: Text("Electric")),
|
||||||
|
DropdownMenuItem(value: "hydrogen", child: Text("Hydrogen")),
|
||||||
],
|
],
|
||||||
onChanged: (v) => setState(() => _fuelType = v ?? ""),
|
onChanged: (v) => setState(() => _fuelType = v ?? ""),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -110,9 +110,12 @@ async function submit() {
|
|||||||
<select v-model="form.fuelType" class="dh-input">
|
<select v-model="form.fuelType" class="dh-input">
|
||||||
<option value="">—</option>
|
<option value="">—</option>
|
||||||
<option value="petrol">Petrol (gasoline)</option>
|
<option value="petrol">Petrol (gasoline)</option>
|
||||||
|
<option value="petrol_lpg">Petrol (gasoline) + LPG</option>
|
||||||
<option value="diesel">Diesel</option>
|
<option value="diesel">Diesel</option>
|
||||||
|
<option value="diesel_lpg">Diesel + LPG</option>
|
||||||
<option value="hybrid">Hybrid</option>
|
<option value="hybrid">Hybrid</option>
|
||||||
<option value="electric">Electric</option>
|
<option value="electric">Electric</option>
|
||||||
|
<option value="hydrogen">Hydrogen</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -390,9 +390,12 @@ function yn(v) {
|
|||||||
|
|
||||||
const FUEL_LABELS = {
|
const FUEL_LABELS = {
|
||||||
petrol: "Petrol (gasoline)",
|
petrol: "Petrol (gasoline)",
|
||||||
|
petrol_lpg: "Petrol (gasoline) + LPG",
|
||||||
diesel: "Diesel",
|
diesel: "Diesel",
|
||||||
|
diesel_lpg: "Diesel + LPG",
|
||||||
hybrid: "Hybrid",
|
hybrid: "Hybrid",
|
||||||
electric: "Electric",
|
electric: "Electric",
|
||||||
|
hydrogen: "Hydrogen",
|
||||||
};
|
};
|
||||||
function fuelLabel(v) {
|
function fuelLabel(v) {
|
||||||
return FUEL_LABELS[v] || "—";
|
return FUEL_LABELS[v] || "—";
|
||||||
|
|||||||
Reference in New Issue
Block a user