Timezone Updates

merge-update-with-lab-changes
haroon amjad 4 years ago
parent ca43849d9d
commit 3896f02d13

@ -1,11 +1,9 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_response_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
@ -90,23 +88,23 @@ class _NewCMCPageState extends State<NewCMCPage> with TickerProviderStateMixin {
showDialog( showDialog(
context: context, context: context,
builder: (cxt) => ConfirmWithMessageDialog( builder: (cxt) => ConfirmWithMessageDialog(
message: TranslationBase.of(context).cancelOrderMsg, message: TranslationBase.of(context).cancelOrderMsg,
onTap: () async { onTap: () async {
UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3);
Future.delayed(new Duration(milliseconds: 300)).then((value) async { Future.delayed(new Duration(milliseconds: 300)).then((value) async {
GifLoaderDialogUtils.showMyDialog(_context); GifLoaderDialogUtils.showMyDialog(_context);
await model.updateCmcPresOrder(updatePresOrderRequestModel); await model.updateCmcPresOrder(updatePresOrderRequestModel);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error); Utils.showErrorToast(model.error);
GifLoaderDialogUtils.hideDialog(_context); GifLoaderDialogUtils.hideDialog(_context);
} else { } else {
AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully);
await model.getCmcAllPresOrders(); await model.getCmcAllPresOrders();
GifLoaderDialogUtils.hideDialog(_context); GifLoaderDialogUtils.hideDialog(_context);
} }
}); });
}, },
)); ));
} }
int status = widget.model.pendingOrder != null ? widget.model.pendingOrder.statusId : 0; int status = widget.model.pendingOrder != null ? widget.model.pendingOrder.statusId : 0;
@ -140,7 +138,6 @@ class _NewCMCPageState extends State<NewCMCPage> with TickerProviderStateMixin {
margin: EdgeInsets.zero, margin: EdgeInsets.zero,
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: Container( child: Container(
// decoration: containerColorRadiusLeft(Colors.white, 12),
margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0),
padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -180,8 +177,7 @@ class _NewCMCPageState extends State<NewCMCPage> with TickerProviderStateMixin {
), ),
Expanded( Expanded(
child: Text( child: Text(
// !projectViewModel.isArabic ? order.nearestProjectDescription.trim().toString() : order.nearestProjectDescriptionN.toString(), widget.model.pendingOrder.projectName != null ? widget.model.pendingOrder.projectName.trim().toString() : "",
widget.model.pendingOrder.projectName != null ? widget.model.pendingOrder.projectName.trim().toString() : "",
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56),
), ),
), ),

@ -274,7 +274,9 @@ class _BookConfirmState extends State<BookConfirm> {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
AppoitmentAllHistoryResultList appo; AppoitmentAllHistoryResultList appo;
widget.service.insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.selectedTime, widget.selectedDate, initialSlotDuration, context, null, null, null, projectViewModel).then((res) { widget.service
.insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.selectedTime, widget.selectedDate, initialSlotDuration, context, null, null, null, projectViewModel)
.then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess);
@ -316,7 +318,8 @@ class _BookConfirmState extends State<BookConfirm> {
insertLiveCareScheduledAppointment(context, DoctorList docObject) { insertLiveCareScheduledAppointment(context, DoctorList docObject) {
final timeSlot = DocAvailableAppointments.selectedAppoDateTime; final timeSlot = DocAvailableAppointments.selectedAppoDateTime;
widget.selectedDate = timeSlot.toUtc().add(Duration(hours: 3)).toString().split(" ")[0];
widget.selectedTime = timeSlot.toUtc().add(Duration(hours: 3)).toString().split(" ")[1].substring(0, 5);
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
AppoitmentAllHistoryResultList appo; AppoitmentAllHistoryResultList appo;
widget.service.insertLiveCareScheduleAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, docObject.serviceID, widget.selectedTime, widget.selectedDate, context).then((res) { widget.service.insertLiveCareScheduleAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, docObject.serviceID, widget.selectedTime, widget.selectedDate, context).then((res) {

@ -13,7 +13,6 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:jiffy/jiffy.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart';
@ -57,6 +56,7 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
ScrollController _scrollController; ScrollController _scrollController;
var language; var language;
bool isLiveCareSchedule;
@override @override
void didUpdateWidget(covariant DocAvailableAppointments oldWidget) { void didUpdateWidget(covariant DocAvailableAppointments oldWidget) {
@ -81,7 +81,7 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
WidgetsBinding.instance.addPostFrameCallback((_) async { WidgetsBinding.instance.addPostFrameCallback((_) async {
getCurrentLanguage(); getCurrentLanguage();
bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT); isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT);
if (isLiveCareSchedule != null && isLiveCareSchedule) if (isLiveCareSchedule != null && isLiveCareSchedule)
getDoctorScheduledFreeSlots(context, widget.doctor); getDoctorScheduledFreeSlots(context, widget.doctor);
else { else {
@ -233,23 +233,32 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
final DateFormat formatter = DateFormat('HH:mm'); final DateFormat formatter = DateFormat('HH:mm');
final DateFormat dateFormatter = DateFormat('yyyy-MM-dd'); final DateFormat dateFormatter = DateFormat('yyyy-MM-dd');
for (var i = 0; i < freeSlotsResponse.length; i++) { for (var i = 0; i < freeSlotsResponse.length; i++) {
if ((widget.doctor.projectID == 2 && DateTime.now().timeZoneName == "+04") || widget.doctor.projectID == 3 && DateTime.now().timeZoneName == "+04") { date = (isLiveCareSchedule != null && isLiveCareSchedule)
date = Jiffy(DateUtil.convertStringToDate(freeSlotsResponse[i])).subtract(hours: 1).dateTime; ? DateUtil.convertStringToDate(freeSlotsResponse[i])
} else { : DateUtil.convertStringToDateSaudiTimezone(freeSlotsResponse[i], widget.doctor.projectID);
date = DateUtil.convertStringToDate(freeSlotsResponse[i]);
}
slotsList.add(FreeSlot(date, ['slot'])); slotsList.add(FreeSlot(date, ['slot']));
docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date)); docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date));
} }
_eventsParsed = Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event); _eventsParsed = Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event);
setState(() { setState(() {
DocAvailableAppointments.selectedDate = dateFormatter.format(DateUtil.convertStringToDate(freeSlotsResponse[0])); DocAvailableAppointments.selectedDate = dateFormatter.format((isLiveCareSchedule != null && isLiveCareSchedule)
DocAvailableAppointments.selectedAppoDateTime = DateUtil.convertStringToDate(freeSlotsResponse[0]); ? DateUtil.convertStringToDate(freeSlotsResponse[0])
selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted(DateUtil.convertStringToDate(freeSlotsResponse[0]), language); : DateUtil.convertStringToDateSaudiTimezone(freeSlotsResponse[0], widget.doctor.projectID));
DocAvailableAppointments.selectedAppoDateTime = (isLiveCareSchedule != null && isLiveCareSchedule)
? DateUtil.convertStringToDate(freeSlotsResponse[0])
: DateUtil.convertStringToDateSaudiTimezone(freeSlotsResponse[0], widget.doctor.projectID);
selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted(
(isLiveCareSchedule != null && isLiveCareSchedule)
? DateUtil.convertStringToDate(freeSlotsResponse[0])
: DateUtil.convertStringToDateSaudiTimezone(freeSlotsResponse[0], widget.doctor.projectID),
language);
selectedDateJSON = freeSlotsResponse[0]; selectedDateJSON = freeSlotsResponse[0];
}); });
openTimeSlotsPickerForDate(DateUtil.convertStringToDate(selectedDateJSON), docFreeSlots); openTimeSlotsPickerForDate(
_calendarController.selectedDate = DateUtil.convertStringToDate(selectedDateJSON); (isLiveCareSchedule != null && isLiveCareSchedule) ? DateUtil.convertStringToDate(selectedDateJSON) : DateUtil.convertStringToDateSaudiTimezone(selectedDateJSON, widget.doctor.projectID),
docFreeSlots);
_calendarController.selectedDate =
(isLiveCareSchedule != null && isLiveCareSchedule) ? DateUtil.convertStringToDate(selectedDateJSON) : DateUtil.convertStringToDateSaudiTimezone(selectedDateJSON, widget.doctor.projectID);
_calendarController.displayDate = _calendarController.selectedDate; _calendarController.displayDate = _calendarController.selectedDate;
return _eventsParsed; return _eventsParsed;
} }

@ -378,6 +378,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
date: DateUtil.convertStringToDate(_appointmentResult.appointmentDate), date: DateUtil.convertStringToDate(_appointmentResult.appointmentDate),
isSortByClinic: _isSortByClinic, isSortByClinic: _isSortByClinic,
rating: _appointmentResult.actualDoctorRate + 0.0, rating: _appointmentResult.actualDoctorRate + 0.0,
// appointmentTime: _appointmentResult.isLiveCareAppointment ? DateUtil.convertStringToDate(_appointmentResult.appointmentDate).toString().split(" ")[1].substring(0, 5) : _appointmentResult.startTime.substring(0, 5),
appointmentTime: _appointmentResult.startTime.substring(0, 5), appointmentTime: _appointmentResult.startTime.substring(0, 5),
remainingTimeInMinutes: (_appointmentResult.patientStatusType == AppointmentType.BOOKED || _appointmentResult.patientStatusType == AppointmentType.CONFIRMED) remainingTimeInMinutes: (_appointmentResult.patientStatusType == AppointmentType.BOOKED || _appointmentResult.patientStatusType == AppointmentType.CONFIRMED)
? _appointmentResult.remaniningHoursTocanPay ? _appointmentResult.remaniningHoursTocanPay

@ -214,7 +214,8 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
), ),
child: Text( child: Text(
getNextActionText(widget.appoList[index].nextAction), textAlign: TextAlign.center, getNextActionText(widget.appoList[index].nextAction),
textAlign: TextAlign.center,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4),
), ),
), ),
@ -246,8 +247,24 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
MyRichText(TranslationBase.of(context).clinic + ": ", widget.appoList[index].clinicName, projectViewModel.isArabic), MyRichText(TranslationBase.of(context).clinic + ": ", widget.appoList[index].clinicName, projectViewModel.isArabic),
MyRichText(TranslationBase.of(context).appointmentDate + ": ", // MyRichText(TranslationBase.of(context).appointmentDate + ": ",
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) + " " + widget.appoList[index].startTime.substring(0, 5), projectViewModel.isArabic), // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) + " " + widget.appoList[index].startTime.substring(0, 5), projectViewModel.isArabic),
// Timezone changes
widget.appoList[index].isLiveCareAppointment
? MyRichText(
TranslationBase.of(context).appointmentDate + ": ",
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) +
" " +
DateUtil.convertStringToDate(widget.appoList[index].appointmentDate).toString().split(" ")[1].substring(0, 5),
projectViewModel.isArabic)
: MyRichText(
TranslationBase.of(context).appointmentDate + ": ",
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) +
" " +
widget.appoList[index].startTime.substring(0, 5),
projectViewModel.isArabic),
MyRichText(TranslationBase.of(context).branch, widget.appoList[index].projectName, projectViewModel.isArabic), MyRichText(TranslationBase.of(context).branch, widget.appoList[index].projectName, projectViewModel.isArabic),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,

@ -211,9 +211,8 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
child: DefaultButton( child: DefaultButton(
TranslationBase.of(context).confirm.toUpperCase(), TranslationBase.of(context).confirm.toUpperCase(),
() { () {
// startApplePay();
if (widget.advanceModel.fileNumber == projectViewModel.user.patientID.toString()) { if (widget.advanceModel.fileNumber == projectViewModel.user.patientID.toString()) {
openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), null); openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), null);
} else { } else {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
model.sendActivationCodeForAdvancePayment(patientID: int.parse(widget.advanceModel.fileNumber), projectID: widget.advanceModel.hospitalsModel.iD).then((value) { model.sendActivationCodeForAdvancePayment(patientID: int.parse(widget.advanceModel.fileNumber), projectID: widget.advanceModel.hospitalsModel.iD).then((value) {

@ -10,11 +10,34 @@ class DateUtil {
const end = "+0300)"; const end = "+0300)";
final startIndex = date.indexOf(start); final startIndex = date.indexOf(start);
final endIndex = date.indexOf(end, startIndex + start.length); final endIndex = date.indexOf(end, startIndex + start.length);
return DateTime.fromMillisecondsSinceEpoch(int.parse(
date.substring(startIndex + start.length, endIndex),
));
} else
return DateTime.now();
}
static DateTime convertStringToDateSaudiTimezone(String date, int projectId) {
if (date != null) {
const start = "/Date(";
const end = "+0300)";
final startIndex = date.indexOf(start);
final endIndex = date.indexOf(end, startIndex + start.length);
// if (projectId == 2 || projectId == 3) {
// return DateTime.fromMillisecondsSinceEpoch(
// int.parse(
// date.substring(startIndex + start.length, endIndex),
// ),
// isUtc: true)
// .add(Duration(hours: 4));
// } else {
return DateTime.fromMillisecondsSinceEpoch( return DateTime.fromMillisecondsSinceEpoch(
int.parse( int.parse(
date.substring(startIndex + start.length, endIndex), date.substring(startIndex + start.length, endIndex),
) ),
); isUtc: true)
.add(Duration(hours: 3));
// }
} else } else
return DateTime.now(); return DateTime.now();
} }
@ -88,22 +111,16 @@ class DateUtil {
static String convertDateMSToJsonDate(utc) { static String convertDateMSToJsonDate(utc) {
var dt = new DateTime.fromMicrosecondsSinceEpoch(utc); var dt = new DateTime.fromMicrosecondsSinceEpoch(utc);
return "/Date(" + return "/Date(" + (dt.millisecondsSinceEpoch * 1000).toString() + '+0300' + ")/";
(dt.millisecondsSinceEpoch * 1000).toString() +
'+0300' +
")/";
} }
/// check Date /// check Date
/// [dateString] String we want to convert /// [dateString] String we want to convert
static String checkDate(DateTime checkedTime) { static String checkDate(DateTime checkedTime) {
DateTime currentTime = DateTime.now(); DateTime currentTime = DateTime.now();
if ((currentTime.year == checkedTime.year) && if ((currentTime.year == checkedTime.year) && (currentTime.month == checkedTime.month) && (currentTime.day == checkedTime.day)) {
(currentTime.month == checkedTime.month) &&
(currentTime.day == checkedTime.day)) {
return "Today"; return "Today";
} else if ((currentTime.year == checkedTime.year) && } else if ((currentTime.year == checkedTime.year) && (currentTime.month == checkedTime.month)) {
(currentTime.month == checkedTime.month)) {
if ((currentTime.day - checkedTime.day) == 1) { if ((currentTime.day - checkedTime.day) == 1) {
return "YESTERDAY"; return "YESTERDAY";
} else if ((currentTime.day - checkedTime.day) == -1) { } else if ((currentTime.day - checkedTime.day) == -1) {
@ -121,16 +138,11 @@ class DateUtil {
static String getDateFormatted(String date) { static String getDateFormatted(String date) {
DateTime dateObj = DateUtil.convertStringToDate(date); DateTime dateObj = DateUtil.convertStringToDate(date);
return DateUtil.getWeekDay(dateObj.weekday) + return DateUtil.getWeekDay(dateObj.weekday) + ", " + dateObj.day.toString() + " " + DateUtil.getMonth(dateObj.month) + " " + dateObj.year.toString();
", " +
dateObj.day.toString() +
" " +
DateUtil.getMonth(dateObj.month) +
" " +
dateObj.year.toString();
} }
static String getISODateFormat(DateTime dateTime){ // 2020-04-30T00:00:00.000 static String getISODateFormat(DateTime dateTime) {
// 2020-04-30T00:00:00.000
return dateTime.toIso8601String(); return dateTime.toIso8601String();
} }
@ -304,6 +316,7 @@ class DateUtil {
else else
return ""; return "";
} }
/// get data formatted like Apr 26,2020 /// get data formatted like Apr 26,2020
/// [dateTime] convert DateTime to data formatted Arabic /// [dateTime] convert DateTime to data formatted Arabic
static String getMonthDayYearDateFormattedAr(DateTime dateTime) { static String getMonthDayYearDateFormattedAr(DateTime dateTime) {
@ -315,62 +328,30 @@ class DateUtil {
/// get data formatted like Thursday, Apr 26,2020 /// get data formatted like Thursday, Apr 26,2020
/// [dateTime] convert DateTime to date formatted /// [dateTime] convert DateTime to date formatted
static String getWeekDayMonthDayYearDateFormatted( static String getWeekDayMonthDayYearDateFormatted(DateTime dateTime, String lang) {
DateTime dateTime, String lang) {
if (dateTime != null) if (dateTime != null)
return lang == 'en' return lang == 'en'
? getWeekDayEnglish(dateTime.weekday) + ? getWeekDayEnglish(dateTime.weekday) + ", " + getMonth(dateTime.month) + " " + dateTime.day.toString() + " " + dateTime.year.toString()
", " + : getWeekDayArabic(dateTime.weekday) + ", " + dateTime.day.toString() + " " + getMonthArabic(dateTime.month) + " " + dateTime.year.toString();
getMonth(dateTime.month) +
" " +
dateTime.day.toString() +
" " +
dateTime.year.toString()
: getWeekDayArabic(dateTime.weekday) +
", " +
dateTime.day.toString() +
" " +
getMonthArabic(dateTime.month) +
" " +
dateTime.year.toString();
else else
return ""; return "";
} }
static String getMonthDayYearLangDateFormatted( static String getMonthDayYearLangDateFormatted(DateTime dateTime, String lang) {
DateTime dateTime, String lang) {
if (dateTime != null) if (dateTime != null)
return lang == 'en' return lang == 'en'
? getMonth(dateTime.month) + ? getMonth(dateTime.month) + " " + dateTime.day.toString() + " " + dateTime.year.toString()
" " + : dateTime.day.toString() + " " + getMonthArabic(dateTime.month) + " " + dateTime.year.toString();
dateTime.day.toString() +
" " +
dateTime.year.toString()
: dateTime.day.toString() +
" " +
getMonthArabic(dateTime.month) +
" " +
dateTime.year.toString();
else else
return ""; return "";
} }
/// get data formatted like 26/4/2020 /// get data formatted like 26/4/2020
static String getDayMonthYearLangDateFormatted( static String getDayMonthYearLangDateFormatted(DateTime dateTime, String lang) {
DateTime dateTime, String lang) {
if (dateTime != null) if (dateTime != null)
return lang == 'en' return lang == 'en'
? dateTime.day.toString() + ? dateTime.day.toString() + " " + getMonth(dateTime.month) + " " + dateTime.year.toString()
" " + : dateTime.day.toString() + " " + getMonthArabic(dateTime.month) + " " + dateTime.year.toString();
getMonth(dateTime.month) +
" " +
dateTime.year.toString()
: dateTime.day.toString() +
" " +
getMonthArabic(dateTime.month) +
" " +
dateTime.year.toString();
else else
return ""; return "";
} }
@ -386,11 +367,7 @@ class DateUtil {
/// [dateTime] convert DateTime to data formatted /// [dateTime] convert DateTime to data formatted
static String getDayMonthYearDateFormatted(DateTime dateTime) { static String getDayMonthYearDateFormatted(DateTime dateTime) {
if (dateTime != null) if (dateTime != null)
return dateTime.day.toString() + return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString();
"/" +
dateTime.month.toString() +
"/" +
dateTime.year.toString();
else else
return ""; return "";
} }
@ -422,13 +399,7 @@ class DateUtil {
/// [dateTime] convert DateTime to data formatted /// [dateTime] convert DateTime to data formatted
static String getDayMonthYearHourMinuteDateFormatted(DateTime dateTime) { static String getDayMonthYearHourMinuteDateFormatted(DateTime dateTime) {
if (dateTime != null) if (dateTime != null)
return dateTime.day.toString() + return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString() + " " + DateFormat('HH:mm').format(dateTime);
"/" +
dateTime.month.toString() +
"/" +
dateTime.year.toString() +
" " +
DateFormat('HH:mm').format(dateTime);
else else
return ""; return "";
} }
@ -452,18 +423,12 @@ class DateUtil {
return ""; return "";
} }
static String getFormattedDate(DateTime dateTime, String formattedString){ static String getFormattedDate(DateTime dateTime, String formattedString) {
return DateFormat(formattedString) return DateFormat(formattedString).format(dateTime);
.format(dateTime);
} }
static convertISODateToJsonDate(String isoDate) { static convertISODateToJsonDate(String isoDate) {
return "/Date(" + return "/Date(" + DateFormat('mm-dd-yyy').parse(isoDate).millisecondsSinceEpoch.toString() + ")/";
DateFormat('mm-dd-yyy')
.parse(isoDate)
.millisecondsSinceEpoch
.toString() +
")/";
} }
static String getDay(DayOfWeek dayOfWeek) { static String getDay(DayOfWeek dayOfWeek) {

@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
@ -34,13 +35,13 @@ class MyInAppBrowser extends InAppBrowser {
// static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE
static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT
static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT
// static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE
static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT // static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT
// static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store
// static String PRESCRIPTION_PAYMENT_WITH_ORDERID = // static String PRESCRIPTION_PAYMENT_WITH_ORDERID =
// 'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID='; // 'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID=';
@ -251,7 +252,11 @@ class MyInAppBrowser extends InAppBrowser {
form = form.replaceFirst('PATIENT_OUT_SA', authUser.outSA == 0 ? false.toString() : true.toString()); form = form.replaceFirst('PATIENT_OUT_SA', authUser.outSA == 0 ? false.toString() : true.toString());
form = form.replaceFirst('PATIENT_TYPE_ID', patientData == null ? patientType.toString() : "1"); form = form.replaceFirst('PATIENT_TYPE_ID', patientData == null ? patientType.toString() : "1");
form = form.replaceFirst('DEVICE_TOKEN', await AppSharedPreferences().getString(PUSH_TOKEN) + "," + await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN)); Platform.isIOS
? form = form.replaceFirst('DEVICE_TOKEN', await AppSharedPreferences().getString(PUSH_TOKEN) + "," + await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN))
: form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN));
// form = form.replaceFirst('DEVICE_TOKEN', await AppSharedPreferences().getString(PUSH_TOKEN) + "," + await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN));
// form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN)); // form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN));
form = form.replaceFirst('LATITUDE_VALUE', this.lat.toString()); form = form.replaceFirst('LATITUDE_VALUE', this.lat.toString());
form = form.replaceFirst('LONGITUDE_VALUE', this.long.toString()); form = form.replaceFirst('LONGITUDE_VALUE', this.long.toString());

Loading…
Cancel
Save