Merge branch 'main' of https://git2.aycode.com/Adam/Mango.Nop.Plugins
This commit is contained in:
commit
54619b93f7
|
|
@ -14,14 +14,15 @@
|
||||||
console.log(pageViewModel.ProductToAuctionMappingId);
|
console.log(pageViewModel.ProductToAuctionMappingId);
|
||||||
// Get the element with data-productid
|
// Get the element with data-productid
|
||||||
isActive = pageViewModel.IsActive;
|
isActive = pageViewModel.IsActive;
|
||||||
initialize();
|
initialize@(Model.ProductId)(@Model.ProductId);
|
||||||
});
|
});
|
||||||
|
|
||||||
function initialize() {
|
function initialize@(Model.ProductId)(thisProductId) {
|
||||||
console.log("isActive = " + isActive);
|
console.log("isActive = " + isActive);
|
||||||
var productItem = $('.product-item[data-productid="' + pageViewModel.ProductId + '"]');
|
console.log("productId:" + thisProductId);
|
||||||
|
var productItem = $('.product-item[data-productid="' + thisProductId + '"]');
|
||||||
|
|
||||||
var existingOverlay = document.getElementById(`publicInfoOverlay${pageViewModel.ProductId}`);
|
var existingOverlay = document.getElementById(`publicInfoOverlay${thisProductId}`);
|
||||||
if (existingOverlay) {
|
if (existingOverlay) {
|
||||||
console.log("remove because it exists");
|
console.log("remove because it exists");
|
||||||
existingOverlay.remove();
|
existingOverlay.remove();
|
||||||
|
|
@ -29,17 +30,17 @@
|
||||||
|
|
||||||
// Check if element exists
|
// Check if element exists
|
||||||
if (productItem.length > 0 && pageViewModel.ProductToAuctionMappingId > 0) {
|
if (productItem.length > 0 && pageViewModel.ProductToAuctionMappingId > 0) {
|
||||||
console.log("Product item found:", productItem);
|
console.log("Product item length:", productItem.length);
|
||||||
// Add a new div as the first child
|
// Add a new div as the first child
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
console.log("isActive: " + isActive);
|
console.log("isActive: " + isActive);
|
||||||
productItem.prepend(`<div id="publicInfoOverlay${pageViewModel.ProductId}" 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"> `
|
productItem.prepend(`<div id="publicInfoOverlay${thisProductId}" 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' +
|
+ 'LIVE RIGTH NOW' +
|
||||||
'</i></div>');
|
'</i></div>');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("isActive: " + isActive);
|
console.log("isActive: " + isActive);
|
||||||
productItem.prepend(`<div id="publicInfoOverlay${pageViewModel.ProductId}" 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"> `
|
productItem.prepend(`<div id="publicInfoOverlay${thisProductId}" 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 +
|
+ pageViewModel.StartDate +
|
||||||
'</i></div>');
|
'</i></div>');
|
||||||
}
|
}
|
||||||
|
|
@ -48,7 +49,7 @@
|
||||||
console.error("Product item not found with productId:", pageViewModel.ProductId);
|
console.error("Product item not found with productId:", pageViewModel.ProductId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
window[`refreshPublicInfo${@Model.ProductId}`] = function (data) {
|
window[`refreshPublicInfo${@Model.ProductId}`] = function (data) {
|
||||||
|
|
||||||
|
|
@ -63,10 +64,10 @@
|
||||||
console.log("setting active to " + isActive);
|
console.log("setting active to " + isActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize();
|
initialize@(Model.ProductId)(data.auctionDto.productToAuctionDtos[0].productId);
|
||||||
console.log('Function called: refreshPublicInfo' + @Model.ProductId);
|
console.log('Function called: refreshPublicInfo' + @Model.ProductId);
|
||||||
};
|
};
|
||||||
console.log(`Function refreshPublicInfo${@Model.ProductId} added to DOM:`, window[`refreshPublicInfo${@Model.ProductId}`]);
|
console.log(`Function refreshPublicInfo${@Model.ProductId} added to DOM:`, window[`refreshPublicInfo${@Model.ProductId}`]);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue