Skip to content

Commit

Permalink
eligibility matrix error resolved(#14)
Browse files Browse the repository at this point in the history
eligibility matrix error resolved
  • Loading branch information
utkarsh-tf141 authored Mar 2, 2024
2 parents d57c577 + 2d03883 commit 82aa57e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
14 changes: 8 additions & 6 deletions pages/admin/rc/[rcid]/proforma/[proformaid]/step2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ function Step2() {
const temp = func[branchName as keyof typeof func];
const idx =
func[branchName as keyof typeof func][keyword as keyof typeof temp];
if (idx !== -1) {
newStr = `${newStr.substring(0, idx)}1${newStr.substring(idx + 1)}`;
let idn = parseInt(idx, 10);
if (idn !== -1) {
newStr = `${newStr.substring(0, idn)}1${newStr.substring(idn + 1)}`;
}
});
setStr(newStr);
Expand All @@ -77,10 +78,11 @@ function Step2() {
const temp = func[branch as keyof typeof func];
const idx = func[branch as keyof typeof func][keyword as keyof typeof temp];
let newStr = str;
if (str[idx] === "1") {
newStr = `${newStr.substring(0, idx)}0${newStr.substring(idx + 1)}`;
let idn = parseInt(idx, 10);
if (str[idn] === "1") {
newStr = `${newStr.substring(0, idn)}0${newStr.substring(idn + 1)}`;
} else {
newStr = `${newStr.substring(0, idx)}1${newStr.substring(idx + 1)}`;
newStr = `${newStr.substring(0, idn)}1${newStr.substring(idn + 1)}`;
}
setStr(newStr);
};
Expand Down Expand Up @@ -127,7 +129,7 @@ function Step2() {
<TableCell>{keyword}</TableCell>
<TableCell>
<Checkbox
checked={str[value] === "1"}
checked={str[parseInt(value, 10)] === "1"}
onClick={() => handleCheck(branch, keyword)}
/>
</TableCell>
Expand Down
14 changes: 8 additions & 6 deletions pages/company/rc/[rcid]/proforma/[proformaid]/step2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ function Step2() {
const temp = func[branchName as keyof typeof func];
const idx =
func[branchName as keyof typeof func][keyword as keyof typeof temp];
if (idx !== -1) {
newStr = `${newStr.substring(0, idx)}1${newStr.substring(idx + 1)}`;
let idn = parseInt(idx, 10);
if (idn !== -1) {
newStr = `${newStr.substring(0, idn)}1${newStr.substring(idn + 1)}`;
}
});
setStr(newStr);
Expand All @@ -75,10 +76,11 @@ function Step2() {
const temp = func[branch as keyof typeof func];
const idx = func[branch as keyof typeof func][keyword as keyof typeof temp];
let newStr = str;
if (str[idx] === "1") {
newStr = `${newStr.substring(0, idx)}0${newStr.substring(idx + 1)}`;
let idn = parseInt(idx, 10);
if (str[idn] === "1") {
newStr = `${newStr.substring(0, idn)}0${newStr.substring(idn + 1)}`;
} else {
newStr = `${newStr.substring(0, idx)}1${newStr.substring(idx + 1)}`;
newStr = `${newStr.substring(0, idn)}1${newStr.substring(idn + 1)}`;
}
setStr(newStr);
};
Expand Down Expand Up @@ -125,7 +127,7 @@ function Step2() {
<TableCell>{keyword}</TableCell>
<TableCell>
<Checkbox
checked={str[value] === "1"}
checked={str[parseInt(value, 10)] === "1"}
onClick={() => handleCheck(branch, keyword)}
/>
</TableCell>
Expand Down

0 comments on commit 82aa57e

Please sign in to comment.