kaza namazı hesaplama düzeltildi.

This commit is contained in:
2026-07-31 04:50:20 +02:00
parent 9966df088e
commit 95aa140831
+9 -9
View File
@@ -11,7 +11,7 @@ const PRAYERS = [
export function renderKaza(pb) { export function renderKaza(pb) {
const user = pb.authStore.model; const user = pb.authStore.model;
const birthDate = user?.birthdate || user?.birthdate; const birthdate = user?.birthdate || user?.birthdate;
const gender = user?.gender || "male"; const gender = user?.gender || "male";
const html = ` const html = `
@@ -29,7 +29,7 @@ export function renderKaza(pb) {
</div> </div>
${ ${
!birthDate !birthdate
? ` ? `
<div class="bg-slate-950/50 border border-white/10 p-6 rounded-2xl my-auto text-center max-w-md mx-auto w-full"> <div class="bg-slate-950/50 border border-white/10 p-6 rounded-2xl my-auto text-center max-w-md mx-auto w-full">
<h3 class="text-base font-bold text-white mb-2">Doğum Tarihi Gerekli</h3> <h3 class="text-base font-bold text-white mb-2">Doğum Tarihi Gerekli</h3>
@@ -37,7 +37,7 @@ export function renderKaza(pb) {
<form id="profileForm" class="space-y-4"> <form id="profileForm" class="space-y-4">
<div class="text-left"> <div class="text-left">
<label class="block text-xs text-slate-300 mb-1">Doğum Tarihi ve Saati</label> <label class="block text-xs text-slate-300 mb-1">Doğum Tarihi ve Saati</label>
<input type="datetime-local" id="birthDateInput" required class="w-full bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-white text-sm focus:border-indigo-500 focus:outline-none" /> <input type="datetime-local" id="birthdateInput" required class="w-full bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-white text-sm focus:border-indigo-500 focus:outline-none" />
</div> </div>
<div class="text-left"> <div class="text-left">
<label class="block text-xs text-slate-300 mb-1">Cinsiyet</label> <label class="block text-xs text-slate-300 mb-1">Cinsiyet</label>
@@ -130,17 +130,17 @@ export function renderKaza(pb) {
); );
}); });
if (!birthDate) { if (!birthdate) {
container container
.querySelector("#profileForm") .querySelector("#profileForm")
?.addEventListener("submit", async (e) => { ?.addEventListener("submit", async (e) => {
e.preventDefault(); e.preventDefault();
const bInput = container.querySelector("#birthDateInput").value; const bInput = container.querySelector("#birthdateInput").value;
const gInput = container.querySelector("#genderInput").value; const gInput = container.querySelector("#genderInput").value;
try { try {
await pb.collection("users").update(pb.authStore.model.id, { await pb.collection("users").update(pb.authStore.model.id, {
birthdate: bInput, birthdate: bInput,
birthDate: bInput, birthdate: bInput,
gender: gInput, gender: gInput,
}); });
pb.authStore.model.birthdate = bInput; pb.authStore.model.birthdate = bInput;
@@ -165,7 +165,7 @@ export function renderKaza(pb) {
"Doğum tarihiniz ve saatiniz Hicri takvime dönüştürülüp 12 yaş borcunuz PocketBase'e kaydedilecek. Onaylıyor musunuz?", "Doğum tarihiniz ve saatiniz Hicri takvime dönüştürülüp 12 yaş borcunuz PocketBase'e kaydedilecek. Onaylıyor musunuz?",
) )
) { ) {
const res = await initAndSaveInitialKaza(pb, birthDate, gender); const res = await initAndSaveInitialKaza(pb, birthdate, gender);
if (res.success) { if (res.success) {
await refreshKazaStats(container, pb); await refreshKazaStats(container, pb);
showKazaMsg( showKazaMsg(
@@ -199,9 +199,9 @@ export function renderKaza(pb) {
}; };
} }
async function initAndSaveInitialKaza(pb, birthDate, gender) { async function initAndSaveInitialKaza(pb, birthdate, gender) {
try { try {
const calc = calculateMissedPrayers(birthDate, gender, 12); const calc = calculateMissedPrayers(birthdate, gender, 12);
if (!calc || calc.days <= 0) { if (!calc || calc.days <= 0) {
return { return {