add support for network calculation from the calculator
All checks were successful
Release / meta (push) Successful in 1m39s
Release / linux-build (push) Successful in 1m55s
Release / web-build (push) Successful in 3m12s
Release / android-build (push) Successful in 6m48s
Release / release-master (push) Successful in 22s
Release / release-dev (push) Successful in 28s

This commit is contained in:
2026-01-27 00:41:27 +00:00
parent 94adf06726
commit 45bd872b23
12 changed files with 299 additions and 55 deletions

View File

@@ -1399,16 +1399,18 @@ class _NewEntryPageState extends State<NewEntryPage> {
singleColumn: true,
),
),
const Divider(height: 24),
TextFormField(
controller: _networkController,
textCapitalization: TextCapitalization.characters,
inputFormatters: const [_UpperCaseTextFormatter()],
decoration: const InputDecoration(
labelText: 'Network',
border: OutlineInputBorder(),
if (_useManualMileage) ...[
const Divider(height: 24),
TextFormField(
controller: _networkController,
textCapitalization: TextCapitalization.characters,
inputFormatters: const [_UpperCaseTextFormatter()],
decoration: const InputDecoration(
labelText: 'Network',
border: OutlineInputBorder(),
),
),
),
],
TextFormField(
controller: _notesController,
maxLines: 3,
@@ -1520,6 +1522,9 @@ class _NewEntryPageState extends State<NewEntryPage> {
onSelected: (val) {
setState(() {
_useManualMileage = val;
if (!val) {
_networkController.clear();
}
if (val && _routeResult != null) {
_mileageController.text = _formatDistance(
distanceUnitService,

View File

@@ -18,7 +18,7 @@ extension _NewEntrySubmitLogic on _NewEntryPageState {
}
}
if (_networkController.text.trim().isEmpty) {
if (_useManualMileage && _networkController.text.trim().isEmpty) {
missing.add('Network');
}
@@ -93,7 +93,7 @@ extension _NewEntrySubmitLogic on _NewEntryPageState {
final isEditingExisting = _isEditing && widget.editLegId != null;
try {
final commonPayload = {
final commonPayload = {
if (isEditingExisting) "leg_id": widget.editLegId,
"leg_trip": _selectedTripId,
"leg_begin_time": _legDateTime.toIso8601String(),
@@ -104,7 +104,8 @@ extension _NewEntrySubmitLogic on _NewEntryPageState {
"leg_destination_time": destinationTime.toIso8601String(),
"leg_notes": _notesController.text.trim(),
"leg_headcode": _headcodeController.text.trim(),
"leg_network": _networkController.text.trim(),
if (_useManualMileage)
"leg_network": _networkController.text.trim(),
"leg_origin": _originController.text.trim(),
"leg_destination": _destinationController.text.trim(),
"leg_begin_delay": beginDelay,