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:
1 parent
98acd7d121
commit
f77cbf0e73
7 files changed
+25
-3
No files matched your search
@@ -18,7 +18,7 @@ class Car {
|
||||
final String differentialOilSpec;
|
||||
final String brakeFluidSpec;
|
||||
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 firstRegistrationDate; // ISO YYYY-MM-DD (date-only)
|
||||
final int serviceIntervalDays;
|
||||
|
||||
@@ -456,9 +456,12 @@ class _InfoTab extends StatelessWidget {
|
||||
|
||||
static const Map<String, String> _fuelLabels = {
|
||||
"petrol": "Petrol (gasoline)",
|
||||
"petrol_lpg": "Petrol (gasoline) + LPG",
|
||||
"diesel": "Diesel",
|
||||
"diesel_lpg": "Diesel + LPG",
|
||||
"hybrid": "Hybrid",
|
||||
"electric": "Electric",
|
||||
"hydrogen": "Hydrogen",
|
||||
};
|
||||
static String _fuelLabel(String v) => _fuelLabels[v] ?? "—";
|
||||
|
||||
|
||||
@@ -198,9 +198,12 @@ class _CarFormSheetState extends State<CarFormSheet> {
|
||||
labelText: "Fuel type", border: OutlineInputBorder(), isDense: true),
|
||||
items: const [
|
||||
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_lpg", child: Text("Diesel + LPG")),
|
||||
DropdownMenuItem(value: "hybrid", child: Text("Hybrid")),
|
||||
DropdownMenuItem(value: "electric", child: Text("Electric")),
|
||||
DropdownMenuItem(value: "hydrogen", child: Text("Hydrogen")),
|
||||
],
|
||||
onChanged: (v) => setState(() => _fuelType = v ?? ""),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user