|
@@ -3,6 +3,7 @@ import 'package:cs_resources/generated/l10n.dart';
|
|
|
import 'package:cs_resources/theme/app_colors_theme.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:auto_route/auto_route.dart';
|
|
|
+import 'package:flutter_hooks/flutter_hooks.dart';
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
import 'package:router/ext/auto_router_extensions.dart';
|
|
|
import 'package:widgets/ext/ex_widget.dart';
|
|
@@ -14,21 +15,23 @@ import 'facility_detail_view_model.dart';
|
|
|
|
|
|
@RoutePage()
|
|
|
class FacilityDetailPage extends HookConsumerWidget {
|
|
|
- const FacilityDetailPage({Key? key}) : super(key: key);
|
|
|
+ final String? bookingId;
|
|
|
+
|
|
|
+ const FacilityDetailPage({Key? key, required this.bookingId}) : super(key: key);
|
|
|
|
|
|
|
|
|
- static void startInstance({BuildContext? context}) {
|
|
|
+ static void startInstance({BuildContext? context, required String? bookingId}) {
|
|
|
if (context != null) {
|
|
|
- context.router.push(const FacilityDetailPageRoute());
|
|
|
+ context.router.push(FacilityDetailPageRoute(bookingId: bookingId));
|
|
|
} else {
|
|
|
- appRouter.push(const FacilityDetailPageRoute());
|
|
|
+ appRouter.push(FacilityDetailPageRoute(bookingId: bookingId));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- static void startWithPop2Main() {
|
|
|
+ static void startWithPop2Main({required String? bookingId}) {
|
|
|
appRouter.pushAndPopUntil(
|
|
|
- const FacilityDetailPageRoute(),
|
|
|
+ FacilityDetailPageRoute(bookingId: bookingId),
|
|
|
predicate: (route) {
|
|
|
return route.settings.name == 'FacilityPageRoute';
|
|
|
},
|
|
@@ -40,8 +43,16 @@ class FacilityDetailPage extends HookConsumerWidget {
|
|
|
final viewModel = ref.watch(facilityDetailViewModelProvider.notifier);
|
|
|
final state = ref.watch(facilityDetailViewModelProvider);
|
|
|
|
|
|
+ useEffect(() {
|
|
|
+
|
|
|
+ Future.microtask(() => viewModel.fetchFacilityDetail(bookingId));
|
|
|
+ return () {
|
|
|
+
|
|
|
+ };
|
|
|
+ }, []);
|
|
|
+
|
|
|
return Scaffold(
|
|
|
- appBar: MyAppBar.appBar(context, "Kids party room", backgroundColor: context.appColors.backgroundWhite),
|
|
|
+ appBar: MyAppBar.appBar(context, state.detail?.facility?.type?.name ?? "", backgroundColor: context.appColors.backgroundWhite),
|
|
|
backgroundColor: context.appColors.backgroundDark,
|
|
|
body: SingleChildScrollView(
|
|
|
scrollDirection: Axis.vertical,
|
|
@@ -61,9 +72,9 @@ class FacilityDetailPage extends HookConsumerWidget {
|
|
|
Assets.facilityConfirmDateIcon,
|
|
|
28.5,
|
|
|
29,
|
|
|
- "Tue,24 Oct 2023",
|
|
|
+ state.detail?.booking?.date ?? "",
|
|
|
null,
|
|
|
- "05:00 PM-10:00 PM",
|
|
|
+ "${state.detail?.booking?.start ?? ""}-${state.detail?.booking?.end ?? ""}",
|
|
|
null,
|
|
|
),
|
|
|
|
|
@@ -75,9 +86,9 @@ class FacilityDetailPage extends HookConsumerWidget {
|
|
|
Assets.facilityConfirmFacilityIcon,
|
|
|
25.0,
|
|
|
30.5,
|
|
|
- "Kids party room",
|
|
|
+ state.detail?.facility?.type?.name ?? "",
|
|
|
null,
|
|
|
- "Blue room",
|
|
|
+ state.detail?.facility?.name ?? "",
|
|
|
null,
|
|
|
),
|
|
|
|
|
@@ -90,9 +101,9 @@ class FacilityDetailPage extends HookConsumerWidget {
|
|
|
27.0,
|
|
|
22.0,
|
|
|
S.current.booking_fee,
|
|
|
- "10.80",
|
|
|
+ state.detail?.timePeriod?.price ?? "",
|
|
|
S.current.total,
|
|
|
- "\$10.80",
|
|
|
+ "\$${state.detail?.timePeriod?.price ?? ""}",
|
|
|
),
|
|
|
|
|
|
|
|
@@ -104,7 +115,7 @@ class FacilityDetailPage extends HookConsumerWidget {
|
|
|
28.0,
|
|
|
26.5,
|
|
|
S.current.on_hold,
|
|
|
- "\$100.00",
|
|
|
+ "\$${state.detail?.timePeriod?.deposit ?? ""}",
|
|
|
null,
|
|
|
null,
|
|
|
),
|
|
@@ -115,6 +126,7 @@ class FacilityDetailPage extends HookConsumerWidget {
|
|
|
}
|
|
|
|
|
|
Widget _buildHeaderWidget(BuildContext context, WidgetRef ref) {
|
|
|
+ final state = ref.watch(facilityDetailViewModelProvider);
|
|
|
return Container(
|
|
|
width: double.infinity,
|
|
|
color: context.appColors.whiteBG,
|
|
@@ -152,7 +164,7 @@ class FacilityDetailPage extends HookConsumerWidget {
|
|
|
textColor: context.appColors.textBlack,
|
|
|
),
|
|
|
MyTextView(
|
|
|
- "\$10.80",
|
|
|
+ "\$${state.detail?.timePeriod?.price ?? ""}",
|
|
|
fontSize: 15,
|
|
|
isFontRegular: true,
|
|
|
textColor: context.appColors.textPrimary,
|
|
@@ -187,7 +199,7 @@ class FacilityDetailPage extends HookConsumerWidget {
|
|
|
textColor: context.appColors.textBlack,
|
|
|
),
|
|
|
MyTextView(
|
|
|
- "24 Oct 2023 at 02:19 PM",
|
|
|
+ " ${state.detail?.booking?.date ?? ""}",
|
|
|
fontSize: 15,
|
|
|
isFontMedium: true,
|
|
|
textColor: context.appColors.textBlack,
|
|
@@ -195,21 +207,70 @@ class FacilityDetailPage extends HookConsumerWidget {
|
|
|
],
|
|
|
).marginOnly(top: 5),
|
|
|
|
|
|
- Divider(height: 0.5, color: context.appColors.dividerDefault).marginOnly(top: 14, bottom: 14),
|
|
|
+
|
|
|
+ Visibility(
|
|
|
+ visible: state.detail?.booking?.depositRefund != "0.00",
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ Divider(height: 0.5, color: context.appColors.dividerDefault).marginOnly(top: 14, bottom: 14),
|
|
|
|
|
|
-
|
|
|
- MyTextView(
|
|
|
- S.current.deposit_released_caps,
|
|
|
- fontSize: 15,
|
|
|
- isFontRegular: true,
|
|
|
- textColor: context.appColors.textBlack,
|
|
|
- ),
|
|
|
- MyTextView(
|
|
|
- "\$100.00",
|
|
|
- fontSize: 15,
|
|
|
- marginTop: 5,
|
|
|
- isFontRegular: true,
|
|
|
- textColor: context.appColors.textPrimary,
|
|
|
+
|
|
|
+ MyTextView(
|
|
|
+ S.current.deposit_released_caps,
|
|
|
+ fontSize: 15,
|
|
|
+ isFontRegular: true,
|
|
|
+ textColor: context.appColors.textBlack,
|
|
|
+ ),
|
|
|
+
|
|
|
+ MyTextView(
|
|
|
+ "\$${state.detail?.booking?.depositRefund ?? ""}",
|
|
|
+ fontSize: 15,
|
|
|
+ marginTop: 5,
|
|
|
+ isFontRegular: true,
|
|
|
+ textColor: context.appColors.textPrimary,
|
|
|
+ ),
|
|
|
+
|
|
|
+ Divider(height: 0.5, color: context.appColors.dividerDefault).marginOnly(top: 14, bottom: 14),
|
|
|
+
|
|
|
+
|
|
|
+ Row(
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ S.current.hold_started_on,
|
|
|
+ fontSize: 15,
|
|
|
+ isFontRegular: true,
|
|
|
+ textColor: context.appColors.textBlack,
|
|
|
+ ),
|
|
|
+ MyTextView(
|
|
|
+ " ${state.detail?.booking?.date ?? ""}",
|
|
|
+ fontSize: 15,
|
|
|
+ isFontMedium: true,
|
|
|
+ textColor: context.appColors.textBlack,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ).marginOnly(top: 5),
|
|
|
+
|
|
|
+
|
|
|
+ Row(
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ S.current.released_on,
|
|
|
+ fontSize: 15,
|
|
|
+ isFontRegular: true,
|
|
|
+ textColor: context.appColors.textBlack,
|
|
|
+ ),
|
|
|
+ MyTextView(
|
|
|
+ " ${state.detail?.booking?.depositRefundAt ?? ""}",
|
|
|
+ fontSize: 15,
|
|
|
+ isFontMedium: true,
|
|
|
+ textColor: context.appColors.textBlack,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ).marginOnly(top: 5),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
|
|
|
const SizedBox(height: 23),
|