commit
This commit is contained in:
parent
57a85471c0
commit
6b6e126bfb
|
|
@ -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({
|
||||
|
|
@ -41,12 +41,12 @@ const AcceptStage = ({
|
|||
} = useForm({
|
||||
resolver: zodResolver(schema),
|
||||
defaultValues: {
|
||||
amount: recepientAmount ? recepientAmount : 'Loading',
|
||||
duration: creditDuration ? creditDuration : 'loading',
|
||||
amount: recepientAmount ? recepientAmount : "Loading",
|
||||
duration: creditDuration ? creditDuration : "loading",
|
||||
},
|
||||
});
|
||||
|
||||
console.log(borrowerData);
|
||||
// console.log(borrowerData);
|
||||
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
|
|
@ -93,11 +93,11 @@ const AcceptStage = ({
|
|||
// },
|
||||
// );
|
||||
const response = await fetch(
|
||||
`http://shahsyotag.halkbank.gov.tm/onlineloancre-services/api/loancre`,
|
||||
`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: {
|
||||
|
|
@ -107,7 +107,7 @@ const AcceptStage = ({
|
|||
name: borrowerData.name,
|
||||
surname: borrowerData.surname,
|
||||
availableAmount: borrowerData.availableAmount,
|
||||
clientType: 'recipient',
|
||||
clientType: "recipient",
|
||||
signRecipient: borrowerData.signRecipient,
|
||||
},
|
||||
clientGuarantor: isGuranter
|
||||
|
|
@ -118,7 +118,7 @@ const AcceptStage = ({
|
|||
name: guaranterData.name,
|
||||
surname: guaranterData.surname,
|
||||
availableAmount: guaranterData.availableAmount,
|
||||
clientType: 'guarantor',
|
||||
clientType: "guarantor",
|
||||
signRecipient: guaranterData.signRecipient,
|
||||
}
|
||||
: null,
|
||||
|
|
@ -127,7 +127,7 @@ const AcceptStage = ({
|
|||
mrtIsInsuarance: isGuranter ? 1 : 0,
|
||||
termInYears: creditDuration,
|
||||
}),
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
|
|
@ -136,7 +136,7 @@ const AcceptStage = ({
|
|||
|
||||
const responseJson = await response.json();
|
||||
|
||||
console.log(responseJson);
|
||||
console.log("RESPONSE!!!! ", responseJson);
|
||||
|
||||
setIsLoading(false);
|
||||
} catch (error) {
|
||||
|
|
@ -156,19 +156,23 @@ const AcceptStage = ({
|
|||
<section className="imm-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)}>
|
||||
<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>
|
||||
|
|
@ -189,50 +193,55 @@ const AcceptStage = ({
|
|||
<section className="imm-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="amount">
|
||||
{locale === 'TKM'
|
||||
? 'At'
|
||||
: locale === 'РУС'
|
||||
? 'Сумма'
|
||||
: locale === 'ENG'
|
||||
? 'amount'
|
||||
: 'At'}
|
||||
{locale === "TKM"
|
||||
? "At"
|
||||
: locale === "РУС"
|
||||
? "Сумма"
|
||||
: locale === "ENG"
|
||||
? "amount"
|
||||
: "At"}
|
||||
</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'
|
||||
? 'At'
|
||||
: locale === 'РУС'
|
||||
? 'Срок'
|
||||
: locale === 'ENG'
|
||||
? 'duration'
|
||||
: 'At'}
|
||||
{locale === "TKM"
|
||||
? "At"
|
||||
: locale === "РУС"
|
||||
? "Срок"
|
||||
: locale === "ENG"
|
||||
? "duration"
|
||||
: "At"}
|
||||
</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'
|
||||
? 'At'
|
||||
: locale === 'РУС'
|
||||
? 'Номер карты'
|
||||
: locale === 'ENG'
|
||||
? 'amount'
|
||||
: 'At'}
|
||||
{locale === "TKM"
|
||||
? "At"
|
||||
: locale === "РУС"
|
||||
? "Номер карты"
|
||||
: locale === "ENG"
|
||||
? "amount"
|
||||
: "At"}
|
||||
</label>
|
||||
<input
|
||||
value={cardDetails}
|
||||
|
|
@ -246,19 +255,23 @@ const AcceptStage = ({
|
|||
</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 +279,17 @@ const AcceptStage = ({
|
|||
type="submit"
|
||||
className="sign-btn cu-btn"
|
||||
disabled={cardDetails.length !== 16 && !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