edited the payment dialog
All checks were successful
Build frontend / build (push) Successful in 1m2s

This commit is contained in:
mouazkh
2026-07-21 01:08:29 +03:00
parent 83a06e8007
commit 66db009562

View File

@ -687,7 +687,7 @@ function PaymentDialog({
const amount = reservation.depositAmount || reservation.totalPrice || 0; const amount = reservation.depositAmount || reservation.totalPrice || 0;
const currencySign = reservation.currencySign || t("sypSymbol"); const currencySign = reservation.currencySign || t("sypSymbol");
const selectedMethod = paymentMethods?.find( const selectedMethod = paymentMethods?.find(
(m) => (m?.id ?? m?.name) === selectedPayment (m) => (m?.id ?? m?.name) === selectedPayment,
); );
const isHaram = selectedMethod?.name?.toLowerCase?.() === "haram"; const isHaram = selectedMethod?.name?.toLowerCase?.() === "haram";
const canPay = payingId !== reservation.id && (!isHaram || !!receiptImage); const canPay = payingId !== reservation.id && (!isHaram || !!receiptImage);
@ -874,14 +874,18 @@ function PaymentDialog({
<X className="w-4 h-4" /> <X className="w-4 h-4" />
</button> </button>
<div className="p-3 text-center"> <div className="p-3 text-center">
<p className="text-xs text-gray-500 truncate">{receiptImage.name}</p> <p className="text-xs text-gray-500 truncate">
{receiptImage.name}
</p>
</div> </div>
</div> </div>
) : ( ) : (
<label className="flex flex-col items-center justify-center w-full h-48 border-2 border-dashed border-gray-300 rounded-2xl bg-gray-50 hover:bg-gray-100 hover:border-amber-300 transition-all cursor-pointer"> <label className="flex flex-col items-center justify-center w-full h-48 border-2 border-dashed border-gray-300 rounded-2xl bg-gray-50 hover:bg-gray-100 hover:border-amber-300 transition-all cursor-pointer">
<ImageIcon className="w-10 h-10 text-gray-400 mb-2" /> <ImageIcon className="w-10 h-10 text-gray-400 mb-2" />
<p className="text-sm text-gray-500"> <p className="text-sm text-gray-500">
{t("tapToUploadReceipt", { defaultValue: "اضغط لرفع صورة الإيصال" })} {t("tapToUploadReceipt", {
defaultValue: "اضغط لرفع صورة الإيصال",
})}
</p> </p>
<p className="text-xs text-gray-400 mt-1"> <p className="text-xs text-gray-400 mt-1">
JPG, PNG {t("maxSize", { defaultValue: "حد أقصى 5 ميجا" })} JPG, PNG {t("maxSize", { defaultValue: "حد أقصى 5 ميجا" })}
@ -894,7 +898,12 @@ function PaymentDialog({
const file = e.target.files?.[0]; const file = e.target.files?.[0];
if (!file) return; if (!file) return;
if (file.size > 5 * 1024 * 1024) { if (file.size > 5 * 1024 * 1024) {
toast.error(t("fileTooLarge", { defaultValue: "الصورة كبيرة جداً، الحد الأقصى 5 ميجا" })); toast.error(
t("fileTooLarge", {
defaultValue:
"الصورة كبيرة جداً، الحد الأقصى 5 ميجا",
}),
);
return; return;
} }
onSetReceiptImage(file); onSetReceiptImage(file);
@ -1663,7 +1672,7 @@ export default function UserReservationsPage() {
await payDeposit({ await payDeposit({
reservationId: r.id, reservationId: r.id,
paymentTypeId: selectedPayment, paymentTypeId: selectedPayment,
transactionType: "", transactionType: 1,
comment: null, comment: null,
paymentImage: receiptImage || null, paymentImage: receiptImage || null,
}); });