Skip to content

Commit

Permalink
Added validation on P2 values
Browse files Browse the repository at this point in the history
  • Loading branch information
deepa-s-13 committed Apr 23, 2024
1 parent 5d3cd6b commit 85d1f25
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,33 @@ setWaterCharges(Malbafees/2)
return <Loader />
}

function setOtherChargesVal(value) {
if(/^[0-9]*$/.test(value)){
setOtherCharges(value);
sessionStorage.setItem("otherCharges",e.target.value)
}
else{
//alert("Please enter numbers")
}
}
function setDevelopmentVal(value) {
if(/^[0-9]*$/.test(value)){
setDevelopment(value);
sessionStorage.setItem("development",e.target.value)
}
else{
//alert("Please enter numbers")
}
}
function setLessAdjusmentVal(value) {
if(/^[0-9]*$/.test(value)){
setLessAdjusment(value);
sessionStorage.setItem("lessAdjusment",e.target.value)
}
else{
//alert("Please enter numbers")
}
}

return (
<React.Fragment>
Expand Down Expand Up @@ -378,41 +405,41 @@ setWaterCharges(Malbafees/2)
type={"text"}
isMandatory={false}
optionKey="i18nKey"
name="email"
name="development"
defaultValue={value?.additionalDetails?.selfCertificationCharges?.BPA_DEVELOPMENT_CHARGES }
value={development}
onChange={(e) => {setDevelopment(e.target.value),sessionStorage.setItem("development",e.target.value)}}
onChange={(e) => {setDevelopmentVal(e.target.value)}}
//disable={userInfo?.info?.emailId && !isOpenLinkFlow ? true : false}
//disable={editScreen}
//{...{ required: true, pattern: "[A-Za-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$", type: "email", title: t("CORE_COMMON_APPLICANT_MOBILE_NUMBER_INVALID") }}
{...{ required: true, pattern: "^[0-9]*$" }}
/>
<CardLabel>{t("BPA_COMMON_OTHER_AMT")}</CardLabel>
<TextInput
t={t}
type={"text"}
isMandatory={false}
optionKey="i18nKey"
name="email"
name="otherCharges"
defaultValue={value?.additionalDetails?.selfCertificationCharges?.BPA_OTHER_CHARGES }
value={otherCharges}
onChange={(e) => {setOtherCharges(e.target.value),sessionStorage.setItem("otherCharges",e.target.value)}}
onChange={(e) => {setOtherChargesVal(e.target.value)}}
//disable={userInfo?.info?.emailId && !isOpenLinkFlow ? true : false}
//disable={editScreen}
//{...{ required: true, pattern: "[A-Za-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$", type: "email", title: t("CORE_COMMON_APPLICANT_MOBILE_NUMBER_INVALID") }}
{...{ required: true, pattern: /^[0-9]*$/ }}
/>
<CardLabel>{t("BPA_COMMON_LESS_AMT")}</CardLabel>
<TextInput
t={t}
type={"text"}
isMandatory={false}
optionKey="i18nKey"
name="email"
name="lessAdjusment"
defaultValue={value?.additionalDetails?.selfCertificationCharges?.BPA_LESS_ADJUSMENT_PLOT }
value={lessAdjusment}
onChange={(e) => {setLessAdjusment(e.target.value),sessionStorage.setItem("lessAdjusment",e.target.value)}}
onChange={(e) => {setLessAdjusmentVal(e.target.value)}}
//disable={userInfo?.info?.emailId && !isOpenLinkFlow ? true : false}
//disable={editScreen}
//{...{ required: true, pattern: "[A-Za-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$", type: "email", title: t("CORE_COMMON_APPLICANT_MOBILE_NUMBER_INVALID") }}
{...{ required: true, pattern: "^[0-9]*$" }}
/>

</StatusTable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,33 @@ const ScruntinyDetails = ({ scrutinyDetails, paymentsList=[],additionalDetails }
else if (data?.value) return data?.value;
else t("NA");
}
function setOtherChargesVal(value) {
if(/^[0-9]*$/.test(value)){
setOtherCharges(value);
sessionStorage.setItem("otherCharges",e.target.value)
}
else{
//alert("Please enter numbers")
}
}
function setDevelopmentVal(value) {
if(/^[0-9]*$/.test(value)){
setDevelopment(value);
sessionStorage.setItem("development",e.target.value)
}
else{
//alert("Please enter numbers")
}
}
function setLessAdjusmentVal(value) {
if(/^[0-9]*$/.test(value)){
setLessAdjusment(value);
sessionStorage.setItem("lessAdjusment",e.target.value)
}
else{
//alert("Please enter numbers")
}
}
return (
<Fragment>
{!scrutinyDetails?.isChecklist && <div style={{ background: "#FAFAFA", border: "1px solid #D6D5D4", padding: "8px", borderRadius: "4px", maxWidth: "950px" }}>
Expand Down Expand Up @@ -60,7 +87,8 @@ const ScruntinyDetails = ({ scrutinyDetails, paymentsList=[],additionalDetails }
defaultValue={additionalDetails?.selfCertificationCharges?.BPA_DEVELOPMENT_CHARGES || ""}
value={development}
disabled={!isEditApplication}
onChange={(e) => {setDevelopment(e.target.value),sessionStorage.setItem("development",e.target.value)}}
onChange={(e) => {setDevelopmentVal(e.target.value)}}
{...{ required: true, pattern: "^[0-9]*$", type: "text" }}
/>
<CardLabel>{t("BPA_COMMON_OTHER_AMT")}</CardLabel>
<TextInput
Expand All @@ -72,10 +100,8 @@ const ScruntinyDetails = ({ scrutinyDetails, paymentsList=[],additionalDetails }
defaultValue={additionalDetails?.selfCertificationCharges?.BPA_OTHER_CHARGES || ""}
value={otherCharges}
disabled={!isEditApplication}
onChange={(e) => {setOtherCharges(e.target.value),sessionStorage.setItem("otherCharges",e.target.value)}}
//disable={userInfo?.info?.emailId && !isOpenLinkFlow ? true : false}
//disable={editScreen}
//{...{ required: true, pattern: "[A-Za-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$", type: "email", title: t("CORE_COMMON_APPLICANT_MOBILE_NUMBER_INVALID") }}
onChange={(e) => {setOtherChargesVal(e.target.value)}}
{...{ required: true, pattern: "^[0-9]*$", type: "text" }}
/>
<CardLabel>{t("BPA_COMMON_LESS_AMT")}</CardLabel>
<TextInput
Expand All @@ -87,7 +113,8 @@ const ScruntinyDetails = ({ scrutinyDetails, paymentsList=[],additionalDetails }
defaultValue={additionalDetails?.selfCertificationCharges?.BPA_LESS_ADJUSMENT_PLOT || ""}
value={lessAdjusment}
disabled={!isEditApplication}
onChange={(e) => {setLessAdjusment(e.target.value),sessionStorage.setItem("lessAdjusment",e.target.value)}}
onChange={(e) => {setLessAdjusmentVal(e.target.value)}}
{...{ required: true, pattern: "^[0-9]*$", type: "text" }}
/>
</div>
}
Expand Down

0 comments on commit 85d1f25

Please sign in to comment.