45 lines
1.7 KiB
Plaintext
45 lines
1.7 KiB
Plaintext
@model AuctionPublicInfoModel
|
|
|
|
|
|
|
|
<script asp-location="Footer">
|
|
var pageViewModel;
|
|
|
|
$(document).ready(function () {
|
|
// Deserialize the server-side model
|
|
pageViewModel = @Html.Raw(Json.Serialize(Model));
|
|
console.log("Page View Model:", pageViewModel);
|
|
console.log(pageViewModel.ProductId);
|
|
console.log(pageViewModel.ProductToAuctionMappingId);
|
|
// Get the element with data-productid
|
|
var productItem = $('.product-item[data-productid="' + pageViewModel.ProductId + '"]');
|
|
|
|
// Check if element exists
|
|
if (productItem.length > 0 && pageViewModel.ProductToAuctionMappingId > 0) {
|
|
console.log("Product item found:", productItem);
|
|
// Add a new div as the first child
|
|
if (pageViewModel.IsActive) {
|
|
productItem.prepend('<div class="bg-success p-1 text-white fs-6 text-center" style="position: absolute; width: calc(100% - 1rem); height: 40px; z-index: 1;"><i class="fa-solid fa-gavel"> '
|
|
+ 'LIVE RIGTH NOW' +
|
|
'</i></div>');
|
|
}
|
|
else {
|
|
productItem.prepend('<div class="bg-primary p-1 text-white fs-6 text-center" style="position: absolute; width: calc(100% - 1rem); height: 40px; z-index: 1;"><i class="fa-solid fa-gavel"> '
|
|
+ pageViewModel.StartDate +
|
|
'</i></div>');
|
|
}
|
|
|
|
} else {
|
|
console.error("Product item not found with productId:", pageViewModel.ProductId);
|
|
}
|
|
});
|
|
|
|
|
|
function refreshPublicInfo@(Model.ProductId)(data) {
|
|
|
|
console.log('function called: refreshPublicInfo' + @(Model.ProductId));
|
|
}
|
|
|
|
</script>
|
|
|