better sizing for note text area.

This commit is contained in:
ivancheahhh
2024-01-03 05:37:05 -07:00
parent 943dee8d74
commit 928d18c8e5
7 changed files with 23 additions and 20 deletions

View File

@@ -78,14 +78,14 @@ namespace CarCareTracker.Controllers
{
var result = _gasRecordDataAccess.GetGasRecordsByVehicleId(vehicleId);
var computedResults = new List<GasRecordViewModel>();
int previousMileage = 0;
//perform computation.
for(int i = 0; i < result.Count; i++)
{
if (i > 0)
{
var currentObject = result[i];
var previousObject = result[i - 1];
var deltaMileage = currentObject.Mileage - previousObject.Mileage;
var deltaMileage = currentObject.Mileage - previousMileage;
computedResults.Add(new GasRecordViewModel()
{
Id = currentObject.Id,
@@ -113,8 +113,9 @@ namespace CarCareTracker.Controllers
CostPerGallon = (result[i].Cost / result[i].Gallons)
});
}
previousMileage = result[i].Mileage;
}
return PartialView("_GasRecords", result);
return PartialView("_GasRecords", computedResults);
}
#endregion
#region "Service Records"

View File

@@ -39,16 +39,14 @@
</li>
</ul>
<div class="tab-content" id="vehicleTabContent">
<div class="tab-pane fade show active" id="servicerecord-tab-pane" role="tabpanel"tabindex="0">
</div>
<div class="tab-pane fade show active" id="servicerecord-tab-pane" role="tabpanel"tabindex="0"></div>
<div class="tab-pane fade" id="gas-tab-pane" role="tabpanel" tabindex="0">111</div>
<div class="tab-pane fade" id="tax-tab-pane" role="tabpanel" tabindex="0">222</div>
<div class="tab-pane fade" id="notes-tab-pane" role="tabpanel" tabindex="0">
<div class="row">
<div class="col-12">
<label for="noteTextArea" class="form-label">This is where you can store notes related to the vehicle such as tire size, oil filter size, oil types, etc.</label>
<textarea class="form-control" id="noteTextArea" rows="7"></textarea>
<textarea class="form-control vehicleNoteContainer" id="noteTextArea"></textarea>
</div>
</div>
<div class="row">

View File

@@ -3,9 +3,9 @@
<div class="d-flex justify-content-between">
<div class="d-flex align-items-center">
<span class="ms-2 badge bg-success">@($"# of Gas Records: {Model.Count()}")</span>
<span class="badge bg-primary">@($"Average MPG: {Model.Where(y=>y.MilesPerGallon > 0).Average(x => x.MilesPerGallon)}")</span>
<span class="badge bg-primary">@($"Min MPG: {Model.Min(x => x.MilesPerGallon)}")</span>
<span class="badge bg-primary">@($"Max MPG: {Model.Max(x => x.MilesPerGallon)}")</span>
<span class="badge bg-primary">@($"Average Fuel Economy: {Model.Where(y=>y.MilesPerGallon > 0).Average(x => x.MilesPerGallon)}")</span>
<span class="badge bg-primary">@($"Min Fuel Economy: {Model.Min(x => x.MilesPerGallon)}")</span>
<span class="badge bg-primary">@($"Max Fuel Economy: {Model.Max(x => x.MilesPerGallon)}")</span>
<span class="ms-2 badge bg-success">@($"Total Gallons: {Model.Sum(x=>x.Gallons)}")</span>
<span class="ms-2 badge bg-success">@($"Total Cost: {Model.Sum(x => x.Cost).ToString("C")}")</span>
</div>
@@ -20,9 +20,9 @@
<thead>
<tr class="d-flex">
<th scope="col" class="col-2">Date Refueled</th>
<th scope="col" class="col-2">Mileage</th>
<th scope="col" class="col-2">Gallons</th>
<th scope="col" class="col-2">MPG</th>
<th scope="col" class="col-2">Odometer</th>
<th scope="col" class="col-2">Consumption</th>
<th scope="col" class="col-2">Fuel Economy</th>
<th scope="col" class="col-2">Cost</th>
<th scope="col" class="col-2">Unit Cost</th>
</tr>

View File

@@ -14,9 +14,9 @@
<input type="text" id="gasRecordDate" class="form-control" value="@Model.Date">
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
</div>
<label for="gasRecordMileage">Mileage</label>
<label for="gasRecordMileage">Odometer Reading</label>
<input type="number" id="gasRecordMileage" class="form-control" value="@Model.Mileage">
<label for="gasRecordGallons">Gallons</label>
<label for="gasRecordGallons">Fuel Consumption(gals/litres)</label>
<input type="text" id="gasRecordGallons" class="form-control" value="@Model.Gallons">
<label for="GasRecordCost">Cost</label>
<input type="number" id="gasRecordCost" class="form-control" value="@Model.Cost">
@@ -34,13 +34,13 @@
</div>
}
<label for="gasRecordFiles">Upload more documents</label>
<input onChange="uploadServiceRecordFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="gasRecordFiles">
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="gasRecordFiles">
</div>
}
else
{
<label for="gasRecordFiles">Upload documents(optional)</label>
<input onChange="uploadServiceRecordFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="gasRecordFiles">
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="gasRecordFiles">
}
</div>
</div>

View File

@@ -36,13 +36,13 @@
</div>
}
<label for="serviceRecordFiles">Upload more documents</label>
<input onChange="uploadServiceRecordFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="serviceRecordFiles">
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="serviceRecordFiles">
</div>
}
else
{
<label for="serviceRecordFiles">Upload documents(optional)</label>
<input onChange="uploadServiceRecordFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="serviceRecordFiles">
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="serviceRecordFiles">
}
</div>
</div>

View File

@@ -35,3 +35,7 @@ html {
overflow-y:auto;
overflow-x:auto;
}
.vehicleNoteContainer{
height:40vh;
}

View File

@@ -69,7 +69,7 @@ function saveServiceRecordToVehicle(isEdit) {
}
})
}
function uploadServiceRecordFilesAsync(event) {
function uploadVehicleFilesAsync(event) {
let formData = new FormData();
var files = event.files;
for (var x = 0; x < files.length; x++) {