-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BC Assessment Popup #2236
Merged
Merged
BC Assessment Popup #2236
Changes from 14 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6bba2e0
Added a findOneWhereContains hook to the main map to hopefully show t…
GrahamS-Quartech 718e87d
Added additional fields to properties and configured the displayConfi…
GrahamS-Quartech 4d07ca8
LTSA Info to be displayed in dialog
GrahamS-Quartech a709f66
Added placeholder text for when no BCA data present.
GrahamS-Quartech eeb6688
Reverted LTSA Info string
GrahamS-Quartech 649bfec
BCA Info renders conditionally on whether data contains FOLIO ID
GrahamS-Quartech 858980d
BCA Layer URL now comes from an env variable
GrahamS-Quartech 5d95444
Used proper env naming convention
GrahamS-Quartech ed59284
Merge branch 'main' into bcassessment-lookup
GrahamS-Quartech 649cf3f
Now determines the url based on absolute href location
GrahamS-Quartech 106ef19
force redeploy
GrahamS-Quartech 37282fe
Removed no longer needed env from openshift config
GrahamS-Quartech 2506025
Removed unneeded entry in the layerscontrol data file
GrahamS-Quartech a48104c
Added ROLL_NUMBER to fields pulled out of bca call
GrahamS-Quartech 1ee5b27
Merge branch 'main' into bcassessment-lookup
GrahamS-Quartech 3c9efe6
Merge branch 'main' into bcassessment-lookup
GrahamS-Quartech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
import { | ||
Box, | ||
Button, | ||
Dialog, | ||
DialogActions, | ||
DialogContent, | ||
DialogTitle, | ||
Grid, | ||
Stack, | ||
Typography, | ||
} from '@mui/material'; | ||
import { HeaderDivider } from 'features/mapSideBar/components/tabs/HeaderDivider'; | ||
import { tabStyles } from 'features/mapSideBar/components/tabs/TabStyles'; | ||
import React, { Dispatch, SetStateAction } from 'react'; | ||
import formatCurrency from 'utils/formatCurrency'; | ||
|
||
export interface IBCAData { | ||
GEN_NET_IMPROVEMENT_VALUE: number; | ||
GEN_NET_LAND_VALUE: number; | ||
GEN_GROSS_LAND_VALUE: number; | ||
GEN_GROSS_IMPROVEMENT_VALUE: number; | ||
FOLIO_ID: string; | ||
ROLL_NUMBER: string; | ||
} | ||
|
||
interface IBCADialogProps { | ||
bcaInfoOpen: boolean; | ||
setBcaInfoOpen: Dispatch<SetStateAction<boolean>>; | ||
bcaData: IBCAData; | ||
} | ||
|
||
export const BCADialog = (props: IBCADialogProps) => { | ||
const { bcaInfoOpen, setBcaInfoOpen, bcaData } = props; | ||
const { leftColumnWidth, rightColumnWidth, boldFontWeight, fontSize, headerColour } = tabStyles; | ||
const noInfoParagraphStyle = { | ||
display: 'flex', | ||
margin: '1em', | ||
color: 'GrayText', | ||
fontSize: '11pt', | ||
}; | ||
return ( | ||
<Dialog | ||
open={bcaInfoOpen} | ||
scroll={'body'} | ||
aria-labelledby="scroll-dialog-title" | ||
aria-describedby="scroll-dialog-description" | ||
maxWidth={'md'} | ||
> | ||
<DialogTitle id="scroll-dialog-title">BC Assessment Information</DialogTitle> | ||
<DialogContent> | ||
{bcaData.FOLIO_ID ? ( | ||
<div className="title"> | ||
<Box sx={{ p: 2, background: 'white' }}> | ||
{/* HEADER */} | ||
<Stack direction="row" spacing={1}> | ||
<Typography | ||
text-align="left" | ||
sx={{ fontWeight: boldFontWeight, color: headerColour }} | ||
> | ||
Details | ||
</Typography> | ||
</Stack> | ||
<HeaderDivider /> | ||
|
||
{/* CONTENT */} | ||
<Grid container sx={{ textAlign: 'left' }} rowSpacing={0.5}> | ||
<Grid item xs={leftColumnWidth}> | ||
<Typography fontSize={fontSize}>Folio ID:</Typography> | ||
</Grid> | ||
<Grid item xs={rightColumnWidth}> | ||
<Typography fontSize={fontSize}>{bcaData?.FOLIO_ID}</Typography> | ||
</Grid> | ||
|
||
<Grid item xs={leftColumnWidth}> | ||
<Typography fontSize={fontSize}>Roll Number:</Typography> | ||
</Grid> | ||
<Grid item xs={rightColumnWidth}> | ||
<Typography fontSize={fontSize}>{bcaData?.ROLL_NUMBER}</Typography> | ||
</Grid> | ||
|
||
<Grid item xs={leftColumnWidth}> | ||
<Typography fontSize={fontSize}>Net Improvement Value:</Typography> | ||
</Grid> | ||
<Grid item xs={rightColumnWidth}> | ||
<Typography fontSize={fontSize}> | ||
{formatCurrency(bcaData.GEN_NET_IMPROVEMENT_VALUE)} | ||
</Typography> | ||
</Grid> | ||
|
||
<Grid item xs={leftColumnWidth}> | ||
<Typography fontSize={fontSize}>Net Land Value:</Typography> | ||
</Grid> | ||
<Grid item xs={rightColumnWidth}> | ||
<Typography fontSize={fontSize}> | ||
{formatCurrency(bcaData?.GEN_NET_LAND_VALUE)} | ||
</Typography> | ||
</Grid> | ||
|
||
<Grid item xs={leftColumnWidth}> | ||
<Typography fontSize={fontSize}>Gross Improvement Value:</Typography> | ||
</Grid> | ||
<Grid item xs={rightColumnWidth}> | ||
<Typography fontSize={fontSize}> | ||
{formatCurrency(bcaData?.GEN_GROSS_IMPROVEMENT_VALUE)} | ||
</Typography> | ||
</Grid> | ||
|
||
<Grid item xs={leftColumnWidth}> | ||
<Typography fontSize={fontSize}>Gross Land Value:</Typography> | ||
</Grid> | ||
<Grid item xs={rightColumnWidth}> | ||
<Typography fontSize={fontSize}> | ||
{formatCurrency(bcaData?.GEN_GROSS_LAND_VALUE)} | ||
</Typography> | ||
</Grid> | ||
</Grid> | ||
</Box> | ||
</div> | ||
) : ( | ||
<> | ||
<p style={noInfoParagraphStyle}> | ||
No BC Assessment information available for this PID or information still loading. | ||
</p> | ||
</> | ||
)} | ||
</DialogContent> | ||
<DialogActions> | ||
<Button | ||
onClick={() => { | ||
setBcaInfoOpen(false); | ||
}} | ||
sx={{ | ||
backgroundColor: '#003366', | ||
color: '#F2F2F2', | ||
fontWeight: 600, | ||
'&:hover': { | ||
backgroundColor: '#1A5A96', | ||
}, | ||
}} | ||
> | ||
Close | ||
</Button> | ||
</DialogActions> | ||
</Dialog> | ||
); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* formatCurrency - transform a string or number to the local Canadian currency string format. | ||
* Ex: 1234: number -> CA$1,234: string | ||
* @param value a number or string formatted number | ||
* @returns {string} | ||
*/ | ||
const formatCurrency = (value: number | string | undefined): string => { | ||
if (value == null) { | ||
return ''; | ||
} | ||
|
||
let cleanedValue = 0; | ||
if (typeof value === 'string') { | ||
cleanedValue = parseFloat(value.replace(',', '').replace('$', '')); | ||
if (Number.isNaN(cleanedValue)) { | ||
return ''; | ||
} | ||
} else if (typeof value === 'number') { | ||
cleanedValue = value; | ||
} | ||
|
||
return new Intl.NumberFormat('en-US', { | ||
style: 'currency', | ||
currency: 'CAD', | ||
}).format(cleanedValue); | ||
}; | ||
|
||
export default formatCurrency; |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with leaving this here. Easy to uncomment if we want it back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I felt there was a non-zero chance we might move the information around so I figured I would leave it there for now.