type, region, branch localized added

This commit is contained in:
VividTruthKeeper 2022-05-06 01:22:42 +05:00
parent 4378946f43
commit 7dc48daf3f
4 changed files with 73 additions and 15 deletions

View File

@ -301,7 +301,7 @@ const CardStage3 = ({ setStage, data, setData }) => {
region: inputLocal.region,
region_localized: inputValid.region,
branch: inputLocal.affiliate,
branch_localized: inputLocal.affiliate,
branch_localized: inputValid.affiliate,
date_arrival_bank: inputValid.date,
selected_time: inputValid.time,
the_codeword: inputValid.code,

View File

@ -93,11 +93,11 @@ const CardStage6 = ({
</li>
<li>
<p>{locale === "TKM" ? "Welaýat" : "Регион"}:</p>
<h4>{data.region ? data.region : "-"}</h4>
<h4>{data.region_localized ? data.region_localized : "-"}</h4>
</li>
<li>
<p>{locale === "TKM" ? "Filial" : "Филиал"}:</p>
<h4>{data.branch ? data.branch : "-"}</h4>
<h4>{data.branch_localized ? data.branch_localized : "-"}</h4>
</li>
<li>
<p>

View File

@ -18,6 +18,11 @@ const CreditStage4 = ({ setStage, data, setData }) => {
salary: data.salary ? data.salary : null,
position: data.position ? data.position : null,
experience: data.exp ? data.exp : null,
region: data.region_localized ? data.region_localized : null,
affiliate: data.branch_localized ? data.branch_localized : null,
});
const [inputLocal, setInputLocal] = useState({
region: data.region ? data.region : null,
affiliate: data.branch ? data.branch : null,
});
@ -121,9 +126,22 @@ const CreditStage4 = ({ setStage, data, setData }) => {
placeholder={
locale === "TKM" ? "Welaýaty saýlaň" : "Выберите регион"
}
stateSetter={(state) =>
setInputValid({ ...inputValid, region: state })
}
stateSetter={(state) => {
setInputValid({ ...inputValid, region: state });
if (state) {
const index = branch.regions.RUS.findIndex(
(e) => e === state
);
if (index === -1) {
setInputLocal({ ...inputLocal, region: state });
} else {
setInputLocal({
...inputLocal,
region: branch.regions.TKM[index],
});
}
}
}}
eTarget={true}
defaultValue={inputValid.region}
/>
@ -170,15 +188,53 @@ const CreditStage4 = ({ setStage, data, setData }) => {
customId={"affiliate"}
blockName={"card-3-select"}
elName={"card-3-select-el"}
defaultValue={inputValid.affiliate}
name={"affiliate"}
placeholder={
locale === "TKM" ? "Filialy saýlaň" : "Выберите филиал"
}
stateSetter={(state) =>
setInputValid({ ...inputValid, affiliate: state })
}
stateSetter={(state) => {
setInputValid({ ...inputValid, affiliate: state });
if (state && inputLocal.region) {
console.log(inputLocal.region);
let index;
if (inputLocal.region === "Aşgabat şäheri") {
index = branch["Ashgabat"].RUS.findIndex(
(e) => e === state
);
} else if (inputLocal.region === "Daşoguz") {
index = branch["Dashoguz"].RUS.findIndex(
(e) => e === state
);
} else {
index = branch[inputLocal.region].RUS.findIndex(
(e) => e === state
);
}
if (index === -1) {
setInputLocal({ ...inputLocal, affiliate: state });
} else {
if (inputLocal.region === "Aşgabat şäheri") {
setInputLocal({
...inputLocal,
affiliate: branch["Ashgabat"].TKM[index],
});
} else if (inputLocal.region === "Daşoguz") {
setInputLocal({
...inputLocal,
affiliate: branch["Dashoguz"].TKM[index],
});
} else {
setInputLocal({
...inputLocal,
affiliate: branch[inputLocal.region].TKM[index],
});
}
}
}
}}
eTarget={true}
defaultValue={inputValid.affiliate}
/>
</div>
</div>
@ -212,11 +268,13 @@ const CreditStage4 = ({ setStage, data, setData }) => {
setData({
...data,
workplace: inputValid.workplace,
region: inputValid.region,
region: inputLocal.region,
region_localized: inputValid.region,
branch: inputLocal.affiliate,
branch_localized: inputValid.affiliate,
exp: inputValid.experience,
position: inputValid.position,
salary: inputValid.salary,
branch: inputValid.affiliate,
});
}}
>

View File

@ -29,7 +29,7 @@ const CreditStage6 = ({
const token = localStorage.getItem("userToken");
const postUrl = destination + "/online_credit";
const getUrl = destination + "/me";
console.log(data);
return (
<section className="card-stage-6">
<div className="cd-6-top">
@ -84,11 +84,11 @@ const CreditStage6 = ({
</li>
<li>
<p>{locale === "TKM" ? "Welaýat" : "Регион"}:</p>
<h4>{data.region ? data.region : "-"}</h4>
<h4>{data.region_localized ? data.region_localized : "-"}</h4>
</li>
<li>
<p>{locale === "TKM" ? "Filial" : "Филиал"}:</p>
<h4>{data.branch ? data.branch : "-"}</h4>
<h4>{data.branch_localized ? data.branch_localized : "-"}</h4>
</li>
<li>
<p>{locale === "TKM" ? "Iş ýeri" : "Место работы"}:</p>