-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PIMS-2001: Add ERP date for general user projects (#2642)
Co-authored-by: Dylan Barkowsky <[email protected]>
- Loading branch information
1 parent
da4195c
commit 117fc0d
Showing
3 changed files
with
122 additions
and
75 deletions.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
react-app/src/components/projects/EnhancedReferralDates.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,83 @@ | ||
import React from 'react'; | ||
import { Box } from '@mui/material'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers'; | ||
import { DateField } from '@mui/x-date-pickers/DateField'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import dayjs from 'dayjs'; | ||
import { NotificationQueue } from '@/hooks/api/useProjectNotificationApi'; | ||
import { NotificationType } from '@/constants/notificationTypes'; | ||
|
||
interface EnhancedReferralDatesProps { | ||
rows: NotificationQueue[]; | ||
} | ||
|
||
const EnhancedReferralDates: React.FC<EnhancedReferralDatesProps> = ({ rows = [] }) => { | ||
const initalERN = rows.find((row) => row.TemplateId === NotificationType.NEW_PROPERTIES_ON_ERP); | ||
const thirtyDayERN = rows.find( | ||
(row) => row.TemplateId === NotificationType.THIRTY_DAY_ERP_NOTIFICATION_OWNING_AGENCY, | ||
); | ||
const sixtyDayERN = rows.find( | ||
(row) => row.TemplateId === NotificationType.SIXTY_DAY_ERP_NOTIFICATION_OWNING_AGENCY, | ||
); | ||
const nintyDayERN = rows.find( | ||
(row) => row.TemplateId === NotificationType.NINTY_DAY_ERP_NOTIFICATION_OWNING_AGENCY, | ||
); | ||
|
||
const allErnNotificatonsFound = [initalERN, thirtyDayERN, sixtyDayERN, nintyDayERN].every( | ||
(notification) => notification != undefined, | ||
); | ||
|
||
if (!allErnNotificatonsFound) return null; | ||
|
||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<Box | ||
gap={1} | ||
display={'inline-flex'} | ||
mb={3} | ||
mt={2} | ||
sx={{ | ||
'& .MuiInputBase-root.Mui-disabled': { | ||
'& > fieldset': { | ||
borderColor: 'rgba(0,0,0)', | ||
}, | ||
}, | ||
'& .MuiFormLabel-root.MuiInputLabel-root': { | ||
color: 'rgba(0, 0, 0)', | ||
}, | ||
'& .MuiInputBase-input.MuiOutlinedInput-input.Mui-disabled': { | ||
color: 'rgba(0,0,0)', | ||
WebkitTextFillColor: 'rgba(0,0,0)', | ||
}, | ||
}} | ||
> | ||
<DateField | ||
disabled={true} | ||
value={initalERN ? dayjs(initalERN.SendOn) : undefined} | ||
label={'Initial Send Date'} | ||
format={'LL'} | ||
/> | ||
<DateField | ||
disabled={true} | ||
value={thirtyDayERN ? dayjs(thirtyDayERN.SendOn) : undefined} | ||
label={'30-day Send Date'} | ||
format={'LL'} | ||
/> | ||
<DateField | ||
disabled={true} | ||
value={sixtyDayERN ? dayjs(sixtyDayERN.SendOn) : undefined} | ||
label={'60-day Send Date'} | ||
format={'LL'} | ||
/> | ||
<DateField | ||
disabled={true} | ||
value={nintyDayERN ? dayjs(nintyDayERN.SendOn) : undefined} | ||
label={'90-day Send Date'} | ||
format={'LL'} | ||
/> | ||
</Box> | ||
</LocalizationProvider> | ||
); | ||
}; | ||
|
||
export default EnhancedReferralDates; |
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