-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from AOT-Technologies/feature/update-lob
Removed all console logs and added contact and individual details in …
- Loading branch information
Showing
10 changed files
with
56 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,27 +9,51 @@ import { State } from "../../../interfaces/stateInterface"; | |
import { getLobDetails } from "../../../services/LOBService"; | ||
import { setSelectedCaseLOBDetails } from "../../../reducers/newCaseReducer"; | ||
import { useNavigate } from "react-router"; | ||
import { getContactDetails, getContactsData } from "../../../services/ContactService"; | ||
import { getIndividualsData } from "../../../services/IndividualService"; | ||
import { setSelectedContact } from "../../../reducers/newContactReducer"; | ||
import { setSelectedIndividual } from "../../../reducers/newIndividualReducer"; | ||
|
||
const LobCustom = () => { | ||
const dispatch = useDispatch(); | ||
const navigate = useNavigate(); | ||
const selectedCase = useSelector((state: State) => state.cases.selectedCase); | ||
const lobData = selectedCase.lobDetails; | ||
const selectedContact = useSelector((state: State) => state.contacts.selectedContact); | ||
const selectedIndividual = useSelector((state: State) => state.individuals.selectedIndividual); | ||
// const lobData = selectedCase.lobDetails; | ||
useEffect(() => { | ||
if (selectedCase.lobcaseid > 0) { | ||
getCaseLobDetails(selectedCase.lobcaseid); | ||
if (selectedCase.contactid) { | ||
getCaseContactDetails(selectedCase.contactid); | ||
} | ||
}, [selectedCase.lobcaseid]); | ||
const getCaseLobDetails = async (id) => { | ||
let lobDetails = await getLobDetails(id); | ||
if (lobDetails && lobDetails.id) { | ||
dispatch(setSelectedCaseLOBDetails(lobDetails)); | ||
}, [selectedCase.contactid]); | ||
useEffect(() => { | ||
if (selectedCase.individualid) { | ||
getCaseIndividualDetails(selectedCase.individualid); | ||
} | ||
}, [selectedCase.individualid]); | ||
const getCaseContactDetails = async (contact) => { | ||
let searchContacts = await getContactsData(1, contact.split(" ")[0]); | ||
let contactDetails = searchContacts?.CaseflowContacts?.map((element) => { | ||
if(element.firstname+" "+element.lastname === contact) { | ||
return element | ||
} else return {} | ||
}); | ||
dispatch(setSelectedContact(contactDetails)); | ||
}; | ||
|
||
const navigateToLob = () => { | ||
navigate("/private/lob/" + lobData.id + "/details"); | ||
const getCaseIndividualDetails = async (individual) => { | ||
let searchIndividuals = await getIndividualsData(1, individual.split(" ")[0]); | ||
let individualDetails = searchIndividuals?.CaseflowIndividuals?.map((element) => { | ||
if(element.firstname+" "+element.lastname === individual) { | ||
return element | ||
} else return {} | ||
}); | ||
dispatch(setSelectedIndividual(individualDetails)); | ||
}; | ||
|
||
|
||
// const navigateToLob = () => { | ||
// navigate("/private/lob/" + lobData.id + "/details"); | ||
// }; | ||
|
||
return ( | ||
<> | ||
|
@@ -41,39 +65,39 @@ const LobCustom = () => { | |
Contact Details | ||
</Typography> | ||
<Divider sx={{ border: 1, color: "#606060" }} /> | ||
{/* {lobData && lobData.id ? ( */} | ||
{/* {selectedContact && selectedContact.id ? ( */} | ||
<div className="lob-custom-content-case-detail"> | ||
<div> | ||
<Typography variant="subtitle1">Name</Typography> | ||
<Typography variant="subtitle1">Samuel James (Parent)</Typography> | ||
<Typography variant="subtitle1">Id</Typography> | ||
<Typography variant="subtitle1">{selectedContact[0]?.id}</Typography> | ||
<Typography variant="body2" color="#606060"> | ||
|
||
</Typography> | ||
</div> | ||
<div> | ||
<Typography variant="subtitle1">Phone No</Typography> | ||
<Typography variant="subtitle1">+1613555015</Typography> | ||
<Typography variant="subtitle1">Name</Typography> | ||
<Typography variant="subtitle1">{selectedContact[0]?.firstname} {selectedContact[0]?.lastname}</Typography> | ||
<Typography variant="body2" color="#606060"> | ||
|
||
</Typography> | ||
</div> | ||
<div> | ||
<Typography variant="subtitle1">City</Typography> | ||
<Typography variant="subtitle1">Anytown</Typography> | ||
<Typography variant="subtitle1">Phone No</Typography> | ||
<Typography variant="subtitle1">{selectedContact[0]?.phonenumber}</Typography> | ||
<Typography variant="body2" color="#606060"> | ||
|
||
</Typography> | ||
</div> | ||
<div> | ||
<Typography variant="subtitle1">Region</Typography> | ||
<Typography variant="subtitle1">BC</Typography> | ||
<Typography variant="subtitle1">Email</Typography> | ||
<Typography variant="subtitle1">{selectedContact[0]?.email}</Typography> | ||
<Typography variant="body2" color="#606060"> | ||
|
||
</Typography> | ||
</div> | ||
<div> | ||
<Typography variant="subtitle1">Email</Typography> | ||
<Typography variant="subtitle1">[email protected]</Typography> | ||
<Typography variant="subtitle1">Address</Typography> | ||
<Typography variant="subtitle1">{selectedContact[0]?.address}</Typography> | ||
<Typography variant="body2" color="#606060"> | ||
|
||
</Typography> | ||
|
@@ -111,36 +135,36 @@ const LobCustom = () => { | |
{/* {lobData && lobData.id ? ( */} | ||
<div className="lob-custom-content-case-detail"> | ||
<div> | ||
<Typography variant="subtitle1">Name</Typography> | ||
<Typography variant="subtitle1">Shruti James (child)</Typography> | ||
<Typography variant="subtitle1">Id</Typography> | ||
<Typography variant="subtitle1">{selectedIndividual[0]?.id}</Typography> | ||
<Typography variant="body2" color="#606060"> | ||
|
||
</Typography> | ||
</div> | ||
<div> | ||
<Typography variant="subtitle1">Phone No</Typography> | ||
<Typography variant="subtitle1">+1613555015</Typography> | ||
<Typography variant="subtitle1">Name</Typography> | ||
<Typography variant="subtitle1">{selectedIndividual[0]?.firstname} {selectedIndividual[0]?.lastname}</Typography> | ||
<Typography variant="body2" color="#606060"> | ||
|
||
</Typography> | ||
</div> | ||
<div> | ||
<Typography variant="subtitle1">City</Typography> | ||
<Typography variant="subtitle1">Anytown</Typography> | ||
<Typography variant="subtitle1">Phone No</Typography> | ||
<Typography variant="subtitle1">{selectedIndividual[0]?.phonenumber}</Typography> | ||
<Typography variant="body2" color="#606060"> | ||
|
||
</Typography> | ||
</div> | ||
<div> | ||
<Typography variant="subtitle1">Region</Typography> | ||
<Typography variant="subtitle1">BC</Typography> | ||
<Typography variant="subtitle1">Email</Typography> | ||
<Typography variant="subtitle1">{selectedIndividual[0]?.email}</Typography> | ||
<Typography variant="body2" color="#606060"> | ||
|
||
</Typography> | ||
</div> | ||
<div> | ||
<Typography variant="subtitle1">Email</Typography> | ||
<Typography variant="subtitle1">[email protected]</Typography> | ||
<Typography variant="subtitle1">Address</Typography> | ||
<Typography variant="subtitle1">{selectedIndividual[0]?.address}</Typography> | ||
<Typography variant="body2" color="#606060"> | ||
|
||
</Typography> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters