|
|
|
|
@ -10,6 +10,7 @@ import 'package:mc_common_app/models/general_models/generic_resp_model.dart';
|
|
|
|
|
import 'package:mc_common_app/theme/colors.dart';
|
|
|
|
|
import 'package:mc_common_app/utils/date_helper.dart';
|
|
|
|
|
import 'package:mc_common_app/utils/dialogs_and_bottomsheets.dart';
|
|
|
|
|
import 'package:mc_common_app/utils/enums.dart';
|
|
|
|
|
import 'package:mc_common_app/utils/navigator.dart';
|
|
|
|
|
import 'package:mc_common_app/utils/utils.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
|
|
|
|
|
@ -52,7 +53,7 @@ class _SchedulesListPageState extends State<SchedulesListPage> {
|
|
|
|
|
GenericRespModel res = await serviceVM.setScheduleInactive(serviceVM.schedule!.data![index].id!, serviceVM.schedule!.data![index].serviceProviderBranchId!);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
if (res.messageStatus == 1) {
|
|
|
|
|
Utils.showToast(LocaleKeys.branch_deleted.tr());
|
|
|
|
|
Utils.showToast(LocaleKeys.scheduleDeletedSuccessfully.tr());
|
|
|
|
|
} else {
|
|
|
|
|
Utils.showToast(res.message ?? "");
|
|
|
|
|
}
|
|
|
|
|
@ -94,62 +95,67 @@ class _SchedulesListPageState extends State<SchedulesListPage> {
|
|
|
|
|
? EmptyWidget(
|
|
|
|
|
text: LocaleKeys.noSchedulesFound.tr(),
|
|
|
|
|
).paddingAll(21)
|
|
|
|
|
: ListView.separated(
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(child: scheduleVM.schedule!.data![index].scheduleName.toString().toText(fontSize: 16)),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(4.0),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
MyAssets.icEdit,
|
|
|
|
|
width: 18,
|
|
|
|
|
height: 18,
|
|
|
|
|
),
|
|
|
|
|
).onPress(() {
|
|
|
|
|
scheduleVM.schedule!.data![index].branchId = widget.branchId ?? "";
|
|
|
|
|
navigateWithName(context, AppRoutes.addSchedule, arguments: scheduleVM.schedule!.data![index]);
|
|
|
|
|
}),
|
|
|
|
|
MyAssets.closeWithOrangeBg
|
|
|
|
|
.buildSvg(height: 28, width: 28)
|
|
|
|
|
.onPress(() => deleteScheduleConfirmationSheet(index, scheduleVM, context))
|
|
|
|
|
.paddingOnly(top: 3, left: 4),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
showItem("${LocaleKeys.startDate.tr()}:", DateHelper.formatAsDayMonthYear(scheduleVM.schedule!.data![index].fromDate)),
|
|
|
|
|
showItem("${LocaleKeys.endDate.tr()}:", DateHelper.formatAsDayMonthYear(scheduleVM.schedule!.data![index].toDate)),
|
|
|
|
|
showItem("${LocaleKeys.shiftStartTime.tr()}:", scheduleVM.schedule!.data![index].startTime ?? ""),
|
|
|
|
|
showItem("${LocaleKeys.shiftEndTime.tr()}:", scheduleVM.schedule!.data![index].endTime ?? ""),
|
|
|
|
|
showItem("${LocaleKeys.slotsTime.tr()}:", "${scheduleVM.schedule!.data![index].slotDurationMinute} Mins"),
|
|
|
|
|
showItem("${LocaleKeys.appointmentPerSlot.tr()}:", scheduleVM.schedule!.data![index].perSlotAppointment.toString()),
|
|
|
|
|
showItem(
|
|
|
|
|
LocaleKeys.serviceLocation.tr(), scheduleVM.schedule!.data![index].appointmentType == 1 ? LocaleKeys.companyLocation.tr() : LocaleKeys.customerLocation.tr()),
|
|
|
|
|
showItem("${LocaleKeys.offDays.tr()}:", offDays(scheduleVM.schedule!.data![index])),
|
|
|
|
|
12.height,
|
|
|
|
|
"${LocaleKeys.services.tr()}:".toText(fontSize: 12, color: MyColors.lightTextColor),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: scheduleVM.schedule!.data![index].scheduleServices!
|
|
|
|
|
.map(
|
|
|
|
|
(element) => Container(
|
|
|
|
|
child: element.serviceDescription.toString().toText(fontSize: 12),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
.toList(),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).toWhiteContainer(width: double.infinity, allPading: 12);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (BuildContext context, int index) {
|
|
|
|
|
return 12.height;
|
|
|
|
|
: RefreshIndicator(
|
|
|
|
|
onRefresh: () async {
|
|
|
|
|
await scheduleVM.getSchedules(widget.branchId ?? "");
|
|
|
|
|
},
|
|
|
|
|
padding: const EdgeInsets.all(20),
|
|
|
|
|
itemCount: scheduleVM.schedule!.data!.length,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(child: scheduleVM.schedule!.data![index].scheduleName.toString().toText(fontSize: 16)),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(4.0),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
MyAssets.icEdit,
|
|
|
|
|
width: 18,
|
|
|
|
|
height: 18,
|
|
|
|
|
),
|
|
|
|
|
).onPress(() {
|
|
|
|
|
scheduleVM.schedule!.data![index].branchId = widget.branchId ?? "";
|
|
|
|
|
navigateWithName(context, AppRoutes.addSchedule, arguments: scheduleVM.schedule!.data![index]);
|
|
|
|
|
}),
|
|
|
|
|
MyAssets.closeWithOrangeBg
|
|
|
|
|
.buildSvg(height: 28, width: 28)
|
|
|
|
|
.onPress(() => deleteScheduleConfirmationSheet(index, scheduleVM, context))
|
|
|
|
|
.paddingOnly(top: 3, left: 4),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
showItem("${LocaleKeys.startDate.tr()}:", DateHelper.formatAsDayMonthYear(scheduleVM.schedule!.data![index].fromDate)),
|
|
|
|
|
showItem("${LocaleKeys.endDate.tr()}:", DateHelper.formatAsDayMonthYear(scheduleVM.schedule!.data![index].toDate)),
|
|
|
|
|
showItem("${LocaleKeys.shiftStartTime.tr()}:", scheduleVM.schedule!.data![index].startTime ?? ""),
|
|
|
|
|
showItem("${LocaleKeys.shiftEndTime.tr()}:", scheduleVM.schedule!.data![index].endTime ?? ""),
|
|
|
|
|
showItem("${LocaleKeys.slotsTime.tr()}:", "${scheduleVM.schedule!.data![index].slotDurationMinute} Mins"),
|
|
|
|
|
showItem("${LocaleKeys.appointmentPerSlot.tr()}:", scheduleVM.schedule!.data![index].perSlotAppointment.toString()),
|
|
|
|
|
showItem(
|
|
|
|
|
LocaleKeys.serviceLocation.tr(), scheduleVM.schedule!.data![index].appointmentType == 1 ? LocaleKeys.companyLocation.tr() : LocaleKeys.customerLocation.tr()),
|
|
|
|
|
showItem("${LocaleKeys.offDays.tr()}:", offDays(scheduleVM.schedule!.data![index])),
|
|
|
|
|
12.height,
|
|
|
|
|
"${LocaleKeys.services.tr()}:".toText(fontSize: 12, color: MyColors.lightTextColor),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: scheduleVM.schedule!.data![index].scheduleServices!
|
|
|
|
|
.map(
|
|
|
|
|
(element) => Container(
|
|
|
|
|
child: element.serviceDescription.toString().toText(fontSize: 12),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
.toList(),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).toWhiteContainer(width: double.infinity, allPading: 12);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (BuildContext context, int index) {
|
|
|
|
|
return 12.height;
|
|
|
|
|
},
|
|
|
|
|
padding: const EdgeInsets.all(20),
|
|
|
|
|
itemCount: scheduleVM.schedule!.data!.length,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
@ -161,7 +167,7 @@ class _SchedulesListPageState extends State<SchedulesListPage> {
|
|
|
|
|
onPressed: () {
|
|
|
|
|
navigateWithName(context, AppRoutes.addSchedule, arguments: ScheduleData(branchId: widget.branchId ?? ""));
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|