Merge pull request #348 from hargata/Hargata/show.extrafields
Show Extra Fields as Columns in tables.
This commit is contained in:
@@ -140,6 +140,7 @@ namespace CarCareTracker.Helper
|
|||||||
PreferredGasUnit = _config[nameof(UserConfig.PreferredGasUnit)],
|
PreferredGasUnit = _config[nameof(UserConfig.PreferredGasUnit)],
|
||||||
UserLanguage = _config[nameof(UserConfig.UserLanguage)],
|
UserLanguage = _config[nameof(UserConfig.UserLanguage)],
|
||||||
EnableShopSupplies = bool.Parse(_config[nameof(UserConfig.EnableShopSupplies)]),
|
EnableShopSupplies = bool.Parse(_config[nameof(UserConfig.EnableShopSupplies)]),
|
||||||
|
EnableExtraFieldColumns = bool.Parse(_config[nameof(UserConfig.EnableExtraFieldColumns)]),
|
||||||
VisibleTabs = _config.GetSection("VisibleTabs").Get<List<ImportMode>>(),
|
VisibleTabs = _config.GetSection("VisibleTabs").Get<List<ImportMode>>(),
|
||||||
DefaultTab = (ImportMode)int.Parse(_config[nameof(UserConfig.DefaultTab)])
|
DefaultTab = (ImportMode)int.Parse(_config[nameof(UserConfig.DefaultTab)])
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -71,7 +71,8 @@ namespace CarCareTracker.Helper
|
|||||||
IsFillToFull = currentObject.IsFillToFull,
|
IsFillToFull = currentObject.IsFillToFull,
|
||||||
MissedFuelUp = currentObject.MissedFuelUp,
|
MissedFuelUp = currentObject.MissedFuelUp,
|
||||||
Notes = currentObject.Notes,
|
Notes = currentObject.Notes,
|
||||||
Tags = currentObject.Tags
|
Tags = currentObject.Tags,
|
||||||
|
ExtraFields = currentObject.ExtraFields
|
||||||
};
|
};
|
||||||
if (currentObject.MissedFuelUp)
|
if (currentObject.MissedFuelUp)
|
||||||
{
|
{
|
||||||
@@ -124,7 +125,8 @@ namespace CarCareTracker.Helper
|
|||||||
IsFillToFull = currentObject.IsFillToFull,
|
IsFillToFull = currentObject.IsFillToFull,
|
||||||
MissedFuelUp = currentObject.MissedFuelUp,
|
MissedFuelUp = currentObject.MissedFuelUp,
|
||||||
Notes = currentObject.Notes,
|
Notes = currentObject.Notes,
|
||||||
Tags = currentObject.Tags
|
Tags = currentObject.Tags,
|
||||||
|
ExtraFields = currentObject.ExtraFields
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
previousMileage = currentObject.Mileage;
|
previousMileage = currentObject.Mileage;
|
||||||
|
|||||||
@@ -182,11 +182,20 @@ namespace CarCareTracker.Helper
|
|||||||
{
|
{
|
||||||
return templateExtraFields;
|
return templateExtraFields;
|
||||||
}
|
}
|
||||||
//append the fields.
|
var recordFieldNames = recordExtraFields.Select(x => x.Name);
|
||||||
|
//update isrequired setting
|
||||||
foreach (ExtraField extraField in recordExtraFields)
|
foreach (ExtraField extraField in recordExtraFields)
|
||||||
{
|
{
|
||||||
extraField.IsRequired = templateExtraFields.Where(x => x.Name == extraField.Name).First().IsRequired;
|
extraField.IsRequired = templateExtraFields.Where(x => x.Name == extraField.Name).First().IsRequired;
|
||||||
}
|
}
|
||||||
|
//append extra fields
|
||||||
|
foreach(ExtraField extraField in templateExtraFields)
|
||||||
|
{
|
||||||
|
if (!recordFieldNames.Contains(extraField.Name))
|
||||||
|
{
|
||||||
|
recordExtraFields.Add(extraField);
|
||||||
|
}
|
||||||
|
}
|
||||||
return recordExtraFields;
|
return recordExtraFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
public bool MissedFuelUp { get; set; }
|
public bool MissedFuelUp { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public List<string> Tags { get; set; } = new List<string>();
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
|
public List<ExtraField> ExtraFields { get; set; } = new List<ExtraField>();
|
||||||
public bool IncludeInAverage { get { return MilesPerGallon > 0 || (!IsFillToFull && !MissedFuelUp); } }
|
public bool IncludeInAverage { get { return MilesPerGallon > 0 || (!IsFillToFull && !MissedFuelUp); } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
public bool EnableAutoReminderRefresh { get; set; }
|
public bool EnableAutoReminderRefresh { get; set; }
|
||||||
public bool EnableAutoOdometerInsert { get; set; }
|
public bool EnableAutoOdometerInsert { get; set; }
|
||||||
public bool EnableShopSupplies { get; set; }
|
public bool EnableShopSupplies { get; set; }
|
||||||
|
public bool EnableExtraFieldColumns { get; set; }
|
||||||
public string PreferredGasUnit { get; set; } = string.Empty;
|
public string PreferredGasUnit { get; set; } = string.Empty;
|
||||||
public string PreferredGasMileageUnit { get; set; } = string.Empty;
|
public string PreferredGasMileageUnit { get; set; } = string.Empty;
|
||||||
public string UserNameHash { get; set; }
|
public string UserNameHash { get; set; }
|
||||||
|
|||||||
@@ -53,6 +53,10 @@
|
|||||||
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="enableAutoOdometerInsert" checked="@Model.UserConfig.EnableAutoOdometerInsert">
|
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="enableAutoOdometerInsert" checked="@Model.UserConfig.EnableAutoOdometerInsert">
|
||||||
<label class="form-check-label" for="enableAutoOdometerInsert">@translator.Translate(userLanguage, "Auto Insert Odometer Records")<br /><small class="text-body-secondary">@translator.Translate(userLanguage, "Only when Adding Service/Repair/Upgrade/Fuel Record or Completing a Plan")</small></label>
|
<label class="form-check-label" for="enableAutoOdometerInsert">@translator.Translate(userLanguage, "Auto Insert Odometer Records")<br /><small class="text-body-secondary">@translator.Translate(userLanguage, "Only when Adding Service/Repair/Upgrade/Fuel Record or Completing a Plan")</small></label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="enableExtraFieldColumns" checked="@Model.UserConfig.EnableExtraFieldColumns">
|
||||||
|
<label class="form-check-label" for="enableExtraFieldColumns">@translator.Translate(userLanguage, "Show Extra Field Columns")<br /><small class="text-body-secondary">@translator.Translate(userLanguage, "Enabling this may cause performance issues")</small></label>
|
||||||
|
</div>
|
||||||
<div class="form-check form-switch @(User.IsInRole(nameof(UserData.IsRootUser)) ? "" : "d-none")">
|
<div class="form-check form-switch @(User.IsInRole(nameof(UserData.IsRootUser)) ? "" : "d-none")">
|
||||||
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="enableShopSupplies" checked="@Model.UserConfig.EnableShopSupplies">
|
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="enableShopSupplies" checked="@Model.UserConfig.EnableShopSupplies">
|
||||||
<label class="form-check-label" for="enableShopSupplies">@translator.Translate(userLanguage, "Shop Supplies")</label>
|
<label class="form-check-label" for="enableShopSupplies">@translator.Translate(userLanguage, "Shop Supplies")</label>
|
||||||
@@ -287,6 +291,7 @@
|
|||||||
enableAutoReminderRefresh: $("#enableAutoReminderRefresh").is(":checked"),
|
enableAutoReminderRefresh: $("#enableAutoReminderRefresh").is(":checked"),
|
||||||
enableAutoOdometerInsert: $("#enableAutoOdometerInsert").is(":checked"),
|
enableAutoOdometerInsert: $("#enableAutoOdometerInsert").is(":checked"),
|
||||||
enableShopSupplies: $("#enableShopSupplies").is(":checked"),
|
enableShopSupplies: $("#enableShopSupplies").is(":checked"),
|
||||||
|
enableExtraFieldColumns: $("#enableExtraFieldColumns").is(":checked"),
|
||||||
preferredGasUnit: $("#preferredGasUnit").val(),
|
preferredGasUnit: $("#preferredGasUnit").val(),
|
||||||
preferredGasMileageUnit: $("#preferredFuelMileageUnit").val(),
|
preferredGasMileageUnit: $("#preferredFuelMileageUnit").val(),
|
||||||
userLanguage: $("#defaultLanguage").val(),
|
userLanguage: $("#defaultLanguage").val(),
|
||||||
|
|||||||
@@ -7,6 +7,11 @@
|
|||||||
var hideZero = userConfig.HideZero;
|
var hideZero = userConfig.HideZero;
|
||||||
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
||||||
var userLanguage = userConfig.UserLanguage;
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
var extraFields = new List<string>();
|
||||||
|
if (userConfig.EnableExtraFieldColumns)
|
||||||
|
{
|
||||||
|
extraFields = Model.SelectMany(x => x.ExtraFields).Select(y => y.Name).Distinct().ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@model List<CollisionRecord>
|
@model List<CollisionRecord>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -38,6 +43,48 @@
|
|||||||
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('RepairRecord')">@translator.Translate(userLanguage,"Export to CSV")</a></li>
|
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('RepairRecord')">@translator.Translate(userLanguage,"Export to CSV")</a></li>
|
||||||
<li><hr class="dropdown-divider"></li>
|
<li><hr class="dropdown-divider"></li>
|
||||||
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage,"Print")</a></li>
|
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage,"Print")</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><h6 class="dropdown-header">@translator.Translate(userLanguage, "Visible Columns")</h6></li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='date' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Date" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Date">@translator.Translate(userLanguage, "Date")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='odometer' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Odometer" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Odometer">@translator.Translate(userLanguage, "Odometer")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='description' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Description" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Description">@translator.Translate(userLanguage, "Description")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='cost' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Cost" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Cost">@translator.Translate(userLanguage, "Cost")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='notes' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Notes" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Notes">@translator.Translate(userLanguage, "Notes")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
var elementId = Guid.NewGuid();
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" onChange="showTableColumns(this, true)" type="checkbox" id="@elementId">
|
||||||
|
<label class="form-check-label stretched-link" for="@elementId">@extraFieldColumn</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -58,22 +105,30 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-2 col-xl-1">@translator.Translate(userLanguage,"Date")</th>
|
<th scope="col" class="col-2 col-xl-1" data-column="date">@translator.Translate(userLanguage, "Date")</th>
|
||||||
<th scope="col" class="col-2">@translator.Translate(userLanguage,"Odometer")</th>
|
<th scope="col" class="col-2" data-column="odometer">@translator.Translate(userLanguage, "Odometer")</th>
|
||||||
<th scope="col" class="col-3 col-xl-4">@translator.Translate(userLanguage,"Description")</th>
|
<th scope="col" class="col-3 col-xl-4" data-column="description">@translator.Translate(userLanguage, "Description")</th>
|
||||||
<th scope="col" class="col-2" onclick="toggleSort('accident-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage,"Cost")</th>
|
<th scope="col" class="col-2" data-column="cost" onclick="toggleSort('accident-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Cost")</th>
|
||||||
<th scope="col" class="col-3">@translator.Translate(userLanguage,"Notes")</th>
|
<th scope="col" class="col-3" data-column="notes">@translator.Translate(userLanguage, "Notes")</th>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
<th scope="col" style='display:none;' class="col-2" data-column="@extraFieldColumn">@extraFieldColumn</th>
|
||||||
|
}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (CollisionRecord collisionRecord in Model)
|
@foreach (CollisionRecord collisionRecord in Model)
|
||||||
{
|
{
|
||||||
<tr class="d-flex user-select-none" style="cursor:pointer;" onmouseup="stopEvent()" ontouchstart="detectRowLongTouch(this)" ontouchend="detectRowTouchEndPremature(this)" data-rowId="@collisionRecord.Id" oncontextmenu="showTableContextMenu(this)" onmousemove="rangeMouseMove(this)" onclick="handleTableRowClick(this, showEditCollisionRecordModal,@collisionRecord.Id)" data-tags='@string.Join(" ", collisionRecord.Tags)'>
|
<tr class="d-flex user-select-none" style="cursor:pointer;" onmouseup="stopEvent()" ontouchstart="detectRowLongTouch(this)" ontouchend="detectRowTouchEndPremature(this)" data-rowId="@collisionRecord.Id" oncontextmenu="showTableContextMenu(this)" onmousemove="rangeMouseMove(this)" onclick="handleTableRowClick(this, showEditCollisionRecordModal,@collisionRecord.Id)" data-tags='@string.Join(" ", collisionRecord.Tags)'>
|
||||||
<td class="col-2 col-xl-1">@collisionRecord.Date.ToShortDateString()</td>
|
<td class="col-2 col-xl-1" data-column="date">@collisionRecord.Date.ToShortDateString()</td>
|
||||||
<td class="col-2">@collisionRecord.Mileage</td>
|
<td class="col-2" data-column="odometer">@collisionRecord.Mileage</td>
|
||||||
<td class="col-3 col-xl-4">@collisionRecord.Description</td>
|
<td class="col-3 col-xl-4" data-column="description">@collisionRecord.Description</td>
|
||||||
<td class="col-2" data-record-type="cost">@((hideZero && collisionRecord.Cost == default) ? "---" : collisionRecord.Cost.ToString("C"))</td>
|
<td class="col-2" data-column="cost" data-record-type="cost">@((hideZero && collisionRecord.Cost == default) ? "---" : collisionRecord.Cost.ToString("C"))</td>
|
||||||
<td class="col-3 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(collisionRecord.Notes)</td>
|
<td class="col-3 text-truncate" data-column="notes">@CarCareTracker.Helper.StaticHelper.TruncateStrings(collisionRecord.Notes)</td>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
<td class="col-2 text-truncate" style='display:none;' data-column="@extraFieldColumn">@(collisionRecord.ExtraFields.Where(x => x.Name == extraFieldColumn)?.FirstOrDefault()?.Value ?? "")</td>
|
||||||
|
}
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -29,7 +29,8 @@
|
|||||||
{
|
{
|
||||||
consumptionUnit = "imp gal";
|
consumptionUnit = "imp gal";
|
||||||
fuelEconomyUnit = useHours ? "h/g" : "mpg";
|
fuelEconomyUnit = useHours ? "h/g" : "mpg";
|
||||||
} else if (useUKMPG)
|
}
|
||||||
|
else if (useUKMPG)
|
||||||
{
|
{
|
||||||
fuelEconomyUnit = useHours ? "l/100h" : "l/100mi.";
|
fuelEconomyUnit = useHours ? "l/100h" : "l/100mi.";
|
||||||
consumptionUnit = "l";
|
consumptionUnit = "l";
|
||||||
@@ -40,6 +41,11 @@
|
|||||||
consumptionUnit = useMPG ? "US gal" : "l";
|
consumptionUnit = useMPG ? "US gal" : "l";
|
||||||
fuelEconomyUnit = useHours ? (useMPG ? "h/g" : "l/100h") : (useMPG ? "mpg" : "l/100km");
|
fuelEconomyUnit = useHours ? (useMPG ? "h/g" : "l/100h") : (useMPG ? "mpg" : "l/100km");
|
||||||
}
|
}
|
||||||
|
var extraFields = new List<string>();
|
||||||
|
if (userConfig.EnableExtraFieldColumns)
|
||||||
|
{
|
||||||
|
extraFields = Model.GasRecords.SelectMany(x => x.ExtraFields).Select(y => y.Name).Distinct().ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
@@ -52,7 +58,8 @@
|
|||||||
{
|
{
|
||||||
<span class="ms-2 badge bg-primary" id="minFuelMileageLabel">@($"{translator.Translate(userLanguage, "Min Fuel Economy")}: {Model.GasRecords.Where(y => y.MilesPerGallon > 0)?.Min(x => x.MilesPerGallon).ToString("F") ?? "0"}")</span>
|
<span class="ms-2 badge bg-primary" id="minFuelMileageLabel">@($"{translator.Translate(userLanguage, "Min Fuel Economy")}: {Model.GasRecords.Where(y => y.MilesPerGallon > 0)?.Min(x => x.MilesPerGallon).ToString("F") ?? "0"}")</span>
|
||||||
<span class="ms-2 badge bg-primary" id="maxFuelMileageLabel">@($"{translator.Translate(userLanguage, "Max Fuel Economy")}: {Model.GasRecords.Max(x => x.MilesPerGallon).ToString("F") ?? "0"}")</span>
|
<span class="ms-2 badge bg-primary" id="maxFuelMileageLabel">@($"{translator.Translate(userLanguage, "Max Fuel Economy")}: {Model.GasRecords.Max(x => x.MilesPerGallon).ToString("F") ?? "0"}")</span>
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
<span class="ms-2 badge bg-primary" id="minFuelMileageLabel">@($"{translator.Translate(userLanguage, "Min Fuel Economy")}: {Model.GasRecords.Max(x => x.MilesPerGallon).ToString("F") ?? "0"}")</span>
|
<span class="ms-2 badge bg-primary" id="minFuelMileageLabel">@($"{translator.Translate(userLanguage, "Min Fuel Economy")}: {Model.GasRecords.Max(x => x.MilesPerGallon).ToString("F") ?? "0"}")</span>
|
||||||
<span class="ms-2 badge bg-primary" id="maxFuelMileageLabel">@($"{translator.Translate(userLanguage, "Max Fuel Economy")}: {Model.GasRecords.Where(y => y.MilesPerGallon > 0)?.Min(x => x.MilesPerGallon).ToString("F") ?? "0"}")</span>
|
<span class="ms-2 badge bg-primary" id="maxFuelMileageLabel">@($"{translator.Translate(userLanguage, "Max Fuel Economy")}: {Model.GasRecords.Where(y => y.MilesPerGallon > 0)?.Min(x => x.MilesPerGallon).ToString("F") ?? "0"}")</span>
|
||||||
@@ -83,9 +90,65 @@
|
|||||||
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('GasRecord')">@translator.Translate(userLanguage, "Export to CSV")</a></li>
|
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('GasRecord')">@translator.Translate(userLanguage, "Export to CSV")</a></li>
|
||||||
<li><hr class="dropdown-divider"></li>
|
<li><hr class="dropdown-divider"></li>
|
||||||
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage, "Print")</a></li>
|
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage, "Print")</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><h6 class="dropdown-header">@translator.Translate(userLanguage, "Visible Columns")</h6></li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='daterefueled' onChange="showTableColumns(this)" type="checkbox" id="chkCol_DateRefueled" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_DateRefueled">@translator.Translate(userLanguage, "Date Refueled")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='odometer' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Odometer" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Odometer">@translator.Translate(userLanguage, "Odometer")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='delta' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Delta" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Delta">@translator.Translate(userLanguage, "Delta")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='consumption' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Consumption" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Consumption">@translator.Translate(userLanguage, "Consumption")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='fueleconomy' onChange="showTableColumns(this)" type="checkbox" id="chkCol_FuelEconomy" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_FuelEconomy">@translator.Translate(userLanguage, "Fuel Economy")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='cost' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Cost" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Cost">@translator.Translate(userLanguage, "Cost")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='unitcost' onChange="showTableColumns(this)" type="checkbox" id="chkCol_UnitCost" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_UnitCost">@translator.Translate(userLanguage, "Unit Cost")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
var elementId = Guid.NewGuid();
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" onChange="showTableColumns(this, true)" type="checkbox" id="@elementId">
|
||||||
|
<label class="form-check-label stretched-link" for="@elementId">@extraFieldColumn</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
<button onclick="showAddGasRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage, "Add Gas Record")</button>
|
<button onclick="showAddGasRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage, "Add Gas Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -100,26 +163,34 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-2">@translator.Translate(userLanguage,"Date Refueled")</th>
|
<th scope="col" class="col-2" data-column="daterefueled">@translator.Translate(userLanguage, "Date Refueled")</th>
|
||||||
<th scope="col" class="col-2">@($"{translator.Translate(userLanguage, "Odometer")}({distanceUnit})")</th>
|
<th scope="col" class="col-2" data-column="odometer">@($"{translator.Translate(userLanguage, "Odometer")}({distanceUnit})")</th>
|
||||||
<th scope="col" class="col-1" style="cursor:pointer;" onclick="toggleSort('gas-tab-pane', this)">@($"Δ({distanceUnit})")</th>
|
<th scope="col" class="col-1" data-column="delta" style="cursor:pointer;" onclick="toggleSort('gas-tab-pane', this)">@($"Δ({distanceUnit})")</th>
|
||||||
<th scope="col" class="col-2" data-gas="consumption" data-unit="@consumptionUnit" onclick="toggleSort('gas-tab-pane', this)" oncontextmenu="toggleUnits(this)" style="cursor:pointer;">@($"{translator.Translate(userLanguage,"Consumption")}({consumptionUnit})")</th>
|
<th scope="col" class="col-2" data-column="consumption" data-gas="consumption" data-unit="@consumptionUnit" onclick="toggleSort('gas-tab-pane', this)" oncontextmenu="toggleUnits(this)" style="cursor:pointer;">@($"{translator.Translate(userLanguage, "Consumption")}({consumptionUnit})")</th>
|
||||||
<th scope="col" class="col-3" data-gas="fueleconomy" data-unit="@fuelEconomyUnit" onclick="toggleSort('gas-tab-pane', this)" oncontextmenu="toggleUnits(this)" style="cursor:pointer;">@($"{@translator.Translate(userLanguage,"Fuel Economy")}({fuelEconomyUnit})")</th>
|
<th scope="col" class="col-3" data-column="fueleconomy" data-gas="fueleconomy" data-unit="@fuelEconomyUnit" onclick="toggleSort('gas-tab-pane', this)" oncontextmenu="toggleUnits(this)" style="cursor:pointer;">@($"{@translator.Translate(userLanguage, "Fuel Economy")}({fuelEconomyUnit})")</th>
|
||||||
<th scope="col" class="col-1" onclick="toggleSort('gas-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage,"Cost")</th>
|
<th scope="col" class="col-1" data-column="cost" onclick="toggleSort('gas-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Cost")</th>
|
||||||
<th scope="col" class="col-1" onclick="toggleSort('gas-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage,"Unit Cost")</th>
|
<th scope="col" class="col-1" data-column="unitcost" onclick="toggleSort('gas-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Unit Cost")</th>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
<th scope="col" style='display:none;' class="col-2" data-column="@extraFieldColumn">@extraFieldColumn</th>
|
||||||
|
}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (GasRecordViewModel gasRecord in Model.GasRecords)
|
@foreach (GasRecordViewModel gasRecord in Model.GasRecords)
|
||||||
{
|
{
|
||||||
<tr class="d-flex user-select-none" style="cursor:pointer;" onmouseup="stopEvent()" ontouchstart="detectRowLongTouch(this)" ontouchend="detectRowTouchEndPremature(this)" data-rowId="@gasRecord.Id" oncontextmenu="showTableContextMenu(this)" onmousemove="rangeMouseMove(this)" onclick="handleTableRowClick(this, showEditGasRecordModal,@gasRecord.Id)" data-tags='@string.Join(" ", gasRecord.Tags)'>
|
<tr class="d-flex user-select-none" style="cursor:pointer;" onmouseup="stopEvent()" ontouchstart="detectRowLongTouch(this)" ontouchend="detectRowTouchEndPremature(this)" data-rowId="@gasRecord.Id" oncontextmenu="showTableContextMenu(this)" onmousemove="rangeMouseMove(this)" onclick="handleTableRowClick(this, showEditGasRecordModal,@gasRecord.Id)" data-tags='@string.Join(" ", gasRecord.Tags)'>
|
||||||
<td class="col-2">@gasRecord.Date</td>
|
<td class="col-2" data-column="daterefueled">@gasRecord.Date</td>
|
||||||
<td class="col-2" data-gas-type="mileage" data-gas-aggregate="@gasRecord.DeltaMileage" data-gas-original="@gasRecord.Mileage">@gasRecord.Mileage</td>
|
<td class="col-2" data-column="odometer" data-gas-type="mileage" data-gas-aggregate="@gasRecord.DeltaMileage" data-gas-original="@gasRecord.Mileage">@gasRecord.Mileage</td>
|
||||||
<td class="col-1">@(gasRecord.DeltaMileage == default ? "---" : gasRecord.DeltaMileage)</td>
|
<td class="col-1" data-column="delta">@(gasRecord.DeltaMileage == default ? "---" : gasRecord.DeltaMileage)</td>
|
||||||
<td class="col-2" data-gas-type="consumption" data-gas-aggregate="@gasRecord.Gallons">@gasRecord.Gallons.ToString("F")</td>
|
<td class="col-2" data-column="consumption" data-gas-type="consumption" data-gas-aggregate="@gasRecord.Gallons">@gasRecord.Gallons.ToString("F")</td>
|
||||||
<td class="col-3" data-gas-type="fueleconomy" data-aggregated='@(gasRecord.IncludeInAverage.ToString().ToLower())'>@(gasRecord.MilesPerGallon == 0 ? "---" : gasRecord.MilesPerGallon.ToString("F"))</td>
|
<td class="col-3" data-column="fueleconomy" data-gas-type="fueleconomy" data-aggregated='@(gasRecord.IncludeInAverage.ToString().ToLower())'>@(gasRecord.MilesPerGallon == 0 ? "---" : gasRecord.MilesPerGallon.ToString("F"))</td>
|
||||||
<td class="col-1" data-record-type="cost">@((hideZero && gasRecord.Cost == default) ? "---" : gasRecord.Cost.ToString(gasCostFormat))</td>
|
<td class="col-1" data-column="cost" data-record-type="cost">@((hideZero && gasRecord.Cost == default) ? "---" : gasRecord.Cost.ToString(gasCostFormat))</td>
|
||||||
<td class="col-1" data-gas-type="unitcost">@((hideZero && gasRecord.CostPerGallon == default) ? "---" : gasRecord.CostPerGallon.ToString(gasCostFormat))</td>
|
<td class="col-1" data-column="unitcost" data-gas-type="unitcost">@((hideZero && gasRecord.CostPerGallon == default) ? "---" : gasRecord.CostPerGallon.ToString(gasCostFormat))</td>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
<td class="col-2 text-truncate" style='display:none;' data-column="@extraFieldColumn">@(gasRecord.ExtraFields.Where(x => x.Name == extraFieldColumn)?.FirstOrDefault()?.Value ?? "")</td>
|
||||||
|
}
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -131,7 +202,6 @@
|
|||||||
<div class="modal fade" data-bs-focus="false" id="gasRecordModal" tabindex="-1" role="dialog" aria-hidden="true">
|
<div class="modal fade" data-bs-focus="false" id="gasRecordModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
<div class="modal-dialog modal-lg" role="document">
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
<div class="modal-content" id="gasRecordModalContent">
|
<div class="modal-content" id="gasRecordModalContent">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,6 +7,11 @@
|
|||||||
var hideZero = userConfig.HideZero;
|
var hideZero = userConfig.HideZero;
|
||||||
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
||||||
var userLanguage = userConfig.UserLanguage;
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
var extraFields = new List<string>();
|
||||||
|
if (userConfig.EnableExtraFieldColumns)
|
||||||
|
{
|
||||||
|
extraFields = Model.SelectMany(x => x.ExtraFields).Select(y => y.Name).Distinct().ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@model List<OdometerRecord>
|
@model List<OdometerRecord>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -37,6 +42,36 @@
|
|||||||
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('OdometerRecord')">@translator.Translate(userLanguage, "Export to CSV")</a></li>
|
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('OdometerRecord')">@translator.Translate(userLanguage, "Export to CSV")</a></li>
|
||||||
<li><hr class="dropdown-divider"></li>
|
<li><hr class="dropdown-divider"></li>
|
||||||
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage, "Print")</a></li>
|
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage, "Print")</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><h6 class="dropdown-header">@translator.Translate(userLanguage, "Visible Columns")</h6></li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='date' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Date" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Date">@translator.Translate(userLanguage, "Date")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='odometer' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Odometer" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Odometer">@translator.Translate(userLanguage, "Odometer")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='notes' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Notes" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Notes">@translator.Translate(userLanguage, "Notes")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
var elementId = Guid.NewGuid();
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" onChange="showTableColumns(this, true)" type="checkbox" id="@elementId">
|
||||||
|
<label class="form-check-label stretched-link" for="@elementId">@extraFieldColumn</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -57,18 +92,26 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-2 col-xl-1">@translator.Translate(userLanguage, "Date")</th>
|
<th scope="col" class="col-2 col-xl-1" data-column="date">@translator.Translate(userLanguage, "Date")</th>
|
||||||
<th scope="col" class="col-3">@translator.Translate(userLanguage, "Odometer")</th>
|
<th scope="col" class="col-3" data-column="odometer">@translator.Translate(userLanguage, "Odometer")</th>
|
||||||
<th scope="col" class="col-7 col-xl-8">@translator.Translate(userLanguage, "Notes")</th>
|
<th scope="col" class="col-7 col-xl-8" data-column="notes">@translator.Translate(userLanguage, "Notes")</th>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
<th scope="col" style='display:none;' class="col-2" data-column="@extraFieldColumn">@extraFieldColumn</th>
|
||||||
|
}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (OdometerRecord odometerRecord in Model)
|
@foreach (OdometerRecord odometerRecord in Model)
|
||||||
{
|
{
|
||||||
<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">@odometerRecord.Date.ToShortDateString()</td>
|
<td class="col-2 col-xl-1" data-column="date">@odometerRecord.Date.ToShortDateString()</td>
|
||||||
<td class="col-3" data-record-type="cost">@odometerRecord.Mileage</td>
|
<td class="col-3" data-column="odometer" data-record-type="cost">@odometerRecord.Mileage</td>
|
||||||
<td class="col-7 col-xl-8 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(odometerRecord.Notes, 75)</td>
|
<td class="col-7 col-xl-8 text-truncate" data-column="notes">@CarCareTracker.Helper.StaticHelper.TruncateStrings(odometerRecord.Notes, 75)</td>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
<td class="col-2 text-truncate" style='display:none;' data-column="@extraFieldColumn">@(odometerRecord.ExtraFields.Where(x => x.Name == extraFieldColumn)?.FirstOrDefault()?.Value ?? "")</td>
|
||||||
|
}
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -7,6 +7,11 @@
|
|||||||
var hideZero = userConfig.HideZero;
|
var hideZero = userConfig.HideZero;
|
||||||
var userLanguage = userConfig.UserLanguage;
|
var userLanguage = userConfig.UserLanguage;
|
||||||
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
||||||
|
var extraFields = new List<string>();
|
||||||
|
if (userConfig.EnableExtraFieldColumns)
|
||||||
|
{
|
||||||
|
extraFields = Model.SelectMany(x => x.ExtraFields).Select(y => y.Name).Distinct().ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@model List<ServiceRecord>
|
@model List<ServiceRecord>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -38,6 +43,48 @@
|
|||||||
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('ServiceRecord')">@translator.Translate(userLanguage, "Export to CSV")</a></li>
|
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('ServiceRecord')">@translator.Translate(userLanguage, "Export to CSV")</a></li>
|
||||||
<li><hr class="dropdown-divider"></li>
|
<li><hr class="dropdown-divider"></li>
|
||||||
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage, "Print")</a></li>
|
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage, "Print")</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><h6 class="dropdown-header">@translator.Translate(userLanguage, "Visible Columns")</h6></li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='date' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Date" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Date">@translator.Translate(userLanguage, "Date")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='odometer' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Odometer" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Odometer">@translator.Translate(userLanguage, "Odometer")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='description' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Description" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Description">@translator.Translate(userLanguage, "Description")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='cost' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Cost" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Cost">@translator.Translate(userLanguage, "Cost")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='notes' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Notes" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Notes">@translator.Translate(userLanguage, "Notes")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
var elementId = Guid.NewGuid();
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" onChange="showTableColumns(this, true)" type="checkbox" id="@elementId">
|
||||||
|
<label class="form-check-label stretched-link" for="@elementId">@extraFieldColumn</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -58,22 +105,30 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-2 col-xl-1">@translator.Translate(userLanguage,"Date")</th>
|
<th scope="col" class="col-2 col-xl-1" data-column="date">@translator.Translate(userLanguage, "Date")</th>
|
||||||
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Odometer")</th>
|
<th scope="col" class="col-2" data-column="odometer">@translator.Translate(userLanguage, "Odometer")</th>
|
||||||
<th scope="col" class="col-3 col-xl-4">@translator.Translate(userLanguage, "Description")</th>
|
<th scope="col" class="col-3 col-xl-4" data-column="description">@translator.Translate(userLanguage, "Description")</th>
|
||||||
<th scope="col" class="col-2" onclick="toggleSort('servicerecord-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Cost")</th>
|
<th scope="col" class="col-2" data-column="cost" onclick="toggleSort('servicerecord-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Cost")</th>
|
||||||
<th scope="col" class="col-3">@translator.Translate(userLanguage, "Notes")</th>
|
<th scope="col" class="col-3" data-column="notes">@translator.Translate(userLanguage, "Notes")</th>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
<th scope="col" style='display:none;' class="col-2" data-column="@extraFieldColumn">@extraFieldColumn</th>
|
||||||
|
}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (ServiceRecord serviceRecord in Model)
|
@foreach (ServiceRecord serviceRecord in Model)
|
||||||
{
|
{
|
||||||
<tr class="d-flex user-select-none" style="cursor:pointer;" onmouseup="stopEvent()" ontouchstart="detectRowLongTouch(this)" ontouchend="detectRowTouchEndPremature(this)" data-rowId="@serviceRecord.Id" oncontextmenu="showTableContextMenu(this)" onmousemove="rangeMouseMove(this)" onclick="handleTableRowClick(this, showEditServiceRecordModal,@serviceRecord.Id)" data-tags='@string.Join(" ", serviceRecord.Tags)'>
|
<tr class="d-flex user-select-none" style="cursor:pointer;" onmouseup="stopEvent()" ontouchstart="detectRowLongTouch(this)" ontouchend="detectRowTouchEndPremature(this)" data-rowId="@serviceRecord.Id" oncontextmenu="showTableContextMenu(this)" onmousemove="rangeMouseMove(this)" onclick="handleTableRowClick(this, showEditServiceRecordModal,@serviceRecord.Id)" data-tags='@string.Join(" ", serviceRecord.Tags)'>
|
||||||
<td class="col-2 col-xl-1">@serviceRecord.Date.ToShortDateString()</td>
|
<td class="col-2 col-xl-1" data-column="date">@serviceRecord.Date.ToShortDateString()</td>
|
||||||
<td class="col-2">@serviceRecord.Mileage</td>
|
<td class="col-2" data-column="odometer">@serviceRecord.Mileage</td>
|
||||||
<td class="col-3 col-xl-4">@serviceRecord.Description</td>
|
<td class="col-3 col-xl-4" data-column="description">@serviceRecord.Description</td>
|
||||||
<td class="col-2" data-record-type="cost">@((hideZero && serviceRecord.Cost == default) ? "---" : serviceRecord.Cost.ToString("C"))</td>
|
<td class="col-2" data-column="cost" data-record-type="cost">@((hideZero && serviceRecord.Cost == default) ? "---" : serviceRecord.Cost.ToString("C"))</td>
|
||||||
<td class="col-3 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(serviceRecord.Notes)</td>
|
<td class="col-3 text-truncate" data-column="notes">@CarCareTracker.Helper.StaticHelper.TruncateStrings(serviceRecord.Notes)</td>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
<td class="col-2 text-truncate" style='display:none;' data-column="@extraFieldColumn">@(serviceRecord.ExtraFields.Where(x => x.Name == extraFieldColumn)?.FirstOrDefault()?.Value ?? "")</td>
|
||||||
|
}
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -85,7 +140,6 @@
|
|||||||
<div class="modal fade" data-bs-focus="false" id="serviceRecordModal" tabindex="-1" role="dialog" aria-hidden="true">
|
<div class="modal fade" data-bs-focus="false" id="serviceRecordModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
<div class="modal-dialog modal-lg" role="document">
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
<div class="modal-content" id="serviceRecordModalContent">
|
<div class="modal-content" id="serviceRecordModalContent">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,6 +7,11 @@
|
|||||||
var enableCsvImports = userConfig.EnableCsvImports;
|
var enableCsvImports = userConfig.EnableCsvImports;
|
||||||
var hideZero = userConfig.HideZero;
|
var hideZero = userConfig.HideZero;
|
||||||
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
||||||
|
var extraFields = new List<string>();
|
||||||
|
if (userConfig.EnableExtraFieldColumns)
|
||||||
|
{
|
||||||
|
extraFields = Model.SelectMany(x => x.ExtraFields).Select(y => y.Name).Distinct().ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@model List<SupplyRecord>
|
@model List<SupplyRecord>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -38,6 +43,60 @@
|
|||||||
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('SupplyRecord')">@translator.Translate(userLanguage,"Export to CSV")</a></li>
|
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('SupplyRecord')">@translator.Translate(userLanguage,"Export to CSV")</a></li>
|
||||||
<li><hr class="dropdown-divider"></li>
|
<li><hr class="dropdown-divider"></li>
|
||||||
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage,"Print")</a></li>
|
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage,"Print")</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><h6 class="dropdown-header">@translator.Translate(userLanguage, "Visible Columns")</h6></li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='date' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Date" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Date">@translator.Translate(userLanguage, "Date")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='partnumber' onChange="showTableColumns(this)" type="checkbox" id="chkCol_PartNumber" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_PartNumber">@translator.Translate(userLanguage, "Part Number")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='supplier' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Supplier" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Supplier">@translator.Translate(userLanguage, "Supplier")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='description' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Description" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Description">@translator.Translate(userLanguage, "Description")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='quantity' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Quantity" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Quantity">@translator.Translate(userLanguage, "Quantity")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='cost' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Cost" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Cost">@translator.Translate(userLanguage, "Cost")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='notes' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Notes" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Notes">@translator.Translate(userLanguage, "Notes")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
var elementId = Guid.NewGuid();
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" onChange="showTableColumns(this, true)" type="checkbox" id="@elementId">
|
||||||
|
<label class="form-check-label stretched-link" for="@elementId">@extraFieldColumn</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -58,26 +117,34 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-2 col-xl-1">@translator.Translate(userLanguage,"Date")</th>
|
<th scope="col" class="col-2 col-xl-1" data-column="date">@translator.Translate(userLanguage, "Date")</th>
|
||||||
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Part #")</th>
|
<th scope="col" class="col-2" data-column="partnumber">@translator.Translate(userLanguage, "Part #")</th>
|
||||||
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Supplier")</th>
|
<th scope="col" class="col-2" data-column="supplier">@translator.Translate(userLanguage, "Supplier")</th>
|
||||||
<th scope="col" class="col-2 col-xl-3">@translator.Translate(userLanguage, "Description")</th>
|
<th scope="col" class="col-2 col-xl-3" data-column="description">@translator.Translate(userLanguage, "Description")</th>
|
||||||
<th scope="col" class="col-1" onclick="toggleSort('supply-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Quantity")</th>
|
<th scope="col" class="col-1" data-column="quantity" onclick="toggleSort('supply-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Quantity")</th>
|
||||||
<th scope="col" class="col-1" onclick="toggleSort('supply-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Cost")</th>
|
<th scope="col" class="col-1" data-column="cost" onclick="toggleSort('supply-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Cost")</th>
|
||||||
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Notes")</th>
|
<th scope="col" class="col-2" data-column="notes">@translator.Translate(userLanguage, "Notes")</th>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
<th scope="col" style='display:none;' class="col-2" data-column="@extraFieldColumn">@extraFieldColumn</th>
|
||||||
|
}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (SupplyRecord supplyRecord in Model)
|
@foreach (SupplyRecord supplyRecord in Model)
|
||||||
{
|
{
|
||||||
<tr class="d-flex user-select-none" style="cursor:pointer;" onmouseup="stopEvent()" ontouchstart="detectRowLongTouch(this)" ontouchend="detectRowTouchEndPremature(this)" data-rowId="@supplyRecord.Id" oncontextmenu="showTableContextMenu(this)" onmousemove="rangeMouseMove(this)" onclick="handleTableRowClick(this, showEditSupplyRecordModal,@supplyRecord.Id)" data-tags='@string.Join(" ", supplyRecord.Tags)'>
|
<tr class="d-flex user-select-none" style="cursor:pointer;" onmouseup="stopEvent()" ontouchstart="detectRowLongTouch(this)" ontouchend="detectRowTouchEndPremature(this)" data-rowId="@supplyRecord.Id" oncontextmenu="showTableContextMenu(this)" onmousemove="rangeMouseMove(this)" onclick="handleTableRowClick(this, showEditSupplyRecordModal,@supplyRecord.Id)" data-tags='@string.Join(" ", supplyRecord.Tags)'>
|
||||||
<td class="col-2 col-xl-1">@supplyRecord.Date.ToShortDateString()</td>
|
<td class="col-2 col-xl-1" data-column="date">@supplyRecord.Date.ToShortDateString()</td>
|
||||||
<td class="col-2">@supplyRecord.PartNumber</td>
|
<td class="col-2" data-column="partnumber">@supplyRecord.PartNumber</td>
|
||||||
<td class="col-2">@supplyRecord.PartSupplier</td>
|
<td class="col-2" data-column="supplier">@supplyRecord.PartSupplier</td>
|
||||||
<td class="col-2 col-xl-3">@supplyRecord.Description</td>
|
<td class="col-2 col-xl-3" data-column="description">@supplyRecord.Description</td>
|
||||||
<td class="col-1">@supplyRecord.Quantity</td>
|
<td class="col-1" data-column="quantity">@supplyRecord.Quantity</td>
|
||||||
<td class="col-1" data-record-type="cost">@((hideZero && supplyRecord.Cost == default) ? "---" : supplyRecord.Cost.ToString("C"))</td>
|
<td class="col-1" data-column="cost" data-record-type="cost">@((hideZero && supplyRecord.Cost == default) ? "---" : supplyRecord.Cost.ToString("C"))</td>
|
||||||
<td class="col-2 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(supplyRecord.Notes)</td>
|
<td class="col-2 text-truncate" data-column="notes">@CarCareTracker.Helper.StaticHelper.TruncateStrings(supplyRecord.Notes)</td>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
<td class="col-2 text-truncate" style='display:none;' data-column="@extraFieldColumn">@(supplyRecord.ExtraFields.Where(x => x.Name == extraFieldColumn)?.FirstOrDefault()?.Value ?? "")</td>
|
||||||
|
}
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -7,6 +7,11 @@
|
|||||||
var enableCsvImports = userConfig.EnableCsvImports;
|
var enableCsvImports = userConfig.EnableCsvImports;
|
||||||
var hideZero = userConfig.HideZero;
|
var hideZero = userConfig.HideZero;
|
||||||
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
||||||
|
var extraFields = new List<string>();
|
||||||
|
if (userConfig.EnableExtraFieldColumns)
|
||||||
|
{
|
||||||
|
extraFields = Model.SelectMany(x => x.ExtraFields).Select(y => y.Name).Distinct().ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@model List<TaxRecord>
|
@model List<TaxRecord>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -38,6 +43,42 @@
|
|||||||
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('TaxRecord')">@translator.Translate(userLanguage, "Export to CSV")</a></li>
|
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('TaxRecord')">@translator.Translate(userLanguage, "Export to CSV")</a></li>
|
||||||
<li><hr class="dropdown-divider"></li>
|
<li><hr class="dropdown-divider"></li>
|
||||||
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage, "Print")</a></li>
|
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage, "Print")</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><h6 class="dropdown-header">@translator.Translate(userLanguage, "Visible Columns")</h6></li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='date' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Date" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Date">@translator.Translate(userLanguage, "Date")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='description' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Description" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Description">@translator.Translate(userLanguage, "Description")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='cost' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Cost" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Cost">@translator.Translate(userLanguage, "Cost")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='notes' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Notes" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Notes">@translator.Translate(userLanguage, "Notes")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
var elementId = Guid.NewGuid();
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" onChange="showTableColumns(this, true)" type="checkbox" id="@elementId">
|
||||||
|
<label class="form-check-label stretched-link" for="@elementId">@extraFieldColumn</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -58,20 +99,28 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-3 col-xl-1">@translator.Translate(userLanguage, "Date")</th>
|
<th scope="col" class="col-3 col-xl-1" data-column="date">@translator.Translate(userLanguage, "Date")</th>
|
||||||
<th scope="col" class="col-4 col-xl-6">@translator.Translate(userLanguage, "Description")</th>
|
<th scope="col" class="col-4 col-xl-6" data-column="description">@translator.Translate(userLanguage, "Description")</th>
|
||||||
<th scope="col" class="col-2" onclick="toggleSort('tax-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Cost")</th>
|
<th scope="col" class="col-2" data-column="cost" onclick="toggleSort('tax-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Cost")</th>
|
||||||
<th scope="col" class="col-3">@translator.Translate(userLanguage, "Notes")</th>
|
<th scope="col" class="col-3" data-column="notes">@translator.Translate(userLanguage, "Notes")</th>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
<th scope="col" style='display:none;' class="col-2" data-column="@extraFieldColumn">@extraFieldColumn</th>
|
||||||
|
}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (TaxRecord taxRecord in Model)
|
@foreach (TaxRecord taxRecord in Model)
|
||||||
{
|
{
|
||||||
<tr class="d-flex user-select-none" style="cursor:pointer;" onmouseup="stopEvent()" ontouchstart="detectRowLongTouch(this)" ontouchend="detectRowTouchEndPremature(this)" data-rowId="@taxRecord.Id" oncontextmenu="showTableContextMenu(this)" onmousemove="rangeMouseMove(this)" onclick="handleTableRowClick(this, showEditTaxRecordModal,@taxRecord.Id)" data-tags='@string.Join(" ", taxRecord.Tags)'>
|
<tr class="d-flex user-select-none" style="cursor:pointer;" onmouseup="stopEvent()" ontouchstart="detectRowLongTouch(this)" ontouchend="detectRowTouchEndPremature(this)" data-rowId="@taxRecord.Id" oncontextmenu="showTableContextMenu(this)" onmousemove="rangeMouseMove(this)" onclick="handleTableRowClick(this, showEditTaxRecordModal,@taxRecord.Id)" data-tags='@string.Join(" ", taxRecord.Tags)'>
|
||||||
<td class="col-3 col-xl-1">@taxRecord.Date.ToShortDateString()</td>
|
<td class="col-3 col-xl-1" data-column="date">@taxRecord.Date.ToShortDateString()</td>
|
||||||
<td class="col-4 col-xl-6">@taxRecord.Description</td>
|
<td class="col-4 col-xl-6" data-column="description">@taxRecord.Description</td>
|
||||||
<td class="col-2" data-record-type="cost">@((hideZero && taxRecord.Cost == default) ? "---" : taxRecord.Cost.ToString("C"))</td>
|
<td class="col-2" data-column="cost" data-record-type="cost">@((hideZero && taxRecord.Cost == default) ? "---" : taxRecord.Cost.ToString("C"))</td>
|
||||||
<td class="col-3 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(taxRecord.Notes)</td>
|
<td class="col-3 text-truncate" data-column="notes">@CarCareTracker.Helper.StaticHelper.TruncateStrings(taxRecord.Notes)</td>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
<td class="col-2 text-truncate" style='display:none;' data-column="@extraFieldColumn">@(taxRecord.ExtraFields.Where(x => x.Name == extraFieldColumn)?.FirstOrDefault()?.Value ?? "")</td>
|
||||||
|
}
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -7,6 +7,11 @@
|
|||||||
var enableCsvImports = userConfig.EnableCsvImports;
|
var enableCsvImports = userConfig.EnableCsvImports;
|
||||||
var hideZero = userConfig.HideZero;
|
var hideZero = userConfig.HideZero;
|
||||||
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
||||||
|
var extraFields = new List<string>();
|
||||||
|
if (userConfig.EnableExtraFieldColumns)
|
||||||
|
{
|
||||||
|
extraFields = Model.SelectMany(x => x.ExtraFields).Select(y => y.Name).Distinct().ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@model List<UpgradeRecord>
|
@model List<UpgradeRecord>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -38,6 +43,48 @@
|
|||||||
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('UpgradeRecord')">@translator.Translate(userLanguage, "Export to CSV")</a></li>
|
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('UpgradeRecord')">@translator.Translate(userLanguage, "Export to CSV")</a></li>
|
||||||
<li><hr class="dropdown-divider"></li>
|
<li><hr class="dropdown-divider"></li>
|
||||||
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage, "Print")</a></li>
|
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage, "Print")</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><h6 class="dropdown-header">@translator.Translate(userLanguage, "Visible Columns")</h6></li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='date' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Date" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Date">@translator.Translate(userLanguage, "Date")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='odometer' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Odometer" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Odometer">@translator.Translate(userLanguage, "Odometer")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='description' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Description" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Description">@translator.Translate(userLanguage, "Description")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='cost' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Cost" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Cost">@translator.Translate(userLanguage, "Cost")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" data-column-toggle='notes' onChange="showTableColumns(this)" type="checkbox" id="chkCol_Notes" checked>
|
||||||
|
<label class="form-check-label stretched-link" for="chkCol_Notes">@translator.Translate(userLanguage, "Notes")</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
var elementId = Guid.NewGuid();
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<input class="form-check-input" onChange="showTableColumns(this, true)" type="checkbox" id="@elementId">
|
||||||
|
<label class="form-check-label stretched-link" for="@elementId">@extraFieldColumn</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -58,22 +105,30 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-2 col-xl-1">@translator.Translate(userLanguage, "Date")</th>
|
<th scope="col" class="col-2 col-xl-1" data-column="date">@translator.Translate(userLanguage, "Date")</th>
|
||||||
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Odometer")</th>
|
<th scope="col" class="col-2" data-column="odometer">@translator.Translate(userLanguage, "Odometer")</th>
|
||||||
<th scope="col" class="col-3 col-xl-4">@translator.Translate(userLanguage, "Description")</th>
|
<th scope="col" class="col-3 col-xl-4" data-column="description">@translator.Translate(userLanguage, "Description")</th>
|
||||||
<th scope="col" class="col-2" onclick="toggleSort('upgrade-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Cost")</th>
|
<th scope="col" class="col-2" data-column="cost" onclick="toggleSort('upgrade-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Cost")</th>
|
||||||
<th scope="col" class="col-3">@translator.Translate(userLanguage, "Notes")</th>
|
<th scope="col" class="col-3" data-column="notes">@translator.Translate(userLanguage, "Notes")</th>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
<th scope="col" style='display:none;' class="col-2" data-column="@extraFieldColumn">@extraFieldColumn</th>
|
||||||
|
}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (UpgradeRecord upgradeRecord in Model)
|
@foreach (UpgradeRecord upgradeRecord in Model)
|
||||||
{
|
{
|
||||||
<tr class="d-flex user-select-none" style="cursor:pointer;" onmouseup="stopEvent()" ontouchstart="detectRowLongTouch(this)" ontouchend="detectRowTouchEndPremature(this)" data-rowId="@upgradeRecord.Id" oncontextmenu="showTableContextMenu(this)" onmousemove="rangeMouseMove(this)" onclick="handleTableRowClick(this, showEditUpgradeRecordModal,@upgradeRecord.Id)" data-tags='@string.Join(" ", upgradeRecord.Tags)'>
|
<tr class="d-flex user-select-none" style="cursor:pointer;" onmouseup="stopEvent()" ontouchstart="detectRowLongTouch(this)" ontouchend="detectRowTouchEndPremature(this)" data-rowId="@upgradeRecord.Id" oncontextmenu="showTableContextMenu(this)" onmousemove="rangeMouseMove(this)" onclick="handleTableRowClick(this, showEditUpgradeRecordModal,@upgradeRecord.Id)" data-tags='@string.Join(" ", upgradeRecord.Tags)'>
|
||||||
<td class="col-2 col-xl-1">@upgradeRecord.Date.ToShortDateString()</td>
|
<td class="col-2 col-xl-1" data-column="date">@upgradeRecord.Date.ToShortDateString()</td>
|
||||||
<td class="col-2">@upgradeRecord.Mileage</td>
|
<td class="col-2" data-column="odometer">@upgradeRecord.Mileage</td>
|
||||||
<td class="col-3 col-xl-4">@upgradeRecord.Description</td>
|
<td class="col-3 col-xl-4" data-column="description">@upgradeRecord.Description</td>
|
||||||
<td class="col-2" data-record-type="cost">@((hideZero && upgradeRecord.Cost == default) ? "---" : upgradeRecord.Cost.ToString("C"))</td>
|
<td class="col-2" data-column="cost" data-record-type="cost">@((hideZero && upgradeRecord.Cost == default) ? "---" : upgradeRecord.Cost.ToString("C"))</td>
|
||||||
<td class="col-3 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(upgradeRecord.Notes)</td>
|
<td class="col-3 text-truncate" data-column="notes">@CarCareTracker.Helper.StaticHelper.TruncateStrings(upgradeRecord.Notes)</td>
|
||||||
|
@foreach (string extraFieldColumn in extraFields)
|
||||||
|
{
|
||||||
|
<td class="col-2 text-truncate" style='display:none;' data-column="@extraFieldColumn">@(upgradeRecord.ExtraFields.Where(x => x.Name == extraFieldColumn)?.FirstOrDefault()?.Value ?? "")</td>
|
||||||
|
}
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
"EnableAutoReminderRefresh": false,
|
"EnableAutoReminderRefresh": false,
|
||||||
"EnableAutoOdometerInsert": false,
|
"EnableAutoOdometerInsert": false,
|
||||||
"EnableShopSupplies": false,
|
"EnableShopSupplies": false,
|
||||||
|
"EnableExtraFieldColumns": false,
|
||||||
"UseUKMPG": false,
|
"UseUKMPG": false,
|
||||||
"UseThreeDecimalGasCost": true,
|
"UseThreeDecimalGasCost": true,
|
||||||
"UseMarkDownOnSavedNotes": false,
|
"UseMarkDownOnSavedNotes": false,
|
||||||
|
|||||||
@@ -865,3 +865,23 @@ function replenishSupplies() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function showTableColumns(e, isExtraField) {
|
||||||
|
//logic for extra field since we dont hardcode the data-column type
|
||||||
|
if (isExtraField) {
|
||||||
|
var showColumn = $(e).is(':checked');
|
||||||
|
var columnName = $(e).parent().find('.form-check-label').text();
|
||||||
|
if (showColumn) {
|
||||||
|
$(`[data-column='${columnName}']`).show();
|
||||||
|
} else {
|
||||||
|
$(`[data-column='${columnName}']`).hide();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var showColumn = $(e).is(':checked');
|
||||||
|
var columnName = $(e).attr('data-column-toggle');
|
||||||
|
if (showColumn) {
|
||||||
|
$(`[data-column='${columnName}']`).show();
|
||||||
|
} else {
|
||||||
|
$(`[data-column='${columnName}']`).hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user