new region

This commit is contained in:
VividTruthKeeper 2023-09-09 01:25:30 +05:00
parent 2a2bbb5049
commit 8221884c79
7 changed files with 417 additions and 310 deletions

34
package-lock.json generated
View File

@ -12,6 +12,7 @@
"@testing-library/react": "12.1.2",
"@testing-library/user-event": "13.5.0",
"axios": "^0.26.0",
"node": "^14.15.1",
"node-sass": "^7.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
@ -11725,6 +11726,26 @@
"tslib": "^2.0.3"
}
},
"node_modules/node": {
"version": "14.15.1",
"resolved": "https://registry.npmjs.org/node/-/node-14.15.1.tgz",
"integrity": "sha512-BeTf2muiTEC7o3w0sUJ83GHORQ+FLNZCouQUM3VJk3LKf1keQ6ldghELrOo6nBUNZBBS5I++pgDSYPhHWcpp8w==",
"hasInstallScript": true,
"dependencies": {
"node-bin-setup": "^1.0.0"
},
"bin": {
"node": "bin/node"
},
"engines": {
"npm": ">=5.0.0"
}
},
"node_modules/node-bin-setup": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/node-bin-setup/-/node-bin-setup-1.1.3.tgz",
"integrity": "sha512-opgw9iSCAzT2+6wJOETCpeRYAQxSopqQ2z+N6BXwIMsQQ7Zj5M8MaafQY8JMlolRR6R1UXg2WmhKp0p9lSOivg=="
},
"node_modules/node-forge": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.2.1.tgz",
@ -25879,6 +25900,19 @@
"tslib": "^2.0.3"
}
},
"node": {
"version": "14.15.1",
"resolved": "https://registry.npmjs.org/node/-/node-14.15.1.tgz",
"integrity": "sha512-BeTf2muiTEC7o3w0sUJ83GHORQ+FLNZCouQUM3VJk3LKf1keQ6ldghELrOo6nBUNZBBS5I++pgDSYPhHWcpp8w==",
"requires": {
"node-bin-setup": "^1.0.0"
}
},
"node-bin-setup": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/node-bin-setup/-/node-bin-setup-1.1.3.tgz",
"integrity": "sha512-opgw9iSCAzT2+6wJOETCpeRYAQxSopqQ2z+N6BXwIMsQQ7Zj5M8MaafQY8JMlolRR6R1UXg2WmhKp0p9lSOivg=="
},
"node-forge": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.2.1.tgz",

View File

@ -7,6 +7,7 @@
"@testing-library/react": "12.1.2",
"@testing-library/user-event": "13.5.0",
"axios": "^0.26.0",
"node": "^14.15.1",
"node-sass": "^7.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",

View File

@ -34,18 +34,45 @@ const CardStage3 = ({ setStage, data, setData }) => {
useEffect(() => {
if (
inputValid.region &&
inputValid.affiliate &&
inputValid.date &&
inputValid.time &&
inputValid.code
inputValid.region === branch.regions.TKM[6] ||
inputValid.region === branch.regions.RUS[6] ||
inputValid.region === branch.regions.ENG[6]
) {
setBtnEnabled(true);
if (
inputValid.region &&
inputValid.date &&
inputValid.time &&
inputValid.code
) {
setBtnEnabled(true);
} else {
setBtnEnabled(false);
}
} else {
setBtnEnabled(false);
if (
inputValid.region &&
inputValid.affiliate &&
inputValid.date &&
inputValid.time &&
inputValid.code
) {
setBtnEnabled(true);
} else {
setBtnEnabled(false);
}
}
}, [inputValid]);
useEffect(() => {
if (
inputValid.region === branch.regions.TKM[6] ||
inputValid.region === branch.regions.RUS[6] ||
inputValid.region === branch.regions.ENG[6]
) {
setInputValid({ ...inputValid, affiliate: null });
}
}, [inputValid.region]);
return (
<section className="card-stage-3">
<form>
@ -107,156 +134,162 @@ const CardStage3 = ({ setStage, data, setData }) => {
defaultValue={inputValid.region}
/>
</div>
<div className="input-block">
<label htmlFor="affiliate">
{locale === "TKM"
? "Şahamça"
: locale === "РУС"
? "Филиал"
: locale === "ENG"
? "Branch"
: "Şahamça"}
<span>*</span>
</label>
<CustomSelect
items={
inputValid.region === "Город Ашхабад" ||
inputValid.region === "Ashgabat city" ||
inputValid.region === "Aşgabat şäheri"
? locale === "TKM"
? branch.Ashgabat.TKM
: locale === "РУС"
? branch.Ashgabat.RUS
: locale === "ENG"
? branch.Ashgabat.ENG
: branch.Ashgabat.TKM
: inputValid.region === "Ахалский регион" ||
inputValid.region === "Akhal region" ||
inputValid.region === "Ahal"
? locale === "TKM"
? branch.Ahal.TKM
: locale === "РУС"
? branch.Ahal.RUS
: locale === "ENG"
? branch.Ahal.ENG
: branch.Ahal.TKM
: inputValid.region === "Балканский регион" ||
inputValid.region === "Balkan region" ||
inputValid.region === "Balkan"
? locale === "TKM"
? branch.Balkan.TKM
: locale === "РУС"
? branch.Balkan.RUS
: locale === "ENG"
? branch.Balkan.ENG
: branch.Balkan.TKM
: inputValid.region === "Дашогузский регион" ||
inputValid.region === "Dashoguz region" ||
inputValid.region === "Daşoguz"
? locale === "TKM"
? branch.Dashoguz.TKM
: locale === "РУС"
? branch.Dashoguz.RUS
: locale === "ENG"
? branch.Dashoguz.ENG
: branch.Dashoguz.TKM
: inputValid.region === "Лебапский регион" ||
inputValid.region === "Lebap region" ||
inputValid.region === "Lebap"
? locale === "TKM"
? branch.Lebap.TKM
: locale === "РУС"
? branch.Lebap.RUS
: locale === "ENG"
? branch.Lebap.ENG
: branch.Lebap.TKM
: inputValid.region === "Марыйский регион" ||
inputValid.region === "Mary region" ||
inputValid.region === "Mary"
? locale === "TKM"
? branch.Mary.TKM
: locale === "РУС"
? branch.Mary.RUS
: locale === "ENG"
? branch.Mary.ENG
: branch.Mary.TKM
: [""]
}
customId={"affiliate"}
blockName={"card-3-select"}
elName={"card-3-select-el"}
name={"affiliate"}
placeholder={
locale === "TKM"
? "Şahamçany saýlaň"
: locale === "РУС"
? "Выберите филиал"
: locale === "ENG"
? "Choose branch"
: "Şahamçany saýlaň"
}
stateSetter={(state) => {
setInputValid({ ...inputValid, affiliate: state });
if (state && inputLocal.region) {
let index;
if (inputLocal.region === "Aşgabat şäheri") {
if (locale === "РУС") {
index = branch["Ashgabat"].RUS.findIndex(
(e) => e === state
);
} else if (locale === "ENG") {
index = branch["Ashgabat"].ENG.findIndex(
(e) => e === state
);
}
} else if (inputLocal.region === "Daşoguz") {
if (locale === "РУС") {
index = branch["Dashoguz"].RUS.findIndex(
(e) => e === state
);
} else if (locale === "ENG") {
index = branch["Dashoguz"].ENG.findIndex(
(e) => e === state
);
}
} else {
if (locale === "РУС") {
index = branch[inputLocal.region].RUS.findIndex(
(e) => e === state
);
} else if (locale === "ENG") {
index = branch[inputLocal.region].ENG.findIndex(
(e) => e === state
);
}
}
if (index === -1) {
setInputLocal({ ...inputLocal, affiliate: state });
} else {
{inputValid.region !== branch.regions.TKM[6] &&
inputValid.region !== branch.regions.RUS[6] &&
inputValid.region !== branch.regions.ENG[6] ? (
<div className="input-block">
<label htmlFor="affiliate">
{locale === "TKM"
? "Şahamça"
: locale === "РУС"
? "Филиал"
: locale === "ENG"
? "Branch"
: "Şahamça"}
<span>*</span>
</label>
<CustomSelect
items={
inputValid.region === "Город Ашхабад" ||
inputValid.region === "Ashgabat city" ||
inputValid.region === "Aşgabat şäheri"
? locale === "TKM"
? branch.Ashgabat.TKM
: locale === "РУС"
? branch.Ashgabat.RUS
: locale === "ENG"
? branch.Ashgabat.ENG
: branch.Ashgabat.TKM
: inputValid.region === "Ахалский регион" ||
inputValid.region === "Akhal region" ||
inputValid.region === "Ahal"
? locale === "TKM"
? branch.Ahal.TKM
: locale === "РУС"
? branch.Ahal.RUS
: locale === "ENG"
? branch.Ahal.ENG
: branch.Ahal.TKM
: inputValid.region === "Балканский регион" ||
inputValid.region === "Balkan region" ||
inputValid.region === "Balkan"
? locale === "TKM"
? branch.Balkan.TKM
: locale === "РУС"
? branch.Balkan.RUS
: locale === "ENG"
? branch.Balkan.ENG
: branch.Balkan.TKM
: inputValid.region === "Дашогузский регион" ||
inputValid.region === "Dashoguz region" ||
inputValid.region === "Daşoguz"
? locale === "TKM"
? branch.Dashoguz.TKM
: locale === "РУС"
? branch.Dashoguz.RUS
: locale === "ENG"
? branch.Dashoguz.ENG
: branch.Dashoguz.TKM
: inputValid.region === "Лебапский регион" ||
inputValid.region === "Lebap region" ||
inputValid.region === "Lebap"
? locale === "TKM"
? branch.Lebap.TKM
: locale === "РУС"
? branch.Lebap.RUS
: locale === "ENG"
? branch.Lebap.ENG
: branch.Lebap.TKM
: inputValid.region === "Марыйский регион" ||
inputValid.region === "Mary region" ||
inputValid.region === "Mary"
? locale === "TKM"
? branch.Mary.TKM
: locale === "РУС"
? branch.Mary.RUS
: locale === "ENG"
? branch.Mary.ENG
: branch.Mary.TKM
: [""]
}
customId={"affiliate"}
blockName={"card-3-select"}
elName={"card-3-select-el"}
name={"affiliate"}
placeholder={
locale === "TKM"
? "Şahamçany saýlaň"
: locale === "РУС"
? "Выберите филиал"
: locale === "ENG"
? "Choose branch"
: "Şahamçany saýlaň"
}
stateSetter={(state) => {
setInputValid({ ...inputValid, affiliate: state });
if (state && inputLocal.region) {
let index;
if (inputLocal.region === "Aşgabat şäheri") {
setInputLocal({
...inputLocal,
affiliate: branch["Ashgabat"].TKM[index],
});
if (locale === "РУС") {
index = branch["Ashgabat"].RUS.findIndex(
(e) => e === state
);
} else if (locale === "ENG") {
index = branch["Ashgabat"].ENG.findIndex(
(e) => e === state
);
}
} else if (inputLocal.region === "Daşoguz") {
setInputLocal({
...inputLocal,
affiliate: branch["Dashoguz"].TKM[index],
});
if (locale === "РУС") {
index = branch["Dashoguz"].RUS.findIndex(
(e) => e === state
);
} else if (locale === "ENG") {
index = branch["Dashoguz"].ENG.findIndex(
(e) => e === state
);
}
} else {
setInputLocal({
...inputLocal,
affiliate: branch[inputLocal.region].TKM[index],
});
if (locale === "РУС") {
index = branch[inputLocal.region].RUS.findIndex(
(e) => e === state
);
} else if (locale === "ENG") {
index = branch[inputLocal.region].ENG.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>
}}
eTarget={true}
defaultValue={inputValid.affiliate}
/>
</div>
) : null}
<div className="input-block">
<label htmlFor="date">
{locale === "TKM"

View File

@ -27,8 +27,6 @@ const CardStage4 = ({ setStage, data, setData, req }) => {
setBtnEnabled(false);
}
}, [files]);
console.log(req);
return (
<section className="card-stage-4">
<form>

View File

@ -30,19 +30,47 @@ const CreditStage4 = ({ setStage, data, setData }) => {
useEffect(() => {
if (
inputValid.workplace &&
inputValid.salary &&
inputValid.position &&
inputValid.experience &&
inputValid.region &&
inputValid.affiliate
inputValid.region === branch.regions.TKM[6] ||
inputValid.region === branch.regions.RUS[6] ||
inputValid.region === branch.regions.ENG[6]
) {
setBtnEnabled(true);
if (
inputValid.workplace &&
inputValid.salary &&
inputValid.position &&
inputValid.experience &&
inputValid.region
) {
setBtnEnabled(true);
} else {
setBtnEnabled(false);
}
} else {
setBtnEnabled(false);
if (
inputValid.workplace &&
inputValid.salary &&
inputValid.position &&
inputValid.experience &&
inputValid.region &&
inputValid.affiliate
) {
setBtnEnabled(true);
} else {
setBtnEnabled(false);
}
}
}, [inputValid]);
useEffect(() => {
if (
inputValid.region === branch.regions.TKM[6] ||
inputValid.region === branch.regions.RUS[6] ||
inputValid.region === branch.regions.ENG[6]
) {
setInputValid({ ...inputValid, affiliate: null });
}
}, [inputValid.region]);
return (
<section className="card-stage-3">
<form>
@ -200,156 +228,160 @@ const CreditStage4 = ({ setStage, data, setData }) => {
defaultValue={inputValid.region}
/>
</div>
<div className="input-block">
<label htmlFor="affiliate">
{locale === "TKM"
? "Şahamça"
: locale === "РУС"
? "Филиал"
: locale === "ENG"
? "Branch"
: "Şahamça"}
<span>*</span>
</label>
<CustomSelect
items={
inputValid.region === "Город Ашхабад" ||
inputValid.region === "Ashgabat city" ||
inputValid.region === "Aşgabat şäheri"
? locale === "TKM"
? branch.Ashgabat.TKM
: locale === "РУС"
? branch.Ashgabat.RUS
: locale === "ENG"
? branch.Ashgabat.ENG
: branch.Ashgabat.TKM
: inputValid.region === "Ахалский регион" ||
inputValid.region === "Akhal region" ||
inputValid.region === "Ahal"
? locale === "TKM"
? branch.Ahal.TKM
: locale === "РУС"
? branch.Ahal.RUS
: locale === "ENG"
? branch.Ahal.ENG
: branch.Ahal.TKM
: inputValid.region === "Балканский регион" ||
inputValid.region === "Balkan region" ||
inputValid.region === "Balkan"
? locale === "TKM"
? branch.Balkan.TKM
: locale === "РУС"
? branch.Balkan.RUS
: locale === "ENG"
? branch.Balkan.ENG
: branch.Balkan.TKM
: inputValid.region === "Дашогузский регион" ||
inputValid.region === "Dashoguz region" ||
inputValid.region === "Daşoguz"
? locale === "TKM"
? branch.Dashoguz.TKM
: locale === "РУС"
? branch.Dashoguz.RUS
: locale === "ENG"
? branch.Dashoguz.ENG
: branch.Dashoguz.TKM
: inputValid.region === "Лебапский регион" ||
inputValid.region === "Lebap region" ||
inputValid.region === "Lebap"
? locale === "TKM"
? branch.Lebap.TKM
: locale === "РУС"
? branch.Lebap.RUS
: locale === "ENG"
? branch.Lebap.ENG
: branch.Lebap.TKM
: inputValid.region === "Марыйский регион" ||
inputValid.region === "Mary region" ||
inputValid.region === "Mary"
? locale === "TKM"
? branch.Mary.TKM
: locale === "РУС"
? branch.Mary.RUS
: locale === "ENG"
? branch.Mary.ENG
: branch.Mary.TKM
: [""]
}
customId={"affiliate"}
blockName={"card-3-select"}
elName={"card-3-select-el"}
defaultValue={inputValid.affiliate}
name={"affiliate"}
placeholder={
locale === "TKM"
? "Şahamçay saýlaň"
{inputValid.region !== branch.regions.TKM[6] &&
inputValid.region !== branch.regions.RUS[6] &&
inputValid.region !== branch.regions.ENG[6] ? (
<div className="input-block">
<label htmlFor="affiliate">
{locale === "TKM"
? "Şahamça"
: locale === "РУС"
? "Выберите филиал"
? "Филиал"
: locale === "ENG"
? "Choose branch"
: "Şahamçay saýlaň"
}
stateSetter={(state) => {
setInputValid({ ...inputValid, affiliate: state });
if (state && inputLocal.region) {
let index;
if (inputLocal.region === "Aşgabat şäheri") {
if (locale === "РУС") {
index = branch["Ashgabat"].RUS.findIndex(
(e) => e === state
);
} else if (locale === "ENG") {
index = branch["Ashgabat"].ENG.findIndex(
(e) => e === state
);
}
} else if (inputLocal.region === "Daşoguz") {
if (locale === "РУС") {
index = branch["Dashoguz"].RUS.findIndex(
(e) => e === state
);
} else if (locale === "ENG") {
index = branch["Dashoguz"].ENG.findIndex(
(e) => e === state
);
}
} else {
if (locale === "РУС") {
index = branch[inputLocal.region].RUS.findIndex(
(e) => e === state
);
} else if (locale === "ENG") {
index = branch[inputLocal.region].ENG.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],
});
}
}
? "Branch"
: "Şahamça"}
<span>*</span>
</label>
<CustomSelect
items={
inputValid.region === "Город Ашхабад" ||
inputValid.region === "Ashgabat city" ||
inputValid.region === "Aşgabat şäheri"
? locale === "TKM"
? branch.Ashgabat.TKM
: locale === "РУС"
? branch.Ashgabat.RUS
: locale === "ENG"
? branch.Ashgabat.ENG
: branch.Ashgabat.TKM
: inputValid.region === "Ахалский регион" ||
inputValid.region === "Akhal region" ||
inputValid.region === "Ahal"
? locale === "TKM"
? branch.Ahal.TKM
: locale === "РУС"
? branch.Ahal.RUS
: locale === "ENG"
? branch.Ahal.ENG
: branch.Ahal.TKM
: inputValid.region === "Балканский регион" ||
inputValid.region === "Balkan region" ||
inputValid.region === "Balkan"
? locale === "TKM"
? branch.Balkan.TKM
: locale === "РУС"
? branch.Balkan.RUS
: locale === "ENG"
? branch.Balkan.ENG
: branch.Balkan.TKM
: inputValid.region === "Дашогузский регион" ||
inputValid.region === "Dashoguz region" ||
inputValid.region === "Daşoguz"
? locale === "TKM"
? branch.Dashoguz.TKM
: locale === "РУС"
? branch.Dashoguz.RUS
: locale === "ENG"
? branch.Dashoguz.ENG
: branch.Dashoguz.TKM
: inputValid.region === "Лебапский регион" ||
inputValid.region === "Lebap region" ||
inputValid.region === "Lebap"
? locale === "TKM"
? branch.Lebap.TKM
: locale === "РУС"
? branch.Lebap.RUS
: locale === "ENG"
? branch.Lebap.ENG
: branch.Lebap.TKM
: inputValid.region === "Марыйский регион" ||
inputValid.region === "Mary region" ||
inputValid.region === "Mary"
? locale === "TKM"
? branch.Mary.TKM
: locale === "РУС"
? branch.Mary.RUS
: locale === "ENG"
? branch.Mary.ENG
: branch.Mary.TKM
: [""]
}
}}
eTarget={true}
/>
</div>
customId={"affiliate"}
blockName={"card-3-select"}
elName={"card-3-select-el"}
name={"affiliate"}
placeholder={
locale === "TKM"
? "Şahamçany saýlaň"
: locale === "РУС"
? "Выберите филиал"
: locale === "ENG"
? "Choose branch"
: "Şahamçany saýlaň"
}
stateSetter={(state) => {
setInputValid({ ...inputValid, affiliate: state });
if (state && inputLocal.region) {
let index;
if (inputLocal.region === "Aşgabat şäheri") {
if (locale === "РУС") {
index = branch["Ashgabat"].RUS.findIndex(
(e) => e === state
);
} else if (locale === "ENG") {
index = branch["Ashgabat"].ENG.findIndex(
(e) => e === state
);
}
} else if (inputLocal.region === "Daşoguz") {
if (locale === "РУС") {
index = branch["Dashoguz"].RUS.findIndex(
(e) => e === state
);
} else if (locale === "ENG") {
index = branch["Dashoguz"].ENG.findIndex(
(e) => e === state
);
}
} else {
if (locale === "РУС") {
index = branch[inputLocal.region].RUS.findIndex(
(e) => e === state
);
} else if (locale === "ENG") {
index = branch[inputLocal.region].ENG.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>
) : null}
</div>
<div className="cu-bottom card-stage-3-bottom cs-4-bottom">
<button

View File

@ -125,7 +125,6 @@ const RegForm = () => {
.toISOString()
.split("T")[0];
inputDate.max = new Date().toISOString().split("T")[0];
console.log(inputDate.max);
}, []);
return (
<section className="reg">

View File

@ -1,7 +1,15 @@
export const branchData = () => {
return {
regions: {
TKM: ["Aşgabat şäheri", "Ahal", "Balkan", "Daşoguz", "Lebap", "Mary"],
TKM: [
"Aşgabat şäheri",
"Ahal",
"Balkan",
"Daşoguz",
"Lebap",
"Mary",
"Arkadag şäheri",
],
RUS: [
"Город Ашхабад",
"Ахалский регион",
@ -9,6 +17,7 @@ export const branchData = () => {
"Дашогузский регион",
"Лебапский регион",
"Марыйский регион",
"Город Аркадаг",
],
ENG: [
"Ashgabat city",
@ -17,6 +26,7 @@ export const branchData = () => {
"Dashoguz region",
"Lebap region",
"Mary region",
"Arkadag city",
],
},
Ashgabat: {