); } function RatingScreen({ nav, params, onComplete }) { const { t } = useLang(); const p = params.provider; const [stars, setStars] = useState(3); const [reviewText, setReviewText] = useState(""); const [done, setDone] = useState(false); const submit = async () => { const bookingId = params.bookingId; const tok = _apiToken || sessionStorage.getItem('marha_token'); if (bookingId && tok) { try { await fetch("https://zyad.marha.app/reviews", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${tok}` }, body: JSON.stringify({ booking_id: bookingId, rating: stars, text: reviewText }) }); } catch(e) {} } onComplete?.({ role: "customer", counterpartyName: p?.name, service: p?.profession, price: p?.price, rating: stars, bookingId, }); setDone(true); }; if (done) { return (
{t("thanksForReview")}
{t("helpsOtherCustomers")}
); } return (
nav.pop()} />
{p.name}
{tService(p.profession, t)}
{[1, 2, 3, 4, 5].map((i) => ( ))}
{stars === 1 ? "⚡ " + t("ratingPoor") : stars === 2 ? "😐 " + t("ratingFair") : stars === 3 ? "👍 " + t("ratingGood") : stars === 4 ? "😊 " + t("ratingGreat") : "🌟 " + t("ratingExcellent")}
{[t("professionalism"), t("speed"), t("quality"), t("communication"), t("value")].map((c) => ( ))}