Merged in feat/SW-165-fixes (pull request #460)

Feat/SW-165 fixes

* fix(SW-165): update translations for reward labels

* fix(SW-165): Fix sorting and filtering of transactions and hide fields when BALFWD

* fix(SW-165): update condition


Approved-by: Michael Zetterberg
This commit is contained in:
Tobias Johansson
2024-08-22 14:34:55 +00:00
parent 0815075ba2
commit 159114a082
7 changed files with 80 additions and 50 deletions

View File

@@ -27,8 +27,15 @@ export default function Row({ transaction }: RowProps) {
switch (transaction.type) {
case RewardTransactionTypes.stay:
if (transaction.hotelId === "ORS")
case RewardTransactionTypes.stayAdj:
if (transaction.hotelId === "ORS") {
description = intl.formatMessage({ id: "Former Scandic Hotel" })
}
if (transaction.confirmationNumber === "BALFWD") {
description = intl.formatMessage({
id: "Points earned prior to May 1, 2021",
})
}
break
case RewardTransactionTypes.ancillary:
description = intl.formatMessage({ id: "Extras to your booking" })
@@ -41,21 +48,31 @@ export default function Row({ transaction }: RowProps) {
break
case RewardTransactionTypes.tui_points:
description = intl.formatMessage({ id: "TUI Points" })
case RewardTransactionTypes.stayAdj:
if (transaction.confirmationNumber === "BALFWD")
description = intl.formatMessage({
id: "Points earned prior to May 1, 2021",
})
break
case RewardTransactionTypes.pointShop:
description = intl.formatMessage({ id: "Scandic Friends Point Shop" })
break
}
const arrival = dt(transaction.checkinDate).locale(lang).format("DD MMM YYYY")
const transactionDate = dt(transaction.transactionDate)
.locale(lang)
.format("DD MMM YYYY")
function renderConfirmationNumber() {
if (transaction.confirmationNumber === "BALFWD") return null
if (
transaction.bookingUrl &&
(transaction.type === RewardTransactionTypes.stay ||
transaction.type === RewardTransactionTypes.rewardNight)
) {
return (
<Link variant="underscored" href={transaction.bookingUrl}>
{transaction.confirmationNumber}
</Link>
)
}
return transaction.confirmationNumber
}
return (
<tr className={styles.tr}>
@@ -64,18 +81,11 @@ export default function Row({ transaction }: RowProps) {
isCalculated={transaction.pointsCalculated}
/>
<td className={`${styles.td} ${styles.description}`}>{description}</td>
<td className={styles.td}>{renderConfirmationNumber()}</td>
<td className={styles.td}>
{transaction.type === RewardTransactionTypes.stay &&
transaction.bookingUrl ? (
<Link variant="underscored" href={transaction.bookingUrl}>
{transaction.confirmationNumber}
</Link>
) : (
transaction.confirmationNumber
)}
</td>
<td className={styles.td}>
{transaction.checkinDate ? arrival : transactionDate}
{transaction.checkinDate && transaction.confirmationNumber !== "BALFWD"
? arrival
: null}
</td>
</tr>
)