Skip to content
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

3490 - Intake observations #5510

Merged
merged 4 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const BottomButtonGroup = ({
}}
disabled={disableNewCfrFormBtn()}
>
+ Create New CFR Form
+ Create New Processing Fee Form
</button>}
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const CFRFormHistoryModal = React.memo(({
return <div className='request-accordian' key={entry.cfrfeeid}>
<Accordion defaultExpanded={false} className='history-entry-accordion'>
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
<Typography className="history-entry-title">CFR Form - Version {formHistory.length - index} - {entry['cfrformreason.description'] ? entry['cfrformreason.description'] : 'Original'}
<Typography className="history-entry-title">Processing Fee Form - Version {formHistory.length - index} - {entry['cfrformreason.description'] ? entry['cfrformreason.description'] : 'Original'}
</Typography>
<Typography className="history-entry-username"> {entry.version_createdby} - {entry.version_created_at}</Typography>
</AccordionSummary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const CFRFormStatus = ({
const CFRStatuses = [
{
value: 'init',
label: 'Select CFR Form Status',
label: 'Select Processing Fee Form Status',
disabled: true,
},
{
Expand Down Expand Up @@ -64,11 +64,11 @@ export const CFRFormStatus = ({
return (
<>
{<div className='foi-assigned-to-container'>
<div className='foi-assigned-to-inner-container' id="cfrstatuscontainer">
<div className='foi-assigned-to-inner-container' id="processingfeestatuscontainer">
<TextField
id="cfrStatus"
label={"CFR Status"}
inputProps={{ "aria-labelledby": "cfrStatus-label"}}
id="processingFeeStatus"
label={"Processing Fee Status"}
inputProps={{ "aria-labelledby": "processingFeeStatus-label"}}
InputLabelProps={{ shrink: true }}
select
name="formStatus"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ export const HorizontalTabs = ({ selectedSubtab, handleSubtabChange, showApplica
{(showCFRTab && <ClickableChip
id="cfr-form"
key={`cfr-form`}
label={"CFR FORM"}
label={"PROCESSING FEE"}
color="primary"
size="small"
onClick={()=>{handleSubtabChange(FeesSubtabValues.CFRFORM)}}
clicked={selectedSubtab == FeesSubtabValues.CFRFORM}
onClick={()=>{handleSubtabChange(FeesSubtabValues.PROCESSINGFEE)}}
clicked={selectedSubtab == FeesSubtabValues.PROCESSINGFEE}
/>)}
</Stack>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const StateChangeDialog = ({
// id="state-change-dialog"
>
<DialogTitle disableTypography id="state-change-dialog-title">
<h2 className="state-change-header">CFR Form Status</h2>
<h2 className="state-change-header">Processing Fee Form Status</h2>
<IconButton className="title-col3" onClick={handleClose}>
<i className="dialog-close-button">Close</i>
<CloseIcon />
Expand Down Expand Up @@ -65,7 +65,7 @@ export const StateChangeDialog = ({
// id="state-change-dialog"
>
<DialogTitle disableTypography id="state-change-dialog-title">
<h2 className="state-change-header">Create New CFR Form </h2>
<h2 className="state-change-header">Create New Processing Fee Form </h2>
<IconButton className="title-col3" onClick={handleCreateClose}>
<i className="dialog-close-button">Close</i>
<CloseIcon />
Expand All @@ -74,10 +74,10 @@ export const StateChangeDialog = ({
<DialogContent className={'dialog-content-nomargin'}>
<DialogContentText id="state-change-dialog-description" component={'span'}>
<span className="confirmation-message create-new-modal-message">
Are you sure you want to create a new, blank CFR form? <br></br>
Are you sure you want to create a new, blank Processing Fee form? <br></br>
<em>
Any unsaved changes will be lost. The previous version will be locked for editing
and viewable in the CFR Form History.
and viewable in the Processing Fee Form History.
</em>
</span>
</DialogContentText>
Expand Down Expand Up @@ -106,7 +106,7 @@ export const StateChangeDialog = ({
// id="state-change-dialog"
>
<DialogTitle disableTypography id="state-change-dialog-title">
<h2 className="state-change-header">Create New CFR Form </h2>
<h2 className="state-change-header">Create New Processing Fee Form </h2>
<IconButton className="title-col3" onClick={handleCreateClose}>
<i className="dialog-close-button">Close</i>
<CloseIcon />
Expand All @@ -115,10 +115,10 @@ export const StateChangeDialog = ({
<DialogContent className={'dialog-content-nomargin'}>
<DialogContentText id="state-change-dialog-description" component={'span'}>
<span className="confirmation-message create-new-modal-message">
Are you sure you want to create a new, blank CFR form? <br></br>
Are you sure you want to create a new, blank Processing Fee form? <br></br>
<em>
Any unsaved changes will be lost. The previous version will be locked for editing
and viewable in the CFR Form History.
and viewable in the Processing Fee Form History.
</em>
</span>
</DialogContentText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import { formatDate, isMinistryLogin } from "../../../../../helper/FOI/helper";
import { ApplicationFeeStatuses, paymentMethods } from '../util';
import _ from 'lodash';
import CustomizedTooltip from '../../Tooltip/MuiTooltip/Tooltip';
import FileUpload from '../../FileUpload';
import { generateReceiptFromOnlinePayment } from '../../../../../apiManager/services/FOI/foiApplicationFeeFormServices';
import { getFileFromS3, getFOIS3DocumentPreSignedUrl } from '../../../../../apiManager/services/FOI/foiOSSServices';
Expand All @@ -25,7 +24,6 @@ export const ApplicationFeeTab = ({
ministryId,
requestId,
userDetail,
setCFRUnsaved,
formData,
setFormData,
rerenderFileUpload,
Expand All @@ -35,9 +33,6 @@ export const ApplicationFeeTab = ({
const dispatch = useDispatch();
const userGroups = userDetail.groups.map((group: any) => group.slice(1));
const isMinistry = isMinistryLogin(userGroups);
const initialApplicationFeeState: any = useSelector((state: any) => state.foiRequests.foiRequestApplicationFeeForm);

const [initialFormData, setInitialFormData] = useState(initialApplicationFeeState);

const handleTextChanges = (e: React.ChangeEvent<HTMLInputElement>) => {
const name : string = e.target.name;
Expand All @@ -60,24 +55,6 @@ export const ApplicationFeeTab = ({
setFormData((values: any) => ({...values, ['refundAmount']: value}));
}

const tooltipTotals = {
"title": "Payment Details",
"content": [
<div className="toolTipContent">
<p>The balance remaining for a fee estimate is the Estimated total subtracted by the amount paid.
When actuals are entered, the balance remaining is the actual totals subtracted by the amount paid.
If the balance is negative, then an applicant may be owed a refund.</p>
</div>]
};

React.useEffect(() => {
if (!_.isEqual(initialFormData, formData)) {
setCFRUnsaved(true);
} else {
setCFRUnsaved(false);
}
}, [initialFormData, formData]);

const applicationFeeStatusField = (
<div className="col-lg-6 foi-details-col">
<TextField
Expand Down Expand Up @@ -398,6 +375,13 @@ export const ApplicationFeeTab = ({
return isDisabled;
}

const refundAmountFieldError = () => {
let refundDateBlank = formData?.refundDate == '' || formData?.refundDate == null
if (!refundDateBlank && formData?.refundAmount == 0) return true;
if (formData?.refundAmount % 10 != 0 || formData?.refundAmount > formData?.amountPaid) return true
return false;
}

const [refundAmountHelperText, setRefundAmountHelperText] = useState('')

React.useEffect(() => {
Expand Down Expand Up @@ -433,13 +417,20 @@ export const ApplicationFeeTab = ({
e.target.value = parseFloat(e.target.value).toFixed(2);
}}
fullWidth
error={formData?.refundAmount % 10 != 0 || formData?.refundAmount > formData?.amountPaid}
error={refundAmountFieldError()}
helperText={refundAmountHelperText}
disabled={disableRefundFields()}
/>
</div>
)

const refundDateFieldError = () => {
if (formData?.refundAmount > 0) {
if (formData?.refundDate == '' || formData?.refundDate == null) return true
}
return false;
}

const refundDateField = (
<div className="col-lg-6 foi-details-col">
<TextField
Expand All @@ -453,6 +444,7 @@ export const ApplicationFeeTab = ({
InputLabelProps={{
shrink: true,
}}
error={refundDateFieldError()}
InputProps={{inputProps: { max: formatDate(new Date())} }}
variant="outlined"
fullWidth
Expand Down Expand Up @@ -480,10 +472,6 @@ export const ApplicationFeeTab = ({
{receiptUploadField}
{formData?.receipts.length > 0 || formData?.paymentSource == 'creditcardonline' ? uploadedReceiptsField : <></>}
</div>}
<div className="cfrform-floatRight cfrform-totals">
<CustomizedTooltip content={tooltipTotals} position={""} />
<p className="hideContent" id="popup-6">Information6</p>
</div>
</AccordionDetails>
</Accordion>
</div>
Expand Down
37 changes: 22 additions & 15 deletions forms-flow-web/src/components/FOI/customComponents/Fees/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,9 @@ export const Fees = ({
},
)
}
if (applicationFeeFormData?.applicationFeeStatus == 'appfeeowing') {
if (applicationFeeFormData?.applicationFeeStatus == 'appfeeowing' &&
(requestState === StateEnum.intakeinprogress.name || requestState === StateEnum.unopened.name)
) {
handleStateChange('App Fee Owing');
}
setReceiptFileUpload(null)
Expand Down Expand Up @@ -484,7 +486,8 @@ export const Fees = ({
errorToast(errorMessage)
},
)
if (applicationFeeFormData?.applicationFeeStatus == 'appfeeowing') {
if (applicationFeeFormData?.applicationFeeStatus == 'appfeeowing' &&
(requestState === StateEnum.intakeinprogress.name || requestState === StateEnum.unopened.name)) {
handleStateChange('App Fee Owing');
}
}
Expand Down Expand Up @@ -575,7 +578,7 @@ export const Fees = ({
if (applicationFeeFormData?.applicationFeeStatus == 'na-ige') {
setStatusChangeModalMessage('Are you sure you want to set the Application Fee Status to N/A - IGE?');
setStatusChangeModalOpen(true);
} else if (applicationFeeFormData?.applicationFeeStatus == 'appfeeowing') {
} else if (applicationFeeFormData?.applicationFeeStatus == 'appfeeowing' && (requestState === StateEnum.unopened.name || requestState === StateEnum.intakeinprogress.name)) {
setStatusChangeModalMessage(`Are you sure you want to update the Application Fee Status to App Fee Owing?
The request status will also be changed to App Fee Owing and you will be prompted to confirm the state change again.`);
setStatusChangeModalOpen(true);
Expand All @@ -584,7 +587,7 @@ export const Fees = ({
saveApplicationFeeTab();
}
}
if (selectedSubtab == FeesSubtabValues.CFRFORM) {
if (selectedSubtab == FeesSubtabValues.PROCESSINGFEE) {
saveCFRFormTab();
}
};
Expand All @@ -602,13 +605,13 @@ export const Fees = ({
const handleStatusChange = (e: React.ChangeEvent<HTMLInputElement>) => {
handleTextChanges(e);
if (e.target.value === 'review') {
setModalMessage(<>By changing the CFR Form Status to <b>"In Review with IAO"</b> you
setModalMessage(<>By changing the Processing Fee Form Status to <b>"In Review with IAO"</b> you
will be sending the form to the IAO user and locking your ability to edit the form.
Are you sure you would like to continue?</>);
} else if (e.target.value === 'approved') {
setModalMessage(<>Are you sure you want to change the status to <b>"Approved"</b>? Once approved, a CFR form is uneditable. Any changes will require a new CFR form to be created.</>);
setModalMessage(<>Are you sure you want to change the status to <b>"Approved"</b>? Once approved, a Processing Fee form is uneditable. Any changes will require a new Processing Fee form to be created.</>);
} else if (e.target.value === 'clarification') {
setModalMessage(<>By changing the CFR Form Status to <b>"Needs Clarification with Ministry" </b> you
setModalMessage(<>By changing the Processing Fee Form Status to <b>"Needs Clarification with Ministry" </b> you
will be sending the form to the Ministry user and locking your ability to edit the form.
Are you sure you would like to continue?</>);
}
Expand Down Expand Up @@ -649,7 +652,7 @@ export const Fees = ({
setIsNewCFRForm(true)
}

const [selectedSubtab, setSelectedSubtab] = useState(FeesSubtabValues.CFRFORM)
const [selectedSubtab, setSelectedSubtab] = useState(FeesSubtabValues.PROCESSINGFEE)

React.useEffect(() => {
if (!isMinistry) {
Expand All @@ -659,7 +662,7 @@ export const Fees = ({
requestState === StateEnum.appfeeowing.name) {
setSelectedSubtab(FeesSubtabValues.APPLICATIONFEE);
} else {
setSelectedSubtab(FeesSubtabValues.CFRFORM);
setSelectedSubtab(FeesSubtabValues.PROCESSINGFEE);
}
}
}, [requestState])
Expand Down Expand Up @@ -700,12 +703,17 @@ export const Fees = ({
<div className="foi-request-number-header">
<h3 className="foi-review-request-text">{requestNumber}</h3>
</div>
{selectedSubtab == FeesSubtabValues.PROCESSINGFEE ?
<Chip
label={initialCFRFormData.formStatus === 'approved' ? "Version " + formHistory.length : "Version " + (formHistory.length + 1) + " Draft" }
sx={{ backgroundColor: '#096DD1', color: '#fff', height: 19}}
/>
/>
:
<div>
<div style={{height: 29}}></div>
</div>}
</div>
{selectedSubtab == FeesSubtabValues.CFRFORM && <CFRFormStatus
{selectedSubtab == FeesSubtabValues.PROCESSINGFEE && <CFRFormStatus
formData={CFRFormData}
handleStatusChange={handleStatusChange}
cfrStatusDisabled={cfrStatusDisabled}
Expand All @@ -718,7 +726,7 @@ export const Fees = ({
/>}
</div>
{/* CFR Form History */}
{selectedSubtab == FeesSubtabValues.CFRFORM ? <div className="cfr-history-button">
{selectedSubtab == FeesSubtabValues.PROCESSINGFEE ? <div className="cfr-history-button">
<CFRFormHistoryModal
modalOpen={historyModalOpen}
handleClose={handleHistoryClose}
Expand All @@ -731,7 +739,7 @@ export const Fees = ({
disabled={formHistory.length < 1}
onClick={() => setHistoryModal(true)}
>
CFR Form History
Processing Fee Form History
</button>
</div> :
// placeholder for layout
Expand All @@ -753,14 +761,13 @@ export const Fees = ({
ministryId={ministryId}
requestId={requestId}
userDetail={userDetail}
setCFRUnsaved={setCFRUnsaved}
formData={applicationFeeFormData}
setFormData={setApplicationFeeFormData}
rerenderFileUpload={rerenderFileUpload}
handleTextChanges={handleTextChanges}
updateFilesCb={updateFilesCb}
/>}
{selectedSubtab == FeesSubtabValues.CFRFORM &&
{selectedSubtab == FeesSubtabValues.PROCESSINGFEE &&
<>
<CFRFormTab
requestState={requestState}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ export type modalParams = {

export enum FeesSubtabValues {
APPLICATIONFEE = "APPLICATIONFEE",
CFRFORM = "CFRFORM"
PROCESSINGFEE = "PROCESSINGFEE"
}
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ const ExportHistory = ({
{showCFRTab() &&
<div style={{ pageBreakInside: 'avoid' }}>
<div className="export_title">
<h1 className="foi-review-request-text foi-ministry-requestheadertext">CFR Forms</h1>
<h1 className="foi-review-request-text foi-ministry-requestheadertext">Processing Fee</h1>
</div>
<ExportCFRForms foiRequestCFRFormHistory={foiRequestCFRFormHistory} foiRequestCFRForm={foiRequestCFRForm} />
</div>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __preparefeestatuschangecomment(self, requestid, ministryrequestid, data, us
appfeestatus = 'Paid'
elif 'applicationfeestatus' in data and data['applicationfeestatus'].lower() == 'appfeeowing':
appfeestatus = 'App Fee Owing'
commentmessage = '{} has updated Application fee status to {}'.format(username, appfeestatus)
commentmessage = '{} has updated Application Fee Status to {}'.format(username, appfeestatus)
if ministryrequestid is not None:
comment = {"comment": commentmessage, "commenttypeid": 2, "ministryrequestid": ministryrequestid}
else:
Expand Down Expand Up @@ -74,10 +74,10 @@ def __preparefeestatuschangenotification(self, status):

def __feestatusnotificationmessage(self, status):
if status.lower() == 'na-ige':
return 'Application fee status updated to N/A - IGE'
return 'Application Fee Status updated to N/A - IGE'
elif status.lower() == 'paid':
return 'Application fee status updated to Paid'
return 'Application Fee Status updated to Paid'
elif status.lower() == 'appfeeowing':
return 'Application fee status updated to App Fee Owing'
return 'Application Fee Status updated to App Fee Owing'
else:
return 'Application fee status updated to '+ status
return 'Application Fee Status updated to '+ status