Skip to content

Commit

Permalink
Merge pull request #5465 from bcgov/dev-marshal-MD-intake
Browse files Browse the repository at this point in the history
3490 - Intake Updates - minor fixes
  • Loading branch information
milosdes authored Dec 4, 2024
2 parents 69921bd + bf4a57d commit b020a81
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,15 @@ export const ApplicationFeeTab = ({
const uploadedReceiptsField = formData?.receipts.map((receipt: any) => {
if (receipt.isactive) {
return (
<div className="col-lg-12 foi-details-col">
<div className="col-lg-12 foi-details-col application-fee-receipt">
<u
className="receipt-link"
onClick={() => {
getReceiptFile(receipt?.receiptfilename, receipt?.receiptfilepath)}
}
>{receipt.receiptfilename ? receipt.receiptfilename : 'view online payment receipt'}</u>
<i
className="fa fa-times-circle"
className="fa fa-times-circle receipt-delete"
onClick={() => setFormData((values: any) => ({...values, ['receipts']: [...formData?.receipts.filter((r: any) => r.receiptfilename != receipt.receiptfilename), {...receipt, isactive: false}]}))}
>
</i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@
font-size: 20px;
margin-top: 2px;
}
.receipt-link {
cursor: pointer;
}
.receipt-delete {
cursor: pointer;
}
}

@media (max-width: 1444px) {
Expand Down
21 changes: 14 additions & 7 deletions forms-flow-web/src/components/FOI/customComponents/Fees/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,15 @@ export const Fees = ({
}

const validateFields = () => {
if (applicationFeeFormData?.paymentSource != 'creditcardonline') {
if (applicationFeeFormData?.paymentDate == null || applicationFeeFormData?.paymentDate == '') return false;
if (applicationFeeFormData?.amountPaid == 0) return false;
if (applicationFeeFormData?.paymentSource == 'init') return false;
if (!_.isEqual(initialApplicationFeeFormData?.applicationFeeStatus, applicationFeeFormData?.applicationFeeStatus)) {
if (applicationFeeFormData?.applicationFeeStatus == 'na-ige' || applicationFeeFormData?.applicationFeeStatus == 'appfeeowing') return true;
if (applicationFeeFormData?.applicationFeeStatus == 'paid') {
if (applicationFeeFormData?.paymentSource != 'creditcardonline') {
if (applicationFeeFormData?.paymentDate == null || applicationFeeFormData?.paymentDate == '') return false;
if (applicationFeeFormData?.amountPaid == 0) return false;
if (applicationFeeFormData?.paymentSource == 'init') return false;
}
}
}
if (validateBalancePaymentMethod() || validateEstimatePaymentMethod()) {
return false;
Expand All @@ -245,10 +250,12 @@ export const Fees = ({
if (!validateApplicationFeeAmountPaid()) {
return false;
}
if (!validateApplicationFeeRefundAmount() || !applicationFeeFormData?.refundDate) {
return false;
if (!_.isEqual(initialApplicationFeeFormData?.refundAmount, applicationFeeFormData?.refundAmount) ||
!_.isEqual(initialApplicationFeeFormData?.refundDate, applicationFeeFormData?.refundDate)) {
if (!validateApplicationFeeRefundAmount() || !applicationFeeFormData?.refundDate) {
return false;
}
}

if (receiptFileUpload && receiptFileUpload.length > 0) return true;

return !_.isEqual(initialCFRFormData, CFRFormData) || !_.isEqual(initialApplicationFeeFormData, applicationFeeFormData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def saveapplicationfee(self, requestid, ministryrequestid, data, userid = 'syste
if result.success == True and applicationfeeservice().applicationfeestatushaschanged(requestid):
applicationfeeformevent().createfeestatuschangeevent(requestid, ministryrequestid, data, userid, username)
if result.success == True and applicationfeeservice().applicationfeerefundupdated(requestid):
applicationfeeformevent().createfeerefundevent(requestid, ministryrequestid, applicationfee.refundamount, userid, username)
applicationfeeformevent().createfeerefundevent(requestid, ministryrequestid, data['refundamount'], userid, username)
return result

def getapplicationfee(self, requestid, ministryrequestid = None):
Expand Down Expand Up @@ -90,7 +90,7 @@ def __prepareapplicationfee(self, requestid, data={}, getprevious=True):
applicationfee.orderid = data.get('orderid', None)
applicationfee.transactionnumber = data.get('transactionnumber', None)
applicationfee.refundamount = data.get('refundamount', None)
if data['refunddate'] and isinstance(data['refunddate'], str) and len(data['refunddate']) < 11 and data['refunddate'].count('-') == 2:
if 'refunddate' in data and isinstance(data['refunddate'], str) and len(data['refunddate']) < 11 and data['refunddate'].count('-') == 2:
parseddateobject = data['refunddate'].split('-')
datetime_object = datetime(int(parseddateobject[0]), int(parseddateobject[1]), int(parseddateobject[2]), 17, 0, 0)
applicationfee.refunddate = datetime_object
Expand Down

0 comments on commit b020a81

Please sign in to comment.