6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit a2efe795

AuthorMikkel Thygesen<mth@dwarf.dk>
Date2025-04-30 16:31:14 +0200
1552: Removed payment info from past details

Changed files

.../lib/check_in/check_in_repository.dart          |  3 ++-
 comwell_key_app/lib/overview/models/booking.dart   |  9 +++++--
 .../past_cancelled_booking_detail_page.dart        | 31 ----------------------
 3 files changed, 9 insertions(+), 34 deletions(-)

Diff

diff --git a/comwell_key_app/lib/check_in/check_in_repository.dart b/comwell_key_app/lib/check_in/check_in_repository.dart
index 5be332f1..d22b616f 100644
--- a/comwell_key_app/lib/check_in/check_in_repository.dart
+++ b/comwell_key_app/lib/check_in/check_in_repository.dart
@@ -26,7 +26,8 @@ class CheckInRepository {
final user = await profileRepository.fetchProfileSettings();
final entity = await db.bookingsDao.getBookingDetails(bookingId);
final Json json = jsonDecode(entity.json) as Json;
- return BookingDTO.fromJson(json).toBooking(user.id);
+ return BookingDTO.fromJson(json)
+ .toBooking(user.id, BookingStatus.fromString(entity.status));
}
Future<void> checkIfSetup() async {
diff --git a/comwell_key_app/lib/overview/models/booking.dart b/comwell_key_app/lib/overview/models/booking.dart
index 48cc0f30..01faa70c 100644
--- a/comwell_key_app/lib/overview/models/booking.dart
+++ b/comwell_key_app/lib/overview/models/booking.dart
@@ -39,7 +39,8 @@ class Booking extends Equatable {
Iterable<Guest>? guests,
}) : guests = _ensureBookerInGuestList(booker, guests ?? []);
- static Iterable<Guest> _ensureBookerInGuestList(Guest booker, Iterable<Guest> guests) {
+ static Iterable<Guest> _ensureBookerInGuestList(
+ Guest booker, Iterable<Guest> guests) {
final bookerExists = guests.any((guest) => guest.id == booker.id);
if (!bookerExists) {
return [
@@ -118,5 +119,9 @@ class Booking extends Equatable {
enum BookingStatus {
current,
past,
- cancelled,
+ cancelled;
+
+ static BookingStatus fromString(String value) {
+ return BookingStatus.values.firstWhere((status) => status.name == value.toLowerCase());
+ }
}
diff --git a/comwell_key_app/lib/overview/past_cancelled_booking_detail_page.dart b/comwell_key_app/lib/overview/past_cancelled_booking_detail_page.dart
index 21b28a2c..6922061a 100644
--- a/comwell_key_app/lib/overview/past_cancelled_booking_detail_page.dart
+++ b/comwell_key_app/lib/overview/past_cancelled_booking_detail_page.dart
@@ -120,37 +120,6 @@ class PastCancelledBookingDetailPage extends StatelessWidget {
.toString(),
style: theme.textTheme.headlineSmall)),
const Divider(color: colorDivider),
- ListTile(
- contentPadding: const EdgeInsets.symmetric(horizontal: 0),
- title: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('payment'.tr(), style: theme.textTheme.headlineLarge),
- const SizedBox(height: 20),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- // TODO: Remove?
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('payment_method'.tr(),
- style: theme.textTheme.bodySmall?.copyWith(
- color: Colors.black.withAlpha((0.65 * 255).toInt()))),
- Text("booking.paymentDetails.cardNumber",
- style: theme.textTheme.headlineSmall),
- ]),
- booking.status == BookingStatus.cancelled
- ? Text('booking_annulled'.tr(),
- style: theme.textTheme.headlineSmall
- ?.copyWith(color: Colors.red))
- : const PaymentCardImage(
- cardType: CardType.mastercard),
- ],
- )
- ],
- )),
- const Divider(color: colorDivider),
booking.status != BookingStatus.cancelled
? ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 0),