|
|
|
|
@ -60,63 +60,65 @@ class AppointmentsFragment extends StatelessWidget {
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
RefreshIndicator(
|
|
|
|
|
onRefresh: () async {
|
|
|
|
|
int index = appointmentsVM.appointmentsFilterOptions.indexWhere((element) => element.isSelected);
|
|
|
|
|
if (index != -1) {
|
|
|
|
|
AppointmentStatusEnum appointmentStatusEnum = appointmentsVM.appointmentsFilterOptions[index].id.toAppointmentStatusEnum();
|
|
|
|
|
appointmentsVM.applyFilterOnAppointmentsVMForCustomers(appointmentStatusEnum: appointmentStatusEnum);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: appointmentsVM.state == ViewState.busy
|
|
|
|
|
? const Center(child: CircularProgressIndicator())
|
|
|
|
|
: appointmentsVM.myFilteredAppointmentsForCustomers.isEmpty
|
|
|
|
|
? AppState().getIsViewOnly
|
|
|
|
|
? LocaleKeys.loginToViewAppointments.tr().toText(fontSize: 16, color: MyColors.lightTextColor)
|
|
|
|
|
: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.noAppointmentstoShow.tr().toText(fontSize: 16, color: MyColors.lightTextColor),
|
|
|
|
|
if (appointmentsVM.appointmentFiltersCounter > 0) ...[
|
|
|
|
|
8.height,
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
appointmentsVM.clearAppointmentFilters();
|
|
|
|
|
await appointmentsVM.applyFilterOnAppointmentsVMForCustomers(appointmentStatusEnum: AppointmentStatusEnum.allAppointments);
|
|
|
|
|
},
|
|
|
|
|
child: LocaleKeys.clearFilters.tr().toText(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
isBold: true,
|
|
|
|
|
color: MyColors.darkPrimaryColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: RefreshIndicator(
|
|
|
|
|
onRefresh: () async {
|
|
|
|
|
int index = appointmentsVM.appointmentsFilterOptions.indexWhere((element) => element.isSelected);
|
|
|
|
|
if (index != -1) {
|
|
|
|
|
AppointmentStatusEnum appointmentStatusEnum = appointmentsVM.appointmentsFilterOptions[index].id.toAppointmentStatusEnum();
|
|
|
|
|
appointmentsVM.applyFilterOnAppointmentsVMForCustomers(appointmentStatusEnum: appointmentStatusEnum);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: appointmentsVM.state == ViewState.busy
|
|
|
|
|
? const Center(child: CircularProgressIndicator())
|
|
|
|
|
: appointmentsVM.myFilteredAppointmentsForCustomers.isEmpty
|
|
|
|
|
? AppState().getIsViewOnly
|
|
|
|
|
? LocaleKeys.loginToViewAppointments.tr().toText(fontSize: 16, color: MyColors.lightTextColor)
|
|
|
|
|
: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.noAppointmentstoShow.tr().toText(fontSize: 16, color: MyColors.lightTextColor),
|
|
|
|
|
if (appointmentsVM.appointmentFiltersCounter > 0) ...[
|
|
|
|
|
8.height,
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
appointmentsVM.clearAppointmentFilters();
|
|
|
|
|
await appointmentsVM.applyFilterOnAppointmentsVMForCustomers(appointmentStatusEnum: AppointmentStatusEnum.allAppointments);
|
|
|
|
|
},
|
|
|
|
|
child: LocaleKeys.clearFilters.tr().toText(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
isBold: true,
|
|
|
|
|
color: MyColors.darkPrimaryColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: ListView.separated(
|
|
|
|
|
separatorBuilder: (context, index) => 12.height,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: appointmentsVM.myFilteredAppointmentsForCustomers.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return AppointmentFragmentTileWidget(
|
|
|
|
|
onTapped: () {
|
|
|
|
|
AppointmentListModel appointmentModel = appointmentsVM.myFilteredAppointmentsForCustomers[index];
|
|
|
|
|
appointmentModel.appointmentServicesList!.forEach((service) {
|
|
|
|
|
double totalServicePrice = 0.0;
|
|
|
|
|
service.serviceItems!.forEach((item) {
|
|
|
|
|
totalServicePrice = totalServicePrice + (double.parse("${item.price ?? 0.0}"));
|
|
|
|
|
)
|
|
|
|
|
: ListView.separated(
|
|
|
|
|
separatorBuilder: (context, index) => 12.height,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: appointmentsVM.myFilteredAppointmentsForCustomers.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return AppointmentFragmentTileWidget(
|
|
|
|
|
onTapped: () {
|
|
|
|
|
AppointmentListModel appointmentModel = appointmentsVM.myFilteredAppointmentsForCustomers[index];
|
|
|
|
|
appointmentModel.appointmentServicesList!.forEach((service) {
|
|
|
|
|
double totalServicePrice = 0.0;
|
|
|
|
|
service.serviceItems!.forEach((item) {
|
|
|
|
|
totalServicePrice = totalServicePrice + (double.parse("${item.price ?? 0.0}"));
|
|
|
|
|
});
|
|
|
|
|
service.currentTotalServicePrice = totalServicePrice;
|
|
|
|
|
});
|
|
|
|
|
service.currentTotalServicePrice = totalServicePrice;
|
|
|
|
|
});
|
|
|
|
|
navigateWithName(context, AppRoutes.appointmentDetailView, arguments: appointmentModel);
|
|
|
|
|
},
|
|
|
|
|
appointmentListModel: appointmentsVM.myFilteredAppointmentsForCustomers[index],
|
|
|
|
|
).margin(left: 21, right: 21);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
).toViewOnly(context, onTap: () {
|
|
|
|
|
navigateWithName(context, AppRoutes.loginWithPassword, arguments: false);
|
|
|
|
|
}),
|
|
|
|
|
navigateWithName(context, AppRoutes.appointmentDetailView, arguments: appointmentModel);
|
|
|
|
|
},
|
|
|
|
|
appointmentListModel: appointmentsVM.myFilteredAppointmentsForCustomers[index],
|
|
|
|
|
).margin(left: 21, right: 21).toViewOnly(context, onTap: () {
|
|
|
|
|
navigateWithName(context, AppRoutes.loginWithPassword, arguments: false);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|