/* ============================================================
screen_consult.jsx — платная консультация карьерного специалиста
100 000 сум. Оплата: кнопка → шторка выбора Click / Payme →
имитация перехода в приложение банка → экран «Оплачено».
============================================================ */
/* ---------- логотип платёжной системы ---------- */
function PayLogo({ method, size = 34 }) {
return (
);
}
/* ---------- шторка выбора способа оплаты ---------- */
function PaySheet({ t, onPick, onClose, priceText }) {
const price = priceText || t.cons_price;
return (
{t.cons_paySheet}
{t.cons_paySheetSub}
{CONSULT.methods.map((m, i) => (
))}
);
}
/* ---------- переход в приложение банка ---------- */
function PayProcessing({ t, method, priceText }) {
return (
{t.cons_processing}…
{method.name} · {priceText || t.cons_price}
);
}
/* ---------- экран «оплачено» ---------- */
function ConsultPaid({ t, onClose, onAgain }) {
return (
{t.cons_paidTitle}
{t.cons_paidSub}
{onAgain && (
)}
);
}
/* ---------- статус после оплаты: повторная оплата закрыта ---------- */
function ConsultStatus({ t, lang, go, onDone }) {
const steps = [
{ label: t.cons_stStep1, state: 'done' },
{ label: t.cons_stStep2, state: 'now' },
{ label: t.cons_stStep3, state: 'next' },
];
return (
{/* карточка статуса */}
{t.cons_stTitle}
{t.cons_stSub}
{/* три шага */}
{steps.map((st, i) => (
{i > 0 && }
{st.state === 'done' ? : i + 1}
{st.label}
))}
{/* специалист */}
{tr(APPLICATION.manager, lang)}
{t.online || ''}
{/* демо-кнопка: клиент отмечает, что консультация прошла */}
);
}
/* ---------- развёрнутый NPS после консультации ---------- */
function npsColor(n) {
return n <= 6 ? 'var(--hot)' : n <= 8 ? 'var(--amber)' : 'var(--good)';
}
function ConsultNps({ t, lang, onSubmit }) {
const [score, setScore] = useState(null);
const [aspects, setAspects] = useState([]);
const [comment, setComment] = useState('');
const list = score == null ? [] : score >= 9 ? t.nps_aspects_good : t.nps_aspects_bad;
const toggle = (a) => setAspects(p => p.includes(a) ? p.filter(x => x !== a) : [...p, a]);
return (
{t.nps_title}
{t.nps_sub}
{/* шкала 0–10 */}
{Array.from({ length: 11 }, (_, n) => {
const on = score === n;
return (
);
})}
{t.nps_low}
{t.nps_high}
{/* аспекты: зависят от оценки */}
{score != null && (
= 9 ? 'g' : 'b'} style={{ borderRadius: 'var(--r-xl)', background: 'var(--surface)', border: '1px solid var(--border)', boxShadow: 'var(--shadow-1)', padding: '16px', marginTop: 12, animation: 'fadeUp .4s both' }}>
{score >= 9 ? t.nps_whyGood : t.nps_whyBad}
{list.map((a, i) => {
const on = aspects.includes(a);
return (
);
})}
{t.nps_comment}
)}
);
}
/* ---------- спасибо за оценку ---------- */
function ConsultRated({ t, lang, go }) {
let nps = null;
try { nps = JSON.parse(localStorage.getItem('chaz_nps')); } catch {}
const score = nps ? nps.score : 10;
const followUp = score >= 9 ? t.nps_thanksPromoter : score >= 7 ? t.nps_thanksPassive : t.nps_thanksDetractor;
return (
{score}
{t.nps_yourScore}
{t.nps_thanksTitle}
{followUp}
);
}
function ConsultScreen({ lang, theme, setLang, setTheme, t, go, consultState, setConsultState }) {
const [stage, setStage] = useState('idle'); // idle | sheet | processing | paid
const [method, setMethod] = useState(CONSULT.methods[0]);
const pick = (m) => {
setMethod(m);
setStage('processing');
setTimeout(() => { setStage('paid'); setConsultState('paid'); }, 1900);
};
const head = } t={t} />;
// оплачено — повторная оплата закрыта, показываем статус
if (consultState === 'paid' && stage !== 'paid') return (
{head}
setConsultState('done')} />
);
// прошла — просим оценку
if (consultState === 'done') return (
{head}
{
try { localStorage.setItem('chaz_nps', JSON.stringify(r)); } catch {}
setConsultState('rated');
}} />
);
// оценка отправлена
if (consultState === 'rated') return (
{head}
);
if (stage === 'paid') return (
} t={t} />
setStage('status')} onAgain={null} />
);
return (
} t={t} />
{/* price hero */}
{t.cons_navTitle}
{t.cons_price}
{t.cons_duration}
{/* what you get */}
{t.cons_whatTitle}
{t.cons_what.map((line, i) => (
{line}
))}
{/* who needs it */}
{t.cons_whyTitle}
{t.cons_why}
{/* accepted payments — просто информация, выбор идёт в шторке */}
{t.cons_payTitle}
{CONSULT.methods.map(m =>
)}
{/* sticky pay button */}
{t.cons_payNote}
{stage === 'sheet' &&
setStage('idle')} />}
{stage === 'processing' && }
);
}
/* ---------- крупный баннер оффера (главный экран) ---------- */
function ConsultBanner({ t, go, delay = 0 }) {
return (
{t.cons_navTitle}
{t.cons_bannerTitle}
{t.cons_bannerBullets.map((b, i) => (
{b}
))}
{t.cons_bannerNote}
);
}
/* ---------- компактная промо-строка (вакансии, заявка) ---------- */
function ConsultPromo({ t, go, delay = 0 }) {
return (
);
}
Object.assign(window, { ConsultScreen, ConsultPromo, ConsultBanner, PaySheet, PayProcessing });