translation fix
This commit is contained in:
parent
b18157b68d
commit
b5b4e5a312
|
|
@ -1,17 +1,22 @@
|
|||
// 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,
|
||||
}) => {
|
||||
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 +28,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 +61,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 +82,7 @@ const CardRegistration = ({ borrowerData, setStage, setPaymentLink, setPaymentDe
|
|||
dep_code: borrowerData.depCode,
|
||||
address: address,
|
||||
}),
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
|
|
@ -97,19 +102,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 +145,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 +174,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 +191,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"
|
||||
? "To open the credit card, please confirm the personal details "
|
||||
: "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"
|
||||
? "At"
|
||||
: locale === "РУС"
|
||||
? "Имя"
|
||||
: locale === "ENG"
|
||||
? "Name"
|
||||
: "At"}
|
||||
</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 ýyly"
|
||||
: locale === "РУС"
|
||||
? "Год рождения"
|
||||
: locale === "ENG"
|
||||
? "Year of birth"
|
||||
: "Doglan ýyly"}
|
||||
</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 +329,41 @@ 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>
|
||||
|
||||
<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 +371,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" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue