Merge pull request #149 from hargata/Hargata/pin.notes

added ability to pin notes so that they always show up on top.
This commit is contained in:
Hargata Softworks
2024-01-23 17:48:30 -07:00
committed by GitHub
4 changed files with 9 additions and 1 deletions

View File

@@ -1266,6 +1266,7 @@ namespace CarCareTracker.Controllers
public IActionResult GetNotesByVehicleId(int vehicleId)
{
var result = _noteDataAccess.GetNotesByVehicleId(vehicleId);
result = result.OrderByDescending(x => x.Pinned).ToList();
return PartialView("_Notes", result);
}
[HttpPost]

View File

@@ -6,5 +6,6 @@
public int VehicleId { get; set; }
public string Description { get; set; }
public string NoteText { get; set; }
public bool Pinned { get; set; }
}
}

View File

@@ -12,6 +12,10 @@
<div class="row">
<div class="col-12">
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="noteIsPinned" checked="@Model.Pinned">
<label class="form-check-label" for="noteIsPinned">Pinned</label>
</div>
<label for="noteDescription">Description</label>
<input type="text" id="noteDescription" class="form-control" placeholder="Description of the note" value="@(isNew ? "" : Model.Description)">
</div>

View File

@@ -67,6 +67,7 @@ function getAndValidateNoteValues() {
var noteText = $("#noteTextArea").val();
var vehicleId = GetVehicleId().vehicleId;
var noteId = getNoteModelData().id;
var noteIsPinned = $("#noteIsPinned").is(":checked");
//validation
var hasError = false;
if (noteDescription.trim() == '') { //eliminates whitespace.
@@ -86,6 +87,7 @@ function getAndValidateNoteValues() {
hasError: hasError,
vehicleId: vehicleId,
description: noteDescription,
noteText: noteText
noteText: noteText,
pinned: noteIsPinned
}
}