From 12dc63716356ea40c550a2427912c52577f1bb74 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 23 Mar 2021 21:33:19 +0300 Subject: [PATCH] bug fixes --- lib/config/config.dart | 12 +- lib/core/service/sickleave_service.dart | 5 + lib/models/patient/patiant_info_model.dart | 137 +++++++++--------- .../add-rescheduleleave.dart | 33 ++--- lib/util/date-utils.dart | 23 +-- lib/widgets/auth/verification_methods.dart | 2 +- lib/widgets/patients/PatientCard.dart | 11 +- lib/widgets/shared/app_drawer_widget.dart | 1 + 8 files changed, 118 insertions(+), 106 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index a944a0a1..81dea160 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -4,8 +4,8 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; -//const BASE_URL = 'https://hmgwebservices.com/'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; +//const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = @@ -151,8 +151,8 @@ const SEND_LAB_RESULT_EMAIL = 'Services/Notifications.svc/REST/SendLabReportEmail'; const GET_Patient_LAB_RESULT = 'Services/Patients.svc/REST/GetPatientLabResults'; -const GET_Patient_LAB_ORDERS_RESULT = 'Services/Patients.svc/REST/GetPatientLabOrdersResults'; - +const GET_Patient_LAB_ORDERS_RESULT = + 'Services/Patients.svc/REST/GetPatientLabOrdersResults'; // SOAP @@ -226,7 +226,8 @@ const GET_BOX_QUANTITY = ///GET ECG const GET_ECG = "Services/Patients.svc/REST/HIS_GetPatientMuseResults"; -const GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus"; +const GET_PAtIENTS_INSURANCE_APPROVALS = + "Services/Patients.svc/REST/GetApprovalStatus"; var selectedPatientType = 1; @@ -294,7 +295,6 @@ const GENERAL_ID = 'Cs2020@2016\$2958'; const PATIENT_TYPE = 1; const PATIENT_TYPE_ID = 1; - /// Timer Info const TIMER_MIN = 10; diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart index 3ef8229f..8a5babd5 100644 --- a/lib/core/service/sickleave_service.dart +++ b/lib/core/service/sickleave_service.dart @@ -114,6 +114,11 @@ class SickLeaveService extends BaseService { response['requisitionList']['entityList'].forEach((v) { _getReScheduleLeave.add(GetRescheduleLeavesResponse.fromJson(v)); }); + _getReScheduleLeave.sort((a, b) { + var adate = a.dateTimeFrom; //before -> var adate = a.date; + var bdate = b.dateTimeFrom; //var bdate = b.date; + return -adate.compareTo(bdate); + }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index dc3c8b4e..2c3bb2b2 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -56,6 +56,7 @@ class PatiantInformtion { String nationalityFlagURL; int patientStatusType; int visitTypeId; + String startTimes; PatiantInformtion( {this.list, this.projectId, @@ -111,74 +112,76 @@ class PatiantInformtion { this.visitType, this.nationalityFlagURL, this.patientStatusType, - this.visitTypeId}); + this.visitTypeId, + this.startTimes}); factory PatiantInformtion.fromJson(Map json) => PatiantInformtion( - projectId: json["ProjectID"] ?? json["projectID"], - clinicId: json["ClinicID"] ?? json["clinicID"], - doctorId: json["DoctorID"] ?? json["doctorID"], - patientId: json["PatientID"] ?? - json["patientID"] ?? - json['patientMRN'] ?? - json['PatientMRN'], - doctorName: json["DoctorName"] ?? json["doctorName"], - doctorNameN: json["DoctorNameN"] ?? json["doctorNameN"], - firstName: json["FirstName"] ?? json["firstName"], - middleName: json["MiddleName"] ?? json["middleName"], - lastName: json["LastName"] ?? json["lastName"], - firstNameN: json["FirstNameN"] ?? json["firstNameN"], - middleNameN: json["MiddleNameN"] ?? json["middleNameN"], - lastNameN: json["LastNameN"] ?? json["lastNameN"], - gender: json["Gender"] ?? json["gender"], - dateofBirth: json["DateofBirth"] ?? json["dob"], - nationalityId: json["NationalityID"] ?? json["nationalityID"], - mobileNumber: json["MobileNumber"] ?? json["mobileNumber"], - emailAddress: json["EmailAddress"] ?? json["emailAddress"], - patientIdentificationNo: json["PatientIdentificationNo"] ?? - json["patientIdentificationNo"], - patientType: json["PatientType"] ?? json["patientType"], - admissionNo: json["AdmissionNo"] ?? json["admissionNo"], - admissionDate: json["AdmissionDate"] ?? json["admissionDate"], - createdOn: json["CreatedOn"] ?? json["CreatedOn"], - roomId: json["RoomID"] ?? json["roomID"], - bedId: json["BedID"] ?? json["bedID"], - nursingStationId: - json["NursingStationID"] ?? json["nursingStationID"], - description: json["Description"] ?? json["description"], - clinicDescription: - json["ClinicDescription"] ?? json["clinicDescription"], - clinicDescriptionN: - json["ClinicDescriptionN"] ?? json["clinicDescriptionN"], - nationalityName: json["NationalityName"] ?? - json["nationalityName"] ?? - json['NationalityName'], - nationalityNameN: json["NationalityNameN"] ?? - json["nationalityNameN"] ?? - json['NationalityNameN'], - age: json["Age"] ?? json["age"], - genderDescription: json["GenderDescription"], - nursingStationName: json["NursingStationName"], - appointmentDate: json["AppointmentDate"] ?? '', - startTime: json["startTime"], - appointmentNo: json['appointmentNo'] ?? json['AppointmentNo'], - appointmentType: json['appointmentType'], - arrivedOn: json['arrivedOn'], - clinicGroupId: json['clinicGroupId'], - companyName: json['companyName'], - dischargeStatus: json['dischargeStatus'], - doctorDetails: json['doctorDetails'], - endTime: json['endTime'], - episodeNo: json['episodeNo'] ?? json['EpisodeID'], - fallRiskScore: json['fallRiskScore'], - isSigned: json['isSigned'], - medicationOrders: json['medicationOrders'], - nationality: json['nationality'] ?? json['NationalityNameN'], - patientMRN: json['patientMRN'] ?? json['PatientMRN'], - visitType: json['visitType'] ?? json['visitType'], - nationalityFlagURL: - json['NationalityFlagURL'] ?? json['NationalityFlagURL'], - patientStatusType: - json['patientStatusType'] ?? json['patientStatusType'], - visitTypeId: json['visitTypeId'] ?? json['visitTypeId']); + projectId: json["ProjectID"] ?? json["projectID"], + clinicId: json["ClinicID"] ?? json["clinicID"], + doctorId: json["DoctorID"] ?? json["doctorID"], + patientId: json["PatientID"] ?? + json["patientID"] ?? + json['patientMRN'] ?? + json['PatientMRN'], + doctorName: json["DoctorName"] ?? json["doctorName"], + doctorNameN: json["DoctorNameN"] ?? json["doctorNameN"], + firstName: json["FirstName"] ?? json["firstName"], + middleName: json["MiddleName"] ?? json["middleName"], + lastName: json["LastName"] ?? json["lastName"], + firstNameN: json["FirstNameN"] ?? json["firstNameN"], + middleNameN: json["MiddleNameN"] ?? json["middleNameN"], + lastNameN: json["LastNameN"] ?? json["lastNameN"], + gender: json["Gender"] ?? json["gender"], + dateofBirth: json["DateofBirth"] ?? json["dob"], + nationalityId: json["NationalityID"] ?? json["nationalityID"], + mobileNumber: json["MobileNumber"] ?? json["mobileNumber"], + emailAddress: json["EmailAddress"] ?? json["emailAddress"], + patientIdentificationNo: + json["PatientIdentificationNo"] ?? json["patientIdentificationNo"], + patientType: json["PatientType"] ?? json["patientType"], + admissionNo: json["AdmissionNo"] ?? json["admissionNo"], + admissionDate: json["AdmissionDate"] ?? json["admissionDate"], + createdOn: json["CreatedOn"] ?? json["CreatedOn"], + roomId: json["RoomID"] ?? json["roomID"], + bedId: json["BedID"] ?? json["bedID"], + nursingStationId: json["NursingStationID"] ?? json["nursingStationID"], + description: json["Description"] ?? json["description"], + clinicDescription: + json["ClinicDescription"] ?? json["clinicDescription"], + clinicDescriptionN: + json["ClinicDescriptionN"] ?? json["clinicDescriptionN"], + nationalityName: json["NationalityName"] ?? + json["nationalityName"] ?? + json['NationalityName'], + nationalityNameN: json["NationalityNameN"] ?? + json["nationalityNameN"] ?? + json['NationalityNameN'], + age: json["Age"] ?? json["age"], + genderDescription: json["GenderDescription"], + nursingStationName: json["NursingStationName"], + appointmentDate: json["AppointmentDate"] ?? '', + startTime: json["startTime"], + appointmentNo: json['appointmentNo'] ?? json['AppointmentNo'], + appointmentType: json['appointmentType'], + arrivedOn: json['arrivedOn'], + clinicGroupId: json['clinicGroupId'], + companyName: json['companyName'], + dischargeStatus: json['dischargeStatus'], + doctorDetails: json['doctorDetails'], + endTime: json['endTime'], + episodeNo: json['episodeNo'] ?? json['EpisodeID'], + fallRiskScore: json['fallRiskScore'], + isSigned: json['isSigned'], + medicationOrders: json['medicationOrders'], + nationality: json['nationality'] ?? json['NationalityNameN'], + patientMRN: json['patientMRN'] ?? json['PatientMRN'], + visitType: json['visitType'] ?? json['visitType'], + nationalityFlagURL: + json['NationalityFlagURL'] ?? json['NationalityFlagURL'], + patientStatusType: + json['patientStatusType'] ?? json['patientStatusType'], + visitTypeId: json['visitTypeId'] ?? json['visitTypeId'], + startTimes: json['StartTime'] ?? json['StartTime'], + ); } diff --git a/lib/screens/reschedule-leaves/add-rescheduleleave.dart b/lib/screens/reschedule-leaves/add-rescheduleleave.dart index d5760cc0..0dab0226 100644 --- a/lib/screens/reschedule-leaves/add-rescheduleleave.dart +++ b/lib/screens/reschedule-leaves/add-rescheduleleave.dart @@ -1,22 +1,16 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/leave_rechdule_response.dart'; -import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/reschedule-leaves/reschedule_leave.dart'; -import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; class AddRescheduleLeavScreen extends StatelessWidget { ProjectViewModel projectsProvider; @@ -161,16 +155,21 @@ class AddRescheduleLeavScreen extends StatelessWidget { children: [ Flexible( child: Text( - item.dateTimeFrom + - ' ' + - TranslationBase.of( - context) - .to + - ' ' + - item.dateTimeTo, - // overflow: - // TextOverflow.ellipsis, - )) + DateUtils.convertStringToDateFormat( + item + .dateTimeFrom, + 'yyyy-MM-dd HH:mm') + + ' ' + + TranslationBase.of( + context) + .to + + ' ' + + DateUtils.convertStringToDateFormat( + item.dateTimeTo, + 'yyyy-MM-dd HH:mm') + // overflow: + // TextOverflow.ellipsis, + )) ], ), SizedBox( diff --git a/lib/util/date-utils.dart b/lib/util/date-utils.dart index 8e6cd17c..4ef21844 100644 --- a/lib/util/date-utils.dart +++ b/lib/util/date-utils.dart @@ -3,7 +3,6 @@ import 'package:flutter/cupertino.dart'; import 'package:intl/intl.dart'; class DateUtils { - static String convertDateToFormat(DateTime dateTime, String dateFormat) { return DateFormat(dateFormat).format(dateTime); } @@ -34,7 +33,8 @@ class DateUtils { return date; } - static String differenceBetweenDateAndCurrentInYearMonthDay(DateTime firstDate, BuildContext context) { + static String differenceBetweenDateAndCurrentInYearMonthDay( + DateTime firstDate, BuildContext context) { DateTime now = DateTime.now(); // now = now.add(Duration(days: 400, minutes: 0)); var difference = firstDate.difference(now); @@ -54,13 +54,15 @@ class DateUtils { return "$days ${TranslationBase.of(context).days}, $months ${TranslationBase.of(context).months}, $years ${TranslationBase.of(context).years}"; } - static String differenceBetweenDateAndCurrent(DateTime firstDate, BuildContext context) { + static String differenceBetweenDateAndCurrent( + DateTime firstDate, BuildContext context) { DateTime now = DateTime.now(); // DateTime now = nows.add(Duration(days: 400, minutes: 25, hours: 0)); var difference = now.difference(firstDate); int minutesInDays = difference.inMinutes; - int hoursInDays = minutesInDays ~/ 60; // ~/ : truncating division to make the result int + int hoursInDays = + minutesInDays ~/ 60; // ~/ : truncating division to make the result int int minutes = minutesInDays % 60; int days = hoursInDays ~/ 24; int hours = hoursInDays % 24; @@ -70,7 +72,8 @@ class DateUtils { return "$days ${TranslationBase.of(context).days}, $hours ${TranslationBase.of(context).hr}, $minutes ${TranslationBase.of(context).min}"; } - static String differenceBetweenServerDateAndCurrent(String str, BuildContext context) { + static String differenceBetweenServerDateAndCurrent( + String str, BuildContext context) { const start = "/Date("; const end = "+0300)"; @@ -217,7 +220,8 @@ class DateUtils { } } - static DateTime convertStringToDate(String date) { // /Date(1585774800000+0300)/ + static DateTime convertStringToDate(String date) { + // /Date(1585774800000+0300)/ if (date != null) { const start = "/Date("; const end = "+0300)"; @@ -258,11 +262,11 @@ class DateUtils { return ""; } - static String getAgeByBirthday(dynamic birthday, BuildContext context){ + static String getAgeByBirthday(dynamic birthday, BuildContext context) { // https://leechy.dev/calculate-dates-diff-in-dart - DateTime birthDate = DateUtils.getDateTimeFromServerFormat(birthday); + DateTime birthDate = DateUtils.getDateTimeFromServerFormat(birthday); final now = DateTime.now(); - int years = now.year - birthDate .year; + int years = now.year - birthDate.year; int months = now.month - birthDate.month; int days = now.day - birthDate.day; if (months < 0 || (months == 0 && days < 0)) { @@ -276,4 +280,3 @@ class DateUtils { return "$years ${TranslationBase.of(context).years} $months ${TranslationBase.of(context).months} $days ${TranslationBase.of(context).days}"; } } - diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index d7f6a816..5e8d7674 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -695,7 +695,7 @@ class _VerificationMethodsState extends State { this.checkActivationCode(authProv, value: value); }, () => { - Navigator.pop(context), + widget.changeLoadingStata(false), print('Faild..'), }, ).displayDialog(context); diff --git a/lib/widgets/patients/PatientCard.dart b/lib/widgets/patients/PatientCard.dart index a7e058ac..f067e161 100644 --- a/lib/widgets/patients/PatientCard.dart +++ b/lib/widgets/patients/PatientCard.dart @@ -230,7 +230,7 @@ class PatientCard extends StatelessWidget { " : ", fontSize: 14, ), - patientInfo.startTime != null + patientInfo.startTimes != null ? Container( height: 15, width: 60, @@ -240,7 +240,7 @@ class PatientCard extends StatelessWidget { color: HexColor("#20A169"), ), child: AppText( - patientInfo.startTime, + patientInfo.startTimes, color: Colors.white, fontSize: 1.5 * SizeConfig.textMultiplier, @@ -254,9 +254,10 @@ class PatientCard extends StatelessWidget { ), Container( child: AppText( - convertDateFormat2(patientInfo - .appointmentDate - .toString()), + DateUtils.convertDateFromServerFormat( + patientInfo.appointmentDate + .toString(), + 'yyyy-MM-dd'), fontSize: 1.5 * SizeConfig.textMultiplier, fontWeight: FontWeight.bold, diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index 590f09d6..84144f49 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -126,6 +126,7 @@ class _AppDrawerState extends State { onPressed: () async { Navigator.pop(context); await helpers.logout(); + projectsProvider.isLogin = false; }, ), ],