Fixing JIRA Issues

aamir_dev
Faiz Hashmi 1 year ago
parent 4c37d0835f
commit 36351fc920

@ -23,6 +23,7 @@ import 'package:flutter/material.dart';
import 'package:mc_common_app/models/appointments_models/appointment_list_model.dart'; import 'package:mc_common_app/models/appointments_models/appointment_list_model.dart';
import 'package:mc_common_app/models/provider_branches_models/branch_detail_model.dart'; import 'package:mc_common_app/models/provider_branches_models/branch_detail_model.dart';
import 'package:mc_common_app/utils/enums.dart'; import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/views/setting_options/provider_accepted_requests_view.dart';
class ProviderAppRoutes { class ProviderAppRoutes {
static final Map<String, WidgetBuilder> routes = { static final Map<String, WidgetBuilder> routes = {
@ -61,5 +62,8 @@ class ProviderAppRoutes {
//Branch Duplication //Branch Duplication
AppRoutes.matchServices: (context) => MatchedServicesPage((ModalRoute.of(context)!.settings.arguments) == null ? null : (ModalRoute.of(context)!.settings.arguments as MatchServicesArguments)), AppRoutes.matchServices: (context) => MatchedServicesPage((ModalRoute.of(context)!.settings.arguments) == null ? null : (ModalRoute.of(context)!.settings.arguments as MatchServicesArguments)),
//Requests
AppRoutes.providerAcceptedRequestsView: (context) => const ProviderAcceptedRequestsView(),
}; };
} }

@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'package:car_provider_app/config/provider_dependencies.dart'; import 'package:car_provider_app/config/provider_dependencies.dart';
import 'package:flutter/services.dart';
import 'package:mc_common_app/repositories/items_repo.dart'; import 'package:mc_common_app/repositories/items_repo.dart';
import 'package:mc_common_app/repositories/schedule_repo.dart'; import 'package:mc_common_app/repositories/schedule_repo.dart';
import 'package:car_provider_app/view_models/items_view_model.dart'; import 'package:car_provider_app/view_models/items_view_model.dart';
@ -159,14 +160,17 @@ Future<void> main() async {
// command to generate languages data from json // command to generate languages data from json
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key); const MyApp({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
return Sizer( return Sizer(
builder: (context, orientation, deviceType) { builder: (context, orientation, deviceType) {
injector.get<AppState>().setAppType(AppType.provider); injector.get<AppState>().setAppType(AppType.provider);
AppState().setPostParamsModel( AppState().setPostParamsModel(
PostParamsModel( PostParamsModel(
languageID: EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2, languageID: EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2,

@ -105,6 +105,11 @@ class ScheduleVM extends BaseVM {
return response; return response;
} }
Future<GenericRespModel> checkServiceGroupInBranchSchedule(Map map) async {
GenericRespModel response = await scheduleRepo.checkServiceGroupInBranchSchedule(map);
return response;
}
Future<GenericRespModel> addServicesInSchedule(Map map) async { Future<GenericRespModel> addServicesInSchedule(Map map) async {
GenericRespModel response = await scheduleRepo.addServicesInSchedule(map); GenericRespModel response = await scheduleRepo.addServicesInSchedule(map);
return response; return response;

@ -13,7 +13,7 @@ import 'package:provider/provider.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
class AppointmentDetailListPage extends StatelessWidget { class AppointmentDetailListPage extends StatelessWidget {
const AppointmentDetailListPage({Key? key}) : super(key: key); const AppointmentDetailListPage({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -41,7 +41,8 @@ class AppointmentDetailListPage extends StatelessWidget {
onTap: () { onTap: () {
appointmentsVM.selectedAppointmentId = appointmentsVM.myFilteredAppointments2[appointmentsVM.selectedAppointmentIndex].customerAppointmentList![index].id ?? 0; appointmentsVM.selectedAppointmentId = appointmentsVM.myFilteredAppointments2[appointmentsVM.selectedAppointmentIndex].customerAppointmentList![index].id ?? 0;
appointmentsVM.selectedAppointmentSubIndex = index; appointmentsVM.selectedAppointmentSubIndex = index;
navigateWithName(context, AppRoutes.updateAppointmentPage, arguments: appointmentsVM.myFilteredAppointments2[appointmentsVM.selectedAppointmentIndex].customerAppointmentList![index]); navigateWithName(context, AppRoutes.updateAppointmentPage,
arguments: appointmentsVM.myFilteredAppointments2[appointmentsVM.selectedAppointmentIndex].customerAppointmentList![index]);
}, },
); );
}, },

@ -104,10 +104,12 @@ class _AppointmentPageState extends State<AppointmentPage> {
EmptyWidget( EmptyWidget(
spacerWidget: const SizedBox(height: 25), spacerWidget: const SizedBox(height: 25),
text: LocaleKeys.noAppointmentFound.tr(), text: LocaleKeys.noAppointmentFound.tr(),
), )
else ...[
ListView.separated( ListView.separated(
itemBuilder: (context, index) { itemBuilder: (context, index) {
return GeneralAppointmentWidget( return GeneralAppointmentWidget(
isNeedToShowItems: true,
appointmentListModel: appointmentsVM.myFilteredAppointments2[index], appointmentListModel: appointmentsVM.myFilteredAppointments2[index],
isNeedTotalPayment: false, isNeedTotalPayment: false,
onTap: () { onTap: () {
@ -131,6 +133,7 @@ class _AppointmentPageState extends State<AppointmentPage> {
padding: const EdgeInsets.all(21), padding: const EdgeInsets.all(21),
), ),
], ],
],
), ),
), ),
); );

@ -22,10 +22,15 @@ import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
class UpdateAppointmentPage extends StatelessWidget { class UpdateAppointmentPage extends StatefulWidget {
late AppointmentListModel appointmentListModel; const UpdateAppointmentPage({super.key});
UpdateAppointmentPage({Key? key}) : super(key: key); @override
State<UpdateAppointmentPage> createState() => _UpdateAppointmentPageState();
}
class _UpdateAppointmentPageState extends State<UpdateAppointmentPage> {
late AppointmentListModel appointmentListModel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -39,7 +44,9 @@ class UpdateAppointmentPage extends StatelessWidget {
if (appointmentsVM.state == ViewState.busy) { if (appointmentsVM.state == ViewState.busy) {
return const Center(child: CircularProgressIndicator()); return const Center(child: CircularProgressIndicator());
} else { } else {
return Column( return RefreshIndicator(
onRefresh: () async => _updateAppointment(context, appointmentListModel.branchId ?? 0),
child: Column(
children: [ children: [
Expanded( Expanded(
child: ListView( child: ListView(
@ -86,7 +93,8 @@ class UpdateAppointmentPage extends StatelessWidget {
).paddingAll(21), ).paddingAll(21),
if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.confirmed && if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.confirmed &&
(appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.payPartial || appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.defaultStatus)) (appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.payPartial ||
appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.defaultStatus))
Column( Column(
children: [ children: [
showArrivedButton(context, appointmentsVM), showArrivedButton(context, appointmentsVM),
@ -94,7 +102,8 @@ class UpdateAppointmentPage extends StatelessWidget {
).paddingAll(21), ).paddingAll(21),
if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.arrived && if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.arrived &&
(appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.payPartial || appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.defaultStatus)) (appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.payPartial ||
appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.defaultStatus))
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@ -109,7 +118,8 @@ class UpdateAppointmentPage extends StatelessWidget {
Utils.buildStatusContainer(LocaleKeys.waitingPaymentfromtheCustomer.tr()).paddingAll(10), Utils.buildStatusContainer(LocaleKeys.waitingPaymentfromtheCustomer.tr()).paddingAll(10),
if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.arrived && if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.arrived &&
(appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.paid || appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.payLater)) (appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.paid ||
appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.payLater))
Column( Column(
children: [ children: [
showWorkStartButton(context, appointmentsVM), showWorkStartButton(context, appointmentsVM),
@ -177,6 +187,7 @@ class UpdateAppointmentPage extends StatelessWidget {
// ), // ),
// ), // ),
], ],
),
); );
} }
})), })),
@ -189,9 +200,14 @@ class UpdateAppointmentPage extends StatelessWidget {
maxWidth: double.infinity, maxWidth: double.infinity,
onPressed: () async { onPressed: () async {
Utils.showLoading(context); Utils.showLoading(context);
await appointmentsVM.updateAppointmentStatus(appointmentId: appointmentListModel.id!, appointmentStatusEnum: AppointmentStatusEnum.workStarted); bool status = await appointmentsVM.updateAppointmentStatus(appointmentId: appointmentListModel.id!, appointmentStatusEnum: AppointmentStatusEnum.workStarted);
if (status) {
_updateAppointment(context, appointmentListModel.branchId ?? 0);
}
Utils.hideLoading(context); Utils.hideLoading(context);
pop(context); // pop(context);
// showMyBottomSheet( // showMyBottomSheet(
// context, // context,
@ -210,8 +226,10 @@ class UpdateAppointmentPage extends StatelessWidget {
maxWidth: double.infinity, maxWidth: double.infinity,
onPressed: () async { onPressed: () async {
Utils.showLoading(context); Utils.showLoading(context);
await appointmentsVM.updateAppointmentPaymentStatus({"appointmentID": appointmentListModel.id.toString(), "appointmentServicePaymentStatusID": 2}); bool status = await appointmentsVM.updateAppointmentPaymentStatus({"appointmentID": appointmentListModel.id.toString(), "appointmentServicePaymentStatusID": 2});
if (status) {
_updateAppointment(context, appointmentListModel.branchId ?? 0); _updateAppointment(context, appointmentListModel.branchId ?? 0);
}
Utils.hideLoading(context); Utils.hideLoading(context);
pop(context); pop(context);
}, },
@ -224,8 +242,10 @@ class UpdateAppointmentPage extends StatelessWidget {
maxWidth: double.infinity, maxWidth: double.infinity,
onPressed: () async { onPressed: () async {
Utils.showLoading(context); Utils.showLoading(context);
await appointmentsVM.updateAppointmentStatus(appointmentId: appointmentListModel.id!, appointmentStatusEnum: AppointmentStatusEnum.arrived); bool status = await appointmentsVM.updateAppointmentStatus(appointmentId: appointmentListModel.id!, appointmentStatusEnum: AppointmentStatusEnum.arrived);
if (status) {
_updateAppointment(context, appointmentListModel.branchId ?? 0); _updateAppointment(context, appointmentListModel.branchId ?? 0);
}
Utils.hideLoading(context); Utils.hideLoading(context);
pop(context); pop(context);
}, },

@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:developer';
import 'package:car_provider_app/view_models/schedule_view_model.dart'; import 'package:car_provider_app/view_models/schedule_view_model.dart';
import 'package:car_provider_app/views/branch_management/schedule/widgets/chips_picker_item.dart'; import 'package:car_provider_app/views/branch_management/schedule/widgets/chips_picker_item.dart';
import 'package:car_provider_app/views/branch_management/schedule/widgets/select_days_sheet.dart'; import 'package:car_provider_app/views/branch_management/schedule/widgets/select_days_sheet.dart';
@ -35,6 +36,8 @@ class _AddSchedulesPageState extends State<AddSchedulesPage> {
late ScheduleData scheduleData; late ScheduleData scheduleData;
int? scheduleID;
setEditData() { setEditData() {
name = scheduleData.scheduleName ?? ""; name = scheduleData.scheduleName ?? "";
startDate = DateHelper.formatAsYearMonthDay(scheduleData.fromDate ?? DateTime.now()); startDate = DateHelper.formatAsYearMonthDay(scheduleData.fromDate ?? DateTime.now());
@ -107,7 +110,9 @@ class _AddSchedulesPageState extends State<AddSchedulesPage> {
schedulevm.selectedServicesItems = []; schedulevm.selectedServicesItems = [];
schedulevm.selectedDaysItems = []; schedulevm.selectedDaysItems = [];
if (scheduleData.id != null) { if (scheduleData.id != null) {
scheduleID = scheduleData.id;
setEditData(); setEditData();
setState(() {});
} }
}); });
} }
@ -115,7 +120,7 @@ class _AddSchedulesPageState extends State<AddSchedulesPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: CustomAppBar(title: LocaleKeys.createGroupServices.tr()), appBar: CustomAppBar(title: scheduleID == null ? LocaleKeys.createGroupServices.tr() : LocaleKeys.updateGroupServices.tr()),
body: SizedBox( body: SizedBox(
width: double.infinity, width: double.infinity,
child: Consumer<ScheduleVM>( child: Consumer<ScheduleVM>(
@ -298,7 +303,7 @@ class _AddSchedulesPageState extends State<AddSchedulesPage> {
), ),
), ),
ShowFillButton( ShowFillButton(
title: LocaleKeys.create.tr(), title: scheduleID == null ? LocaleKeys.create.tr() : LocaleKeys.update.tr(),
maxWidth: double.infinity, maxWidth: double.infinity,
margin: const EdgeInsets.all(20), margin: const EdgeInsets.all(20),
onPressed: () { onPressed: () {
@ -353,12 +358,33 @@ class _AddSchedulesPageState extends State<AddSchedulesPage> {
} }
createSchedule(BuildContext context, ScheduleVM scheduleVM) async { createSchedule(BuildContext context, ScheduleVM scheduleVM) async {
Utils.showLoading(context);
try {
List<int> services = [];
for (var element in scheduleVM.selectedServicesItems) {
services.add(element.id);
}
var map1 = {
"serviceProviderServiceID": services,
"appointmentType": selectedScheduleLocationDrop.id,
};
GenericRespModel respModel = await scheduleVM.checkServiceGroupInBranchSchedule(map1);
Utils.hideLoading(context);
log("respModel: ${respModel.data}");
if (respModel.messageStatus == 2) {
Utils.showToast(respModel.message ?? "");
return;
}
List<int> days = []; List<int> days = [];
for (var element in scheduleVM.selectedDaysItems) { for (var element in scheduleVM.selectedDaysItems) {
days.add(element.id); days.add(element.id);
} }
//TODO: needs to verify with Zahoor about appointment type while creating Schedule
var map = { var map = {
"scheduleName": name, "scheduleName": name,
"serviceProviderBranchID": scheduleData.branchId, "serviceProviderBranchID": scheduleData.branchId,
@ -377,10 +403,6 @@ class _AddSchedulesPageState extends State<AddSchedulesPage> {
GenericRespModel scheduleResponse = await scheduleVM.createSchedule(map); GenericRespModel scheduleResponse = await scheduleVM.createSchedule(map);
if (scheduleResponse.messageStatus == 1) { if (scheduleResponse.messageStatus == 1) {
List<int> services = [];
for (var element in scheduleVM.selectedServicesItems) {
services.add(element.id);
}
var map1 = { var map1 = {
"branchAppointmentScheduleID": scheduleResponse.data, "branchAppointmentScheduleID": scheduleResponse.data,
"serviceProviderServiceID": services, "serviceProviderServiceID": services,
@ -402,11 +424,16 @@ class _AddSchedulesPageState extends State<AddSchedulesPage> {
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.showToast(scheduleResponse.message ?? ""); Utils.showToast(scheduleResponse.message ?? "");
} }
} catch (e) {
Utils.showToast(e.toString());
Utils.hideLoading(context);
}
} }
updateSchedule(BuildContext context, ScheduleVM model) async { updateSchedule(BuildContext context, ScheduleVM scheduleVM) async {
try {
List<int> days = []; List<int> days = [];
for (var element in model.selectedDaysItems) { for (var element in scheduleVM.selectedDaysItems) {
days.add(element.id); days.add(element.id);
} }
var map = { var map = {
@ -425,19 +452,20 @@ class _AddSchedulesPageState extends State<AddSchedulesPage> {
}; };
Utils.showLoading(context); Utils.showLoading(context);
GenericRespModel scheduleResponse = await model.updateSchedule(map); GenericRespModel scheduleResponse = await scheduleVM.updateSchedule(map);
if (scheduleResponse.messageStatus == 1) { if (scheduleResponse.messageStatus == 1) {
List<int> services = []; List<int> services = [];
for (var element in model.selectedServicesItems) { for (var element in scheduleVM.selectedServicesItems) {
services.add(element.id); services.add(element.id);
} }
var map1 = { var map1 = {
"branchAppointmentScheduleID": scheduleData.id, "branchAppointmentScheduleID": scheduleData.id,
"serviceProviderServiceID": services, "serviceProviderServiceID": services,
"serviceGroupDescription": "string", "serviceGroupDescription": "string",
}; };
GenericRespModel servicesResponse = await model.updateServicesInSchedule(map1); GenericRespModel servicesResponse = await scheduleVM.updateServicesInSchedule(map1);
Utils.hideLoading(context); Utils.hideLoading(context);
if (servicesResponse.messageStatus == 1) { if (servicesResponse.messageStatus == 1) {
Utils.showToast(servicesResponse.message ?? "Schedule Successfully Updated"); Utils.showToast(servicesResponse.message ?? "Schedule Successfully Updated");
@ -450,5 +478,9 @@ class _AddSchedulesPageState extends State<AddSchedulesPage> {
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.showToast(scheduleResponse.message ?? LocaleKeys.somethingWrong.tr()); Utils.showToast(scheduleResponse.message ?? LocaleKeys.somethingWrong.tr());
} }
} catch (e) {
Utils.showToast(e.toString());
Utils.hideLoading(context);
}
} }
} }

@ -103,24 +103,21 @@ class _SchedulesListPageState extends State<SchedulesListPage> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded(child: scheduleVM.schedule!.data![index].scheduleName.toString().toText(fontSize: 16)), Expanded(child: scheduleVM.schedule!.data![index].scheduleName.toString().toText(fontSize: 16)),
IconButton(
onPressed: () async {
return deleteScheduleConfirmationSheet(index, scheduleVM, context);
},
icon: const Icon(Icons.delete_outline),
color: Colors.red,
),
Padding( Padding(
padding: const EdgeInsets.all(4.0), padding: const EdgeInsets.all(4.0),
child: SvgPicture.asset( child: SvgPicture.asset(
MyAssets.icEdit, MyAssets.icEdit,
width: 16, width: 18,
height: 16, height: 18,
), ),
).onPress(() { ).onPress(() {
scheduleVM.schedule!.data![index].branchId = widget.branchId ?? ""; scheduleVM.schedule!.data![index].branchId = widget.branchId ?? "";
navigateWithName(context, AppRoutes.addSchedule, arguments: scheduleVM.schedule!.data![index]); 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, 8.height,
@ -130,7 +127,8 @@ class _SchedulesListPageState extends State<SchedulesListPage> {
showItem("${LocaleKeys.shiftEndTime.tr()}:", scheduleVM.schedule!.data![index].endTime ?? ""), showItem("${LocaleKeys.shiftEndTime.tr()}:", scheduleVM.schedule!.data![index].endTime ?? ""),
showItem("${LocaleKeys.slotsTime.tr()}:", "${scheduleVM.schedule!.data![index].slotDurationMinute} Mins"), showItem("${LocaleKeys.slotsTime.tr()}:", "${scheduleVM.schedule!.data![index].slotDurationMinute} Mins"),
showItem("${LocaleKeys.appointmentPerSlot.tr()}:", scheduleVM.schedule!.data![index].perSlotAppointment.toString()), 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.serviceLocation.tr(), scheduleVM.schedule!.data![index].appointmentType == 1 ? LocaleKeys.companyLocation.tr() : LocaleKeys.customerLocation.tr()),
showItem("${LocaleKeys.offDays.tr()}:", offDays(scheduleVM.schedule!.data![index])), showItem("${LocaleKeys.offDays.tr()}:", offDays(scheduleVM.schedule!.data![index])),
12.height, 12.height,
"${LocaleKeys.services.tr()}:".toText(fontSize: 12, color: MyColors.lightTextColor), "${LocaleKeys.services.tr()}:".toText(fontSize: 12, color: MyColors.lightTextColor),

@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:developer';
import 'dart:io'; import 'dart:io';
import 'package:car_provider_app/view_models/items_view_model.dart'; import 'package:car_provider_app/view_models/items_view_model.dart';
@ -196,7 +197,12 @@ class _CreateItemPageState extends State<CreateItemPage> {
maxWidth: double.infinity, maxWidth: double.infinity,
onPressed: () async { onPressed: () async {
if (validation()) { if (validation()) {
var attachedFile = Utils.convertFileToBase64(file!); var attachedFile = "";
if (file != null) {
attachedFile = Utils.convertFileToBase64(file!);
} else {
attachedFile = pickedImage.first.filePath ?? "";
}
if (!(itemData?.isUpdateOrSelected ?? false)) { if (!(itemData?.isUpdateOrSelected ?? false)) {
Map map = { Map map = {
"name": name, "name": name,
@ -220,6 +226,7 @@ class _CreateItemPageState extends State<CreateItemPage> {
} }
Utils.showToast(mResponse.message ?? ""); Utils.showToast(mResponse.message ?? "");
} else { } else {
log("attachedIMag: $attachedFile");
Map map = { Map map = {
"id": itemData!.id, "id": itemData!.id,
"name": name, "name": name,
@ -255,7 +262,7 @@ class _CreateItemPageState extends State<CreateItemPage> {
bool validation() { bool validation() {
bool valid = true; bool valid = true;
if (file == null) { if (pickedImage.isEmpty && file == null) {
Utils.showToast("Please add al least one item image."); Utils.showToast("Please add al least one item image.");
valid = false; valid = false;
} }
@ -268,9 +275,6 @@ class _CreateItemPageState extends State<CreateItemPage> {
} else if (price == null) { } else if (price == null) {
Utils.showToast("Please add valid item price"); Utils.showToast("Please add valid item price");
valid = false; valid = false;
} else if (year == null) {
Utils.showToast("Please add valid year");
valid = false;
} }
return valid; return valid;
} }

@ -29,8 +29,8 @@ class GeneralAppointmentWidget extends StatelessWidget {
this.isSelectable = false, this.isSelectable = false,
this.isNeedToShowAppointmentStatus = false, this.isNeedToShowAppointmentStatus = false,
this.isNeedToShowMergeStatus = false, this.isNeedToShowMergeStatus = false,
Key? key, super.key,
}) : super(key: key); });
List<Widget> buildServicesFromAppointment({required AppointmentListModel appointmentListModel}) { List<Widget> buildServicesFromAppointment({required AppointmentListModel appointmentListModel}) {
if (appointmentListModel.appointmentServicesList == null || appointmentListModel.appointmentServicesList!.isEmpty) { if (appointmentListModel.appointmentServicesList == null || appointmentListModel.appointmentServicesList!.isEmpty) {
@ -51,7 +51,7 @@ class GeneralAppointmentWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
showServices( showServices(
appointmentListModel.appointmentServicesList!.first.providerServiceDescription, "${appointmentListModel.appointmentServicesList!.first.providerServiceDescription} - ${appointmentListModel.appointmentServicesList!.first.serviceId}",
MyAssets.modificationsIcon, MyAssets.modificationsIcon,
), ),
if (isNeedToShowItems) ...itemsList, if (isNeedToShowItems) ...itemsList,
@ -67,28 +67,24 @@ class GeneralAppointmentWidget extends StatelessWidget {
if (isNeedToShowItems) { if (isNeedToShowItems) {
itemsList = List.generate( itemsList = List.generate(
appointmentListModel.appointmentServicesList?[index].serviceItems?.length ?? 0, appointmentListModel.appointmentServicesList?[index].serviceItems?.length ?? 0,
// (mIndex) => (" - ${appointmentListModel.appointmentServicesList?[index].serviceItems?[mIndex].name ?? ""}").toString().toText(
// color: MyColors.lightTextColor,
// ),
(mIndex) => showItems((appointmentListModel.appointmentServicesList?[index].serviceItems?[mIndex].name ?? "").toString(), MyAssets.modificationsIcon), (mIndex) => showItems((appointmentListModel.appointmentServicesList?[index].serviceItems?[mIndex].name ?? "").toString(), MyAssets.modificationsIcon),
); );
} }
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
showServices(appointmentListModel.appointmentServicesList![index].providerServiceDescription, MyAssets.modificationsIcon), showServices(
"${appointmentListModel.appointmentServicesList![index].providerServiceDescription} - ${appointmentListModel.appointmentServicesList![index].serviceId}", MyAssets.modificationsIcon),
if (isNeedToShowItems) ...itemsList, if (isNeedToShowItems) ...itemsList,
], ],
).paddingOnly(bottom: 6); ).paddingOnly(bottom: 6);
}, },
); );
if (isNeedToShowToMoreText && appointmentListModel.appointmentServicesList!.length > 1) { if (isNeedToShowToMoreText && appointmentListModel.appointmentServicesList!.length > 2) {
servicesList.add( servicesList.add(
showServices( showServices(
"+ ${appointmentListModel.appointmentServicesList!.length - 1} More", "+ ${appointmentListModel.appointmentServicesList!.length - 2} More",
"", "",
isMoreText: true, isMoreText: true,
), ),
@ -128,7 +124,7 @@ class GeneralAppointmentWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (isNeedToShowMergeStatus) if (isNeedToShowMergeStatus)
"${LocaleKeys.merged.tr()}".toText(color: MyColors.white).toContainer( LocaleKeys.merged.tr().toText(color: MyColors.white).toContainer(
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 3), padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 3),
borderRadius: 12, borderRadius: 12,
backgroundColor: MyColors.greenColor, backgroundColor: MyColors.greenColor,
@ -183,13 +179,20 @@ class GeneralAppointmentWidget extends StatelessWidget {
), ),
Row( Row(
children: [ children: [
"${LocaleKeys.location.tr()}: ".toText(color: MyColors.lightTextColor), "${LocaleKeys.serviceDeliveryType.tr()}: ".toText(color: MyColors.lightTextColor),
2.width, 2.width,
(appointmentListModel.appointmentTypeEnum == AppointmentTypeEnum.home ? LocaleKeys.home.tr() : LocaleKeys.workshop.tr()).toText( (appointmentListModel.appointmentTypeEnum == AppointmentTypeEnum.home ? LocaleKeys.home.tr() : LocaleKeys.workshop.tr()).toText(
fontSize: 12, fontSize: 12,
), ),
], ],
), ),
Row(
children: [
"${LocaleKeys.createdOn.tr()}: ".toText(color: MyColors.lightTextColor),
2.width,
Flexible(child: appointmentListModel.appointmentDate!.toFormattedDateWithoutTime().toText(fontSize: 8))
],
),
], ],
), ),
), ),

Loading…
Cancel
Save