Skip to content

Commit

Permalink
Display translated IOU/Report previews
Browse files Browse the repository at this point in the history
  • Loading branch information
youssef-lr committed Aug 16, 2023
1 parent 266cd4c commit 5de9792
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/ReportActionItem/IOUPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function IOUPreview(props) {

let message = props.translate('iou.cash');
if (ReportUtils.isControlPolicyExpenseReport(props.iouReport) && ReportUtils.isReportApproved(props.iouReport) && !ReportUtils.isSettled(props.iouReport)) {
message += ` • approved`;
message += ` • ${props.translate('iou.approved')}`;
} else if (props.iouReport.isWaitingOnBankAccount) {
message += ` • ${props.translate('iou.pending')}`;
} else if (ReportUtils.isSettled(props.iouReport.reportID)) {
Expand Down
7 changes: 6 additions & 1 deletion src/components/ReportActionItem/ReportPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ function ReportPreview(props) {

const managerName = ReportUtils.isPolicyExpenseChat(props.chatReport) ? ReportUtils.getPolicyName(props.chatReport) : ReportUtils.getDisplayNameForParticipant(managerID, true);
const bankAccountRoute = ReportUtils.getBankAccountRoute(props.chatReport);
const previewMessage = props.translate(ReportUtils.isSettled(props.iouReportID) || props.iouReport.isWaitingOnBankAccount ? 'iou.payerPaid' : 'iou.payerOwes', {payer: managerName});
let previewMessage;
if (ReportUtils.isControlPolicyExpenseReport(props.iouReport) && ReportUtils.isReportApproved(props.iouReport)) {
previewMessage = props.translate('iou.managerApproved', {manager: ReportUtils.getDisplayNameForParticipant(managerID, true)});
} else {
previewMessage = props.translate(ReportUtils.isSettled(props.iouReportID) || props.iouReport.isWaitingOnBankAccount ? 'iou.payerPaid' : 'iou.payerOwes', {payer: managerName});
}
const shouldShowSettlementButton =
!_.isEmpty(props.iouReport) && isCurrentUserManager && !ReportUtils.isSettled(props.iouReportID) && !props.iouReport.isWaitingOnBankAccount && reportTotal !== 0;
return (
Expand Down
2 changes: 2 additions & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ export default {
},
iou: {
amount: 'Amount',
approved: 'Approved',
cash: 'Cash',
split: 'Split',
request: 'Request',
Expand All @@ -395,6 +396,7 @@ export default {
payerOwes: ({payer}) => `${payer} owes: `,
payerPaidAmount: ({payer, amount}) => `${payer} paid ${amount}`,
payerPaid: ({payer}) => `${payer} paid: `,
managerApproved: ({manager}) => `${manager} approved:`,
payerSettled: ({amount}) => `paid ${amount}`,
waitingOnBankAccount: ({submitterDisplayName}) => `started settling up, payment is held until ${submitterDisplayName} adds a bank account`,
settledAfterAddedBankAccount: ({submitterDisplayName, amount}) => `${submitterDisplayName} added a bank account. The ${amount} payment has been made.`,
Expand Down
4 changes: 4 additions & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ export default {
},
iou: {
amount: 'Importe',
// TODO
approved: '',
cash: 'Efectivo',
split: 'Dividir',
request: 'Solicitar',
Expand All @@ -394,6 +396,8 @@ export default {
payerOwes: ({payer}) => `${payer} debe: `,
payerPaidAmount: ({payer, amount}) => `${payer} pagó ${amount}`,
payerPaid: ({payer}) => `${payer} pagó: `,
// TODO
managerApproved: ({manager}) => `${manager} approved:`,
payerSettled: ({amount}) => `pagó ${amount}`,
waitingOnBankAccount: ({submitterDisplayName}) => `inicio el pago, pero no se procesará hasta que ${submitterDisplayName} añada una cuenta bancaria`,
settledAfterAddedBankAccount: ({submitterDisplayName, amount}) => `${submitterDisplayName} añadió una cuenta bancaria. El pago de ${amount} se ha realizado.`,
Expand Down

0 comments on commit 5de9792

Please sign in to comment.