Fix count labels for odometer and reminder records when filtered by tags.

This commit is contained in:
DESKTOP-T0O5CDB\DESK-555BD
2025-01-22 09:39:07 -07:00
parent f1f99a67dd
commit 4be3c16adc
4 changed files with 9 additions and 8 deletions

View File

@@ -131,7 +131,7 @@
<tr class="d-flex user-select-none" style="cursor:pointer;" onmouseup="stopEvent()" ontouchstart="detectRowLongTouch(this)" ontouchend="detectRowTouchEndPremature(this)" data-rowId="@odometerRecord.Id" oncontextmenu="showTableContextMenu(this)" onmousemove="rangeMouseMove(this)" onclick="handleTableRowClick(this, showEditOdometerRecordModal,@odometerRecord.Id)" data-tags='@string.Join(" ", odometerRecord.Tags)'> <tr class="d-flex user-select-none" style="cursor:pointer;" onmouseup="stopEvent()" ontouchstart="detectRowLongTouch(this)" ontouchend="detectRowTouchEndPremature(this)" data-rowId="@odometerRecord.Id" oncontextmenu="showTableContextMenu(this)" onmousemove="rangeMouseMove(this)" onclick="handleTableRowClick(this, showEditOdometerRecordModal,@odometerRecord.Id)" data-tags='@string.Join(" ", odometerRecord.Tags)'>
<td class="col-2 col-xl-1 flex-grow-1 text-truncate" data-column="date">@odometerRecord.Date.ToShortDateString()</td> <td class="col-2 col-xl-1 flex-grow-1 text-truncate" data-column="date">@odometerRecord.Date.ToShortDateString()</td>
<td class="col-3 flex-grow-1 flex-shrink-1 text-truncate" data-column="initialodometer">@odometerRecord.InitialMileage</td> <td class="col-3 flex-grow-1 flex-shrink-1 text-truncate" data-column="initialodometer">@odometerRecord.InitialMileage</td>
<td class="col-3 flex-grow-1 flex-shrink-1 text-truncate" data-column="odometer">@odometerRecord.Mileage</td> <td class="col-3 flex-grow-1 flex-shrink-1 text-truncate" data-column="odometer" data-record-type="cost">@odometerRecord.Mileage</td>
<td class="col-2 flex-grow-1 flex-shrink-1 text-truncate" data-column="distance" data-record-type="distance">@(odometerRecord.DistanceTraveled == default ? "---" : odometerRecord.DistanceTraveled)</td> <td class="col-2 flex-grow-1 flex-shrink-1 text-truncate" data-column="distance" data-record-type="distance">@(odometerRecord.DistanceTraveled == default ? "---" : odometerRecord.DistanceTraveled)</td>
<td class="col-2 col-xl-3 flex-grow-1 flex-shrink-1 text-truncate" data-column="notes">@StaticHelper.TruncateStrings(odometerRecord.Notes, 75)</td> <td class="col-2 col-xl-3 flex-grow-1 flex-shrink-1 text-truncate" data-column="notes">@StaticHelper.TruncateStrings(odometerRecord.Notes, 75)</td>
@foreach (string extraFieldColumn in extraFields) @foreach (string extraFieldColumn in extraFields)

View File

@@ -140,7 +140,7 @@
<span class="badge text-bg-success">@translator.Translate(userLanguage, "Not Urgent")</span> <span class="badge text-bg-success">@translator.Translate(userLanguage, "Not Urgent")</span>
} }
</td> </td>
<td class="col-2 text-truncate flex-grow-1 flex-shrink-1" data-column="metric"> <td class="col-2 text-truncate flex-grow-1 flex-shrink-1" data-column="metric" data-record-type="cost">
@if (reminderRecord.Metric == ReminderMetric.Date) @if (reminderRecord.Metric == ReminderMetric.Date)
{ {
@reminderRecord.Date.ToShortDateString() @reminderRecord.Date.ToShortDateString()

View File

@@ -139,7 +139,7 @@ function getAndValidateOdometerRecordValues() {
function recalculateDistance() { function recalculateDistance() {
//force distance recalculation //force distance recalculation
//reserved for when data is incoherent with negative distances due to non-chronologica order of odometer records. //reserved for when data is incoherent with negative distances due to non-chronological order of odometer records.
var vehicleId = GetVehicleId().vehicleId var vehicleId = GetVehicleId().vehicleId
$.post(`/Vehicle/ForceRecalculateDistanceByVehicleId?vehicleId=${vehicleId}`, function (data) { $.post(`/Vehicle/ForceRecalculateDistanceByVehicleId?vehicleId=${vehicleId}`, function (data) {
if (data) { if (data) {
@@ -362,15 +362,16 @@ function getRecordedOdometer() {
return parseFloat(`${recordedOdometer}.${recordedSubOdometer}`); return parseFloat(`${recordedOdometer}.${recordedSubOdometer}`);
} }
function saveRecordedOdometer() { function saveRecordedOdometer() {
//update current odometer value
$("#odometerRecordMileage").val(parseInt(getRecordedOdometer()).toString());
//save coordinates into a CSV file and upload //save coordinates into a CSV file and upload
if (tripCoordinates.length > 0) { if (tripCoordinates.length > 1) {
//update current odometer value
$("#odometerRecordMileage").val(parseInt(getRecordedOdometer()).toString());
//generate attachment
$.post('/Files/UploadCoordinates', { coordinates: tripCoordinates }, function (response) { $.post('/Files/UploadCoordinates', { coordinates: tripCoordinates }, function (response) {
uploadedFiles.push(response); uploadedFiles.push(response);
$.post('/Vehicle/GetFilesPendingUpload', { uploadedFiles: uploadedFiles }, function (viewData) { $.post('/Vehicle/GetFilesPendingUpload', { uploadedFiles: uploadedFiles }, function (viewData) {
$("#filesPendingUpload").html(viewData); $("#filesPendingUpload").html(viewData);
tripCoordinates = []; tripCoordinates = ["Latitude,Longitude"];
}); });
}); });
} }

View File

@@ -1449,7 +1449,7 @@ function handleModalPaste(e, recordType) {
} }
function handleEnter(e) { function handleEnter(e) {
if ((event.ctrlKey || event.metaKey) && event.which == 13) { if ((event.ctrlKey || event.metaKey) && event.which == 13) {
var saveButton = $(e).parent().find(".modal-footer .btn-primary"); var saveButton = $(e).parent().find(".modal-footer .btn-primary:not('.d-none')");
if (saveButton.length > 0) { if (saveButton.length > 0) {
saveButton.first().trigger('click'); saveButton.first().trigger('click');
} }