6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 12468718
Changed files
.../pages/hotel_information_menu.dart | 5 - .../lib/my_booking/my_booking_page.dart | 7 +- .../bloc/booking_details_cubit.dart | 1 + .../booking_details/booking_details_page.dart | 5 +- .../booking_details/components/share_button.dart | 1 + .../pages/prereg_confirmation_page.dart | 472 ++++++++++----------- .../pages/prereg_up_sales_catalog_page.dart | 3 + .../components/catalog/addon_upgrade_catalog.dart | 3 + .../lib/up_sales/pages/addon_upgrade_page.dart | 92 +++- comwell_key_app/lib/up_sales/up_sales_catalog.dart | 203 ++++----- comwell_key_app/lib/up_sales/up_sales_route.dart | 2 + 11 files changed, 448 insertions(+), 346 deletions(-)
Diff
diff --git a/comwell_key_app/lib/hotel_information/pages/hotel_information_menu.dart b/comwell_key_app/lib/hotel_information/pages/hotel_information_menu.dart
index 3764652e..afd19865 100644
--- a/comwell_key_app/lib/hotel_information/pages/hotel_information_menu.dart
+++ b/comwell_key_app/lib/hotel_information/pages/hotel_information_menu.dart
@@ -44,11 +44,6 @@ class HotelInformationMenu extends StatelessWidget {
),
);
}),
- HotelInformationListTile(
- iconPath: Assets.icons.icInfo.path,
- title: context.strings.hotel_information_page_menu_other_info_title,
- onClick: cubit.onMoreInformationClicked,
- ),
],
),
),
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 cf218a5a..33063c1d 100644
--- a/comwell_key_app/lib/my_booking/my_booking_page.dart
+++ b/comwell_key_app/lib/my_booking/my_booking_page.dart
@@ -116,7 +116,7 @@ class MyBookingPage extends StatelessWidget {
style: theme.textTheme.bodyMedium,
),
Text(
- DateFormat('HH:mm').format(booking.startDate),
+ DateFormat('HH:mm').format(booking.startDate.add(const Duration(hours: 15))),
style: theme.textTheme.bodyMedium,
),
],
@@ -140,7 +140,7 @@ class MyBookingPage extends StatelessWidget {
),
const SizedBox(height: 4),
Text(
- DateFormat('HH:mm').format(booking.endDate),
+ DateFormat('HH:mm').format(booking.endDate.add(const Duration(hours: 10))),
style: theme.textTheme.bodyMedium,
),
],
@@ -252,8 +252,7 @@ class MyBookingPage extends StatelessWidget {
),
),
const SizedBox(width: 8),
- //TODO: add card number when we can add it through the website
- Text('•••• •••• •••• 1234', style: theme.textTheme.bodyMedium),
+ Text('•••• •••• •••• ${booking.maskedCardNumber}', style: theme.textTheme.bodyMedium),
const SizedBox(width: 8),
],
),
diff --git a/comwell_key_app/lib/presentation/screens/booking_details/bloc/booking_details_cubit.dart b/comwell_key_app/lib/presentation/screens/booking_details/bloc/booking_details_cubit.dart
index 5503364b..24e25691 100644
--- a/comwell_key_app/lib/presentation/screens/booking_details/bloc/booking_details_cubit.dart
+++ b/comwell_key_app/lib/presentation/screens/booking_details/bloc/booking_details_cubit.dart
@@ -127,6 +127,7 @@ class BookingDetailsCubit extends BaseCubit<BookingDetailsState> {
if (keys.isEmpty || !isKeyLoadedForBooking) {
await _seosRepository.provisionKey(bookingId: booking.id, hotelCode: booking.hotelCode);
final keys = await _seosRepository.refreshKeys();
+ print("keys: $keys");
safeEmit(state.copyWith(keys: keys));
}
} catch (e) {
diff --git a/comwell_key_app/lib/presentation/screens/booking_details/booking_details_page.dart b/comwell_key_app/lib/presentation/screens/booking_details/booking_details_page.dart
index 840adbb8..351fb5be 100644
--- a/comwell_key_app/lib/presentation/screens/booking_details/booking_details_page.dart
+++ b/comwell_key_app/lib/presentation/screens/booking_details/booking_details_page.dart
@@ -65,6 +65,7 @@ class BookingDetailsPage extends StatelessWidget {
return Stack(
children: [
+
// Background image - fixed
Container(
decoration: BoxDecoration(
@@ -88,9 +89,7 @@ class BookingDetailsPage extends StatelessWidget {
),
),
// Share button - fixed at top
- SafeArea(
- child: shouldShowShareButton ? ShareButton(guests: state.guests) : const SizedBox(),
- ),
+
// Scrollable content with haptic feedback
_ScrollableBookingContent(
screenHeight: screenHeight,
diff --git a/comwell_key_app/lib/presentation/screens/booking_details/components/share_button.dart b/comwell_key_app/lib/presentation/screens/booking_details/components/share_button.dart
index 601531b9..f55439d7 100644
--- a/comwell_key_app/lib/presentation/screens/booking_details/components/share_button.dart
+++ b/comwell_key_app/lib/presentation/screens/booking_details/components/share_button.dart
@@ -56,6 +56,7 @@ class ShareButton extends StatelessWidget {
height: userButtonSize,
child: ElevatedButton(
onPressed: () {
+ print("booking: $booking");
context.push(AppRoutes.shareBooking, extra: booking);
},
style: ElevatedButton.styleFrom(
diff --git a/comwell_key_app/lib/presentation/screens/pregistration/pages/prereg_confirmation_page.dart b/comwell_key_app/lib/presentation/screens/pregistration/pages/prereg_confirmation_page.dart
index d5de2209..1bef1157 100644
--- a/comwell_key_app/lib/presentation/screens/pregistration/pages/prereg_confirmation_page.dart
+++ b/comwell_key_app/lib/presentation/screens/pregistration/pages/prereg_confirmation_page.dart
@@ -41,161 +41,187 @@ class PreregConfirmationPage extends StatelessWidget {
child: ListView(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
children: [
- const SizedBox(height: 16),
- Text(
- context.strings.preregistration_confirmation_title,
- style: Theme.of(context).textTheme.headlineLarge,
- ),
- const SizedBox(height: 16),
- InformationCard(
- title: context.strings.preregistration_confirmation_profile_card_title,
- titleStyle: theme.textTheme.titleMedium?.copyWith(
- fontWeight: FontWeight.w500,
- color: colorHeadlineText,
+ const SizedBox(height: 16),
+ Text(
+ context.strings.preregistration_confirmation_title,
+ style: Theme.of(context).textTheme.headlineLarge,
),
- onEditClick: cubit.onEditProfileClicked,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- "${state.user!.firstName} ${state.user!.lastName}",
- style: Theme.of(context).textTheme.bodyMedium,
- ),
- Text(
- user.email,
- style: Theme.of(context).textTheme.bodyMedium,
- ),
- Text(
- state.user!.phoneNumber,
- style: Theme.of(context).textTheme.bodyMedium,
- ),
- ],
- ),
- ),
- const SizedBox(height: 12),
- InformationCard(
- title: context.strings.preregistration_confirmation_address_card_title,
- titleStyle: theme.textTheme.titleMedium?.copyWith(
- fontWeight: FontWeight.w500,
- color: colorHeadlineText,
+ const SizedBox(height: 16),
+ InformationCard(
+ title: context.strings.preregistration_confirmation_profile_card_title,
+ titleStyle: theme.textTheme.titleMedium?.copyWith(
+ fontWeight: FontWeight.w500,
+ color: colorHeadlineText,
+ ),
+ onEditClick: cubit.onEditProfileClicked,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ "${state.user!.firstName} ${state.user!.lastName}",
+ style: Theme.of(context).textTheme.bodyMedium,
+ ),
+ Text(
+ user.email,
+ style: Theme.of(context).textTheme.bodyMedium,
+ ),
+ Text(
+ state.user!.phoneNumber,
+ style: Theme.of(context).textTheme.bodyMedium,
+ ),
+ ],
+ ),
),
- onEditClick: cubit.onEditAddressClicked,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- cubit.state.user!.address.street,
- style: theme.textTheme.bodyMedium,
- ),
- Text(
- "${state.user!.address.zipCode}, ${state.user!.address.city}${state.user!.address.country.isNotEmpty ? ', ${state.user!.address.country}' : ''}",
- style: theme.textTheme.bodyMedium,
- ),
- ],
+ const SizedBox(height: 12),
+ InformationCard(
+ title: context.strings.preregistration_confirmation_address_card_title,
+ titleStyle: theme.textTheme.titleMedium?.copyWith(
+ fontWeight: FontWeight.w500,
+ color: colorHeadlineText,
+ ),
+ onEditClick: cubit.onEditAddressClicked,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ cubit.state.user!.address.street,
+ style: theme.textTheme.bodyMedium,
+ ),
+ Text(
+ "${state.user!.address.zipCode}, ${state.user!.address.city}${state.user!.address.country.isNotEmpty ? ', ${state.user!.address.country}' : ''}",
+ style: theme.textTheme.bodyMedium,
+ ),
+ ],
+ ),
),
- ),
- const SizedBox(height: 24),
- // My addons section
- Text(
- context.strings.preregistration_my_addons,
- style: theme.textTheme.headlineSmall,
- ),
- const SizedBox(height: 8),
- Text(
- context.strings.preregistration_my_addons_subtitle,
- style: theme.textTheme.bodySmall?.copyWith(
- color: colorHeadlineText,
- fontSize: 13,
+ const SizedBox(height: 24),
+ // My addons section
+ Text(
+ context.strings.preregistration_my_addons,
+ style: theme.textTheme.headlineSmall,
),
- ),
- const SizedBox(height: 16),
- InformationCard(
- title: extrasTitleText,
- titleStyle: theme.textTheme.titleMedium?.copyWith(
- fontWeight: FontWeight.w500,
- color: colorHeadlineText,
+ const SizedBox(height: 8),
+ Text(
+ context.strings.preregistration_my_addons_subtitle,
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: colorHeadlineText,
+ fontSize: 13,
+ ),
),
- onEditClick: cubit.onEditExtrasClicked,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- context.strings.total_charge_value(cubit.extrasTotalPrice.toString()),
- style: theme.textTheme.bodyMedium?.copyWith(
- fontWeight: FontWeight.w600,
+ const SizedBox(height: 16),
+ InformationCard(
+ title: extrasTitleText,
+ titleStyle: theme.textTheme.titleMedium?.copyWith(
+ fontWeight: FontWeight.w500,
+ color: colorHeadlineText,
+ ),
+ onEditClick: cubit.onEditExtrasClicked,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ context.strings.total_charge_value(cubit.extrasTotalPrice.toString()),
+ style: theme.textTheme.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ ),
),
- ),
- Text(
- context.strings.preregistration_confirmation_extras_card_subtitle,
- style: theme.textTheme.bodySmall?.copyWith(
- color: colorHeadlineText,
+ Text(
+ context.strings.preregistration_confirmation_extras_card_subtitle,
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: colorHeadlineText,
+ ),
),
- ),
- ],
+ ],
+ ),
),
- ),
- const SizedBox(height: 12),
- // Serving time field
- GestureDetector(
- onTap: () async {
- final initialTimeOfDay = state.servingTime ?? TimeOfDay.now();
- final initialDateTime = DateTime(
- 0,
- 1,
- 1,
- initialTimeOfDay.hour,
- initialTimeOfDay.minute,
- );
+ const SizedBox(height: 12),
+ // Serving time field
+ GestureDetector(
+ onTap: () async {
+ final initialTimeOfDay = state.servingTime ?? TimeOfDay.now();
+ final initialDateTime = DateTime(
+ 0,
+ 1,
+ 1,
+ initialTimeOfDay.hour,
+ initialTimeOfDay.minute,
+ );
- final selectedTime = await showModalBottomSheet<TimeOfDay>(
- context: context,
- builder: (context) {
- DateTime tempPicked = initialDateTime;
+ final selectedTime = await showModalBottomSheet<TimeOfDay>(
+ context: context,
+ builder: (context) {
+ DateTime tempPicked = initialDateTime;
- return SizedBox(
- height: 260,
- child: Column(
- children: [
- Align(
- alignment: Alignment.centerRight,
- child: TextButton(
- onPressed: () {
- Navigator.of(context).pop(
- TimeOfDay(
- hour: tempPicked.hour,
- minute: tempPicked.minute,
+ return SizedBox(
+ height: 260,
+ child: Column(
+ children: [
+ Align(
+ alignment: Alignment.centerRight,
+ child: TextButton(
+ onPressed: () {
+ Navigator.of(context).pop(
+ TimeOfDay(
+ hour: tempPicked.hour,
+ minute: tempPicked.minute,
+ ),
+ );
+ },
+ child: Text(
+ context.strings.generic_ok,
+ style: theme.textTheme.labelLarge?.copyWith(
+ color: sandColor,
),
- );
- },
- child: Text(
- context.strings.generic_ok,
- style: theme.textTheme.labelLarge?.copyWith(
- color: sandColor,
),
),
),
- ),
- Expanded(
- child: CupertinoDatePicker(
- mode: CupertinoDatePickerMode.time,
- use24hFormat: true,
- initialDateTime: initialDateTime,
- onDateTimeChanged: (DateTime newDate) {
- tempPicked = newDate;
- },
+ Expanded(
+ child: CupertinoDatePicker(
+ mode: CupertinoDatePickerMode.time,
+ use24hFormat: true,
+ initialDateTime: initialDateTime,
+ onDateTimeChanged: (DateTime newDate) {
+ tempPicked = newDate;
+ },
+ ),
),
- ),
- ],
- ),
- );
- },
- );
+ ],
+ ),
+ );
+ },
+ );
- if (selectedTime != null) {
- cubit.onServingTimeSelected(selectedTime);
- }
- },
- child: Container(
+ if (selectedTime != null) {
+ cubit.onServingTimeSelected(selectedTime);
+ }
+ },
+ child: Container(
+ padding: const EdgeInsets.all(12),
+ decoration: BoxDecoration(
+ border: Border.all(color: colorDivider),
+ borderRadius: const BorderRadius.all(Radius.circular(4)),
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ context.strings.preregistration_serving_time_label,
+ style: theme.textTheme.titleMedium?.copyWith(
+ fontWeight: FontWeight.w500,
+ color: colorHeadlineText,
+ ),
+ ),
+ Text(
+ state.servingTime != null ? state.servingTime!.format(context) : '--:--',
+ style: theme.textTheme.bodyMedium,
+ ),
+ ],
+ ),
+ ),
+ ),
+ const SizedBox(height: 24),
+ // Comment field
+ Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
border: Border.all(color: colorDivider),
@@ -205,127 +231,99 @@ class PreregConfirmationPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- context.strings.preregistration_serving_time_label,
+ context.strings.preregistration_comment_label,
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w500,
color: colorHeadlineText,
),
),
- Text(
- state.servingTime != null
- ? state.servingTime!.format(context)
- : '--:--',
- style: theme.textTheme.bodyMedium,
+ const SizedBox(height: 8),
+ TextField(
+ controller: cubit.commentTextController,
+ maxLines: 3,
+ decoration: InputDecoration(
+ hintText: context.strings.preregistration_comment_hint,
+ hintStyle: theme.textTheme.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ ),
+ border: InputBorder.none,
+ contentPadding: EdgeInsets.zero,
+ ),
+ style: theme.textTheme.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ ),
),
],
),
),
- ),
- const SizedBox(height: 24),
- // Comment field
- Container(
- padding: const EdgeInsets.all(12),
- decoration: BoxDecoration(
- border: Border.all(color: colorDivider),
- borderRadius: const BorderRadius.all(Radius.circular(4)),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
+ const SizedBox(height: 16),
+ // Accept terms checkbox
+ Row(
+ crossAxisAlignment: CrossAxisAlignment.center,
children: [
- Text(
- context.strings.preregistration_comment_label,
- style: theme.textTheme.titleMedium?.copyWith(
- fontWeight: FontWeight.w500,
- color: colorHeadlineText,
- ),
- ),
- const SizedBox(height: 8),
- TextField(
- controller: cubit.commentTextController,
- maxLines: 3,
- decoration: InputDecoration(
- hintText: context.strings.preregistration_comment_hint,
- hintStyle: theme.textTheme.bodyMedium?.copyWith(
- fontWeight: FontWeight.w600,
- ),
- border: InputBorder.none,
- contentPadding: EdgeInsets.zero,
+ Checkbox(
+ value: state.termsAndConditionsAccepted,
+ onChanged: (_) => cubit.onTermsAndConditionsToggled(
+ !state.termsAndConditionsAccepted,
),
- style: theme.textTheme.bodyMedium?.copyWith(
- fontWeight: FontWeight.w600,
+ side: const BorderSide(color: colorDivider, width: 2),
+ visualDensity: VisualDensity.compact,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(4),
),
+ activeColor: sandColor[80],
),
- ],
- ),
- ),
- const SizedBox(height: 16),
- // Accept terms checkbox
- Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Checkbox(
- value: state.termsAndConditionsAccepted,
- onChanged: (_) => cubit.onTermsAndConditionsToggled(
- !state.termsAndConditionsAccepted,
- ),
- side: const BorderSide(color: colorDivider, width: 2),
- visualDensity: VisualDensity.compact,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(4),
- ),
- activeColor: sandColor[80],
- ),
- const SizedBox(width: 4),
- Expanded(
- child: Wrap(
- children: [
- Text(
- '${context.strings.preregistration_accept_terms_prefix} ',
- style: theme.textTheme.bodySmall?.copyWith(
- color: colorHeadlineText,
- fontSize: 13,
- ),
- ),
- GestureDetector(
- onTap: () {
- launchUrl(Uri.parse(ComwellUrls.clubPermission));
- },
- child: Text(
- context.strings.preregistration_accept_terms_privacy_policy,
+ const SizedBox(width: 4),
+ Expanded(
+ child: Wrap(
+ children: [
+ Text(
+ '${context.strings.preregistration_accept_terms_prefix} ',
style: theme.textTheme.bodySmall?.copyWith(
- color: sandColor,
- decoration: TextDecoration.underline,
- decorationColor: sandColor,
+ color: colorHeadlineText,
fontSize: 13,
),
),
- ),
- Text(
- ' ${context.strings.preregistration_accept_terms_and} ',
- style: theme.textTheme.bodySmall?.copyWith(
- color: colorHeadlineText,
- fontSize: 13,
+ GestureDetector(
+ onTap: () {
+ launchUrl(Uri.parse(ComwellUrls.clubPermission));
+ },
+ child: Text(
+ context.strings.preregistration_accept_terms_privacy_policy,
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: sandColor,
+ decoration: TextDecoration.underline,
+ decorationColor: sandColor,
+ fontSize: 13,
+ ),
+ ),
),
- ),
- GestureDetector(
- onTap: () {
- launchUrl(Uri.parse(ComwellUrls.termsAndConditions));
- },
- child: Text(
- context.strings.preregistration_accept_terms_trade_conditions,
+ Text(
+ ' ${context.strings.preregistration_accept_terms_and} ',
style: theme.textTheme.bodySmall?.copyWith(
- color: sandColor,
- decoration: TextDecoration.underline,
- decorationColor: sandColor,
+ color: colorHeadlineText,
fontSize: 13,
),
),
- ),
- ],
+ GestureDetector(
+ onTap: () {
+ launchUrl(Uri.parse(ComwellUrls.termsAndConditions));
+ },
+ child: Text(
+ context.strings.preregistration_accept_terms_trade_conditions,
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: sandColor,
+ decoration: TextDecoration.underline,
+ decorationColor: sandColor,
+ fontSize: 13,
+ ),
+ ),
+ ),
+ ],
+ ),
),
- ),
- ],
- ),
+ ],
+ ),
const SizedBox(height: 40),
],
),
diff --git a/comwell_key_app/lib/presentation/screens/pregistration/pages/prereg_up_sales_catalog_page.dart b/comwell_key_app/lib/presentation/screens/pregistration/pages/prereg_up_sales_catalog_page.dart
index c7fb67a6..1a4a70ee 100644
--- a/comwell_key_app/lib/presentation/screens/pregistration/pages/prereg_up_sales_catalog_page.dart
+++ b/comwell_key_app/lib/presentation/screens/pregistration/pages/prereg_up_sales_catalog_page.dart
@@ -113,6 +113,9 @@ class PreregUpSalesCatalogPage extends StatelessWidget {
onAddOnUpgradeSelected: (upgrade, quantity) {
cubit.updateAddonUpgradeQuantity(upgrade, quantity);
},
+ onServingTimeSelected: (time) {
+ cubit.onServingTimeSelected(time);
+ },
),
],
const SizedBox(height: 24),
diff --git a/comwell_key_app/lib/up_sales/components/catalog/addon_upgrade_catalog.dart b/comwell_key_app/lib/up_sales/components/catalog/addon_upgrade_catalog.dart
index 2042b79f..594df96d 100644
--- a/comwell_key_app/lib/up_sales/components/catalog/addon_upgrade_catalog.dart
+++ b/comwell_key_app/lib/up_sales/components/catalog/addon_upgrade_catalog.dart
@@ -9,12 +9,14 @@ class AddOnUpgradeCatalog extends StatelessWidget {
final void Function(AddOnUpgrade, int) onAddOnUpgradeSelected;
final int extrasTotalPrice;
final String selectedRoomUpgrade;
+ final void Function(TimeOfDay) onServingTimeSelected;
const AddOnUpgradeCatalog({
super.key,
required this.addOnUpgrades,
required this.onAddOnUpgradeSelected,
required this.extrasTotalPrice,
required this.selectedRoomUpgrade,
+ required this.onServingTimeSelected,
});
@override
@@ -32,6 +34,7 @@ class AddOnUpgradeCatalog extends StatelessWidget {
addOnUpgrades.elementAt(index),
extrasTotalPrice,
selectedRoomUpgrade,
+ onServingTimeSelected,
]);
if (quantity is int) {
onAddOnUpgradeSelected(addOnUpgrades.elementAt(index), quantity);
diff --git a/comwell_key_app/lib/up_sales/pages/addon_upgrade_page.dart b/comwell_key_app/lib/up_sales/pages/addon_upgrade_page.dart
index c69f37aa..cab3c402 100644
--- a/comwell_key_app/lib/up_sales/pages/addon_upgrade_page.dart
+++ b/comwell_key_app/lib/up_sales/pages/addon_upgrade_page.dart
@@ -5,6 +5,7 @@ import 'package:comwell_key_app/up_sales/components/upsale_header_media.dart';
import 'package:comwell_key_app/up_sales/models/addon_upgrade.dart';
import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:comwell_key_app/utils/upsale_utils.dart';
+import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import '../../themes/light_theme.dart';
@@ -15,12 +16,13 @@ class AddonUpgradePage extends StatefulWidget {
//prop drilled
final int extrasTotalPrice;
final String selectedRoomUpgrade;
-
+ final void Function(TimeOfDay) onServingTimeSelected;
const AddonUpgradePage({
super.key,
required this.addonUpgrade,
required this.extrasTotalPrice,
required this.selectedRoomUpgrade,
+ required this.onServingTimeSelected,
});
@override
@@ -29,6 +31,7 @@ class AddonUpgradePage extends StatefulWidget {
class _AddonUpgradePageState extends State<AddonUpgradePage> {
late int quantity = widget.addonUpgrade.quantity > 0 ? widget.addonUpgrade.quantity : 1;
+ TimeOfDay? arrivalTime;
void increment() {
setState(() {
@@ -110,6 +113,93 @@ class _AddonUpgradePageState extends State<AddonUpgradePage> {
style: theme.textTheme.bodySmall?.copyWith(color: colorHeadlineText),
),
),
+ const SizedBox(height: 24),
+ GestureDetector(
+ onTap: () async {
+ final initialTimeOfDay = arrivalTime ?? TimeOfDay.now();
+ final initialDateTime = DateTime(
+ 0,
+ 1,
+ 1,
+ initialTimeOfDay.hour,
+ initialTimeOfDay.minute,
+ );
+
+ final selectedTime = await showModalBottomSheet<TimeOfDay>(
+ context: context,
+ builder: (context) {
+ DateTime tempPicked = initialDateTime;
+
+ return SizedBox(
+ height: 260,
+ child: Column(
+ children: [
+ Align(
+ alignment: Alignment.centerRight,
+ child: TextButton(
+ onPressed: () {
+ Navigator.of(context).pop(
+ TimeOfDay(
+ hour: tempPicked.hour,
+ minute: tempPicked.minute,
+ ),
+ );
+ },
+ child: Text(
+ context.strings.generic_ok,
+ style: theme.textTheme.labelLarge?.copyWith(
+ color: sandColor,
+ ),
+ ),
+ ),
+ ),
+ Expanded(
+ child: CupertinoDatePicker(
+ mode: CupertinoDatePickerMode.time,
+ use24hFormat: true,
+ initialDateTime: initialDateTime,
+ onDateTimeChanged: (DateTime newDate) {
+ tempPicked = newDate;
+ },
+ ),
+ ),
+ ],
+ ),
+ );
+ },
+ );
+
+ if (selectedTime != null) {
+ setState(() {
+ arrivalTime = selectedTime;
+ widget.onServingTimeSelected(selectedTime);
+ });
+ }
+ },
+ child: Container(
+ padding: const EdgeInsets.all(12),
+ decoration: BoxDecoration(
+ border: Border.all(color: colorDivider),
+ borderRadius: const BorderRadius.all(Radius.circular(4)),
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ context.strings.preregistration_serving_time_label,
+ style: theme.textTheme.titleMedium?.copyWith(
+ fontWeight: FontWeight.w500,
+ color: colorHeadlineText,
+ ),
+ ),
+ Text(
+ arrivalTime != null ? arrivalTime!.format(context) : '--:--',
+ style: theme.textTheme.bodyMedium,
+ ),
+ ],
+ ),
+ ),
+ ),
],
),
),
diff --git a/comwell_key_app/lib/up_sales/up_sales_catalog.dart b/comwell_key_app/lib/up_sales/up_sales_catalog.dart
index 7654a6bd..e3edafd0 100644
--- a/comwell_key_app/lib/up_sales/up_sales_catalog.dart
+++ b/comwell_key_app/lib/up_sales/up_sales_catalog.dart
@@ -17,116 +17,127 @@ class UpSalesCatalog extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
- return BlocBuilder<UpSalesCubit, UpSalesState>(builder: (context, state) {
- // Show shimmer loader when loading
- if (state.isLoading) {
+ return BlocBuilder<UpSalesCubit, UpSalesState>(
+ builder: (context, state) {
+ // Show shimmer loader when loading
+ if (state.isLoading) {
+ return Scaffold(
+ appBar: const ComwellAppBar(),
+ backgroundColor: Theme.of(context).colorScheme.surface,
+ body: const UpSalesCatalogShimmerLoader(),
+ );
+ }
+
+ final cubit = context.read<UpSalesCubit>();
+ final serviceUpgrades = cubit.state.addOnUpgrades
+ .where((upgrade) => upgrade.isService)
+ .toList();
+ final addonUpgrades = cubit.upSales.addOnUpgrades
+ .where((upgrade) => !upgrade.isService)
+ .toList();
+ final selectedRoomUpgrade = cubit.state.selectedRoomUpgrade.isEmpty
+ ? null
+ : cubit.upSales.roomUpgrades.firstWhere((e) => e.id == cubit.state.selectedRoomUpgrade);
+
return Scaffold(
appBar: const ComwellAppBar(),
backgroundColor: Theme.of(context).colorScheme.surface,
- body: const UpSalesCatalogShimmerLoader(),
- );
- }
-
- final cubit = context.read<UpSalesCubit>();
- final serviceUpgrades = cubit.state.addOnUpgrades
- .where((upgrade) => upgrade.isService)
- .toList();
- final addonUpgrades = cubit.upSales.addOnUpgrades
- .where((upgrade) => !upgrade.isService)
- .toList();
- final selectedRoomUpgrade = cubit.state.selectedRoomUpgrade.isEmpty
- ? null
- : cubit.upSales.roomUpgrades
- .firstWhere((e) => e.id == cubit.state.selectedRoomUpgrade);
-
- return Scaffold(
- appBar: const ComwellAppBar(),
- backgroundColor: Theme.of(context).colorScheme.surface,
- body: SingleChildScrollView(
- child: Padding(
- padding: const EdgeInsets.only(
- top: 24,
- bottom: 100,
- left: 0,
- right: 0,
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Text(context.strings.up_sales_catalog_title,
- style: theme.textTheme.headlineLarge),
- ),
- const SizedBox(height: 40),
- if (serviceUpgrades.isNotEmpty && serviceUpgrades.any((e) => e.isService)) ...[
+ body: SingleChildScrollView(
+ child: Padding(
+ padding: const EdgeInsets.only(
+ top: 24,
+ bottom: 100,
+ left: 0,
+ right: 0,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Text(context.strings.services,
- style: theme.textTheme.headlineMedium),
- ),
- const SizedBox(height: 8),
- ServiceCatalog(
- booking: cubit.booking,
- upSales: serviceUpgrades,
- onServiceSelected: (upgrade, isSelected) {
- cubit.toggleSelectedUpgrade(upgrade);
- },
- onTap: (upgrade) {
- cubit.toggleSelectedUpgrade(upgrade);
- },
- ),
- ],
- const SizedBox(height: 24),
- if (cubit.upSales.roomUpgrades.isNotEmpty) ...[
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Text(context.strings.room_upgrades,
- style: theme.textTheme.headlineMedium),
- ),
- const SizedBox(height: 8),
- RoomUpgradeCatalog(
- booking: cubit.booking,
- availableRoomUpgrades: cubit.upSales.roomUpgrades,
- selectedRoomUpgrade: cubit.state.selectedRoomUpgrade,
- onRoomUpgradeSelected: (upgrade, isSelected) {
- cubit.toggleSelectedUpgrade(upgrade);
- },
- onTap: (upgrade) {
- cubit.toggleSelectedUpgrade(upgrade);
- },
+ child: Text(
+ context.strings.up_sales_catalog_title,
+ style: theme.textTheme.headlineLarge,
+ ),
),
+ const SizedBox(height: 40),
+ if (serviceUpgrades.isNotEmpty && serviceUpgrades.any((e) => e.isService)) ...[
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Text(context.strings.services, style: theme.textTheme.headlineMedium),
+ ),
+ const SizedBox(height: 8),
+ ServiceCatalog(
+ booking: cubit.booking,
+ upSales: serviceUpgrades,
+ onServiceSelected: (upgrade, isSelected) {
+ cubit.toggleSelectedUpgrade(upgrade);
+ },
+ onTap: (upgrade) {
+ cubit.toggleSelectedUpgrade(upgrade);
+ },
+ ),
+ ],
const SizedBox(height: 24),
- ],
- if (addonUpgrades.any((e) => !e.isService)) ...[
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Text(context.strings.other_up_sales,
- style: theme.textTheme.headlineMedium),
- ),
- const SizedBox(height: 8),
- AddOnUpgradeCatalog(
+ if (cubit.upSales.roomUpgrades.isNotEmpty) ...[
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Text(
+ context.strings.room_upgrades,
+ style: theme.textTheme.headlineMedium,
+ ),
+ ),
+ const SizedBox(height: 8),
+ RoomUpgradeCatalog(
+ booking: cubit.booking,
+ availableRoomUpgrades: cubit.upSales.roomUpgrades,
+ selectedRoomUpgrade: cubit.state.selectedRoomUpgrade,
+ onRoomUpgradeSelected: (upgrade, isSelected) {
+ cubit.toggleSelectedUpgrade(upgrade);
+ },
+ onTap: (upgrade) {
+ cubit.toggleSelectedUpgrade(upgrade);
+ },
+ ),
+ const SizedBox(height: 24),
+ ],
+ if (addonUpgrades.any((e) => !e.isService)) ...[
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Text(
+ context.strings.other_up_sales,
+ style: theme.textTheme.headlineMedium,
+ ),
+ ),
+ const SizedBox(height: 8),
+ AddOnUpgradeCatalog(
addOnUpgrades: cubit.otherUpgrades,
extrasTotalPrice: cubit.extrasTotalPrice,
selectedRoomUpgrade: selectedRoomUpgrade?.id ?? '',
onAddOnUpgradeSelected: (upgrade, quantity) {
cubit.updateAddonUpgradeQuantity(upgrade, quantity);
- }),
+ },
+ onServingTimeSelected: (time) {},
+ ),
+ ],
+ const SizedBox(height: 24),
],
- const SizedBox(height: 24),
- ],
+ ),
),
),
- ),
- bottomNavigationBar: Column(mainAxisSize: MainAxisSize.min, children: [
- const Divider(color: colorDivider),
- UpSalesContinueButton(
- selectedUpSales: cubit.selectedAddOnUpgrades,
- extrasTotalPrice: cubit.extrasTotalPrice,
- selectedRoomUpgrade: selectedRoomUpgrade,
- )
- ]),
- );
- });
+ bottomNavigationBar: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ const Divider(color: colorDivider),
+ UpSalesContinueButton(
+ selectedUpSales: cubit.selectedAddOnUpgrades,
+ extrasTotalPrice: cubit.extrasTotalPrice,
+ selectedRoomUpgrade: selectedRoomUpgrade,
+ ),
+ ],
+ ),
+ );
+ },
+ );
}
}
diff --git a/comwell_key_app/lib/up_sales/up_sales_route.dart b/comwell_key_app/lib/up_sales/up_sales_route.dart
index 225fd150..3d6e3d3c 100644
--- a/comwell_key_app/lib/up_sales/up_sales_route.dart
+++ b/comwell_key_app/lib/up_sales/up_sales_route.dart
@@ -14,6 +14,7 @@ import 'package:comwell_key_app/up_sales/pages/up_sale_confirmation_page.dart';
import 'package:comwell_key_app/up_sales/up_sales_catalog.dart';
import 'package:comwell_key_app/utils/locator.dart';
import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
@@ -78,6 +79,7 @@ final upSalesRoute = ShellRoute(
addonUpgrade: extras[0] as AddOnUpgrade,
extrasTotalPrice: extras[1] as int,
selectedRoomUpgrade: extras[2] as String,
+ onServingTimeSelected: extras[3] as void Function(TimeOfDay),
);
},
),