added front end stuff for consolidated vehicle maintenance record.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
@model List<CostForVehicleByMonth>
|
||||
@if (Model.Any())
|
||||
{
|
||||
<canvas id="bar-chart" class="vehicleDetailTabContainer"></canvas>
|
||||
<canvas id="bar-chart"></canvas>
|
||||
<script>
|
||||
renderChart();
|
||||
function renderChart() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@model ReportViewModel
|
||||
<div class="row">
|
||||
<div class="row hideOnPrint">
|
||||
<div class="col-md-3 col-12 mt-2">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@@ -69,11 +69,26 @@
|
||||
</div>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="d-flex justify-content-center">
|
||||
<button onclick="generateVehicleHistoryReport()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Generate and Print Vehicle History Report</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="vehicleHistoryReport" class="showOnPrint" ></div>
|
||||
<script>
|
||||
function getYear() {
|
||||
return $("#yearOption").val();
|
||||
}
|
||||
function generateVehicleHistoryReport(){
|
||||
var vehicleId = GetVehicleId().vehicleId;
|
||||
$.get(`/Vehicle/GetVehicleHistory?vehicleId=${vehicleId}`, function(data){
|
||||
if (data) {
|
||||
$("#vehicleHistoryReport").html(data);
|
||||
setTimeout(function () {
|
||||
window.print();
|
||||
}, 500);
|
||||
}
|
||||
})
|
||||
}
|
||||
var debounce = null;
|
||||
function updateCheck(sender) {
|
||||
clearTimeout(debounce);
|
||||
|
||||
74
Views/Vehicle/_VehicleHistory.cshtml
Normal file
74
Views/Vehicle/_VehicleHistory.cshtml
Normal file
@@ -0,0 +1,74 @@
|
||||
@inject IConfiguration Configuration
|
||||
@{
|
||||
var hideZero = bool.Parse(Configuration[nameof(UserConfig.HideZero)]);
|
||||
}
|
||||
@model VehicleHistoryViewModel
|
||||
<div class="vehicleDetailTabContainer">
|
||||
<div class="row mt-2">
|
||||
<div class="d-flex">
|
||||
<img src="/defaults/lubelogger_logo.png" />
|
||||
<span class="display-6 ms-5">Vehicle Maintenance Report</span>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<span class="display-6">@($"{Model.VehicleData.Year} {Model.VehicleData.Make} {Model.VehicleData.Model}")</span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="lead">@Model.VehicleData.LicensePlate</span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
@if (Model.VehicleData.IsElectric)
|
||||
{
|
||||
<span><i class="bi bi-ev-station"></i> Electric</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span><i class="bi bi-fuel-pump"></i> Gasoline</span>
|
||||
}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">Last Reported Odometer Reading: @Model.Odometer</li>
|
||||
<li class="list-group-item">Average Fuel Economy: @Model.MPG.ToString("F")</li>
|
||||
<li class="list-group-item">Total Spent(excl. fuel): @Model.TotalCost.ToString("C")</li>
|
||||
<li class="list-group-item">Total Spent on Fuel: @Model.TotalGasCost.ToString("C")</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr class="d-flex">
|
||||
<th scope="col" class="col-1">Type</th>
|
||||
<th scope="col" class="col-1">Date</th>
|
||||
<th scope="col" class="col-2">Odometer</th>
|
||||
<th scope="col" class="col-3">Description</th>
|
||||
<th scope="col" class="col-2">Cost</th>
|
||||
<th scope="col" class="col-3">Notes</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (GenericReportModel reportData in Model.VehicleHistory)
|
||||
{
|
||||
<tr class="d-flex" style="cursor:pointer;">
|
||||
<td class="col-1">@reportData.DataType.ToString()</td>
|
||||
<td class="col-1">@reportData.Date.ToShortDateString()</td>
|
||||
<td class="col-2">@(reportData.Odometer == default ? "---" : reportData.Odometer.ToString("N0"))</td>
|
||||
<td class="col-3">@reportData.Description</td>
|
||||
<td class="col-2">@((hideZero && reportData.Cost == default) ? "---" : reportData.Cost.ToString("C"))</td>
|
||||
<td class="col-3 text-wrap">@CarCareTracker.Helper.StaticHelper.TruncateStrings(reportData.Notes, 100)</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user