-
Notifications
You must be signed in to change notification settings - Fork 2
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 #253 from bcgov/FEATURE/download-itinerary
Feature/download itinerary
- Loading branch information
Showing
9 changed files
with
53,192 additions
and
985 deletions.
There are no files selected for viewing
53,986 changes: 53,019 additions & 967 deletions
53,986
packages/bcer-data-portal/app/package-lock.json
Large diffs are not rendered by default.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { BCDirectionData, BusinessLocation } from "@/constants/localInterfaces"; | ||
import React from "react"; | ||
|
||
export class MapUtil { | ||
static formatLocationsForPDF(locations: BusinessLocation[], routeData: BCDirectionData) { | ||
return { | ||
locations : locations.map(({ id, addressLine1, postal, city }, index) => { | ||
return <div key = {id} style={{paddingBottom: 10, fontSize: 10, width: '100%'}}> | ||
<div style={{fontWeight: 'bold', color: 'black', paddingBottom: 5}}>{`Location ${index+1}`}</div> | ||
<div style={{fontSize: 10, width: '100%', color: 'grey'}}> | ||
{addressLine1} | ||
<div>{`${postal}, ${city}`}</div> | ||
</div> | ||
</div> | ||
}), | ||
directions: routeData.directions.map(({ type, text}, index) => { | ||
return <div key={index} style={{paddingBottom: 12, fontSize: 10, width: '100%'}}> | ||
<div style={{fontWeight: 'bold', color: 'black', paddingBottom: 3}}>{type}</div> | ||
<div style={{color: 'grey'}}> | ||
{text} | ||
</div> | ||
</div> | ||
}) | ||
}; | ||
} | ||
} |
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
71 changes: 71 additions & 0 deletions
71
packages/bcer-data-portal/app/src/views/Map/ItineraryPdf.tsx
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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { BCDirectionData, BusinessLocation } from '@/constants/localInterfaces'; | ||
import { Grid, Typography, makeStyles } from '@material-ui/core'; | ||
import Box from '@material-ui/core/Box'; | ||
import React from 'react'; | ||
import logo from '../../assets/images/bc-logo.png'; | ||
import { MapUtil } from '@/util/map.util'; | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
container: { | ||
width: 535, | ||
padding: 40, | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: 20 | ||
}, | ||
logo: { | ||
display: 'flex', | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
gap: 15, | ||
paddingBottom: 20 | ||
}, | ||
itinerary: { | ||
paddingBottom: 20 | ||
}, | ||
header: { | ||
fontSize: 14, | ||
color: '#002C71', | ||
fontWeight: 'bold', | ||
}, | ||
})); | ||
|
||
type ItineraryPdfProps = { | ||
routeData: BCDirectionData, | ||
locations: BusinessLocation[], | ||
imageString: string | ||
} | ||
|
||
function ItineraryPdf ({ routeData, locations, imageString }: ItineraryPdfProps) { | ||
const classes = useStyles(); | ||
const formattedData = MapUtil.formatLocationsForPDF(locations, routeData); | ||
return ( | ||
<Box className={classes.container}> | ||
<div className={classes.logo}> | ||
<img src={logo} alt="BC Logo" style={{height: '70px', width: '90px'}} /> | ||
<Typography className={classes.header} style={{ fontSize: '16px'}}>E-Substances Regulation</Typography> | ||
</div> | ||
|
||
<div className={classes.itinerary}> | ||
<Typography className={classes.header}>Itinerary</Typography> | ||
<Box mt={1} /> | ||
<img src={imageString} alt="Itinerary Map" style={{ height: '330px', width: '540px'}} /> | ||
</div> | ||
|
||
<Grid container spacing={2} > | ||
<Grid item md={6}> | ||
<Typography className={classes.header}>Directions</Typography> | ||
<Box mt={1} /> | ||
{formattedData.directions} | ||
</Grid> | ||
<Grid item md={6}> | ||
<Typography className={classes.header}>Business Location</Typography> | ||
<Box mt={1} /> | ||
{formattedData.locations} | ||
</Grid> | ||
</Grid> | ||
</Box> | ||
) | ||
} | ||
|
||
export default ItineraryPdf |
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