feat: odometer_baseline field on server portal device settings page
This commit is contained in:
@@ -102,6 +102,11 @@
|
|||||||
<input class="form-control" id="avatar_path" name="avatar_path" maxlength="255" placeholder="img/yaris.png" disabled>
|
<input class="form-control" id="avatar_path" name="avatar_path" maxlength="255" placeholder="img/yaris.png" disabled>
|
||||||
<div class="form-text">Relative to the shared <code>static/</code> folder.</div>
|
<div class="form-text">Relative to the shared <code>static/</code> folder.</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-12 col-md-6">
|
||||||
|
<label class="form-label" for="odometer_baseline">Odometer baseline (km)</label>
|
||||||
|
<input class="form-control" id="odometer_baseline" name="odometer_baseline" type="number" inputmode="decimal" min="0" max="999999" step="0.1" disabled>
|
||||||
|
<div class="form-text">Enter the car's current odometer reading. The app adds trip distances to this baseline. Synced to the Pi on next config sync.</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ const fields = {
|
|||||||
car_model: document.getElementById('car_model'),
|
car_model: document.getElementById('car_model'),
|
||||||
device_name: document.getElementById('device_name'),
|
device_name: document.getElementById('device_name'),
|
||||||
avatar_path: document.getElementById('avatar_path'),
|
avatar_path: document.getElementById('avatar_path'),
|
||||||
|
odometer_baseline: document.getElementById('odometer_baseline'),
|
||||||
};
|
};
|
||||||
|
|
||||||
let devices = [];
|
let devices = [];
|
||||||
@@ -56,6 +57,7 @@ function currentState() {
|
|||||||
car_model: fields.car_model.value.trim(),
|
car_model: fields.car_model.value.trim(),
|
||||||
device_name: fields.device_name.value.trim(),
|
device_name: fields.device_name.value.trim(),
|
||||||
avatar_path: fields.avatar_path.value.trim(),
|
avatar_path: fields.avatar_path.value.trim(),
|
||||||
|
odometer_baseline: Number(fields.odometer_baseline.value) || 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +117,7 @@ function populateDevice(device, config) {
|
|||||||
fields.car_model.value = config.car_model || '';
|
fields.car_model.value = config.car_model || '';
|
||||||
fields.device_name.value = config.device_name || '';
|
fields.device_name.value = config.device_name || '';
|
||||||
fields.avatar_path.value = config.avatar_path || '';
|
fields.avatar_path.value = config.avatar_path || '';
|
||||||
|
fields.odometer_baseline.value = (config.odometer_baseline || 0).toFixed(1);
|
||||||
initialState = currentState();
|
initialState = currentState();
|
||||||
credentialFields.deviceName.value = device.name;
|
credentialFields.deviceName.value = device.name;
|
||||||
renderDeviceList();
|
renderDeviceList();
|
||||||
|
|||||||
Reference in New Issue
Block a user