|
|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
import 'dart:developer';
|
|
|
|
|
|
|
|
|
|
import 'package:car_customer_app/view_models/appointments_view_model.dart';
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
@ -5,6 +7,7 @@ import 'package:mc_common_app/classes/consts.dart';
|
|
|
|
|
import 'package:mc_common_app/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:mc_common_app/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:mc_common_app/generated/locale_keys.g.dart';
|
|
|
|
|
import 'package:mc_common_app/models/schedule_model.dart';
|
|
|
|
|
import 'package:mc_common_app/models/service_schedule_model.dart';
|
|
|
|
|
import 'package:mc_common_app/models/services/item_model.dart';
|
|
|
|
|
import 'package:mc_common_app/models/services/service_model.dart';
|
|
|
|
|
@ -93,7 +96,7 @@ class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: "Schedule: ${scheduleIndex + 1}".toText(fontSize: 20, isBold: true),
|
|
|
|
|
child: "Services".toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -103,7 +106,7 @@ class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
ListView.separated(
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: appointmentsVM.servicesInSchedule.length,
|
|
|
|
|
itemCount: scheduleData.servicesListInAppointment!.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int serviceIndex) {
|
|
|
|
|
String selectedTimeSlot = "";
|
|
|
|
|
if (scheduleData.selectedCustomTimeDateSlotModel!.availableSlots != null) {
|
|
|
|
|
@ -111,33 +114,38 @@ class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
}
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
// Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// Expanded(
|
|
|
|
|
// child: selectedService.value.toText(fontSize: 14, isBold: true),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
if (true) ...[
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Service Location: ".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
(appointmentsVM.isHomeTapped ? "Home" : "Workshop").toText(fontSize: 12, isBold: true).expand(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
5.height,
|
|
|
|
|
if (scheduleData.servicesListInAppointment!.isNotEmpty) ...[
|
|
|
|
|
Column(
|
|
|
|
|
children: List.generate(scheduleData.servicesListInAppointment!.length, (itemIndex) {
|
|
|
|
|
ServiceModel serviceData = scheduleData.servicesListInAppointment![itemIndex];
|
|
|
|
|
return Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: List.generate(scheduleData.servicesListInAppointment!.length, (serviceIndex) {
|
|
|
|
|
ServiceModel serviceData = scheduleData.servicesListInAppointment![serviceIndex];
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
"${serviceData.providerServiceDescription}".toText(fontSize: 13, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"${serviceData.providerServiceDescription}".toText(fontSize: 16, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
children: List.generate(serviceData.serviceItems!.length, (itemIndex) {
|
|
|
|
|
ItemData itemData = serviceData.serviceItems![itemIndex];
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"${itemData.name}: ${itemData.price} SAR".toText(fontSize: 13, isBold: true, color: MyColors.lightTextColor),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
).paddingOnly(bottom: 10),
|
|
|
|
|
],
|
|
|
|
|
5.height,
|
|
|
|
|
SizedBox(
|
|
|
|
|
@ -145,7 +153,7 @@ class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Time & Location".toText(fontSize: 14, isBold: true),
|
|
|
|
|
"Time & Location".toText(fontSize: 16, isBold: true),
|
|
|
|
|
3.height,
|
|
|
|
|
Row(children: [
|
|
|
|
|
"Date & Time: ".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
@ -153,11 +161,43 @@ class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
]),
|
|
|
|
|
Row(children: [
|
|
|
|
|
"Location: ".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
"PM58+F97, Al Olaya, Riyadh 12333".toText(fontSize: 12, isBold: true),
|
|
|
|
|
(scheduleData.appointmentType == 2 ? "Home" : "Workshop").toText(fontSize: 12, isBold: true),
|
|
|
|
|
]),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
10.height,
|
|
|
|
|
Divider(thickness: 0.7),
|
|
|
|
|
Builder(builder: (BuildContext context) {
|
|
|
|
|
double totalServicePrice = 0.0;
|
|
|
|
|
double totalKms = 15.3;
|
|
|
|
|
double rangePricePerKm = 5;
|
|
|
|
|
totalServicePrice = rangePricePerKm * totalKms;
|
|
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Amount".toText(fontSize: 16, isBold: true),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
"Service Charges".toText(fontSize: 14, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
"${scheduleData.amountTotal.toString()} SAR".toText(fontSize: 16, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (scheduleData.appointmentType == 1) ...[
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
"Location Charges ($rangePricePerKm x $totalKms )".toText(fontSize: 14, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
"${totalServicePrice.toString()} SAR".toText(fontSize: 16, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
10.height,
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
@ -171,111 +211,60 @@ class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget buildTimeAndLocationInfoCard() {
|
|
|
|
|
return SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
Widget buildNextButtonFooter({required BuildContext context}) {
|
|
|
|
|
AppointmentsVM appointmentsVM = context.read<AppointmentsVM>();
|
|
|
|
|
return Container(
|
|
|
|
|
color: MyColors.white,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
"Time & Location".toText(fontSize: 16, isBold: true),
|
|
|
|
|
3.height,
|
|
|
|
|
Row(children: [
|
|
|
|
|
"Date & Time: ".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
"2nd Feb, 2023 at 09:30 AM".toText(fontSize: 12, isBold: true),
|
|
|
|
|
]),
|
|
|
|
|
Row(children: [
|
|
|
|
|
"Location: ".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
"PM58+F97, Al Olaya, Riyadh 12333".toText(fontSize: 12, isBold: true),
|
|
|
|
|
]),
|
|
|
|
|
],
|
|
|
|
|
).toWhiteContainer(width: double.infinity, allPading: 12, margin: EdgeInsets.only(left: 21, right: 21, top: 10)),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget buildChargesBreakDown({required BuildContext context}) {
|
|
|
|
|
AppointmentsVM appointmentsVM = context.read<AppointmentsVM>();
|
|
|
|
|
List<ItemData> allSelectedItems = [];
|
|
|
|
|
double totalServicePrice = 0.0;
|
|
|
|
|
// appointmentsVM.serviceAppointmentScheduleList.forEach((schedule) {
|
|
|
|
|
// schedule.servicesListInAppointment!.forEach((service) {
|
|
|
|
|
// allSelectedItems.add(item);
|
|
|
|
|
// totalServicePrice = totalServicePrice + double.parse(item.price!);
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Services".toText(fontSize: 16, isBold: true),
|
|
|
|
|
Column(
|
|
|
|
|
children: List.generate(
|
|
|
|
|
allSelectedItems.length,
|
|
|
|
|
(index) => Row(
|
|
|
|
|
Divider(thickness: 0.7, height: 3),
|
|
|
|
|
8.height,
|
|
|
|
|
if (appointmentsVM.amountToPayForAppointment > 0) ...[
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
"${allSelectedItems[index].name}".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
"${allSelectedItems[index].price} SAR".toText(fontSize: 12, isBold: true),
|
|
|
|
|
"Payable now".toText(fontSize: 14, isBold: true),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
appointmentsVM.amountToPayForAppointment.toString().toText(fontSize: 16, isBold: true),
|
|
|
|
|
2.width,
|
|
|
|
|
"SAR".toText(color: MyColors.lightTextColor, fontSize: 12, isBold: true).paddingOnly(bottom: 2),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
"${totalServicePrice.toString()} SAR".toText(fontSize: 16, isBold: true),
|
|
|
|
|
).paddingOnly(left: 21, right: 21),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
"Remaining Amount".toText(fontSize: 14, isBold: true),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
(appointmentsVM.totalAmount - appointmentsVM.amountToPayForAppointment).toString().toText(fontSize: 16, isBold: true),
|
|
|
|
|
2.width,
|
|
|
|
|
"SAR".toText(color: MyColors.lightTextColor, fontSize: 12, isBold: true).paddingOnly(bottom: 2),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(left: 21, right: 21),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
10.height,
|
|
|
|
|
Divider(thickness: 0.7),
|
|
|
|
|
if (appointmentsVM.isHomeTapped) ...[
|
|
|
|
|
"Home Location".toText(fontSize: 16, isBold: true),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
"10km ".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
"5 x 10".toText(fontSize: 12, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
"50 SAR".toText(fontSize: 16, isBold: true),
|
|
|
|
|
"Total Amount ".toText(fontSize: 18, isBold: true),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
appointmentsVM.totalAmount.toString().toText(fontSize: 29, isBold: true),
|
|
|
|
|
2.width,
|
|
|
|
|
"SAR".toText(color: MyColors.lightTextColor, fontSize: 16, isBold: true).paddingOnly(bottom: 5),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
10.height,
|
|
|
|
|
Divider(thickness: 0.7),
|
|
|
|
|
],
|
|
|
|
|
10.height,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
"Total Amount ".toText(fontSize: 16, isBold: true),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
totalServicePrice.toString().toText(fontSize: 29, isBold: true),
|
|
|
|
|
2.width,
|
|
|
|
|
"SAR".toText(color: MyColors.lightTextColor, fontSize: 16, isBold: true).paddingOnly(bottom: 5),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
10.height,
|
|
|
|
|
],
|
|
|
|
|
).toWhiteContainer(width: double.infinity, allPading: 12, margin: EdgeInsets.only(left: 21, right: 21, top: 10, bottom: 21));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget buildNextButtonFooter({required BuildContext context}) {
|
|
|
|
|
AppointmentsVM appointmentsVM = context.read<AppointmentsVM>();
|
|
|
|
|
return Container(
|
|
|
|
|
height: 90,
|
|
|
|
|
color: MyColors.white,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Divider(thickness: 0.7, height: 3),
|
|
|
|
|
10.height,
|
|
|
|
|
).paddingOnly(left: 21, right: 21),
|
|
|
|
|
5.height,
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: ShowFillButton(
|
|
|
|
|
@ -283,7 +272,7 @@ class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
backgroundColor: MyColors.darkPrimaryColor,
|
|
|
|
|
title: "Book Appointment",
|
|
|
|
|
onPressed: () {
|
|
|
|
|
// appointmentsVM.onBookAppointmentPressed();
|
|
|
|
|
appointmentsVM.onBookAppointmentPressed(context);
|
|
|
|
|
},
|
|
|
|
|
).paddingOnly(bottom: 12, left: 21, right: 21),
|
|
|
|
|
),
|
|
|
|
|
@ -299,7 +288,6 @@ class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
title: "Review Appointment",
|
|
|
|
|
isRemoveBackButton: false,
|
|
|
|
|
isDrawerEnabled: false,
|
|
|
|
|
actions: [MyAssets.searchIcon.buildSvg().paddingOnly(right: 21)],
|
|
|
|
|
onBackButtonTapped: () => Navigator.pop(context),
|
|
|
|
|
),
|
|
|
|
|
body: Column(
|
|
|
|
|
@ -309,8 +297,6 @@ class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
children: [
|
|
|
|
|
buildBranchInfoCard(context: context),
|
|
|
|
|
buildServicesInfoCard(context: context),
|
|
|
|
|
// buildTimeAndLocationInfoCard(),
|
|
|
|
|
buildChargesBreakDown(context: context),
|
|
|
|
|
],
|
|
|
|
|
).expand(),
|
|
|
|
|
buildNextButtonFooter(context: context),
|
|
|
|
|
|