6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 12c67dd6
Changed files
comwell_key_app/assets/icons/ic_user_circle.svg | 4 + comwell_key_app/assets/translations/da-DK.json | 3 +- comwell_key_app/assets/translations/en-US.json | 3 +- .../booking_details/bloc/booking_details_bloc.dart | 4 +- .../components/booking_details_bottom_sheet.dart | 2 +- .../components/practical_information_button.dart | 3 +- .../lib/find_booking/find_booking_page.dart | 53 ++++---- .../components/current_booking_list_item_view.dart | 10 +- .../components/current_bookings_tab_view.dart | 44 +++++-- comwell_key_app/lib/overview/overview_page.dart | 136 +++++++++++---------- comwell_key_app/lib/profile/utils/urls.dart | 1 + .../up_sales/pages/up_sale_confirmation_page.dart | 1 - 12 files changed, 155 insertions(+), 109 deletions(-)
Diff
diff --git a/comwell_key_app/assets/icons/ic_user_circle.svg b/comwell_key_app/assets/icons/ic_user_circle.svg
new file mode 100644
index 00000000..e0d1b5cd
--- /dev/null
+++ b/comwell_key_app/assets/icons/ic_user_circle.svg
@@ -0,0 +1,4 @@
+<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M10 5C9.38194 5 8.77775 5.18328 8.26385 5.52666C7.74994 5.87004 7.3494 6.3581 7.11288 6.92912C6.87636 7.50013 6.81447 8.12847 6.93505 8.73466C7.05563 9.34085 7.35326 9.89767 7.7903 10.3347C8.22734 10.7717 8.78416 11.0694 9.39035 11.19C9.99654 11.3105 10.6249 11.2486 11.1959 11.0121C11.7669 10.7756 12.255 10.3751 12.5983 9.86116C12.9417 9.34725 13.125 8.74307 13.125 8.125C13.125 7.2962 12.7958 6.50134 12.2097 5.91529C11.6237 5.32924 10.8288 5 10 5ZM10 10C9.62917 10 9.26665 9.89003 8.95831 9.68401C8.64997 9.47798 8.40964 9.18514 8.26773 8.84253C8.12582 8.49992 8.08868 8.12292 8.16103 7.75921C8.23338 7.39549 8.41196 7.0614 8.67418 6.79918C8.9364 6.53695 9.2705 6.35838 9.63421 6.28603C9.99793 6.21368 10.3749 6.25081 10.7175 6.39273C11.0601 6.53464 11.353 6.77496 11.559 7.08331C11.765 7.39165 11.875 7.75416 11.875 8.125C11.8744 8.62211 11.6767 9.0987 11.3252 9.4502C10.9737 9.80171 10.4971 9.99944 10 10Z" fill="black"/>
+<path d="M10 1.25C8.26942 1.25 6.57769 1.76318 5.13876 2.72464C3.69983 3.6861 2.57832 5.05267 1.91606 6.65152C1.25379 8.25037 1.08051 10.0097 1.41813 11.707C1.75575 13.4044 2.58911 14.9635 3.81282 16.1872C5.03653 17.4109 6.59563 18.2443 8.29296 18.5819C9.9903 18.9195 11.7496 18.7462 13.3485 18.0839C14.9473 17.4217 16.3139 16.3002 17.2754 14.8612C18.2368 13.4223 18.75 11.7306 18.75 10C18.7474 7.68016 17.8247 5.45608 16.1843 3.8157C14.5439 2.17533 12.3198 1.25261 10 1.25ZM6.25 16.4853V15.625C6.25055 15.1279 6.44827 14.6513 6.79978 14.2998C7.15129 13.9483 7.62789 13.7505 8.125 13.75H11.875C12.3721 13.7505 12.8487 13.9483 13.2002 14.2998C13.5517 14.6513 13.7495 15.1279 13.75 15.625V16.4853C12.612 17.1498 11.3178 17.5 10 17.5C8.68218 17.5 7.38802 17.1498 6.25 16.4853ZM14.9953 15.5786C14.9829 14.7588 14.6488 13.9766 14.0652 13.4008C13.4815 12.8249 12.6949 12.5014 11.875 12.5H8.125C7.30507 12.5014 6.5185 12.8249 5.93483 13.4008C5.35116 13.9766 5.01712 14.7588 5.00469 15.5786C3.87129 14.5666 3.07202 13.2342 2.71271 11.7578C2.3534 10.2814 2.451 8.73072 2.99259 7.31104C3.53418 5.89136 4.4942 4.66967 5.74555 3.80773C6.99689 2.94579 8.48053 2.48427 10 2.48427C11.5195 2.48427 13.0031 2.94579 14.2545 3.80773C15.5058 4.66967 16.4658 5.89136 17.0074 7.31104C17.549 8.73072 17.6466 10.2814 17.2873 11.7578C16.928 13.2342 16.1287 14.5666 14.9953 15.5786Z" fill="black"/>
+</svg>
diff --git a/comwell_key_app/assets/translations/da-DK.json b/comwell_key_app/assets/translations/da-DK.json
index 7697d3d0..40746223 100644
--- a/comwell_key_app/assets/translations/da-DK.json
+++ b/comwell_key_app/assets/translations/da-DK.json
@@ -287,5 +287,6 @@
"confirm_up_sales_dialog_cancel": "Nej",
"email_launch_error": "Kunne ikke åbne email klient",
"phone_launch_error": "Kunne ikke åbne telefon",
- "balance": "SALDO"
+ "balance": "SALDO",
+ "new_booking": "Book nyt ophold"
}
\ 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 3b19a3ee..bb2d9f1e 100644
--- a/comwell_key_app/assets/translations/en-US.json
+++ b/comwell_key_app/assets/translations/en-US.json
@@ -286,6 +286,7 @@
"confirm_up_sales_dialog_cancel": "No",
"email_launch_error": "Could not launch email client",
"phone_launch_error": "Could not launch phone call",
- "balance": "BALANCE"
+ "balance": "BALANCE",
+ "new_booking": "Make a new booking"
}
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 70a6b96f..01da86e3 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
@@ -169,7 +169,9 @@ class BookingDetailsBloc
DateTime getCheckInTime() => booking.startDate.add(const Duration(hours: 15));
DateTime getCheckOutTime() => booking.endDate.add(const Duration(hours: 5));
-
+
+ bool get isHouseKeepingTime => booking.endDate.difference(booking.startDate).inDays > 2;
+
Future<void> getUser(Emitter<BookingDetailsState> emit) async {
user = await profileRepository.fetchProfileSettings();
}
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 7e71c939..ff98611b 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
@@ -91,7 +91,7 @@ class BookingDetailsBottomSheet extends StatelessWidget {
child: Text('room_keys'.tr(), style: theme.textTheme.headlineMedium),
),
const SizedBox(height: 16),
- cubit.booking.reservationStatus == ReservationStatus.checkedin
+ cubit.booking.reservationStatus == ReservationStatus.checkedin && cubit.isHouseKeepingTime
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
diff --git a/comwell_key_app/lib/booking_details/components/practical_information_button.dart b/comwell_key_app/lib/booking_details/components/practical_information_button.dart
index 834b9cf9..808b25df 100644
--- a/comwell_key_app/lib/booking_details/components/practical_information_button.dart
+++ b/comwell_key_app/lib/booking_details/components/practical_information_button.dart
@@ -18,7 +18,6 @@ class PracticalInformationButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final screenWidth = MediaQuery.of(context).size.width;
return Material(
color: sandColor[10],
@@ -55,7 +54,7 @@ class PracticalInformationButton extends StatelessWidget {
children: [
Text(title),
SizedBox(
- width: screenWidth * 0.4,
+ height: 60,
child: Text(
subtitle,
style: Theme.of(context)
diff --git a/comwell_key_app/lib/find_booking/find_booking_page.dart b/comwell_key_app/lib/find_booking/find_booking_page.dart
index 79bd150d..d0126aec 100644
--- a/comwell_key_app/lib/find_booking/find_booking_page.dart
+++ b/comwell_key_app/lib/find_booking/find_booking_page.dart
@@ -194,34 +194,39 @@ class FindBookingPageState extends State<FindBookingPage>
controller: _lastNameController,
),
const Spacer(),
- const Divider(color: colorDivider),
- const SizedBox(height: 0),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- child: ElevatedButton(
- style: ElevatedButton.styleFrom(
- backgroundColor: sandColor,
- disabledBackgroundColor: disabledButtonColor,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(25),
- ),
+ const SizedBox(height: 20),
+ ],
+ ),
+ ),
+ bottomNavigationBar: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ const Divider(color: colorDivider),
+ Padding(
+ padding: const EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 32),
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ minimumSize: const Size(double.infinity, 50),
+ backgroundColor: sandColor,
+ disabledBackgroundColor: disabledButtonColor,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(25),
),
- onPressed: _isButtonEnabled
- ? () async {
- await _findBooking(context);
- }
- : null,
- child: Text(
- 'Find Booking',
- style: theme.textTheme.headlineSmall?.copyWith(
- color: Colors.white,
- ),
+ ),
+ onPressed: _isButtonEnabled
+ ? () async {
+ await _findBooking(context);
+ }
+ : null,
+ child: Text(
+ 'Find Booking',
+ style: theme.textTheme.headlineSmall?.copyWith(
+ color: Colors.white,
),
),
),
- const SizedBox(height: 20),
- ],
- ),
+ ),
+ ],
),
);
}
diff --git a/comwell_key_app/lib/overview/components/current_booking_list_item_view.dart b/comwell_key_app/lib/overview/components/current_booking_list_item_view.dart
index d6f5870a..ad8e1604 100644
--- a/comwell_key_app/lib/overview/components/current_booking_list_item_view.dart
+++ b/comwell_key_app/lib/overview/components/current_booking_list_item_view.dart
@@ -50,10 +50,10 @@ class CurrentBookingListItem extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
- crossAxisAlignment: CrossAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ mainAxisAlignment: MainAxisAlignment.center,
children: [
- SvgPicture.asset("assets/icons/ic_calendar.svg",
- width: 16, height: 16),
+ SvgPicture.asset("assets/icons/ic_calendar.svg"),
const SizedBox(width: 4),
Text(DateFormat('d. MMM').format(booking.startDate),
style: theme.textTheme.bodySmall),
@@ -67,8 +67,10 @@ class CurrentBookingListItem extends StatelessWidget {
),
const VerticalDivider(),
Row(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ mainAxisAlignment: MainAxisAlignment.center,
children: [
- SvgPicture.asset("assets/icons/user-circle.svg"),
+ SvgPicture.asset("assets/icons/ic_user_circle.svg"),
const SizedBox(width: 4),
Text(
"${booking.adults} ${booking.adults > 1 ? 'adults'.tr() : 'adult'.tr()}${booking.children >= 1 ? ', ${booking.children} ${booking.children > 1 ? 'children'.tr() : 'child'.tr()}' : ''}",
diff --git a/comwell_key_app/lib/overview/components/current_bookings_tab_view.dart b/comwell_key_app/lib/overview/components/current_bookings_tab_view.dart
index ee396ca4..9c4d6e47 100644
--- a/comwell_key_app/lib/overview/components/current_bookings_tab_view.dart
+++ b/comwell_key_app/lib/overview/components/current_bookings_tab_view.dart
@@ -1,10 +1,13 @@
import 'package:comwell_key_app/overview/components/current_booking_list_item_view.dart';
import 'package:comwell_key_app/overview/cubit/overview_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/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:comwell_key_app/common/components/shimmer_loader/overview_shimmer_loader.dart';
+import 'package:go_router/go_router.dart';
class CurrentBookingsTabView extends StatelessWidget {
final Iterable<Booking> bookings;
@@ -27,7 +30,6 @@ class CurrentBookingsTabView extends StatelessWidget {
return BlocBuilder<OverviewCubit, OverviewState>(
builder: (context, state) {
if (state is OverviewLoading) {
- // Show shimmer loader while loading
return ListView(
children: const [
SizedBox(height: 20),
@@ -89,18 +91,44 @@ class CurrentBookingsTabView extends StatelessWidget {
),
),
),
- const SizedBox(
- height: 40,
- ),
],
);
} else {
return ListView.builder(
shrinkWrap: true,
- itemCount: bookings.length,
- itemBuilder: (context, index) => CurrentBookingListItem(
- booking: bookings.elementAt(index),
- ),
+ itemCount: bookings.length + 1,
+ itemBuilder: (context, index) {
+ if (index < bookings.length) {
+ return CurrentBookingListItem(
+ booking: bookings.elementAt(index),
+ );
+ } else {
+ return Padding(
+ padding: const EdgeInsets.symmetric(vertical: 8.0),
+ child: Column(
+ children: [
+ OutlinedButton.icon(
+ onPressed: () async {
+ context.pushNamed(AppRoutes.findBooking.name);
+ },
+ icon: Icon(Icons.search, color: theme.dividerColor),
+ label: Text(
+ 'find_booking'.tr(),
+ style: theme.textTheme.bodyMedium,
+ ),
+ style: OutlinedButton.styleFrom(
+ minimumSize: const Size(150, 50),
+ side: const BorderSide(color: colorDivider),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(25),
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+ },
);
}
},
diff --git a/comwell_key_app/lib/overview/overview_page.dart b/comwell_key_app/lib/overview/overview_page.dart
index 461b7a4c..5dd5d19c 100644
--- a/comwell_key_app/lib/overview/overview_page.dart
+++ b/comwell_key_app/lib/overview/overview_page.dart
@@ -4,12 +4,14 @@ import 'package:comwell_key_app/overview/components/bookings_tab_view.dart';
import 'package:comwell_key_app/overview/components/current_bookings_tab_view.dart';
import 'package:comwell_key_app/overview/cubit/overview_cubit.dart';
import 'package:comwell_key_app/overview/models/bookings.dart';
+import 'package:comwell_key_app/profile/utils/urls.dart';
import 'package:comwell_key_app/routing/app_routes.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';
+import 'package:url_launcher/url_launcher.dart';
class OverviewPage extends StatefulWidget {
const OverviewPage({super.key});
@@ -58,78 +60,80 @@ class OverviewTabViewState extends State<OverviewPage>
shouldShowBackButton: false,
),
body: Column(
- children: [
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 16),
- child: Container(
- height: 39,
- decoration: BoxDecoration(
- color: sandColor[20],
- borderRadius: BorderRadius.circular(25),
- ),
- child: TabBar(
- controller: _tabController,
- indicatorPadding: const EdgeInsets.all(8),
- indicatorSize: TabBarIndicatorSize.tab,
- indicator: BoxDecoration(
- borderRadius: BorderRadius.circular(25),
- color: sandColor,
- ),
- labelColor: Colors.white,
- labelStyle: theme.textTheme.bodyMedium,
- unselectedLabelColor: Colors.black,
- dividerColor: Colors.transparent,
- tabs: [
- Tab(
- text: 'overview_tabbar_active'.tr(),
- ),
- Tab(text: 'overview_tabbar_past'.tr()),
- Tab(text: 'overview_tabbar_cancelled'.tr()),
- ],
- ),
+ children: [
+ Padding(
+ padding:
+ const EdgeInsets.symmetric(horizontal: 8, vertical: 16),
+ child: Container(
+ height: 39,
+ decoration: BoxDecoration(
+ color: sandColor[20],
+ borderRadius: BorderRadius.circular(25),
),
- ),
- if (state is OverviewLoaded) ...[
- OverviewTabView(
- tabController: _tabController,
- bookings: (state).bookings),
- ] else if (state is OverviewError) ...[
- OverviewTabView(
- tabController: _tabController,
- bookings: const Bookings(
- cancelled: [], current: [], past: [])),
- ] else if (state is OverviewNoBookingFound) ...[
- OverviewTabView(
- tabController: _tabController,
- bookings: state.bookings),
- ] else ...[
- OverviewTabView(
- tabController: _tabController,
- bookings: const Bookings(
- cancelled: [], current: [], past: [])),
- ],
- Padding(
- padding: const EdgeInsets.only(top: 16.0, bottom: 24.0),
- child: OutlinedButton.icon(
- onPressed: () async {
- context.pushNamed(AppRoutes.findBooking.name);
- },
- icon: Icon(Icons.search, color: theme.dividerColor),
- label: Text(
- 'find_booking'.tr(),
- style: theme.textTheme.bodyMedium,
+ child: TabBar(
+ controller: _tabController,
+ indicatorPadding: const EdgeInsets.all(8),
+ indicatorSize: TabBarIndicatorSize.tab,
+ indicator: BoxDecoration(
+ borderRadius: BorderRadius.circular(25),
+ color: sandColor,
),
- style: OutlinedButton.styleFrom(
- side: const BorderSide(color: colorDivider),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(25),
+ labelColor: Colors.white,
+ labelStyle: theme.textTheme.bodyMedium,
+ unselectedLabelColor: Colors.black,
+ dividerColor: Colors.transparent,
+ tabs: [
+ Tab(
+ text: 'overview_tabbar_active'.tr(),
),
- ),
+ Tab(text: 'overview_tabbar_past'.tr()),
+ Tab(text: 'overview_tabbar_cancelled'.tr()),
+ ],
),
),
+ ),
+ if (state is OverviewLoaded) ...[
+ OverviewTabView(
+ tabController: _tabController,
+ bookings: (state).bookings),
+ ] else if (state is OverviewError) ...[
+ OverviewTabView(
+ tabController: _tabController,
+ bookings:
+ const Bookings(cancelled: [], current: [], past: [])),
+ ] else if (state is OverviewNoBookingFound) ...[
+ OverviewTabView(
+ tabController: _tabController, bookings: state.bookings),
+ ] else ...[
+ OverviewTabView(
+ tabController: _tabController,
+ bookings:
+ const Bookings(cancelled: [], current: [], past: [])),
],
- ),
-
+ Padding(
+ padding: const EdgeInsets.only(
+ left: 18.0, right: 18.0, bottom: 32.0, top: 18.0),
+ child: ElevatedButton(
+ onPressed: () async {
+ launchUrl(Uri.parse(ComwellUrls.comwellWebsite));
+ },
+ style:
+ Theme.of(context).elevatedButtonTheme.style?.copyWith(
+ minimumSize: const WidgetStatePropertyAll(
+ Size(double.infinity, 50)),
+ shape: WidgetStatePropertyAll(
+ RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(25),
+ ),
+ ),
+ ),
+ child: Text('new_booking'.tr(),
+ style: theme.textTheme.bodyMedium
+ ?.copyWith(color: Colors.white)),
+ ),
+ ),
+ ],
+ ),
);
},
),
diff --git a/comwell_key_app/lib/profile/utils/urls.dart b/comwell_key_app/lib/profile/utils/urls.dart
index c81ea4e2..f83a686e 100644
--- a/comwell_key_app/lib/profile/utils/urls.dart
+++ b/comwell_key_app/lib/profile/utils/urls.dart
@@ -1,4 +1,5 @@
class ComwellUrls {
static const String clubRules = 'https://comwell.com/club/club-regler';
static const String clubPermission = 'https://comwell.com/club/club-permission';
+ static const String comwellWebsite = 'https://comwell.com/';
}
diff --git a/comwell_key_app/lib/up_sales/pages/up_sale_confirmation_page.dart b/comwell_key_app/lib/up_sales/pages/up_sale_confirmation_page.dart
index 32de7196..1e46dc8d 100644
--- a/comwell_key_app/lib/up_sales/pages/up_sale_confirmation_page.dart
+++ b/comwell_key_app/lib/up_sales/pages/up_sale_confirmation_page.dart
@@ -109,7 +109,6 @@ class UpSaleConfirmationPage extends StatelessWidget {
)),
GestureDetector(
onTap: () {
- // TODO: Whats the correct url?
launchUrl(Uri.parse(ComwellUrls.clubRules));
},
child: Text(