6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit f44c1779
Changed files
comwell_key_app/assets/translations/da-DK.json | 8 +- comwell_key_app/assets/translations/en-US.json | 7 +- .../components/booking_details_bottom_sheet.dart | 1 - .../lib/booking_details/components/guest_list.dart | 140 +++++++-------- .../booking_details/components/share_button.dart | 198 ++++++++++++--------- comwell_key_app/lib/check_in/check_in_page.dart | 14 +- .../check_out/components/apply_club_points.dart | 2 +- .../choose_share_room/choose_share_room_page.dart | 15 ++ .../common/components/comwell_error_widget.dart | 49 ++--- .../up_sales_catalog_shimmer_loader.dart | 44 ++--- .../components/communications_list.dart | 2 +- .../lib/notifications/notifications_page.dart | 3 +- .../lib/overview/cubit/overview_cubit.dart | 4 +- comwell_key_app/lib/overview/overview_page.dart | 3 + .../overview/repository/overview_repository.dart | 2 - .../lib/payment/cubit/payment_cubit.dart | 1 - .../pregistration/pregistration_repository.dart | 3 - .../lib/profile/components/error_page_widget.dart | 39 +++- .../lib/profile/profile_repository.dart | 3 +- .../lib/services/mappers/booking_mapper.dart | 2 +- .../lib/share/cubit/share_booking_state.dart | 20 ++- comwell_key_app/lib/themes/dark_theme.dart | 2 +- comwell_key_app/lib/themes/light_theme.dart | 2 +- .../pages/processing/up_sales_error_page.dart | 2 +- .../test/overview_test/overview_cubic_test.dart | 16 +- .../overview_test/overview_repository_test.dart | 4 +- 26 files changed, 342 insertions(+), 244 deletions(-)
Diff
diff --git a/comwell_key_app/assets/translations/da-DK.json b/comwell_key_app/assets/translations/da-DK.json
index d8c05372..895bf3ef 100644
--- a/comwell_key_app/assets/translations/da-DK.json
+++ b/comwell_key_app/assets/translations/da-DK.json
@@ -328,6 +328,7 @@
"facilities": "Faciliteter",
"remove": "Fjern",
"up_sales_processing_error_title": "Kunne ikke tilføje tilkøb",
+ "up_sales_processing_error_subtitle": "Opgraderinger virker ikke i øjeblikket. Prøv igen senere.",
"pay_bill": "Betal regning",
"discount": "Comwell Club Point Rabat",
"error_preregistration": "Kunne ikke preregister, gå til reception",
@@ -344,5 +345,10 @@
"overview_error_title": "Kunne ikke indlæse dine bookinger",
"overview_error_subtitle": "Der er sket en fejl. Vi kunne ikke loade dine bookinger. Prøv igen senere.",
"up_sales_error_title": "Tillægskøb er ikke tilgængelige i øjeblikket",
- "up_sales_error_subtitle": "Der er sket en fejl. Prøv igen senere."
+ "up_sales_error_subtitle": "Der er sket en fejl. Prøv igen senere.",
+
+ "choose_room_error_title": "Kunne ikke vælge værelse",
+ "choose_room_error_subtitle": "Der er sket en fejl. Prøv igen senere eller gå til receptionen",
+ "share_booking_error_title": "Kunne ikke finde gæsterne på værelset",
+ "share_booking_error_subtitle": "Der er sket en fejl. Prøv igen senere."
}
\ No newline at end of file
diff --git a/comwell_key_app/assets/translations/en-US.json b/comwell_key_app/assets/translations/en-US.json
index 7880a955..5e64aa27 100644
--- a/comwell_key_app/assets/translations/en-US.json
+++ b/comwell_key_app/assets/translations/en-US.json
@@ -331,6 +331,7 @@
"facilities": "Facilities",
"remove": "Remove",
"up_sales_processing_error_title": "Failed to add addons",
+ "up_sales_processing_error_subtitle": "Addons are not available at the moment. Please try again later.",
"pay_bill": "Pay bill",
"discount": "Comwell Club Points Discount",
"error_preregistration": "Failed to preregister, go to reception",
@@ -347,5 +348,9 @@
"overview_error_title": "Could not load your bookings",
"overview_error_subtitle": "An error occurred. We could not load your bookings. Please try again later.",
"up_sales_error_title": "Could not load up sales",
- "up_sales_error_subtitle": "An error occurred. We could not load up sales. Please try again later."
+ "up_sales_error_subtitle": "An error occurred. We could not load up sales. Please try again later.",
+ "choose_room_error_title": "Could not choose room",
+ "choose_room_error_subtitle": "An error occurred. Please try again later or go to the reception.",
+ "share_booking_error_title": "Could not find guests on the room",
+ "share_booking_error_subtitle": "An error occurred. Please try again later."
}
diff --git a/comwell_key_app/lib/booking_details/components/booking_details_bottom_sheet.dart b/comwell_key_app/lib/booking_details/components/booking_details_bottom_sheet.dart
index 588bbdee..636be348 100644
--- a/comwell_key_app/lib/booking_details/components/booking_details_bottom_sheet.dart
+++ b/comwell_key_app/lib/booking_details/components/booking_details_bottom_sheet.dart
@@ -8,7 +8,6 @@ import 'package:comwell_key_app/common/components/outlined_pill_button.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/up_sales/components/catalog/service_catalog.dart';
-import 'package:comwell_key_app/up_sales/components/up_sales_catalog_button.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
diff --git a/comwell_key_app/lib/booking_details/components/guest_list.dart b/comwell_key_app/lib/booking_details/components/guest_list.dart
index 20deb809..b9c0f33a 100644
--- a/comwell_key_app/lib/booking_details/components/guest_list.dart
+++ b/comwell_key_app/lib/booking_details/components/guest_list.dart
@@ -19,85 +19,83 @@ class GuestList extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return SingleChildScrollView(
- child: ListView.builder(
- shrinkWrap: true,
- itemCount: guests.length,
- itemBuilder: (context, index) {
- final guest = guests.elementAt(index);
- final initials = guest.split(' ').map((name) => name[0]).join('');
-
- return Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
- child: GestureDetector(
- onTap: () {
- final newSelectedGuests = List<String>.from(selectedGuests);
- if (selectedGuests.contains(guest)) {
- newSelectedGuests.remove(guest);
- } else {
- newSelectedGuests.add(guest);
- }
- onGuestSelected(newSelectedGuests);
- },
- child: Container(
- decoration: BoxDecoration(
- border: Border.all(
- color: Colors.grey[300]!,
- width: 1.0,
- ),
- borderRadius: BorderRadius.circular(8.0),
+ return ListView.builder(
+ shrinkWrap: true,
+ itemCount: guests.length,
+ itemBuilder: (context, index) {
+ final guest = guests.elementAt(index);
+ final initials = guest.split(' ').map((name) => name[0]).join('');
+
+ return Padding(
+ padding:
+ const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
+ child: GestureDetector(
+ onTap: () {
+ final newSelectedGuests = List<String>.from(selectedGuests);
+ if (selectedGuests.contains(guest)) {
+ newSelectedGuests.remove(guest);
+ } else {
+ newSelectedGuests.add(guest);
+ }
+ onGuestSelected(newSelectedGuests);
+ },
+ child: Container(
+ decoration: BoxDecoration(
+ border: Border.all(
+ color: Colors.grey[300]!,
+ width: 1.0,
),
- padding: const EdgeInsets.all(12.0),
- child: Row(
- children: [
- Container(
- width: 40,
- height: 40,
- decoration: const BoxDecoration(
- color: Colors.black,
- shape: BoxShape.circle,
- ),
- child: Center(
- child: Text(
- initials,
- style: const TextStyle(
- color: Colors.white,
- fontWeight: FontWeight.w400,
- fontSize: 16,
- ),
- ),
- ),
+ borderRadius: BorderRadius.circular(8.0),
+ ),
+ padding: const EdgeInsets.all(12.0),
+ child: Row(
+ children: [
+ Container(
+ width: 40,
+ height: 40,
+ decoration: const BoxDecoration(
+ color: Colors.black,
+ shape: BoxShape.circle,
),
- const SizedBox(width: 16),
- Expanded(
+ child: Center(
child: Text(
- guest,
- style: Theme.of(context).textTheme.bodyLarge,
+ initials,
+ style: const TextStyle(
+ color: Colors.white,
+ fontWeight: FontWeight.w400,
+ fontSize: 16,
+ ),
),
),
- Checkbox(
- value: selectedGuests.contains(guest),
- onChanged: (bool? value) {
- if (value != null) {
- final newSelectedGuests =
- List<String>.from(selectedGuests);
- if (value) {
- newSelectedGuests.add(guest);
- } else {
- newSelectedGuests.remove(guest);
- }
- onGuestSelected(newSelectedGuests);
- }
- },
+ ),
+ const SizedBox(width: 16),
+ Expanded(
+ child: Text(
+ guest,
+ style: Theme.of(context).textTheme.bodyLarge,
),
- ],
- ),
+ ),
+ Checkbox(
+ value: selectedGuests.contains(guest),
+ onChanged: (bool? value) {
+ if (value != null) {
+ final newSelectedGuests =
+ List<String>.from(selectedGuests);
+ if (value) {
+ newSelectedGuests.add(guest);
+ } else {
+ newSelectedGuests.remove(guest);
+ }
+ onGuestSelected(newSelectedGuests);
+ }
+ },
+ ),
+ ],
),
),
- );
- },
- ),
+ ),
+ );
+ },
);
}
}
diff --git a/comwell_key_app/lib/booking_details/components/share_button.dart b/comwell_key_app/lib/booking_details/components/share_button.dart
index 8c90f2fb..247aa8b7 100644
--- a/comwell_key_app/lib/booking_details/components/share_button.dart
+++ b/comwell_key_app/lib/booking_details/components/share_button.dart
@@ -1,4 +1,5 @@
import 'package:comwell_key_app/booking_details/bloc/booking_details_bloc.dart';
+import 'package:comwell_key_app/common/components/comwell_error_widget.dart';
import 'package:comwell_key_app/overview/models/guest.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/booking_details/components/guest_list.dart';
@@ -120,7 +121,13 @@ class ShareButton extends StatelessWidget {
return showModalBottomSheet<dynamic>(
context: context,
backgroundColor: Colors.white,
- isScrollControlled: true,
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.only(
+ topLeft: Radius.circular(16),
+ topRight: Radius.circular(16),
+ ),
+ ),
+ isScrollControlled: false,
builder: (BuildContext bottomSheetContext) {
return BlocProvider(
create: (context) => ShareBookingCubit(),
@@ -128,99 +135,114 @@ class ShareButton extends StatelessWidget {
listener: (context, state) {},
builder: (context, state) {
final cubit = context.read<ShareBookingCubit>();
- return SafeArea(
- child: SizedBox(
- width: double.infinity,
- height: 450,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Padding(
- padding: const EdgeInsets.all(16.0),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('handle_guests_title'.tr(),
- style: theme.textTheme.titleLarge?.copyWith(
- color: Colors.black,
- fontWeight: FontWeight.w600,
- )),
- ElevatedButton(
- style: ElevatedButton.styleFrom(
- backgroundColor: sandColor[40],
- shape: const CircleBorder(),
- elevation: 0,
- minimumSize:
- const Size(40, 40)),
- child: const Icon(Icons.close, color: Colors.black),
- onPressed: () {
- Navigator.pop(bottomSheetContext);
- },
- ),
- ],
- ),
- ),
- const SizedBox(height: 16),
- Expanded(
- child: GuestList(
- guests: guests
- .where((guest) => guest.name != booker)
- .map((guest) => guest.name),
- selectedGuests: state.selectedGuests,
- onGuestSelected: (Iterable<String> newSelection) {
- cubit.updateSelectedGuests(newSelection);
- },
- ),
- ),
- Column(
+
+ return ClipRRect(
+ borderRadius: const BorderRadius.only(
+ topLeft: Radius.circular(16),
+ topRight: Radius.circular(16),
+ ),
+ child: Scaffold(
+ body: SizedBox(
+ width: double.infinity,
+ height: 450,
+ child: Column(
children: [
- Divider(
- height: 1,
- color: Colors.grey.shade300,
- ),
Padding(
- padding: const EdgeInsets.all(16.0),
- child: ElevatedButton(
- onPressed: state.selectedGuests.isNotEmpty
- ? () async {
- final shouldRemove = await showDialog<bool>(
- context: bottomSheetContext,
- builder: (context) =>
- _buildRemoveGuestDialog(
- context,
- cubit,
- bottomSheetContext,
- state.selectedGuests,
- ),
- );
-
- if (shouldRemove == true &&
- context.mounted) {
- context.pop(state.selectedGuests);
- }
- }
- : null,
- style: ElevatedButton.styleFrom(
- backgroundColor: state.selectedGuests.isNotEmpty
- ? Colors.black
- : const Color(0xffE0E0E0),
- minimumSize: const Size.fromHeight(50),
- elevation: 0,
- ),
- child: Text(
- 'cancel_sharing'.tr(),
- style: TextStyle(
- color: state.selectedGuests.isNotEmpty
- ? Colors.white
- : Colors.grey[500],
+ padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text('handle_guests_title'.tr(),
+ style: theme.textTheme.titleLarge?.copyWith(
+ color: Colors.black,
+ fontWeight: FontWeight.w600,
+ )),
+ ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ backgroundColor: sandColor[40],
+ shape: const CircleBorder(),
+ elevation: 0,
+ minimumSize: const Size(40, 40)),
+ child: const Icon(Icons.close,
+ color: Colors.black),
+ onPressed: () {
+ Navigator.pop(bottomSheetContext);
+ },
),
- ),
+ ],
),
),
+ Builder(builder: (context) {
+ if (state.isLoading) {
+ return const CircularProgressIndicator();
+ }
+ if (state.error != null) {
+ return ComwellErrorWidget(
+ title: "share_booking_error_title".tr(),
+ subtitle: "share_booking_error_subtitle".tr(),
+ border: true,
+ );
+ }
+ return Expanded(
+ child: GuestList(
+ guests: guests.where((guest) => guest.name != booker).map((guest) => guest.name).toList(),
+ selectedGuests: state.selectedGuests,
+ onGuestSelected: (Iterable<String> newSelection) {
+ cubit.updateSelectedGuests(newSelection);
+ },
+ ));
+ })
],
- ),
- ],
+ )),
+ bottomNavigationBar: state.error != null ? null : SafeArea(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.end,
+ mainAxisAlignment: MainAxisAlignment.end,
+ children: [
+ Divider(
+ height: 1,
+ color: Colors.grey.shade300,
+ ),
+ Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: ElevatedButton(
+ onPressed: state.selectedGuests.isNotEmpty
+ ? () async {
+ final shouldRemove = await showDialog<bool>(
+ context: bottomSheetContext,
+ builder: (context) => _buildRemoveGuestDialog(
+ context,
+ cubit,
+ bottomSheetContext,
+ state.selectedGuests,
+ ),
+ );
+
+ if (shouldRemove == true && context.mounted) {
+ context.pop(state.selectedGuests);
+ }
+ }
+ : null,
+ style: ElevatedButton.styleFrom(
+ backgroundColor: state.selectedGuests.isNotEmpty
+ ? Colors.black
+ : const Color(0xffE0E0E0),
+ minimumSize: const Size.fromHeight(50),
+ elevation: 0,
+ ),
+ child: Text(
+ 'cancel_sharing'.tr(),
+ style: TextStyle(
+ color: state.selectedGuests.isNotEmpty
+ ? Colors.white
+ : Colors.grey[500],
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
),
),
);
diff --git a/comwell_key_app/lib/check_in/check_in_page.dart b/comwell_key_app/lib/check_in/check_in_page.dart
index 4b6991fe..c75e7ba8 100644
--- a/comwell_key_app/lib/check_in/check_in_page.dart
+++ b/comwell_key_app/lib/check_in/check_in_page.dart
@@ -1,6 +1,7 @@
import 'package:comwell_key_app/check_in/bloc/check_in_cubit.dart';
import 'package:comwell_key_app/check_in/bloc/check_in_state.dart';
import 'package:comwell_key_app/common/components/comwell_card_component.dart';
+import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:comwell_key_app/utils/lottie_utils.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
@@ -165,11 +166,10 @@ class _CheckInPageState extends State<CheckInPage>
onPressed: () {
context.pop();
},
- style: const ButtonStyle(
- backgroundColor: WidgetStatePropertyAll(
- Color(0xffAA8D65)),
+ style: ButtonStyle(
+ backgroundColor: WidgetStatePropertyAll(sandColor[80]),
foregroundColor:
- WidgetStatePropertyAll(Colors.white)),
+ const WidgetStatePropertyAll(Colors.white)),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 16.0),
@@ -216,11 +216,11 @@ class _CheckInPageState extends State<CheckInPage>
cubit.onDonePressed();
context.pop();
},
- style: const ButtonStyle(
+ style: ButtonStyle(
backgroundColor: WidgetStatePropertyAll(
- Color(0xffAA8D65)),
+ sandColor[80]),
foregroundColor:
- WidgetStatePropertyAll(Colors.white)),
+ const WidgetStatePropertyAll(Colors.white)),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 16.0),
diff --git a/comwell_key_app/lib/check_out/components/apply_club_points.dart b/comwell_key_app/lib/check_out/components/apply_club_points.dart
index 290d1ee7..e4249f3c 100644
--- a/comwell_key_app/lib/check_out/components/apply_club_points.dart
+++ b/comwell_key_app/lib/check_out/components/apply_club_points.dart
@@ -38,7 +38,7 @@ class ApplyClubPoints extends StatelessWidget {
if (clubPoints > 0)
Switch(
value: applyClubPoints,
- activeColor: sandColor[80],
+ activeThumbColor: sandColor[80],
inactiveTrackColor: Colors.grey[200],
inactiveThumbColor: Colors.white,
trackOutlineColor: const WidgetStatePropertyAll(Colors.white),
diff --git a/comwell_key_app/lib/choose_share_room/choose_share_room_page.dart b/comwell_key_app/lib/choose_share_room/choose_share_room_page.dart
index c7fe544b..24640ae0 100644
--- a/comwell_key_app/lib/choose_share_room/choose_share_room_page.dart
+++ b/comwell_key_app/lib/choose_share_room/choose_share_room_page.dart
@@ -2,6 +2,7 @@ import 'package:comwell_key_app/choose_share_room/components/my_room_widget.dart
import 'package:comwell_key_app/choose_share_room/cubit/choose_share_room_cubit.dart';
import 'package:comwell_key_app/choose_share_room/cubit/choose_share_room_state.dart';
import 'package:comwell_key_app/common/components/comwell_app_bar.dart';
+import 'package:comwell_key_app/common/components/comwell_error_widget.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
@@ -27,6 +28,20 @@ class ChooseShareRoomPage extends StatelessWidget {
return const ChooseShareRoomShimmerLoader();
}
+ if (state.error != null) {
+ return Center(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ ComwellErrorWidget(
+ title: "choose_room_error_title".tr(),
+ subtitle: "choose_room_error_subtitle".tr()),
+ ],
+ ),
+ );
+ }
+
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ListView(
diff --git a/comwell_key_app/lib/common/components/comwell_error_widget.dart b/comwell_key_app/lib/common/components/comwell_error_widget.dart
index de8ddb31..12c6f0b0 100644
--- a/comwell_key_app/lib/common/components/comwell_error_widget.dart
+++ b/comwell_key_app/lib/common/components/comwell_error_widget.dart
@@ -1,6 +1,5 @@
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
import 'package:flutter_svg/flutter_svg.dart';
class ComwellErrorWidget extends StatelessWidget {
@@ -8,37 +7,43 @@ class ComwellErrorWidget extends StatelessWidget {
final String subtitle;
final bool border;
const ComwellErrorWidget(
- {super.key, required this.title, required this.subtitle, this.border = false});
+ {super.key,
+ required this.title,
+ required this.subtitle,
+ this.border = false});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
- return Container(
- width: double.infinity,
- decoration: const BoxDecoration(
- color: Colors.white
- ),
- padding: const EdgeInsets.all(16),
- child: Column(
- children: [
- Container(
- decoration: BoxDecoration(
- border: border ? Border.all(color: colorDivider) : null,
- borderRadius: BorderRadius.circular(16),
- ),
- padding: const EdgeInsets.symmetric(horizontal: 48, vertical: 32),
- child: Column(
+ return Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: Container(
+ width: double.infinity,
+ decoration: BoxDecoration(
+ color: Colors.white,
+ border: border ? Border.all(color: colorDivider) : null,
+ borderRadius: BorderRadius.circular(8),
+ ),
+ padding: const EdgeInsets.symmetric(vertical: 15.0),
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
+ mainAxisSize: MainAxisSize.min,
children: [
- SvgPicture.asset('assets/icons/ic_error.svg', width: 48, height: 48),
+ SvgPicture.asset('assets/icons/ic_error.svg',
+ width: 48, height: 48),
const SizedBox(height: 30),
- Text(title, style: theme.textTheme.headlineMedium, textAlign: TextAlign.center),
+ Text(title,
+ style: theme.textTheme.headlineMedium,
+ textAlign: TextAlign.center),
const SizedBox(height: 12),
- Text(subtitle, style: theme.textTheme.bodySmall, textAlign: TextAlign.center),
+ Text(subtitle,
+ style: theme.textTheme.bodySmall, textAlign: TextAlign.center),
],
- )),
- ],
+ ),
+ ),
),
);
}
diff --git a/comwell_key_app/lib/common/components/shimmer_loader/up_sales_catalog_shimmer_loader.dart b/comwell_key_app/lib/common/components/shimmer_loader/up_sales_catalog_shimmer_loader.dart
index 7700f025..b0545430 100644
--- a/comwell_key_app/lib/common/components/shimmer_loader/up_sales_catalog_shimmer_loader.dart
+++ b/comwell_key_app/lib/common/components/shimmer_loader/up_sales_catalog_shimmer_loader.dart
@@ -13,9 +13,9 @@ class UpSalesCatalogShimmerLoader extends StatelessWidget {
baseColor: sandColor[40]!,
highlightColor: sandColor[10]!,
enabled: true,
- child: SingleChildScrollView(
+ child: const SingleChildScrollView(
child: Padding(
- padding: const EdgeInsets.only(
+ padding: EdgeInsets.only(
top: 24,
bottom: 100,
left: 0,
@@ -25,41 +25,41 @@ class UpSalesCatalogShimmerLoader extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Main title placeholder
- const TitlePlaceholder(width: 200),
- const SizedBox(height: 40),
+ TitlePlaceholder(width: 200),
+ SizedBox(height: 40),
// Services section placeholder
- const Padding(
+ Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: TitlePlaceholder(width: 100),
),
- const SizedBox(height: 8),
- const CatalogItemPlaceholder(),
- const SizedBox(height: 16),
- const CatalogItemPlaceholder(),
- const SizedBox(height: 24),
+ SizedBox(height: 8),
+ CatalogItemPlaceholder(),
+ SizedBox(height: 16),
+ CatalogItemPlaceholder(),
+ SizedBox(height: 24),
// Room upgrades section placeholder
- const Padding(
+ Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: TitlePlaceholder(width: 120),
),
- const SizedBox(height: 8),
- const CatalogItemPlaceholder(),
- const SizedBox(height: 16),
- const CatalogItemPlaceholder(),
- const SizedBox(height: 24),
+ SizedBox(height: 8),
+ CatalogItemPlaceholder(),
+ SizedBox(height: 16),
+ CatalogItemPlaceholder(),
+ SizedBox(height: 24),
// Other up sales section placeholder
- const Padding(
+ Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: TitlePlaceholder(width: 140),
),
- const SizedBox(height: 8),
- const CatalogItemPlaceholder(),
- const SizedBox(height: 16),
- const CatalogItemPlaceholder(),
- const SizedBox(height: 24),
+ SizedBox(height: 8),
+ CatalogItemPlaceholder(),
+ SizedBox(height: 16),
+ CatalogItemPlaceholder(),
+ SizedBox(height: 24),
],
),
),
diff --git a/comwell_key_app/lib/notifications/components/communications_list.dart b/comwell_key_app/lib/notifications/components/communications_list.dart
index e14ff817..07526e67 100644
--- a/comwell_key_app/lib/notifications/components/communications_list.dart
+++ b/comwell_key_app/lib/notifications/components/communications_list.dart
@@ -23,7 +23,7 @@ class CommunicationsList extends StatelessWidget {
itemCount: notificationPermissions.length,
itemBuilder: (context, index) {
return SwitchListTile(
- activeColor: sandColor,
+ activeThumbColor: sandColor,
inactiveTrackColor: Colors.grey[200],
inactiveThumbColor: Colors.white,
trackOutlineColor: WidgetStatePropertyAll(Theme.of(context).colorScheme.surface),
diff --git a/comwell_key_app/lib/notifications/notifications_page.dart b/comwell_key_app/lib/notifications/notifications_page.dart
index a520af7a..26ab6164 100644
--- a/comwell_key_app/lib/notifications/notifications_page.dart
+++ b/comwell_key_app/lib/notifications/notifications_page.dart
@@ -2,7 +2,6 @@ import 'package:comwell_key_app/common/components/comwell_app_bar.dart';
import 'package:comwell_key_app/common/components/comwell_error_widget.dart';
import 'package:comwell_key_app/notifications/cubit/notifications_state.dart';
import 'package:comwell_key_app/notifications/models/notification_permission.dart';
-import 'package:comwell_key_app/profile/components/error_page_widget.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
@@ -70,7 +69,7 @@ class NotificationsPage extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Switch(
- activeColor: sandColor,
+ activeThumbColor: sandColor,
inactiveTrackColor: Colors.grey[200],
inactiveThumbColor: Colors.white,
trackOutlineColor: WidgetStatePropertyAll(
diff --git a/comwell_key_app/lib/overview/cubit/overview_cubit.dart b/comwell_key_app/lib/overview/cubit/overview_cubit.dart
index 5cabcea2..9bb6d0c4 100644
--- a/comwell_key_app/lib/overview/cubit/overview_cubit.dart
+++ b/comwell_key_app/lib/overview/cubit/overview_cubit.dart
@@ -31,11 +31,11 @@ class OverviewCubit extends Cubit<OverviewState> {
updatedBookings.add(newBooking);
- final updatedBookingsObject = Bookings(current: updatedBookings, past: [], cancelled: []);
+ final updatedBookingsObject = Bookings(current: updatedBookings, past: const [], cancelled: const []);
emit(OverviewLoaded(bookings: updatedBookingsObject));
} else {
- final bookings = Bookings(current: [newBooking], past: [], cancelled: []);
+ final bookings = Bookings(current: [newBooking], past: const [], cancelled: const []);
emit(OverviewLoaded(bookings: bookings));
}
}
diff --git a/comwell_key_app/lib/overview/overview_page.dart b/comwell_key_app/lib/overview/overview_page.dart
index df43c71f..d52dc32f 100644
--- a/comwell_key_app/lib/overview/overview_page.dart
+++ b/comwell_key_app/lib/overview/overview_page.dart
@@ -104,6 +104,9 @@ class OverviewTabViewState extends State<OverviewPage>
subtitle: 'overview_error_subtitle'.tr(),
border: true,
),
+ IconButton(onPressed: () {
+ context.read<OverviewCubit>().fetchBookings();
+ }, icon: const Icon(Icons.refresh, color: Colors.black)),
const FindBookingButton()
],
),
diff --git a/comwell_key_app/lib/overview/repository/overview_repository.dart b/comwell_key_app/lib/overview/repository/overview_repository.dart
index c2e3c4a2..e6f7c509 100644
--- a/comwell_key_app/lib/overview/repository/overview_repository.dart
+++ b/comwell_key_app/lib/overview/repository/overview_repository.dart
@@ -7,9 +7,7 @@ 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';
-import 'package:comwell_key_app/services/mappers/bookings_mapper.dart';
import 'package:comwell_key_app/services/models/booking_dto.dart';
-import 'package:comwell_key_app/services/models/bookings_dto.dart';
import 'package:comwell_key_app/utils/locator.dart';
class OverviewRepository {
diff --git a/comwell_key_app/lib/payment/cubit/payment_cubit.dart b/comwell_key_app/lib/payment/cubit/payment_cubit.dart
index c124fcfd..c7125e16 100644
--- a/comwell_key_app/lib/payment/cubit/payment_cubit.dart
+++ b/comwell_key_app/lib/payment/cubit/payment_cubit.dart
@@ -1,5 +1,4 @@
import 'package:adyen_checkout/adyen_checkout.dart';
-import 'package:comwell_key_app/check_out/utils/constants.dart';
import 'package:comwell_key_app/pregistration/pregistration_repository.dart';
import 'package:comwell_key_app/payment/cubit/payment_processing_state.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
diff --git a/comwell_key_app/lib/pregistration/pregistration_repository.dart b/comwell_key_app/lib/pregistration/pregistration_repository.dart
index ee8eef15..519ba187 100644
--- a/comwell_key_app/lib/pregistration/pregistration_repository.dart
+++ b/comwell_key_app/lib/pregistration/pregistration_repository.dart
@@ -1,8 +1,5 @@
import 'package:adyen_checkout/adyen_checkout.dart';
import 'package:comwell_key_app/check_out/models/payment_configurations.dart';
-import 'package:comwell_key_app/overview/models/payment_details.dart'
- as payment_details;
-import 'package:comwell_key_app/payment_cards/models/add_card_payment_method.dart';
import 'package:comwell_key_app/profile/utils/constants.dart';
import 'package:comwell_key_app/profile_settings/repostiory/profile_settings_repository.dart';
import 'package:comwell_key_app/services/adyen/stored_payment_method.dart';
diff --git a/comwell_key_app/lib/profile/components/error_page_widget.dart b/comwell_key_app/lib/profile/components/error_page_widget.dart
index fe2a2faa..9e61a89c 100644
--- a/comwell_key_app/lib/profile/components/error_page_widget.dart
+++ b/comwell_key_app/lib/profile/components/error_page_widget.dart
@@ -42,10 +42,41 @@ class ErrorPageWidget extends StatelessWidget {
),
const SizedBox(height: 10),
Expanded(
- child: ComwellErrorWidget(
- title: 'profile_error_title'.tr(),
- subtitle: 'profile_error_subtitle'.tr(),
- border: true),
+ child: Container(
+ decoration: BoxDecoration(
+ color: Colors.white,
+ border: Border.all(color: colorDivider),
+ ),
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Column(
+ children: [
+ ComwellErrorWidget(
+ title: 'profile_error_title'.tr(),
+ subtitle: 'profile_error_subtitle'.tr(),
+ border: true),
+ const SizedBox(height: 30),
+ Center(
+ child: OutlinedButton(
+ style: OutlinedButton.styleFrom(
+ side: const BorderSide(color: colorDivider),
+ ),
+ onPressed: () {
+ showDialog<void>(
+ context: context,
+ builder: (context) => LogoutDialogWidget(
+ cubit: context.read<ProfileCubit>(),
+ ),
+ );
+ },
+ child: Text(
+ 'logout_profile_menu'.tr(),
+ style: TextStyle(color: Colors.grey[600]),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
),
],
);
diff --git a/comwell_key_app/lib/profile/profile_repository.dart b/comwell_key_app/lib/profile/profile_repository.dart
index 3356148c..d5a9086b 100644
--- a/comwell_key_app/lib/profile/profile_repository.dart
+++ b/comwell_key_app/lib/profile/profile_repository.dart
@@ -6,7 +6,6 @@ import 'package:comwell_key_app/profile_settings/repostiory/profile_settings_rep
import 'package:comwell_key_app/services/api.dart';
import 'package:comwell_key_app/services/mappers/booking_mapper.dart';
import 'package:comwell_key_app/services/mappers/user_mapper.dart';
-import 'package:comwell_key_app/services/models/bookings_dto.dart';
import 'package:comwell_key_app/services/models/user_dto.dart';
import 'package:comwell_key_app/utils/json.dart';
import 'package:comwell_key_app/utils/locator.dart';
@@ -63,7 +62,7 @@ class ProfileRepository {
} catch (e) {
try {
final response = await api.getBookingDetails(hmsConfirmationNumber, hotelCode);
- await locator<ComwellDatabase>().bookingsDao.insertBookings(
+ await locator<ComwellDatabase>().bookingsDao.insert(
[response!]);
final booking = response.toBooking(user.id, []);
debugPrint("Booking saved to database: ${booking.confirmationId}");
diff --git a/comwell_key_app/lib/services/mappers/booking_mapper.dart b/comwell_key_app/lib/services/mappers/booking_mapper.dart
index 6974b16f..920e77ef 100644
--- a/comwell_key_app/lib/services/mappers/booking_mapper.dart
+++ b/comwell_key_app/lib/services/mappers/booking_mapper.dart
@@ -16,7 +16,7 @@ extension BookingDTOMapper on BookingDTO {
roomNumber: roomNumber ?? "",
startDate: startDate,
endDate: endDate,
- reservationStatus: ReservationStatus.fromString(this.status),
+ reservationStatus: ReservationStatus.fromString(status),
image: "assets/images/no_current_bookings_background.jpeg",
hotelName: "Hotel $hotelCode",
roomType: roomType ?? '',
diff --git a/comwell_key_app/lib/share/cubit/share_booking_state.dart b/comwell_key_app/lib/share/cubit/share_booking_state.dart
index c1c2daf2..e2282d84 100644
--- a/comwell_key_app/lib/share/cubit/share_booking_state.dart
+++ b/comwell_key_app/lib/share/cubit/share_booking_state.dart
@@ -2,21 +2,33 @@ part of 'share_booking_cubit.dart';
class ShareBookingState extends Equatable {
final Iterable<String> selectedGuests;
+ final bool isLoading;
+ final Error? error;
const ShareBookingState._({
required this.selectedGuests,
+ required this.isLoading,
+ this.error,
});
- const ShareBookingState.initial() : this._(selectedGuests: const []);
+ const ShareBookingState.initial() : this._(selectedGuests: const [], isLoading: false, error: null);
+
+ ShareBookingState loading() => _copyWith(isLoading: true);
+
+ ShareBookingState setupError({required Error error}) => _copyWith(error: error, isLoading: false);
+
+ ShareBookingState loaded() => _copyWith(isLoading: false);
ShareBookingState updateSelectedGuests(Iterable<String> guests) =>
_copyWith(selectedGuests: guests);
- ShareBookingState _copyWith({Iterable<String>? selectedGuests}) {
+ ShareBookingState _copyWith({Iterable<String>? selectedGuests, bool? isLoading, Error? error}) {
return ShareBookingState._(
- selectedGuests: selectedGuests ?? this.selectedGuests);
+ selectedGuests: selectedGuests ?? this.selectedGuests,
+ isLoading: isLoading ?? this.isLoading,
+ error: error ?? this.error);
}
@override
- List<Object?> get props => [selectedGuests];
+ List<Object?> get props => [selectedGuests, isLoading, error];
}
diff --git a/comwell_key_app/lib/themes/dark_theme.dart b/comwell_key_app/lib/themes/dark_theme.dart
index 8d736413..82df2b29 100644
--- a/comwell_key_app/lib/themes/dark_theme.dart
+++ b/comwell_key_app/lib/themes/dark_theme.dart
@@ -5,7 +5,7 @@ ThemeData darkTheme = ThemeData(
fontFamily: 'Fellix',
brightness: Brightness.light,
appBarTheme: const AppBarTheme(
- color: colorPrimary,
+ backgroundColor: colorPrimary,
foregroundColor: Colors.white,
),
progressIndicatorTheme: const ProgressIndicatorThemeData(
diff --git a/comwell_key_app/lib/themes/light_theme.dart b/comwell_key_app/lib/themes/light_theme.dart
index ace5d7b3..61029b86 100644
--- a/comwell_key_app/lib/themes/light_theme.dart
+++ b/comwell_key_app/lib/themes/light_theme.dart
@@ -5,7 +5,7 @@ ThemeData lightTheme = ThemeData(
fontFamily: 'Fellix',
brightness: Brightness.light,
appBarTheme: const AppBarTheme(
- color: colorPrimary,
+ backgroundColor: colorPrimary,
foregroundColor: Colors.white,
),
progressIndicatorTheme: const ProgressIndicatorThemeData(
diff --git a/comwell_key_app/lib/up_sales/pages/processing/up_sales_error_page.dart b/comwell_key_app/lib/up_sales/pages/processing/up_sales_error_page.dart
index 7205bbab..a9a8b05f 100644
--- a/comwell_key_app/lib/up_sales/pages/processing/up_sales_error_page.dart
+++ b/comwell_key_app/lib/up_sales/pages/processing/up_sales_error_page.dart
@@ -26,7 +26,7 @@ class UpSalesErrorPage extends StatelessWidget {
.headlineMedium
?.copyWith(color: Colors.white),
),
- Text("generic_error".tr(),
+ Text("up_sales_processing_error_subtitle".tr(),
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
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 bb0a3fe3..2d29c4da 100644
--- a/comwell_key_app/test/overview_test/overview_cubic_test.dart
+++ b/comwell_key_app/test/overview_test/overview_cubic_test.dart
@@ -28,7 +28,7 @@ void main() {
build: () {
when(() => mockOverviewRepository.fetchAllBookingsForUser())
.thenAnswer((_) async => Bookings(
- bookings: [
+ current: [
Booking(
id: '1',
reservationStatus: ReservationStatus.newreservation,
@@ -52,6 +52,8 @@ void main() {
rooms: const [],
addOnItems: const [])
],
+ past: [],
+ cancelled: [],
));
return overviewCubit;
},
@@ -60,7 +62,7 @@ void main() {
OverviewLoading(),
OverviewLoaded(
bookings: Bookings(
- bookings: [
+ current: [
Booking(
id: '1',
reservationStatus: ReservationStatus.newreservation,
@@ -84,6 +86,8 @@ void main() {
rooms: const [],
addOnItems: const [])
],
+ past: [],
+ cancelled: [],
),
),
],
@@ -110,7 +114,9 @@ void main() {
},
seed: () => const OverviewLoaded(
bookings: Bookings(
- bookings: [],
+ current: [],
+ past: [],
+ cancelled: [],
),
),
act: (cubit) => cubit.addBooking(Booking(
@@ -138,7 +144,7 @@ void main() {
expect: () => [
OverviewLoaded(
bookings: Bookings(
- bookings: [
+ current: [
Booking(
id: '1',
roomNumber: '',
@@ -162,6 +168,8 @@ void main() {
rooms: const [],
addOnItems: const [])
],
+ past: [],
+ cancelled: [],
),
),
],
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 27ab6025..e07fe268 100644
--- a/comwell_key_app/test/overview_test/overview_repository_test.dart
+++ b/comwell_key_app/test/overview_test/overview_repository_test.dart
@@ -18,7 +18,7 @@ void main() {
test('fetchAllBookingsForUser returns Bookings', () async {
const userId = '1';
final bookings = Bookings(
- bookings: [
+ current: [
Booking(
id: '1',
reservationStatus: ReservationStatus.newreservation,
@@ -43,6 +43,8 @@ void main() {
addOnItems: const []
),
],
+ past: [],
+ cancelled: [],
);
when(() => overviewRepository.fetchAllBookingsForUser())