This commit is contained in:
Kakabay 2024-04-15 14:44:19 +05:00
commit ec27ca32ef
19 changed files with 1532 additions and 1215 deletions

View File

@ -1,7 +1,7 @@
{
"files": {
"main.css": "/static/css/main.1b5f2b8d.css",
"main.js": "/static/js/main.7c0b369b.js",
"main.css": "/static/css/main.47dd3ba3.css",
"main.js": "/static/js/main.9f11f3b0.js",
"static/media/logo-transp.svg": "/static/media/logo-transp.66d6235f12fb5d9a6264c592bce58c5a.svg",
"static/media/logo-bg.jpg": "/static/media/logo-bg.1d55df78b7376108f96c.jpg",
"static/media/credit-card.jpg": "/static/media/credit-card.ff2990f7d50439a8f34d.jpg",
@ -68,7 +68,7 @@
"static/media/arrow.svg": "/static/media/arrow.c8492a68102634ab2875008b3e67164c.svg"
},
"entrypoints": [
"static/css/main.1b5f2b8d.css",
"static/js/main.7c0b369b.js"
"static/css/main.47dd3ba3.css",
"static/js/main.9f11f3b0.js"
]
}

View File

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"/><meta name="theme-color" content="#000000"/><meta name="Content-Security-Policy" content="default-src https://shahsyotag.halkbank.gov.tm 'self'; content-src 'self' https://shahsyotag.halkbank.gov.tm; script-src 'self' www.google.com www.gstatic.com; style-src 'self' https: 'unsafe-inline'; frame-src www.google.com;"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>Shahsy Otag</title><script defer="defer" src="/static/js/main.7c0b369b.js"></script><link href="/static/css/main.1b5f2b8d.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script src="//www.google.com/recaptcha/api.js" nonce="{NONCE}" async defer="defer"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"/><meta name="theme-color" content="#000000"/><meta name="Content-Security-Policy" content="default-src https://shahsyotag.halkbank.gov.tm 'self'; content-src 'self' https://shahsyotag.halkbank.gov.tm; script-src 'self' www.google.com www.gstatic.com; style-src 'self' https: 'unsafe-inline'; frame-src www.google.com;"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>Shahsy Otag</title><script defer="defer" src="/static/js/main.9f11f3b0.js"></script><link href="/static/css/main.47dd3ba3.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script src="//www.google.com/recaptcha/api.js" nonce="{NONCE}" async defer="defer"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,13 +1,13 @@
// IMPORT MODULES
import React, { useState, useContext } from 'react';
import { LanguageContext } from '../../backend/LanguageContext';
import { UserContext } from '../../backend/UserContext';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import React, { useState, useContext } from "react";
import { LanguageContext } from "../../backend/LanguageContext";
import { UserContext } from "../../backend/UserContext";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
// IMPORT IMAGES
import next from '../../icons/next.svg';
import next_reverse from '../../icons/next-reverse.svg';
import next from "../../icons/next.svg";
import next_reverse from "../../icons/next-reverse.svg";
// import arrow from "../../icons/arrow.svg";
const schema = z.object({
@ -24,13 +24,15 @@ const AcceptStage = ({
borrowerData,
guaranterData,
isGuranter,
setErrMessage,
setAcceptedMessage,
setUserDataRes,
userDataRes,
setErrMessage,
setErrMessageEn,
setErrMessageTkm,
}) => {
const { locale } = useContext(LanguageContext);
const userToken = localStorage.getItem('userToken');
const userToken = localStorage.getItem("userToken");
const { user } = useContext(UserContext);
const handleCardDetails = (e) => {
@ -39,6 +41,7 @@ const AcceptStage = ({
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState(false);
const [errorMessage, setErrorMesage] = useState("");
const {
register,
@ -47,20 +50,20 @@ const AcceptStage = ({
} = useForm({
resolver: zodResolver(schema),
defaultValues: {
amount: recepientAmount ? recepientAmount : 'Loading',
duration: creditDuration ? creditDuration : 'loading',
amount: recepientAmount ? recepientAmount : "Loading",
duration: creditDuration ? creditDuration : "loading",
},
});
const loanCreateCheck = async () => {
try {
const response = await fetch(
'https://shahsyotag.halkbank.gov.tm/onlineloancre-services/api/loancre/check',
"https://shahsyotag.halkbank.gov.tm/onlineloancre-services/api/loancre/check",
{
method: 'POST',
method: "POST",
headers: {
Accept: 'application/json, text/plain',
'Content-Type': 'application/json;charset=UTF-8',
Accept: "application/json, text/plain",
"Content-Type": "application/json;charset=UTF-8",
},
body: JSON.stringify({
clientRecipient: {
@ -70,7 +73,7 @@ const AcceptStage = ({
name: borrowerData.name,
surname: borrowerData.surname,
availableAmount: borrowerData.availableAmount,
clientType: 'recipient',
clientType: "recipient",
signRecipient: borrowerData.signRecipient,
},
clientGuarantor: isGuranter
@ -81,7 +84,7 @@ const AcceptStage = ({
name: guaranterData.name,
surname: guaranterData.surname,
availableAmount: guaranterData.availableAmount,
clientType: 'guarantor',
clientType: "guarantor",
signGuarantor: guaranterData.signGuarantor,
}
: null,
@ -90,7 +93,7 @@ const AcceptStage = ({
mrtIsInsuarance: isGuranter ? 0 : 1,
termInYears: creditDuration,
}),
},
}
);
if (!response.ok) {
@ -99,11 +102,12 @@ const AcceptStage = ({
const jsonedResponse = await response.json();
console.log(jsonedResponse);
if (jsonedResponse.errCode === 0) {
sendCode();
} else {
setErrMessage(jsonedResponse.messageRu);
setErrMessageTkm(jsonedResponse.message);
setErrMessageEn(jsonedResponse.messageEn);
setStage(10);
}
} catch (error) {}
@ -111,18 +115,27 @@ const AcceptStage = ({
const sendCode = async () => {
try {
const response = await fetch('https://shahsyotag.halkbank.gov.tm/sendOTP', {
method: 'POST',
headers: { 'Content-Type': 'aplication/json' },
body: JSON.stringify({
phone_number: user.mobile_phone,
}),
});
const response = await fetch(
"https://shahsyotag.halkbank.gov.tm/sendOTP",
{
method: "POST",
headers: { "Content-Type": "aplication/json" },
body: JSON.stringify({
phone_number: user.mobile_phone,
}),
}
);
if (!response.ok) {
setError(true);
setErrorMesage(response.status);
throw new Error(`HTTP error! Status: ${response.status}`);
}
if (response.status !== 200 || response.status !== 201) {
console.log(response.status);
}
setStage(9);
} catch (error) {
console.error(error);
@ -135,26 +148,38 @@ const AcceptStage = ({
if (error) {
return (
<section className="imm-cs-1 cs-1">
<h1 className="cs-2-title">Error...</h1>
<div className="cu-bottom cd-2-title">
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(7)}>
<div>
<div className="btn-img">
<img src={next_reverse} alt="logout" />
</div>
<h3>
{locale === 'TKM'
? 'Yza'
: locale === 'РУС'
? 'Назад'
: locale === 'ENG'
? 'Back'
: 'Yza'}
</h3>
<section className="cs-1 err-section">
<h1 className="cs-2-title">
{errorMessage}
{locale === "TKM"
? " Bir zat ýalňyş ..."
: locale === "РУС"
? " Ошибка..."
: locale === "ENG"
? "Error..."
: " Bir zat ýalňyş ..."}
</h1>
<br />
<button
type="button"
className="sign-btn reg-btn"
onClick={() => setStage(7)}
>
<div>
<div className="btn-img">
<img src={next_reverse} alt="logout" />
</div>
</button>
</div>
<h3>
{locale === "TKM"
? "Yza"
: locale === "РУС"
? "Назад"
: locale === "ENG"
? "Back"
: "Yza"}
</h3>
</div>
</button>
</section>
);
}
@ -163,13 +188,13 @@ const AcceptStage = ({
return (
<section className="loading">
<h1 className="cs-2-title">
{locale === 'TKM'
? 'Garaşmagyňyzy haýyş edýäris ...'
: locale === 'РУС'
? 'Пожалуйста, подождите...'
: locale === 'ENG'
? 'Please wait...'
: 'Garaşmagyňyzy haýyş edýäris ...'}
{locale === "TKM"
? "Garaşmagyňyzy haýyş edýäris ..."
: locale === "РУС"
? "Пожалуйста, подождите..."
: locale === "ENG"
? "Please wait..."
: "Garaşmagyňyzy haýyş edýäris ..."}
</h1>
</section>
);
@ -179,50 +204,55 @@ const AcceptStage = ({
<section className="imm-cs-1 cs-1">
<form onSubmit={handleSubmit(onSubmit)}>
<h2 className="cs-2-title">
{locale === 'TKM'
? 'Karzyň maglumatlaryny tassyklaň'
: locale === 'РУС'
? 'Подтвердите данные кредита'
: locale === 'ENG'
? 'Confirm the loan details'
: 'Karzyň maglumatlaryny tassyklaň'}
{locale === "TKM"
? "Karzyň maglumatlaryny tassyklaň"
: locale === "РУС"
? "Подтвердите данные кредита"
: locale === "ENG"
? "Confirm the loan details"
: "Karzyň maglumatlaryny tassyklaň"}
</h2>
<div className="imm-credit-form-wrapper">
<div className="input-block">
<label htmlFor="amount">
{locale === 'TKM'
? 'Karzyň möçberi'
: locale === 'РУС'
? 'Сумма кредита'
: locale === 'ENG'
? 'Amount of loan'
: 'Karzyň möçberi'}
{locale === "TKM"
? "Karzyň möçberi"
: locale === "РУС"
? "Сумма кредита"
: locale === "ENG"
? "Amount of loan"
: "Karzyň möçberi"}
</label>
<input {...register('amount')} type="text" id="amount" disabled />
<input {...register("amount")} type="text" id="amount" disabled />
{errors.amount && <span>{errors.amount.message}</span>}
</div>
<div className="input-block">
<label htmlFor="surname">
{locale === 'TKM'
? 'Karzyň möhleti'
: locale === 'РУС'
? 'Срок кредита'
: locale === 'ENG'
? 'Term of loan'
: 'Karzyň möhleti'}
{locale === "TKM"
? "Karzyň möhleti"
: locale === "РУС"
? "Срок кредита"
: locale === "ENG"
? "Term of loan"
: "Karzyň möhleti"}
</label>
<input {...register('duration')} type="text" id="duration" disabled />
<input
{...register("duration")}
type="text"
id="duration"
disabled
/>
{errors.duration && <span>{errors.duration.message}</span>}
</div>
<div className="input-block">
<label htmlFor="code">
{locale === 'TKM'
? 'Karz kartynyň hasabyny dolduryň'
: locale === 'РУС'
? 'Заполните счет кредитной карты'
: locale === 'ENG'
? 'Fill the credit card account number'
: 'Karz kartynyň hasabyny dolduryň'}
{locale === "TKM"
? "Karz kartynyň hasabyny dolduryň"
: locale === "РУС"
? "Заполните счет кредитной карты"
: locale === "ENG"
? "Fill the credit card account number"
: "Karz kartynyň hasabyny dolduryň"}
</label>
<input
value={cardDetails}
@ -232,31 +262,35 @@ const AcceptStage = ({
placeholder="6435980023168745"
/>
<span className="another-option" onClick={() => setStage(12)}>
{locale === 'TKM'
? 'Kartyňyz ýok bolsa, täze karty üçin ýüz tutuň'
: locale === 'РУС'
? 'Оформите новую карту, если она у вас отсувствует'
: locale === 'ENG'
? 'Apply for a new card if you do not have one'
: 'Kartyňyz ýok bolsa, täze karty üçin ýüz tutuň'}
{locale === "TKM"
? "Kartyňyz ýok bolsa, täze karty üçin ýüz tutuň"
: locale === "РУС"
? "Оформите новую карту, если она у вас отсувствует"
: locale === "ENG"
? "Apply for a new card if you do not have one"
: "Kartyňyz ýok bolsa, täze karty üçin ýüz tutuň"}
</span>
{/* {errors.code && <span>{errors.code.message}</span>} */}
</div>
</div>
<div className="cu-bottom cd-2-title">
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(7)}>
<button
type="button"
className="sign-btn reg-btn"
onClick={() => setStage(7)}
>
<div>
<div className="btn-img">
<img src={next_reverse} alt="logout" />
</div>
<h3>
{locale === 'TKM'
? 'Yza'
: locale === 'РУС'
? 'Назад'
: locale === 'ENG'
? 'Back'
: 'Yza'}
{locale === "TKM"
? "Yza"
: locale === "РУС"
? "Назад"
: locale === "ENG"
? "Back"
: "Yza"}
</h3>
</div>
</button>
@ -266,16 +300,17 @@ const AcceptStage = ({
disabled={cardDetails.length !== 23 && !isLoading ? true : false}
onClick={() => {
onSubmit();
}}>
}}
>
<div>
<h3>
{locale === 'TKM'
? 'Dowam et'
: locale === 'РУС'
? 'Подтвердить '
: locale === 'ENG'
? 'Proceed'
: 'Dowam et'}
{locale === "TKM"
? "Dowam et"
: locale === "РУС"
? "Подтвердить "
: locale === "ENG"
? "Proceed"
: "Dowam et"}
</h3>
<div className="btn-img">
<img src={next} alt="logout" />

View File

@ -1,13 +1,13 @@
// IMPORT MODULES
import React, { useState, useContext } from 'react';
import { LanguageContext } from '../../backend/LanguageContext';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import React, { useState, useContext } from "react";
import { LanguageContext } from "../../backend/LanguageContext";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
// IMPORT IMAGES
import next from '../../icons/next.svg';
import next_reverse from '../../icons/next-reverse.svg';
import { UserContext } from '../../backend/UserContext';
import next from "../../icons/next.svg";
import next_reverse from "../../icons/next-reverse.svg";
import { UserContext } from "../../backend/UserContext";
// import arrow from "../../icons/arrow.svg";
// const schema = z.object({
@ -46,14 +46,14 @@ const BorrowerInfo = ({
} = useForm({
// resolver: zodResolver(schema),
defaultValues: {
name: borrowerData.name ? borrowerData.name : 'Loading',
surname: borrowerData.surname ? borrowerData.surname : 'loading',
lastname: borrowerData.lastname ? borrowerData.lastname : 'loading',
passportSerial: borrowerData.idSeria ? borrowerData.idSeria : 'Loading',
passportNumber: borrowerData.idNo ? borrowerData.idNo : 'Loading',
bankAccount: borrowerData.accountNo ? borrowerData.accountNo : 'Loading',
birthDate: borrowerData.birthDate ? borrowerData.birthDate : 'Loading',
address: borrowerData.address ? borrowerData.address : 'Loading',
name: borrowerData.name ? borrowerData.name : "Loading",
surname: borrowerData.surname ? borrowerData.surname : "loading",
lastname: borrowerData.lastname ? borrowerData.lastname : "loading",
passportSerial: borrowerData.idSeria ? borrowerData.idSeria : "Loading",
passportNumber: borrowerData.idNo ? borrowerData.idNo : "Loading",
bankAccount: borrowerData.accountNo ? borrowerData.accountNo : "Loading",
birthDate: borrowerData.birthDate ? borrowerData.birthDate : "Loading",
address: borrowerData.address ? borrowerData.address : "Loading",
phoneNumber: user.mobile_phone,
},
});
@ -73,127 +73,146 @@ const BorrowerInfo = ({
<section className="imm-cs-1 cs-1">
<form onSubmit={handleSubmit(onSubmit)}>
<h2 className="cs-2-title">
{locale === 'TKM'
? 'Görkezilen maglumatlary tassyklaň, eger-de görkezilen maglumatlar nädogry bolsa ýa-da doldurylmadyk meýdançalar bar bolsa, bank bilen habarlaşyň!'
: locale === 'РУС'
? 'Подтвердите указанные данные, если указанные данные неверны или есть пустые поля, обратитесь в банк!'
: locale === 'ENG'
? 'Confirm the specified data, if the specified data is incorrect or there are blank fields, contact the bank!'
: 'Görkezilen maglumatlary tassyklaň, eger-de görkezilen maglumatlar nädogry bolsa ýa-da doldurylmadyk meýdançalar bar bolsa, bank bilen habarlaşyň!'}
{locale === "TKM"
? "Görkezilen maglumatlary tassyklaň, eger-de görkezilen maglumatlar nädogry bolsa ýa-da doldurylmadyk meýdançalar bar bolsa, bank bilen habarlaşyň!"
: locale === "РУС"
? "Подтвердите указанные данные. В случае, если данные не верны или есть незаполненные поля, просим обратиться в Банк!"
: locale === "ENG"
? "Confirm the provided information. If the data is incorrect or there are blank fields, please contact the Bank!"
: "Görkezilen maglumatlary tassyklaň, eger-de görkezilen maglumatlar nädogry bolsa ýa-da doldurylmadyk meýdançalar bar bolsa, bank bilen habarlaşyň!"}
</h2>
<div className="imm-credit-form-wrapper">
<div className="input-block">
<label htmlFor="name">
{locale === 'TKM'
? 'At'
: locale === 'РУС'
? 'Имя'
: locale === 'ENG'
? 'Name'
: 'At'}
{locale === "TKM"
? "Ady"
: locale === "РУС"
? "Имя"
: locale === "ENG"
? "Name"
: "Ady"}
</label>
<input {...register('name')} type="text" id="name" disabled />
<input {...register("name")} type="text" id="name" disabled />
{/* {errors.name && <span>{errors.name.message}</span>} */}
</div>
<div className="input-block">
<label htmlFor="lastname">
{locale === 'TKM'
? 'At'
: locale === 'РУС'
? 'Фамилия'
: locale === 'ENG'
? 'lastname'
: 'At'}
{locale === "TKM"
? "Familiýasy"
: locale === "РУС"
? "Фамилия"
: locale === "ENG"
? "Lastname"
: "Familiýasy"}
</label>
<input {...register('lastname')} type="text" id="lastname" disabled />
<input
{...register("lastname")}
type="text"
id="lastname"
disabled
/>
{/* {errors.surname && <span>{errors.surname.message}</span>} */}
</div>
<div className="input-block">
<label htmlFor="surname">
{locale === 'TKM'
? 'Familiýasy'
: locale === 'РУС'
? 'Отчество'
: locale === 'ENG'
? 'Middle name'
: 'Familiýasy'}
{locale === "TKM"
? "Atasynyň ady"
: locale === "РУС"
? "Отчество"
: locale === "ENG"
? "Middle name"
: "Atasynyň ady"}
</label>
<input {...register('surname')} type="text" id="surname" disabled />
<input {...register("surname")} type="text" id="surname" disabled />
{/* {errors.surname && <span>{errors.surname.message}</span>} */}
</div>
<div className="input-block">
<label htmlFor="birthDate">
{locale === 'TKM'
? 'Doglan ýyly'
: locale === 'РУС'
? 'Год рождения'
: locale === 'ENG'
? 'Year of birth'
: 'Doglan ýyly'}
{locale === "TKM"
? "Doglan senesi"
: locale === "РУС"
? "Дата рождения"
: locale === "ENG"
? "Date of birth"
: "Doglan senesi"}
</label>
<input {...register('birthDate')} type="text" id="birthDate" disabled />
<input
{...register("birthDate")}
type="text"
id="birthDate"
disabled
/>
{/* {errors.surname && <span>{errors.surname.message}</span>} */}
</div>
<div className="input-block">
<label htmlFor="passport-serial">
{locale === 'TKM'
? 'Pasport seriýasy'
: locale === 'РУС'
? 'Серия паспорта'
: locale === 'ENG'
? 'Passport Series'
: 'Pasport seriýasy'}
{locale === "TKM"
? "Pasport seriýasy"
: locale === "РУС"
? "Серия паспорта"
: locale === "ENG"
? "Passport Series"
: "Pasport seriýasy"}
</label>
<input {...register('passportSerial')} type="text" id="passport-serial" disabled />
{errors.passportSerial && <span>{errors.passportSerial.message}</span>}
<input
{...register("passportSerial")}
type="text"
id="passport-serial"
disabled
/>
{errors.passportSerial && (
<span>{errors.passportSerial.message}</span>
)}
</div>
<div className="input-block">
<label htmlFor="passport-number">
{locale === 'TKM'
? 'Pasport şahsyýetnamasy'
: locale === 'РУС'
? 'Номер паспорта'
: locale === 'ENG'
? 'Passport ID'
: 'Pasport şahsyýetnamasy'}
{locale === "TKM"
? "Pasport belgisi"
: locale === "РУС"
? "Номер паспорта"
: locale === "ENG"
? "Passport number"
: "Pasport belgisi"}
</label>
<input
{...register('passportNumber', { valueAsNumber: true })}
{...register("passportNumber", { valueAsNumber: true })}
type="number"
id="passport-number"
disabled
/>
{errors.passportNumber && <span>{errors.passportNumber.message}</span>}
{errors.passportNumber && (
<span>{errors.passportNumber.message}</span>
)}
</div>
<div className="input-block">
<label htmlFor="address">
{locale === 'TKM'
? 'Ýaşaýan salgysy'
: locale === 'РУС'
? 'Адрес прописки'
: locale === 'ENG'
? 'Address of residence'
: 'Ýaşaýan salgysy'}
{locale === "TKM"
? "Ýaşaýan salgysy"
: locale === "РУС"
? "Адрес прописки"
: locale === "ENG"
? "Address of residence"
: "Ýaşaýan salgysy"}
</label>
<input {...register('address')} type="text" id="address" disabled />
<input {...register("address")} type="text" id="address" disabled />
</div>
<div className="input-block">
<label htmlFor="bank-acc">
{locale === 'TKM'
? 'Aýlyk kartyň hasaby'
: locale === 'РУС'
? 'Счет зарплатной карты'
: locale === 'ENG'
? 'Salary card account'
: 'Aýlyk kartyň hasaby'}
{locale === "TKM"
? "Aýlyk kartyň hasaby"
: locale === "РУС"
? "Счет зарплатной карты"
: locale === "ENG"
? "Salary card account"
: "Aýlyk kartyň hasaby"}
</label>
<input
{...register('bankAccount', { valueAsNumber: true })}
{...register("bankAccount", { valueAsNumber: true })}
type="number"
id="bank-acc"
disabled
@ -202,28 +221,33 @@ const BorrowerInfo = ({
</div>
<div className="input-block">
<label htmlFor="phone-number">
{locale === 'TKM'
? 'Telefon belgisi'
: locale === 'РУС'
? 'Номер телефона'
: locale === 'ENG'
? 'Phone number'
: 'Telefon belgisi'}
{locale === "TKM"
? "Telefon belgisi"
: locale === "РУС"
? "Номер телефона"
: locale === "ENG"
? "Phone number"
: "Telefon belgisi"}
</label>
<input disabled type="text" id="phone-number" {...register('phoneNumber')} />
<input
disabled
type="text"
id="phone-number"
{...register("phoneNumber")}
/>
{errors.phoneNumber && <span>{errors.phoneNumber.message}</span>}
</div>
<div className="input-block">
<label htmlFor="workPlace">
{locale === 'TKM'
? 'Iş ýeriňizi dolduryň'
: locale === 'РУС'
? 'Заполните место работы'
: locale === 'ENG'
? 'Fill the place of work'
: 'Iş ýeriňizi dolduryň'}
{locale === "TKM"
? "Iş ýeriňizi dolduryň"
: locale === "РУС"
? "Заполните место работы"
: locale === "ENG"
? "Fill the place of work"
: "Iş ýeriňizi dolduryň"}
<span> *</span>
</label>
<input
@ -236,13 +260,13 @@ const BorrowerInfo = ({
</div>
<div className="input-block">
<label htmlFor="workPosition">
{locale === 'TKM'
? 'Wezipäňizi dolduryň'
: locale === 'РУС'
? 'Заполните должность'
: locale === 'ENG'
? 'Fill the position'
: 'Wezipäňizi dolduryň'}
{locale === "TKM"
? "Wezipäňizi dolduryň"
: locale === "РУС"
? "Заполните должность"
: locale === "ENG"
? "Fill the position"
: "Wezipäňizi dolduryň"}
<span> *</span>
</label>
<input
@ -256,38 +280,45 @@ const BorrowerInfo = ({
</div>
<div className="cu-bottom cd-2-title">
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(1)}>
<button
type="button"
className="sign-btn reg-btn"
onClick={() => setStage(1)}
>
<div>
<div className="btn-img">
<img src={next_reverse} alt="logout" />
</div>
<h3>
{locale === 'TKM'
? 'Yza'
: locale === 'РУС'
? 'Назад'
: locale === 'ENG'
? 'Back'
: 'Yza'}
{locale === "TKM"
? "Yza"
: locale === "РУС"
? "Назад"
: locale === "ENG"
? "Back"
: "Yza"}
</h3>
</div>
</button>
<button
type="button"
disabled={
recipientWorkPosition.length < 3 || recipientWorkPlace.length < 3 ? true : false
recipientWorkPosition.length < 3 || recipientWorkPlace.length < 3
? true
: false
}
className="sign-btn cu-btn"
onClick={() => (isGuranter ? setStage(4) : setStage(7))}>
onClick={() => (isGuranter ? setStage(4) : setStage(7))}
>
<div>
<h3>
{locale === 'TKM'
? 'Dowam et'
: locale === 'РУС'
? 'Подтвердить '
: locale === 'ENG'
? 'Proceed'
: 'Dowam et'}
{locale === "TKM"
? "Dowam et"
: locale === "РУС"
? "Подтвердить "
: locale === "ENG"
? "Proceed"
: "Dowam et"}
</h3>
<div className="btn-img">
<img src={next} alt="logout" />
@ -298,7 +329,7 @@ const BorrowerInfo = ({
</form>
</section>
) : (
'Loading'
"Loading"
);
};

View File

@ -1,14 +1,14 @@
// IMPORT MODULES
import React, { useState, useRef, useContext, useEffect } from 'react';
import { LanguageContext } from '../../backend/LanguageContext';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import React, { useState, useRef, useContext, useEffect } from "react";
import { LanguageContext } from "../../backend/LanguageContext";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
// IMPORT IMAGES
import next from '../../icons/next.svg';
import next_reverse from '../../icons/next-reverse.svg';
import next from "../../icons/next.svg";
import next_reverse from "../../icons/next-reverse.svg";
import Select from '../global/Select';
import Select from "../global/Select";
// import arrow from "../../icons/arrow.svg";
// const schema = z.object({
@ -21,18 +21,18 @@ import Select from '../global/Select';
// });
const IDSerias = [
'I-AS',
'I-AH',
'I-BN',
'I-LB',
'I-MR',
'I-DZ',
'II-AS',
'II-AH',
'II-BN',
'II-LB',
'II-MR',
'II-DZ',
"I-AS",
"I-AH",
"I-BN",
"I-LB",
"I-MR",
"I-DZ",
"II-AS",
"II-AH",
"II-BN",
"II-LB",
"II-MR",
"II-DZ",
];
// 478992
// 23908934160170143144000
@ -47,6 +47,8 @@ const BorrowerStage = ({
setRecepientAmount,
setErrMessage,
modalOpen,
setErrMessageEn,
setErrMessageTkm,
}) => {
const { locale } = useContext(LanguageContext);
@ -55,9 +57,9 @@ const BorrowerStage = ({
const [errCode, setErrCode] = useState();
const [isGuranterSelected, setIsGuranterSelected] = useState(false);
const [idSerial, setIdSerial] = useState('I-AS');
const [passportNumber, setPassportNumber] = useState('');
const [accNumber, setAccNumber] = useState('');
const [idSerial, setIdSerial] = useState("I-AS");
const [passportNumber, setPassportNumber] = useState("");
const [accNumber, setAccNumber] = useState("");
const handlePassportNumber = (e) => {
setPassportNumber(e.target.value);
@ -72,7 +74,7 @@ const BorrowerStage = ({
};
const checkboxHandleChange = (e) => {
e.target.value === 'guaranter' ? setIsGuranter(true) : setIsGuranter(false);
e.target.value === "guaranter" ? setIsGuranter(true) : setIsGuranter(false);
};
const {
@ -89,17 +91,17 @@ const BorrowerStage = ({
const response = await fetch(
`https://shahsyotag.halkbank.gov.tm/onlineloan-services/api/clientinfo`,
{
method: 'POST',
method: "POST",
headers: {
'Content-Type': 'application/json',
"Content-Type": "application/json",
},
body: JSON.stringify({
idSeria: idSeria,
idNo: idNo,
accountNo: accountNo,
clientType: 'recipient',
clientType: "recipient",
}),
},
}
);
if (!response.ok) {
@ -120,6 +122,8 @@ const BorrowerStage = ({
setStage(2);
} else if (responseJson.errCode !== 0) {
setErrMessage(responseJson.messageRu);
setErrMessageEn(responseJson.messageEn);
setErrMessageTkm(responseJson.message);
setStage(3);
}
} catch (error) {
@ -144,14 +148,14 @@ const BorrowerStage = ({
return (
<section className="loading">
<h1 className="cs-2-title">
{' '}
{locale === 'TKM'
? 'Garaşmagyňyzy haýyş edýäris ...'
: locale === 'РУС'
? 'Пожалуйста, подождите...'
: locale === 'ENG'
? 'Please wait...'
: 'Garaşmagyňyzy haýyş edýäris ...'}
{" "}
{locale === "TKM"
? "Garaşmagyňyzy haýyş edýäris ..."
: locale === "РУС"
? "Пожалуйста, подождите..."
: locale === "ENG"
? "Please wait..."
: "Garaşmagyňyzy haýyş edýäris ..."}
</h1>
</section>
);
@ -187,44 +191,44 @@ const BorrowerStage = ({
<section className="imm-cs-1 cs-1">
<form onSubmit={handleSubmit(onSubmit)}>
<h2 className="cs-2-title">
{locale === 'TKM'
? 'Maglumatlary dolduryň'
: locale === 'РУС'
? 'Заполните данные'
: locale === 'ENG'
? 'Fill in the details'
: 'Maglumatlary dolduryň'}
{locale === "TKM"
? "Maglumatlary dolduryň"
: locale === "РУС"
? "Заполните данные"
: locale === "ENG"
? "Fill in the details"
: "Maglumatlary dolduryň"}
</h2>
<div className="imm-credit-form-wrapper">
<Select
items={IDSerias}
customId={'card'}
blockName={'card-1-select'}
elName={'card-1-select-el'}
name={'passportSerial'}
customId={"card"}
blockName={"card-1-select"}
elName={"card-1-select-el"}
name={"passportSerial"}
eTarget={true}
register={register}
label={
locale === 'TKM'
? 'Pasportyň seriýasy'
: locale === 'РУС'
? 'Серия паспорта'
: locale === 'ENG'
? 'Passport Series'
: 'Pasportyň seriýasy'
locale === "TKM"
? "Pasportyň seriýasy"
: locale === "РУС"
? "Серия паспорта"
: locale === "ENG"
? "Passport Series"
: "Pasportyň seriýasy"
}
stateSetter={setIdSerial}
/>
<div className="input-block">
<label htmlFor="passport-number">
{locale === 'TKM'
? 'Pasportyň belgisi'
: locale === 'РУС'
? 'Номер паспорта'
: locale === 'ENG'
? 'Passport number'
: 'Pasportyň belgisi'}
{locale === "TKM"
? "Pasportyň belgisi"
: locale === "РУС"
? "Номер паспорта"
: locale === "ENG"
? "Passport number"
: "Pasportyň belgisi"}
</label>
<input
// {...register("passportNumber", { valueAsNumber: true })}
@ -238,13 +242,13 @@ const BorrowerStage = ({
</div>
<div className="input-block">
<label htmlFor="bank-acc">
{locale === 'TKM'
? 'Aýlyk kartyň hasaby'
: locale === 'РУС'
? 'Счет зарплатной карты'
: locale === 'ENG'
? 'Salary card account'
: 'Aýlyk kartyň hasaby'}
{locale === "TKM"
? "Aýlyk kartyň hasaby"
: locale === "РУС"
? "Счет зарплатной карты"
: locale === "ENG"
? "Salary card account"
: "Aýlyk kartyň hasaby"}
</label>
<input
// {...register("bankAccount", { valueAsNumber: true })}
@ -262,56 +266,66 @@ const BorrowerStage = ({
<div className="imm-credit-checkbox-wrapper">
<h3>
{locale === 'TKM'
? 'Zamunçylygyň görnüşini saýlan'
: locale === 'РУС'
? 'Выберите вид поручителя'
: locale === 'ENG'
? 'Select the type of guarantor'
: 'Zamunçylygyň görnüşini saýlan'}
{locale === "TKM"
? "Zamunçylygyň görnüşini saýlan"
: locale === "РУС"
? "Выберите вид поручителя"
: locale === "ENG"
? "Select the type of guarantor"
: "Zamunçylygyň görnüşini saýlan"}
</h3>
<div className="imm-credit-checkbox-group">
<div className="imm-credit-checkbox-block" onClick={() => isGuranterHandler(false)}>
<div
className="imm-credit-checkbox-block"
onClick={() => isGuranterHandler(false)}
>
<input
type="radio"
id="borrower"
value={'recepient'}
value={"recepient"}
name="client-type"
checked={isGuranterSelected ? (isGuranter ? false : true) : false}
checked={
isGuranterSelected ? (isGuranter ? false : true) : false
}
onChange={checkboxHandleChange}
// {...register("clientType")}
className="radio-button"
/>
<label htmlFor="borrower">
{locale === 'TKM'
? 'Ätiýaçlandyryş hyzmaty'
: locale === 'РУС'
? 'Гос. страхование'
: locale === 'ENG'
? 'Insurance Service '
: 'Ätiýaçlandyryş hyzmaty'}
{locale === "TKM"
? "Ätiýaçlandyryş hyzmaty"
: locale === "РУС"
? "Гос. страхование"
: locale === "ENG"
? "Insurance Service "
: "Ätiýaçlandyryş hyzmaty"}
</label>
</div>
<div className="imm-credit-checkbox-block" onClick={() => isGuranterHandler(true)}>
<div
className="imm-credit-checkbox-block"
onClick={() => isGuranterHandler(true)}
>
<input
type="radio"
id="isGuranter"
value={'guaranter'}
value={"guaranter"}
name="client-type"
checked={isGuranterSelected ? (isGuranter ? true : false) : false}
checked={
isGuranterSelected ? (isGuranter ? true : false) : false
}
onChange={checkboxHandleChange}
// {...register("clientType")}
className="radio-button"
/>
<label htmlFor="isGuranter">
{locale === 'TKM'
? 'Zamunçy'
: locale === 'РУС'
? 'Поручитель'
: locale === 'ENG'
? 'The guarantor'
: 'Zamunçy'}
{locale === "TKM"
? "Zamunçy"
: locale === "РУС"
? "Поручитель"
: locale === "ENG"
? "The guarantor"
: "Zamunçy"}
</label>
</div>
</div>
@ -320,7 +334,9 @@ const BorrowerStage = ({
<div className="card-button cs-1-bottom">
<button
disabled={
passportNumber.length === 6 && accNumber.length === 23 && isGuranterSelected
passportNumber.length === 6 &&
accNumber.length === 23 &&
isGuranterSelected
? false
: true
}
@ -328,16 +344,17 @@ const BorrowerStage = ({
className="sign-btn cd-btn"
onClick={() => {
// setData({ ...data, type: inputValid, type_localized: input });
}}>
}}
>
<div>
<h3>
{locale === 'TKM'
? 'Dowam et'
: locale === 'РУС'
? 'Продолжить'
: locale === 'ENG'
? 'Proceed'
: 'Dowam et'}
{locale === "TKM"
? "Dowam et"
: locale === "РУС"
? "Продолжить"
: locale === "ENG"
? "Proceed"
: "Dowam et"}
</h3>
<div className="btn-img">
<img src={next} alt="logout" />

View File

@ -1,12 +1,12 @@
// IMPORT MODULES
import React, { useState, useContext } from 'react';
import { LanguageContext } from '../../backend/LanguageContext';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import React, { useState, useContext } from "react";
import { LanguageContext } from "../../backend/LanguageContext";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
// IMPORT IMAGES
import next from '../../icons/next.svg';
import next_reverse from '../../icons/next-reverse.svg';
import next from "../../icons/next.svg";
import next_reverse from "../../icons/next-reverse.svg";
// import arrow from "../../icons/arrow.svg";
const schema = z.object({
@ -37,24 +37,24 @@ const CardDetails = ({ setStage, cardDetails, setCardDetails }) => {
<section className="imm-cs-1 cs-1">
<form onSubmit={handleSubmit(onSubmit)}>
<h2 className="cs-2-title">
{locale === 'TKM'
? 'Karzyň kalkulýatory'
: locale === 'РУС'
? 'Введите номер карты'
: locale === 'ENG'
? 'Loan calculator'
: 'Karzyň kalkulýatory'}
{locale === "TKM"
? "Karzyň kalkulýatory"
: locale === "РУС"
? "Введите номер карты"
: locale === "ENG"
? "Loan calculator"
: "Karzyň kalkulýatory"}
</h2>
<div className="imm-credit-form-wrapper">
<div className="input-block">
<label htmlFor="code">
{locale === 'TKM'
? 'At'
: locale === 'РУС'
? 'Номер карты'
: locale === 'ENG'
? 'amount'
: 'At'}
{locale === "TKM"
? "Ady"
: locale === "РУС"
? "Номер карты"
: locale === "ENG"
? "amount"
: "Ady"}
</label>
<input
value={cardDetails}
@ -68,19 +68,23 @@ const CardDetails = ({ setStage, cardDetails, setCardDetails }) => {
</div>
</div>
<div className="cu-bottom cd-2-title">
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(9)}>
<button
type="button"
className="sign-btn reg-btn"
onClick={() => setStage(9)}
>
<div>
<div className="btn-img">
<img src={next_reverse} alt="logout" />
</div>
<h3>
{locale === 'TKM'
? 'Yza'
: locale === 'РУС'
? 'Назад'
: locale === 'ENG'
? 'Back'
: 'Yza'}
{locale === "TKM"
? "Yza"
: locale === "РУС"
? "Назад"
: locale === "ENG"
? "Back"
: "Yza"}
</h3>
</div>
</button>
@ -88,16 +92,17 @@ const CardDetails = ({ setStage, cardDetails, setCardDetails }) => {
disabled={cardDetails.length !== 16 ? true : false}
type="button"
className="sign-btn cu-btn"
onClick={() => setStage(10)}>
onClick={() => setStage(10)}
>
<div>
<h3>
{locale === 'TKM'
? 'Dowam et'
: locale === 'РУС'
? 'Подтвердить '
: locale === 'ENG'
? 'Proceed'
: 'Dowam et'}
{locale === "TKM"
? "Dowam et"
: locale === "РУС"
? "Подтвердить "
: locale === "ENG"
? "Proceed"
: "Dowam et"}
</h3>
<div className="btn-img">
<img src={next} alt="logout" />

View File

@ -1,17 +1,23 @@
// IMPORT MODULES
import React, { useState, useContext } from 'react';
import { LanguageContext } from '../../backend/LanguageContext';
import { UserContext } from '../../backend/UserContext';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import React, { useState, useContext } from "react";
import { LanguageContext } from "../../backend/LanguageContext";
import { UserContext } from "../../backend/UserContext";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
// IMPORT IMAGES
import next from '../../icons/next.svg';
import next_reverse from '../../icons/next-reverse.svg';
import next from "../../icons/next.svg";
import next_reverse from "../../icons/next-reverse.svg";
const CardRegistration = ({ borrowerData, setStage, setPaymentLink, setPaymentDetails }) => {
const CardRegistration = ({
borrowerData,
setStage,
setPaymentLink,
setPaymentDetails,
invalidData,
}) => {
const { locale } = useContext(LanguageContext);
const userToken = localStorage.getItem('userToken');
const userToken = localStorage.getItem("userToken");
const [error, setError] = useState(false);
const [isLoading, setIsLoading] = useState(false);
@ -23,23 +29,23 @@ const CardRegistration = ({ borrowerData, setStage, setPaymentLink, setPaymentDe
} = useForm({
// resolver: zodResolver(schema),
defaultValues: {
name: borrowerData.name ? borrowerData.name : 'Loading',
surname: borrowerData.surname ? borrowerData.surname : 'Loading',
lastname: borrowerData.lastname ? borrowerData.lastname : 'loading',
passportSerial: borrowerData.idSeria ? borrowerData.idSeria : 'Loading',
passportNumber: borrowerData.idNo ? borrowerData.idNo : 'Loading',
birthDate: borrowerData.birthDate ? borrowerData.birthDate : 'Loading',
passDate: borrowerData.passDate ? borrowerData.passDate : 'Loading',
passOrg: borrowerData.passOrg ? borrowerData.passOrg : 'Loading',
workPlace: borrowerData.workPlace ? borrowerData.workPlace : '',
workPosition: borrowerData.workPosition ? borrowerData.workPosition : '',
address: borrowerData.address ? borrowerData.address : '',
name: borrowerData.name ? borrowerData.name : "Loading",
surname: borrowerData.surname ? borrowerData.surname : "Loading",
lastname: borrowerData.lastname ? borrowerData.lastname : "loading",
passportSerial: borrowerData.idSeria ? borrowerData.idSeria : "Loading",
passportNumber: borrowerData.idNo ? borrowerData.idNo : "Loading",
birthDate: borrowerData.birthDate ? borrowerData.birthDate : "Loading",
passDate: borrowerData.passDate ? borrowerData.passDate : "Loading",
passOrg: borrowerData.passOrg ? borrowerData.passOrg : "Loading",
workPlace: borrowerData.workPlace ? borrowerData.workPlace : "",
workPosition: borrowerData.workPosition ? borrowerData.workPosition : "",
address: borrowerData.address ? borrowerData.address : "",
},
});
const [workPlace, setWorkPlace] = useState('');
const [workPosition, setWorkPosition] = useState('');
const [address, setAddress] = useState('');
const [workPlace, setWorkPlace] = useState("");
const [workPosition, setWorkPosition] = useState("");
const [address, setAddress] = useState("");
console.log(borrowerData);
@ -56,14 +62,14 @@ const CardRegistration = ({ borrowerData, setStage, setPaymentLink, setPaymentDe
const sendData = async () => {
try {
const headers = {
Accept: 'application/json',
'Content-Type': 'application/json',
Accept: "application/json",
"Content-Type": "application/json",
Authorization: `Bearer ${userToken}`,
};
const response = await fetch(
'https://shahsyotag.halkbank.gov.tm/app/api/online_credit_card',
"https://shahsyotag.halkbank.gov.tm/app/api/online_credit_card",
{
method: 'POST',
method: "POST",
headers: headers,
body: JSON.stringify({
id_seria: borrowerData.idSeria,
@ -77,7 +83,7 @@ const CardRegistration = ({ borrowerData, setStage, setPaymentLink, setPaymentDe
dep_code: borrowerData.depCode,
address: address,
}),
},
}
);
if (!response.ok) {
@ -97,19 +103,22 @@ const CardRegistration = ({ borrowerData, setStage, setPaymentLink, setPaymentDe
const sendPaymentRequest = async (link) => {
try {
const headers = {
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
};
const formData = new URLSearchParams();
formData.append('app', 'sanlykarz');
formData.append('id', borrowerData.idNo);
formData.append('url', link);
formData.append("app", "sanlykarz");
formData.append("id", borrowerData.idNo);
formData.append("url", link);
const response = await fetch('https://shahsyotag.halkbank.gov.tm/api/v1/start-hack', {
method: 'POST',
headers: headers,
body: formData.toString(),
});
const response = await fetch(
"https://shahsyotag.halkbank.gov.tm/api/v1/start-hack",
{
method: "POST",
headers: headers,
body: formData.toString(),
}
);
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
@ -137,19 +146,23 @@ const CardRegistration = ({ borrowerData, setStage, setPaymentLink, setPaymentDe
<section className="imm-cs-1 cs-1">
<h1 className="cs-2-title">Error...</h1>
<div className="cu-bottom cd-2-title">
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(8)}>
<button
type="button"
className="sign-btn reg-btn"
onClick={() => setStage(8)}
>
<div>
<div className="btn-img">
<img src={next_reverse} alt="logout" />
</div>
<h3>
{locale === 'TKM'
? 'Yza'
: locale === 'РУС'
? 'Назад'
: locale === 'ENG'
? 'Back'
: 'Yza'}
{locale === "TKM"
? "Yza"
: locale === "РУС"
? "Назад"
: locale === "ENG"
? "Back"
: "Yza"}
</h3>
</div>
</button>
@ -162,14 +175,14 @@ const CardRegistration = ({ borrowerData, setStage, setPaymentLink, setPaymentDe
return (
<section className="loading">
<h1 className="cs-2-title">
{' '}
{locale === 'TKM'
? 'Garaşmagyňyzy haýyş edýäris ...'
: locale === 'РУС'
? 'Пожалуйста, подождите...'
: locale === 'ENG'
? 'Please wait...'
: 'Garaşmagyňyzy haýyş edýäris ...'}
{" "}
{locale === "TKM"
? "Garaşmagyňyzy haýyş edýäris ..."
: locale === "РУС"
? "Пожалуйста, подождите..."
: locale === "ENG"
? "Please wait..."
: "Garaşmagyňyzy haýyş edýäris ..."}
</h1>
</section>
);
@ -179,87 +192,102 @@ const CardRegistration = ({ borrowerData, setStage, setPaymentLink, setPaymentDe
<section className="imm-cs-1 cs-1">
<form onSubmit={handleSubmit()}>
<h2 className="cs-2-title">
{locale === 'TKM'
? 'Karz kartyny açdyrmak üçin maglumatlary tassyklaň'
: locale === 'РУС'
? 'Подтвердите данные для оформления кредитной карты'
: locale === 'ENG'
? 'To open the credit card, please confirm the personal details '
: 'Karz kartyny açdyrmak üçin maglumatlary tassyklaň'}
{locale === "TKM"
? "Karz kartyny açdyrmak üçin maglumatlary tassyklaň"
: locale === "РУС"
? "Подтвердите данные для оформления кредитной карты"
: locale === "ENG"
? "Please confirm the personal data for openning the credit card"
: "Karz kartyny açdyrmak üçin maglumatlary tassyklaň"}
</h2>
<div className="imm-credit-form-wrapper">
<div className="input-block">
<label htmlFor="name">
{locale === 'TKM'
? 'At'
: locale === 'РУС'
? 'Имя'
: locale === 'ENG'
? 'Name'
: 'At'}
{locale === "TKM"
? "Ady"
: locale === "РУС"
? "Имя"
: locale === "ENG"
? "Name"
: "Ady"}
</label>
<input {...register('name')} type="text" id="name" disabled />
<input {...register("name")} type="text" id="name" disabled />
</div>
<div className="input-block">
<label htmlFor="lastname">
{locale === 'TKM'
? 'Familiýa'
: locale === 'РУС'
? 'Фамилия'
: locale === 'ENG'
? 'Lastname'
: 'Familiýa'}
{locale === "TKM"
? "Familiýa"
: locale === "РУС"
? "Фамилия"
: locale === "ENG"
? "Lastname"
: "Familiýa"}
</label>
<input {...register('lastname')} type="text" id="lastname" disabled />
<input
{...register("lastname")}
type="text"
id="lastname"
disabled
/>
{/* {errors.surname && <span>{errors.surname.message}</span>} */}
</div>
<div className="input-block">
<label htmlFor="surname">
{locale === 'TKM'
? 'Atasynyň ady'
: locale === 'РУС'
? 'Отчество'
: locale === 'ENG'
? 'Middle name'
: 'Atasynyň ady'}
{locale === "TKM"
? "Atasynyň ady"
: locale === "РУС"
? "Отчество"
: locale === "ENG"
? "Middle name"
: "Atasynyň ady"}
</label>
<input {...register('surname')} type="text" id="surname" disabled />
<input {...register("surname")} type="text" id="surname" disabled />
</div>
<div className="input-block">
<label htmlFor="birthDate">
{locale === 'TKM'
? 'Doglan ýyly'
: locale === 'РУС'
? 'Год рождения'
: locale === 'ENG'
? 'Year of birth'
: 'Doglan ýyly'}
{locale === "TKM"
? "Doglan senesi"
: locale === "РУС"
? "Дата рождения"
: locale === "ENG"
? "Date of birth"
: "Doglan senesi"}
</label>
<input {...register('birthDate')} type="text" id="birthDate" disabled />
<input
{...register("birthDate")}
type="text"
id="birthDate"
disabled
/>
</div>
<div className="input-block">
<label htmlFor="passDate">
{locale === 'TKM'
? 'Pasport berlen senesi'
: locale === 'РУС'
? 'Дата выдачи паспорта'
: locale === 'ENG'
? 'Passport issue date'
: 'Pasport berlen senesi'}
{locale === "TKM"
? "Pasport berlen senesi"
: locale === "РУС"
? "Дата выдачи паспорта"
: locale === "ENG"
? "Passport issue date"
: "Pasport berlen senesi"}
</label>
<input {...register('passDate')} type="text" id="passDate" disabled />
<input
{...register("passDate")}
type="text"
id="passDate"
disabled
/>
</div>
<div className="input-block">
<label htmlFor="passOrg">
{locale === 'TKM'
? 'At'
: locale === 'РУС'
? 'Кем выдан паспорт'
: locale === 'ENG'
? 'Passport issued by'
: 'Pasport kim tarapyndan berlen'}
{locale === "TKM"
? "Pasport berlen ýeri"
: locale === "РУС"
? "Кем выдан паспорт"
: locale === "ENG"
? "Passport issued by"
: "Pasport berlen ýeri"}
</label>
<input {...register('passOrg')} type="text" id="passOrg" disabled />
<input {...register("passOrg")} type="text" id="passOrg" disabled />
</div>
{/* <div className="input-block">
@ -302,32 +330,55 @@ const CardRegistration = ({ borrowerData, setStage, setPaymentLink, setPaymentDe
</div> */}
<div className="input-block">
<label htmlFor="address">
{locale === 'TKM'
? 'Ýaşaýan salgysy '
: locale === 'РУС'
? 'Адрес прописки '
: locale === 'ENG'
? 'Address of residence '
: 'Ýaşaýan salgysy '}
{locale === "TKM"
? "Ýaşaýan salgysy "
: locale === "РУС"
? "Адрес прописки "
: locale === "ENG"
? "Address of residence "
: "Ýaşaýan salgysy "}
</label>
<input disabled={true} {...register('address')} type="text" id="address" />
<input
disabled={true}
{...register("address")}
type="text"
id="address"
/>
</div>
</div>
{invalidData && (
<section className="imm-cs-1 cs-1">
<h1 className="cs-2-title">
{locale === "TKM"
? "Kard maglumatlary barlamana we täzeden girizmäne haýyş edýäris"
: locale === "РУС"
? "Пожалуйста, проверьте и еще раз введите данные своей карты."
: locale === "ENG"
? "Please check and re-enter your card details"
: "Kard maglumatlary barlamana we täzeden girizmäne haýyş edýäris"}
</h1>
</section>
)}
<div className="cu-bottom cd-2-title">
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(8)}>
<button
type="button"
className="sign-btn reg-btn"
onClick={() => setStage(8)}
>
<div>
<div className="btn-img">
<img src={next_reverse} alt="logout" />
</div>
<h3>
{locale === 'TKM'
? 'Yza'
: locale === 'РУС'
? 'Назад'
: locale === 'ENG'
? 'Back'
: 'Yza'}
{locale === "TKM"
? "Yza"
: locale === "РУС"
? "Назад"
: locale === "ENG"
? "Back"
: "Yza"}
</h3>
</div>
</button>
@ -335,16 +386,17 @@ const CardRegistration = ({ borrowerData, setStage, setPaymentLink, setPaymentDe
type="submit"
className="sign-btn cu-btn"
disabled={isLoading ? true : false}
onClick={onSubmit}>
onClick={onSubmit}
>
<div>
<h3>
{locale === 'TKM'
? 'Dowam et'
: locale === 'РУС'
? 'Подтвердить '
: locale === 'ENG'
? 'Proceed'
: 'Dowam et'}
{locale === "TKM"
? "Dowam et"
: locale === "РУС"
? "Подтвердить "
: locale === "ENG"
? "Proceed"
: "Dowam et"}
</h3>
<div className="btn-img">
<img src={next} alt="logout" />

View File

@ -1,33 +1,42 @@
import React, { useContext } from 'react';
import { LanguageContext } from '../../backend/LanguageContext';
import React, { useContext } from "react";
import { LanguageContext } from "../../backend/LanguageContext";
const FinalStage = ({ setModalOpen }) => {
const FinalStage = ({
setModalOpen,
acceptedMessageTkm,
acceptedMessage,
acceptedMessageEn,
}) => {
const { locale } = useContext(LanguageContext);
return (
<section className="imm-cs-1 cs-1">
<form>
<h2 className="succes-title">
{locale === 'TKM'
? 'Karzyň kalkulýatory'
: locale === 'РУС'
? 'Оплата прошла успешно. Ваша заявка принята'
: locale === 'ENG'
? 'Loan calculator'
: 'Karzyň kalkulýatory'}
{locale === "TKM"
? acceptedMessageTkm
: locale === "РУС"
? acceptedMessage
: locale === "ENG"
? acceptedMessageEn
: acceptedMessageTkm}
</h2>
<div className="cu-bottom cd-2-title">
<button type="submit" onClick={() => setModalOpen(false)} className="sign-btn cu-btn">
<button
type="submit"
onClick={() => setModalOpen(false)}
className="sign-btn cu-btn"
>
<div>
<h3>
{locale === 'TKM'
? 'Dowam et'
: locale === 'РУС'
? 'Закрыть '
: locale === 'ENG'
? 'Proceed'
: 'Dowam et'}
{locale === "TKM"
? "Çykmak"
: locale === "РУС"
? "Закрыть "
: locale === "ENG"
? "Close"
: "Çykmak"}
</h3>
</div>
</button>

View File

@ -1,12 +1,12 @@
// IMPORT MODULES
import React, { useState, useContext } from 'react';
import { LanguageContext } from '../../backend/LanguageContext';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import React, { useState, useContext } from "react";
import { LanguageContext } from "../../backend/LanguageContext";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
// IMPORT IMAGES
import next from '../../icons/next.svg';
import next_reverse from '../../icons/next-reverse.svg';
import next from "../../icons/next.svg";
import next_reverse from "../../icons/next-reverse.svg";
// import arrow from "../../icons/arrow.svg";
const schema = z.object({
@ -16,13 +16,13 @@ const schema = z.object({
passportNumber: z
.number()
.int()
.gte(100000, { message: 'Must be equal to 6 digits' })
.lte(999999, { message: 'Must be equal to 6 digits' }),
.gte(100000, { message: "Must be equal to 6 digits" })
.lte(999999, { message: "Must be equal to 6 digits" }),
bankAccount: z
.number()
.int()
.gte(100000, { message: 'Must be equal to 6 digits' })
.lte(999999, { message: 'Must be equal to 6 digits' }),
.gte(100000, { message: "Must be equal to 6 digits" })
.lte(999999, { message: "Must be equal to 6 digits" }),
// clientType: z.string(),
});
@ -36,15 +36,17 @@ const GuaranterInfo = ({ setStage, isGuranter, guaranterData }) => {
} = useForm({
resolver: zodResolver(schema),
defaultValues: {
name: guaranterData.name ? guaranterData.name : 'Loading',
surname: guaranterData.surname ? guaranterData.surname : 'loading',
lastname: guaranterData.lastname ? guaranterData.lastname : 'loading',
name: guaranterData.name ? guaranterData.name : "Loading",
surname: guaranterData.surname ? guaranterData.surname : "loading",
lastname: guaranterData.lastname ? guaranterData.lastname : "loading",
passportSerial: guaranterData.idSeria ? guaranterData.idSeria : 'Loading',
passportNumber: guaranterData.idNo ? guaranterData.idNo : 'Loading',
bankAccount: guaranterData.accountNo ? guaranterData.accountNo : 'Loading',
birthDate: guaranterData.birthDate ? guaranterData.birthDate : 'Loading',
address: guaranterData.address ? guaranterData.address : 'Loading',
passportSerial: guaranterData.idSeria ? guaranterData.idSeria : "Loading",
passportNumber: guaranterData.idNo ? guaranterData.idNo : "Loading",
bankAccount: guaranterData.accountNo
? guaranterData.accountNo
: "Loading",
birthDate: guaranterData.birthDate ? guaranterData.birthDate : "Loading",
address: guaranterData.address ? guaranterData.address : "Loading",
},
});
@ -56,126 +58,164 @@ const GuaranterInfo = ({ setStage, isGuranter, guaranterData }) => {
<section className="imm-cs-1 cs-1">
<form onSubmit={handleSubmit(onSubmit)}>
<h2 className="cs-2-title">
{locale === 'TKM'
? 'Karzyň kalkulýatory'
: locale === 'РУС'
? 'Подтвердите данные'
: locale === 'ENG'
? 'Loan calculator'
: 'Karzyň kalkulýatory'}
{locale === "TKM"
? "Zamunçynyň görkezilen maglumatlaryny tassyklaň, eger-de görkezilen maglumatlar nädogry bolsa ýa doldurylmadyk meýdançalar bolsa bank bilen habarlaşyň"
: locale === "РУС"
? "Подтвердите предоставленную заёмщиком информацию. В случае, если данные не верны или есть незаполненные поля, просим обратиться в Банк!"
: locale === "ENG"
? "Confirm the information provided by the guarantor. If the data is incorrect or there are blank fields, please contact the Bank!"
: "Zamunçynyň görkezilen maglumatlaryny tassyklaň, eger-de görkezilen maglumatlar nädogry bolsa ýa doldurylmadyk meýdançalar bolsa bank bilen habarlaşyň"}
</h2>
<div className="imm-credit-form-wrapper">
<div className="input-block">
<label htmlFor="name">
{locale === 'TKM'
? 'At'
: locale === 'РУС'
? 'Имя'
: locale === 'ENG'
? 'Name'
: 'At'}
{locale === "TKM"
? "Ady"
: locale === "РУС"
? "Имя"
: locale === "ENG"
? "Name"
: "Ady"}
</label>
<input {...register('name')} type="text" id="name" disabled />
<input {...register("name")} type="text" id="name" disabled />
{/* {errors.name && <span>{errors.name.message}</span>} */}
</div>
<div className="input-block">
<label htmlFor="lastname">
{locale === 'TKM'
? 'Familiýa'
: locale === 'РУС'
? 'Фамилия'
: locale === 'ENG'
? 'Lastname'
: 'Familiýa'}
{locale === "TKM"
? "Familiýa"
: locale === "РУС"
? "Фамилия"
: locale === "ENG"
? "Lastname"
: "Familiýa"}
</label>
<input {...register('lastname')} type="text" id="lastname" disabled />
<input
{...register("lastname")}
type="text"
id="lastname"
disabled
/>
{/* {errors.surname && <span>{errors.surname.message}</span>} */}
</div>
<div className="input-block">
<label htmlFor="surname">
{locale === 'TKM'
? 'Atasynyň ady'
: locale === 'РУС'
? 'Отчество'
: locale === 'ENG'
? 'Middle name'
: 'Atasynyň ady'}
{locale === "TKM"
? "Atasynyň ady"
: locale === "РУС"
? "Отчество"
: locale === "ENG"
? "Middle name"
: "Atasynyň ady"}
</label>
<input {...register('surname')} type="text" id="surname" disabled />
<input {...register("surname")} type="text" id="surname" disabled />
{/* {errors.surname && <span>{errors.surname.message}</span>} */}
</div>
<div className="input-block">
<label htmlFor="birthDate">
{locale === 'TKM'
? 'Doglan ýyly'
: locale === 'РУС'
? 'Год рождения'
: locale === 'ENG'
? 'Year of birth'
: 'Doglan ýyly'}
{locale === "TKM"
? "Doglan senesi"
: locale === "РУС"
? "Дата рождения"
: locale === "ENG"
? "Date of birth"
: "Doglan senesi"}
</label>
<input {...register('birthDate')} type="text" id="birthDate" disabled />
<input
{...register("birthDate")}
type="text"
id="birthDate"
disabled
/>
{/* {errors.surname && <span>{errors.surname.message}</span>} */}
</div>
<div className="input-block">
<label htmlFor="passport-serial">
{locale === 'TKM'
? 'Pasportyň seriýasy'
: locale === 'РУС'
? 'Серия паспорта'
: locale === 'ENG'
? 'Passport Series'
: 'Pasportyň seriýasy'}
{locale === "TKM"
? "Pasportyň seriýasy"
: locale === "РУС"
? "Серия паспорта"
: locale === "ENG"
? "Passport Series"
: "Pasportyň seriýasy"}
</label>
<input {...register('passportSerial')} type="text" id="passport-serial" disabled />
{errors.passportSerial && <span>{errors.passportSerial.message}</span>}
<input
{...register("passportSerial")}
type="text"
id="passport-serial"
disabled
/>
{errors.passportSerial && (
<span>{errors.passportSerial.message}</span>
)}
</div>
<div className="input-block">
<label htmlFor="passport-number">
{locale === 'TKM'
? 'Pasportyň belgisi'
: locale === 'РУС'
? 'Номер паспорта'
: locale === 'ENG'
? 'Passport number'
: 'Pasportyň belgisi'}
{locale === "TKM"
? "Pasportyň belgisi"
: locale === "РУС"
? "Номер паспорта"
: locale === "ENG"
? "Passport number"
: "Pasportyň belgisi"}
</label>
<input
{...register('passportNumber', { valueAsNumber: true })}
{...register("passportNumber", { valueAsNumber: true })}
type="number"
id="passport-number"
disabled
/>
{errors.passportNumber && <span>{errors.passportNumber.message}</span>}
{errors.passportNumber && (
<span>{errors.passportNumber.message}</span>
)}
</div>
<div className="input-block">
<label htmlFor="address">
{locale === 'TKM'
? 'Ýaşaýan salgysy'
: locale === 'РУС'
? 'Адрес прописки'
: locale === 'ENG'
? 'Address of residence'
: 'Ýaşaýan salgysy'}
{locale === "TKM"
? "Ýaşaýan salgysy"
: locale === "РУС"
? "Адрес прописки"
: locale === "ENG"
? "Address of residence"
: "Ýaşaýan salgysy"}
</label>
<input {...register('address')} type="text" id="address" disabled />
<input {...register("address")} type="text" id="address" disabled />
</div>
<div className="input-block">
<label htmlFor="bank-acc">
{locale === 'TKM'
? 'Aýlyk kartyň hasaby'
: locale === 'РУС'
? 'Счет зарплатной карты'
: locale === 'ENG'
? 'Salary card account'
: 'Aýlyk kartyň hasaby'}
{locale === "TKM"
? "Aýlyk kartyň hasaby"
: locale === "РУС"
? "Счет зарплатной карты"
: locale === "ENG"
? "Salary card account"
: "Aýlyk kartyň hasaby"}
</label>
<input
{...register('bankAccount', { valueAsNumber: true })}
{...register("bankAccount", { valueAsNumber: true })}
type="number"
id="bank-acc"
disabled
/>
{errors.bankAccount && <span>{errors.bankAccount.message}</span>}
</div>
<div className="input-block input-block-hidden">
<label htmlFor="bank-acc">
{locale === "TKM"
? "Aýlyk kartyň hasaby"
: locale === "РУС"
? "Счет зарплатной карты"
: locale === "ENG"
? "Salary card account"
: "Aýlyk kartyň hasaby"}
</label>
<input
{...register("bankAccount", { valueAsNumber: true })}
type="number"
id="bank-acc"
disabled
@ -185,56 +225,68 @@ const GuaranterInfo = ({ setStage, isGuranter, guaranterData }) => {
<div className="input-block">
<label htmlFor="workPlace">
{locale === 'TKM'
? 'Iş ýeriňizi dolduryň'
: locale === 'РУС'
? 'Заполните место работы'
: locale === 'ENG'
? 'Fill the place of work'
: 'Iş ýeriňizi dolduryň'}
{locale === "TKM"
? "Iş ýeriňizi dolduryň"
: locale === "РУС"
? "Заполните место работы"
: locale === "ENG"
? "Fill the place of work"
: "Iş ýeriňizi dolduryň"}
</label>
<input type="text" id="workPlace" {...register('workPlace')} />
<input type="text" id="workPlace" {...register("workPlace")} />
</div>
<div className="input-block">
<label htmlFor="workPosition">
{locale === 'TKM'
? 'Wezipäňizi dolduryň'
: locale === 'РУС'
? 'Заполните должность'
: locale === 'ENG'
? 'Fill the position'
: 'Wezipäňizi dolduryň'}
{locale === "TKM"
? "Wezipäňizi dolduryň"
: locale === "РУС"
? "Заполните должность"
: locale === "ENG"
? "Fill the position"
: "Wezipäňizi dolduryň"}
</label>
<input type="text" id="workPosition" {...register('workPosition')} />
<input
type="text"
id="workPosition"
{...register("workPosition")}
/>
</div>
</div>
<div className="cu-bottom cd-2-title">
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(3)}>
<button
type="button"
className="sign-btn reg-btn"
onClick={() => setStage(4)}
>
<div>
<div className="btn-img">
<img src={next_reverse} alt="logout" />
</div>
<h3>
{locale === 'TKM'
? 'Yza'
: locale === 'РУС'
? 'Назад'
: locale === 'ENG'
? 'Back'
: 'Yza'}
{locale === "TKM"
? "Yza"
: locale === "РУС"
? "Назад"
: locale === "ENG"
? "Back"
: "Yza"}
</h3>
</div>
</button>
<button type="button" className="sign-btn cu-btn" onClick={() => setStage(7)}>
<button
type="button"
className="sign-btn cu-btn"
onClick={() => setStage(7)}
>
<div>
<h3>
{locale === 'TKM'
? 'Dowam et'
: locale === 'РУС'
? 'Подтвердить '
: locale === 'ENG'
? 'Proceed'
: 'Dowam et'}
{locale === "TKM"
? "Dowam et"
: locale === "РУС"
? "Подтвердить "
: locale === "ENG"
? "Proceed"
: "Dowam et"}
</h3>
<div className="btn-img">
<img src={next} alt="logout" />

View File

@ -1,13 +1,13 @@
// IMPORT MODULES
import React, { useState, useContext } from 'react';
import { LanguageContext } from '../../backend/LanguageContext';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import React, { useState, useContext } from "react";
import { LanguageContext } from "../../backend/LanguageContext";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
// IMPORT IMAGES
import next from '../../icons/next.svg';
import next_reverse from '../../icons/next-reverse.svg';
import Select from '../global/Select';
import next from "../../icons/next.svg";
import next_reverse from "../../icons/next-reverse.svg";
import Select from "../global/Select";
// const schema = z.object({
// passportNumber: z
@ -24,18 +24,18 @@ import Select from '../global/Select';
// });
const IDSerias = [
'I-AS',
'I-AH',
'I-BN',
'I-LB',
'I-MR',
'I-DZ',
'II-AS',
'II-AH',
'II-BN',
'II-LB',
'II-MR',
'II-DZ',
"I-AS",
"I-AH",
"I-BN",
"I-LB",
"I-MR",
"I-DZ",
"II-AS",
"II-AH",
"II-BN",
"II-LB",
"II-MR",
"II-DZ",
];
const GuaranterStage = ({
@ -44,6 +44,8 @@ const GuaranterStage = ({
setGuaranterData,
setSignGuaranter,
setErrMessage,
setErrMessageEn,
setErrMessageTkm,
borrowerData,
}) => {
const { locale } = useContext(LanguageContext);
@ -52,9 +54,9 @@ const GuaranterStage = ({
const [err, setErr] = useState(false);
const [errCode, setErrCode] = useState();
const [idSerial, setIdSerial] = useState('I-AS');
const [passportNumber, setPassportNumber] = useState('');
const [accNumber, setAccNumber] = useState('');
const [idSerial, setIdSerial] = useState("I-AS");
const [passportNumber, setPassportNumber] = useState("");
const [accNumber, setAccNumber] = useState("");
const handlePassportNumber = (e) => {
setPassportNumber(e.target.value);
@ -77,19 +79,19 @@ const GuaranterStage = ({
const response = await fetch(
`https://shahsyotag.halkbank.gov.tm/onlineloan-services/api/clientinfo`,
{
method: 'POST',
method: "POST",
headers: {
'Content-Type': 'application/json',
"Content-Type": "application/json",
},
body: JSON.stringify({
idSeria: idSeria,
idNo: idNo,
accountNo: accountNo,
clientType: 'guarantor',
clientType: "guarantor",
signRecipient: signRecipient,
availableAmount: borrowerData.availableAmount,
}),
},
}
);
if (!response.ok) {
@ -111,9 +113,14 @@ const GuaranterStage = ({
if (responseJson.errCode === 0) {
setStage(5);
} else if (responseJson.errCode !== 0) {
setErrMessage(responseJson.messageRu);
setErrMessageEn(responseJson.messageEn);
setErrMessageTkm(responseJson.message);
setStage(6);
}
} catch (error) {
setIsLoading(false);
console.error(error.toString());
// Handle errors as needed
setErr(true);
@ -128,14 +135,14 @@ const GuaranterStage = ({
return (
<section className="loading">
<h1 className="cs-2-title">
{' '}
{locale === 'TKM'
? 'Garaşmagyňyzy haýyş edýäris ...'
: locale === 'РУС'
? 'Пожалуйста, подождите...'
: locale === 'ENG'
? 'Please wait...'
: 'Garaşmagyňyzy haýyş edýäris ...'}
{" "}
{locale === "TKM"
? "Garaşmagyňyzy haýyş edýäris ..."
: locale === "РУС"
? "Пожалуйста, подождите..."
: locale === "ENG"
? "Please wait..."
: "Garaşmagyňyzy haýyş edýäris ..."}
</h1>
</section>
);
@ -145,44 +152,44 @@ const GuaranterStage = ({
<section className="imm-cs-1 cs-1">
<form onSubmit={handleSubmit(onSubmit)}>
<h2 className="cs-2-title">
{locale === 'TKM'
? 'Zamunçynyň maglumtlaryny tassyklaň'
: locale === 'РУС'
? 'Заполните данные поручителя'
: locale === 'ENG'
? 'Confirm the guarantors details'
: 'Zamunçynyň maglumtlaryny tassyklaň'}
{locale === "TKM"
? "Zamunçynyň maglumatlaryny dolduryň"
: locale === "РУС"
? "Заполните данные поручителя"
: locale === "ENG"
? "Fill in the guarantors details"
: "Zamunçynyň maglumatlaryny dolduryň"}
</h2>
<div className="imm-credit-form-wrapper">
<Select
items={IDSerias}
customId={'card'}
blockName={'card-1-select'}
elName={'card-1-select-el'}
name={'passportSerial'}
customId={"card"}
blockName={"card-1-select"}
elName={"card-1-select-el"}
name={"passportSerial"}
eTarget={true}
register={register}
label={
locale === 'TKM'
? 'Pasportyň seriýasy'
: locale === 'РУС'
? 'Серия паспорта'
: locale === 'ENG'
? 'Passport Series'
: 'Pasportyň seriýasy'
locale === "TKM"
? "Pasportyň seriýasy"
: locale === "РУС"
? "Серия паспорта"
: locale === "ENG"
? "Passport Series"
: "Pasportyň seriýasy"
}
stateSetter={setIdSerial}
/>
<div className="input-block">
<label htmlFor="passport-number">
{locale === 'TKM'
? 'Pasportyň belgisi'
: locale === 'РУС'
? 'Номер паспорта'
: locale === 'ENG'
? 'Passport number'
: 'Pasportyň belgisi'}
{locale === "TKM"
? "Pasportyň belgisi"
: locale === "РУС"
? "Номер паспорта"
: locale === "ENG"
? "Passport number"
: "Pasportyň belgisi"}
</label>
<input
// {...register("passportNumber", { valueAsNumber: true })}
@ -197,13 +204,13 @@ const GuaranterStage = ({
</div>
<div className="input-block">
<label htmlFor="bank-acc">
{locale === 'TKM'
? 'Aýlyk kartyň hasaby'
: locale === 'РУС'
? 'Счет зарплатной карты'
: locale === 'ENG'
? 'Salary card account'
: 'Aýlyk kartyň hasaby'}
{locale === "TKM"
? "Aýlyk kartyň hasaby"
: locale === "РУС"
? "Счет зарплатной карты"
: locale === "ENG"
? "Salary card account"
: "Aýlyk kartyň hasaby"}
</label>
<input
// {...register("bankAccount", { valueAsNumber: true })}
@ -217,35 +224,44 @@ const GuaranterStage = ({
</div>
<div className="cu-bottom cd-2-title">
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(2)}>
<button
type="button"
className="sign-btn reg-btn"
onClick={() => setStage(2)}
>
<div>
<div className="btn-img">
<img src={next_reverse} alt="logout" />
</div>
<h3>
{locale === 'TKM'
? 'Yza'
: locale === 'РУС'
? 'Назад'
: locale === 'ENG'
? 'Back'
: 'Yza'}
{locale === "TKM"
? "Yza"
: locale === "РУС"
? "Назад"
: locale === "ENG"
? "Back"
: "Yza"}
</h3>
</div>
</button>
<button
type="submit"
disabled={passportNumber.length === 6 && accNumber.length === 23 ? false : true}
className="sign-btn cu-btn">
disabled={
passportNumber.length === 6 && accNumber.length === 23
? false
: true
}
className="sign-btn cu-btn"
>
<div>
<h3>
{locale === 'TKM'
? 'Dowam et'
: locale === 'РУС'
? 'Подтвердить '
: locale === 'ENG'
? 'Proceed'
: 'Dowam et'}
{locale === "TKM"
? "Dowam et"
: locale === "РУС"
? "Подтвердить "
: locale === "ENG"
? "Proceed"
: "Dowam et"}
</h3>
<div className="btn-img">
<img src={next} alt="logout" />

View File

@ -1,10 +1,16 @@
import React, { useContext } from 'react';
import { LanguageContext } from '../../backend/LanguageContext';
import React, { useContext } from "react";
import { LanguageContext } from "../../backend/LanguageContext";
import next from '../../icons/next.svg';
import next_reverse from '../../icons/next-reverse.svg';
import next from "../../icons/next.svg";
import next_reverse from "../../icons/next-reverse.svg";
const NotAUser = ({ setStage, stage, errMessage }) => {
const NotAUser = ({
setStage,
stage,
errMessage,
errMessageEn,
errMessageTkm,
}) => {
const { locale } = useContext(LanguageContext);
return (
@ -12,32 +18,33 @@ const NotAUser = ({ setStage, stage, errMessage }) => {
<form>
<h2 className="notauser-title">
{errMessage
? locale === 'TKM'
? 'Karzyň kalkulýatory'
: locale === 'РУС'
? locale === "TKM"
? errMessageTkm
: locale === "РУС"
? errMessage
: locale === 'ENG'
? 'Loan calculator'
: 'Karzyň kalkulýatory'
: 'Ошибка'}
: locale === "ENG"
? errMessageEn
: errMessageTkm
: "Ошибка"}
</h2>
<div className="cu-bottom cd-2-title">
<button
type="button"
className="sign-btn reg-btn"
onClick={() => setStage((stage) => stage - 2)}>
onClick={() => setStage((stage) => stage - 2)}
>
<div>
<div className="btn-img">
<img src={next_reverse} alt="logout" />
</div>
<h3>
{locale === 'TKM'
? 'Yza'
: locale === 'РУС'
? 'Назад'
: locale === 'ENG'
? 'Back'
: 'Yza'}
{locale === "TKM"
? "Yza"
: locale === "РУС"
? "Назад"
: locale === "ENG"
? "Back"
: "Yza"}
</h3>
</div>
</button>

View File

@ -1,13 +1,13 @@
// IMPORT MODULES
import React, { useState, useContext, useEffect } from 'react';
import { LanguageContext } from '../../backend/LanguageContext';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import React, { useState, useContext, useEffect } from "react";
import { LanguageContext } from "../../backend/LanguageContext";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
// IMPORT IMAGES
import next from '../../icons/next.svg';
import next_reverse from '../../icons/next-reverse.svg';
import CardDetails from './CardDetails';
import next from "../../icons/next.svg";
import next_reverse from "../../icons/next-reverse.svg";
import CardDetails from "./CardDetails";
// import arrow from "../../icons/arrow.svg";
const schema = z.object({
@ -21,17 +21,17 @@ const PaymentDetails = ({
borrowerData,
setSumbitCardDetails,
paymentLink,
setInvalidData,
}) => {
const { locale } = useContext(LanguageContext);
const [invalidData, setInvalidData] = useState(false);
const [timeLeft, setTimeLeft] = useState(paymentDetails['remaining-time']);
const [timeLeft, setTimeLeft] = useState(paymentDetails["remaining-time"]);
const [paymentName, setPaymentName] = useState('');
const [paymentCard, setPaymentCard] = useState('');
const [paymentCv, setPaymentCv] = useState('');
const [paymentCardDurationYear, setPaymentCardDurationYear] = useState('');
const [paymentCardDurationMonth, setPaymentCardDurationMonth] = useState('');
const [paymentName, setPaymentName] = useState("");
const [paymentCard, setPaymentCard] = useState("");
const [paymentCv, setPaymentCv] = useState("");
const [paymentCardDurationYear, setPaymentCardDurationYear] = useState("");
const [paymentCardDurationMonth, setPaymentCardDurationMonth] = useState("");
const handlePaymentCard = (e) => {
setPaymentCard(e.target.value);
@ -62,26 +62,31 @@ const PaymentDetails = ({
const sendPaymentRequest = async () => {
try {
const headers = {
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
};
const formData = new URLSearchParams();
formData.append('app', 'sanlykarz');
formData.append('id', borrowerData.idNo);
formData.append('md-order', paymentDetails['md-order']);
formData.append('card-number', paymentCard.toString());
formData.append("app", "sanlykarz");
formData.append("id", borrowerData.idNo);
formData.append("md-order", paymentDetails["md-order"]);
formData.append("card-number", paymentCard.toString());
formData.append(
'card-expiry',
'20' + paymentCardDurationYear.toString() + paymentCardDurationMonth.toString(),
"card-expiry",
"20" +
paymentCardDurationYear.toString() +
paymentCardDurationMonth.toString()
);
formData.append('name-on-card', paymentName);
formData.append('card-cvc', paymentCv.toString());
formData.append("name-on-card", paymentName);
formData.append("card-cvc", paymentCv.toString());
const response = await fetch('https://shahsyotag.halkbank.gov.tm/api/v1/submit-card', {
method: 'POST',
headers: headers,
body: formData.toString(),
});
const response = await fetch(
"https://shahsyotag.halkbank.gov.tm/api/v1/submit-card",
{
method: "POST",
headers: headers,
body: formData.toString(),
}
);
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
@ -89,14 +94,14 @@ const PaymentDetails = ({
const jsonedResponse = await response.json();
if (jsonedResponse.status === 'other-error') {
setInvalidData(true);
} else if (jsonedResponse.status === 'ok') {
if (jsonedResponse.status === "ok") {
setSumbitCardDetails(jsonedResponse);
setInvalidData(false);
setStage(14);
} else {
setInvalidData(false);
setStage(12);
setInvalidData(true);
}
// setIsLoading(false);
@ -126,46 +131,46 @@ const PaymentDetails = ({
<section className="imm-cs-1 cs-1">
<form onSubmit={handleSubmit(onSubmit)}>
<h2 className="cs-2-title">
{locale === 'TKM'
? 'Töleg üçin kartyň maglumatlaryny giriziň'
: locale === 'РУС'
? 'Введите данные карты для оплаты'
: locale === 'ENG'
? 'Enter card details for payment'
: 'Töleg üçin kartyň maglumatlaryny giriziň'}
{locale === "TKM"
? "Töleg üçin kartyň maglumatlaryny giriziň"
: locale === "РУС"
? "Введите данные карты для оплаты"
: locale === "ENG"
? "Enter card details for payment"
: "Töleg üçin kartyň maglumatlaryny giriziň"}
</h2>
<div className="payment-details">
<h2>
{locale === 'TKM'
? 'Tölemeli mukdar:'
: locale === 'РУС'
? 'Сумма к оплате:'
: locale === 'ENG'
? 'Amount to pay:'
: 'Tölemeli mukdar:'}
{paymentDetails['amount-info']}
{locale === "TKM"
? "Tölemeli mukdar:"
: locale === "РУС"
? "Сумма к оплате:"
: locale === "ENG"
? "Amount to pay:"
: "Tölemeli mukdar:"}
{paymentDetails["amount-info"]}
</h2>
<h2>
{locale === 'TKM'
? 'Wagt galdy:'
: locale === 'РУС'
? 'Оставшееся время:'
: locale === 'ENG'
? 'Time left:'
: 'Wagt galdy:'}
{locale === "TKM"
? "Wagt galdy:"
: locale === "РУС"
? "Оставшееся время:"
: locale === "ENG"
? "Time left:"
: "Wagt galdy:"}
{Math.floor((timeLeft % 3600) / 60)}:{timeLeft % 60}
</h2>
</div>
<div className="imm-credit-form-wrapper">
<div className="input-block">
<label htmlFor="card">
{locale === 'TKM'
? 'Kartyň ýüzünde görkezilen ady, familiýasyny giriziň'
: locale === 'РУС'
? 'Имя и фамилия, указанные на карте'
: locale === 'ENG'
? 'Enter first name and last name indicated on the card'
: 'Kartyň ýüzünde görkezilen ady, familiýasyny giriziň'}
{locale === "TKM"
? "Kartyň ýüzünde görkezilen ady, familiýasyny giriziň"
: locale === "РУС"
? "Имя и фамилия, указанные на карте"
: locale === "ENG"
? "Enter first name and last name indicated on the card"
: "Kartyň ýüzünde görkezilen ady, familiýasyny giriziň"}
</label>
<input
value={paymentName}
@ -178,13 +183,13 @@ const PaymentDetails = ({
</div>
<div className="input-block">
<label htmlFor="card">
{locale === 'TKM'
? 'Kart belgesi'
: locale === 'РУС'
? 'Номер карты'
: locale === 'ENG'
? 'Card number'
: 'Kart belgesi'}
{locale === "TKM"
? "Kart belgisi"
: locale === "РУС"
? "Номер карты"
: locale === "ENG"
? "Card number"
: "Kart belgisi"}
</label>
<input
value={paymentCard}
@ -195,16 +200,16 @@ const PaymentDetails = ({
/>
{/* {errors.code && <span>{errors.code.message}</span>} */}
</div>
{paymentDetails['is-cvc-required'] && (
{paymentDetails["is-cvc-required"] && (
<div className="input-block">
<label htmlFor="cvc">
{locale === 'TKM'
? 'KArtyň CVC'
: locale === 'РУС'
? 'CVC карты'
: locale === 'ENG'
{locale === "TKM"
? "Kartyň CVC"
: locale === "РУС"
? "CVC карты"
: locale === "ENG"
? "Card's CVC"
: 'KArtyň CVC'}
: "Kartyň CVC"}
</label>
<input
value={paymentCv}
@ -221,13 +226,13 @@ const PaymentDetails = ({
<div className="input-block">
<label htmlFor="duration-month">
{locale === 'TKM'
? 'Kartyň möhleti (aý)'
: locale === 'РУС'
? 'Срок годности карты (месяц)'
: locale === 'ENG'
? 'Card expiration date (month)'
: 'Kartyň möhleti (aý)'}
{locale === "TKM"
? "Kartyň möhleti (aý)"
: locale === "РУС"
? "Срок годности карты (месяц)"
: locale === "ENG"
? "Card expiration date (month)"
: "Kartyň möhleti (aý)"}
</label>
<input
value={paymentCardDurationMonth}
@ -240,13 +245,13 @@ const PaymentDetails = ({
</div>
<div className="input-block">
<label htmlFor="duration-year">
{locale === 'TKM'
? 'Kartyň möhleti (ýyl)'
: locale === 'РУС'
? 'Срок годности карты (год)'
: locale === 'ENG'
? 'Card expiration date (year)'
: 'Kartyň möhleti (ýyl)'}
{locale === "TKM"
? "Kartyň möhleti (ýyl)"
: locale === "РУС"
? "Срок годности карты (год)"
: locale === "ENG"
? "Card expiration date (year)"
: "Kartyň möhleti (ýyl)"}
</label>
<input
value={paymentCardDurationYear}
@ -258,33 +263,25 @@ const PaymentDetails = ({
{/* {errors.code && <span>{errors.code.message}</span>} */}
</div>
</div>
{invalidData && (
<section className="imm-cs-1 cs-1">
<h1 className="cs-2-title">
{locale === 'TKM'
? 'Roralňyşlyk, maglumatlary barlaň'
: locale === 'РУС'
? 'Ошибка, проверьте данные'
: locale === 'ENG'
? 'Card expiration date (year)'
: 'Roralňyşlyk, maglumatlary barlaň'}
</h1>
</section>
)}
<div className="cu-bottom cd-2-title">
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(12)}>
<button
type="button"
className="sign-btn reg-btn"
onClick={() => setStage(12)}
>
<div>
<div className="btn-img">
<img src={next_reverse} alt="logout" />
</div>
<h3>
{locale === 'TKM'
? 'Yza'
: locale === 'РУС'
? 'Назад'
: locale === 'ENG'
? 'Back'
: 'Yza'}
{locale === "TKM"
? "Yza"
: locale === "РУС"
? "Назад"
: locale === "ENG"
? "Back"
: "Yza"}
</h3>
</div>
</button>
@ -303,16 +300,17 @@ const PaymentDetails = ({
}
type="submit"
className="sign-btn cu-btn"
onClick={() => onSubmit()}>
onClick={() => onSubmit()}
>
<div>
<h3>
{locale === 'TKM'
? 'Dowam et'
: locale === 'РУС'
? 'Подтвердить '
: locale === 'ENG'
? 'Proceed'
: 'Dowam et'}
{locale === "TKM"
? "Dowam et"
: locale === "РУС"
? "Подтвердить "
: locale === "ENG"
? "Proceed"
: "Dowam et"}
</h3>
<div className="btn-img">
<img src={next} alt="logout" />

View File

@ -1,9 +1,9 @@
import React, { useContext, useState } from 'react';
import { LanguageContext } from '../../backend/LanguageContext';
import React, { useContext, useState } from "react";
import { LanguageContext } from "../../backend/LanguageContext";
import next from '../../icons/next.svg';
import next_reverse from '../../icons/next-reverse.svg';
import { UserContext } from '../../backend/UserContext';
import next from "../../icons/next.svg";
import next_reverse from "../../icons/next-reverse.svg";
import { UserContext } from "../../backend/UserContext";
const PaymentSuccess = ({
setStage,
@ -14,11 +14,14 @@ const PaymentSuccess = ({
recepientAmount,
creditDuration,
setErrMessage,
setAcceptedMessage,
setAcceptedMessageEn,
setAcceptedMessageTkm,
}) => {
const { locale } = useContext(LanguageContext);
const { user } = useContext(UserContext);
const [codeValue, setPhoneValue] = useState('');
const [codeValue, setPhoneValue] = useState("");
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState(false);
@ -30,15 +33,18 @@ const PaymentSuccess = ({
const confirmCode = async () => {
try {
setIsLoading(true);
const response = await fetch('https://shahsyotag.halkbank.gov.tm/validateOTP', {
headers: { 'Content-Type': 'aplication/json' },
method: 'POST',
const response = await fetch(
"https://shahsyotag.halkbank.gov.tm/validateOTP",
{
headers: { "Content-Type": "aplication/json" },
method: "POST",
body: JSON.stringify({
phone_number: user.mobile_phone,
otp: codeValue,
}),
});
body: JSON.stringify({
phone_number: user.mobile_phone,
otp: codeValue,
}),
}
);
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
@ -46,7 +52,7 @@ const PaymentSuccess = ({
const jsonedResponse = await response.json();
if (jsonedResponse === 'OTP validated successfully') {
if (jsonedResponse === "OTP validated successfully") {
fetchData();
setIsLoading(false);
}
@ -58,9 +64,9 @@ const PaymentSuccess = ({
const response = await fetch(
`https://shahsyotag.halkbank.gov.tm/onlineloancre-services/api/loancre`,
{
method: 'POST',
method: "POST",
headers: {
'Content-Type': 'application/json',
"Content-Type": "application/json",
},
body: JSON.stringify({
clientRecipient: {
@ -70,7 +76,7 @@ const PaymentSuccess = ({
name: borrowerData.name,
surname: borrowerData.surname,
availableAmount: borrowerData.availableAmount,
clientType: 'recipient',
clientType: "recipient",
signRecipient: borrowerData.signRecipient,
},
clientGuarantor: isGuranter
@ -81,7 +87,7 @@ const PaymentSuccess = ({
name: guaranterData.name,
surname: guaranterData.surname,
availableAmount: guaranterData.availableAmount,
clientType: 'guarantor',
clientType: "guarantor",
signGuarantor: guaranterData.signGuarantor,
}
: null,
@ -90,7 +96,7 @@ const PaymentSuccess = ({
mrtIsInsuarance: isGuranter ? 0 : 1,
termInYears: creditDuration,
}),
},
}
);
if (!response.ok) {
@ -100,6 +106,9 @@ const PaymentSuccess = ({
const responseJson = await response.json();
if (responseJson.errCode === 0) {
setAcceptedMessage(responseJson.messageRu);
setAcceptedMessageEn(responseJson.messageEn);
setAcceptedMessageTkm(responseJson.message);
setStage(16);
} else {
setErrMessage(responseJson.messageRu);
@ -120,14 +129,14 @@ const PaymentSuccess = ({
return (
<section className="loading">
<h1 className="cs-2-title">
{' '}
{locale === 'TKM'
? 'Garaşmagyňyzy haýyş edýäris ...'
: locale === 'РУС'
? 'Пожалуйста, подождите...'
: locale === 'ENG'
? 'Please wait...'
: 'Garaşmagyňyzy haýyş edýäris ...'}
{" "}
{locale === "TKM"
? "Garaşmagyňyzy haýyş edýäris ..."
: locale === "РУС"
? "Пожалуйста, подождите..."
: locale === "ENG"
? "Please wait..."
: "Garaşmagyňyzy haýyş edýäris ..."}
</h1>
</section>
);
@ -137,35 +146,40 @@ const PaymentSuccess = ({
<section className="imm-cs-1 cs-1">
<form>
<h2 className="succes-title">
{locale === 'TKM'
? 'Karz karty açmak üçin tölegiňiz üstünlikli geçdi we arzaňyz kabul edildi '
: locale === 'РУС'
? 'Оплата прошла успешно, заявка на оформление кредитной карты принята.'
: locale === 'ENG'
? 'To complete the application for a Digital loan, enter the SMS code sent to the number'
: 'Karz karty açmak üçin tölegiňiz üstünlikli geçdi we arzaňyz kabul edildi '}
{locale === "TKM"
? "Karz karty açmak üçin tölegiňiz üstünlikli geçdi we arzaňyz kabul edildi "
: locale === "РУС"
? "Оплата прошла успешно, заявка на оформление кредитной карты принята."
: locale === "ENG"
? "To complete the application for a Digital loan, enter the SMS code sent to the number"
: "Karz karty açmak üçin tölegiňiz üstünlikli geçdi we arzaňyz kabul edildi "}
</h2>
<h3 className="succes-sub-title">
{locale === 'TKM'
? 'Sanly karz ýüz tutmaňyzy doly tamamlamak üçin siziň telefon belgiňize gelen SMS kody giriziň'
: locale === 'РУС'
? 'Для завершения оформления заявки на получение быстрого кредита введите СМС код, отправленный на номер …..'
: locale === 'ENG'
? 'To complete the application for a Digital loan, enter the SMS code sent to the number'
: 'Sanly karz ýüz tutmaňyzy doly tamamlamak üçin siziň telefon belgiňize gelen SMS kody giriziň'}
{locale === "TKM"
? "Sanly karz ýüz tutmaňyzy doly tamamlamak üçin siziň telefon belgiňize gelen SMS kody giriziň"
: locale === "РУС"
? "Для завершения оформления заявки на получение быстрого кредита введите СМС код, отправленный на номер ….."
: locale === "ENG"
? "To complete the application for a Digital loan, enter the SMS code sent to the number"
: "Sanly karz ýüz tutmaňyzy doly tamamlamak üçin siziň telefon belgiňize gelen SMS kody giriziň"}
</h3>
<div className="imm-credit-form-wrapper">
<div className="input-block">
<label htmlFor="code">
{locale === 'TKM'
? 'At'
: locale === 'РУС'
? 'Код'
: locale === 'ENG'
? 'amount'
: 'At'}
{locale === "TKM"
? "Kod"
: locale === "РУС"
? "Код"
: locale === "ENG"
? "Code"
: "Kod"}
</label>
<input value={codeValue} onChange={handleCodeChange} type="text" id="code" />
<input
value={codeValue}
onChange={handleCodeChange}
type="text"
id="code"
/>
{/* <span className="another-option" onClick={codeResend}>
Отправить код снова
</span> */}
@ -173,19 +187,23 @@ const PaymentSuccess = ({
</div>
</div>
<div className="cu-bottom cd-2-title">
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(14)}>
<button
type="button"
className="sign-btn reg-btn"
onClick={() => setStage(14)}
>
<div>
<div className="btn-img">
<img src={next_reverse} alt="logout" />
</div>
<h3>
{locale === 'TKM'
? 'Yza'
: locale === 'РУС'
? 'Назад'
: locale === 'ENG'
? 'Back'
: 'Yza'}
{locale === "TKM"
? "Yza"
: locale === "РУС"
? "Назад"
: locale === "ENG"
? "Back"
: "Yza"}
</h3>
</div>
</button>
@ -193,16 +211,17 @@ const PaymentSuccess = ({
disabled={codeValue.length !== 6 && !isLoading ? true : false}
type="submit"
onClick={onSubmit}
className="sign-btn cu-btn">
className="sign-btn cu-btn"
>
<div>
<h3>
{locale === 'TKM'
? 'Dowam et'
: locale === 'РУС'
? 'Подтвердить '
: locale === 'ENG'
? 'Proceed'
: 'Dowam et'}
{locale === "TKM"
? "Dowam et"
: locale === "РУС"
? "Подтвердить "
: locale === "ENG"
? "Proceed"
: "Dowam et"}
</h3>
<div className="btn-img">
<img src={next} alt="logout" />

View File

@ -1,13 +1,13 @@
// IMPORT MODULES
import React, { useState, useContext } from 'react';
import { LanguageContext } from '../../backend/LanguageContext';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import React, { useState, useContext } from "react";
import { LanguageContext } from "../../backend/LanguageContext";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
// IMPORT IMAGES
import next from '../../icons/next.svg';
import next_reverse from '../../icons/next-reverse.svg';
import { UserContext } from '../../backend/UserContext';
import next from "../../icons/next.svg";
import next_reverse from "../../icons/next-reverse.svg";
import { UserContext } from "../../backend/UserContext";
// import arrow from "../../icons/arrow.svg";
const schema = z.object({
@ -33,7 +33,7 @@ const PhoneAccept = ({
}) => {
const { locale } = useContext(LanguageContext);
const { user } = useContext(UserContext);
const userToken = localStorage.getItem('userToken');
const userToken = localStorage.getItem("userToken");
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState(false);
@ -41,9 +41,9 @@ const PhoneAccept = ({
const [invalidData, setInvalidData] = useState(false);
const [tryAgain, setTryAgain] = useState(false);
const [codeValue, setPhoneValue] = useState('');
const [codeValue, setPhoneValue] = useState("");
const [errMesage, setErrMessage] = useState();
const [errMessage, setErrMessage] = useState();
const handleCodeChange = (e) => {
setPhoneValue(e.target.value);
@ -58,23 +58,26 @@ const PhoneAccept = ({
const confirmPayment = async () => {
try {
const headers = {
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
};
const formData = new URLSearchParams();
formData.append('app', 'sanlykarz');
formData.append('id', borrowerData.idNo);
formData.append('md-order', paymentDetails['md-order']);
formData.append('acs-req-id', submitCardDetails['acs-request-id']);
formData.append('acs-session-url', submitCardDetails['acs-session-url']);
formData.append('otp', codeValue);
formData.append('term-url', submitCardDetails['terminate-url']);
formData.append("app", "sanlykarz");
formData.append("id", borrowerData.idNo);
formData.append("md-order", paymentDetails["md-order"]);
formData.append("acs-req-id", submitCardDetails["acs-request-id"]);
formData.append("acs-session-url", submitCardDetails["acs-session-url"]);
formData.append("otp", codeValue);
formData.append("term-url", submitCardDetails["terminate-url"]);
const response = await fetch('https://shahsyotag.halkbank.gov.tm/api/v1/confirm-payment', {
method: 'POST',
headers: headers,
body: formData.toString(),
});
const response = await fetch(
"https://shahsyotag.halkbank.gov.tm/api/v1/confirm-payment",
{
method: "POST",
headers: headers,
body: formData.toString(),
}
);
const jsonedResponse = await response.json();
@ -82,13 +85,16 @@ const PhoneAccept = ({
throw new Error(`HTTP error! Status: ${response.status}`);
}
if (jsonedResponse.status === 'ok' && jsonedResponse['final-url'].includes('status=1')) {
console.log(jsonedResponse['final-url']);
if (
jsonedResponse.status === "ok" &&
jsonedResponse["final-url"].includes("status=1")
) {
console.log(jsonedResponse["final-url"]);
setInvalidData(false);
checkPayment();
} else if (
jsonedResponse.status === 'wrong-otp' ||
!jsonedResponse['final-url'].includes('status=1')
jsonedResponse.status === "wrong-otp" ||
!jsonedResponse["final-url"].includes("status=1")
) {
setTryAgain(true);
} else {
@ -100,7 +106,7 @@ const PhoneAccept = ({
const checkPayment = async () => {
try {
const response = await fetch(
`https://shahsyotag.halkbank.gov.tm/app/api/check-payment-credit-card?paymentId=${paymentLink.id}&orderId=${paymentDetails['md-order']}&status=1`,
`https://shahsyotag.halkbank.gov.tm/app/api/check-payment-credit-card?paymentId=${paymentLink.id}&orderId=${paymentDetails["md-order"]}&status=1`
);
if (!response.ok) {
@ -109,8 +115,8 @@ const PhoneAccept = ({
const jsonedResponse = await response.json();
if (jsonedResponse.status.ErrorCode === '0') {
console.log('success');
if (jsonedResponse.status.ErrorCode === "0") {
console.log("success");
loanCreateCheck();
}
} catch (error) {
@ -121,12 +127,12 @@ const PhoneAccept = ({
const loanCreateCheck = async () => {
try {
const response = await fetch(
'https://shahsyotag.halkbank.gov.tm/onlineloancre-services/api/loancre/check',
"https://shahsyotag.halkbank.gov.tm/onlineloancre-services/api/loancre/check",
{
method: 'POST',
method: "POST",
headers: {
Accept: 'application/json, text/plain',
'Content-Type': 'application/json;charset=UTF-8',
Accept: "application/json, text/plain",
"Content-Type": "application/json;charset=UTF-8",
},
body: JSON.stringify({
clientRecipient: {
@ -136,7 +142,7 @@ const PhoneAccept = ({
name: borrowerData.name,
surname: borrowerData.surname,
availableAmount: borrowerData.availableAmount,
clientType: 'recipient',
clientType: "recipient",
signRecipient: borrowerData.signRecipient,
},
clientGuarantor: isGuranter
@ -147,7 +153,7 @@ const PhoneAccept = ({
name: guaranterData.name,
surname: guaranterData.surname,
availableAmount: guaranterData.availableAmount,
clientType: 'guarantor',
clientType: "guarantor",
signGuarantor: guaranterData.signGuarantor,
}
: null,
@ -156,7 +162,7 @@ const PhoneAccept = ({
mrtIsInsuarance: isGuranter ? 0 : 1,
termInYears: creditDuration,
}),
},
}
);
if (!response.ok) {
@ -174,18 +180,21 @@ const PhoneAccept = ({
};
const sendCode = async () => {
console.log('startred');
try {
const response = await fetch('https://shahsyotag.halkbank.gov.tm/sendOTP', {
method: 'POST',
headers: { 'Content-Type': 'aplication/json' },
body: JSON.stringify({
phone_number: user.mobile_phone,
}),
});
const response = await fetch(
"https://shahsyotag.halkbank.gov.tm/sendOTP",
{
method: "POST",
headers: { "Content-Type": "aplication/json" },
body: JSON.stringify({
phone_number: user.mobile_phone,
}),
}
);
if (!response.ok) {
setErrMessage(response.status);
setError(true);
throw new Error(`HTTP error! Status: ${response.status}`);
}
@ -200,19 +209,22 @@ const PhoneAccept = ({
const confirmCode = async () => {
try {
setIsLoading(true);
const response = await fetch('https://shahsyotag.halkbank.gov.tm/validateOTP', {
headers: { 'Content-Type': 'aplication/json' },
method: 'POST',
const response = await fetch(
"https://shahsyotag.halkbank.gov.tm/validateOTP",
{
headers: { "Content-Type": "aplication/json" },
method: "POST",
body: JSON.stringify({
phone_number: user.mobile_phone,
otp: codeValue,
}),
});
body: JSON.stringify({
phone_number: user.mobile_phone,
otp: codeValue,
}),
}
);
const jsonedResponse = await response.json();
if (jsonedResponse === 'OTP validated successfully') {
if (jsonedResponse === "OTP validated successfully") {
loanCreate();
} else {
setErrMessage(true);
@ -225,9 +237,9 @@ const PhoneAccept = ({
const response = await fetch(
`https://shahsyotag.halkbank.gov.tm/onlineloancre-services/api/loancre`,
{
method: 'POST',
method: "POST",
headers: {
'Content-Type': 'application/json',
"Content-Type": "application/json",
},
body: JSON.stringify({
clientRecipient: {
@ -237,7 +249,7 @@ const PhoneAccept = ({
name: borrowerData.name,
surname: borrowerData.surname,
availableAmount: borrowerData.availableAmount,
clientType: 'recipient',
clientType: "recipient",
signRecipient: borrowerData.signRecipient,
},
clientGuarantor: isGuranter
@ -248,7 +260,7 @@ const PhoneAccept = ({
name: guaranterData.name,
surname: guaranterData.surname,
availableAmount: guaranterData.availableAmount,
clientType: 'guarantor',
clientType: "guarantor",
signGuarantor: guaranterData.signGuarantor,
}
: null,
@ -257,7 +269,7 @@ const PhoneAccept = ({
mrtIsInsuarance: isGuranter ? 0 : 1,
termInYears: creditDuration,
}),
},
}
);
if (!response.ok) {
@ -282,22 +294,25 @@ const PhoneAccept = ({
const sendData = async (requestBody) => {
try {
const headers = {
Accept: 'application/json',
'Content-Type': 'application/json',
Accept: "application/json",
"Content-Type": "application/json",
Authorization: `Bearer ${userToken}`,
};
const response = await fetch('https://shahsyotag.halkbank.gov.tm/app/api/quick_loans', {
method: 'POST',
headers: headers,
body: JSON.stringify({
sign: requestBody.sign,
where_works: recipientWorkPlace,
position: recipientWorkPosition,
mobile_phone: user.mobile_phone,
name: borrowerData.name,
surname: borrowerData.surname,
}),
});
const response = await fetch(
"https://shahsyotag.halkbank.gov.tm/app/api/quick_loans",
{
method: "POST",
headers: headers,
body: JSON.stringify({
sign: requestBody.sign,
where_works: recipientWorkPlace,
position: recipientWorkPosition,
mobile_phone: user.mobile_phone,
name: borrowerData.name,
surname: borrowerData.surname,
}),
}
);
const jsonedResponse = await response.json();
if (!cardDetails) {
@ -325,36 +340,49 @@ const PhoneAccept = ({
return (
<section className="loading">
<h1 className="cs-2-title">
{' '}
{locale === 'TKM'
? 'Garaşmagyňyzy haýyş edýäris ...'
: locale === 'РУС'
? 'Пожалуйста, подождите...'
: locale === 'ENG'
? 'Please wait...'
: 'Garaşmagyňyzy haýyş edýäris ...'}
{locale === "TKM"
? "Garaşmagyňyzy haýyş edýäris ..."
: locale === "РУС"
? "Пожалуйста, подождите..."
: locale === "ENG"
? "Please wait..."
: "Garaşmagyňyzy haýyş edýäris ..."}
</h1>
</section>
);
}
if (errMesage) {
if (error) {
return (
<section className="imm-cs-1 cs-1">
<h1 className="cs-2-title">Error...</h1>
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(8)}>
<section className="cs-1 err-section">
<h1 className="cs-2-title">
{errMessage}
{locale === "TKM"
? "Bir zat ýalňyş ..."
: locale === "РУС"
? " Ошибка..."
: locale === "ENG"
? " Error..."
: " Bir zat ýalňyş ..."}
</h1>
<br />
<button
type="button"
className="sign-btn reg-btn"
onClick={() => setStage(8)}
>
<div>
<div className="btn-img">
<img src={next_reverse} alt="logout" />
</div>
<h3>
{locale === 'TKM'
? 'Yza'
: locale === 'РУС'
? 'Назад'
: locale === 'ENG'
? 'Back'
: 'Yza'}
{locale === "TKM"
? "Yza"
: locale === "РУС"
? "Назад"
: locale === "ENG"
? "Back"
: "Yza"}
</h3>
</div>
</button>
@ -366,34 +394,47 @@ const PhoneAccept = ({
<section className="imm-cs-1 cs-1">
<form onSubmit={handleSubmit(onSubmit)}>
<h2 className="cs-2-title">
{locale === 'TKM'
{locale === "TKM"
? `${
cardDetails ? user.mobile_phone : submitCardDetails['three-d-secure-number']
cardDetails
? user.mobile_phone
: submitCardDetails["three-d-secure-number"]
} Karz ýüzlenmäni tassyklamak üçin belgä iberilen SMS duýduryş koduny giriziň`
: locale === 'РУС'
: locale === "РУС"
? `Для подтверждения кредитной заявки, введите код с СМС оповещения, отправленный на номер ${
cardDetails ? user.mobile_phone : submitCardDetails['three-d-secure-number']
cardDetails
? user.mobile_phone
: submitCardDetails["three-d-secure-number"]
}`
: locale === 'ENG'
: locale === "ENG"
? `To confirm the loan application enter the SMS alert code sent to the number ${
cardDetails ? user.mobile_phone : submitCardDetails['three-d-secure-number']
cardDetails
? user.mobile_phone
: submitCardDetails["three-d-secure-number"]
}`
: `${
cardDetails ? user.mobile_phone : submitCardDetails['three-d-secure-number']
cardDetails
? user.mobile_phone
: submitCardDetails["three-d-secure-number"]
} Karz ýüzlenmäni tassyklamak üçin belgä iberilen SMS duýduryş koduny giriziň`}
</h2>
<div className="imm-credit-form-wrapper">
<div className="input-block">
<label htmlFor="code">
{locale === 'TKM'
? 'Kod'
: locale === 'РУС'
? 'Код'
: locale === 'ENG'
? 'Code'
: 'Kod'}
{locale === "TKM"
? "Kod"
: locale === "РУС"
? "Код"
: locale === "ENG"
? "Code"
: "Kod"}
</label>
<input value={codeValue} onChange={handleCodeChange} type="text" id="code" />
<input
value={codeValue}
onChange={handleCodeChange}
type="text"
id="code"
/>
{/* <span className="another-option" onClick={codeResend}>
Отправить код снова
</span> */}
@ -403,27 +444,27 @@ const PhoneAccept = ({
{invalidData && (
<section className=" cs-1">
<h1 className="cs-2-title">
{locale === 'TKM'
? 'Roralňyşlyk, maglumatlary barlaň'
: locale === 'РУС'
? 'Ошибка, проверьте данные'
: locale === 'ENG'
? 'Error, check data'
: 'Roralňyşlyk, maglumatlary barlaň'}
{locale === "TKM"
? "Ýalňyş, maglumatlary barlaň"
: locale === "РУС"
? "Ошибка, проверьте данные"
: locale === "ENG"
? "Error, check data"
: "Ýalňyş, maglumatlary barlaň"}
</h1>
</section>
)}
{tryAgain && (
<section className="imm-cs-1 cs-1">
<h1 className="cs-2-title">
{' '}
{locale === 'TKM'
? 'Gaýtadan iberip görüň'
: locale === 'РУС'
? 'Попробуйте отправить снова'
: locale === 'ENG'
? 'Try sending again'
: 'Gaýtadan iberip görüň'}
{" "}
{locale === "TKM"
? "Gaýtadan iberip görüň"
: locale === "РУС"
? "Попробуйте отправить снова"
: locale === "ENG"
? "Try sending again"
: "Gaýtadan iberip görüň"}
</h1>
</section>
)}
@ -431,19 +472,20 @@ const PhoneAccept = ({
<button
type="submit"
className="sign-btn reg-btn"
onClick={() => (cardDetails ? setStage(8) : setStage(13))}>
onClick={() => (cardDetails ? setStage(8) : setStage(13))}
>
<div>
<div className="btn-img">
<img src={next_reverse} alt="logout" />
</div>
<h3>
{locale === 'TKM'
? 'Yza'
: locale === 'РУС'
? 'Назад'
: locale === 'ENG'
? 'Back'
: 'Yza'}
{locale === "TKM"
? "Yza"
: locale === "РУС"
? "Назад"
: locale === "ENG"
? "Back"
: "Yza"}
</h3>
</div>
</button>
@ -459,16 +501,17 @@ const PhoneAccept = ({
}
type="submit"
onClick={onSubmit}
className="sign-btn cu-btn">
className="sign-btn cu-btn"
>
<div>
<h3>
{locale === 'TKM'
? 'Dowam et'
: locale === 'РУС'
? 'Подтвердить '
: locale === 'ENG'
? 'Proceed'
: 'Dowam et'}
{locale === "TKM"
? "Dowam et"
: locale === "РУС"
? "Подтвердить "
: locale === "ENG"
? "Proceed"
: "Dowam et"}
</h3>
<div className="btn-img">
<img src={next} alt="logout" />

View File

@ -51,7 +51,12 @@ const ImmediateCreditModal = ({
const [error, setError] = useState();
const [errMessage, setErrMessage] = useState('');
const [errMessageEn, setErrMessageEn] = useState('');
const [errMessageTkm, setErrMessageTkm] = useState('');
const [acceptedMessage, setAcceptedMessage] = useState('');
const [acceptedMessageEn, setAcceptedMessageEn] = useState('');
const [acceptedMessageTkm, setAcceptedMessageTkm] = useState('');
const [borrowerData, setBorrowerData] = useState();
const [guaranterData, setGuaranterData] = useState();
@ -73,7 +78,7 @@ const ImmediateCreditModal = ({
const [recipientWorkPlace, setRecipientWorkPlace] = useState('');
const [recipientWorkPosition, setRecipientWorkPosition] = useState('');
console.log('stage', stage);
const [invalidData, setInvalidData] = useState(false);
return (
<section className={modalOpen ? 'modal credit-modal active' : 'modal credit-modal'}>
@ -101,111 +106,73 @@ const ImmediateCreditModal = ({
</div>
<div className="modal-middle modal-middle-digital-loan">
{stage < 12 ? (
<div className="icon-block active">
<Img4 className="modal-icon" />
<h3 className="icon-title">
{locale === 'TKM'
? 'Maglumatlary dolduryň'
: locale === 'РУС'
? 'Заполните данные'
: locale === 'ENG'
? 'Fill in the details'
: 'Maglumatlary dolduryň'}
</h3>
</div>
<div className={stage > 1 ? 'line-block active' : 'line-block'}>
<Lines className="lines" />
</div>
<div className={stage > 1 ? 'icon-block active' : 'icon-block'}>
<Img3 className="modal-icon" />
<h3 className="icon-title">
{locale === 'TKM'
? 'Şahsy maglumatlaryňyzy tassyklaň'
: locale === 'РУС'
? 'Подтвердите личные данные'
: locale === 'ENG'
? 'Confirm your Personal data'
: 'Şahsy maglumatlaryňyzy tassyklaň'}
</h3>
</div>
<div className={stage > 1 ? 'line-block active' : 'line-block'}>
<Lines className="lines" />
</div>
{isGuranter && (
<>
<div className="icon-block active">
<div className={stage > 3 ? 'icon-block active' : 'icon-block'}>
<Img4 className="modal-icon" />
<h3 className="icon-title">
{locale === 'TKM'
? 'Maglumatlary dolduryň'
? 'Zamunçynyň maglumatlaryny dolduryň'
: locale === 'РУС'
? 'Заполните данные'
? 'Заполните данные поручителя'
: locale === 'ENG'
? 'Fill in the details'
: 'Maglumatlary dolduryň'}
? "Fill in the guarantor's details"
: 'Zamunçynyň maglumatlaryny dolduryň'}
</h3>
</div>
<div className={stage > 1 ? 'line-block active' : 'line-block'}>
<div className={stage > 3 ? 'line-block active' : 'line-block'}>
<Lines className="lines" />
</div>
<div className={stage > 1 ? 'icon-block active' : 'icon-block'}>
<div className={stage > 4 ? 'icon-block active' : 'icon-block'}>
<Img3 className="modal-icon" />
<h3 className="icon-title">
{locale === 'TKM'
? 'Şahsy maglumatlaryňyzy tassyklaň'
? 'Zamunçynyň maglumatlaryny tassyklaň'
: locale === 'РУС'
? 'Подтвердите личные данные'
? 'Подтвердите данные поручителя'
: locale === 'ENG'
? 'Confirm your personal details'
: 'Şahsy maglumatlaryňyzy tassyklaň'}
? "Confirm the guarantor's details"
: 'Zamunçynyň maglumatlaryny tassyklaň'}
</h3>
</div>
<div className={stage > 1 ? 'line-block active' : 'line-block'}>
<Lines className="lines" />
</div>
{isGuranter && (
<>
<div className={stage > 3 ? 'icon-block active' : 'icon-block'}>
<Img4 className="modal-icon" />
<h3 className="icon-title">
{locale === 'TKM'
? 'Zamunçynyň maglumatlaryny dolduryň'
: locale === 'РУС'
? 'Заполните данные поручителя'
: locale === 'ENG'
? "Fill in the guarantor's details"
: 'Zamunçynyň maglumatlaryny dolduryň'}
</h3>
</div>
<div className={stage > 3 ? 'line-block active' : 'line-block'}>
<Lines className="lines" />
</div>
<div className={stage > 4 ? 'icon-block active' : 'icon-block'}>
<Img3 className="modal-icon" />
<h3 className="icon-title">
{locale === 'TKM'
? 'Zamunçynyň maglumatlaryny tassyklaň'
: locale === 'РУС'
? 'Подтвердите данные поручителя'
: locale === 'ENG'
? "Confirm the guarantor's details"
: 'Zamunçynyň maglumatlaryny tassyklaň'}
</h3>
</div>
<div className={stage > 3 ? 'line-block active' : 'line-block'}>
<Lines className="lines" />
</div>
</>
)}
<div className={stage > 6 ? 'icon-block active' : 'icon-block'}>
<Img2 className="modal-icon" />
<h3 className="icon-title">
{locale === 'TKM'
? 'Karz kalkulýatory'
: locale === 'РУС'
? 'Калькулятор кредита'
: locale === 'ENG'
? 'Loan calculator'
: 'Karz kalkulýatory'}
</h3>
</div>
<div className={stage > 6 ? 'line-block active' : 'line-block'}>
<Lines className="lines" />
</div>
<div className={stage > 7 ? 'icon-block active' : 'icon-block'}>
<Img6 className="modal-icon" />
<h3 className="icon-title">
{locale === 'TKM'
? 'Karz maglumatlaryňyzy tassyklaň'
: locale === 'РУС'
? 'Подтвердите данные кредита'
: locale === 'ENG'
? 'Confirm your loan details'
: 'Karz maglumatlaryňyzy tassyklaň'}
</h3>
</div>
<div className={stage > 7 ? 'line-block active' : 'line-block'}>
<div className={stage > 3 ? 'line-block active' : 'line-block'}>
<Lines className="lines" />
</div>
@ -222,39 +189,53 @@ const ImmediateCreditModal = ({
</h3>
</div>
</>
) : (
<>
<div className="icon-block active">
<Img4 className="modal-icon" />
<h3 className="icon-title">
{locale === 'TKM'
? 'Maglumatlary dolduryň'
: locale === 'РУС'
? 'Заполните данные'
: locale === 'ENG'
? 'Fill in the details'
: 'Maglumatlary dolduryň'}
</h3>
</div>
<div className={stage > 11 ? 'line-block active' : 'line-block'}>
<Lines className="lines" />
</div>
<div className={stage > 12 ? 'icon-block active' : 'icon-block'}>
<Img3 className="modal-icon" />
<h3 className="icon-title">
{locale === 'TKM'
? 'Şahsy maglumatlaryňyzy tassyklaň'
: locale === 'РУС'
? 'Подтвердите личные данные'
: locale === 'ENG'
? 'Confirm your personal details'
: 'Şahsy maglumatlaryňyzy tassyklaň'}
</h3>
</div>
</>
)}
<div className={stage > 6 ? 'icon-block active' : 'icon-block'}>
<Img2 className="modal-icon" />
<h3 className="icon-title">
{locale === 'TKM'
? 'Karz kalkulýatory'
: locale === 'РУС'
? 'Калькулятор кредита'
: locale === 'ENG'
? 'Loan calculator'
: 'Karz kalkulýatory'}
</h3>
</div>
<div className={stage > 6 ? 'line-block active' : 'line-block'}>
<Lines className="lines" />
</div>
<div className={stage > 7 ? 'icon-block active' : 'icon-block'}>
<Img6 className="modal-icon" />
<h3 className="icon-title">
{locale === 'TKM'
? 'Karz maglumatlaryňyzy tassyklaň'
: locale === 'РУС'
? 'Подтвердите данные кредита'
: locale === 'ENG'
? 'Confirm your loan personal data'
: 'Karz maglumatlaryňyzy tassyklaň'}
</h3>
</div>
<div className={stage > 7 ? 'line-block active' : 'line-block'}>
<Lines className="lines" />
</div>
<div className={stage > 8 ? 'icon-block active' : 'icon-block'}>
<Img5 className="modal-icon" />
<h3 className="icon-title">
{locale === 'TKM'
? 'Karz ýüzlenmesini tassyklaň'
: locale === 'РУС'
? 'Подтвердите кредитную заявку'
: locale === 'ENG'
? 'Confirm your loan application'
: 'Karz ýüzlenmesini tassyklaň'}
</h3>
</div>
</div>
<div className="modal-middle modal-middle-mobile">
@ -282,7 +263,7 @@ const ImmediateCreditModal = ({
: locale === 'РУС'
? 'Подтвердите личные данные'
: locale === 'ENG'
? 'Confirm your personal details'
? 'Confirm your Personal data'
: 'Şahsy maglumatlaryňyzy tassyklaň'}
</h3>
</div>
@ -389,7 +370,7 @@ const ImmediateCreditModal = ({
: locale === 'РУС'
? 'Подтвердите личные данные'
: locale === 'ENG'
? 'Confirm your personal details'
? 'Confirm your Personal data'
: 'Şahsy maglumatlaryňyzy tassyklaň'}
</h3>
</div>
@ -438,6 +419,8 @@ const ImmediateCreditModal = ({
setMaxAmount={setMaxAmount}
setRecepientAmount={setRecepientAmount}
setErrMessage={setErrMessage}
setErrMessageEn={setErrMessageEn}
setErrMessageTkm={setErrMessageTkm}
/>
) : stage === 2 ? (
<BorrowerInfo
@ -450,7 +433,13 @@ const ImmediateCreditModal = ({
recipientWorkPosition={recipientWorkPosition}
/>
) : stage === 3 ? (
<NotAUser setStage={setStage} stage={stage} errMessage={errMessage} />
<NotAUser
setStage={setStage}
stage={stage}
errMessage={errMessage}
errMessageEn={errMessageEn}
errMessageTkm={errMessageTkm}
/>
) : stage === 4 ? (
<GuaranterStage
setStage={setStage}
@ -459,9 +448,11 @@ const ImmediateCreditModal = ({
guaranterData={guaranterData}
setGuaranterData={setGuaranterData}
signRecipient={signRecipient}
setErrMessage={setErrMessage}
setSignGuaranter={setSignGuaranter}
borrowerData={borrowerData}
setErrMessage={setErrMessage}
setErrMessageEn={setErrMessageEn}
setErrMessageTkm={setErrMessageTkm}
/>
) : stage === 5 ? (
<GuaranterInfo
@ -470,7 +461,13 @@ const ImmediateCreditModal = ({
guaranterData={guaranterData}
/>
) : stage === 6 ? (
<NotAUser setStage={setStage} stage={stage} errMessage={errMessage} />
<NotAUser
setStage={setStage}
stage={stage}
errMessage={errMessage}
errMessageEn={errMessageEn}
errMessageTkm={errMessageTkm}
/>
) : stage === 7 ? (
<CalculateStage
isGuranter={isGuranter}
@ -494,9 +491,11 @@ const ImmediateCreditModal = ({
borrowerData={borrowerData}
guaranterData={guaranterData}
isGuranter={isGuranter}
setErrMessage={setErrMessage}
setUserDataRes={setUserDataRes}
userDataRes={userDataRes}
setErrMessage={setErrMessage}
setErrMessageEn={setErrMessageEn}
setErrMessageTkm={setErrMessageTkm}
/>
) : stage === 9 ? (
<PhoneAccept
@ -511,7 +510,13 @@ const ImmediateCreditModal = ({
recipientWorkPosition={recipientWorkPosition}
/>
) : stage === 10 ? (
<NotAUser setStage={setStage} stage={stage} errMessage={errMessage} />
<NotAUser
setStage={setStage}
stage={stage}
errMessage={errMessage}
errMessageEn={errMessageEn}
errMessageTkm={errMessageTkm}
/>
) : stage === 11 ? (
<LoanAccepted
setModalOpen={setModalOpen}
@ -527,6 +532,7 @@ const ImmediateCreditModal = ({
setPaymentLink={setPaymentLink}
paymentLink={paymentLink}
setPaymentDetails={setPaymentDetails}
invalidData={invalidData}
/>
) : stage === 13 ? (
<PaymentDetails
@ -535,6 +541,7 @@ const ImmediateCreditModal = ({
paymentDetails={paymentDetails}
borrowerData={borrowerData}
setSumbitCardDetails={setSumbitCardDetails}
setInvalidData={setInvalidData}
/>
) : stage === 14 ? (
<PhoneAccept
@ -556,9 +563,17 @@ const ImmediateCreditModal = ({
recepientAmount={recepientAmount}
creditDuration={creditDuration}
setErrMessage={setErrMessage}
setAcceptedMessage={setAcceptedMessage}
setAcceptedMessageEn={setAcceptedMessageEn}
setAcceptedMessageTkm={setAcceptedMessageTkm}
/>
) : stage === 16 ? (
<FinalStage setModalOpen={setModalOpen} />
<FinalStage
setModalOpen={setModalOpen}
acceptedMessage={acceptedMessage}
acceptedMessageEn={acceptedMessageEn}
acceptedMessageTkm={acceptedMessageTkm}
/>
) : (
''
)}

View File

@ -75,6 +75,11 @@
}
}
.input-block-hidden {
visibility: hidden;
pointer-events: none;
}
.phone-starter {
position: relative;
width: 100%;
@ -198,6 +203,15 @@
grid-template-columns: repeat(13, 1fr);
}
.err-section {
max-width: 400px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin: 0 auto;
}
@media (max-width: 1300px) {
.modal-middle-digital-loan {
display: none;
@ -207,4 +221,8 @@
display: flex;
flex-direction: column;
}
.input-block-hidden {
display: none;
}
}