Skip to content

Commit

Permalink
fix: change message when reimbursementChoice is reimburseNo
Browse files Browse the repository at this point in the history
  • Loading branch information
koko57 committed Sep 27, 2024
1 parent 4c76858 commit c1ce94a
Showing 1 changed file with 20 additions and 33 deletions.
53 changes: 20 additions & 33 deletions src/libs/NextStepUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ function buildNextStep(report: OnyxEntry<Report>, predictedNextStatus: ValueOf<t
const type: ReportNextStep['type'] = 'neutral';
let optimisticNextStep: ReportNextStep | null;

const noActionRequired = {
icon: CONST.NEXT_STEP.ICONS.CHECKMARK,
type,
message: [
{
text: 'No further action required!',
},
],
};

switch (predictedNextStatus) {
// Generates an optimistic nextStep once a report has been opened
case CONST.REPORT.STATUS_NUM.OPEN:
Expand Down Expand Up @@ -126,6 +136,12 @@ function buildNextStep(report: OnyxEntry<Report>, predictedNextStatus: ValueOf<t
],
};

if (policy.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO) {
optimisticNextStep = noActionRequired;

break;
}

// Scheduled submit enabled
if (harvesting?.enabled && autoReportingFrequency !== CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MANUAL) {
optimisticNextStep.message = [
Expand Down Expand Up @@ -217,16 +233,10 @@ function buildNextStep(report: OnyxEntry<Report>, predictedNextStatus: ValueOf<t
}

// Generates an optimistic nextStep once a report has been closed for example in the case of Submit and Close approval flow
// or when a report has been paid
case CONST.REPORT.STATUS_NUM.CLOSED:
optimisticNextStep = {
icon: CONST.NEXT_STEP.ICONS.CHECKMARK,
type,
message: [
{
text: 'No further action required!',
},
],
};
case CONST.REPORT.STATUS_NUM.REIMBURSED:
optimisticNextStep = noActionRequired;

break;

Expand All @@ -242,15 +252,7 @@ function buildNextStep(report: OnyxEntry<Report>, predictedNextStatus: ValueOf<t
report,
)
) {
optimisticNextStep = {
type,
icon: CONST.NEXT_STEP.ICONS.CHECKMARK,
message: [
{
text: 'No further action required!',
},
],
};
optimisticNextStep = noActionRequired;
break;
}
// Self review
Expand Down Expand Up @@ -278,21 +280,6 @@ function buildNextStep(report: OnyxEntry<Report>, predictedNextStatus: ValueOf<t
};
break;

// Generates an optimistic nextStep once a report has been paid
case CONST.REPORT.STATUS_NUM.REIMBURSED:
// Paid with wallet
optimisticNextStep = {
type,
icon: CONST.NEXT_STEP.ICONS.CHECKMARK,
message: [
{
text: 'No further action required!',
},
],
};

break;

// Resets a nextStep
default:
optimisticNextStep = null;
Expand Down

0 comments on commit c1ce94a

Please sign in to comment.