Compare commits

..

No commits in common. "a4af03be3cf410e4baaf70244932eb2b49632c05" and "85125132d242510efb8a9ed9846b98c98a7e9245" have entirely different histories.

5 changed files with 23 additions and 49 deletions

View File

@ -1235,16 +1235,9 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
} }
// Get or calculate price // Get or calculate price
//var unitPrice = productModel.Price > 0 var unitPrice = productModel.Price > 0
// ? productModel.Price ? productModel.Price
// : (await _priceCalculationService.GetFinalPriceAsync(product, customer, store)).finalPrice; : (await _priceCalculationService.GetFinalPriceAsync(product, customer, store)).finalPrice;
var valami = await _priceCalculationService.GetFinalPriceAsync(product, customer, store, includeDiscounts: true);
var originalPrice = valami.priceWithoutDiscounts;
var discountAmount = valami.appliedDiscountAmount;
var discountedPrice = valami.appliedDiscounts;
var unitPrice = valami.finalPrice;
// Calculate tax // Calculate tax
var (unitPriceInclTaxValue, _) = await _taxService.GetProductPriceAsync(product, unitPrice, true, customer); var (unitPriceInclTaxValue, _) = await _taxService.GetProductPriceAsync(product, unitPrice, true, customer);

View File

@ -68,23 +68,13 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
{ {
// Validate and get order // Validate and get order
var order = await _orderService.GetOrderByIdAsync(orderId); var order = await _orderService.GetOrderByIdAsync(orderId);
var orderDto = await _dbContext.OrderDtos.GetByIdAsync(orderId, true);
if (order == null) if (order == null)
{ {
return Json(new { success = false, message = "Order not found" }); return Json(new { success = false, message = "Order not found" });
} }
if (orderDto == null)
{
return Json(new { success = false, message = "OrderDTO not found" });
}
if (orderDto.DateOfReceipt == null)
{
return Json(new { success = false, message = "Ki kell tölteni az átvétel idejét." });
}
// Validate and get customer // Validate and get customer
var customer = await _customerService.GetCustomerByIdAsync(orderDto.CustomerId); var customer = await _customerService.GetCustomerByIdAsync(order.CustomerId);
if (customer == null) if (customer == null)
{ {
return Json(new { success = false, message = "Customer not found" }); return Json(new { success = false, message = "Customer not found" });
@ -115,15 +105,13 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
VevoOrszag = billingCountryCode, VevoOrszag = billingCountryCode,
VevoAdoszam = customer.VatNumber, VevoAdoszam = customer.VatNumber,
MegrendelestombID = 1, MegrendelestombID = 1,
MegrendelesKelte = ((DateTime)orderDto.DateOfReceipt).ToLocalTime(), MegrendelesKelte = order.CreatedOnUtc.ToLocalTime(),
Hatarido = DateTime.Now.AddDays(7), Hatarido = DateTime.Now.AddDays(7),
Devizanem = "Ft", // TODO: get real default - A. Devizanem = "Ft", // TODO: get real default - A.
//FizetesiMod = order.PaymentMethodSystemName ?? "átutalás", FizetesiMod = order.PaymentMethodSystemName ?? "átutalás",
FizetesiMod = "átutalás", Email = customer.Email ?? string.Empty,
//Email = customer.Email ?? string.Empty,
Email = billingAddress.Email ?? customer.Email ?? string.Empty,
Telefon = billingAddress.PhoneNumber ?? string.Empty, Telefon = billingAddress.PhoneNumber ?? string.Empty,
MegrendelesSzamStr = orderDto.Id.ToString() MegrendelesSzamStr = order.Id.ToString()
}; };
// Add shipping address details // Add shipping address details

View File

@ -134,21 +134,19 @@
<script src="https://cdn.jsdelivr.net/npm/qrcodejs@1.0.0/qrcode.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/qrcodejs@1.0.0/qrcode.min.js"></script>
<script> <script>
$(function() { $(function() {
@if (!string.IsNullOrEmpty(Model.CurrentVersion) && !string.IsNullOrEmpty(Model.FileName)) @if (!string.IsNullOrEmpty(Model.DownloadUrl))
{ {
<text> <text>
var downloadUrl = '@Url.Action("Download", "AppDownload", new { version = Model.CurrentVersion, fileName = Model.FileName }, Context.Request.Scheme)'; var downloadUrl = window.location.origin + '@Model.DownloadUrl';
console.log('QR Code URL:', downloadUrl); // Debug log new QRCode(document.getElementById("qrcode"), {
text: downloadUrl,
new QRCode(document.getElementById("qrcode"), { width: 200,
text: downloadUrl, height: 200,
width: 200, colorDark: "#000000",
height: 200, colorLight: "#ffffff",
colorDark: "#000000", correctLevel: QRCode.CorrectLevel.H
colorLight: "#ffffff", });
correctLevel: QRCode.CorrectLevel.H </text>
});
</text>
} }
}); });
</script> </script>

View File

@ -152,14 +152,9 @@ public class CustomPriceCalculationService : PriceCalculationService
{ {
var productDto = await _dbContext.ProductDtos.GetByIdAsync(product.Id, true); var productDto = await _dbContext.ProductDtos.GetByIdAsync(product.Id, true);
var finalPrice = await base.GetFinalPriceAsync(product, customer, store, overriddenProductPrice, additionalCharge, includeDiscounts, quantity, rentalStartDate, rentalEndDate);
if (productDto.IsMeasurable) if (productDto.IsMeasurable)
{ {
//finalPrice.priceWithoutDiscounts = 0; return (0, product.Price, 1000m, []);
//return (0, finalPrice.finalPrice, finalPrice.appliedDiscountAmount, []);
return finalPrice;
//return (overriddenProductPrice.GetValueOrDefault(0), overriddenProductPrice.GetValueOrDefault(0), 0m, []); //return (overriddenProductPrice.GetValueOrDefault(0), overriddenProductPrice.GetValueOrDefault(0), 0m, []);
} }
//var productAttributeMappings = await _specificationAttributeService.GetProductSpecificationAttributesAsync(product.Id); //var productAttributeMappings = await _specificationAttributeService.GetProductSpecificationAttributesAsync(product.Id);
@ -179,6 +174,6 @@ public class CustomPriceCalculationService : PriceCalculationService
// } // }
//} //}
return finalPrice; return await base.GetFinalPriceAsync(product, customer, store, overriddenProductPrice, additionalCharge, includeDiscounts, quantity, rentalStartDate, rentalEndDate);
} }
} }

View File

@ -24,7 +24,7 @@ public class PluginNopStartup : INopStartup
feature.AddPolicy( feature.AddPolicy(
"AllowBlazorClient", "AllowBlazorClient",
apiPolicy => apiPolicy apiPolicy => apiPolicy
.WithOrigins(["https://localhost:7144", "https://measurementtest.fruitbank.hu", "https://localhost:60589", "http://localhost:5000"]) .WithOrigins(["https://localhost:7144", "measuringtest.fruitbank.hu", "https://localhost:60589"])
.AllowAnyHeader() .AllowAnyHeader()
.AllowAnyMethod() .AllowAnyMethod()
.AllowCredentials() .AllowCredentials()