deprecated pinned notes
This commit is contained in:
@@ -28,7 +28,7 @@
|
|||||||
<div class="row gy-3 align-items-stretch vehiclesContainer">
|
<div class="row gy-3 align-items-stretch vehiclesContainer">
|
||||||
@foreach (Vehicle vehicle in Model)
|
@foreach (Vehicle vehicle in Model)
|
||||||
{
|
{
|
||||||
<div class="col-xl-2 col-lg-4 col-md-4 col-sm-4 col-4 user-select-none garage-item" ondragover="dragOver(event)" ondrop="dropBox(event, @vehicle.Id)" draggable="true" ondragstart="dragStart(event, @vehicle.Id)" data-tags='@string.Join(" ", vehicle.Tags)' id="gridVehicle_@vehicle.Id" data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="bottom" data-bs-trigger="manual" onmouseenter="loadPinnedNotes(@vehicle.Id)" ontouchstart="loadPinnedNotes(@vehicle.Id)" ontouchcancel="hidePinnedNotes(@vehicle.Id)" ontouchend="hidePinnedNotes(@vehicle.Id)" onmouseleave="hidePinnedNotes(@vehicle.Id)">
|
<div class="col-xl-2 col-lg-4 col-md-4 col-sm-4 col-4 user-select-none garage-item" ondragover="dragOver(event)" ondrop="dropBox(event, @vehicle.Id)" draggable="true" ondragstart="dragStart(event, @vehicle.Id)" data-tags='@string.Join(" ", vehicle.Tags)' id="gridVehicle_@vehicle.Id" data-bs-toggle="tooltip" data-bs-html="true" data-bs-title="@await Html.PartialAsync("_VehicleExtraFields", vehicle.ExtraFields)" data-bs-placement="bottom" data-bs-trigger="manual" onmouseenter="loadPinnedNotes(@vehicle.Id)" ontouchstart="loadPinnedNotes(@vehicle.Id)" ontouchcancel="hidePinnedNotes(@vehicle.Id)" ontouchend="hidePinnedNotes(@vehicle.Id)" onmouseleave="hidePinnedNotes(@vehicle.Id)">
|
||||||
<div class="card" onclick="viewVehicle(@vehicle.Id)">
|
<div class="card" onclick="viewVehicle(@vehicle.Id)">
|
||||||
<img src="@vehicle.ImageLocation" style="height:145px; object-fit:scale-down; pointer-events:none; @(string.IsNullOrWhiteSpace(vehicle.SoldDate) ? "" : "filter: grayscale(100%);")" />
|
<img src="@vehicle.ImageLocation" style="height:145px; object-fit:scale-down; pointer-events:none; @(string.IsNullOrWhiteSpace(vehicle.SoldDate) ? "" : "filter: grayscale(100%);")" />
|
||||||
@if (!string.IsNullOrWhiteSpace(vehicle.SoldDate))
|
@if (!string.IsNullOrWhiteSpace(vehicle.SoldDate))
|
||||||
|
|||||||
10
Views/Home/_VehicleExtraFields.cshtml
Normal file
10
Views/Home/_VehicleExtraFields.cshtml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
@model List<ExtraField>
|
||||||
|
@if (Model.Any())
|
||||||
|
{
|
||||||
|
<ul class='list-group list-group-flush'>
|
||||||
|
@foreach (ExtraField field in Model)
|
||||||
|
{
|
||||||
|
<li><b>@field.Name</b> : @field.Value</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
}
|
||||||
@@ -173,29 +173,10 @@ function performLogOut() {
|
|||||||
}
|
}
|
||||||
function loadPinnedNotes(vehicleId) {
|
function loadPinnedNotes(vehicleId) {
|
||||||
var hoveredGrid = $(`#gridVehicle_${vehicleId}`);
|
var hoveredGrid = $(`#gridVehicle_${vehicleId}`);
|
||||||
if (hoveredGrid.attr("data-bs-title") == undefined) {
|
|
||||||
$.get(`/Vehicle/GetPinnedNotesByVehicleId?vehicleId=${vehicleId}`, function (data) {
|
|
||||||
if (data.length > 0) {
|
|
||||||
//converted pinned notes to html.
|
|
||||||
var htmlString = "<ul class='list-group list-group-flush'>";
|
|
||||||
data.forEach(x => {
|
|
||||||
htmlString += `<li><b>${x.description}</b> : ${x.noteText}</li>`;
|
|
||||||
});
|
|
||||||
htmlString += "</ul>";
|
|
||||||
hoveredGrid.attr("data-bs-title", htmlString);
|
|
||||||
new bootstrap.Tooltip(hoveredGrid);
|
|
||||||
hoveredGrid.tooltip("show");
|
|
||||||
} else {
|
|
||||||
//disable the tooltip
|
|
||||||
hoveredGrid.attr("data-bs-title", "");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (hoveredGrid.attr("data-bs-title") != '') {
|
if (hoveredGrid.attr("data-bs-title") != '') {
|
||||||
hoveredGrid.tooltip("show");
|
hoveredGrid.tooltip("show");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
function hidePinnedNotes(vehicleId) {
|
function hidePinnedNotes(vehicleId) {
|
||||||
if ($(`#gridVehicle_${vehicleId}`).attr('data-bs-title') != '') {
|
if ($(`#gridVehicle_${vehicleId}`).attr('data-bs-title') != '') {
|
||||||
$(`#gridVehicle_${vehicleId}`).tooltip("hide");
|
$(`#gridVehicle_${vehicleId}`).tooltip("hide");
|
||||||
|
|||||||
Reference in New Issue
Block a user