diff --git a/lib/core/service/patient_medical_file/sick_leave/sickleave_service.dart b/lib/core/service/patient_medical_file/sick_leave/sickleave_service.dart index 2b3062ee..070fd862 100644 --- a/lib/core/service/patient_medical_file/sick_leave/sickleave_service.dart +++ b/lib/core/service/patient_medical_file/sick_leave/sickleave_service.dart @@ -7,11 +7,12 @@ import 'package:doctor_app_flutter/core/viewModel/leave_rechdule_response.dart'; import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; import 'package:doctor_app_flutter/models/sickleave/extend_sick_leave_request.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; +import 'package:doctor_app_flutter/models/sickleave/sick_leave_statisitics_model.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; class SickLeaveService extends BaseService { - Map get sickLeavestatisitics => _statistics; - Map _statistics = {}; + SickLeaveStatisticsModel get sickLeavestatisitics => _statistics; + SickLeaveStatisticsModel _statistics = SickLeaveStatisticsModel(); List get getOffTimeList => offTime; List offTime = []; List get getReasons => reasonse; @@ -40,8 +41,8 @@ class SickLeaveService extends BaseService { GET_SICKLEAVE_STATISTIC, onSuccess: (dynamic response, int statusCode) { print(response); - _statistics = {}; - _statistics = response['SickLeaveStatistics']; + + _statistics = SickLeaveStatisticsModel.fromJson(response['SickLeaveStatistics']); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/viewModel/sick_leave_view_model.dart b/lib/core/viewModel/sick_leave_view_model.dart index bc7c9568..7a7f4575 100644 --- a/lib/core/viewModel/sick_leave_view_model.dart +++ b/lib/core/viewModel/sick_leave_view_model.dart @@ -1,25 +1,40 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/patient/patient_service.dart'; import 'package:doctor_app_flutter/core/service/patient_medical_file/sick_leave/sickleave_service.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; +import 'package:doctor_app_flutter/models/sickleave/sick_leave_statisitics_model.dart'; import '../../locator.dart'; import 'base_view_model.dart'; class SickLeaveViewModel extends BaseViewModel { SickLeaveService _sickLeaveService = locator(); - get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics; - get getAllSIckLeave => _sickLeaveService.getAllSickLeave; + PatientService _patientService = locator(); + + SickLeaveStatisticsModel get sickLeaveStatistics => + _sickLeaveService.sickLeavestatisitics; + get getAllSIckLeave => _sickLeaveService.getAllSickLeave; List get allOffTime => _sickLeaveService.getOffTimeList; + List get allReasons => _sickLeaveService.getReasons; + List get coveringDoctors => _sickLeaveService.coveringDoctorsList; + List get sickLeaveDoctor => _sickLeaveService.getAllSickLeaveDoctor; + get getReschduleLeave => _sickLeaveService.getAllRescheduleLeave; + get postSechedule => _sickLeaveService.postReschedule; - get getAllSIckLeavePatient => - [..._sickLeaveService.getAllSickLeavePatient, ..._sickLeaveService.getAllSickLeaveDoctor]; + + get getAllSIckLeavePatient => [ + ..._sickLeaveService.getAllSickLeavePatient, + ..._sickLeaveService.getAllSickLeaveDoctor + ]; + Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { setState(ViewState.BusyLocal); await _sickLeaveService.addSickLeave(addSickLeaveRequest); @@ -60,12 +75,36 @@ class SickLeaveViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getSickLeavePatient(patientMRN) async { - setState(ViewState.Busy); + Future getSickLeavePatient(patientMRN, {bool isLocalBusy = false}) async { + if (isLocalBusy) + setState(ViewState.BusyLocal); + else + setState(ViewState.Busy); await _sickLeaveService.getSickLeavePatient(patientMRN); if (_sickLeaveService.hasError) { error = _sickLeaveService.error; setState(ViewState.ErrorLocal); + + } else + setState(ViewState.Idle); + } + + Future getSickLeaveForPatient(PatiantInformtion patient, {bool isLocalBusy = false}) async { + if (isLocalBusy) + setState(ViewState.BusyLocal); + else + setState(ViewState.Busy); + var patientMRN = patient.patientMRN ?? patient.patientId; + var services = [_sickLeaveService.getSickLeavePatient(patientMRN),_sickLeaveService.getSickLeaveDoctor(patientMRN) ]; + + final results = await Future.wait(services); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + // if (isLocalBusy) + setState(ViewState.ErrorLocal); + // else + // setState(ViewState.Error); + } else setState(ViewState.Idle); } diff --git a/lib/models/sickleave/sick_leave_statisitics_model.dart b/lib/models/sickleave/sick_leave_statisitics_model.dart new file mode 100644 index 00000000..f679807c --- /dev/null +++ b/lib/models/sickleave/sick_leave_statisitics_model.dart @@ -0,0 +1,24 @@ +class SickLeaveStatisticsModel { + String recommendedSickLeaveDays; + int totalLeavesByAllClinics; + int totalLeavesByDoctor; + + SickLeaveStatisticsModel( + {this.recommendedSickLeaveDays, + this.totalLeavesByAllClinics, + this.totalLeavesByDoctor}); + + SickLeaveStatisticsModel.fromJson(Map json) { + recommendedSickLeaveDays = json['recommendedSickLeaveDays']; + totalLeavesByAllClinics = json['totalLeavesByAllClinics']; + totalLeavesByDoctor = json['totalLeavesByDoctor']; + } + + Map toJson() { + final Map data = new Map(); + data['recommendedSickLeaveDays'] = this.recommendedSickLeaveDays; + data['totalLeavesByAllClinics'] = this.totalLeavesByAllClinics; + data['totalLeavesByDoctor'] = this.totalLeavesByDoctor; + return data; + } +} diff --git a/lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart b/lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart index c32eed2c..a5ba8819 100644 --- a/lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart +++ b/lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart @@ -5,11 +5,13 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_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/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -28,21 +30,19 @@ import 'package:intl/intl.dart'; Helpers helpers = Helpers(); class AddPatientSickLeaveScreen extends StatefulWidget { - final bool isExtended; - final GetAllSickLeaveResponse extendedData; final appointmentNo; final patientMRN; - final patient; + final PatiantInformtion patient; + final SickLeaveViewModel previousModel; AddPatientSickLeaveScreen( {this.appointmentNo, this.patientMRN, - this.isExtended = false, - this.extendedData, - this.patient}); + this.patient, this.previousModel}); @override - _AddPatientSickLeaveScreenState createState() => _AddPatientSickLeaveScreenState(); + _AddPatientSickLeaveScreenState createState() => + _AddPatientSickLeaveScreenState(); } class _AddPatientSickLeaveScreenState extends State { @@ -53,321 +53,276 @@ class _AddPatientSickLeaveScreenState extends State { TextEditingController _doctorController = new TextEditingController(); TextEditingController _remarkController = new TextEditingController(); - Map profile = {}; AddSickLeaveRequest addSickLeave = AddSickLeaveRequest(); bool isFormSubmitted = false; - void _presentDatePicker(id) { + void _presentDatePicker() { showDatePicker( context: context, initialDate: DateTime.now(), - firstDate: DateTime(2019), - lastDate: DateTime(2050), + firstDate: DateTime(DateTime.now().year-1), + lastDate: DateTime(DateTime.now().year+1), ).then((pickedDate) { if (pickedDate == null) { return; } setState(() { - // var selectedDate = DateFormat.yMd().format(pickedDate); final df = new DateFormat('yyyy-MM-dd'); addSickLeave.startDate = df.format(pickedDate); - - _toDateController.text = addSickLeave.startDate; - //addSickLeave.startDate = selectedDate; + _toDateController.text = AppDateUtils.getDayMonthYearDateFormatted(pickedDate,isMonthShort: true ); }); }); } @override void initState() { - getProfile(); super.initState(); } @override Widget build(BuildContext context) { - return BaseView( + return BaseView( onModelReady: (model) async { - await model.getClinicsList(); - _clinicController.text = getClinicName(model); - _doctorController.text = profile['DoctorName']; + await model.getDoctorProfile(); + _clinicController.text = model.doctorProfile.clinicDescription; + _doctorController.text = model.doctorProfile.doctorName; + await model.preSickLeaveStatistics( + widget.appointmentNo, widget.patientMRN); }, - builder: (_, model, w) => BaseView( - onModelReady: (model2) => model2.preSickLeaveStatistics( - widget.appointmentNo, widget.patientMRN), - builder: (_, model2, w) => GestureDetector( - onTap: () { - FocusScope.of(context).requestFocus(new FocusNode()); - }, - child: AppScaffold( - baseViewModel: model2, - appBar: BottomSheetTitle(title: widget.isExtended == true - ? TranslationBase.of(context).extendSickLeave - : TranslationBase.of(context).addSickLeave,), - isShowAppBar: true, - body: Center( - child: Container( - margin: EdgeInsets.only(top: 10), - child: FractionallySizedBox( - widthFactor: 0.9, - child: ListView( - children: [ - SizedBox( - height: 30, - ), - AppTextFieldCustom( - height: Helpers.getTextFieldHeight(), - hintText: widget.extendedData != null - ? widget.extendedData.noOfDays.toString() - : TranslationBase.of(context).sickLeave + - ' ' + - TranslationBase.of(context).days, - maxLines: 1, - minLines: 1, - dropDownColor: Colors.white, - isTextFieldHasSuffix: true, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - controller: _numberOfDayController, - onChanged: (value) { - setState(() { - addSickLeave.noOfDays = value; - }); + builder: (_, model, w) => GestureDetector( + onTap: () { + FocusScope.of(context).requestFocus(new FocusNode()); + }, + child: AppScaffold( + baseViewModel: model, + appBar: BottomSheetTitle( + title: TranslationBase.of(context).addSickLeave, + ), + isShowAppBar: true, + body: Center( + child: Container( + margin: EdgeInsets.only(top: 10), + child: FractionallySizedBox( + widthFactor: 0.9, + child: ListView( + children: [ + SizedBox( + height: 30, + ), + AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + hintText: TranslationBase.of(context).sickLeave + + ' ' + + TranslationBase.of(context).days, + maxLines: 1, + minLines: 1, + dropDownColor: Colors.white, + isTextFieldHasSuffix: true, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + inputType:TextInputType.number, + controller: _numberOfDayController, + onChanged: (value) { + if(value.isNotEmpty) + setState(() { + addSickLeave.noOfDays = value; + }); - if (widget.extendedData != null) { - widget.extendedData.noOfDays = - int.parse(value); - } - }, - validationError: isFormSubmitted && - (addSickLeave.noOfDays == null) - ? TranslationBase.of(context) - .pleaseEnterNoOfDays - : null, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: Helpers.getTextFieldHeight(), - onClick: () { - _presentDatePicker('_selectedToDate'); - }, - hintText: widget.extendedData != null - ? widget.extendedData.startDate - : TranslationBase.of(context) - .sickLeaveDate, - enabled: false, - maxLines: 1, - minLines: 1, - isTextFieldHasSuffix: true, - suffixIcon: IconButton( - icon: Icon(Icons.calendar_today)), - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - controller: _toDateController, - onChanged: (value) { - setState(() { - addSickLeave.startDate = value; - }); - if (widget.extendedData != null) { - widget.extendedData.startDate = value; - } - }, - validationError: isFormSubmitted && - (addSickLeave.startDate == null) - ? TranslationBase.of(context) - .pleaseEnterDate - : null, - ), - SizedBox( - height: 5, - ), - AppTextFieldCustom( - height: Helpers.getTextFieldHeight(), - hintText: - TranslationBase.of(context).clinic, - enabled: false, - maxLines: 1, - minLines: 1, - dropDownColor: Colors.white, - isTextFieldHasSuffix: true, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - controller: _clinicController, - onChanged: (value) {}, - ), - SizedBox( - height: 10, - ), - model2.sickLeaveStatistics[ - 'recommendedSickLeaveDays'] != - null - ? Row( - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - SizedBox( - width: 10, - ), - Icon( - DoctorApp.warning, - size: 20, - color: IN_PROGRESS_COLOR, - ), - SizedBox( - width: 10, - ), - AppText( - model2.sickLeaveStatistics[ - 'recommendedSickLeaveDays'], - textAlign: TextAlign.start, - fontSize: 12, - color: IN_PROGRESS_COLOR, - ), - ], - ) - : SizedBox( - height: 10, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: Helpers.getTextFieldHeight(), - hintText: - TranslationBase.of(context).doctor, - enabled: false, - maxLines: 1, - minLines: 1, - dropDownColor: Colors.white, - isTextFieldHasSuffix: true, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - controller: _doctorController, - onChanged: (value) {}, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: Helpers.getTextFieldHeight(), - hintText: widget.extendedData != null - ? widget.extendedData.remarks - : TranslationBase.of(context).remarks, - maxLines: 30, - minLines: 5, - dropDownColor: Colors.white, - isTextFieldHasSuffix: true, - controller: _remarkController, - onChanged: (value) { - setState(() { - addSickLeave.remarks = value; - }); - if (widget.extendedData != null) { - widget.extendedData.remarks = value; - } - }, - validationError: isFormSubmitted && - (addSickLeave.remarks == null) - ? TranslationBase.of(context) - .pleaseEnterRemarks - : null, - ), - ], + }, + validationError: isFormSubmitted && + (addSickLeave.noOfDays == null) + ? TranslationBase.of(context) + .pleaseEnterNoOfDays + : null, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + onClick: () { + _presentDatePicker(); + }, + hintText: TranslationBase.of(context) + .sickLeaveDate, + enabled: false, + maxLines: 1, + minLines: 1, + isTextFieldHasSuffix: true, + suffixIcon: IconButton( + icon: Icon(Icons.calendar_today)), + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + controller: _toDateController, + onChanged: (value) { + setState(() { + addSickLeave.startDate = value; + }); + + }, + validationError: isFormSubmitted && + (addSickLeave.startDate == null) + ? TranslationBase.of(context) + .pleaseEnterDate + : null, + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + hintText: TranslationBase.of(context).clinic, + enabled: false, + maxLines: 1, + minLines: 1, + dropDownColor: Colors.white, + isTextFieldHasSuffix: true, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + controller: _clinicController, + onChanged: (value) {}, + ), + SizedBox( + height: 10, + ), + model.sickLeaveStatistics.recommendedSickLeaveDays!= + null + ? Row( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + SizedBox( + width: 10, + ), + Icon( + DoctorApp.warning, + size: 20, + color: IN_PROGRESS_COLOR, ), - ), + SizedBox( + width: 10, + ), + AppText( + model.sickLeaveStatistics.recommendedSickLeaveDays, + textAlign: TextAlign.start, + fontSize: 12, + color: IN_PROGRESS_COLOR, + ), + ], + ) + : SizedBox( + height: 10, + ), + SizedBox( + height: 10, ), - ), - bottomSheet: model2.state == ViewState.Busy || - model.state == ViewState.Busy - ? Container( - height: 0, - ) - : Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all( - color: HexColor('#707070'), width: 0), - ), - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 12 : 10), - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - FractionallySizedBox( - widthFactor: 0.9, - child: AppButton( - title: widget.isExtended == true - ? TranslationBase.of(context).extend - : TranslationBase.of(context) - .addSickLeaverequest, - color: Colors.green, - onPressed: () async { - submitForm(model2); - }), - ), - SizedBox( - height: 5, - ), - ], - ), - )), - ))); + AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + hintText: TranslationBase.of(context).doctor, + enabled: false, + maxLines: 1, + minLines: 1, + dropDownColor: Colors.white, + isTextFieldHasSuffix: true, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + controller: _doctorController, + onChanged: (value) {}, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + hintText: TranslationBase.of(context).remarks, + maxLines: 30, + minLines: 5, + dropDownColor: Colors.white, + isTextFieldHasSuffix: true, + controller: _remarkController, + onChanged: (value) { + setState(() { + addSickLeave.remarks = value; + }); + }, + ), + ], + ), + ), + ), + ), + bottomSheet: model.state == ViewState.Busy || + model.state == ViewState.Busy + ? Container( + height: 0, + ) + : Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all( + color: HexColor('#707070'), width: 0), + ), + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 12 : 10), + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, + ), + FractionallySizedBox( + widthFactor: 0.9, + child: AppButton( + title: TranslationBase.of(context) + .addSickLeaverequest, + color: Colors.green, + onPressed: () async { + submitForm(model); + }), + ), + SizedBox( + height: 5, + ), + ], + ), + )), + )); } - submitForm(SickLeaveViewModel model2) async { + submitForm(SickLeaveViewModel model) async { { - if (widget.isExtended) { - GifLoaderDialogUtils.showMyDialog(context); - await model2.extendSickLeave(widget.extendedData); - if (model2.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model2.error); - } else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context).replySuccessfully); - Navigator.of(context).popUntil((route) { - return route.settings.name == PATIENTS_PROFILE; - }); - Navigator.of(context) - .pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient}); - } - - GifLoaderDialogUtils.hideDialog(context); - } else { try { setState(() { isFormSubmitted = true; }); if (addSickLeave.noOfDays == null || - addSickLeave.startDate == null || - addSickLeave.remarks == null) { + addSickLeave.startDate == null ) { return; } else { GifLoaderDialogUtils.showMyDialog(context); addSickLeave.patientMRN = widget.patient.patientMRN.toString(); addSickLeave.appointmentNo = widget.patient.appointmentNo.toString(); - await model2.addSickLeave(addSickLeave); - if (model2.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model2.error); + await model.addSickLeave(addSickLeave); + if (model.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(model.error); } else { + await widget.previousModel + .getSickLeaveForPatient(widget.patient, isLocalBusy: true); DrAppToastMsg.showSuccesToast( TranslationBase.of(context).replySuccessfully); + Navigator.of(context).pop(); } GifLoaderDialogUtils.hideDialog(context); @@ -375,21 +330,8 @@ class _AddPatientSickLeaveScreenState extends State { } catch (err) { print(err); } - } - } - } - getProfile() async { - Map p = await sharedPref.getObj(DOCTOR_PROFILE); - setState(() { - this.profile = p; - }); + } } - getClinicName(model) { - var clinicInfo = model.clinicsList - .where((i) => i['ClinicID'] == this.profile['ClinicID']) - .toList(); - return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; - } } diff --git a/lib/screens/patient-sick-leave/patient_sick_leave_screen.dart b/lib/screens/patient-sick-leave/patient_sick_leave_screen.dart index 55114803..c38aab4a 100644 --- a/lib/screens/patient-sick-leave/patient_sick_leave_screen.dart +++ b/lib/screens/patient-sick-leave/patient_sick_leave_screen.dart @@ -6,7 +6,6 @@ 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/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.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/patient-sick-leave/add_patient_sick_leave_screen.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; @@ -35,9 +34,7 @@ class PatientSickLeaveScreen extends StatelessWidget { bool isInpatient = routeArgs['isInpatient']; return BaseView( onModelReady: (model) async { - await model - .getSickLeavePatient(patient.patientMRN ?? patient.patientId); - await model.getSickLeaveDoctor(patient.patientMRN ?? patient.patientId); + await model.getSickLeaveForPatient(patient); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, @@ -94,10 +91,7 @@ class PatientSickLeaveScreen extends StatelessWidget { "Leave Screen", eventAction: "apply For Sick Leave", ); - openSickLeave( - context, - false, - ); + openSickLeave(context, model); }), ], ) @@ -288,22 +282,17 @@ class PatientSickLeaveScreen extends StatelessWidget { ); } - openSickLeave(BuildContext context, isExtend, - {GetAllSickLeaveResponse extendedData}) { + openSickLeave(BuildContext context, model) { Navigator.push( context, SlideUpPageRoute( fullscreenDialog: true, widget: AddPatientSickLeaveScreen( - appointmentNo: isExtend - ? extendedData.appointmentNo - : patient.appointmentNo, - //extendedData.appointmentNo, - patientMRN: - isExtend ? extendedData.patientMRN : patient.patientMRN, - isExtended: isExtend, - extendedData: extendedData, - patient: patient), + appointmentNo: patient.appointmentNo, + patientMRN: patient.patientMRN, + patient: patient, + previousModel: model, + ), ), ); } diff --git a/lib/screens/patients/profile/note/progress_note_screen.dart b/lib/screens/patients/profile/note/progress_note_screen.dart index c43b1ab8..054817c2 100644 --- a/lib/screens/patients/profile/note/progress_note_screen.dart +++ b/lib/screens/patients/profile/note/progress_note_screen.dart @@ -496,7 +496,7 @@ class _ProgressNoteState extends State { isArabic: projectViewModel .isArabic, - isMonthshort: true) + isMonthShort: true) : AppDateUtils .getDayMonthYearDateFormatted( DateTime.now(), diff --git a/lib/util/date-utils.dart b/lib/util/date-utils.dart index c4819ad9..89564833 100644 --- a/lib/util/date-utils.dart +++ b/lib/util/date-utils.dart @@ -297,11 +297,11 @@ class AppDateUtils { /// get data formatted like 26 Apr 2020 /// [dateTime] convert DateTime to data formatted static String getDayMonthYearDateFormatted(DateTime dateTime, - {bool isArabic = false, bool isMonthshort = false}) { + {bool isArabic = false, bool isMonthShort = false}) { if (dateTime != null) return dateTime.day.toString() + " " + - "${isArabic ? getMonthArabic(dateTime.month) : isMonthshort ? getMonth(dateTime.month).toString().substring(0, 3) : getMonth(dateTime.month)}" + + "${isArabic ? getMonthArabic(dateTime.month) : isMonthShort ? getMonth(dateTime.month).toString().substring(0, 3) : getMonth(dateTime.month)}" + " " + dateTime.year.toString(); else