6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 72fe2d7a

AuthorEdmir Suljic<esu@dwarf.dk>
Date2025-05-01 11:13:25 +0200
1537: Created UI for My booking page

Changed files

comwell_key_app/assets/translations/da-DK.json     |  14 +-
 comwell_key_app/assets/translations/en-US.json     |  14 +-
 .../lib/booking_details/booking_details_page.dart  | 252 +++++++++++++------
 .../components/check_in_button.dart                |   5 +-
 .../lib/common/components/bottom_sheet_widget.dart |  13 +-
 .../lib/my_booking/cubit/my_booking_cubit.dart     |  21 ++
 .../lib/my_booking/cubit/my_booking_state.dart     |  25 ++
 .../lib/my_booking/my_booking_page.dart            | 280 +++++++++++++++++++++
 .../lib/my_booking/my_booking_repository.dart      |  20 ++
 .../profile_settings/profile_settings_page.dart    |  16 +-
 comwell_key_app/lib/routing/app_router.dart        |   7 +
 comwell_key_app/lib/routing/app_routes.dart        |   1 +
 12 files changed, 565 insertions(+), 103 deletions(-)

Diff

diff --git a/comwell_key_app/assets/translations/da-DK.json b/comwell_key_app/assets/translations/da-DK.json
index 37b451ed..56130ba4 100644
--- a/comwell_key_app/assets/translations/da-DK.json
+++ b/comwell_key_app/assets/translations/da-DK.json
@@ -51,13 +51,13 @@
"open_room_success": "Succes",
"open_room_error": "Prøv igen!",
"profile_settings": "Profilindstillinger",
- "profil_settings_firstname": "Fornavn",
- "profil_settings_lastname": "Efternavn",
- "profil_settings_email": "Email",
- "profil_settings_phone": "Telefon",
- "profil_settings_address": "Adresse",
- "profil_settings_birthday": "Fødselsdag",
- "profil_settings_edit_password": "Ret adgangskode",
+ "profile_settings_firstname": "Fornavn",
+ "profile_settings_lastname": "Efternavn",
+ "profile_settings_email": "Email",
+ "profile_settings_phone": "Telefon",
+ "profile_settings_address": "Adresse",
+ "profile_settings_birthday": "Fødselsdag",
+ "profile_settings_edit_password": "Ret adgangskode",
"profile_settings_error": "Der skete en fejl. Prøv igen.",
"delete_profile": "Slet profil",
"my_booking": "Min booking",
diff --git a/comwell_key_app/assets/translations/en-US.json b/comwell_key_app/assets/translations/en-US.json
index a6504e80..3d27211f 100644
--- a/comwell_key_app/assets/translations/en-US.json
+++ b/comwell_key_app/assets/translations/en-US.json
@@ -51,13 +51,13 @@
"open_room_success": "Success",
"open_room_error": "Try again!",
"profile_settings": "Profile settings",
- "profil_settings_firstname": "First name",
- "profil_settings_lastname": "Last name",
- "profil_settings_email": "Email",
- "profil_settings_phone": "Phone",
- "profil_settings_address": "Address",
- "profil_settings_birthday": "Birthday",
- "profil_settings_edit_password": "Edit password",
+ "profile_settings_firstname": "First name",
+ "profile_settings_lastname": "Last name",
+ "profile_settings_email": "Email",
+ "profile_settings_phone": "Phone",
+ "profile_settings_address": "Address",
+ "profile_settings_birthday": "Birthday",
+ "profile_settings_edit_password": "Edit password",
"profile_settings_error": "An error occurred. Please try again later.",
"delete_profile": "Delete profile",
"my_booking": "My booking",
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 686d10d6..a244217d 100644
--- a/comwell_key_app/lib/booking_details/booking_details_page.dart
+++ b/comwell_key_app/lib/booking_details/booking_details_page.dart
@@ -33,91 +33,191 @@ class BookingDetailsPage extends StatelessWidget {
extendBodyBehindAppBar: true,
backgroundColor: sandColor[40],
appBar: const ComwellAppBar(),
- body: Container(
- decoration: const BoxDecoration(
- image: DecorationImage(
- image: AssetImage('assets/images/booking_background.png'),
- fit: BoxFit.cover,
+ body: Stack(
+ children: [
+ Container(
+ decoration: const BoxDecoration(
+ image: DecorationImage(
+ image: AssetImage('assets/images/booking_background.png'),
+ fit: BoxFit.cover,
+ ),
+ ),
),
- ),
- child: Stack(
- alignment: Alignment.center,
- children: [
- SafeArea(
- child: ShareButton(guests: state.guests),
+ Container(
+ decoration: const BoxDecoration(
+ gradient: LinearGradient(
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ colors: [
+ Colors.black26,
+ Colors.black54,
+ ],
+ ),
),
- Column(
- crossAxisAlignment: CrossAxisAlignment.center,
+ ),
+ Stack(
+ alignment: Alignment.center,
+ children: [
+ SafeArea(
+ child: ShareButton(guests: state.guests),
+ ),
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ const Spacer(),
+ _buildBookingDetails(context, state),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Divider(color: Colors.grey[400]),
+ ),
+ const SizedBox(height: 10),
+ if (state.keys.isNotEmpty)
+ const UnlockRoomButton()
+ else
+ const CheckInButton(),
+ const SizedBox(
+ height: 220,
+ ),
+ ],
+ ),
+ BottomSheetWidget(
+ widgetChildren: [
+ HousekeepingButton(
+ key: ValueKey(state.isHouseKeepingOrdered)),
+ const SizedBox(height: 20),
+ const CheckOutButton(),
+ const SizedBox(height: 20),
+ Text("booking_details_page_practical_information".tr()),
+ const SizedBox(height: 20),
+ Row(children: [
+ Expanded(
+ child: AspectRatio(
+ aspectRatio: 175 / 220,
+ child: PracticalInformationButton(
+ iconPath: "assets/icons/ic_bed.svg",
+ title:
+ "booking_details_page_hotel_information_button_title"
+ .tr(),
+ subtitle:
+ "booking_details_page_hotel_information_button_subtitle"
+ .tr(),
+ onClick: () {
+ context.pushNamed(
+ AppRoutes.hotelInformation.name);
+ }),
+ ),
+ ),
+ const SizedBox(width: 8),
+ Expanded(
+ child: AspectRatio(
+ aspectRatio: 175 / 220,
+ child: PracticalInformationButton(
+ iconPath: "assets/icons/ic_telephone.svg",
+ title:
+ "booking_details_page_contact_button_title"
+ .tr(),
+ subtitle:
+ "booking_details_page_contact_button_subtitle"
+ .tr(),
+ onClick: () {
+ context.pushNamed(AppRoutes.contact.name);
+ }),
+ ),
+ ),
+ ]),
+ const SizedBox(height: 16),
+ Text('rooms'.tr()),
+ const SizedBox(height: 16),
+ const PreregisterButton(),
+ const SizedBox(height: 16),
+ Text('room_keys'.tr()),
+ const SizedBox(height: 400),
+ ],
+ )
+ ],
+ )
+ ],
+ ),
+ );
+ },
+ );
+ }
+
+ Widget _buildBookingDetails(BuildContext context, BookingDetailsState state) {
+ final theme = Theme.of(context);
+
+ return InkWell(
+ onTap: () {
+ context.pushNamed(AppRoutes.myBooking.name);
+ },
+ child: Container(
+ width: double.infinity,
+ height: 50,
+ decoration: BoxDecoration(
+ color: Colors.transparent,
+ borderRadius: BorderRadius.circular(4),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
- const Spacer(),
- if (state.keys.isNotEmpty)
- const UnlockRoomButton()
- else
- const CheckInButton(),
- const SizedBox(
- height: 220,
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ '20100868-1',
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: Colors.white,
+ fontWeight: FontWeight.w400,
+ ),
+ ),
+ const SizedBox(width: 12),
+ Text(
+ 'Balance',
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: Colors.white,
+ fontWeight: FontWeight.w400,
+ ),
+ ),
+ ],
),
- ],
- ),
- BottomSheetWidget(
- widgetChildren: [
- HousekeepingButton(
- key: ValueKey(state.isHouseKeepingOrdered)),
- const SizedBox(height: 20),
- const CheckOutButton(),
- const SizedBox(height: 20),
- Text("booking_details_page_practical_information".tr()),
- const SizedBox(height: 20),
- Row(children: [
- Expanded(
- child: AspectRatio(
- aspectRatio: 175 / 220,
- child: PracticalInformationButton(
- iconPath: "assets/icons/ic_bed.svg",
- title:
- "booking_details_page_hotel_information_button_title"
- .tr(),
- subtitle:
- "booking_details_page_hotel_information_button_subtitle"
- .tr(),
- onClick: () {
- context
- .pushNamed(AppRoutes.hotelInformation.name);
- }),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ 'Standard Double Room',
+ style: theme.textTheme.bodyMedium?.copyWith(
+ color: Colors.white,
+ ),
),
- ),
- const SizedBox(width: 8),
- Expanded(
- child: AspectRatio(
- aspectRatio: 175 / 220,
- child: PracticalInformationButton(
- iconPath: "assets/icons/ic_telephone.svg",
- title: "booking_details_page_contact_button_title"
- .tr(),
- subtitle:
- "booking_details_page_contact_button_subtitle"
- .tr(),
- onClick: () {
- context.pushNamed(AppRoutes.contact.name);
- }),
+ const SizedBox(width: 12),
+ Text(
+ '-200 kr.',
+ style: theme.textTheme.bodyMedium?.copyWith(
+ color: Colors.white,
+ ),
),
- ),
- ]),
- const SizedBox(height: 16),
- Text('rooms'.tr()),
- const SizedBox(height: 16),
- const PreregisterButton(),
- const SizedBox(height: 16),
- Text('room_keys'.tr()),
- const SizedBox(height: 400),
+ ],
+ ),
],
- )
- ],
- ),
+ ),
+ ),
+ const Icon(
+ Icons.chevron_right,
+ color: Colors.white,
+ size: 36,
+ ),
+ ],
),
- );
- },
+ ),
+ ),
);
}
}
diff --git a/comwell_key_app/lib/booking_details/components/check_in_button.dart b/comwell_key_app/lib/booking_details/components/check_in_button.dart
index b0b267ea..9a2858e3 100644
--- a/comwell_key_app/lib/booking_details/components/check_in_button.dart
+++ b/comwell_key_app/lib/booking_details/components/check_in_button.dart
@@ -21,7 +21,7 @@ class CheckInButton extends StatelessWidget {
Widget getDigitalCardWidget(BuildContext context, BookingDetailsBloc bloc) {
return Container(
- margin: const EdgeInsets.symmetric(horizontal: 30),
+ margin: const EdgeInsets.symmetric(horizontal: 10),
child: ElevatedButton(
onPressed: () async {
await context.pushNamed(AppRoutes.checkIn.name, extra: bloc.booking);
@@ -30,6 +30,7 @@ class CheckInButton extends StatelessWidget {
}
},
style: ElevatedButton.styleFrom(
+ elevation: 0,
backgroundColor: sandColor[80],
textStyle: const TextStyle(
color: Colors.white,
@@ -77,7 +78,7 @@ class CheckInButton extends StatelessWidget {
Widget getPhysicalCardWidget(BuildContext context) {
return Container(
- margin: const EdgeInsets.symmetric(horizontal: 30),
+ margin: const EdgeInsets.symmetric(horizontal: 10),
child: Container(
decoration: BoxDecoration(
color: sandColor[80],
diff --git a/comwell_key_app/lib/common/components/bottom_sheet_widget.dart b/comwell_key_app/lib/common/components/bottom_sheet_widget.dart
index 3e481b7d..e0d1605e 100644
--- a/comwell_key_app/lib/common/components/bottom_sheet_widget.dart
+++ b/comwell_key_app/lib/common/components/bottom_sheet_widget.dart
@@ -3,10 +3,17 @@ import 'package:flutter/material.dart';
import 'package:sheet/sheet.dart';
class BottomSheetWidget extends StatelessWidget {
+ final double initialExtent;
+ final double maxExtent;
+ final double minExtent;
+
final List<Widget> widgetChildren;
const BottomSheetWidget({
required this.widgetChildren,
+ this.initialExtent = 200,
+ this.maxExtent = 600,
+ this.minExtent = 100,
super.key,
});
@@ -14,7 +21,7 @@ class BottomSheetWidget extends StatelessWidget {
Widget build(BuildContext context) {
return Sheet(
backgroundColor: sandColor[40],
- initialExtent: 200,
+ initialExtent: initialExtent,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
@@ -23,8 +30,8 @@ class BottomSheetWidget extends StatelessWidget {
),
resizable: true,
fit: SheetFit.expand,
- minExtent: 100,
- maxExtent: 600,
+ minExtent: minExtent,
+ maxExtent: maxExtent,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
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
new file mode 100644
index 00000000..cfc5e590
--- /dev/null
+++ b/comwell_key_app/lib/my_booking/cubit/my_booking_cubit.dart
@@ -0,0 +1,21 @@
+
+import 'package:comwell_key_app/my_booking/cubit/my_booking_state.dart';
+import 'package:comwell_key_app/my_booking/my_booking_repository.dart';
+import 'package:comwell_key_app/overview/models/booking.dart';
+import 'package:comwell_key_app/utils/locator.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+
+class MyBookingCubit extends Cubit<MyBookingState> {
+ final MyBookingRepository myBookingRepository;
+ MyBookingCubit(this.myBookingRepository)
+ : super(const MyBookingState(
+ booking: null,
+ isLoading: false,
+ error: null,
+ ));
+
+ Future<void> fetchBooking() async {
+ final booking = await myBookingRepository.fetchBooking();
+
+ }
+}
diff --git a/comwell_key_app/lib/my_booking/cubit/my_booking_state.dart b/comwell_key_app/lib/my_booking/cubit/my_booking_state.dart
new file mode 100644
index 00000000..5c40753c
--- /dev/null
+++ b/comwell_key_app/lib/my_booking/cubit/my_booking_state.dart
@@ -0,0 +1,25 @@
+import 'package:comwell_key_app/overview/models/booking.dart';
+import 'package:equatable/equatable.dart';
+
+class MyBookingState extends Equatable {
+ final Error? error;
+ final bool isLoading;
+ final Booking? booking;
+
+ const MyBookingState({
+ required this.booking,
+ this.error,
+ required this.isLoading,
+ });
+
+ @override
+ List<Object?> get props => [booking, error, isLoading];
+
+ MyBookingState copyWith({Booking? booking}) {
+ return MyBookingState(
+ booking: booking ?? this.booking,
+ error: error,
+ isLoading: isLoading,
+ );
+ }
+}
diff --git a/comwell_key_app/lib/my_booking/my_booking_page.dart b/comwell_key_app/lib/my_booking/my_booking_page.dart
new file mode 100644
index 00000000..0a5b4d37
--- /dev/null
+++ b/comwell_key_app/lib/my_booking/my_booking_page.dart
@@ -0,0 +1,280 @@
+import 'package:comwell_key_app/common/components/bottom_sheet_widget.dart';
+import 'package:comwell_key_app/common/components/comwell_app_bar.dart';
+import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:flutter/material.dart';
+
+class MyBookingPage extends StatelessWidget {
+ const MyBookingPage({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ final theme = Theme.of(context);
+
+ 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(
+ 'Min booking',
+ style: theme.textTheme.titleLarge?.copyWith(
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ const SizedBox(height: 8),
+ Text(
+ 'Bookingsreference',
+ style: TextStyle(
+ color: Colors.grey[600],
+ fontSize: 14,
+ ),
+ ),
+ const Text(
+ '201004868-1',
+ style: TextStyle(fontSize: 14),
+ ),
+ 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),
+
+ TextButton(
+ onPressed: () {},
+ child: const Text(
+ 'Annuller ophold',
+ style: TextStyle(
+ color: Colors.red,
+ fontSize: 16,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ const BottomSheetWidget(
+ initialExtent: 100,
+ maxExtent: 600,
+ minExtent: 100,
+ widgetChildren: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text('Hello'),
+ Text('Hello'),
+ ],
+ ),
+ ],
+ ),
+ ],
+ ),
+ );
+ }
+
+ Widget _buildCheckInOutSection(ThemeData theme) {
+ return Row(
+ children: [
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text('Check-in', style: theme.textTheme.titleMedium),
+ const SizedBox(height: 4),
+ Text(
+ '13. nov. 2024',
+ style: theme.textTheme.bodyMedium
+ ),
+ Text(
+ '15:00',
+ style: theme.textTheme.bodyMedium
+ ),
+ ],
+ ),
+ ),
+ const Expanded(
+ child: Icon(
+ Icons.arrow_forward,
+ color: Colors.grey,
+ size: 32,
+ ),
+ ),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text('Checkout', style: theme.textTheme.titleMedium),
+ const SizedBox(height: 4),
+ Text(
+ '14. nov. 2024',
+ style: theme.textTheme.bodyMedium,
+ ),
+ const SizedBox(height: 4),
+ Text(
+ '10:00',
+ style: theme.textTheme.bodyMedium,
+ ),
+ ],
+ ),
+ ),
+ ],
+ );
+ }
+
+ Widget _buildBookingDetails(ThemeData theme) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'Booking',
+ style: theme.textTheme.titleMedium
+ ),
+ const SizedBox(height: 8),
+ Text('Standard Double Room', style: theme.textTheme.bodyMedium),
+ Text('Overnatning med morgenmad', style: theme.textTheme.bodyMedium),
+ const SizedBox(height: 16),
+ const Divider(color: colorDivider),
+ Text(
+ 'Personer',
+ style: theme.textTheme.titleMedium,
+ ),
+ const SizedBox(height: 8),
+ Text('2 voksne', style: theme.textTheme.bodyMedium),
+ const SizedBox(height: 16),
+ const Divider(color: colorDivider),
+ Text(
+ 'Booker',
+ style: theme.textTheme.titleMedium,
+ ),
+ const SizedBox(height: 8),
+ Text('Jeppe Bjørholm Andersen', style: theme.textTheme.bodyMedium),
+ const SizedBox(height: 16),
+ const Divider(color: colorDivider),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.end,
+ children: [
+ Text(
+ 'Del ophold',
+ style: theme.textTheme.titleMedium,
+ ),
+ Container(
+ padding: const EdgeInsets.all(8),
+ decoration: BoxDecoration(
+ color: Colors.brown.shade300,
+ shape: BoxShape.circle,
+ ),
+ child: const Icon(Icons.add, color: Colors.white, size: 20),
+ ),
+ ],
+ ),
+ Text('Ikke delt', style: theme.textTheme.bodyMedium),
+ ],
+ );
+ }
+
+ Widget _buildPaymentSection(ThemeData theme) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'Betaling',
+ style: theme.textTheme.titleLarge,
+ ),
+ const SizedBox(height: 16),
+ Row(
+ children: [
+ Text('Betalingsmetode', style: theme.textTheme.bodyMedium),
+ SizedBox(width: 8),
+ Text('•••• •••• •••• 1234', style: theme.textTheme.bodyMedium),
+ SizedBox(width: 8),
+ ],
+ ),
+ SizedBox(height: 16),
+ Text('Betalingsdato'),
+ Text('15. jul 2024'),
+ ],
+ );
+ }
+
+ Widget _buildCancellationPolicy(ThemeData theme) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const Text(
+ 'Annuleringsbetingelser',
+ style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
+ ),
+ const SizedBox(height: 8),
+ Text(
+ 'Dette ophold kan annuleres omkostningsfrit indtil d. 12.11.2024 kl. 15:00 på ankomstdagen. Annulleres senere end d. 14.01 skal del faktureres v/r for den første nat.',
+ style: theme.textTheme.bodyMedium,
+ ),
+ ],
+ );
+ }
+
+ Widget _buildBalanceBottomSheet(ThemeData theme) {
+ return Positioned(
+ bottom: 0,
+ left: 0,
+ right: 0,
+ child: Container(
+ decoration: BoxDecoration(
+ color: Colors.brown.shade300,
+ borderRadius: const BorderRadius.only(
+ topLeft: Radius.circular(16),
+ topRight: Radius.circular(16),
+ ),
+ ),
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ 'Min balance',
+ style: theme.textTheme.bodyMedium?.copyWith(
+ color: Colors.white,
+ fontSize: 16,
+ fontWeight: FontWeight.w500,
+ ),
+ ),
+ Row(
+ children: [
+ const Text(
+ '-200 kr',
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 16,
+ fontWeight: FontWeight.w500,
+ ),
+ ),
+ const SizedBox(width: 8),
+ Icon(
+ Icons.keyboard_arrow_up,
+ color: Colors.white.withOpacity(0.8),
+ ),
+ ],
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/comwell_key_app/lib/my_booking/my_booking_repository.dart b/comwell_key_app/lib/my_booking/my_booking_repository.dart
new file mode 100644
index 00000000..c1f6b1e2
--- /dev/null
+++ b/comwell_key_app/lib/my_booking/my_booking_repository.dart
@@ -0,0 +1,20 @@
+
+import 'package:comwell_key_app/database/comwell_db.dart';
+import 'package:comwell_key_app/profile/profile_repository.dart';
+import 'package:comwell_key_app/profile_settings/model/user.dart';
+import 'package:comwell_key_app/services/api.dart';
+import 'package:comwell_key_app/utils/locator.dart';
+
+class MyBookingRepository {
+ final Api api = Api();
+ final db = locator<ComwellDatabase>();
+ final ProfileRepository profileRepository = locator<ProfileRepository>();
+ late User user;
+
+ Future<User> fetchUser() async {
+ user = await profileRepository.fetchProfileSettings();
+ return user;
+ }
+
+ fetchBooking() {}
+}
diff --git a/comwell_key_app/lib/profile_settings/profile_settings_page.dart b/comwell_key_app/lib/profile_settings/profile_settings_page.dart
index 67b95f16..7992e5bc 100644
--- a/comwell_key_app/lib/profile_settings/profile_settings_page.dart
+++ b/comwell_key_app/lib/profile_settings/profile_settings_page.dart
@@ -1,4 +1,4 @@
-import 'package:comwell_key_app/authentication/bloc/authentication_bloc.dart';
+ import 'package:comwell_key_app/authentication/bloc/authentication_bloc.dart';
import 'package:comwell_key_app/common/components/comwell_app_bar.dart';
import 'package:comwell_key_app/common/components/generic_dialog.dart';
import 'package:comwell_key_app/login/auth.dart';
@@ -81,7 +81,7 @@ class ProfileSettingsPage extends StatelessWidget {
textAlign: TextAlign.start),
const SizedBox(height: 36),
ComwellTextField(
- fieldName: "profil_settings_firstname".tr(),
+ fieldName: "profile_settings_firstname".tr(),
initialValue: state.user!.firstName,
readOnly: false,
controller: _firstNameController,
@@ -91,7 +91,7 @@ class ProfileSettingsPage extends StatelessWidget {
}),
const SizedBox(height: 8),
ComwellTextField(
- fieldName: "profil_settings_lastname".tr(),
+ fieldName: "profile_settings_lastname".tr(),
initialValue: state.user!.lastName,
readOnly: false,
controller: _lastNameController,
@@ -107,7 +107,7 @@ class ProfileSettingsPage extends StatelessWidget {
),
const SizedBox(height: 8),
IntlPhoneField(
- title: "profil_settings_phone".tr(),
+ title: "profile_settings_phone".tr(),
phoneNumber: state.user!.phoneNumber,
controller: _phoneNumberController,
readOnly: false,
@@ -117,7 +117,7 @@ class ProfileSettingsPage extends StatelessWidget {
),
const SizedBox(height: 8),
TextFieldWithTrailingIcon(
- title: "profil_settings_address".tr(),
+ title: "profile_settings_address".tr(),
text:
"${state.user!.address.street}, ${state.user!.address.city}, ${state.user!.address.zipCode}, ${state.user!.address.country}",
trailingIcon: "assets/icons/edit-alt.svg",
@@ -138,13 +138,13 @@ class ProfileSettingsPage extends StatelessWidget {
showTitle: true),
const SizedBox(height: 8),
DateTimePicker(
- title: "profil_settings_birthday".tr(),
+ title: "profile_settings_birthday".tr(),
initialValue: state.user!.birthDate,
),
const SizedBox(height: 8),
TextFieldWithTrailingIcon(
- title: "",
- text: "profil_settings_edit_password".tr(),
+ title: "profile_settings_edit_password".tr(),
+ text: "profile_settings_edit_password".tr(),
trailingIcon: "assets/icons/arrow-left.svg",
onTap: () {
openChangePasswordModal(context, Auth.changePassword);
diff --git a/comwell_key_app/lib/routing/app_router.dart b/comwell_key_app/lib/routing/app_router.dart
index 2e7a74f2..d123ccaf 100644
--- a/comwell_key_app/lib/routing/app_router.dart
+++ b/comwell_key_app/lib/routing/app_router.dart
@@ -16,6 +16,7 @@ import 'package:comwell_key_app/hotel_information/hotel_information_page.dart';
import 'package:comwell_key_app/housekeeping/housekeeping_page.dart';
import 'package:comwell_key_app/key/key_page.dart';
import 'package:comwell_key_app/login/login_page.dart';
+import 'package:comwell_key_app/my_booking/my_booking_page.dart';
import 'package:comwell_key_app/notifications/cubit/notifications_cubit.dart';
import 'package:comwell_key_app/notifications/models/notification_permission.dart';
import 'package:comwell_key_app/notifications/notifications_page.dart';
@@ -265,6 +266,12 @@ GoRouter goRouter(AuthenticationBloc authBloc) {
),
],
),
+ GoRoute(
+ path: "/${AppRoutes.myBooking.name}",
+ name: AppRoutes.myBooking.name,
+ builder: (context, state) {
+ return const MyBookingPage();
+ }),
GoRoute(
path: "/${AppRoutes.paymentCards.name}",
name: AppRoutes.paymentCards.name,
diff --git a/comwell_key_app/lib/routing/app_routes.dart b/comwell_key_app/lib/routing/app_routes.dart
index 80ddb010..a08fd617 100644
--- a/comwell_key_app/lib/routing/app_routes.dart
+++ b/comwell_key_app/lib/routing/app_routes.dart
@@ -27,4 +27,5 @@ enum AppRoutes {
paymentCards,
shareBooking,
notifications,
+ myBooking,
}