Skip to content

Commit

Permalink
Inspection runs can be viewed with details
Browse files Browse the repository at this point in the history
  • Loading branch information
devireddyprasanth22 committed Aug 7, 2024
1 parent 247d5d7 commit 74fb349
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 46 deletions.
14 changes: 14 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import PropertySearch from './components/property_search/PropertyGrid';
import RentalProfile from './components/rental_profile/RentalProfile';
import RenterApplication from './components/renter_application/RenterApplication';
import ReceivedApplication from './components/applications/manager/RecievedApplication';
import LogIn from './components/login_page/Login';
import LogIn from './components/login_page/LogIn';
import Inspection from './components/inspection_page/Inspection';
import Messaging from './components/messaging/Messaging'
import Keys from './components/keys/Keys';
Expand Down
60 changes: 15 additions & 45 deletions frontend/src/components/inspection_run/InspectionRun.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ const InspectionRun = () => {
throw propertiesError;
}

const { data: propertyManager, error: propertyManagerError } = await supabase
.from("PROPERTY MANAGER")
.select("*");

if (propertyManagerError) {
throw propertyManagerError;
}

const { data: inspectionRuns, error: inspectionRunsError } =
await supabase.from("INSPECTION RUN").select("*");

Expand All @@ -44,11 +52,17 @@ const InspectionRun = () => {
(inspectionRun) =>
inspectionRun.inspection_run_id === inspection.inspection_run_id
);
const propertyManagerData = inspectionRun
? propertyManager.find(
(manager) => manager.property_manager_id === inspectionRun.property_manager_id
)
: null;

return {
...inspection,
propertyData: property || {},
inspectionRunData: inspectionRun || {},
propertyManagerData: propertyManagerData || {},
};
});

Expand Down Expand Up @@ -104,7 +118,7 @@ const InspectionRun = () => {
>
<TableCell>
<Typography variant='body' fontWeight={700}>
{inspection.inspectionRunData.property_manager_id}
{inspection.propertyManagerData.property_manager_first_name} {inspection.propertyManagerData.property_manager_last_name}
</Typography>
</TableCell>
<TableCell align="right">
Expand Down Expand Up @@ -138,47 +152,3 @@ const InspectionRun = () => {

export default InspectionRun;


// <Grid container spacing={2} style={{ paddingTop: "20px" }}>
// {inspectionsData.map((inspection) => (
// <Grid item key={inspection.id} xs={12}>
// <Box display="flex" alignItems="flex-start">
// <img
// src={
// inspection.propertyData.property_pictures?.[0] ||
// "default_image_path.jpg"
// }
// alt="Property"
// style={{
// width: 300,
// height: 200,
// objectFit: "cover",
// borderRadius: 8,
// marginRight: 16,
// }}
// />
// <Box
// display="flex"
// flexDirection="column"
// justifyContent="flex-start"
// alignItems="flex-start"
// gap={2}
// >
// <Typography variant="h5">
// {inspection.propertyData.property_street_number}{" "}
// {inspection.propertyData.property_street_name},{" "}
// {inspection.propertyData.property_suburb},{" "}
// {inspection.propertyData.property_state}
// </Typography>
// <Typography variant="body1">
// Date: {inspection.inspection_date},{" "}
// {inspection.inspectionRunData.inspection_run_date}
// </Typography>
// <Typography variant="body1">
// Time: {inspection.inspection_start}
// </Typography>
// </Box>
// </Box>
// </Grid>
// ))}
// </Grid>

0 comments on commit 74fb349

Please sign in to comment.