fixed Things before QA

aamir_dev
Faiz Hashmi 1 year ago
parent 5ed15fa243
commit aad7b199da

@ -36,7 +36,7 @@ class DashboardVM extends BaseVM {
int selectedNavbarBarIndex = 2;
void onNavbarTapped(int index) {
void onNavbarTapped(int index) async {
logger.i(AppState().getDeviceToken);
selectedNavbarBarIndex = index;
notifyListeners();

@ -183,11 +183,14 @@ class _AddNewServiceAppointmentPageState extends State<AddNewServiceAppointmentP
isBold: true,
),
2.width,
LocaleKeys.sar.tr().toText(
LocaleKeys.sar
.tr()
.toText(
fontSize: 16,
isBold: true,
color: MyColors.lightTextColor,
),
)
.paddingOnly(bottom: 5),
],
),
],
@ -205,7 +208,12 @@ class _AddNewServiceAppointmentPageState extends State<AddNewServiceAppointmentP
isFilled: false,
txtColor: MyColors.redColor,
borderColor: MyColors.redColor,
onPressed: () {},
onPressed: () {
if (pickedItems != null && pickedItems!.isNotEmpty) {
pickedItems!.clear();
}
pop(context);
},
),
),
12.width,
@ -214,7 +222,7 @@ class _AddNewServiceAppointmentPageState extends State<AddNewServiceAppointmentP
title: LocaleKeys.add.tr(),
maxWidth: double.infinity,
onPressed: () async {
if (pickedItems != null && pickedItems!.length > 0) {
if (pickedItems != null && pickedItems!.isNotEmpty) {
List<int> items = [];
pickedItems?.forEach((element) {
items.add(element.id);

@ -140,7 +140,10 @@ class _AppointmentPageState extends State<AppointmentPage> {
}
Widget progressWidget(BuildContext context, AppointmentsVM appointmentsVM) {
double percent = appointmentsVM.appointmentSlots!.occupiedSlots / appointmentsVM.appointmentSlots!.totalSlots;
double percent = 0.0;
if (appointmentsVM.appointmentSlots != null) {
percent = appointmentsVM.appointmentSlots!.occupiedSlots / appointmentsVM.appointmentSlots!.totalSlots;
}
return Column(
children: [
Row(

@ -1,6 +1,7 @@
import 'package:car_provider_app/config/provider_routes.dart';
import 'package:car_provider_app/views/appoinments/widget/sheets.dart';
import 'package:car_provider_app/views/dashboard/widget/general_appointment_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/config/dependency_injection.dart';
@ -35,7 +36,6 @@ class UpdateAppointmentPage extends StatelessWidget {
child: Consumer(builder: (BuildContext context, AppointmentsVM appointmentsVM, Widget? child) {
appointmentListModel = appointmentsVM.myFilteredAppointments2[appointmentsVM.selectedAppointmentIndex].customerAppointmentList![appointmentsVM.selectedAppointmentSubIndex];
if (appointmentsVM.state == ViewState.busy) {
return const Center(child: CircularProgressIndicator());
} else {
print(appointmentListModel.appointmentPaymentStatusEnum);
@ -53,7 +53,9 @@ class UpdateAppointmentPage extends StatelessWidget {
onTap: () {},
),
21.height,
if (appointmentListModel.appointmentStatusEnum != AppointmentStatusEnum.confirmed) ...[
if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.confirmed ||
appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.arrived ||
appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.workStarted) ...[
ShowFillButton(
title: ("+ ${LocaleKeys.addNewService.tr()}"),
txtColor: MyColors.darkPrimaryColor,
@ -66,17 +68,20 @@ class UpdateAppointmentPage extends StatelessWidget {
);
},
),
]
],
],
),
),
if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.cancelled) "Appointment is Canceled".toText(),
if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.cancelled) ...[
Utils.buildStatusContainer("Appointment Cancelled").paddingAll(10),
],
if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.booked)
Column(
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
showPayNowButton(context, appointmentsVM),
12.height,
showCancelButton(context, appointmentsVM),
Expanded(child: showPayNowButton(context, appointmentsVM)),
12.width,
Expanded(child: showCancelButton(context, appointmentsVM)),
],
).paddingAll(21),
@ -90,20 +95,18 @@ class UpdateAppointmentPage extends StatelessWidget {
if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.arrived &&
(appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.payPartial || appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.defaultStatus))
Column(
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
showPayNowButton(context, appointmentsVM),
12.height,
showPayLaterButton(context, appointmentsVM),
Expanded(child: showPayNowButton(context, appointmentsVM)),
12.width,
Expanded(child: showPayLaterButton(context, appointmentsVM)),
],
).paddingAll(21),
if ((appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.arrived || appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.workStarted) &&
appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.payNow)
buildStatusContainer(text: LocaleKeys.waitingPaymentfromtheCustomer.tr()).paddingAll(10),
// LocaleKeys.waitingPaymentfromtheCustomer.tr().toText().paddingAll(21),
Utils.buildStatusContainer(LocaleKeys.waitingPaymentfromtheCustomer.tr()).paddingAll(10),
if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.arrived &&
(appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.paid || appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.payLater))
@ -114,11 +117,12 @@ class UpdateAppointmentPage extends StatelessWidget {
).paddingAll(21),
if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.workStarted && appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.payPartial)
Column(
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
showPayLaterButton(context, appointmentsVM),
12.height,
showPayNowButton(context, appointmentsVM),
Expanded(child: showPayNowButton(context, appointmentsVM)),
12.width,
Expanded(child: showPayLaterButton(context, appointmentsVM)),
],
).paddingAll(21),
// "Show Pay Now".toText(),
@ -133,8 +137,11 @@ class UpdateAppointmentPage extends StatelessWidget {
if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.workStarted && appointmentListModel.appointmentPaymentStatusEnum == AppointmentPaymentStatusEnum.payLater)
showPayNowButton(context, appointmentsVM).paddingAll(21),
if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.visitCompleted) LocaleKeys.appointmentisCompleted.tr().toText().paddingAll(21),
if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.visitCompleted) ...[
Utils.buildStatusContainer(LocaleKeys.appointmentisCompleted.tr()).paddingAll(10),
],
//TODO: THIS NEEDS TO BE CHECKED. IMPORTANT
// Padding(
// padding: const EdgeInsets.all(21.0),
// child: Column(
@ -182,7 +189,7 @@ class UpdateAppointmentPage extends StatelessWidget {
maxWidth: double.infinity,
onPressed: () async {
Utils.showLoading(context);
await appointmentsVM.updateAppointmentStatus({"appointmentID": appointmentListModel.id.toString(), "appointmentStatusID": 7});
await appointmentsVM.updateAppointmentStatus(appointmentId: appointmentListModel.id!, appointmentStatusEnum: AppointmentStatusEnum.workStarted);
Utils.hideLoading(context);
// showMyBottomSheet(
// context,
@ -214,7 +221,7 @@ class UpdateAppointmentPage extends StatelessWidget {
maxWidth: double.infinity,
onPressed: () async {
Utils.showLoading(context);
await appointmentsVM.updateAppointmentStatus({"appointmentID": appointmentListModel.id.toString(), "appointmentStatusID": 3});
await appointmentsVM.updateAppointmentStatus(appointmentId: appointmentListModel.id!, appointmentStatusEnum: AppointmentStatusEnum.arrived);
_updateAppointment(context, appointmentListModel.branchId ?? 0);
Utils.hideLoading(context);
},
@ -234,29 +241,13 @@ class UpdateAppointmentPage extends StatelessWidget {
);
}
Widget buildStatusContainer({required String text}) {
return Center(
child: text.toString().toText(
color: MyColors.adPendingStatusColor,
fontSize: 14,
// isItalic: true,
),
).toContainer(
marginAll: 10,
paddingAll: 10,
borderRadius: 8,
width: double.infinity,
backgroundColor: MyColors.adPendingStatusColor.withOpacity(0.16),
);
}
Widget showCompleteButton(BuildContext context, AppointmentsVM appointmentsVM) {
return ShowFillButton(
title: LocaleKeys.complete.tr(),
maxWidth: double.infinity,
onPressed: () async {
Utils.showLoading(context);
await appointmentsVM.updateAppointmentStatus({"appointmentID": appointmentListModel.id.toString(), "appointmentStatusID": 8});
await appointmentsVM.updateAppointmentStatus(appointmentId: appointmentListModel.id!, appointmentStatusEnum: AppointmentStatusEnum.visitCompleted);
_updateAppointment(context, appointmentListModel.branchId ?? 0);
Utils.hideLoading(context);
},

@ -34,25 +34,25 @@ class HomeFragment extends StatelessWidget {
leadingWidth: 100,
toolbarHeight: 59,
onTap: () => navigateWithName(context, AppRoutes.settingOptionsLanguages),
actions: [
IconButton(
onPressed: () => context.read<DashboardVM>().onRefresh(context),
icon: const b.Badge(
badgeContent: Text(
'3',
style: TextStyle(
fontSize: 10,
color: Colors.white,
),
),
badgeStyle: b.BadgeStyle(
badgeColor: MyColors.primaryColor,
padding: EdgeInsets.all(5),
),
child: Icon(Icons.notifications_active),
),
),
10.width,
actions: const [
// IconButton(
// onPressed: () {},
// icon: const b.Badge(
// badgeContent: Text(
// '3',
// style: TextStyle(
// fontSize: 10,
// color: Colors.white,
// ),
// ),
// badgeStyle: b.BadgeStyle(
// badgeColor: MyColors.primaryColor,
// padding: EdgeInsets.all(5),
// ),
// child: Icon(Icons.notifications_active),
// ),
// ),
// 10.width,
],
),
body: SizedBox(

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:car_provider_app/config/provider_routes.dart';
import 'package:car_provider_app/views/settings/branch/dealer/widget/assign_dealer_user_sheet.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/utils/utils.dart';
import 'package:mc_common_app/view_models/service_view_model.dart';
import 'package:car_provider_app/views/settings/services/services_list_page.dart';
import 'package:easy_localization/easy_localization.dart';
@ -12,7 +13,6 @@ 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/models/provider_branches_models/branch_detail_model.dart';
import 'package:mc_common_app/models/provider_branches_models/profile/categroy.dart';
import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/utils/navigator.dart';
@ -26,20 +26,20 @@ import 'package:provider/provider.dart';
class BranchDetailPage extends StatelessWidget {
final BranchDetailModel branchData;
BranchDetailPage(this.branchData, {super.key});
const BranchDetailPage(this.branchData, {super.key});
getBranchUsers(BuildContext context) {
scheduleMicrotask(() {
context.read<ServiceVM>().getAllProviderDealers(
{"ServiceProviderBranchID": branchData.id.toString(), "ServiceProviderID": AppState().getUser.data?.userInfo?.providerId.toString() ?? ""},
);
if (context.read<ServiceVM>().allProviderDealersList.isNotEmpty) {
context.read<ServiceVM>().getAllProviderDealers(
{"ServiceProviderBranchID": branchData.id.toString(), "ServiceProviderID": AppState().getUser.data?.userInfo?.providerId.toString() ?? ""},
);
}
context.read<ServiceVM>().filterUserBranchCategories();
});
}
bool validation(BuildContext context) {
bool isValid = false;
for (var element in context.read<ServiceVM>().allProviderDealersList) {
@ -69,6 +69,17 @@ class BranchDetailPage extends StatelessWidget {
);
}
Widget pendingApprovalAction({required String pendingText}) {
return Center(
child: pendingText.toText(color: MyColors.lightTextColor, fontSize: 15),
).toContainer(
paddingAll: 15,
borderRadius: 8,
width: double.infinity,
backgroundColor: MyColors.grey98Color.withOpacity(0.1),
);
}
Widget buildFooterActionWidget(BuildContext context) {
Widget actionWidget = const SizedBox();
if (AppState().userType == UserType.providerDealer && branchData.branchStatus == BranchStatusEnum.approvedOrActive) {
@ -93,23 +104,9 @@ class BranchDetailPage extends StatelessWidget {
},
);
} else if (branchData.branchStatus == BranchStatusEnum.pending) {
actionWidget = ShowFillButton(
title: "Pending Approval",
maxWidth: double.infinity,
isDisabled: true,
onPressed: () {},
);
actionWidget = pendingApprovalAction(pendingText: "Approval Pending");
} else if (branchData.branchStatus == BranchStatusEnum.deactivated) {
actionWidget = ShowFillButton(
title: "Activate Now",
maxWidth: double.infinity,
backgroundColor: MyColors.darkPrimaryColor,
borderColor: MyColors.darkPrimaryColor,
txtColor: MyColors.white,
fontSize: 15,
isFilled: true,
onPressed: () {},
);
actionWidget = pendingApprovalAction(pendingText: "Activate Now");
} else if (branchData.branchStatus == BranchStatusEnum.rejected) {
actionWidget = Column(
children: [
@ -181,9 +178,7 @@ class BranchDetailPage extends StatelessWidget {
child: ListView.builder(
itemBuilder: (context, index) {
return Container(
child: (EasyLocalization.of(context)?.currentLocale?.countryCode == "SA"
? vmodel.categories[pIndex].services![index].serviceDescriptionN.toString()
: vmodel.categories[pIndex].services![index].serviceDescription.toString())
child: (EasyLocalization.of(context)?.currentLocale?.countryCode == "SA" ? vmodel.categories[pIndex].services![index].serviceDescriptionN.toString() : vmodel.categories[pIndex].services![index].serviceDescription.toString())
.toText(
fontSize: 12,
color: MyColors.lightTextColor,
@ -289,6 +284,10 @@ class BranchDetailPage extends StatelessWidget {
)
.margin(right: 5),
).onPress(() {
if (branchData.branchStatus == BranchStatusEnum.pending || branchData.branchStatus == BranchStatusEnum.rejected) {
Utils.showToast("Please wait for the branch verification.");
return;
}
navigateWithName(context, ProviderAppRoutes.schedulesList, arguments: branchData.id.toString());
}),
Row(
@ -298,23 +297,28 @@ class BranchDetailPage extends StatelessWidget {
const Icon(
Icons.add,
color: Colors.white,
size: 18,
).toContainer(
borderRadius: 100,
paddingAll: 2,
backgroundColor: MyColors.darkIconColor,
),
8.width,
LocaleKeys.addNewService.tr().toText(fontSize: 13, color: MyColors.lightTextColor, letterSpacing: -0.52),
LocaleKeys.addNewService.tr().toText(fontSize: 15, color: MyColors.lightTextColor, letterSpacing: -0.52),
],
)
.toContainer(
borderRadius: 0,
backgroundColor: MyColors.darkWhiteColor,
width: double.infinity,
paddingAll: 20,
paddingAll: 25,
margin: const EdgeInsets.only(left: 20, right: 20, top: 20),
)
.onPress(() {
if (branchData.branchStatus == BranchStatusEnum.pending || branchData.branchStatus == BranchStatusEnum.rejected) {
Utils.showToast("Please wait for the branch verification.");
return;
}
navigateWithName(
context,
ProviderAppRoutes.createServices3,

@ -175,49 +175,6 @@ class _DefineBranchViewState extends State<DefineBranchView> {
},
),
12.height,
// InkWell(
// onTap: () {
// navigateTo(
// context,
// PickLocationPage(
// onPickAddress: (double latitude, double longitude, String address) {
// serviceVM.latitude = latitude;
// serviceVM.longitude = longitude;
// serviceVM.address = address;
// serviceVM.setState(ViewState.idle);
// },
// ),
// );
// },
// child: Container(
// width: double.infinity,
// height: 45,
// decoration: BoxDecoration(
// color: Colors.transparent,
// border: Border.all(color: MyColors.darkPrimaryColor, width: 2),
// borderRadius: const BorderRadius.all(Radius.circular(8)),
// ),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// const Icon(
// Icons.place_outlined,
// size: 18,
// color: MyColors.darkPrimaryColor,
// ),
// 8.width,
// Text(
// LocaleKeys.pickAddress.tr(),
// style: const TextStyle(
// color: MyColors.darkPrimaryColor,
// ),
// ),
// ],
// ),
// ),
// ),
// 12.height,
DottedRectContainer(
onTap: () => serviceVM.pickMultipleImages(),
text: LocaleKeys.attachImage.tr(),
@ -285,12 +242,12 @@ class _DefineBranchViewState extends State<DefineBranchView> {
await serviceVM.onUpdateBranchPressed(
context: context,
branchID: widget.branchData!.id ?? 0,
branchName: widget.branchData!.branchName ?? "",
branchDesc: widget.branchData!.branchDescription ?? "",
openTime: widget.branchData!.openTime ?? "",
closedTime: widget.branchData!.closeTime ?? "",
cityID: widget.branchData!.cityId ?? 0,
address: widget.branchData!.address ?? "",
branchName: serviceVM.branchName,
branchDesc: serviceVM.branchDescription,
openTime: serviceVM.openTime,
closedTime: serviceVM.closedTime,
cityID: serviceVM.cityId,
address: serviceVM.address,
latitude: widget.branchData!.latitude ?? "0",
longitude: widget.branchData!.longitude ?? "0",
);

@ -246,7 +246,7 @@ class _AddSchedulesPageState extends State<AddSchedulesPage> {
ShowFillButton(
title: LocaleKeys.create.tr(),
maxWidth: double.infinity,
margin: const EdgeInsets.all(20),
margin: const EdgeInsets.symmetric(horizontal: 20),
onPressed: () {
if (validation(model)) {
if (scheduleData.id != null) {
@ -333,7 +333,6 @@ class _AddSchedulesPageState extends State<AddSchedulesPage> {
"serviceGroupDescription": "string",
};
GenericRespModel servicesResponse = await model.addServicesInSchedule(map1);
Utils.hideLoading(context);
if (servicesResponse.messageStatus == 1) {

@ -5,7 +5,6 @@ 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/main.dart';
import 'package:mc_common_app/models/appointments_models/schedule_model.dart';
import 'package:mc_common_app/models/general_models/generic_resp_model.dart';
import 'package:mc_common_app/theme/colors.dart';
@ -20,9 +19,9 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:easy_localization/easy_localization.dart';
class SchedulesListPage extends StatefulWidget {
String? branchId;
final String? branchId;
SchedulesListPage(this.branchId, {Key? key}) : super(key: key);
const SchedulesListPage(this.branchId, {Key? key}) : super(key: key);
@override
State<SchedulesListPage> createState() => _SchedulesListPageState();
@ -65,7 +64,6 @@ class _SchedulesListPageState extends State<SchedulesListPage> {
Expanded(
child: value.schedule!.data![index].scheduleName.toString().toText(
fontSize: 16,
isBold: true,
),
),
IconButton(
@ -95,26 +93,22 @@ class _SchedulesListPageState extends State<SchedulesListPage> {
}),
],
),
8.height,
showItem("${LocaleKeys.startDate.tr()}:", DateHelper.formatAsDayMonthYear(value.schedule!.data![index].fromDate)),
showItem("${LocaleKeys.endDate.tr()}:", DateHelper.formatAsDayMonthYear(value.schedule!.data![index].toDate)),
showItem("${LocaleKeys.shiftStartTime.tr()}:", value.schedule!.data![index].startTime ?? ""),
showItem("${LocaleKeys.shiftEndTime.tr()}:", value.schedule!.data![index].endTime ?? ""),
showItem("${LocaleKeys.slotsTime.tr()}:", "${value.schedule!.data![index].slotDurationMinute} Mins"),
showItem("${LocaleKeys.appointmentPerSlot.tr()}:", value.schedule!.data![index].perSlotAppointment.toString()),
showItem("${LocaleKeys.offDays.tr()}:", offDays(value.schedule!.data![index])),
12.height,
showItem("Start Date:", DateHelper.formatAsDayMonthYear(value.schedule!.data![index].fromDate)),
showItem("End Date:", DateHelper.formatAsDayMonthYear(value.schedule!.data![index].toDate)),
showItem("Off Days:", DateHelper.formatAsDayMonthYear(value.schedule!.data![index].fromDate)),
showItem("Shift Start Time:", value.schedule!.data![index].startTime ?? ""),
showItem("Shift End Time:", value.schedule!.data![index].endTime ?? ""),
showItem("Slots Time:", "${value.schedule!.data![index].slotDurationMinute} Mins"),
showItem("Appointments Per Slot:", value.schedule!.data![index].perSlotAppointment.toString()),
showItem("Off Days", offDays(value.schedule!.data![index])),
12.height,
"Services:".toText(fontSize: 12, isBold: true, color: MyColors.lightTextColor),
"${LocaleKeys.services.tr()}:".toText(fontSize: 12, color: MyColors.lightTextColor),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: value.schedule!.data![index].scheduleServices!
.map(
(element) => Container(
child: element.serviceDescription.toString().toText(
fontSize: 12,
isBold: true,
),
child: element.serviceDescription.toString().toText(fontSize: 12),
),
)
.toList(),
@ -132,7 +126,7 @@ class _SchedulesListPageState extends State<SchedulesListPage> {
),
),
ShowFillButton(
title: "Create Schedule",
title: LocaleKeys.createSchedule.tr(),
maxWidth: double.infinity,
margin: const EdgeInsets.all(20),
onPressed: () {
@ -150,7 +144,7 @@ class _SchedulesListPageState extends State<SchedulesListPage> {
for (int i = 0; i < scheduleData.weeklyOffDays!.length; i++) {
offDays = offDays + initDaysList[scheduleData.weeklyOffDays![i].dayNumber! - 1].title;
if (i != scheduleData.weeklyOffDays!.length - 1) {
offDays = offDays + " , ";
offDays = "$offDays , ";
}
}
return offDays;
@ -159,9 +153,9 @@ class _SchedulesListPageState extends State<SchedulesListPage> {
Widget showItem(String title, String value) {
return Row(
children: [
title.toText(fontSize: 12, isBold: true, color: MyColors.lightTextColor),
title.toText(fontSize: 12, color: MyColors.lightTextColor),
4.width,
value.toText(fontSize: 12, isBold: true),
value.toText(fontSize: 12),
],
);
}

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
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/theme/colors.dart';
@ -14,17 +15,17 @@ class PickerItem {
}
class ChipsPickerItem extends StatelessWidget {
String hint;
List<PickerItem> itemsList;
Function onClick;
final String hint;
final List<PickerItem> itemsList;
final Function onClick;
ChipsPickerItem({Key? key, required this.hint, required this.itemsList, required this.onClick}) : super(key: key);
const ChipsPickerItem({Key? key, required this.hint, required this.itemsList, required this.onClick}) : super(key: key);
@override
Widget build(BuildContext context) {
return Row(
children: [
if (itemsList.isEmpty) Expanded(child: hint.toText(fontSize: 9.sp, color: borderColor)),
if (itemsList.isEmpty) Expanded(child: hint.toText(fontSize: 14, color: borderColor)),
if (itemsList.isNotEmpty)
Expanded(
child: ListView(
@ -61,9 +62,12 @@ class ChipsPickerItem extends StatelessWidget {
Widget showItem(String title, {bool isNeedToShowIcon = true}) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 6),
height: double.infinity,
color: MyColors.chipColor,
child: Row(
children: [
title.toText(fontSize: 12),
title.toText(fontSize: 14, fontWeight: MyFonts.Medium),
if (isNeedToShowIcon) 4.width,
if (isNeedToShowIcon)
const Icon(
@ -79,9 +83,6 @@ class ChipsPickerItem extends StatelessWidget {
),
],
),
padding: const EdgeInsets.symmetric(horizontal: 6),
height: double.infinity,
color: MyColors.chipColor,
);
}
}

@ -71,7 +71,7 @@ class _SelectDaysSheetState extends State<SelectDaysSheet> {
),
12.width,
Expanded(
child: list[index].title.toText(),
child: list[index].title.toText(fontSize: 16),
),
],
);

@ -11,7 +11,6 @@ import 'package:mc_common_app/widgets/txt_field.dart';
import 'package:provider/provider.dart';
import 'package:easy_localization/easy_localization.dart';
class SelectServicesSheet extends StatelessWidget {
Function onSelectServices;
@ -73,7 +72,7 @@ class SelectServicesSheet extends StatelessWidget {
),
12.width,
Expanded(
child: model.servicesList![index].description!.toText(),
child: model.servicesList![index].description!.toText(fontSize: 16),
),
],
);
@ -100,7 +99,7 @@ class SelectServicesSheet extends StatelessWidget {
onSelectServices();
Navigator.pop(context);
},
)
).paddingOnly(bottom: 20)
],
),
);

@ -8,8 +8,6 @@ import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/models/general_models/generic_resp_model.dart';
import 'package:mc_common_app/models/services_models/item_model.dart';
import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/utils/app_permission_handler.dart';
import 'package:mc_common_app/utils/date_helper.dart';
import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/utils/utils.dart';
@ -21,7 +19,6 @@ import 'package:mc_common_app/widgets/checkbox_with_title_desc.dart';
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
import 'package:mc_common_app/widgets/txt_field.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
import 'package:easy_localization/easy_localization.dart';
@ -40,18 +37,16 @@ class _CreateItemPageState extends State<CreateItemPage> {
bool isDefaultValudDone = false;
File? file;
ItemsVM? model;
ItemsVM? itemsVM;
ItemData? itemData;
setDefaultData() {
name = itemData!.name;
description = itemData!.description;
price = itemData!.price;
print(itemData!.manufactureDate);
//TODO: need to discuss with zahoor year and picture
if (itemData!.manufactureDate != null) year = DateHelper.formatAsYearMonthDay(DateHelper.parseStringToDate(itemData!.manufactureDate ?? DateTime.now().toString()));
// itemImage=itemData.
isAppointmentAvailable = itemData!.isAllowAppointment ?? false;
isWorkshopAppointmentAvailable = itemData!.isAppointmentCompanyLoc ?? false;
@ -61,12 +56,12 @@ class _CreateItemPageState extends State<CreateItemPage> {
@override
Widget build(BuildContext context) {
model ??= context.read<ItemsVM>();
itemsVM ??= context.read<ItemsVM>();
itemData ??= ModalRoute.of(context)!.settings.arguments as ItemData;
if (!isDefaultValudDone) setDefaultData();
return Scaffold(
appBar: const CustomAppBar(
title: "Add Items",
appBar: CustomAppBar(
title: LocaleKeys.addItems.tr(),
),
body: Container(
width: double.infinity,
@ -79,7 +74,7 @@ class _CreateItemPageState extends State<CreateItemPage> {
child: Column(
children: [
TxtField(
hint: "Item Name",
hint: LocaleKeys.itemName.tr(),
value: name,
onChanged: (v) {
name = v;
@ -87,7 +82,7 @@ class _CreateItemPageState extends State<CreateItemPage> {
),
12.height,
TxtField(
hint: "Item Description",
hint: LocaleKeys.itemDescription.tr(),
value: description,
onChanged: (v) {
description = v;
@ -95,7 +90,7 @@ class _CreateItemPageState extends State<CreateItemPage> {
),
12.height,
TxtField(
hint: "Item Price",
hint: LocaleKeys.itemPrice.tr(),
value: price,
keyboardType: TextInputType.number,
onChanged: (v) {
@ -104,7 +99,7 @@ class _CreateItemPageState extends State<CreateItemPage> {
),
12.height,
TxtField(
hint: "Manufacture Year",
hint: LocaleKeys.manufacturedOn.tr(),
value: year,
keyboardType: TextInputType.number,
isNeedClickAll: true,
@ -129,7 +124,7 @@ class _CreateItemPageState extends State<CreateItemPage> {
isReview: false,
isFromNetwork: false,
onAddFilePressed: () async {
file = await model!.pickSingleFile(context);
file = await itemsVM!.pickSingleFile(context);
setState(() {});
},
),
@ -137,7 +132,7 @@ class _CreateItemPageState extends State<CreateItemPage> {
10.height,
DottedRectContainer(
onTap: () async {
file = await model!.pickSingleFile(context);
file = await itemsVM!.pickSingleFile(context);
setState(() {});
},
text: LocaleKeys.attachImage.tr(),
@ -146,8 +141,8 @@ class _CreateItemPageState extends State<CreateItemPage> {
20.height,
CheckBoxWithTitleDescription(
isSelected: isAppointmentAvailable,
title: 'Available for appointment',
description: 'This option will allow customer to book appointment for these services',
title: LocaleKeys.availableforAppointment.tr(),
description: LocaleKeys.bookAppointmentForServices.tr(),
onSelection: (bool v) {
setState(() {
isAppointmentAvailable = v;
@ -159,8 +154,8 @@ class _CreateItemPageState extends State<CreateItemPage> {
if (isAppointmentAvailable)
CheckBoxWithTitleDescription(
isSelected: isWorkshopAppointmentAvailable,
title: 'Allow Workshop service',
description: 'This option will show to customer that you can avail this service on workshop or not.',
title: LocaleKeys.allowingWorkshopService.tr(),
description: LocaleKeys.showServiceAvailability.tr(),
onSelection: (bool v) {
setState(() {
isWorkshopAppointmentAvailable = v;
@ -171,8 +166,8 @@ class _CreateItemPageState extends State<CreateItemPage> {
if (isAppointmentAvailable)
CheckBoxWithTitleDescription(
isSelected: isHomeAppointmentAvailable,
title: 'Allow home services',
description: 'This option will allow customer to book appointment at their desired location',
title: LocaleKeys.allowingHomeService.tr(),
description: LocaleKeys.bookAppointmentAtLocation.tr(),
onSelection: (bool v) {
setState(() {
isHomeAppointmentAvailable = v;
@ -189,7 +184,7 @@ class _CreateItemPageState extends State<CreateItemPage> {
maxWidth: double.infinity,
onPressed: () async {
if (validation()) {
var attachedFile = await Utils.convertFileToBase64(file!);
var attachedFile = Utils.convertFileToBase64(file!);
if (!(itemData?.isUpdateOrSelected ?? false)) {
Map map = {
"name": name,
@ -205,10 +200,10 @@ class _CreateItemPageState extends State<CreateItemPage> {
"isAppointmentCustomerLoc": isHomeAppointmentAvailable
};
Utils.showLoading(context);
GenericRespModel mResponse = await model!.createServiceItem(map);
GenericRespModel mResponse = await itemsVM!.createServiceItem(map);
Utils.hideLoading(context);
if (mResponse.messageStatus == 1) {
model!.getServiceItems(itemData!.serviceProviderServiceId ?? 0);
itemsVM!.getServiceItems(itemData!.serviceProviderServiceId ?? 0);
}
Utils.showToast(mResponse.message ?? "");
pop(context);
@ -228,10 +223,10 @@ class _CreateItemPageState extends State<CreateItemPage> {
"isAppointmentCustomerLoc": isHomeAppointmentAvailable
};
Utils.showLoading(context);
GenericRespModel mResponse = await model!.updateServiceItem(map);
GenericRespModel mResponse = await itemsVM!.updateServiceItem(map);
Utils.hideLoading(context);
if (mResponse.messageStatus == 1) {
model!.getServiceItems(itemData!.serviceProviderServiceId ?? 0);
itemsVM!.getServiceItems(itemData!.serviceProviderServiceId ?? 0);
}
Utils.showToast(mResponse.message ?? "");
pop(context);

@ -1,234 +0,0 @@
// import 'package:car_provider_app/common/widget/checkbox_with_title_desc.dart';
// import 'package:mc_common_app/view_models/service_view_model.dart';
// import 'package:easy_localization/easy_localization.dart';
//
// import 'package:flutter/material.dart';
//
// import 'package:car_provider_app/generated/locale_keys.g.dart';
//
// import 'package:car_provider_app/view_models/branch_view_model.dart';
// import 'package:mc_common_app/classes/app_state.dart';
// import 'package:mc_common_app/extensions/int_extensions.dart';
// import 'package:mc_common_app/extensions/string_extensions.dart';
// import 'package:mc_common_app/models/m_response.dart';
// import 'package:mc_common_app/models/model/branch2.dart';
// import 'package:mc_common_app/theme/colors.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';
// import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
// import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
// import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
// import 'package:mc_common_app/widgets/txt_field.dart';
//
// import 'package:provider/provider.dart';
//
// class CreateServicesPage2 extends StatelessWidget {
// ServiceProviderBranch? serviceProviderBranch;
//
// CreateServicesPage2(this.serviceProviderBranch, {Key? key}) : super(key: key);
// bool isAppointmentAvailable = false;
// bool isHomeAppointmentAvailable = false;
// int serviceRage = 0;
// int chargersPerKm = 0;
//
// @override
// Widget build(BuildContext context) {
// ServiceVM branchVM = context.read<ServiceVM>();
//
// // if (serviceProviderBranch != null) {
// // branchVM.categoryDropList.clear();
// // branchVM.serviceId = -1;
// // branchVM.fetchBranchCategory(EasyLocalization.of(context)?.currentLocale?.countryCode ?? "SA");
// // }
// // print(AppState().getUser.data!.accessToken);
//
// return Scaffold(
// appBar: CustomAppBar(title: LocaleKeys.defineServices.tr()),
// body: SizedBox(
// width: double.infinity,
// height: double.infinity,
// child: Consumer<ServiceVM>(
// builder: (context, model, _) {
// return Column(
// children: [
// Expanded(
// child: SingleChildScrollView(
// child: Padding(
// padding: const EdgeInsets.all(20.0),
// child: Column(
// children: [
// Text(
// serviceProviderBranch!.branchName ?? "N/A",
// style: const TextStyle(
// fontSize: 12,
// fontWeight: FontWeight.bold,
// ),
// ).toContainer(
// padding: const EdgeInsets.only(left: 8, right: 8, bottom: 12, top: 12),
// backgroundColor: MyColors.textFieldColor,
// borderRadius: 0,
// width: double.infinity,
// ),
// 12.height,
// (model.category != null)
// ? DropdownField(
// (DropValue value) {
// model.categoryId = value.id;
// model.services = null;
// model.serviceId = -1;
// isAppointmentAvailable = false;
// isHomeAppointmentAvailable = false;
// model.fetchServicesByCategoryId();
//
// // model.setState(ViewState.idle);
// },
// list: model.categoryDropList,
// hint: LocaleKeys.selectServiceCategory.tr(),
// )
// : const CircularProgressIndicator(),
// 12.height,
// (model.services != null)
// ? DropdownField(
// (DropValue value) {
// model.serviceId = value.id;
// isAppointmentAvailable = false;
// isHomeAppointmentAvailable = false;
// model.setState(ViewState.idle);
// },
// list: model.servicesDropList,
// hint: LocaleKeys.defineServices.tr(),
// )
// : model.categoryId == -1
// ? Container()
// : const CircularProgressIndicator(),
// 20.height,
// if (model.serviceId != -1)
// Column(
// children: [
// CheckBoxWithTitleDescription(
// isSelected: isAppointmentAvailable,
// title: 'Available for appointment',
// description: 'This option will allow customer to book appointment for these services',
// onSelection: (bool v) {
// isAppointmentAvailable = v;
// model.setState(ViewState.idle);
// },
// ),
// 20.height,
// CheckBoxWithTitleDescription(
// isSelected: isHomeAppointmentAvailable,
// title: 'Allow home services',
// description: 'This option will allow customer to book appointment at their desired location',
// onSelection: (bool v) {
// isHomeAppointmentAvailable = v;
// model.setState(ViewState.idle);
// },
// ),
// 20.height,
// if (isHomeAppointmentAvailable)
// Column(
// children: [
// TxtField(
// hint: "Home Services Range",
// keyboardType: TextInputType.number,
// postfixWidget: Row(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// "KM".toText(color: MyColors.lightTextColor),
// ],
// ),
// onChanged: (v) {
// if (v.isNotEmpty) {
// serviceRage = int.parse(v);
// } else {
// serviceRage = 0;
// }
// },
// ),
// 12.height,
// TxtField(
// hint: "Charges per Kilometer",
// keyboardType: TextInputType.number,
// onChanged: (v) {
// if (v.isNotEmpty) {
// chargersPerKm = int.parse(v);
// } else {
// chargersPerKm = 0;
// }
// },
// ),
// ],
// ),
// ],
// ),
// ],
// ),
// ),
// ),
// ),
// if (model.serviceId != -1)
// ShowFillButton(
// title: LocaleKeys.save.tr(),
// maxWidth: double.infinity,
// margin: const EdgeInsets.all(20),
// onPressed: () {
// createService(context, model);
// },
// ),
// ],
// );
// },
// ),
// ),
// );
// }
//
// bool checkServicesSelection(BranchVM model) {
// bool isServiceSelected = false;
// try {
// for (var element in model.services!.data!) {
// if (element.isSelected ?? false) isServiceSelected = true;
// }
// } catch (e) {
// isServiceSelected = false;
// }
//
// return isServiceSelected;
// }
//
// createService(BuildContext context, BranchVM model) async {
// List<Map<String, dynamic>> map = [];
// model.services!.data?.forEach((element) {
// if (model.serviceId == element.id) {
// element.isSelected = true;
// } else {
// element.isSelected = false;
// }
// });
//
// for (int i = 0; i < model.services!.data!.length; i++) {
// if (model.services!.data![i].isSelected ?? false) {
// var postParams = {
// // "id": services!.data![i].id,
// "providerBranchID": model.branchId,
// "serviceID": model.services!.data![i].id,
// "isAllowAppointment": isAppointmentAvailable,
// "isActive": true,
// "customerLocationRange": serviceRage,
// "rangePricePerKm": chargersPerKm
// };
// map.add(postParams);
// }
// }
// // print(map);
// Utils.showLoading(context);
// MResponse mResponse = await model.createService(map);
// model.getBranchAndServices();
// Utils.hideLoading(context);
// Utils.showToast(mResponse.message ?? "");
// }
// }

@ -1,5 +1,4 @@
import 'dart:async';
import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/models/general_models/generic_resp_model.dart';
import 'package:mc_common_app/utils/navigator.dart';
@ -33,7 +32,7 @@ class _CreateServicesPage3State extends State<CreateServicesPage3> {
bool isAppointmentAvailable = false;
bool isHomeAppointmentAvailable = false;
int serviceRage = 0;
String chargersPerKm = "0";
String chargersPerKm = "";
int? categoryId;
int? serviceId = -1;
DropValue? category;
@ -53,7 +52,7 @@ class _CreateServicesPage3State extends State<CreateServicesPage3> {
if (serviceRage > 0) {
isHomeAppointmentAvailable = true;
}
chargersPerKm = widget.branchModel?.serviceProviderService?.rangePricePerKm ?? "0";
chargersPerKm = widget.branchModel?.serviceProviderService?.rangePricePerKm ?? "";
serviceId = widget.branchModel?.serviceProviderService?.serviceId ?? -1;
}
});
@ -200,14 +199,22 @@ class _CreateServicesPage3State extends State<CreateServicesPage3> {
TxtField(
hint: "Charges per Kilometer",
keyboardType: TextInputType.number,
value: chargersPerKm == "0.0" ? null : chargersPerKm,
value: chargersPerKm == "" ? null : chargersPerKm,
onChanged: (v) {
if (v.isNotEmpty) {
chargersPerKm = v;
} else {
chargersPerKm = "0";
chargersPerKm = "";
}
},
postfixWidget: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
LocaleKeys.sar.tr().toText(color: MyColors.lightTextColor),
],
),
),
],
),
@ -222,7 +229,7 @@ class _CreateServicesPage3State extends State<CreateServicesPage3> {
ShowFillButton(
title: LocaleKeys.save.tr(),
maxWidth: double.infinity,
margin: const EdgeInsets.all(20),
margin: const EdgeInsets.symmetric(horizontal: 20),
onPressed: () {
if (widget.branchModel!.serviceProviderService != null) {
updateService(context, model);
@ -287,6 +294,5 @@ class _CreateServicesPage3State extends State<CreateServicesPage3> {
Utils.hideLoading(context);
Utils.showToast(mResponse.message ?? "");
pop(context);
}
}

@ -78,9 +78,9 @@ class AllSubscriptionsCard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
subscription.price.toString().toText(fontSize: 29, isBold: true, color: textColor, letterSpacing: -1.77),
subscription.price.toString().toText(fontSize: 29, isBold: true, color: textColor, letterSpacing: -1.77, height: 1),
2.width,
"${subscription.currency}/Month".toText(color: MyColors.lightTextColor, fontSize: 16, letterSpacing: -0.64),
"${subscription.currency ?? ""}/Month".toText(color: MyColors.lightTextColor, fontSize: 16, letterSpacing: -0.64).paddingOnly(bottom: 2),
],
),
),
@ -89,9 +89,7 @@ class AllSubscriptionsCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
(subscription.subscriptionTypeEnum == SubscriptionTypeEnum.current && subscription.isRenewable!)
? "Renew".toText()
: (subscription.subscriptionTypeEnum)!.getStringSubscriptionTypeEnum().toText(),
(subscription.subscriptionTypeEnum == SubscriptionTypeEnum.current && subscription.isRenewable!) ? "Renew".toText() : (subscription.subscriptionTypeEnum)!.getStringSubscriptionTypeEnum().toText(),
6.width,
const Icon(
Icons.arrow_forward,

@ -19,8 +19,7 @@ class MySubscriptionsCard extends StatelessWidget {
Function onUpgradeSubscriptionClick;
bool isMainPage;
MySubscriptionsCard(this.pvm, {Key? key, this.isSubscribed = false, this.backgroundColor, required this.onRenewSubscriptionClick, required this.onUpgradeSubscriptionClick, this.isMainPage = true})
: super(key: key);
MySubscriptionsCard(this.pvm, {Key? key, this.isSubscribed = false, this.backgroundColor, required this.onRenewSubscriptionClick, required this.onUpgradeSubscriptionClick, this.isMainPage = true}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -102,8 +101,7 @@ class MySubscriptionsCard extends StatelessWidget {
Row(
children: [
6.width,
"Renew".toText(
color: MyColors.primaryColor, fontSize: 14, letterSpacing: -0.56, textDecoration: TextDecoration.underline, decorationColor: MyColors.primaryColor, fontWeight: MyFonts.Medium),
"Renew".toText(color: MyColors.primaryColor, fontSize: 14, letterSpacing: -0.56, textDecoration: TextDecoration.underline, decorationColor: MyColors.primaryColor, fontWeight: MyFonts.Medium),
],
).onPress(() {
onRenewSubscriptionClick();

Loading…
Cancel
Save