|
|
|
|
@ -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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|