Skip to content

Commit

Permalink
Merge pull request #987 from sriranjan-s/Dev-2.0
Browse files Browse the repository at this point in the history
removed mandtatory propety search
  • Loading branch information
sriranjan-s authored Mar 13, 2024
2 parents 179e688 + 3303b33 commit 4798816
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -649,9 +649,15 @@ setCityCode(city.code);
onFormValueChange={onFormValueChange}
cardStyle={{marginBottom:"0",maxWidth:"960px"}}
></FormComposer>
<div style={{display:"flex"}}>
<span className="link" style={isMobile ? {display:"flex", justifyContent:"center",paddingBottom:"16px"} : {display:"flex", justifyContent:"left",paddingBottom:"16px", marginLeft: "45px"}}>

<Link to={window.location.href.includes("/ws/")?"/digit-ui/citizen/ws/create-application/create-property" : window.location.href.includes("/tl/tradelicence/") ? "/digit-ui/citizen/tl/tradelicence/new-application/create-property":window.location.href.includes("/obps/bpa/") ? "/digit-ui/citizen/obps/bpa/building_plan_scrutiny/new_construction/create-property":window.location.href.includes("/fsm/")? "/digit-ui/citizen/fsm/new-application/create-property":"/digit-ui/citizen/commonpt/property/new-application"}>{t("CPT_REG_NEW_PROPERTY")}</Link>
</span>
{window.location.href.includes("/obps/bpa/") ?<span className="link" style={isMobile ? {display:"flex", justifyContent:"center",paddingBottom:"16px"} : {display:"flex", justifyContent:"left",paddingBottom:"16px", marginLeft: "45px"}}>
<Link to={"/digit-ui/citizen/obps/bpa/building_plan_scrutiny/new_construction/location"}>{t("CORE_COMMON_SKIP_CONTINUE")}</Link>
</span>:""}
</div>
{showToast && (
<Toast
isDleteBtn={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ const LocationDetails = ({ t, config, onSelect, userType, formData, ownerIndex =
const stateId = Digit.ULBService.getStateId();
const [Pinerror, setPinerror] = useState(null);
const [isOpen, setIsOpen] = useState(false);
const [pincode, setPincode] = useState(currPincode || formData?.address?.pincode ||propertyData.address.pincode|| "");
const [pincode, setPincode] = useState(currPincode || formData?.address?.pincode ||propertyData?.address?.pincode|| "");
const [geoLocation, setgeoLocation] = useState(formData?.address?.geoLocation || "")
const [tenantIdData, setTenantIdData] = useState(formData?.Scrutiny?.[0]?.tenantIdData);
const [selectedCity, setSelectedCity] = useState(() => formData?.address?.city || currCity ||propertyData.address.pincode || null);
const [street, setStreet] = useState(formData?.address?.street || propertyData.address.street||"");
const [landmark, setLandmark] = useState(formData?.address?.landmark || formData?.address?.Landmark || propertyData.address.landmark|| "");
const [selectedCity, setSelectedCity] = useState(() => formData?.address?.city || currCity ||propertyData?.address?.pincode || null);
const [street, setStreet] = useState(formData?.address?.street || propertyData?.address?.street||"");
const [landmark, setLandmark] = useState(formData?.address?.landmark || formData?.address?.Landmark || propertyData?.address?.landmark|| "");
const [placeName, setplaceName] = useState(formData?.address?.placeName || formData?.placeName || "");
const [localities, setLocalities] = useState();
const [selectedLocality, setSelectedLocality] = useState(propertyData?.address?.locality||formData?.address?.locality ||null);
//const { isLoading, data: citymodules } = Digit.Hooks.obps.useMDMS(stateId, "tenant", ["citymodule"]);
let [cities, setcitiesopetions] = useState(allCities);
let validation = { };
Expand Down Expand Up @@ -85,35 +87,39 @@ const LocationDetails = ({ t, config, onSelect, userType, formData, ownerIndex =
let isSendBackTOCitizen = window.location.href.includes("sendbacktocitizen");


const [localities, setLocalities] = useState();

const [selectedLocality, setSelectedLocality] = useState(propertyData.address.locality||formData.address.locality ||null);

useEffect(() => {
// if (selectedCity && fetchedLocalities && !Pinerror) {
// let __localityList = fetchedLocalities;
// let filteredLocalityList = [];
// console.log("fetchedLocalities",fetchedLocalities)
// if (formData?.address?.locality && formData?.address?.locality?.code === selectedLocality?.code) {
// setSelectedLocality(formData.address.locality);
// }

// if ((formData?.address?.pincode || pincode) && !Pinerror) {
// filteredLocalityList = __localityList.filter((obj) => obj.pincode?.find((item) => item == pincode));
// if (!formData?.address?.locality && filteredLocalityList.length<=0) setSelectedLocality();
// }
// if(!localities || (filteredLocalityList.length > 0 && localities.length !== filteredLocalityList.length) || (filteredLocalityList.length <=0 && localities && localities.length !==__localityList.length))
// {
// console.log("filteredLocalityList",filteredLocalityList)
// setLocalities(() => (filteredLocalityList.length > 0 ? filteredLocalityList : __localityList));
// }
// if (filteredLocalityList.length === 1 && ((selectedLocality == null) || (selectedLocality && filteredLocalityList[0]?.code !== selectedLocality?.code))) {
// setSelectedLocality(filteredLocalityList[0]);
// sessionStorage.setItem("currLocality", JSON.stringify(filteredLocalityList[0]));
// }
// }
if(!propertyData?.address?.locality)
{
if (selectedCity && fetchedLocalities && !Pinerror) {
let __localityList = fetchedLocalities;
let filteredLocalityList = [];
console.log("fetchedLocalities",fetchedLocalities)
if (formData?.address?.locality && formData?.address?.locality?.code === selectedLocality?.code) {
setSelectedLocality(formData.address.locality);
}

if ((formData?.address?.pincode || pincode) && !Pinerror) {
filteredLocalityList = __localityList.filter((obj) => obj.pincode?.find((item) => item == pincode));
if (!formData?.address?.locality && filteredLocalityList.length<=0) setSelectedLocality();
}
if(!localities || (filteredLocalityList.length > 0 && localities.length !== filteredLocalityList.length) || (filteredLocalityList.length <=0 && localities && localities.length !==__localityList.length))
{
console.log("filteredLocalityList",filteredLocalityList)
setLocalities(() => (filteredLocalityList.length > 0 ? filteredLocalityList : __localityList));
}
if (filteredLocalityList.length === 1 && ((selectedLocality == null) || (selectedLocality && filteredLocalityList[0]?.code !== selectedLocality?.code))) {
setSelectedLocality(filteredLocalityList[0]);
sessionStorage.setItem("currLocality", JSON.stringify(filteredLocalityList[0]));
}
}

}
else {
setSelectedLocality(propertyData?.address?.locality)
}


setSelectedLocality(propertyData.address.locality)
}, [selectedCity, formData?.pincode, fetchedLocalities, pincode,geoLocation]);


Expand Down Expand Up @@ -251,7 +257,7 @@ const LocationDetails = ({ t, config, onSelect, userType, formData, ownerIndex =
name="pincode"
onChange={selectPincode}
value={pincode}
disabled={true}
disabled={propertyData?.address ? true:false}
/>}
<CardLabel>{`${t("BPA_CITY_LABEL")}*`}</CardLabel>
{!isOpen && <RadioOrSelect
Expand All @@ -262,23 +268,39 @@ const LocationDetails = ({ t, config, onSelect, userType, formData, ownerIndex =
t={t}
isDependent={true}
//labelKey="TENANT_TENANTS"
disabled={true}
disabled={propertyData?.address ? true:false}
/>}

{!isOpen && selectedCity && localities && !propertyData?.address ?(
<span className={"form-pt-dropdown-only"}>
<CardLabel>{`${t("BPA_LOC_MOHALLA_LABEL")}*`}</CardLabel>
<TextInput
<RadioOrSelect
optionCardStyles={{ maxHeight:"20vmax", overflow:"scroll" }}
isMandatory={config.isMandatory}
//options={}
value={propertyData.address.locality.name}
options={localities.sort((a, b) => a.name.localeCompare(b.name))}
selectedOption={selectedLocality}
optionKey="i18nkey"
onSelect={selectLocality}
t={t}
isDependent={true}
labelKey={`${stringReplaceAll(selectedCity?.code,".","_").toUpperCase()}_REVENUE`}
disabled={true}
//disabled={isEdit}
/>
</span>
): <span className={"form-pt-dropdown-only"}>
<CardLabel>{`${t("BPA_LOC_MOHALLA_LABEL")}*`}</CardLabel>
<TextInput
optionCardStyles={{ maxHeight:"20vmax", overflow:"scroll" }}
isMandatory={config.isMandatory}
//options={}
value={propertyData?.address?.locality?.name}
optionKey="i18nkey"
t={t}
isDependent={true}
labelKey={`${stringReplaceAll(selectedCity?.code,".","_").toUpperCase()}_REVENUE`}
disabled={propertyData?.address ? true:false}
/>
</span>}

<CardLabel>{`${t("BPA_DETAILS_SRT_NAME_LABEL")}`}</CardLabel>
{!isOpen && <TextInput
style={{ }}
Expand All @@ -288,7 +310,7 @@ const LocationDetails = ({ t, config, onSelect, userType, formData, ownerIndex =
name="street"
onChange={selectStreet}
value={street}
disabled={true}
disabled={propertyData?.address ? true:false}
/>}
<CardLabel>{`${t("ES_NEW_APPLICATION_LOCATION_LANDMARK")}`}</CardLabel>
{!isOpen && <TextInput
Expand All @@ -299,7 +321,7 @@ const LocationDetails = ({ t, config, onSelect, userType, formData, ownerIndex =
name="landmark"
onChange={selectLandmark}
value={landmark}
disabled={true}
disabled={propertyData?.address ? true:false}
// {...(validation = {
// isRequired: true,
// pattern: getPattern("Name"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,18 @@ const OwnerDetails = ({ t, config, onSelect, userType, formData }) => {
const [genderList, setGenderList] = useState([]);
const [ownershipCategory, setOwnershipCategory] = useState(formData?.owners?.ownershipCategory);
const [name, setName] = useState(formData?.owners?.name || "");
const [emailId, setEmail] = useState(formData?.owners?.emailId || "");
const [isPrimaryOwner, setisPrimaryOwner] = useState(false);
const [gender, setGender] = useState(formData?.owners?.gender);
const [mobileNumber, setMobileNumber] = useState(formData?.owners?.mobileNumber || "");
const [showToast, setShowToast] = useState(null);
const [isDisable, setIsDisable] = useState(false);
const [ownerRoleCheck, setownerRoleCheck] = useState({});
let Webview = !Digit.Utils.browser.isMobile();
const ismultiple = ownershipCategory?.code.includes("MULTIPLEOWNERS") ? true : false;
formData?.owners?.owners?.forEach(owner => {
if(owner.isPrimaryOwner == "false" ) owner.isPrimaryOwner = false
})
let [fields, setFeilds] = useState(
(formData?.owners && formData?.owners?.owners) || [{ name: "",emailId:"", gender: "", mobileNumber: null, isPrimaryOwner: true }]
const [fields, setFeilds] = useState(
(formData?.owners && formData?.owners?.owners) || [{ name: "", gender: "", mobileNumber: null, isPrimaryOwner: true }]
);

useEffect(() => {
Expand Down Expand Up @@ -96,7 +94,7 @@ const OwnerDetails = ({ t, config, onSelect, userType, formData }) => {

function handleAdd() {
const values = [...fields];
values.push({ name: "",emailId:"", gender: "", mobileNumber: null, isPrimaryOwner: false });
values.push({ name: "", gender: "", mobileNumber: null, isPrimaryOwner: false });
setFeilds(values);
setCanmovenext(true);

Expand Down Expand Up @@ -334,7 +332,6 @@ const OwnerDetails = ({ t, config, onSelect, userType, formData }) => {
payload.additionalDetails.usage = formData?.data.occupancyType || "NA";

if (formData?.data?.holdingNumber) payload.additionalDetails.holdingNo = formData?.data?.holdingNumber;
//if (formData?.data?.boundaryWallLength) payload.additionalDetails.boundaryWallLength = formData?.data?.boundaryWallLength;
if (formData?.data?.registrationDetails) payload.additionalDetails.registrationDetails = formData?.data?.registrationDetails;
if (formData?.data?.applicationType) payload.additionalDetails.applicationType = formData?.data?.applicationType;
if (formData?.data?.serviceType) payload.additionalDetails.serviceType = formData?.data?.serviceType;
Expand Down Expand Up @@ -453,29 +450,31 @@ const OwnerDetails = ({ t, config, onSelect, userType, formData }) => {
else
return true;
}
let propertyData =JSON.parse(sessionStorage.getItem("Digit_OBPS_PT"))
fields =propertyData.owners.map((owner) =>{
let gender
if (owner.gender =="FEMALE")
{
gender={
"code": "FEMALE",
"active": true,
"i18nKey": "COMMON_GENDER_FEMALE"
let propertyData =JSON.parse(sessionStorage.getItem("Digit_OBPS_PT"))
if(propertyData?.owners.length >0)
{
fields = propertyData.owners.map((owner) => {
let gender
if (owner.gender == "FEMALE") {
gender = {
"code": "FEMALE",
"active": true,
"i18nKey": "COMMON_GENDER_FEMALE"
}
return { "name": owner.name, "emailId": owner.emailId, "mobileNumber": owner.mobileNumber, gender: gender, isPrimaryOwner }
}
return {"name":owner.name,"emailId":owner.emailId, "mobileNumber":owner.mobileNumber, gender:gender,isPrimaryOwner}
}
else if (owner.gender =="MALE")
{
gender={
"code": "MALE",
"active": true,
"i18nKey": "COMMON_GENDER_MALE"
else if (owner.gender == "MALE") {
gender = {
"code": "MALE",
"active": true,
"i18nKey": "COMMON_GENDER_MALE"
}
return { "name": owner.name, "emailId": owner.emailId, "mobileNumber": owner.mobileNumber, gender: gender, isPrimaryOwner }
}
return {"name":owner.name, "emailId":owner.emailId, "mobileNumber":owner.mobileNumber, gender:gender,isPrimaryOwner}
}

})
})
}

useEffect(()=>{
let propertyData =JSON.parse(sessionStorage.getItem("Digit_OBPS_PT"))
if(propertyData.owners.length == 1)
Expand Down Expand Up @@ -515,7 +514,6 @@ useEffect(()=>{
value={ownershipCategory}
labelKey="PT_OWNERSHIP"
isDependent={true}
disabled = {true}
/>
</div>
{fields.map((field, index) => {
Expand Down Expand Up @@ -546,7 +544,6 @@ useEffect(()=>{
type: "tel",
title: t("CORE_COMMON_APPLICANT_MOBILE_NUMBER_INVALID"),
})}
disabled={true}
/>
<div style={{ position: "relative", zIndex: "100", right: "35px", marginTop: "-24px", marginRight:Webview?"-20px":"-20px" }} onClick={(e) => getOwnerDetails(index, e)}> <SearchIcon /> </div>
</div>
Expand All @@ -567,7 +564,6 @@ useEffect(()=>{
type: "text",
title: t("TL_NAME_ERROR_MESSAGE"),
})}
disabled={true}
/>
<CardLabel>{`${t("BPA_APPLICANT_GENDER_LABEL")} *`}</CardLabel>
<RadioOrSelect
Expand All @@ -577,7 +573,6 @@ useEffect(()=>{
optionKey="i18nKey"
onSelect={(e) => setGenderName(index, e)}
t={t}
disabled={true}
/>
<CardLabel>{`${t("CORE_EMAIL_ID")}`}</CardLabel>
<TextInput
Expand Down Expand Up @@ -634,4 +629,4 @@ useEffect(()=>{
);
};

export default OwnerDetails;
export default OwnerDetails;

0 comments on commit 4798816

Please sign in to comment.