diff --git a/android/app/build.gradle b/android/app/build.gradle index 1f71421f..9640ea61 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -27,7 +27,7 @@ apply plugin: 'com.google.gms.google-services' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 30 + compileSdkVersion 28 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -41,7 +41,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.cloud.diplomaticquarterapp" minSdkVersion 21 - targetSdkVersion 30 + targetSdkVersion 28 versionCode flutterVersionCode.toInteger() versionName flutterVersionName multiDexEnabled true diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index f1a5a3f8..8c32edfd 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -17,6 +17,9 @@ + + + + + diff --git a/android/gradle.properties b/android/gradle.properties index 3f45ee5b..9c0729c9 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -2,4 +2,4 @@ android.enableR8=true android.useAndroidX=true android.enableJetifier=true -org.gradle.jvmargs=-Xmx4608m \ No newline at end of file +org.gradle.jvmargs=-Xmx4608m diff --git a/assets/images/Wifi-AR.png b/assets/images/Wifi-AR.png new file mode 100644 index 00000000..a8e2d9af Binary files /dev/null and b/assets/images/Wifi-AR.png differ diff --git a/assets/images/covid-car.png b/assets/images/covid-car.png new file mode 100644 index 00000000..01090b74 Binary files /dev/null and b/assets/images/covid-car.png differ diff --git a/assets/images/covid_bg_transparent.png b/assets/images/covid_bg_transparent.png new file mode 100644 index 00000000..cd5f12f1 Binary files /dev/null and b/assets/images/covid_bg_transparent.png differ diff --git a/assets/images/home_health_care_icon.png b/assets/images/home_health_care_icon.png new file mode 100644 index 00000000..d80ec015 Binary files /dev/null and b/assets/images/home_health_care_icon.png differ diff --git a/assets/images/wifi-EN.png b/assets/images/wifi-EN.png new file mode 100644 index 00000000..5711925c Binary files /dev/null and b/assets/images/wifi-EN.png differ diff --git a/lib/config/config.dart b/lib/config/config.dart index 36e1b086..55fe744d 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -56,8 +56,9 @@ const GET_NEAREST_HOSPITAL= 'Services/Patients.svc/REST/Patient_GetProjectAvgERWaitingTime'; ///Er Nearest -const GET_AMBULANCE_REQUEST= - 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod'; +const GET_AMBULANCE_REQUEST= 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod'; +const GET_PATIENT_ALL_PRES_ORDERS= 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; +const GET_PICK_UP_REQUEST_BY_PRES_ORDER_ID= 'Services/Patients.svc/REST/PatientER_RRT_GetPickUpRequestByPresOrderID'; ///FindUs @@ -145,8 +146,7 @@ const GET_PATIENT_SHARE = "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNO"; //URL to get patient appointment history -const GET_PATIENT_APPOINTMENT_HISTORY = - "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; +const GET_PATIENT_APPOINTMENT_HISTORY = "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; //URL to get patient appointment curfew history const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 2f958d56..b13210a7 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -569,6 +569,15 @@ const Map> localizedValues = { "All":{"en":"All","ar":"الكل"}, "QuestionHere":{"en":"Enter the question here...","ar":"اضف الاستفسار هنا"}, "ViewDoctorResponses":{"en":"View Doctor Responses","ar":"الاطلاع على ردود الأطباء"}, - + "ServiceInformationButton":{"en":"LOGIN / REGISTER","ar":"دخول / تسجيل"}, + "ServiceInformationTitle":{"en":"Service Information","ar":"معلومات الخدمة"}, + "info-lab": { + "en": "This service allows you to view the results of all laboratory tests performed in Al Habib Medical Group as well as sending the report via e-mail.", + "ar": "خدمة نتائج المختبر: هذه الخدمة تمكنك من الاطلاع على نتائج جميع الفحوصات المخبرية التي تمت في مجموعة الحبيب الطبية." + }, + "info-radiology": { + "en": "This service allows you to view the reports and photos of radiology in Al Habib Medical Group as well as send the report by e-mail.", + "ar": "خدمة الاشعة: هذه الخدمة تمكنك من الاطلاع على تقارير وصور الاشعة التي تمت في مجموعة الحبيب الطبية وكذلك ارسال التقرير عن طريق الايميل." + }, }; diff --git a/lib/core/enum/Ambulate.dart b/lib/core/enum/Ambulate.dart new file mode 100644 index 00000000..f8b2e8be --- /dev/null +++ b/lib/core/enum/Ambulate.dart @@ -0,0 +1,60 @@ +import 'package:flutter/cupertino.dart'; + +enum Ambulate { Wheelchair, Walker, Stretcher, None } + +extension SelectedAmbulate on Ambulate { + String getAmbulateTitle(BuildContext context) { + switch (this) { + case Ambulate.Wheelchair: + return 'Wheelchair'; + break; + case Ambulate.Walker: + return 'Walker'; + break; + case Ambulate.Stretcher: + return 'Stretcher'; + break; + case Ambulate.None: + return 'None'; + break; + } + return 'None'; + } + + int selectAmbulateNumber() { + switch (this) { + case Ambulate.Wheelchair: + return 0; + break; + case Ambulate.Walker: + return 1; + break; + case Ambulate.Stretcher: + return 2; + break; + case Ambulate.None: + return 3; + break; + } + return 3; + } + + Ambulate getAmbulateById(int id) { + switch (id) { + case 0: + return Ambulate.Wheelchair; + break; + case 1: + return Ambulate.Walker; + break; + case 2: + return Ambulate.Stretcher; + break; + case 3: + return Ambulate.None; + break; + } + + return Ambulate.None; + } +} diff --git a/lib/core/enum/OrderService.dart b/lib/core/enum/OrderService.dart new file mode 100644 index 00000000..e6ce24eb --- /dev/null +++ b/lib/core/enum/OrderService.dart @@ -0,0 +1,22 @@ +enum OrderService { AMBULANCE } + +extension SelectedOrderService on OrderService { + int getIdOrderService() { + switch (this) { + case OrderService.AMBULANCE: + return 4; + break; + } + return 4; + } + + OrderService getOrderServiceById(int id) { + switch (id) { + case 4: + return OrderService.AMBULANCE; + break; + } + + return OrderService.AMBULANCE; + } +} diff --git a/lib/core/model/er/PatientAllPresOrders.dart b/lib/core/model/er/PatientAllPresOrders.dart new file mode 100644 index 00000000..90ce074a --- /dev/null +++ b/lib/core/model/er/PatientAllPresOrders.dart @@ -0,0 +1,132 @@ +class PatientAllPresOrders { + int iD; + String patientID; + bool patientOutSA; + bool isOutPatient; + int projectID; + int nearestProjectID; + double longitude; + double latitude; + String appointmentNo; + String dischargeID; + int lineItemNo; + int status; + String description; + String descriptionN; + String createdOn; + int serviceID; + int createdBy; + String editedOn; + int editedBy; + int channel; + dynamic clientRequestID; + bool returnedToQueue; + dynamic pickupDateTime; + dynamic pickupLocationName; + dynamic dropoffLocationName; + int realRRTHaveTransactions; + String nearestProjectDescription; + String nearestProjectDescriptionN; + String projectDescription; + String projectDescriptionN; + + PatientAllPresOrders( + {this.iD, + this.patientID, + this.patientOutSA, + this.isOutPatient, + this.projectID, + this.nearestProjectID, + this.longitude, + this.latitude, + this.appointmentNo, + this.dischargeID, + this.lineItemNo, + this.status, + this.description, + this.descriptionN, + this.createdOn, + this.serviceID, + this.createdBy, + this.editedOn, + this.editedBy, + this.channel, + this.clientRequestID, + this.returnedToQueue, + this.pickupDateTime, + this.pickupLocationName, + this.dropoffLocationName, + this.realRRTHaveTransactions, + this.nearestProjectDescription, + this.nearestProjectDescriptionN, + this.projectDescription, + this.projectDescriptionN}); + + PatientAllPresOrders.fromJson(Map json) { + iD = json['ID']; + patientID = json['PatientID']; + patientOutSA = json['PatientOutSA']; + isOutPatient = json['IsOutPatient']; + projectID = json['ProjectID']; + nearestProjectID = json['NearestProjectID']; + longitude = json['Longitude']; + latitude = json['Latitude']; + appointmentNo = json['AppointmentNo']; + dischargeID = json['DischargeID']; + lineItemNo = json['LineItemNo']; + status = json['Status']; + description = json['Description']; + descriptionN = json['DescriptionN']; + createdOn = json['CreatedOn']; + serviceID = json['ServiceID']; + createdBy = json['CreatedBy']; + editedOn = json['EditedOn']; + editedBy = json['EditedBy']; + channel = json['Channel']; + clientRequestID = json['ClientRequestID']; + returnedToQueue = json['ReturnedToQueue']; + pickupDateTime = json['PickupDateTime']; + pickupLocationName = json['PickupLocationName']; + dropoffLocationName = json['DropoffLocationName']; + realRRTHaveTransactions = json['RealRRT_HaveTransactions']; + nearestProjectDescription = json['NearestProjectDescription']; + nearestProjectDescriptionN = json['NearestProjectDescriptionN']; + projectDescription = json['ProjectDescription']; + projectDescriptionN = json['ProjectDescriptionN']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['PatientID'] = this.patientID; + data['PatientOutSA'] = this.patientOutSA; + data['IsOutPatient'] = this.isOutPatient; + data['ProjectID'] = this.projectID; + data['NearestProjectID'] = this.nearestProjectID; + data['Longitude'] = this.longitude; + data['Latitude'] = this.latitude; + data['AppointmentNo'] = this.appointmentNo; + data['DischargeID'] = this.dischargeID; + data['LineItemNo'] = this.lineItemNo; + data['Status'] = this.status; + data['Description'] = this.description; + data['DescriptionN'] = this.descriptionN; + data['CreatedOn'] = this.createdOn; + data['ServiceID'] = this.serviceID; + data['CreatedBy'] = this.createdBy; + data['EditedOn'] = this.editedOn; + data['EditedBy'] = this.editedBy; + data['Channel'] = this.channel; + data['ClientRequestID'] = this.clientRequestID; + data['ReturnedToQueue'] = this.returnedToQueue; + data['PickupDateTime'] = this.pickupDateTime; + data['PickupLocationName'] = this.pickupLocationName; + data['DropoffLocationName'] = this.dropoffLocationName; + data['RealRRT_HaveTransactions'] = this.realRRTHaveTransactions; + data['NearestProjectDescription'] = this.nearestProjectDescription; + data['NearestProjectDescriptionN'] = this.nearestProjectDescriptionN; + data['ProjectDescription'] = this.projectDescription; + data['ProjectDescriptionN'] = this.projectDescriptionN; + return data; + } +} diff --git a/lib/core/model/er/PatientER.dart b/lib/core/model/er/PatientER.dart new file mode 100644 index 00000000..d0827311 --- /dev/null +++ b/lib/core/model/er/PatientER.dart @@ -0,0 +1,207 @@ +import 'package:diplomaticquarterapp/core/enum/Ambulate.dart'; + +import 'get_all_transportation_method_list_model.dart'; + +class PatientER { + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int patientID; + String tokenID; + int patientTypeID; + int patientType; + int orderServiceID; + String patientIdentificationID; + int direction; + bool haveAppointment; + int tripType; + int pickupUrgency; + int pickupSpot; + String pickupDateTime; + int transportationMethodId; + int selectedAmbulate; + String requesterNote; + int requesterFileNo; + String requesterMobileNo; + bool requesterIsOutSA; + int isOutPatient; + String pickupLocationName; + String dropoffLocationName; + int projectID; + int createdBy; + int lineItemNo; + int cost; + double vAT; + double totalPrice; + String pickupLocationLattitude; + String pickupLocationLongitude; + String dropoffLocationLattitude; + String dropoffLocationLongitude; + String latitude; + String longitude; + String appointmentNo; + dynamic appointmentClinicName; + dynamic appointmentDoctorName; + dynamic appointmentBranch; + dynamic appointmentTime; + PatientERTransportationMethod patientERTransportationMethod; + Ambulate ambulate; + PatientER( + {this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType, + this.orderServiceID = 4, + this.patientIdentificationID, + this.direction, + this.haveAppointment, + this.tripType, + this.pickupUrgency, + this.pickupSpot, + this.pickupDateTime, + this.transportationMethodId, + this.selectedAmbulate, + this.requesterNote, + this.requesterFileNo, + this.requesterMobileNo, + this.requesterIsOutSA, + this.isOutPatient, + this.pickupLocationName, + this.dropoffLocationName, + this.projectID, + this.createdBy, + this.lineItemNo, + this.cost, + this.vAT, + this.totalPrice, + this.pickupLocationLattitude, + this.pickupLocationLongitude, + this.dropoffLocationLattitude, + this.dropoffLocationLongitude, + this.latitude, + this.longitude, + this.appointmentNo, + this.appointmentClinicName, + this.appointmentDoctorName, + this.appointmentBranch, + this.appointmentTime, + this.patientERTransportationMethod, + this.ambulate}); + + PatientER.fromJson(Map json) { + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + patientID = json['PatientID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + orderServiceID = json['OrderServiceID']; + patientIdentificationID = json['PatientIdentificationID']; + direction = json['Direction']; + haveAppointment = json['HaveAppointment']; + tripType = json['TripType']; + pickupUrgency = json['PickupUrgency']; + pickupSpot = json['PickupSpot']; + pickupDateTime = json['PickupDateTime']; + transportationMethodId = json['TransportationMethodId']; + selectedAmbulate = json['SelectedAmbulate']; + requesterNote = json['RequesterNote']; + requesterFileNo = json['RequesterFileNo']; + requesterMobileNo = json['RequesterMobileNo']; + requesterIsOutSA = json['RequesterIsOutSA']; + isOutPatient = json['IsOutPatient']; + pickupLocationName = json['PickupLocationName']; + dropoffLocationName = json['DropoffLocationName']; + projectID = json['ProjectID']; + createdBy = json['CreatedBy']; + lineItemNo = json['LineItemNo']; + cost = json['Cost']; + vAT = json['VAT']; + totalPrice = json['TotalPrice']; + pickupLocationLattitude = json['PickupLocationLattitude']; + pickupLocationLongitude = json['PickupLocationLongitude']; + dropoffLocationLattitude = json['DropoffLocationLattitude']; + dropoffLocationLongitude = json['DropoffLocationLongitude']; + latitude = json['Latitude']; + longitude = json['Longitude']; + appointmentNo = json['AppointmentNo']; + appointmentClinicName = json['AppointmentClinicName']; + appointmentDoctorName = json['AppointmentDoctorName']; + appointmentBranch = json['AppointmentBranch']; + appointmentTime = json['AppointmentTime']; + } + + Map toJson() { + final Map data = new Map(); + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['PatientID'] = this.patientID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + data['OrderServiceID'] = this.orderServiceID; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['Direction'] = this.direction; + data['HaveAppointment'] = this.haveAppointment; + data['TripType'] = this.tripType; + data['PickupUrgency'] = this.pickupUrgency; + data['PickupSpot'] = this.pickupSpot; + data['PickupDateTime'] = this.pickupDateTime; + data['TransportationMethodId'] = this.transportationMethodId; + data['SelectedAmbulate'] = this.selectedAmbulate; + data['RequesterNote'] = this.requesterNote; + data['RequesterFileNo'] = this.requesterFileNo; + data['RequesterMobileNo'] = this.requesterMobileNo; + data['RequesterIsOutSA'] = this.requesterIsOutSA; + data['IsOutPatient'] = this.isOutPatient; + data['PickupLocationName'] = this.pickupLocationName; + data['DropoffLocationName'] = this.dropoffLocationName; + data['ProjectID'] = this.projectID; + data['CreatedBy'] = this.createdBy; + data['LineItemNo'] = this.lineItemNo; + data['Cost'] = this.cost; + data['VAT'] = this.vAT; + data['TotalPrice'] = this.totalPrice; + data['PickupLocationLattitude'] = this.pickupLocationLattitude; + data['PickupLocationLongitude'] = this.pickupLocationLongitude; + data['DropoffLocationLattitude'] = this.dropoffLocationLattitude; + data['DropoffLocationLongitude'] = this.dropoffLocationLongitude; + data['Latitude'] = this.latitude; + data['Longitude'] = this.longitude; + data['AppointmentNo'] = this.appointmentNo; + data['AppointmentClinicName'] = this.appointmentClinicName; + data['AppointmentDoctorName'] = this.appointmentDoctorName; + data['AppointmentBranch'] = this.appointmentBranch; + data['AppointmentTime'] = this.appointmentTime; + return data; + } +} diff --git a/lib/core/model/er/PickUpRequestPresOrder.dart b/lib/core/model/er/PickUpRequestPresOrder.dart new file mode 100644 index 00000000..9ce3e678 --- /dev/null +++ b/lib/core/model/er/PickUpRequestPresOrder.dart @@ -0,0 +1,204 @@ +class PickUpRequestPresOrder { + int id; + int presOrderID; + String createDate; + String lastEditDate; + int createdBy; + int lastEditBy; + bool isActive; + String requestNo; + int requesterId; + int direction; + bool haveAppointment; + dynamic appointmentId; + int tripType; + int pickupUrgency; + String pickupDateTime; + dynamic pickupLocationId; + int pickupSpot; + dynamic dropoffLocationId; + int transportationMethodId; + int cost; + double vAT; + double totalPrice; + int amountCollected; + int selectedAmbulate; + String requesterNote; + int status; + int paymentStatus; + dynamic rejectReason; + int visibility; + dynamic durationId; + dynamic imageId; + String requesterFileNo; + String requesterMobileNo; + bool requesterIsOutSA; + String pickupLocationLongitude; + String pickupLocationLattitude; + String dropoffLocationLongitude; + String dropoffLocationLattitude; + dynamic appointmentClinicName; + dynamic appointmentDoctorName; + dynamic appointmentBranch; + dynamic appointmentTime; + String pickupLocationName; + String dropoffLocationName; + String title; + String titleAR; + String ambulateDescription; + String ambulateDescriptionN; + + PickUpRequestPresOrder( + {this.id, + this.presOrderID, + this.createDate, + this.lastEditDate, + this.createdBy, + this.lastEditBy, + this.isActive, + this.requestNo, + this.requesterId, + this.direction, + this.haveAppointment, + this.appointmentId, + this.tripType, + this.pickupUrgency, + this.pickupDateTime, + this.pickupLocationId, + this.pickupSpot, + this.dropoffLocationId, + this.transportationMethodId, + this.cost, + this.vAT, + this.totalPrice, + this.amountCollected, + this.selectedAmbulate, + this.requesterNote, + this.status, + this.paymentStatus, + this.rejectReason, + this.visibility, + this.durationId, + this.imageId, + this.requesterFileNo, + this.requesterMobileNo, + this.requesterIsOutSA, + this.pickupLocationLongitude, + this.pickupLocationLattitude, + this.dropoffLocationLongitude, + this.dropoffLocationLattitude, + this.appointmentClinicName, + this.appointmentDoctorName, + this.appointmentBranch, + this.appointmentTime, + this.pickupLocationName, + this.dropoffLocationName, + this.title, + this.titleAR, + this.ambulateDescription, + this.ambulateDescriptionN}); + + PickUpRequestPresOrder.fromJson(Map json) { + id = json['Id']; + presOrderID = json['PresOrderID']; + createDate = json['CreateDate']; + lastEditDate = json['LastEditDate']; + createdBy = json['CreatedBy']; + lastEditBy = json['LastEditBy']; + isActive = json['IsActive']; + requestNo = json['RequestNo']; + requesterId = json['RequesterId']; + direction = json['Direction']; + haveAppointment = json['HaveAppointment']; + appointmentId = json['AppointmentId']; + tripType = json['TripType']; + pickupUrgency = json['PickupUrgency']; + pickupDateTime = json['PickupDateTime']; + pickupLocationId = json['PickupLocationId']; + pickupSpot = json['PickupSpot']; + dropoffLocationId = json['DropoffLocationId']; + transportationMethodId = json['TransportationMethodId']; + cost = json['Cost']; + vAT = json['VAT']; + totalPrice = json['TotalPrice']; + amountCollected = json['AmountCollected']; + selectedAmbulate = json['SelectedAmbulate']; + requesterNote = json['RequesterNote']; + status = json['Status']; + paymentStatus = json['PaymentStatus']; + rejectReason = json['RejectReason']; + visibility = json['Visibility']; + durationId = json['DurationId']; + imageId = json['ImageId']; + requesterFileNo = json['RequesterFileNo']; + requesterMobileNo = json['RequesterMobileNo']; + requesterIsOutSA = json['RequesterIsOutSA']; + pickupLocationLongitude = json['PickupLocationLongitude']; + pickupLocationLattitude = json['PickupLocationLattitude']; + dropoffLocationLongitude = json['DropoffLocationLongitude']; + dropoffLocationLattitude = json['DropoffLocationLattitude']; + appointmentClinicName = json['AppointmentClinicName']; + appointmentDoctorName = json['AppointmentDoctorName']; + appointmentBranch = json['AppointmentBranch']; + appointmentTime = json['AppointmentTime']; + pickupLocationName = json['PickupLocationName']; + dropoffLocationName = json['DropoffLocationName']; + title = json['Title']; + titleAR = json['TitleAR']; + ambulateDescription = json['AmbulateDescription']; + ambulateDescriptionN = json['AmbulateDescriptionN']; + } + + Map toJson() { + final Map data = new Map(); + data['Id'] = this.id; + data['PresOrderID'] = this.presOrderID; + data['CreateDate'] = this.createDate; + data['LastEditDate'] = this.lastEditDate; + data['CreatedBy'] = this.createdBy; + data['LastEditBy'] = this.lastEditBy; + data['IsActive'] = this.isActive; + data['RequestNo'] = this.requestNo; + data['RequesterId'] = this.requesterId; + data['Direction'] = this.direction; + data['HaveAppointment'] = this.haveAppointment; + data['AppointmentId'] = this.appointmentId; + data['TripType'] = this.tripType; + data['PickupUrgency'] = this.pickupUrgency; + data['PickupDateTime'] = this.pickupDateTime; + data['PickupLocationId'] = this.pickupLocationId; + data['PickupSpot'] = this.pickupSpot; + data['DropoffLocationId'] = this.dropoffLocationId; + data['TransportationMethodId'] = this.transportationMethodId; + data['Cost'] = this.cost; + data['VAT'] = this.vAT; + data['TotalPrice'] = this.totalPrice; + data['AmountCollected'] = this.amountCollected; + data['SelectedAmbulate'] = this.selectedAmbulate; + data['RequesterNote'] = this.requesterNote; + data['Status'] = this.status; + data['PaymentStatus'] = this.paymentStatus; + data['RejectReason'] = this.rejectReason; + data['Visibility'] = this.visibility; + data['DurationId'] = this.durationId; + data['ImageId'] = this.imageId; + data['RequesterFileNo'] = this.requesterFileNo; + data['RequesterMobileNo'] = this.requesterMobileNo; + data['RequesterIsOutSA'] = this.requesterIsOutSA; + data['PickupLocationLongitude'] = this.pickupLocationLongitude; + data['PickupLocationLattitude'] = this.pickupLocationLattitude; + data['DropoffLocationLongitude'] = this.dropoffLocationLongitude; + data['DropoffLocationLattitude'] = this.dropoffLocationLattitude; + data['AppointmentClinicName'] = this.appointmentClinicName; + data['AppointmentDoctorName'] = this.appointmentDoctorName; + data['AppointmentBranch'] = this.appointmentBranch; + data['AppointmentTime'] = this.appointmentTime; + data['PickupLocationName'] = this.pickupLocationName; + data['DropoffLocationName'] = this.dropoffLocationName; + data['Title'] = this.title; + data['TitleAR'] = this.titleAR; + data['AmbulateDescription'] = this.ambulateDescription; + data['AmbulateDescriptionN'] = this.ambulateDescriptionN; + return data; + } +} diff --git a/lib/core/model/er/get_all_transportation_method_list_model.dart b/lib/core/model/er/get_all_transportation_method_list_model.dart index 3402873e..ebc9caf7 100644 --- a/lib/core/model/er/get_all_transportation_method_list_model.dart +++ b/lib/core/model/er/get_all_transportation_method_list_model.dart @@ -1,23 +1,23 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -class PatientER_RRT_GetAllTransportationMethodListModel { - int id; +class PatientERTransportationMethod { + dynamic id; DateTime createDate; DateTime lastEditDate; - int createdBy; - int lastEditBy; + dynamic createdBy; + dynamic lastEditBy; bool isActive; String title; String titleAR; - int price; - Null isDefault; - int visibility; - Null durationId; + dynamic price; + dynamic isDefault; + dynamic visibility; + dynamic durationId; String description; String descriptionAR; - int totalPrice; - int vAT; + dynamic totalPrice; + dynamic vAT; - PatientER_RRT_GetAllTransportationMethodListModel( + PatientERTransportationMethod( { this.id, this.createDate, @@ -36,7 +36,7 @@ class PatientER_RRT_GetAllTransportationMethodListModel { this.totalPrice, this.vAT}); - PatientER_RRT_GetAllTransportationMethodListModel.fromJson( + PatientERTransportationMethod.fromJson( Map json) { id = json['Id']; createDate = DateUtil.convertStringToDate(json['CreateDate']); diff --git a/lib/core/service/AuthenticatedUserObject.dart b/lib/core/service/AuthenticatedUserObject.dart index 1aaa4755..600e17e1 100644 --- a/lib/core/service/AuthenticatedUserObject.dart +++ b/lib/core/service/AuthenticatedUserObject.dart @@ -2,16 +2,17 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -class AuthenticatedUserObject{ +class AuthenticatedUserObject { AuthenticatedUser user; AppSharedPreferences sharedPref = AppSharedPreferences(); bool isLogin = false; - AuthenticatedUserObject(){ + + AuthenticatedUserObject() { getUser(); } getUser() async { - if (user==null) { + if (user == null) { var userData = await sharedPref.getObject(USER_PROFILE); if (userData != null) user = AuthenticatedUser.fromJson(userData); } @@ -20,4 +21,7 @@ class AuthenticatedUserObject{ this.isLogin = isLogin != null; } + logout() async { + isLogin = false; + } } diff --git a/lib/core/service/base_service.dart b/lib/core/service/base_service.dart index f2820dc1..fdb80604 100644 --- a/lib/core/service/base_service.dart +++ b/lib/core/service/base_service.dart @@ -17,6 +17,7 @@ class BaseService { AppSharedPreferences sharedPref = AppSharedPreferences(); BaseService() { + authenticatedUserObject.getUser(); user = authenticatedUserObject.user; // getUser(); } diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index f5494049..4ad8de79 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -15,7 +15,7 @@ AppSharedPreferences sharedPref = new AppSharedPreferences(); ///await BaseAppClient.post('', /// onSuccess: (dynamic response, int statusCode) {}, /// onFailure: (String error, int statusCode) {}, -/// body: null); +/// body: Map(); class BaseAppClient { post(String endPoint, @@ -78,7 +78,7 @@ class BaseAppClient { print("URL : $url"); print("Body : ${json.encode(body)}"); - var asd=""; + if (await Utils.checkConnection()) { final response = await http.post(url.trim(), body: json.encode(body), diff --git a/lib/core/service/er/am_service.dart b/lib/core/service/er/am_service.dart index 181ad37b..b654e0eb 100644 --- a/lib/core/service/er/am_service.dart +++ b/lib/core/service/er/am_service.dart @@ -1,25 +1,76 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; +import 'package:diplomaticquarterapp/core/model/er/PatientAllPresOrders.dart'; +import 'package:diplomaticquarterapp/core/model/er/PickUpRequestPresOrder.dart'; import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; import '../base_service.dart'; class AmService extends BaseService { - List AmModelList = List(); - Map body = Map(); + List amModelList = List(); + List patientAllPresOrdersList = List(); + bool hasPendingOrder = false; + int pendingOrderID = 0; + String pendingOrderStatus = ""; + String pendingOrderStatusAR = ""; + PickUpRequestPresOrder pickUpRequestPresOrder; Future getAllTransportationOrders() async { hasError = false; - + Map body = Map(); + body['isDentalAllowedBackend'] = false; + body['IdentificationNo'] = user.patientIdentificationNo; await baseAppClient.post(GET_AMBULANCE_REQUEST, onSuccess: (dynamic response, int statusCode) { - AmModelList.clear(); - response['AmModelList'].forEach((vital) { - AmModelList.add( - PatientER_RRT_GetAllTransportationMethodListModel.fromJson(vital)); + amModelList.clear(); + response['PatientER_RRT_GetAllTransportationMethodList'].forEach((item) { + amModelList.add(PatientERTransportationMethod.fromJson(item)); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } + + Future getPatientAllPresOrdersList() async { + hasError = false; + hasPendingOrder = false; + await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, + onSuccess: (dynamic response, int statusCode) { + patientAllPresOrdersList.clear(); + response['PatientER_GetPatientAllPresOrdersList'].forEach((item) { + if (item['ServiceID'] == OrderService.AMBULANCE.getIdOrderService()) { + var order = PatientAllPresOrders.fromJson(item); + patientAllPresOrdersList.add(order); + if (order.status == 1) { + hasPendingOrder = true; + pendingOrderID = order.iD; + pendingOrderStatus = order.description; + pendingOrderStatusAR = order.descriptionN; + } + } + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map()); + } + + Future getOrderDetails() async { + hasError = false; + hasPendingOrder = false; + Map body = Map(); + body['PresOrderID'] = pendingOrderID; + await baseAppClient.post(GET_PICK_UP_REQUEST_BY_PRES_ORDER_ID, + onSuccess: (dynamic response, int statusCode) { + patientAllPresOrdersList.clear(); + response['PatientER_RRT_GetPickUpRequestByPresOrderIDList'] + .forEach((item) { + pickUpRequestPresOrder = PickUpRequestPresOrder.fromJson(item); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map()); + } } diff --git a/lib/core/service/medical/medical_service.dart b/lib/core/service/medical/medical_service.dart index 90230f6d..f90280cf 100644 --- a/lib/core/service/medical/medical_service.dart +++ b/lib/core/service/medical/medical_service.dart @@ -1,13 +1,20 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:flutter/cupertino.dart'; class MedicalService extends BaseService { List appoitmentAllHistoryResultList = List(); - getAppointmentHistory() async { + getAppointmentHistory({bool isActiveAppointment = false}) async { hasError = false; super.error = ""; + Map body = Map(); + if(isActiveAppointment) { + body['IsActiveAppointment'] = true; + body['isDentalAllowedBackend'] = false; + } await baseAppClient.post(GET_PATIENT_APPOINTMENT_HISTORY, onSuccess: (response, statusCode) async { @@ -19,6 +26,23 @@ class MedicalService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: Map()); + }, body: body); + } + + addAmbulanceRequest({@required PatientER patientER}) async { + hasError = false; + super.error = ""; + Map body = Map(); + body['RequesterFileNo'] = user.patientID; + body['RequesterMobileNo'] = user.mobileNumber; + body['RequesterIsOutSA'] = user.outSA; + await baseAppClient.post(GET_PATIENT_APPOINTMENT_HISTORY, + onSuccess: (response, statusCode) async { + + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); } } diff --git a/lib/core/viewModels/base_view_model.dart b/lib/core/viewModels/base_view_model.dart index 7e16d22d..18ab02e3 100644 --- a/lib/core/viewModels/base_view_model.dart +++ b/lib/core/viewModels/base_view_model.dart @@ -18,6 +18,7 @@ class BaseViewModel extends ChangeNotifier { AuthenticatedUser user; AppSharedPreferences sharedPref = AppSharedPreferences(); + AuthenticatedUserObject authenticatedUserObject = locator(); void setState(ViewState viewState) { _state = viewState; diff --git a/lib/core/viewModels/er/am_request_view_model.dart b/lib/core/viewModels/er/am_request_view_model.dart index db1acbf0..fbd3d95d 100644 --- a/lib/core/viewModels/er/am_request_view_model.dart +++ b/lib/core/viewModels/er/am_request_view_model.dart @@ -1,32 +1,82 @@ - import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/er/PatientAllPresOrders.dart'; import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/service/er/am_service.dart'; +import 'package:diplomaticquarterapp/core/service/hospital_service.dart'; +import 'package:diplomaticquarterapp/core/service/medical/medical_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import '../base_view_model.dart'; import '../../../locator.dart'; -class AmRequestViewModel extends BaseViewModel{ +class AmRequestViewModel extends BaseViewModel { + AmService _amService = locator(); + HospitalService _hospitalService = locator(); + MedicalService _medicalService = locator(); + List get amRequestModeList => + _amService.amModelList; - AmService _amService = locator(); + List get patientAllPresOrdersList => + _amService.patientAllPresOrdersList; - List get AmRequestModeList=> - _amService.AmModelList; + List get appoitmentAllHistoryResultList => + _medicalService.appoitmentAllHistoryResultList; - getAmRequestOrders({int id, int projectID}) async { - setState(ViewState.Busy); + List get hospitals => _hospitalService.hospitals; + bool get hasPendingOrder =>_amService.hasPendingOrder; - await _amService.getAllTransportationOrders(); + Future getAppointmentHistory() async { + setState(ViewState.BusyLocal); + await _medicalService.getAppointmentHistory(isActiveAppointment: true); + if (_medicalService.hasError) { + error = _medicalService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } - if ( _amService.hasError) { - error = _amService.error; + Future getAmRequestOrders() async { + setState(ViewState.Busy); + await _amService.getAllTransportationOrders(); + if (_amService.hasError) { + error = _amService.error; setState(ViewState.Error); } else - setState(ViewState.Idle); + getHospitals(); } + Future getHospitals() async { + setState(ViewState.Busy); + await _hospitalService.getHospitals(); + if (_hospitalService.hasError) { + error = _hospitalService.error; + setState(ViewState.Error); + } else + getPatientAllPresOrdersList(); + } + Future getPatientAllPresOrdersList() async { + setState(ViewState.Busy); + await _amService.getPatientAllPresOrdersList(); + if (_hospitalService.hasError) { + error = _hospitalService.error; + setState(ViewState.Error); + } else if (_amService.hasPendingOrder) { + getOrderDetails(); + } else + setState(ViewState.Idle); + } -} \ No newline at end of file + Future getOrderDetails() async { + setState(ViewState.Busy); + await _amService.getOrderDetails(); + if (_hospitalService.hasError) { + error = _hospitalService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index 032aeb1e..8cbf0efc 100644 --- a/lib/core/viewModels/medical/labs_view_model.dart +++ b/lib/core/viewModels/medical/labs_view_model.dart @@ -21,52 +21,54 @@ class LabsViewModel extends BaseViewModel { : _patientLabOrdersListHospital; void getLabs() async { - setState(ViewState.Busy); - await _labsService.getPatientLabOrdersList(); - if (_labsService.hasError) { - error = _labsService.error; - setState(ViewState.Error); - } else { - _labsService.patientLabOrdersList.forEach((element) { - List patientLabOrdersClinic = - _patientLabOrdersListClinic - .where((elementClinic) => - elementClinic.filterName == element.clinicDescription) - .toList(); + if (authenticatedUserObject.isLogin) { + setState(ViewState.Busy); + await _labsService.getPatientLabOrdersList(); + if (_labsService.hasError) { + error = _labsService.error; + setState(ViewState.Error); + } else { + _labsService.patientLabOrdersList.forEach((element) { + List patientLabOrdersClinic = + _patientLabOrdersListClinic + .where((elementClinic) => + elementClinic.filterName == element.clinicDescription) + .toList(); - if (patientLabOrdersClinic.length != 0) { - _patientLabOrdersListClinic[_patientLabOrdersListClinic - .indexOf(patientLabOrdersClinic[0])] - .patientLabOrdersList - .add(element); - } else { - _patientLabOrdersListClinic.add(PatientLabOrdersList( - filterName: element.clinicDescription, - patientDoctorAppointment: element)); - } + if (patientLabOrdersClinic.length != 0) { + _patientLabOrdersListClinic[_patientLabOrdersListClinic + .indexOf(patientLabOrdersClinic[0])] + .patientLabOrdersList + .add(element); + } else { + _patientLabOrdersListClinic.add(PatientLabOrdersList( + filterName: element.clinicDescription, + patientDoctorAppointment: element)); + } - // doctor list sort via project - List patientLabOrdersHospital = - _patientLabOrdersListHospital - .where( - (elementClinic) => - elementClinic.filterName == element.projectName, - ) - .toList(); + // doctor list sort via project + List patientLabOrdersHospital = + _patientLabOrdersListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.projectName, + ) + .toList(); - if (patientLabOrdersHospital.length != 0) { - _patientLabOrdersListHospital[_patientLabOrdersListHospital - .indexOf(patientLabOrdersHospital[0])] - .patientLabOrdersList - .add(element); - } else { - _patientLabOrdersListHospital.add(PatientLabOrdersList( - filterName: element.projectName, - patientDoctorAppointment: element)); - } - }); + if (patientLabOrdersHospital.length != 0) { + _patientLabOrdersListHospital[_patientLabOrdersListHospital + .indexOf(patientLabOrdersHospital[0])] + .patientLabOrdersList + .add(element); + } else { + _patientLabOrdersListHospital.add(PatientLabOrdersList( + filterName: element.projectName, + patientDoctorAppointment: element)); + } + }); - setState(ViewState.Idle); + setState(ViewState.Idle); + } } } diff --git a/lib/core/viewModels/medical/medical_view_model.dart b/lib/core/viewModels/medical/medical_view_model.dart index fa330aad..f8b14c6e 100644 --- a/lib/core/viewModels/medical/medical_view_model.dart +++ b/lib/core/viewModels/medical/medical_view_model.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/medical/medical_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; @@ -11,13 +12,15 @@ class MedicalViewModel extends BaseViewModel { _medicalService.appoitmentAllHistoryResultList; getAppointmentHistory() async { - setState(ViewState.Busy); - if (_medicalService.appoitmentAllHistoryResultList.length == 0) - await _medicalService.getAppointmentHistory(); - if (_medicalService.hasError) { - error = _medicalService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); + if (authenticatedUserObject.isLogin) { + setState(ViewState.Busy); + if (_medicalService.appoitmentAllHistoryResultList.length == 0) + await _medicalService.getAppointmentHistory(); + if (_medicalService.hasError) { + error = _medicalService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } } } diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index e1bc0af7..51624d63 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -41,6 +41,7 @@ class _AllHabibMedicalServiceState extends State { return AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).alhabiServices, + isShowDecPage: false, body: Column( children: [ Expanded( diff --git a/lib/pages/ContactUs/hmg_service.dart b/lib/pages/ContactUs/contact_us_page.dart similarity index 93% rename from lib/pages/ContactUs/hmg_service.dart rename to lib/pages/ContactUs/contact_us_page.dart index 4f19e8f8..7d2192f9 100644 --- a/lib/pages/ContactUs/hmg_service.dart +++ b/lib/pages/ContactUs/contact_us_page.dart @@ -6,12 +6,12 @@ import 'package:flutter/material.dart'; import '../../uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/pages/ErService/widgets/card_common.dart'; -class HmgServicePage extends StatefulWidget { +class ContactUsPage extends StatefulWidget { @override - _HmgServicePageState createState() => _HmgServicePageState(); + _ContactUsPageState createState() => _ContactUsPageState(); } -class _HmgServicePageState extends State { +class _ContactUsPageState extends State { LocationUtils locationUtils; @@ -29,6 +29,7 @@ class _HmgServicePageState extends State { return AppScaffold( isShowAppBar: true,//widget.isAppbar, appBarTitle: "HMG Services",//TranslationBase.of(context).bookAppo, + isShowDecPage: false, body: Container( margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0), child: Column( diff --git a/lib/pages/ErService/AmbulanceReq.dart b/lib/pages/ErService/AmbulanceReq.dart index 9c4dfa29..ec96f482 100644 --- a/lib/pages/ErService/AmbulanceReq.dart +++ b/lib/pages/ErService/AmbulanceReq.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_page.dart'; @@ -9,6 +10,9 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart'; +import 'OrderLogPage.dart'; + class AmbulanceReq extends StatefulWidget { @override _AmbulanceReqState createState() => _AmbulanceReqState(); @@ -23,18 +27,21 @@ class _AmbulanceReqState extends State super.initState(); _tabController = TabController(length: 2, vsync: this); } + @override void dispose() { super.dispose(); _tabController.dispose(); } + @override Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) => model.getPrescriptions(), + return BaseView( + onModelReady: (model) => model.getAmRequestOrders(), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, appBarTitle: "Ambulance Request", + baseViewModel: model, body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( @@ -76,13 +83,14 @@ class _AmbulanceReqState extends State indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, labelPadding: - EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), + EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), unselectedLabelColor: Colors.grey[800], tabs: [ Container( width: MediaQuery.of(context).size.width * 0.40, child: Center( - child: Texts("Ambulance Request"),//TranslationBase.of(context).prescriptions + child: Texts( + "Ambulance Request"), //TranslationBase.of(context).prescriptions ), ), Container( @@ -106,11 +114,13 @@ class _AmbulanceReqState extends State physics: BouncingScrollPhysics(), controller: _tabController, children: [ - PrescriptionsPage( - prescriptionsViewModel: model, - ), - PrescriptionsHistoryPage( - prescriptionsViewModel: model, + model.hasPendingOrder + ? Container() + : AmbulanceRequestIndexPage( + amRequestViewModel: model, + ), + OrderLogPage( + amRequestViewModel: model, ) ], ), @@ -121,5 +131,4 @@ class _AmbulanceReqState extends State ), ); } - } diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart new file mode 100644 index 00000000..55e75e22 --- /dev/null +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart @@ -0,0 +1,87 @@ +import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; +import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/pages/ErService/widgets/StepsWidget.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; + +import 'BillAmount.dart'; +import 'PickupLocation.dart'; +import 'SelectTransportationMethod.dart'; +import 'Summary.dart'; + +class AmbulanceRequestIndexPage extends StatefulWidget { + final AmRequestViewModel amRequestViewModel; + + AmbulanceRequestIndexPage({Key key, this.amRequestViewModel}); + + @override + _AmbulanceRequestIndexPageState createState() => _AmbulanceRequestIndexPageState(); +} + +class _AmbulanceRequestIndexPageState extends State { + int currentIndex = 0; + PageController pageController; + PatientER _patientER = PatientER(); + + _changeCurrentTab(int tab) { + setState(() { + currentIndex = tab; + }); + pageController.animateToPage(tab, + duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart); + } + + @override + void initState() { + super.initState(); + pageController = new PageController(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + body: Column( + children: [ + SizedBox( + height: 80, + ), + Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: StepsWidget( + index: currentIndex, + changeCurrentTab: _changeCurrentTab, + )), + Expanded( + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: pageController, + children: [ + //Container(), + SelectTransportationMethod( + changeCurrentTab: _changeCurrentTab, + patientER: _patientER, + amRequestViewModel: widget.amRequestViewModel, + ), + PickupLocation( + changeCurrentTab: _changeCurrentTab, + patientER: _patientER, + amRequestViewModel: widget.amRequestViewModel, + ), + BillAmount( + changeCurrentTab: _changeCurrentTab, + patientER: _patientER, + amRequestViewModel: widget.amRequestViewModel, + ), + Summary( + changeCurrentTab: _changeCurrentTab, + patientER: _patientER, + amRequestViewModel: widget.amRequestViewModel, + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart new file mode 100644 index 00000000..cc6af0f2 --- /dev/null +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart @@ -0,0 +1,351 @@ +import 'package:diplomaticquarterapp/core/enum/Ambulate.dart'; +import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; +import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + + +class BillAmount extends StatefulWidget { + final Function changeCurrentTab; + final PatientER patientER; + final AmRequestViewModel amRequestViewModel; + + BillAmount( + {Key key, + this.changeCurrentTab, + this.patientER, + this.amRequestViewModel}); + + @override + _BillAmountState createState() => _BillAmountState(); +} + +class _BillAmountState extends State { + Ambulate _ambulate = Ambulate.None; + String note =""; + + + @override + void initState() { + + if(widget.patientER.ambulate!=null) + { + setState(() { + _ambulate = widget.patientER.ambulate; + note = widget.patientER.requesterNote; + }); + } + super.initState(); + } + + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Bill Amount '), + SizedBox( + height: 10, + ), + Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 1.0, color: Colors.grey[300]), + outside: BorderSide(width: 1.0, color: Colors.grey[300])), + children: [ + TableRow( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.09, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10.0), + ), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + 'Amount before tax: ', + textAlign: TextAlign.start, + color: Colors.black, + fontSize: 15, + ), + ), + ), + Container( + height: MediaQuery.of(context).size.height * 0.09, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topRight: Radius.circular(10.0), + ), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + 'SR ${widget.patientER.patientERTransportationMethod.price}', + color: Colors.black, + textAlign: TextAlign.start, + fontSize: 15, + ), + ), + ), + ], + ), + TableRow( + children: [ + Container( + color: Colors.white, + height: MediaQuery.of(context).size.height * 0.09, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + 'Tax amount :', + color: Colors.black, + fontSize: 15, + textAlign: TextAlign.start, + ), + ), + ), + Container( + height: MediaQuery.of(context).size.height * 0.09, + color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + 'SR ${widget.patientER.patientERTransportationMethod.vAT}', + color: Colors.black, + fontSize: 15, + textAlign: TextAlign.start, + ), + ), + ), + ], + ), + TableRow( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.09, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(10.0), + ), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + 'Total amount payable', + color: Colors.black, + fontSize: 15, + textAlign: TextAlign.start, + bold: true, + ), + ), + ), + Container( + height: MediaQuery.of(context).size.height * 0.09, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(10.0), + ), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + 'SR ${widget.patientER.patientERTransportationMethod.totalPrice}', + color: Colors.black, + fontSize: 15, + textAlign: TextAlign.start, + ), + ), + ), + ], + ), + ], + ), + SizedBox( + height: 10, + ), + Texts('Select Ambulate',bold: true,), + SizedBox(height: 5,), + Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.Wheelchair; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text('Wheelchair'), + leading: Radio( + value: Ambulate.Wheelchair, + groupValue: _ambulate, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), + ), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.Walker; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text('Walker'), + leading: Radio( + value: Ambulate.Walker, + groupValue: _ambulate, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), + ), + ), + ), + ), + ], + ), + SizedBox(height: 5,), + Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.Stretcher; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text('Stretcher'), + leading: Radio( + value: Ambulate.Stretcher, + groupValue: _ambulate, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), + ), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.None; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text('None'), + leading: Radio( + value: Ambulate.None, + groupValue: _ambulate, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), + ), + ), + ), + ), + ], + ), + SizedBox(height: 12,), + NewTextFields( + hintText: 'Note', + initialValue: note, + onChanged: (value){ + setState(() { + note = value; + }); + }, + ), + + SizedBox( + height: 15, + ), + Container( + padding: EdgeInsets.all(15), + width: double.maxFinite, + height: 76, + child: SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + setState(() { + widget.patientER.ambulate = _ambulate; + widget.patientER.requesterNote = note; + widget.patientER.selectedAmbulate = _ambulate.selectAmbulateNumber(); + widget.changeCurrentTab(3); + }); + }, + label: 'Next', + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart new file mode 100644 index 00000000..795f4dcc --- /dev/null +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart @@ -0,0 +1,473 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/pages/Blood/dialogs/SelectHospitalDialog.dart'; +import 'package:diplomaticquarterapp/pages/ErService/widgets/AppointmentCard.dart'; +import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; +import 'package:diplomaticquarterapp/uitl/ProgressDialog.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; + +import '../AmbulanceReq.dart'; +import '../AvailableAppointmentsPage.dart'; + +enum HaveAppointment { YES, NO } + +class PickupLocation extends StatefulWidget { + final Function changeCurrentTab; + final PatientER patientER; + final AmRequestViewModel amRequestViewModel; + + PickupLocation( + {Key key, + this.changeCurrentTab, + this.patientER, + this.amRequestViewModel}); + + @override + _PickupLocationState createState() => _PickupLocationState(); +} + +class _PickupLocationState extends State { + bool _isInsideHome = false; + HaveAppointment _haveAppointment = HaveAppointment.NO; + double _latitude; + double _longitude; + AppoitmentAllHistoryResultList myAppointment; + HospitalsModel _selectedHospital; + PickResult _result; + + @override + void initState() { + super.initState(); + _getCurrentLocation(); + } + + _getCurrentLocation() async { + await getLastKnownPosition().then((value) { + _latitude = value.latitude; + _longitude = value.longitude; + }).catchError((e) { + _longitude = 0; + _latitude = 0; + }); + // currentLocation = LatLng(position.latitude, position.longitude); + } + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (widget.patientER.direction == 1) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Pickup Location'), + SizedBox( + height: 15, + ), + Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts('Select From Map'), + Icon( + FontAwesomeIcons.mapMarkerAlt, + size: 24, + color: Colors.black, + ) + ], + ), + ), + SizedBox( + height: 12, + ), + Texts('Pickup Spot'), + SizedBox( + height: 5, + ), + InkWell( + onTap: () { + setState(() { + _isInsideHome = !_isInsideHome; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Texts('Inside Home'), + leading: Checkbox( + activeColor: Colors.red[800], + value: _isInsideHome, + onChanged: (value) { + setState(() { + _isInsideHome = value; + }); + }, + ), + ), + ), + ), + SizedBox( + height: 12, + ), + Texts('Do you have an appointment ?'), + SizedBox( + height: 5, + ), + Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + if (myAppointment == null) { + getAppointment(); + setState(() { + _haveAppointment = HaveAppointment.YES; + }); + } + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text('Yes'), + leading: Radio( + value: HaveAppointment.YES, + groupValue: _haveAppointment, + activeColor: Colors.red[800], + onChanged: (value) { + if (myAppointment == null) { + getAppointment(); + setState(() { + _haveAppointment = value; + }); + } + }, + ), + ), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + setState(() { + _haveAppointment = HaveAppointment.NO; + myAppointment = null; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text('No'), + leading: Radio( + value: HaveAppointment.NO, + groupValue: _haveAppointment, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _haveAppointment = value; + myAppointment = null; + }); + }, + ), + ), + ), + ), + ), + ], + ), + if (myAppointment != null) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 12, + ), + AppointmentCard( + appointment: myAppointment, + ) + ], + ), + SizedBox( + height: 12, + ), + Texts('Drop off Location'), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + confirmSelectHospitalDialog( + widget.amRequestViewModel.hospitals); + }, + child: Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getHospitalName('Pickup Location')), + Icon( + Icons.arrow_drop_down, + size: 24, + color: Colors.black, + ) + ], + ), + ), + ), + ], + ), + if (widget.patientER.direction == 1) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Pickup Location'), + SizedBox( + height: 15, + ), + InkWell( + onTap: () { + confirmSelectHospitalDialog( + widget.amRequestViewModel.hospitals); + }, + child: Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getHospitalName('Pickup Location')), + Icon( + Icons.arrow_drop_down, + size: 24, + color: Colors.black, + ) + ], + ), + ), + ), + SizedBox( + height: 12, + ), + Texts('Drop off Location'), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PlacePicker( + apiKey: 'AIzaSyCiD4YqVqLNYbt8-htvFy4Wp8XSph9E3wM​', + // Put YOUR OWN KEY here. + onPlacePicked: (PickResult result) { + print(result.adrAddress); + setState(() { + _result = result; + }); + Navigator.of(context).pop(); + }, + initialPosition: LatLng(_latitude, _longitude), + useCurrentLocation: true, + ), + ), + ); + }, + child: Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts('Select From Map'), + Icon( + FontAwesomeIcons.mapMarkerAlt, + size: 24, + color: Colors.black, + ) + ], + ), + ), + ), + ], + ), + //TODO show dialog projects + + SizedBox( + height: 45, + ), + Container( + padding: EdgeInsets.all(15), + width: double.maxFinite, + height: 76, + child: SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + if(_result==null || _selectedHospital == null) + AppToast.showErrorToast(message: 'please select all fields'); + else + setState(() { + widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; + if (widget.patientER.direction == 0) { + widget.patientER.pickupLocationLattitude = _result.geometry.location.lat.toString(); + widget.patientER.pickupLocationLongitude = _result.geometry.location.lng.toString(); + widget.patientER.dropoffLocationLattitude = _selectedHospital.latitude; + widget.patientER.dropoffLocationLongitude = _selectedHospital.longitude; + + } else { + widget.patientER.pickupLocationLattitude = _selectedHospital.latitude; + widget.patientER.pickupLocationLongitude = _selectedHospital.longitude; + widget.patientER.dropoffLocationLattitude = _result.geometry.location.lat.toString(); + widget.patientER.dropoffLocationLongitude = _result.geometry.location.lng.toString(); + } + + widget.patientER.latitude = widget.patientER.pickupLocationLattitude; + widget.patientER.longitude = widget.patientER.pickupLocationLongitude; + + if(_haveAppointment == HaveAppointment.YES){ + widget.patientER.appointmentNo = myAppointment.appointmentNo.toString(); + widget.patientER.appointmentClinicName = myAppointment.clinicName; + widget.patientER.appointmentDoctorName = myAppointment.doctorNameObj; + widget.patientER.appointmentBranch = myAppointment.projectName; + widget.patientER.appointmentTime = myAppointment.appointmentDate; + }else{ + widget.patientER.appointmentNo ="0"; + widget.patientER.appointmentClinicName = null; + widget.patientER.appointmentDoctorName = null; + widget.patientER.appointmentBranch = null; + widget.patientER.appointmentTime = null; + } + + widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; + widget.changeCurrentTab(2); + }); + }, + label: 'Next', + ), + ) + ], + ), + ), + ); + } + + void confirmSelectHospitalDialog(List hospitals) { + showDialog( + context: context, + child: SelectHospitalDialog( + hospitals: hospitals, + selectedHospital: _selectedHospital, + onValueSelected: (value) { + setState(() { + _selectedHospital = value; + }); + }, + ), + ); + } + + String getHospitalName(String title) { + return _selectedHospital == null ? title : _selectedHospital.name; + } + + getAppointment() { + ProgressDialogUtil.showProgressDialog(context); + widget.amRequestViewModel.getAppointmentHistory().then((value) { + if (widget.amRequestViewModel.state == ViewState.Error || + widget.amRequestViewModel.state == ViewState.ErrorLocal) { + AppToast.showErrorToast(message: widget.amRequestViewModel.error); + } else if (widget + .amRequestViewModel.appoitmentAllHistoryResultList.length > + 0) { + ProgressDialogUtil.hideProgressDialog(context); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AvailableAppointmentsPage( + appointmentsAllHistoryList: + widget.amRequestViewModel.appoitmentAllHistoryResultList, + ), + ), + ).then((value) { + if (value != null) + setState(() { + myAppointment = value; + }); + else { + ProgressDialogUtil.hideProgressDialog(context); + setState(() { + _haveAppointment = HaveAppointment.NO; + }); + } + }); + } else { + ProgressDialogUtil.hideProgressDialog(context); + setState(() { + _haveAppointment = HaveAppointment.NO; + }); + AppToast.showErrorToast(message: 'You don\'t have any appointment'); + } + }).catchError((e) { + ProgressDialogUtil.hideProgressDialog(context); + AppToast.showErrorToast(message: e); + }); + } +} diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart new file mode 100644 index 00000000..436aabe8 --- /dev/null +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart @@ -0,0 +1,306 @@ +import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; +import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; +import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +enum Direction { ToHospital, FromHospital } +enum Way { OneWay, TwoWays } + +class SelectTransportationMethod extends StatefulWidget { + final Function changeCurrentTab; + final PatientER patientER; + final AmRequestViewModel amRequestViewModel; + + SelectTransportationMethod( + {Key key, + this.changeCurrentTab, + this.patientER, + this.amRequestViewModel}); + + @override + _SelectTransportationMethodState createState() => + _SelectTransportationMethodState(); +} + +class _SelectTransportationMethodState + extends State { + PatientERTransportationMethod _erTransportationMethod = + PatientERTransportationMethod(); + Direction _direction = Direction.FromHospital; + Way _way = Way.OneWay; + + OrderService _orderService = OrderService.AMBULANCE; + + @override + void initState() { + super.initState(); + if (widget.patientER.direction != null) { + _direction = widget.patientER.direction == 0 + ? Direction.ToHospital + : Direction.FromHospital; + _way = widget.patientER.tripType == 1 ? Way.OneWay : Way.TwoWays; + _erTransportationMethod = widget.amRequestViewModel + .amRequestModeList[(widget.patientER.selectedAmbulate - 1)]; + } else { + if (widget.amRequestViewModel.amRequestModeList.length != 0) + _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[ + widget.amRequestViewModel.amRequestModeList.length - 1]; + } + } + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 12, + ), + Texts('Select Transportation Method'), + ...List.generate( + widget.amRequestViewModel.amRequestModeList.length, + (index) => InkWell( + onTap: () { + setState(() { + _erTransportationMethod = + widget.amRequestViewModel.amRequestModeList[index]; + }); + }, + child: Container( + margin: EdgeInsets.all(5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: Row( + children: [ + Expanded( + flex: 3, + child: ListTile( + title: Text(widget.amRequestViewModel + .amRequestModeList[index].title), + leading: Radio( + value: widget + .amRequestViewModel.amRequestModeList[index], + groupValue: _erTransportationMethod, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _erTransportationMethod = value; + }); + }, + ), + ), + ), + Expanded( + flex: 1, + child: Texts( + 'SR ${widget.amRequestViewModel.amRequestModeList[index].price}'), + ) + ], + ), + ), + ), + ), + SizedBox( + height: 12, + ), + Texts('Select Direction'), + SizedBox( + height: 5, + ), + Container( + width: double.maxFinite, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + _direction = Direction.ToHospital; + }); + }, + child: Container( + width: double.maxFinite, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text('To Hospital'), + leading: Radio( + value: Direction.ToHospital, + groupValue: _direction, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _direction = value; + }); + }, + ), + ), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + setState(() { + _direction = Direction.FromHospital; + }); + }, + child: Container( + width: double.maxFinite, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text('Form Hospital'), + leading: Radio( + value: Direction.FromHospital, + groupValue: _direction, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _direction = value; + }); + }, + ), + ), + ), + ), + ), + ], + ), + ), + if (_direction == Direction.ToHospital) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 8, + ), + Texts('Select Direction'), + SizedBox( + height: 5, + ), + Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + _way = Way.OneWay; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text('One Way'), + leading: Radio( + value: Way.OneWay, + groupValue: _way, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _way = value; + }); + }, + ), + ), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + setState(() { + _way = Way.TwoWays; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text('Two Ways'), + leading: Radio( + value: Way.TwoWays, + groupValue: _way, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _way = value; + }); + }, + ), + ), + ), + ), + ), + ], + ), + ], + ), + SizedBox( + height: 15, + ), + Container( + padding: EdgeInsets.all(15), + width: double.maxFinite, + height: 76, + child: SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + setState(() { + widget.patientER.direction = _direction == Direction.ToHospital ? 0 : 1; + widget.patientER.tripType = _way == Way.TwoWays ? 2 : 1; + widget.patientER.selectedAmbulate = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1); + widget.patientER.patientERTransportationMethod = _erTransportationMethod; + widget.patientER.orderServiceID = _orderService.getIdOrderService(); + widget.patientER.pickupUrgency = 1; + widget.patientER.lineItemNo = 1; + widget.patientER.cost = _erTransportationMethod.price; + widget.patientER.vAT = _erTransportationMethod.vAT ?? 0; + widget.patientER.totalPrice = _erTransportationMethod.totalPrice; + + widget.changeCurrentTab(1); + }); + }, + label: 'Next', + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart new file mode 100644 index 00000000..4c189707 --- /dev/null +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart @@ -0,0 +1,105 @@ +import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; +import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/core/enum/Ambulate.dart'; + +class Summary extends StatefulWidget { + final Function changeCurrentTab; + final PatientER patientER; + final AmRequestViewModel amRequestViewModel; + + Summary({Key key, this.changeCurrentTab, this.patientER, this.amRequestViewModel}); + + @override + _SummaryState createState() => _SummaryState(); +} + +class _SummaryState extends State { + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Summary'), + SizedBox(height: 5,), + Container( + width: double.infinity, + + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Transportation Method',color: Colors.grey,), + Texts('${widget.patientER.patientERTransportationMethod.title}',bold: true,), + SizedBox(height: 8,), + + Texts('Direction',color: Colors.grey,), + Texts('From Hospital',bold: true,), + SizedBox(height: 8,), + + Texts('Pickup Location',color: Colors.grey,), + Texts('SZR Medical Center',bold: true,), + SizedBox(height: 8,), + + Texts('Drop off location',color: Colors.grey,), + Texts('6199, Al Ameen wlfn nif',bold: true,), + SizedBox(height: 8,), + + Texts('Select Ambulate',color: Colors.grey,), + Texts('${widget.patientER.ambulate.getAmbulateTitle(context)}',bold: true,), + SizedBox(height: 8,), + + Texts('Note',color: Colors.grey,), + Texts('${widget.patientER.requesterNote?? '---'}',bold: true,), + SizedBox(height: 8,), + ], + ), + ), + SizedBox(height: 20,), + Texts('Bill Amount',textAlign: TextAlign.start,), + SizedBox(height: 5,), + Container( + height: 55, + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8) + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts('Total amount payable:'), + Texts('SR ${widget.patientER.patientERTransportationMethod.totalPrice}') + ], + ), + ), + + SizedBox(height: 45,), + Container( + padding: EdgeInsets.all(15), + width: double.maxFinite, + height: 76, + child:SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + label: 'Next', + + // onTap: ()=> widget.changeCurrentTab(2), + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/ErService/AvailableAppointmentsPage.dart b/lib/pages/ErService/AvailableAppointmentsPage.dart new file mode 100644 index 00000000..7180d5dd --- /dev/null +++ b/lib/pages/ErService/AvailableAppointmentsPage.dart @@ -0,0 +1,45 @@ +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/pages/ErService/widgets/AppointmentCard.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class AvailableAppointmentsPage extends StatelessWidget { + final List appointmentsAllHistoryList; + + const AvailableAppointmentsPage({Key key, this.appointmentsAllHistoryList}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Available Appointments', + body: SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Texts('Available Appointments'), + SizedBox( + height: 12, + ), + ...List.generate( + appointmentsAllHistoryList.length, + (index) => InkWell( + onTap: (){ + Navigator.pop(context, appointmentsAllHistoryList[index]); + }, + child: AppointmentCard(appointment: appointmentsAllHistoryList[index],), + ), + ) + ], + ), + ), + ), + ); + } +} + + diff --git a/lib/pages/ErService/OrderLogPage.dart b/lib/pages/ErService/OrderLogPage.dart new file mode 100644 index 00000000..cbb508e5 --- /dev/null +++ b/lib/pages/ErService/OrderLogPage.dart @@ -0,0 +1,62 @@ +import 'package:diplomaticquarterapp/core/model/er/PatientAllPresOrders.dart'; +import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/OrderLogItem.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class OrderLogPage extends StatelessWidget { + final AmRequestViewModel amRequestViewModel; + + OrderLogPage({Key key, @required this.amRequestViewModel}); + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.all(10), + padding: EdgeInsets.all(8), + child: ListView.builder( + itemCount: amRequestViewModel.patientAllPresOrdersList.length, + itemBuilder: (context, index) => Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(2), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + OrderLogItem( + title: 'Request ID', + value: amRequestViewModel.patientAllPresOrdersList[index].iD + .toString(), + ), + OrderLogItem( + title: 'Status', + value: amRequestViewModel + .patientAllPresOrdersList[index].description, + ), + OrderLogItem( + title: 'Pickup Date', + value: DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(amRequestViewModel + .patientAllPresOrdersList[index].createdOn)), + ), + OrderLogItem( + title: 'Pickup Location', + value: amRequestViewModel + .patientAllPresOrdersList[index].pickupLocationName, + ), + OrderLogItem( + title: 'Drop off Location', + value: amRequestViewModel + .patientAllPresOrdersList[index].dropoffLocationName, + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/ErService/widgets/AppointmentCard.dart b/lib/pages/ErService/widgets/AppointmentCard.dart new file mode 100644 index 00000000..0437c32f --- /dev/null +++ b/lib/pages/ErService/widgets/AppointmentCard.dart @@ -0,0 +1,47 @@ +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class AppointmentCard extends StatelessWidget { + final AppoitmentAllHistoryResultList appointment; + + const AppointmentCard({Key key, this.appointment}) : super(key: key); + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + margin: EdgeInsets.all(8), + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + child: Row( + children: [ + LargeAvatar( + url: appointment.doctorImageURL, + name: appointment.doctorNameObj, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(appointment.doctorNameObj,bold: true,), + SizedBox(height: 4,), + Texts(appointment.projectName), + Texts(appointment.clinicName), + Texts(DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(appointment.bookDate))), + ], + ), + ), + ) + ], + ), + ); + } +} diff --git a/lib/pages/ErService/widgets/StepsWidget.dart b/lib/pages/ErService/widgets/StepsWidget.dart new file mode 100644 index 00000000..c5864710 --- /dev/null +++ b/lib/pages/ErService/widgets/StepsWidget.dart @@ -0,0 +1,226 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class StepsWidget extends StatelessWidget { + final int index; + final Function changeCurrentTab; + + StepsWidget({Key key, this.index, this.changeCurrentTab}); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return projectViewModel.isArabic? Stack( + children: [ + Container( + height: 50, + width: MediaQuery.of(context).size.width, + color: Colors.transparent, + child: Center( + child: Divider( + color: Colors.grey, + height: 0.75, + thickness: 0.75, + ), + ), + ), + Positioned( + top: 10, + left: 0, + child: InkWell( + onTap: () => changeCurrentTab(0), + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), + shape: BoxShape.circle, + color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, + ), + child: Center( + child: Texts( + '1', + color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], + ), + ), + ), + ), + ), + Positioned( + top: 10, + left: MediaQuery.of(context).size.width * 0.3, + child: InkWell( + onTap: () => index >= 2 ? changeCurrentTab(1) : null, + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), + shape: BoxShape.circle, + color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, + ), + child: Center( + child: Texts( + '2', + color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + ), + ), + ), + ), + ), + Positioned( + top: 10, + left: MediaQuery.of(context).size.width * 0.6, + child: InkWell( + onTap: () => index >= 3 ? changeCurrentTab(2) : null, + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: index > 2 ? null:Border.all(color: Colors.black,width: 0.75), + color: index == 2 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, + ), + child: Center( + child: Texts( + '3', + color: index == 2? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + ), + ), + ), + ), + ), + Positioned( + top: 10, + right: 0, + child: InkWell( + onTap: () => index == 2 ?changeCurrentTab(3):null, + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + border: Border.all(color: Colors.black,width: 0.75), + + shape: BoxShape.circle, + color: index == 3 ? Colors.grey[800] : Colors.white, + ), + child: Center( + child: Texts( + '4', + color: index == 3 ? Colors.white : Colors.grey[800], + ), + ), + ), + ), + ), + ], + ):Stack( + children: [ + Container( + height: 50, + width: MediaQuery.of(context).size.width, + color: Colors.transparent, + child: Center( + child: Divider( + color: Colors.grey, + height: 0.75, + thickness: 0.75, + ), + ), + ), + Positioned( + top: 10, + right: 0, + child: InkWell( + onTap: () => changeCurrentTab(0), + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), + shape: BoxShape.circle, + color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, + ), + child: Center( + child: Texts( + '1', + color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], + ), + ), + ), + ), + ), + Positioned( + top: 10, + right: MediaQuery.of(context).size.width * 0.3, + child: InkWell( + onTap: () => index >= 2 ? changeCurrentTab(1) : null, + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), + shape: BoxShape.circle, + color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, + ), + child: Center( + child: Texts( + '2', + color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + ), + ), + ), + ), + ), + Positioned( + top: 10, + right: MediaQuery.of(context).size.width * 0.6, + child: InkWell( + onTap: () => index >= 3 ? changeCurrentTab(2) : null, + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: index > 2 ? null:Border.all(color: Colors.black,width: 0.75), + color: index == 2 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, + ), + child: Center( + child: Texts( + '3', + color: index == 2? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + ), + ), + ), + ), + ), + Positioned( + top: 10, + left: 0, + child: InkWell( + onTap: () => index == 2 ?changeCurrentTab(3):null, + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + border: Border.all(color: Colors.black,width: 0.75), + + shape: BoxShape.circle, + color: index == 3 ? Colors.grey[800] : Colors.white, + ), + child: Center( + child: Texts( + '4', + color: index == 3 ? Colors.white : Colors.grey[800], + ), + ), + ), + ), + ), + ], + ); + } +} diff --git a/lib/pages/base/base_view.dart b/lib/pages/base/base_view.dart index 6014b6c3..f5311aae 100644 --- a/lib/pages/base/base_view.dart +++ b/lib/pages/base/base_view.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -19,10 +20,11 @@ class BaseView extends StatefulWidget { class _BaseViewState extends State> { T model = locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); @override void initState() { - if (widget.onModelReady != null) { + if (widget.onModelReady != null && authenticatedUserObject.isLogin) { widget.onModelReady(model); } super.initState(); diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 79671682..6ce96bc9 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -2,7 +2,7 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; -import 'package:diplomaticquarterapp/pages/ContactUs/hmg_service.dart'; +import 'package:diplomaticquarterapp/pages/ContactUs/contact_us_page.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; @@ -35,6 +35,7 @@ class _HomePageState extends State { return BaseView( onModelReady: (model) => model.getPatientRadOrders(), builder: (_, model, wi) => AppScaffold( + isShowDecPage: false, body: Container( width: double.infinity, child: SingleChildScrollView( @@ -443,7 +444,7 @@ class _HomePageState extends State { child: Column( children: [ Image.asset( - 'assets/images/Dr_Schedule_report.png', + 'assets/images/home_health_care_icon.png', width: 50, height: 50, ), @@ -697,7 +698,7 @@ class _HomePageState extends State { // Navigator.push( // context, FadePage(page: FeedbackHomePage())); Navigator.push( - context, FadePage(page: HmgServicePage())); + context, FadePage(page: ContactUsPage())); }, child: Container( width: double.infinity, diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index ac36c7d6..52afe85f 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -74,6 +74,7 @@ class _ConfirmLogin extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).confirm, isShowAppBar: true, + isShowDecPage: false, body: isLoading == false ? SingleChildScrollView( child: Container( diff --git a/lib/pages/login/forgot-password.dart b/lib/pages/login/forgot-password.dart index c1fa7b18..bbdbb1ae 100644 --- a/lib/pages/login/forgot-password.dart +++ b/lib/pages/login/forgot-password.dart @@ -21,6 +21,7 @@ class _ForgotPassword extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).forgotPassword, isShowAppBar: true, + isShowDecPage: false, body: SingleChildScrollView( child: Container( padding: EdgeInsets.only(top: 10, left: 20, right: 20), diff --git a/lib/pages/login/login-type.dart b/lib/pages/login/login-type.dart index 7a8a940d..d1ac54bb 100644 --- a/lib/pages/login/login-type.dart +++ b/lib/pages/login/login-type.dart @@ -16,6 +16,7 @@ class LoginType extends StatelessWidget { return AppScaffold( appBarTitle: TranslationBase.of(context).welcome, isShowAppBar: true, + isShowDecPage: false, body: Padding( padding: EdgeInsets.all(20), child: Column( diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index c1f04a71..a575f8c4 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; @@ -40,6 +41,9 @@ class _Login extends State { AppointmentRateViewModel appointmentRateViewModel = locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); + + @override void initState() { // getDeviceToken(); @@ -57,6 +61,7 @@ class _Login extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).login, isShowAppBar: true, + isShowDecPage: false, body: isLoading == true ? AppCircularProgressIndicator() : SingleChildScrollView( @@ -195,6 +200,7 @@ class _Login extends State { // request.isRegister = false; this.authService.checkActivationCode(request, code).then((result) => { result = CheckActivationCode.fromJson(result), + authenticatedUserObject.getUser(), this.sharedPref.setObject(USER_PROFILE, result.list), this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), this.sharedPref.setString(TOKEN, result.authenticationTokenID), diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart index 70e5fb29..e94c1af6 100644 --- a/lib/pages/login/register-info.dart +++ b/lib/pages/login/register-info.dart @@ -39,6 +39,7 @@ class _RegisterInfo extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).register, isShowAppBar: true, + isShowDecPage: false, body: SingleChildScrollView( child: Container( padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 3706f452..3ee13a4c 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -45,6 +45,7 @@ class _Register extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).register, isShowAppBar: true, + isShowDecPage: false, body: isLoading == true ? AppCircularProgressIndicator() : SingleChildScrollView( diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index b4b05900..90bc2a2c 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -28,6 +28,7 @@ class _WelcomeLogin extends State { Widget build(BuildContext context) { return AppScaffold( appBarTitle: TranslationBase.of(context).welcome, + isShowDecPage: false, isShowAppBar: true, body: Padding( padding: EdgeInsets.all(20), diff --git a/lib/pages/medical/labs/labs_home_page.dart b/lib/pages/medical/labs/labs_home_page.dart index 325d5dcd..995365d9 100644 --- a/lib/pages/medical/labs/labs_home_page.dart +++ b/lib/pages/medical/labs/labs_home_page.dart @@ -20,6 +20,7 @@ class LabsHomePage extends StatelessWidget { builder: (context, LabsViewModel model, widget) => AppScaffold( baseViewModel: model, isShowAppBar: true, + description: TranslationBase.of(context).infoLab, appBarTitle: TranslationBase.of(context).labOrders, body: SingleChildScrollView( physics: BouncingScrollPhysics(), diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index d2b9a9ea..e7d75e7f 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -48,6 +48,7 @@ class _MedicalProfilePageState extends State { return BaseView( onModelReady: (model) => model.getAppointmentHistory(), builder: (_, model, widget) => AppScaffold( + isShowDecPage: false, baseViewModel: model, body: Container( child: SingleChildScrollView( @@ -73,6 +74,7 @@ class _MedicalProfilePageState extends State { fit: BoxFit.cover, width: double.infinity, ), + if(model.authenticatedUserObject.isLogin) ListView.builder( itemBuilder: (context, index) => TimeLineWidget( isUp: index % 2 == 1, diff --git a/lib/pages/medical/radiology/radiology_home_page.dart b/lib/pages/medical/radiology/radiology_home_page.dart index 0f9f4c7b..995ac485 100644 --- a/lib/pages/medical/radiology/radiology_home_page.dart +++ b/lib/pages/medical/radiology/radiology_home_page.dart @@ -20,6 +20,7 @@ class RadiologyHomePage extends StatelessWidget { isShowAppBar: true, appBarTitle: TranslationBase.of(context).radiology, baseViewModel: model, + description: TranslationBase.of(context).infoRadiology, body: FractionallySizedBox( widthFactor: 1.0, child: ListView( diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index 1598184c..c8d88f9d 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_request.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; @@ -14,6 +15,8 @@ import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/cupertino.dart'; +import '../../locator.dart'; + // SharedPreferences sharedPref = new SharedPreferences(); enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } AppSharedPreferences sharedPref = new AppSharedPreferences(); @@ -41,6 +44,8 @@ class AuthProvider with ChangeNotifier { bool isLogin = false; bool isLoading = true; dynamic authenticatedUser; + AuthenticatedUserObject authenticatedUserObject = locator(); + AuthProvider() { getUserAuthentication(); } diff --git a/lib/uitl/ProgressDialog.dart b/lib/uitl/ProgressDialog.dart new file mode 100644 index 00000000..6820a6d5 --- /dev/null +++ b/lib/uitl/ProgressDialog.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; + +AlertDialog _alert = AlertDialog( + content: Row( + children: [ + CircularProgressIndicator(), + Container(margin: EdgeInsets.only(left: 7), child: Text("Loading...")), + ], + ), +); + +class ProgressDialogUtil { + static showProgressDialog(BuildContext context) { + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return _alert; + }, + ); + } + + static hideProgressDialog(BuildContext context) { + Navigator.pop(context); + } +} diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 1574e63b..f36dada0 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -596,6 +596,10 @@ class TranslationBase { String get all => localizedValues['All'][locale.languageCode]; String get questionHere => localizedValues['QuestionHere'][locale.languageCode]; String get viewDoctorResponses => localizedValues['ViewDoctorResponses'][locale.languageCode]; + String get serviceInformationButton => localizedValues['ServiceInformationButton'][locale.languageCode]; + String get serviceInformationTitle => localizedValues['ServiceInformationTitle'][locale.languageCode]; + String get infoLab => localizedValues['info-lab'][locale.languageCode]; + String get infoRadiology => localizedValues['info-radiology'][locale.languageCode]; } diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 3c5ac608..9a387e4e 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; @@ -16,6 +17,7 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../config/size_config.dart'; +import '../../locator.dart'; import 'drawer_item_widget.dart'; class AppDrawer extends StatefulWidget { @@ -34,6 +36,7 @@ class _AppDrawerState extends State { var sharedPref = new AppSharedPreferences(); var familyFileProvider = FamilyFilesProvider(); AuthenticatedUser user; + AuthenticatedUserObject authenticatedUserObject = locator(); @override Widget build(BuildContext context) { @@ -329,10 +332,7 @@ class _AppDrawerState extends State { } logout() async { - // this.sharedPref.remove(USER_PROFILE); - // this.sharedPref.remove(IMEI_USER_DATA); - // this.sharedPref.remove(TOKEN); - // this.sharedPref.remove(LOGIN_TOKEN_ID); + authenticatedUserObject.logout(); await sharedPref.clear(); this.user = null; diff --git a/lib/widgets/others/OrderLogItem.dart b/lib/widgets/others/OrderLogItem.dart new file mode 100644 index 00000000..3e8305d3 --- /dev/null +++ b/lib/widgets/others/OrderLogItem.dart @@ -0,0 +1,32 @@ +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class OrderLogItem extends StatelessWidget { + final String title; + final String value; + OrderLogItem({ this.title, this.value}); + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.all(10), + width: double.maxFinite, + margin: EdgeInsets.only(bottom: 4,left: 4,right: 4), + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(12), + bottomLeft: Radius.circular(12), + ), + color: Colors.white + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(title,color: Colors.grey,), + SizedBox(height: 4,), + Texts(value??''), + ], + ), + ); + } +} diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 80a3e7af..dabe3097 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -1,8 +1,10 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -12,10 +14,12 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; +import '../../locator.dart'; import 'floating_button_search.dart'; import '../progress_indicator/app_loader_widget.dart'; import 'arrow_back.dart'; import 'network_base_view.dart'; +import 'not_auh_page.dart'; class AppScaffold extends StatelessWidget { final String appBarTitle; @@ -26,6 +30,12 @@ class AppScaffold extends StatelessWidget { final bool hasAppBarParam; final BaseViewModel baseViewModel; final Widget floatingActionButton; + final String title; + final String description; + final bool isShowDecPage; + + AuthenticatedUserObject authenticatedUserObject = + locator(); AppScaffold( {@required this.body, @@ -34,50 +44,61 @@ class AppScaffold extends StatelessWidget { this.isShowAppBar = false, this.hasAppBarParam, this.bottomSheet, - this.baseViewModel, this.floatingActionButton}); + this.baseViewModel, + this.floatingActionButton, + this.title, + this.description, + this.isShowDecPage = true}); @override Widget build(BuildContext context) { AppGlobal.context = context; return Scaffold( - backgroundColor: Theme.of(context).scaffoldBackgroundColor, - appBar: isShowAppBar - ? AppBar( - elevation: 0, - backgroundColor: Theme.of(context).appBarTheme.color, - textTheme: TextTheme( - headline6: TextStyle( - color: Colors.white, fontWeight: FontWeight.bold), - ), - title: Text(appBarTitle.toUpperCase()), - leading: Builder( - builder: (BuildContext context) { - return ArrowBack(); + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + appBar: isShowAppBar + ? AppBar( + elevation: 0, + backgroundColor: Theme.of(context).appBarTheme.color, + textTheme: TextTheme( + headline6: + TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + ), + title: Text(authenticatedUserObject.isLogin + ? appBarTitle.toUpperCase() + : TranslationBase.of(context).serviceInformationTitle), + leading: Builder( + builder: (BuildContext context) { + return ArrowBack(); + }, + ), + centerTitle: true, + actions: [ + IconButton( + icon: Icon(FontAwesomeIcons.home), + color: Colors.white, + onPressed: () { + Navigator.of(context).popUntil(ModalRoute.withName('/')); }, ), - centerTitle: true, - actions: [ - IconButton( - icon: Icon(FontAwesomeIcons.home), - color: Colors.white, - onPressed: () { - Navigator.of(context).popUntil(ModalRoute.withName('/')); - }, - ), - ], - ) - : null, - body: baseViewModel != null - ? NetworkBaseView( - child: buildBodyWidget(), - baseViewModel: baseViewModel, - ) - : buildBodyWidget(), - bottomSheet: bottomSheet, - // bottomNavigationBar: BottomBarSearch() - floatingActionButton: floatingActionButton??floatingActionButton, - ); + ], + ) + : null, + body: (!authenticatedUserObject.isLogin && isShowDecPage) + ? NotAutPage( + title: appBarTitle, + description: description, + ) + : baseViewModel != null + ? NetworkBaseView( + child: buildBodyWidget(), + baseViewModel: baseViewModel, + ) + : buildBodyWidget(), + bottomSheet: bottomSheet, + // bottomNavigationBar: BottomBarSearch() + floatingActionButton: floatingActionButton ?? floatingActionButton, + ); } buildAppLoaderWidget(bool isLoading) { @@ -85,6 +106,6 @@ class AppScaffold extends StatelessWidget { } buildBodyWidget() { - return body ;//Stack(children: [body, buildAppLoaderWidget(isLoading)]); + return body; //Stack(children: [body, buildAppLoaderWidget(isLoading)]); } } diff --git a/lib/widgets/others/not_auh_page.dart b/lib/widgets/others/not_auh_page.dart new file mode 100644 index 00000000..298b5609 --- /dev/null +++ b/lib/widgets/others/not_auh_page.dart @@ -0,0 +1,79 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/login/login-type.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +class NotAutPage extends StatelessWidget { + final String title; + final String description; + + NotAutPage({@required this.title, @required this.description}); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return Scaffold( + body: SingleChildScrollView( + padding: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + title ?? 'Service', + fontWeight: FontWeight.w800, + fontSize: 25, + bold: true, + color: Hexcolor("#60686b"), + ), + SizedBox( + height: 12, + ), + Texts( + description ?? 'Description', + fontWeight: FontWeight.normal, + fontSize: 17, + ), + SizedBox( + height: 22, + ), + Center( + child: SizedBox( + height: MediaQuery.of(context).size.height * 0.55, + width: MediaQuery.of(context).size.width * 0.50, + child: Image.asset(projectViewModel.isArabic + ? 'assets/images/wifi-EN.png' + : 'assets/images/Wifi-AR.png'), + ), + ), + SizedBox( + height: 77, + ), + ], + ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.10, + width: double.infinity, + child: Column( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.9, + child: SecondaryButton( + onTap: () => Navigator.pushReplacement( + context, FadePage(page: LoginType())), + label: TranslationBase.of(context).serviceInformationButton, + textColor: Theme.of(context).backgroundColor), + ), + ], + ), + ), + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index c97127c0..48f43983 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ description: A new Flutter application. version: 1.0.0+1 environment: - sdk: ">=2.2.2 <3.0.0" + sdk: ">=2.6.0 <3.0.0" dependencies: flutter: @@ -60,6 +60,9 @@ dependencies: image_picker: ^0.6.7+1 image_cropper: ^1.2.1 + #GIF image + flutter_gifimage: ^1.0.1 + # UI Reqs dotted_border: 1.0.5 expandable: ^4.1.4 @@ -131,6 +134,10 @@ dependencies: #Handle Geolocation geolocator: ^6.0.0+1 + + #google maps places + google_maps_place_picker: ^0.10.0 + #Dependencies for video call implementation native_device_orientation: ^0.3.0 enum_to_string: ^1.0.9