diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 736be83..b9c2df5 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -931,6 +931,17 @@ "downgrade": "تخفيض الباقة", "current": "الحالية", "adActiveDuration": "سيبقى إعلانك نشطًا لمدة {} يومًا، وبعد ذلك ستحتاج إلى تمديده ليبقى نشطًا.", - "discountOff": "خصم {} ٪" + "discountOff": "خصم {} ٪", + "booked": "محجوز", + "confirmed": "مؤكد", + "rescheduled": "تمت إعادة الجدولة", + "upcoming": "قادم", + "workStarted": "بدأ العمل", + "past": "سابق", + "today": "اليوم", + "noAppointmentsMatchSearch": "لا توجد مواعيد تطابق بحثك", + "appts": "مواعيد", + "approvalPending": "بانتظار الموافقة", + "activateNow": "تفعيل الآن" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 6e2035b..8ac5331 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -929,6 +929,20 @@ "downgrade": "Downgrade", "current": "Current", "adActiveDuration": "Your Ad will be active for {} Days and then you will need to extend it to keep it active.", - "discountOff": "{} % OFF" + "discountOff": "{} % OFF", + "booked": "Booked", + "confirmed": "Confirmed", + "rescheduled": "Rescheduled", + "upcoming": "Upcoming", + "workStarted": "Work Started", + "past": "Past", + "today": "Today", + "noAppointmentsMatchSearch": "No appointments that match your search", + "appts": "appts", + "approvalPending": "Approval Pending", + "activateNow": "Activate Now" + + + } \ No newline at end of file diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index fc5da55..f261e40 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -159,10 +159,55 @@ extension FormatDate on String { return "${dates[2]} ${getMonth(int.parse(dates[1]))} ${dates[0]} ${DateFormat('hh:mm a', "en_US").format(DateFormat('hh:mm:ss', "en_US").parse(time))}"; } - String toFormattedDateWithoutTime() { + // String toFormattedDateWithoutTime() { + // String date = split("T")[0]; + // var dates = date.split("-"); + // return "${dates[2]} ${getMonth(int.parse(dates[1]))}, ${dates[0]}"; + // } + + String toFormattedDateWithoutTime({bool isArabic = false}) { String date = split("T")[0]; var dates = date.split("-"); - return "${dates[2]} ${getMonth(int.parse(dates[1]))}, ${dates[0]}"; + + final monthNumber = int.parse(dates[1]); + + final monthsEn = [ + '', + 'January', + 'February', + 'March', + 'April', + 'May', + 'June', + 'July', + 'August', + 'September', + 'October', + 'November', + 'December', + ]; + + final monthsAr = [ + '', + 'يناير', + 'فبراير', + 'مارس', + 'أبريل', + 'مايو', + 'يونيو', + 'يوليو', + 'أغسطس', + 'سبتمبر', + 'أكتوبر', + 'نوفمبر', + 'ديسمبر', + ]; + + final month = isArabic + ? monthsAr[monthNumber] + : monthsEn[monthNumber]; + + return "${dates[2]} $month, ${dates[0]}"; } String toLocalizedFormattedDateWithoutTime(BuildContext context) { @@ -358,41 +403,70 @@ extension AppointmentTypeEnumExtString on AppointmentTypeEnum { } } +// extension AppointmentStatusToString on AppointmentStatusEnum { +// String getAppointmentNameFromEnum() { +// switch (this) { +// case AppointmentStatusEnum.booked: +// return "Booked"; +// +// case AppointmentStatusEnum.confirmed: +// return "Confirmed"; +// +// case AppointmentStatusEnum.arrived: +// return "Arrived"; +// +// case AppointmentStatusEnum.cancelled: +// return "Canceled"; +// +// case AppointmentStatusEnum.rescheduled: +// return "Rescheduled"; +// +// case AppointmentStatusEnum.upcoming: +// return "Upcoming"; +// +// case AppointmentStatusEnum.workStarted: +// return "Work Started"; +// +// case AppointmentStatusEnum.visitCompleted: +// return "Visit Completed"; +// +// case AppointmentStatusEnum.past: +// return "Past"; +// +// case AppointmentStatusEnum.today: +// return "Today"; +// +// default: +// return "Booked"; +// } +// } +// } + extension AppointmentStatusToString on AppointmentStatusEnum { String getAppointmentNameFromEnum() { switch (this) { case AppointmentStatusEnum.booked: - return "Booked"; - + return LocaleKeys.booked.tr(); case AppointmentStatusEnum.confirmed: - return "Confirmed"; - + return LocaleKeys.confirmed.tr(); case AppointmentStatusEnum.arrived: - return "Arrived"; - + return LocaleKeys.arrived.tr(); case AppointmentStatusEnum.cancelled: - return "Canceled"; - + return LocaleKeys.canceled.tr(); case AppointmentStatusEnum.rescheduled: - return "Rescheduled"; - + return LocaleKeys.rescheduled.tr(); case AppointmentStatusEnum.upcoming: - return "Upcoming"; - + return LocaleKeys.upcoming.tr(); case AppointmentStatusEnum.workStarted: - return "Work Started"; - + return LocaleKeys.workStarted.tr(); case AppointmentStatusEnum.visitCompleted: - return "Visit Completed"; - + return LocaleKeys.visitCompleted.tr(); case AppointmentStatusEnum.past: - return "Past"; - + return LocaleKeys.past.tr(); case AppointmentStatusEnum.today: - return "Today"; - + return LocaleKeys.today.tr(); default: - return "Booked"; + return LocaleKeys.booked.tr(); } } } diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 9ac84b7..8b06070 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -947,7 +947,18 @@ class CodegenLoader extends AssetLoader{ "downgrade": "تخفيض الباقة", "current": "الحالية", "adActiveDuration": "سيبقى إعلانك نشطًا لمدة {} يومًا، وبعد ذلك ستحتاج إلى تمديده ليبقى نشطًا.", - "discountOff": "خصم {} ٪" + "discountOff": "خصم {} ٪", + "booked": "محجوز", + "confirmed": "مؤكد", + "rescheduled": "تمت إعادة الجدولة", + "upcoming": "قادم", + "workStarted": "بدأ العمل", + "past": "سابق", + "today": "اليوم", + "noAppointmentsMatchSearch": "لا توجد مواعيد تطابق بحثك", + "appts": "مواعيد", + "approvalPending": "بانتظار الموافقة", + "activateNow": "تفعيل الآن" }; static const Map _en_US = { "firstTimeLogIn": "First Time Log In", @@ -1880,7 +1891,18 @@ static const Map _en_US = { "downgrade": "Downgrade", "current": "Current", "adActiveDuration": "Your Ad will be active for {} Days and then you will need to extend it to keep it active.", - "discountOff": "{} % OFF" + "discountOff": "{} % OFF", + "booked": "Booked", + "confirmed": "Confirmed", + "rescheduled": "Rescheduled", + "upcoming": "Upcoming", + "workStarted": "Work Started", + "past": "Past", + "today": "Today", + "noAppointmentsMatchSearch": "No appointments that match your search", + "appts": "appts", + "approvalPending": "Approval Pending", + "activateNow": "Activate Now" }; static const Map> mapLocales = {"ar_SA": _ar_SA, "en_US": _en_US}; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 8658a3f..3ec78f6 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -913,5 +913,16 @@ abstract class LocaleKeys { static const current = 'current'; static const adActiveDuration = 'adActiveDuration'; static const discountOff = 'discountOff'; + static const booked = 'booked'; + static const confirmed = 'confirmed'; + static const rescheduled = 'rescheduled'; + static const upcoming = 'upcoming'; + static const workStarted = 'workStarted'; + static const past = 'past'; + static const today = 'today'; + static const noAppointmentsMatchSearch = 'noAppointmentsMatchSearch'; + static const appts = 'appts'; + static const approvalPending = 'approvalPending'; + static const activateNow = 'activateNow'; } diff --git a/lib/view_models/service_view_model.dart b/lib/view_models/service_view_model.dart index 2ec482a..ba36db2 100644 --- a/lib/view_models/service_view_model.dart +++ b/lib/view_models/service_view_model.dart @@ -172,7 +172,7 @@ class ServiceVM extends BaseVM { CategoryData( id: element.categoryId, categoryName: element.categoryName, - categoryNameN: element.categoryName, + categoryNameN: element.categoryNameN, ), ); } @@ -197,10 +197,10 @@ class ServiceVM extends BaseVM { if (branchServiceEnums.isEmpty) { branchServiceEnums = await commonRepo.getEnumTypeValues(enumTypeID: AppEnums.branchServicesEnumId); } - branchServicesFilterOptions.clear(); for (int i = 0; i < branchServiceEnums.length; i++) { - branchServicesFilterOptions.add(FilterListModel(title: branchServiceEnums[i].enumValueStr, isSelected: false, id: branchServiceEnums[i].enumValue)); + branchServicesFilterOptions.add(FilterListModel(title: branchServiceEnums[i].enumValueStr, + titleN: branchServiceEnums[i].enumValueStrN,isSelected: false, id: branchServiceEnums[i].enumValue)); } } @@ -404,6 +404,7 @@ class ServiceVM extends BaseVM { Future getBranchAndServices() async { setState(ViewState.busy); branches = await branchRepo.getBranchAndServices(); + if (branches!.data == null) { homePageBranches = []; } else if (branches!.data!.serviceProviderBranch == null) { diff --git a/lib/views/appointments/appointment_detail_view.dart b/lib/views/appointments/appointment_detail_view.dart index 9bc8fd1..ae992b6 100644 --- a/lib/views/appointments/appointment_detail_view.dart +++ b/lib/views/appointments/appointment_detail_view.dart @@ -294,7 +294,7 @@ class AppointmentDetailView extends StatelessWidget { fit: BoxFit.fill, ), 5.width, - "${appointmentListModel.duration ?? ""} ${appointmentListModel.appointmentDate!.toFormattedDateWithoutTime()}".toText(fontSize: 12, isBold: true, color: MyColors.lightTextColor), + "${appointmentListModel.duration ?? ""} ${appointmentListModel.appointmentDate!.toFormattedDateWithoutTime( isArabic: context.locale.languageCode == 'ar',)}".toText(fontSize: 12, isBold: true, color: MyColors.lightTextColor), ], ), 13.height, diff --git a/lib/views/appointments/widgets/common_appointment_slider_widget.dart b/lib/views/appointments/widgets/common_appointment_slider_widget.dart index f8378b9..6baaaef 100644 --- a/lib/views/appointments/widgets/common_appointment_slider_widget.dart +++ b/lib/views/appointments/widgets/common_appointment_slider_widget.dart @@ -135,7 +135,7 @@ class AppointmentHomeTileWidget extends StatelessWidget { if (appointmentListModel.appointmentServicesList!.length > 1) { servicesList.add( - showServices("+ ${appointmentListModel.appointmentServicesList!.length - 1} More", "", isMoreText: true), + showServices("+ ${appointmentListModel.appointmentServicesList!.length - 1} ${ LocaleKeys.more.tr() }", "", isMoreText: true), ); } return servicesList; @@ -285,7 +285,7 @@ class AppointmentFragmentTileWidget extends StatelessWidget { if (appointmentListModel.appointmentServicesList!.length > 1) { servicesList.add( - showServices("+ ${appointmentListModel.appointmentServicesList!.length - 1} More", "", isMoreText: true), + showServices("+ ${appointmentListModel.appointmentServicesList!.length - 1} ${ LocaleKeys.more.tr()}", "", isMoreText: true), ); } return servicesList; @@ -329,7 +329,7 @@ class AppointmentFragmentTileWidget extends StatelessWidget { children: [ MyAssets.miniClock.buildSvg(height: 12), 2.width, - " ${appointmentListModel!.duration ?? ""} ${appointmentListModel!.appointmentDate!.toFormattedDateWithoutTime()}" + " ${appointmentListModel!.duration ?? ""} ${appointmentListModel!.appointmentDate!.toFormattedDateWithoutTime( isArabic: AppState().isArabic(context),)}" .toText(color: MyColors.lightTextColor, fontSize: 12, letterSpacing: -0.48, height: 19 / 12), ], ), diff --git a/lib/widgets/common_widgets/filters_list.dart b/lib/widgets/common_widgets/filters_list.dart index 1ecc653..9837134 100644 --- a/lib/widgets/common_widgets/filters_list.dart +++ b/lib/widgets/common_widgets/filters_list.dart @@ -38,6 +38,10 @@ class FiltersList extends StatelessWidget { itemCount: filterList.length, scrollDirection: Axis.horizontal, itemBuilder: (BuildContext context, int index) { + print("isArabic ===== $isArabic"); + print("title EN ===== ${filterList[index].title}"); + print("title AR ===== ${filterList[index].titleN}"); + print("--------------------"); return InkWell( onTap: () { onFilterTapped(index, filterList[index].id);