6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit f03c6a81
Changed files
.../up_sales/models/dto/room_upgrade_dto.g.dart | 4 +- .../booking_details/bloc/booking_details_bloc.dart | 2 + .../lib/booking_details/booking_details_page.dart | 2 +- .../components/unlock_room_button.dart | 1 + .../lib/check_in/check_in_repository.dart | 25 ++ .../lib/check_out/bloc/check_out_cubit.dart | 3 +- .../lib/check_out/pages/check_out_error_page.dart | 3 - .../check_out/pages/check_out_processing_page.dart | 4 - .../lib/key/repository/key_repository.dart | 6 +- .../components/balance_bottom_sheet.dart | 344 ++++++++++----------- .../lib/my_booking/cubit/my_booking_cubit.dart | 4 + .../lib/my_booking/my_booking_page.dart | 184 +++++------ comwell_key_app/lib/overview/models/booking.dart | 3 +- comwell_key_app/lib/overview/overview_page.dart | 2 +- .../overview/repository/overview_repository.dart | 2 - .../pregistration/pregistration_repository.dart | 1 - comwell_key_app/lib/routing/app_router.dart | 6 +- comwell_key_app/lib/routing/app_routes.dart | 1 + comwell_key_app/lib/services/api.dart | 1 - .../lib/services/mappers/addon_item_mapper.dart | 5 +- .../lib/services/mappers/booking_mapper.dart | 1 - .../components/catalog/service_catalog.dart | 5 +- .../components/up_sales_services_widget.dart | 2 +- .../components/up_sales_upgrades_widget.dart | 5 +- .../lib/up_sales/cubit/up_sales_cubit.dart | 1 + .../lib/up_sales/mappers/addon_upgrade_mapper.dart | 6 +- .../lib/up_sales/mappers/room_upgrade_mapper.dart | 2 +- .../lib/up_sales/models/addon_upgrade.dart | 12 +- .../lib/up_sales/models/dto/addon_upgrade_dto.dart | 8 +- .../lib/up_sales/models/dto/room_upgrade_dto.dart | 9 +- .../lib/up_sales/models/room_upgrade.dart | 26 +- comwell_key_app/lib/up_sales/models/upgrade.dart | 8 +- .../pages/processing/up_sales_processing_page.dart | 1 - .../lib/up_sales/pages/room_upgrade_page.dart | 4 +- comwell_key_app/lib/utils/locator.dart | 2 + .../test/overview_test/overview_cubic_test.dart | 12 +- .../overview_test/overview_repository_test.dart | 6 +- 37 files changed, 371 insertions(+), 342 deletions(-)
Diff
diff --git a/comwell_key_app/lib/.generated/up_sales/models/dto/room_upgrade_dto.g.dart b/comwell_key_app/lib/.generated/up_sales/models/dto/room_upgrade_dto.g.dart
index c599438b..7eba7335 100644
--- a/comwell_key_app/lib/.generated/up_sales/models/dto/room_upgrade_dto.g.dart
+++ b/comwell_key_app/lib/.generated/up_sales/models/dto/room_upgrade_dto.g.dart
@@ -12,13 +12,13 @@ RoomUpgradeDTO _$RoomUpgradeDTOFromJson(Map json) => RoomUpgradeDTO(
price: (json['price'] as num).toInt(),
images: (json['images'] as List<dynamic>).map((e) => e as String),
description: json['description'] as String,
- tags: (json['tags'] as List<dynamic>).map((e) => e as String),
currency: json['currency'] as String,
quantity: (json['quantity'] as num?)?.toInt(),
facilityTypes: (json['facilityTypes'] as List<dynamic>)
.map(
(e) => FacilityType.fromJson(Map<String, dynamic>.from(e as Map)))
.toList(),
+ roomSize: (json['roomSize'] as num).toInt(),
);
Map<String, dynamic> _$RoomUpgradeDTOToJson(RoomUpgradeDTO instance) =>
@@ -29,7 +29,7 @@ Map<String, dynamic> _$RoomUpgradeDTOToJson(RoomUpgradeDTO instance) =>
'currency': instance.currency,
'images': instance.images.toList(),
'description': instance.description,
- 'tags': instance.tags.toList(),
'quantity': instance.quantity,
'facilityTypes': instance.facilityTypes.map((e) => e.toJson()).toList(),
+ 'roomSize': instance.roomSize,
};
diff --git a/comwell_key_app/lib/booking_details/bloc/booking_details_bloc.dart b/comwell_key_app/lib/booking_details/bloc/booking_details_bloc.dart
index 4d2c9160..8389af98 100644
--- a/comwell_key_app/lib/booking_details/bloc/booking_details_bloc.dart
+++ b/comwell_key_app/lib/booking_details/bloc/booking_details_bloc.dart
@@ -211,4 +211,6 @@ class BookingDetailsBloc
Future<void> getUser(Emitter<BookingDetailsState> emit) async {
user = await profileRepository.fetchProfileSettings();
}
+
+
}
diff --git a/comwell_key_app/lib/booking_details/booking_details_page.dart b/comwell_key_app/lib/booking_details/booking_details_page.dart
index 0e8526ab..7934b24d 100644
--- a/comwell_key_app/lib/booking_details/booking_details_page.dart
+++ b/comwell_key_app/lib/booking_details/booking_details_page.dart
@@ -122,7 +122,7 @@ class BookingDetailsPage extends StatelessWidget {
BookingDetailsState state, BookingDetailsBloc cubit, ThemeData theme) {
return InkWell(
onTap: () {
- context.pushNamed(AppRoutes.myBooking.name, extra: [cubit.booking, cubit.state.upSales]);
+ context.pushNamed(AppRoutes.myBooking.name, extra: cubit.booking);
},
child: Container(
width: double.infinity,
diff --git a/comwell_key_app/lib/booking_details/components/unlock_room_button.dart b/comwell_key_app/lib/booking_details/components/unlock_room_button.dart
index d219a418..ca192694 100644
--- a/comwell_key_app/lib/booking_details/components/unlock_room_button.dart
+++ b/comwell_key_app/lib/booking_details/components/unlock_room_button.dart
@@ -18,6 +18,7 @@ class UnlockRoomButton extends StatelessWidget {
child: SliderButton(
backgroundColor: sandColor,
width: double.infinity,
+ vibrationFlag: true,
icon: Center(
child: SvgPicture.asset(
'assets/icons/Union.svg',
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 06d2078c..e39c6f72 100644
--- a/comwell_key_app/lib/check_in/check_in_repository.dart
+++ b/comwell_key_app/lib/check_in/check_in_repository.dart
@@ -1,5 +1,6 @@
import 'package:comwell_key_app/database/comwell_db.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
+import 'package:comwell_key_app/overview/models/guest.dart';
import 'package:comwell_key_app/profile/profile_repository.dart';
import 'package:comwell_key_app/services/api.dart';
import 'package:comwell_key_app/utils/locator.dart';
@@ -51,4 +52,28 @@ class CheckInRepository {
}
}
+ static final mockBooking = Booking(
+ id: "helloworld",
+ roomNumber: "1234",
+ startDate: DateTime.now(),
+ endDate: DateTime.now(),
+ bookingStatus: BookingStatus.current,
+ reservationStatus: ReservationStatus.newreservation,
+ image: "",
+ hotelName: "hotelName",
+ roomType: "roomType",
+ confirmationId: "",
+ children: 0,
+ adults: 2,
+ hotelCode: "hotelCode",
+ totalCharge: 100,
+ balance: 0,
+ maskedCardNumber: "1234567890",
+ booker: const Guest(name: "Booker", id: "123"),
+ bookingDate: DateTime.now(),
+ digitalCard: true,
+ guests: null,
+ rooms: const [],
+ addOnItems: const [],
+ );
}
diff --git a/comwell_key_app/lib/check_out/bloc/check_out_cubit.dart b/comwell_key_app/lib/check_out/bloc/check_out_cubit.dart
index 60f0dd9b..4ba4d0e4 100644
--- a/comwell_key_app/lib/check_out/bloc/check_out_cubit.dart
+++ b/comwell_key_app/lib/check_out/bloc/check_out_cubit.dart
@@ -3,7 +3,6 @@ import 'package:bloc/bloc.dart';
import 'package:comwell_key_app/check_out/bloc/check_out_state.dart';
import 'package:comwell_key_app/check_out/check_out_repository.dart';
import 'package:comwell_key_app/check_out/models/checkout_processing_state.dart';
-import 'package:comwell_key_app/check_out/models/payment_method.dart';
import 'package:comwell_key_app/check_out/pages/check_out_page.dart';
import 'package:comwell_key_app/check_out/utils/constants.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
@@ -179,7 +178,7 @@ class CheckoutCubit extends Cubit<CheckoutState> {
value: bookingPrice,
currency: currency,
);
- print("qqq applyClubPoints ${state.applyClubPoints}");
+
final paymentConfigurations =
await preregistrationRepository.sessionCheckout(
amount, booking.confirmationId, state.applyClubPoints);
diff --git a/comwell_key_app/lib/check_out/pages/check_out_error_page.dart b/comwell_key_app/lib/check_out/pages/check_out_error_page.dart
index 6bf709af..7a62001c 100644
--- a/comwell_key_app/lib/check_out/pages/check_out_error_page.dart
+++ b/comwell_key_app/lib/check_out/pages/check_out_error_page.dart
@@ -1,9 +1,6 @@
-import 'package:comwell_key_app/check_out/bloc/check_out_cubit.dart';
-import 'package:comwell_key_app/check_out/components/check_out_countdown.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
-import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
class CheckOutErrorPage extends StatelessWidget {
diff --git a/comwell_key_app/lib/check_out/pages/check_out_processing_page.dart b/comwell_key_app/lib/check_out/pages/check_out_processing_page.dart
index ba7276de..8f163eb2 100644
--- a/comwell_key_app/lib/check_out/pages/check_out_processing_page.dart
+++ b/comwell_key_app/lib/check_out/pages/check_out_processing_page.dart
@@ -1,16 +1,12 @@
-import 'dart:io';
-
import 'package:adyen_checkout/adyen_checkout.dart';
import 'package:comwell_key_app/check_out/bloc/check_out_cubit.dart';
import 'package:comwell_key_app/check_out/models/checkout_processing_state.dart';
-import 'package:comwell_key_app/check_out/models/payment_method.dart';
import 'package:comwell_key_app/check_out/pages/check_out_error_page.dart';
import 'package:comwell_key_app/check_out/pages/check_out_success_page.dart';
import 'package:comwell_key_app/themes/dark_theme.dart';
import 'package:comwell_key_app/utils/lottie_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-import 'package:go_router/go_router.dart';
import 'package:lottie/lottie.dart';
class CheckOutProcessingPage extends StatefulWidget {
diff --git a/comwell_key_app/lib/key/repository/key_repository.dart b/comwell_key_app/lib/key/repository/key_repository.dart
index 0ed4cf30..3008943b 100644
--- a/comwell_key_app/lib/key/repository/key_repository.dart
+++ b/comwell_key_app/lib/key/repository/key_repository.dart
@@ -49,10 +49,8 @@ class KeyRepository {
}
Future<void> _checkAndStartScan() async {
- print("qqq _checkAndStartScan ${_isScanning}");
if (!_isScanning) {
- print("qqq start scanning");
await startScanning();
_isScanning = true;
}
@@ -69,7 +67,6 @@ class KeyRepository {
Future<void> startScanning() async {
try {
- print("qqq start scanning second");
await seosMobileKeysPlugin
.startReaderScan(MobileKeysScanMode.optimizePerformance, [
MobileKeysOpeningType(openingType: OpeningType.proximity),
@@ -81,10 +78,9 @@ class KeyRepository {
2,
]).then( (value) {
if (kDebugMode) {
- print('startScanning: "scanned');
+ debugPrint('startScanning: "scanned');
}
});
- print("qqq start scanning third");
} catch (e) {
throw Exception('Failed to start scanning - ${e.toString()}');
diff --git a/comwell_key_app/lib/my_booking/components/balance_bottom_sheet.dart b/comwell_key_app/lib/my_booking/components/balance_bottom_sheet.dart
index 86cd964b..7171e207 100644
--- a/comwell_key_app/lib/my_booking/components/balance_bottom_sheet.dart
+++ b/comwell_key_app/lib/my_booking/components/balance_bottom_sheet.dart
@@ -1,22 +1,27 @@
+import 'package:comwell_key_app/my_booking/cubit/my_booking_cubit.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
+import 'package:comwell_key_app/routing/app_routes.dart';
+import 'package:comwell_key_app/services/models/booking_dto.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:comwell_key_app/up_sales/models/addon_upgrade.dart';
import 'package:comwell_key_app/utils/share_button_utils.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
+import 'package:go_router/go_router.dart';
class BalanceBottomSheet extends StatelessWidget {
final num balance;
final String userName;
final Booking booking;
- final List<AddOnUpgrade> items;
+ final List<BookingAddonItem> addOnItems;
+ final MyBookingCubit cubit;
const BalanceBottomSheet({
super.key,
required this.booking,
required this.balance,
required this.userName,
- required this.items,
+ required this.addOnItems,
+ required this.cubit,
});
@override
@@ -26,184 +31,187 @@ class BalanceBottomSheet extends StatelessWidget {
decoration: const BoxDecoration(
color: Colors.white,
),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Padding(
- padding:
- const EdgeInsets.symmetric(vertical: 40.0, horizontal: 16),
- child: Container(
- padding: const EdgeInsets.symmetric(vertical: 8),
- decoration: const BoxDecoration(
- border: Border(
- bottom: BorderSide(color: colorDivider),
- ),
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- const SizedBox(width: 16),
- Text(
- 'my_balance'.tr(),
- style: theme.textTheme.titleLarge?.copyWith(
- fontWeight: FontWeight.bold,
- ),
- ),
- CircleAvatar(
- radius: 16,
- backgroundColor: sandColor[40],
- child: IconButton(
- padding: EdgeInsets.zero,
- constraints: const BoxConstraints(),
- icon: const Icon(Icons.keyboard_arrow_down, size: 20),
- onPressed: () => Navigator.pop(context),
- color: Colors.black54,
- ),
+ child: Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding:
+ const EdgeInsets.symmetric(vertical: 40.0, horizontal: 16),
+ child: Container(
+ padding: const EdgeInsets.symmetric(vertical: 8),
+ decoration: const BoxDecoration(
+ border: Border(
+ bottom: BorderSide(color: colorDivider),
),
- ],
- ),
- ),
- ),
-
- // Content
- Padding(
- padding: const EdgeInsets.all(10),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- // User info
- Row(
+ ),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- CircleAvatar(
- backgroundColor: sandColor,
- child: Text(
- generateInitialsString(userName),
- style: const TextStyle(color: Colors.white),
- ),
- ),
- const SizedBox(width: 12),
+ const SizedBox(width: 16),
Text(
- userName,
- style: theme.textTheme.bodyMedium?.copyWith(
+ 'my_balance'.tr(),
+ style: theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.bold,
),
),
+ CircleAvatar(
+ radius: 16,
+ backgroundColor: sandColor[40],
+ child: IconButton(
+ padding: EdgeInsets.zero,
+ constraints: const BoxConstraints(),
+ icon: const Icon(Icons.keyboard_arrow_down, size: 20),
+ onPressed: () => Navigator.pop(context),
+ color: Colors.black54,
+ ),
+ ),
],
),
- const SizedBox(height: 16),
- ...items.map((item) => _buildBalanceItem(item, theme)),
- const SizedBox(height: 24),
-
- Container(
- padding: const EdgeInsets.all(16),
- decoration: BoxDecoration(
- color: sandColor[10],
- borderRadius: BorderRadius.circular(4),
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ ),
+ ),
+
+ // Content
+ Padding(
+ padding: const EdgeInsets.all(10),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ // User info
+ Row(
children: [
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- 'total_charge'.tr(),
- style: theme.textTheme.bodyMedium?.copyWith(
- fontSize: 16,
- fontWeight: FontWeight.w400,
- ),
- ),
- Text(
- 'total_charge_value'
- .tr(args: [booking.totalCharge.toString()]),
- style: theme.textTheme.titleLarge
- ?.copyWith(fontWeight: FontWeight.bold),
- ),
- ],
- ),
- const SizedBox(width: 12),
CircleAvatar(
- backgroundColor: sandColor[40],
- child: const Icon(
- Icons.credit_card,
- color: Colors.black54,
- size: 20,
+ backgroundColor: sandColor,
+ child: Text(
+ generateInitialsString(userName),
+ style: const TextStyle(color: Colors.white),
),
),
- ],
- ),
- ),
-
- const SizedBox(height: 16),
- ],
- ),
- ),
- ],
- ),
-
- // Payment button
- Column(
- children: [
- const Divider(color: colorDivider),
- Padding(
- padding: const EdgeInsets.all(16),
- child: SizedBox(
- width: double.infinity,
- child: ElevatedButton(
- onPressed: () {
- // Handle payment
- },
- style: theme.elevatedButtonTheme.style?.copyWith(
- padding: const WidgetStatePropertyAll(
- EdgeInsets.symmetric(vertical: 16)),
- shape: WidgetStatePropertyAll(RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(32))),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
+ const SizedBox(width: 12),
Text(
- 'Gå til betaling ',
+ userName,
style: theme.textTheme.bodyMedium?.copyWith(
- color: Colors.white,
- fontSize: 16,
- fontWeight: FontWeight.w600,
+ fontWeight: FontWeight.bold,
),
),
- Text(
- "total_charge_value"
- .tr(args: [balance.toString()]),
+ ],
+ ),
+ const SizedBox(height: 16),
+ ...addOnItems.map((item) => _buildBalanceItem(item, theme)),
+ const SizedBox(height: 24),
+
+ Container(
+ padding: const EdgeInsets.all(16),
+ decoration: BoxDecoration(
+ color: sandColor[10],
+ borderRadius: BorderRadius.circular(4),
+ ),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'total_charge'.tr(),
+ style: theme.textTheme.bodyMedium?.copyWith(
+ fontSize: 16,
+ fontWeight: FontWeight.w400,
+ ),
+ ),
+ Text(
+ 'total_charge_value'
+ .tr(args: [cubit.totalAddonBalance.toString()]),
+ style: theme.textTheme.titleLarge
+ ?.copyWith(fontWeight: FontWeight.bold),
+ ),
+ ],
+ ),
+ const SizedBox(width: 12),
+ CircleAvatar(
+ backgroundColor: sandColor[40],
+ child: const Icon(
+ Icons.credit_card,
+ color: Colors.black54,
+ size: 20,
+ ),
+ ),
+ ],
+ ),
+ ),
+
+ const SizedBox(height: 16),
+ ],
+ ),
+ ),
+ ],
+ ),
+
+ // Payment button
+ Column(
+ children: [
+ const Divider(color: colorDivider),
+ Padding(
+ padding: const EdgeInsets.all(16),
+ child: SizedBox(
+ width: double.infinity,
+ child: ElevatedButton(
+ onPressed: () => cubit.canContinueToPayment ? context.pushNamed(AppRoutes.payMyBooking.name) : null,
+ style: theme.elevatedButtonTheme.style?.copyWith(
+ backgroundColor: WidgetStatePropertyAll(cubit.canContinueToPayment ? sandColor : Colors.grey),
+ padding: const WidgetStatePropertyAll(
+ EdgeInsets.symmetric(vertical: 16)),
+ shape: WidgetStatePropertyAll(RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(32))),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ 'Gå til betaling ',
style: theme.textTheme.bodyMedium?.copyWith(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.w600,
- )),
- ],
+ ),
+ ),
+ Text(
+ "total_charge_value"
+ .tr(args: [balance.toInt().toString()]),
+ style: theme.textTheme.bodyMedium?.copyWith(
+ color: Colors.white,
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ )),
+ ],
+ ),
),
),
),
),
- ),
- ],
- ),
- ],
+ ],
+ ),
+ ],
+ ),
),
);
}
- Widget _buildBalanceItem(BalanceItem item, ThemeData theme) {
+ Widget _buildBalanceItem(BookingAddonItem item, ThemeData theme) {
+ final quantityString = item.quantity > 1 ? 'x ${item.quantity}' : '';
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
- item.description,
+ "${item.description} $quantityString",
style: TextStyle(
fontSize: 16,
color: Colors.grey[600],
@@ -212,24 +220,26 @@ class BalanceBottomSheet extends StatelessWidget {
Row(
children: [
Text(
- '${item.amount.toInt()}',
+ '${item.price.toInt()}',
style: const TextStyle(
fontSize: 16,
),
),
- if (item.isPaid)
- Container(
- margin: const EdgeInsets.only(left: 8),
- padding: const EdgeInsets.symmetric(
- horizontal: 6,
- vertical: 2,
- ),
- decoration: BoxDecoration(
- color: Colors.grey[200],
- borderRadius: BorderRadius.circular(2),
- ),
- child: Text('paid'.tr(), style: theme.textTheme.bodySmall),
- ),
+ //TODO: add paid status when we know how the receipt is structured
+
+ // if (item.isPaid > 0)
+ // Container(
+ // margin: const EdgeInsets.only(left: 8),
+ // padding: const EdgeInsets.symmetric(
+ // horizontal: 6,
+ // vertical: 2,
+ // ),
+ // decoration: BoxDecoration(
+ // color: Colors.grey[200],
+ // borderRadius: BorderRadius.circular(2),
+ // ),
+ // child: Text('paid'.tr(), style: theme.textTheme.bodySmall),
+ // ),
],
),
],
@@ -237,15 +247,3 @@ class BalanceBottomSheet extends StatelessWidget {
);
}
}
-
-class BalanceItem {
- final String description;
- final double amount;
- final bool isPaid;
-
- const BalanceItem({
- required this.description,
- required this.amount,
- this.isPaid = false,
- });
-}
diff --git a/comwell_key_app/lib/my_booking/cubit/my_booking_cubit.dart b/comwell_key_app/lib/my_booking/cubit/my_booking_cubit.dart
index 36583860..1a0cde57 100644
--- a/comwell_key_app/lib/my_booking/cubit/my_booking_cubit.dart
+++ b/comwell_key_app/lib/my_booking/cubit/my_booking_cubit.dart
@@ -21,4 +21,8 @@ class MyBookingCubit extends Cubit<MyBookingState> {
booking = initialBooking;
}
+ int get totalAddonBalance => booking.addOnItems?.fold(0, (sum, item) => sum! + item.price.toInt()) ?? 0;
+
+ bool get canContinueToPayment => booking.balance != 0 || (booking.addOnItems?.isNotEmpty ?? false);
+
}
diff --git a/comwell_key_app/lib/my_booking/my_booking_page.dart b/comwell_key_app/lib/my_booking/my_booking_page.dart
index 7f576866..dc01f2cf 100644
--- a/comwell_key_app/lib/my_booking/my_booking_page.dart
+++ b/comwell_key_app/lib/my_booking/my_booking_page.dart
@@ -3,10 +3,11 @@ import 'package:comwell_key_app/booking_details/booking_details_repository.dart'
import 'package:comwell_key_app/booking_details/components/share_button.dart';
import 'package:comwell_key_app/common/components/comwell_app_bar.dart';
import 'package:comwell_key_app/my_booking/components/balance_bottom_sheet.dart';
+import 'package:comwell_key_app/my_booking/cubit/my_booking_cubit.dart';
+import 'package:comwell_key_app/my_booking/cubit/my_booking_state.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/profile/profile_repository.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:comwell_key_app/up_sales/models/up_sales.dart';
import 'package:comwell_key_app/up_sales/up_sales_repository.dart';
import 'package:comwell_key_app/utils/locator.dart';
import 'package:easy_localization/easy_localization.dart';
@@ -15,81 +16,87 @@ import 'package:flutter_bloc/flutter_bloc.dart';
class MyBookingPage extends StatelessWidget {
final Booking booking;
- final UpSales upSales;
- const MyBookingPage({super.key, required this.booking, required this.upSales});
+ const MyBookingPage({super.key, required this.booking});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
+
+ return BlocBuilder<MyBookingCubit, MyBookingState>(
+ builder: (context, state) {
+ final cubit = context.read<MyBookingCubit>();
- return Scaffold(
- backgroundColor: Colors.white,
- appBar: const ComwellAppBar(
- shouldShowProfileButton: false,
- ),
- body: Stack(
- children: [
- SingleChildScrollView(
- child: Padding(
- padding: const EdgeInsets.all(16.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- 'my_booking'.tr(),
- style: theme.textTheme.titleLarge?.copyWith(
- fontWeight: FontWeight.bold,
- color: Colors.black,
- ),
- ),
- const SizedBox(height: 8),
- Text(
- 'booking_reference'.tr(),
- style: theme.textTheme.bodySmall?.copyWith(
- color: colorHeadlineText,
- ),
- ),
- Text(
- booking.id,
- style: theme.textTheme.bodyMedium,
- ),
- const SizedBox(height: 16),
- const Divider(color: colorDivider),
- _buildCheckInOutSection(theme),
- const Divider(color: colorDivider),
- _buildBookingDetails(theme),
- const Divider(color: colorDivider),
- _buildPaymentSection(theme),
- const Divider(color: colorDivider),
- _buildCancellationPolicy(theme),
- const Divider(color: colorDivider),
- const SizedBox(height: 100)
- ],
- ),
- ),
+ return Scaffold(
+ backgroundColor: Colors.white,
+ appBar: const ComwellAppBar(
+ shouldShowProfileButton: false,
),
- Positioned(
- bottom: 0,
- left: 0,
- right: 0,
- child: GestureDetector(
- onTap: () {
- showModalBottomSheet<void>(
- isScrollControlled: true,
- context: context,
- builder: (context) => BalanceBottomSheet(
- balance: booking.balance ?? 0,
- userName: booking.booker.name,
- booking: booking,
- items: upSales.addOnItems,
+ body: Stack(
+ children: [
+ SingleChildScrollView(
+ child: Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'my_booking'.tr(),
+ style: theme.textTheme.titleLarge?.copyWith(
+ fontWeight: FontWeight.bold,
+ color: Colors.black,
+ ),
+ ),
+ const SizedBox(height: 8),
+ Text(
+ 'booking_reference'.tr(),
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: colorHeadlineText,
+ ),
+ ),
+ Text(
+ booking.id,
+ style: theme.textTheme.bodyMedium,
+ ),
+ const SizedBox(height: 16),
+ const Divider(color: colorDivider),
+ _buildCheckInOutSection(theme),
+ const Divider(color: colorDivider),
+ _buildBookingDetails(theme),
+ const Divider(color: colorDivider),
+ _buildPaymentSection(theme),
+ const Divider(color: colorDivider),
+ _buildCancellationPolicy(theme),
+ const Divider(color: colorDivider),
+ const SizedBox(height: 100)
+ ],
),
- );
- },
- child: _buildBalanceBottomSheet(theme),
- ),
+ ),
+ ),
+ Positioned(
+ bottom: 0,
+ left: 0,
+ right: 0,
+ child: GestureDetector(
+ onTap: () {
+ showModalBottomSheet<void>(
+ isScrollControlled: true,
+ context: context,
+ builder: (context) => BalanceBottomSheet(
+ balance: cubit.totalAddonBalance,
+ userName: booking.booker.name,
+ booking: booking,
+ addOnItems: booking.addOnItems ?? [],
+ cubit: cubit,
+ ),
+ );
+ },
+ child: _buildBalanceBottomSheet(theme, cubit),
+ ),
+ ),
+ ],
),
- ],
- ),
+ );
+ }
);
}
@@ -100,9 +107,10 @@ class MyBookingPage extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text('check_in'.tr(), style: theme.textTheme.bodySmall?.copyWith(
- color: colorHeadlineText,
- )),
+ Text('check_in'.tr(),
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: colorHeadlineText,
+ )),
const SizedBox(height: 4),
Text(DateFormat('d. MMM').format(booking.startDate),
style: theme.textTheme.bodyMedium),
@@ -116,9 +124,10 @@ class MyBookingPage extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text('check_out'.tr(), style: theme.textTheme.bodySmall?.copyWith(
- color: colorHeadlineText,
- )),
+ Text('check_out'.tr(),
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: colorHeadlineText,
+ )),
const SizedBox(height: 4),
Text(
DateFormat('d. MMM').format(booking.endDate),
@@ -140,9 +149,10 @@ class MyBookingPage extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text('booking_details'.tr(), style: theme.textTheme.bodySmall?.copyWith(
- color: colorHeadlineText,
- )),
+ Text('booking_details'.tr(),
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: colorHeadlineText,
+ )),
Text(booking.roomType, style: theme.textTheme.bodyMedium),
const SizedBox(height: 16),
const Divider(color: colorDivider),
@@ -188,7 +198,6 @@ class MyBookingPage extends StatelessWidget {
child: BlocProvider(
create: (context) => BookingDetailsBloc(
booking,
-
bookingDetailsRepository: locator<BookingDetailsRepository>(),
profileRepository: locator<ProfileRepository>(),
upSaleRepository: locator<UpSalesRepository>(),
@@ -224,10 +233,12 @@ class MyBookingPage extends StatelessWidget {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text('payment_method'.tr(), style: theme.textTheme.bodySmall?.copyWith(
- color: colorHeadlineText,
- )),
+ Text('payment_method'.tr(),
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: colorHeadlineText,
+ )),
const SizedBox(width: 8),
+ //TODO: add card number when we can add it through the website
Text('•••• •••• •••• 1234', style: theme.textTheme.bodyMedium),
const SizedBox(width: 8),
],
@@ -238,9 +249,10 @@ class MyBookingPage extends StatelessWidget {
const SizedBox(height: 16),
const Divider(color: colorDivider),
const SizedBox(height: 8),
- Text('payment_date'.tr(), style: theme.textTheme.bodySmall?.copyWith(
- color: colorHeadlineText,
- )),
+ Text('payment_date'.tr(),
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: colorHeadlineText,
+ )),
const SizedBox(height: 4),
Text(DateFormat('d. MMM').format(booking.bookingDate),
style: theme.textTheme.bodyMedium),
@@ -268,7 +280,7 @@ class MyBookingPage extends StatelessWidget {
);
}
- Widget _buildBalanceBottomSheet(ThemeData theme) {
+ Widget _buildBalanceBottomSheet(ThemeData theme, MyBookingCubit cubit) {
return Container(
height: 100,
decoration: const BoxDecoration(
@@ -293,7 +305,7 @@ class MyBookingPage extends StatelessWidget {
Row(
children: [
Text(
- '${booking.balance} kr',
+ '${cubit.totalAddonBalance} kr',
style: theme.textTheme.bodyLarge?.copyWith(
color: Colors.white,
fontWeight: FontWeight.w600,
diff --git a/comwell_key_app/lib/overview/models/booking.dart b/comwell_key_app/lib/overview/models/booking.dart
index f7aff991..ef5a1d38 100644
--- a/comwell_key_app/lib/overview/models/booking.dart
+++ b/comwell_key_app/lib/overview/models/booking.dart
@@ -3,7 +3,6 @@ import 'package:comwell_key_app/overview/models/guest.dart';
import 'package:comwell_key_app/overview/models/payment_details.dart';
import 'package:comwell_key_app/overview/models/room.dart';
import 'package:comwell_key_app/services/models/booking_dto.dart';
-import 'package:comwell_key_app/up_sales/models/upgrade.dart';
import 'package:equatable/equatable.dart';
class Booking extends Equatable {
@@ -69,7 +68,7 @@ class Booking extends Equatable {
@override
String toString() {
- return "Booking(id: $id, confirmationId: $confirmationId, roomNumber: $roomNumber, startDate: $startDate, endDate: $endDate, status: $bookingStatus, reservationStatus: $reservationStatus, image: $image, hotelName: $hotelName, hotelCode: $hotelCode, roomType: $roomType, adults: $adults, children: $children, booker: $booker, bookingDate: $bookingDate, digitalCard: $digitalCard, guests: $guests, addOnItems: $addOnItems)";
+ return "Booking(id: $id, confirmationId: $confirmationId, roomNumber: $roomNumber, startDate: $startDate, endDate: $endDate, status: $bookingStatus, reservationStatus: $reservationStatus, image: $image, hotelName: $hotelName, hotelCode: $hotelCode, roomType: $roomType, adults: $adults, children: $children, booker: $booker, bookingDate: $bookingDate, digitalCard: $digitalCard, guests: $guests, addOnItems: $addOnItems, balance: $balance, totalCharge: $totalCharge, maskedCardNumber: $maskedCardNumber)";
}
@override
diff --git a/comwell_key_app/lib/overview/overview_page.dart b/comwell_key_app/lib/overview/overview_page.dart
index ad20afda..34ce8aa7 100644
--- a/comwell_key_app/lib/overview/overview_page.dart
+++ b/comwell_key_app/lib/overview/overview_page.dart
@@ -113,7 +113,7 @@ class OverviewTabViewState extends State<OverviewPage>
Padding(
padding: const EdgeInsets.only(
- left: 18.0, right: 18.0, bottom: 32.0, top: 0.0),
+ left: 18.0, right: 18.0, bottom: 32.0, top: 16.0),
child: ElevatedButton(
onPressed: () async {
bool success = await launchUrl(
diff --git a/comwell_key_app/lib/overview/repository/overview_repository.dart b/comwell_key_app/lib/overview/repository/overview_repository.dart
index 47c4468e..933f8515 100644
--- a/comwell_key_app/lib/overview/repository/overview_repository.dart
+++ b/comwell_key_app/lib/overview/repository/overview_repository.dart
@@ -2,8 +2,6 @@ import 'package:comwell_key_app/choose_share_room/choose_share_room_repository.d
import 'package:comwell_key_app/database/comwell_db.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/overview/models/bookings.dart';
-import 'package:comwell_key_app/overview/models/guest.dart';
-import 'package:comwell_key_app/overview/models/room.dart';
import 'package:comwell_key_app/profile/profile_repository.dart';
import 'package:comwell_key_app/services/api.dart';
import 'package:comwell_key_app/services/mappers/booking_mapper.dart';
diff --git a/comwell_key_app/lib/pregistration/pregistration_repository.dart b/comwell_key_app/lib/pregistration/pregistration_repository.dart
index 01f74c9e..97c5744a 100644
--- a/comwell_key_app/lib/pregistration/pregistration_repository.dart
+++ b/comwell_key_app/lib/pregistration/pregistration_repository.dart
@@ -65,7 +65,6 @@ class PreregistrationRepository {
}
DropInConfiguration dropInConfiguration(Amount amount, String clientKey) {
- print("qqq amount: ${amount.value}");
// TODO: missing endpoint to retrieve client key
return DropInConfiguration(
environment: Environment.test,
diff --git a/comwell_key_app/lib/routing/app_router.dart b/comwell_key_app/lib/routing/app_router.dart
index 74e1a2aa..2400296a 100644
--- a/comwell_key_app/lib/routing/app_router.dart
+++ b/comwell_key_app/lib/routing/app_router.dart
@@ -291,15 +291,13 @@ GoRouter goRouter() {
path: "/${AppRoutes.myBooking.name}",
name: AppRoutes.myBooking.name,
builder: (context, state) {
- final extras = state.extra as List<dynamic>;
- final booking = extras[0] as Booking;
- final upSales = extras[1] as UpSales;
+ final booking = state.extra as Booking;
return BlocProvider(
create: (context) => MyBookingCubit(
locator<MyBookingRepository>(),
initialBooking: booking,
),
- child: MyBookingPage(booking: booking, upSales: upSales),
+ child: MyBookingPage(booking: booking),
);
}),
GoRoute(
diff --git a/comwell_key_app/lib/routing/app_routes.dart b/comwell_key_app/lib/routing/app_routes.dart
index bd6c8b5b..c708dc89 100644
--- a/comwell_key_app/lib/routing/app_routes.dart
+++ b/comwell_key_app/lib/routing/app_routes.dart
@@ -37,4 +37,5 @@ enum AppRoutes {
shareRoom,
forceUpdate,
upSalesError,
+ payMyBooking,
}
diff --git a/comwell_key_app/lib/services/api.dart b/comwell_key_app/lib/services/api.dart
index 30ffeb19..d9ada2bb 100644
--- a/comwell_key_app/lib/services/api.dart
+++ b/comwell_key_app/lib/services/api.dart
@@ -281,7 +281,6 @@ class Api {
};
final data = jsonEncode(body);
final response = await dio.post<Json>(ApiEndpoints.upSales, data: data);
- print("response.data: ${response.data}");
return UpSalesDTO.fromJson(response.data!);
}
diff --git a/comwell_key_app/lib/services/mappers/addon_item_mapper.dart b/comwell_key_app/lib/services/mappers/addon_item_mapper.dart
index cc08cb4a..c737c553 100644
--- a/comwell_key_app/lib/services/mappers/addon_item_mapper.dart
+++ b/comwell_key_app/lib/services/mappers/addon_item_mapper.dart
@@ -16,9 +16,9 @@ extension AddOnItemDTOMapper on BookingAddonItem {
currency: "DKK",
images: const [],
description: description,
- tags: const [],
quantity: quantity,
facilityTypes: const [],
+ roomSize: 0,
);
} else {
// This is an addon upgrade
@@ -29,10 +29,11 @@ extension AddOnItemDTOMapper on BookingAddonItem {
currency: "DKK",
images: const [],
description: description,
- tags: const [],
isSelected: false,
quantity: quantity,
isService: true,
+ isPopular: false,
+ onlyAvailableBeforeCheckin: false,
);
}
}
diff --git a/comwell_key_app/lib/services/mappers/booking_mapper.dart b/comwell_key_app/lib/services/mappers/booking_mapper.dart
index 026b6da8..efbba350 100644
--- a/comwell_key_app/lib/services/mappers/booking_mapper.dart
+++ b/comwell_key_app/lib/services/mappers/booking_mapper.dart
@@ -4,7 +4,6 @@ import 'package:comwell_key_app/overview/models/room.dart';
import 'package:comwell_key_app/services/models/booking_dto.dart';
import 'package:comwell_key_app/services/models/room_dto.dart';
import 'package:comwell_key_app/services/mappers/room_mapper.dart';
-import 'package:comwell_key_app/services/mappers/addon_item_mapper.dart';
//TODO: Fix actual image
extension BookingDTOMapper on BookingDTO {
diff --git a/comwell_key_app/lib/up_sales/components/catalog/service_catalog.dart b/comwell_key_app/lib/up_sales/components/catalog/service_catalog.dart
index b64dd555..75f5e70a 100644
--- a/comwell_key_app/lib/up_sales/components/catalog/service_catalog.dart
+++ b/comwell_key_app/lib/up_sales/components/catalog/service_catalog.dart
@@ -20,7 +20,7 @@ class ServiceCatalog extends StatelessWidget {
const ServiceCatalog({
super.key,
- required this.upSales,
+ required this.upSales,
this.height,
required this.onTap,
this.showRadioButton = true,
@@ -39,7 +39,6 @@ class ServiceCatalog extends StatelessWidget {
itemCount: upSales.length,
itemBuilder: (context, index) {
final isSelected = upSales.elementAt(index).isSelected;
- final isPopular = upSales.elementAt(index).tags.contains('popular');
return GestureDetector(
onTap: () async {
final result = await context.pushNamed(
@@ -66,7 +65,7 @@ class ServiceCatalog extends StatelessWidget {
width: kUpSalesServiceWidgetWidthLarge,
upgrade: upSales.elementAt(index),
isSelected: isSelected,
- isPopular: isPopular,
+ isPopular: upSales.elementAt(index).isPopular,
onTap: () {
onTap(upSales.elementAt(index));
},
diff --git a/comwell_key_app/lib/up_sales/components/up_sales_services_widget.dart b/comwell_key_app/lib/up_sales/components/up_sales_services_widget.dart
index fd52f105..46e27bdd 100644
--- a/comwell_key_app/lib/up_sales/components/up_sales_services_widget.dart
+++ b/comwell_key_app/lib/up_sales/components/up_sales_services_widget.dart
@@ -80,7 +80,7 @@ class UpSalesServicesWidget extends StatelessWidget {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- if (isPopular!) TagWidget(text: upgrade.tags.first.toUpperCase()),
+ if (isPopular!) TagWidget(text: "up_sales_popular".tr().toUpperCase()),
const SizedBox(height: 8),
SizedBox(
width: 250,
diff --git a/comwell_key_app/lib/up_sales/components/up_sales_upgrades_widget.dart b/comwell_key_app/lib/up_sales/components/up_sales_upgrades_widget.dart
index fd0dc8ee..20accec6 100644
--- a/comwell_key_app/lib/up_sales/components/up_sales_upgrades_widget.dart
+++ b/comwell_key_app/lib/up_sales/components/up_sales_upgrades_widget.dart
@@ -1,5 +1,6 @@
import 'package:comwell_key_app/common/const.dart';
import 'package:comwell_key_app/up_sales/components/upgrades_counter.dart';
+import 'package:comwell_key_app/up_sales/models/room_upgrade.dart';
import 'package:comwell_key_app/up_sales/models/upgrade.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
@@ -71,7 +72,7 @@ class UpSalesUpgradesWidget extends StatelessWidget {
fit: BoxFit.cover,
),
),
- if (upgrade.tags.firstOrNull != null && !isAddon)
+ if ( !isAddon && upgrade is RoomUpgrade)
Positioned(
top: 16,
right: 16,
@@ -83,7 +84,7 @@ class UpSalesUpgradesWidget extends StatelessWidget {
borderRadius: BorderRadius.circular(32),
),
child: Text(
- '${upgrade.tags.first} m2',
+ '${(upgrade as RoomUpgrade).roomSize} m2',
style: theme.textTheme.headlineMedium
?.copyWith(fontSize: 11),
),
diff --git a/comwell_key_app/lib/up_sales/cubit/up_sales_cubit.dart b/comwell_key_app/lib/up_sales/cubit/up_sales_cubit.dart
index 4f431eab..b9991c60 100644
--- a/comwell_key_app/lib/up_sales/cubit/up_sales_cubit.dart
+++ b/comwell_key_app/lib/up_sales/cubit/up_sales_cubit.dart
@@ -93,6 +93,7 @@ class UpSalesCubit extends Cubit<UpSalesState> {
// Convert selected up sales to AddOnList objects using their individual quantities
final List<AddOnList> addonList = state.addOnUpgrades
+ .where((upgrade) => upgrade.quantity > 0)
.map((upgrade) =>
AddOnList(itemCode: upgrade.id, quantity: upgrade.quantity))
.toList();
diff --git a/comwell_key_app/lib/up_sales/mappers/addon_upgrade_mapper.dart b/comwell_key_app/lib/up_sales/mappers/addon_upgrade_mapper.dart
index 28698856..53de994f 100644
--- a/comwell_key_app/lib/up_sales/mappers/addon_upgrade_mapper.dart
+++ b/comwell_key_app/lib/up_sales/mappers/addon_upgrade_mapper.dart
@@ -11,9 +11,11 @@ extension AddOnUpgradeDTOMapper on AddOnUpgradeDTO {
isSelected: false,
images: images,
description: description,
- tags: tags,
quantity: 0,
- isService: isService);
+ isService: isService,
+ isPopular: isPopular,
+ onlyAvailableBeforeCheckin: onlyAvailableBeforeCheckin,
+ );
}
}
diff --git a/comwell_key_app/lib/up_sales/mappers/room_upgrade_mapper.dart b/comwell_key_app/lib/up_sales/mappers/room_upgrade_mapper.dart
index 6e0823a6..5a49c84b 100644
--- a/comwell_key_app/lib/up_sales/mappers/room_upgrade_mapper.dart
+++ b/comwell_key_app/lib/up_sales/mappers/room_upgrade_mapper.dart
@@ -12,9 +12,9 @@ extension RoomUpgradeDTOMapper on RoomUpgradeDTO {
currency: currency,
images: images,
description: description,
- tags: tags,
quantity: quantity ?? 0,
facilityTypes: facilityTypes.map((e) => FacilityType.fromJson(e.toJson())).toList(),
+ roomSize: roomSize,
);
}
diff --git a/comwell_key_app/lib/up_sales/models/addon_upgrade.dart b/comwell_key_app/lib/up_sales/models/addon_upgrade.dart
index 69a1cfa6..f273552c 100644
--- a/comwell_key_app/lib/up_sales/models/addon_upgrade.dart
+++ b/comwell_key_app/lib/up_sales/models/addon_upgrade.dart
@@ -3,6 +3,8 @@ import 'package:comwell_key_app/up_sales/models/upgrade.dart';
class AddOnUpgrade extends Upgrade {
final bool isSelected;
final bool isService;
+ final bool isPopular;
+ final bool onlyAvailableBeforeCheckin;
const AddOnUpgrade({
required super.id,
required super.name,
@@ -10,10 +12,11 @@ class AddOnUpgrade extends Upgrade {
required super.currency,
required super.images,
required super.description,
- required super.tags,
required super.quantity,
required this.isSelected,
required this.isService,
+ required this.isPopular,
+ required this.onlyAvailableBeforeCheckin,
});
@override
@@ -21,13 +24,15 @@ class AddOnUpgrade extends Upgrade {
@override
String toString() {
- return 'AddOnUpgrade(id: $id, name: $name, price: $price, currency: $currency, isSelected: $isSelected, images: $images, description: $description, tags: $tags, isService: $isService, quantity: $quantity)';
+ return 'AddOnUpgrade(id: $id, name: $name, price: $price, currency: $currency, isSelected: $isSelected, images: $images, description: $description, isService: $isService, quantity: $quantity)';
}
AddOnUpgrade copyWith({
int? quantity,
bool? isSelected,
bool? isService,
+ bool? isPopular,
+ bool? onlyAvailableBeforeCheckin,
}) {
return AddOnUpgrade(
id: id,
@@ -36,10 +41,11 @@ class AddOnUpgrade extends Upgrade {
currency: currency,
images: images,
description: description,
- tags: tags,
quantity: quantity ?? this.quantity,
isSelected: isSelected ?? this.isSelected,
isService: isService ?? this.isService,
+ isPopular: isPopular ?? this.isPopular,
+ onlyAvailableBeforeCheckin: onlyAvailableBeforeCheckin ?? this.onlyAvailableBeforeCheckin,
);
}
diff --git a/comwell_key_app/lib/up_sales/models/dto/addon_upgrade_dto.dart b/comwell_key_app/lib/up_sales/models/dto/addon_upgrade_dto.dart
index 18f1a38a..e016baa2 100644
--- a/comwell_key_app/lib/up_sales/models/dto/addon_upgrade_dto.dart
+++ b/comwell_key_app/lib/up_sales/models/dto/addon_upgrade_dto.dart
@@ -12,9 +12,10 @@ class AddOnUpgradeDTO {
final bool isSelected;
final Iterable<String> images;
final String description;
- final Iterable<String> tags;
final int quantity;
final bool isService;
+ final bool isPopular;
+ final bool onlyAvailableBeforeCheckin;
AddOnUpgradeDTO(
{required this.id,
@@ -24,9 +25,10 @@ class AddOnUpgradeDTO {
required this.isSelected,
required this.images,
required this.description,
- required this.tags,
this.quantity = 0,
- this.isService = false});
+ this.isService = false,
+ this.isPopular = false,
+ this.onlyAvailableBeforeCheckin = false});
Json toJson() => _$AddOnUpgradeDTOToJson(this);
diff --git a/comwell_key_app/lib/up_sales/models/dto/room_upgrade_dto.dart b/comwell_key_app/lib/up_sales/models/dto/room_upgrade_dto.dart
index c55c080f..56488903 100644
--- a/comwell_key_app/lib/up_sales/models/dto/room_upgrade_dto.dart
+++ b/comwell_key_app/lib/up_sales/models/dto/room_upgrade_dto.dart
@@ -11,10 +11,11 @@ class RoomUpgradeDTO {
final int price;
final String currency;
final Iterable<String> images;
- final String description;
- final Iterable<String> tags;
+ final String description;
final int? quantity;
final List<FacilityType> facilityTypes;
+ final int roomSize;
+
RoomUpgradeDTO(
{required this.id,
@@ -22,10 +23,10 @@ class RoomUpgradeDTO {
required this.price,
required this.images,
required this.description,
- required this.tags,
required this.currency,
this.quantity,
- required this.facilityTypes});
+ required this.facilityTypes,
+ required this.roomSize});
Json toJson() => _$RoomUpgradeDTOToJson(this);
diff --git a/comwell_key_app/lib/up_sales/models/room_upgrade.dart b/comwell_key_app/lib/up_sales/models/room_upgrade.dart
index 7051187e..17a70836 100644
--- a/comwell_key_app/lib/up_sales/models/room_upgrade.dart
+++ b/comwell_key_app/lib/up_sales/models/room_upgrade.dart
@@ -3,6 +3,7 @@ import 'package:comwell_key_app/up_sales/models/upgrade.dart';
class RoomUpgrade extends Upgrade {
final List<FacilityType> facilityTypes;
+ final int roomSize;
const RoomUpgrade({
required super.id,
required super.name,
@@ -10,9 +11,9 @@ class RoomUpgrade extends Upgrade {
required super.currency,
required super.images,
required super.description,
- required super.tags,
required super.quantity,
required this.facilityTypes,
+ required this.roomSize,
});
RoomUpgrade copyWith({
@@ -21,10 +22,10 @@ class RoomUpgrade extends Upgrade {
Iterable<String>? images,
String? description,
String? id,
- Iterable<String>? tags,
String? currency,
int? quantity,
List<FacilityType>? facilityTypes,
+ int? roomSize,
}) {
return RoomUpgrade(
name: name ?? this.name,
@@ -32,32 +33,19 @@ class RoomUpgrade extends Upgrade {
images: images ?? this.images,
description: description ?? this.description,
id: id ?? this.id,
- tags: tags ?? this.tags,
currency: currency ?? this.currency,
quantity: quantity ?? this.quantity,
facilityTypes: facilityTypes ?? this.facilityTypes,
+ roomSize: roomSize ?? this.roomSize,
);
}
@override
String toString() {
- return "RoomUpgrade(name: $name, price: $price, images: $images, description: $description, id: $id, tags: $tags, currency: $currency)";
+ return "RoomUpgrade(name: $name, price: $price, images: $images, description: $description, id: $id, currency: $currency)";
}
@override
List<Object?> get props =>
- [name, price, images, description, id, tags, currency];
-}
-
-// enum FacilityType {
-// bed,
-// electronics,
-// bathroom,
-// business,
-// service,
-// room;
-
-// static FacilityType fromString(String value) {
-// return FacilityType.values.firstWhere((e) => e.name == value.toLowerCase());
-// }
-// }
+ [name, price, images, description, id, currency];
+}
\ No newline at end of file
diff --git a/comwell_key_app/lib/up_sales/models/upgrade.dart b/comwell_key_app/lib/up_sales/models/upgrade.dart
index 0ed2a675..9e6cb759 100644
--- a/comwell_key_app/lib/up_sales/models/upgrade.dart
+++ b/comwell_key_app/lib/up_sales/models/upgrade.dart
@@ -8,17 +8,15 @@ abstract class Upgrade extends Equatable {
final String currency;
final Iterable<String> images;
final String description;
- final Iterable<String> tags;
final int quantity;
-
+
const Upgrade({
required this.id,
required this.name,
required this.price,
required this.currency,
required this.images,
- required this.description,
- required this.tags,
+ required this.description,
required this.quantity,
});
@@ -27,6 +25,6 @@ abstract class Upgrade extends Equatable {
@override
String toString() {
- return 'Upgrade(id: $id, name: $name, price: $price, currency: $currency, images: $images, description: $description, tags: $tags, quantity: $quantity)';
+ return 'Upgrade(id: $id, name: $name, price: $price, currency: $currency, images: $images, description: $description, quantity: $quantity)';
}
}
\ No newline at end of file
diff --git a/comwell_key_app/lib/up_sales/pages/processing/up_sales_processing_page.dart b/comwell_key_app/lib/up_sales/pages/processing/up_sales_processing_page.dart
index a7812944..0d457592 100644
--- a/comwell_key_app/lib/up_sales/pages/processing/up_sales_processing_page.dart
+++ b/comwell_key_app/lib/up_sales/pages/processing/up_sales_processing_page.dart
@@ -6,7 +6,6 @@ import 'package:comwell_key_app/up_sales/pages/processing/up_sales_error_page.da
import 'package:comwell_key_app/utils/lottie_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-import 'package:go_router/go_router.dart';
import 'package:lottie/lottie.dart';
class UpSalesProcessingPage extends StatefulWidget {
diff --git a/comwell_key_app/lib/up_sales/pages/room_upgrade_page.dart b/comwell_key_app/lib/up_sales/pages/room_upgrade_page.dart
index 69a3a04b..08ed0ca9 100644
--- a/comwell_key_app/lib/up_sales/pages/room_upgrade_page.dart
+++ b/comwell_key_app/lib/up_sales/pages/room_upgrade_page.dart
@@ -77,9 +77,9 @@ class _RoomUpgradePageState extends State<RoomUpgradePage> {
),
),
const SizedBox(width: 12),
- if (widget.roomUpgradeList.roomUpgrade?.tags.isNotEmpty ?? false)
+ if (widget.roomUpgradeList.roomUpgrade?.roomSize != null)
TagWidget(
- text: '${widget.roomUpgradeList.roomUpgrade?.tags.first} M2',
+ text: '${widget.roomUpgradeList.roomUpgrade?.roomSize} M2',
textColor: sandColor),
],
),
diff --git a/comwell_key_app/lib/utils/locator.dart b/comwell_key_app/lib/utils/locator.dart
index 39d10f6a..9fdb0bb6 100644
--- a/comwell_key_app/lib/utils/locator.dart
+++ b/comwell_key_app/lib/utils/locator.dart
@@ -5,6 +5,7 @@ import 'package:comwell_key_app/contact/repository/contact_repository.dart';
import 'package:comwell_key_app/database/comwell_db.dart';
import 'package:comwell_key_app/hotel_information/repository/hotel_information_repository.dart';
import 'package:comwell_key_app/key/repository/key_repository.dart';
+import 'package:comwell_key_app/my_booking/my_booking_repository.dart';
import 'package:comwell_key_app/notifications/notifications_repository.dart';
import 'package:comwell_key_app/overview/repository/overview_repository.dart';
import 'package:comwell_key_app/pregistration/pregistration_repository.dart';
@@ -61,5 +62,6 @@ void setupLocator() {
() => ChooseShareRoomRepository());
locator.registerSingleton<GlobalKey<NavigatorState>>(rootNavigatorKey);
locator.registerFactory<CheckOutRepository>(() => CheckOutRepository());
+ locator.registerFactory<MyBookingRepository>(() => MyBookingRepository());
}
}
diff --git a/comwell_key_app/test/overview_test/overview_cubic_test.dart b/comwell_key_app/test/overview_test/overview_cubic_test.dart
index 5131e79b..ffae621a 100644
--- a/comwell_key_app/test/overview_test/overview_cubic_test.dart
+++ b/comwell_key_app/test/overview_test/overview_cubic_test.dart
@@ -49,7 +49,8 @@ void main() {
reservationStatus: ReservationStatus.newreservation,
balance: 100,
maskedCardNumber: "1234567890",
- rooms: const [])
+ rooms: const [],
+ addOnItems: const [])
],
past: const [],
cancelled: const [],
@@ -82,7 +83,8 @@ void main() {
reservationStatus: ReservationStatus.newreservation,
balance: 100,
maskedCardNumber: "1234567890",
- rooms: const [])
+ rooms: const [],
+ addOnItems: const [])
],
past: const [],
cancelled: const [],
@@ -137,7 +139,8 @@ void main() {
reservationStatus: ReservationStatus.newreservation,
balance: 100,
maskedCardNumber: "1234567890",
- rooms: const [])),
+ rooms: const [],
+ addOnItems: const [])),
expect: () => [
OverviewLoaded(
bookings: Bookings(
@@ -162,7 +165,8 @@ void main() {
reservationStatus: ReservationStatus.newreservation,
balance: 100,
maskedCardNumber: "1234567890",
- rooms: const [])
+ rooms: const [],
+ addOnItems: const [])
],
past: const [],
cancelled: const [],
diff --git a/comwell_key_app/test/overview_test/overview_repository_test.dart b/comwell_key_app/test/overview_test/overview_repository_test.dart
index c1c2e7d3..ca8c2e6e 100644
--- a/comwell_key_app/test/overview_test/overview_repository_test.dart
+++ b/comwell_key_app/test/overview_test/overview_repository_test.dart
@@ -39,7 +39,8 @@ void main() {
reservationStatus: ReservationStatus.newreservation,
balance: 100,
maskedCardNumber: "1234567890",
- rooms: const []
+ rooms: const [],
+ addOnItems: const []
),
],
past: const [],
@@ -79,7 +80,8 @@ void main() {
reservationStatus: ReservationStatus.newreservation,
balance: 100,
maskedCardNumber: "1234567890",
- rooms: const []
+ rooms: const [],
+ addOnItems: const []
);
when(() => overviewRepository.findBooking(bookingReference, lastName))