Merge branch 'sick_leave' into 'development'

Sick leave

See merge request Cloud_Solution/doctor_app_flutter!847
merge-requests/848/merge
Mohammad Aljammal 5 years ago
commit c231ae378a

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]"; const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
const BASE_URL = 'https://hmgwebservices.com/'; // const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/'; const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient";

@ -243,15 +243,15 @@ const Map<String, Map<String, String>> localizedValues = {
}, },
"no-sickleve": {"en": "No sick leave available", "ar": "لا توجد إجازة مرضية"}, "no-sickleve": {"en": "No sick leave available", "ar": "لا توجد إجازة مرضية"},
"applynow": {"en": "Apply Now", "ar": "التقدم بطلب الآن"}, "applynow": {"en": "Apply Now", "ar": "التقدم بطلب الآن"},
"add-sickleave": {"en": "ADD SICK LEAVE", "ar": "أضف إجازة مرضية"}, "add-sickleave": {"en": "Add Sick Leave", "ar": "أضف إجازة مرضية"},
"add": {"en": "Add", "ar": "أضف"}, "add": {"en": "Add", "ar": "أضف"},
"approved": {"en": "Approved", "ar": "موافق"}, "approved": {"en": "Approved", "ar": "موافق"},
"extended": {"en": "Extended", "ar": "تمديد"}, "extended": {"en": "Extended", "ar": "تمديد"},
"pending": {"en": "Pending", "ar": "قيد الانتظار"}, "pending": {"en": "Pending", "ar": "قيد الانتظار"},
"leave-start-date": {"en": "Leave start date", "ar": "تاريخ بدء المغادرة"}, "leave-start-date": {"en": "Leave start date", "ar": "تاريخ بدء المغادرة"},
"days-sick-leave": {"en": "DAYS OF SICK LEAVE", "ar": "أيام الإجازة المرضية"}, "days-sick-leave": {"en": "Leave Days: ", "ar": "أيام الإجازة "},
"extend": {"en": "Extend", "ar": "تمديد"}, "extend": {"en": "Extend", "ar": "تمديد"},
"extend-sickleave": {"en": "EXTEND SICK LEAVE", "ar": "قم بتمديد الإجازة المرضية"}, "extend-sickleave": {"en": "Extend Sick Leave", "ar": "قم بتمديد الإجازة المرضية"},
"chiefComplaintLength": { "chiefComplaintLength": {
"en": "Chief Complaint length should be greater than 25", "en": "Chief Complaint length should be greater than 25",
"ar": "يجب أن يكون طول شكوى الرئيسية أكبر من 25" "ar": "يجب أن يكون طول شكوى الرئيسية أكبر من 25"

@ -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/add_sickleave_request.dart';
import 'package:doctor_app_flutter/models/sickleave/extend_sick_leave_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/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'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
class SickLeaveService extends BaseService { class SickLeaveService extends BaseService {
Map get sickLeavestatisitics => _statistics; SickLeaveStatisticsModel get sickLeavestatisitics => _statistics;
Map _statistics = {}; SickLeaveStatisticsModel _statistics = SickLeaveStatisticsModel();
List get getOffTimeList => offTime; List get getOffTimeList => offTime;
List offTime = []; List offTime = [];
List get getReasons => reasonse; List get getReasons => reasonse;
@ -27,12 +28,9 @@ class SickLeaveService extends BaseService {
dynamic get postReschedule => _postReschedule; dynamic get postReschedule => _postReschedule;
dynamic _postReschedule; dynamic _postReschedule;
dynamic get sickLeaveResponse => _sickLeaveResponse;
dynamic _sickLeaveResponse;
List<SickLeavePatientModel> getAllSickLeavePatient = List(); List<SickLeavePatientModel> getAllSickLeavePatient = List();
List<SickLeavePatientModel> getAllSickLeaveDoctor = List(); List<SickLeavePatientModel> getAllSickLeaveDoctor = List();
//getAllSickLeavePatient.addAll(getAllSickLeaveDoctor);
SickLeavePatientRequestModel _sickLeavePatientRequestModel = SickLeavePatientRequestModel(); SickLeavePatientRequestModel _sickLeavePatientRequestModel = SickLeavePatientRequestModel();
GetSickLeaveDoctorRequestModel _sickLeaveDoctorRequestModel = GetSickLeaveDoctorRequestModel(); GetSickLeaveDoctorRequestModel _sickLeaveDoctorRequestModel = GetSickLeaveDoctorRequestModel();
@ -43,8 +41,8 @@ class SickLeaveService extends BaseService {
GET_SICKLEAVE_STATISTIC, GET_SICKLEAVE_STATISTIC,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
print(response); print(response);
_statistics = {};
_statistics = response['SickLeaveStatistics']; _statistics = SickLeaveStatisticsModel.fromJson(response['SickLeaveStatistics']);
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -55,20 +53,14 @@ class SickLeaveService extends BaseService {
} }
Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async {
// addSickLeaveRequest.appointmentNo = '2016054661';
// addSickLeaveRequest.patientMRN = '3120746';
hasError = false; hasError = false;
_sickLeaveResponse.clear();
await baseAppClient.post( await baseAppClient.post(
ADD_SICK_LEAVE, ADD_SICK_LEAVE,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_sickLeaveResponse = response;
return Future.value(response);
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
DrAppToastMsg.showErrorToast(error); hasError = true;
// hasError = true; super.error = error;
// super.error = error;
}, },
body: addSickLeaveRequest.toJson(), body: addSickLeaveRequest.toJson(),
); );
@ -84,7 +76,6 @@ class SickLeaveService extends BaseService {
await baseAppClient.post( await baseAppClient.post(
EXTEND_SICK_LEAVE, EXTEND_SICK_LEAVE,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_sickLeaveResponse = response;
return Future.value(response); return Future.value(response);
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {

@ -1,42 +1,56 @@
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; 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/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/add_sickleave_request.dart';
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.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 '../../locator.dart';
import 'base_view_model.dart'; import 'base_view_model.dart';
class SickLeaveViewModel extends BaseViewModel { class SickLeaveViewModel extends BaseViewModel {
SickLeaveService _sickLeaveService = locator<SickLeaveService>(); SickLeaveService _sickLeaveService = locator<SickLeaveService>();
get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics; PatientService _patientService = locator<PatientService>();
SickLeaveStatisticsModel get sickLeaveStatistics =>
_sickLeaveService.sickLeavestatisitics;
get getAllSIckLeave => _sickLeaveService.getAllSickLeave; get getAllSIckLeave => _sickLeaveService.getAllSickLeave;
//get getAllSIckLeavePatient => _sickLeaveService.getAllSickLeavePatient;
get sickleaveResponse => _sickLeaveService.sickLeaveResponse;
List get allOffTime => _sickLeaveService.getOffTimeList; List get allOffTime => _sickLeaveService.getOffTimeList;
List get allReasons => _sickLeaveService.getReasons; List get allReasons => _sickLeaveService.getReasons;
List get coveringDoctors => _sickLeaveService.coveringDoctorsList; List get coveringDoctors => _sickLeaveService.coveringDoctorsList;
List get sickLeaveDoctor => _sickLeaveService.getAllSickLeaveDoctor; List get sickLeaveDoctor => _sickLeaveService.getAllSickLeaveDoctor;
get getReschduleLeave => _sickLeaveService.getAllRescheduleLeave; get getReschduleLeave => _sickLeaveService.getAllRescheduleLeave;
get postSechedule => _sickLeaveService.postReschedule; get postSechedule => _sickLeaveService.postReschedule;
get getAllSIckLeavePatient =>
[..._sickLeaveService.getAllSickLeavePatient, ..._sickLeaveService.getAllSickLeaveDoctor]; get getAllSIckLeavePatient => [
..._sickLeaveService.getAllSickLeavePatient,
..._sickLeaveService.getAllSickLeaveDoctor
];
Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async {
setState(ViewState.Busy); setState(ViewState.BusyLocal);
await _sickLeaveService.addSickLeave(addSickLeaveRequest); await _sickLeaveService.addSickLeave(addSickLeaveRequest);
if (_sickLeaveService.hasError) { if (_sickLeaveService.hasError) {
error = _sickLeaveService.error; error = _sickLeaveService.error;
setState(ViewState.Error); setState(ViewState.ErrorLocal);
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future extendSickLeave(GetAllSickLeaveResponse extendSickLeaveRequest) async { Future extendSickLeave(GetAllSickLeaveResponse extendSickLeaveRequest) async {
setState(ViewState.Busy); setState(ViewState.BusyLocal);
await _sickLeaveService.extendSickLeave(extendSickLeaveRequest); await _sickLeaveService.extendSickLeave(extendSickLeaveRequest);
if (_sickLeaveService.hasError) { if (_sickLeaveService.hasError) {
error = _sickLeaveService.error; error = _sickLeaveService.error;
setState(ViewState.Error); setState(ViewState.ErrorLocal);
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }
@ -61,12 +75,36 @@ class SickLeaveViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getSickLeavePatient(patientMRN) async { Future getSickLeavePatient(patientMRN, {bool isLocalBusy = false}) async {
setState(ViewState.Busy); if (isLocalBusy)
setState(ViewState.BusyLocal);
else
setState(ViewState.Busy);
await _sickLeaveService.getSickLeavePatient(patientMRN); await _sickLeaveService.getSickLeavePatient(patientMRN);
if (_sickLeaveService.hasError) { if (_sickLeaveService.hasError) {
error = _sickLeaveService.error; error = _sickLeaveService.error;
setState(ViewState.ErrorLocal); 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 } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }

@ -0,0 +1,24 @@
class SickLeaveStatisticsModel {
String recommendedSickLeaveDays;
int totalLeavesByAllClinics;
int totalLeavesByDoctor;
SickLeaveStatisticsModel(
{this.recommendedSickLeaveDays,
this.totalLeavesByAllClinics,
this.totalLeavesByDoctor});
SickLeaveStatisticsModel.fromJson(Map<String, dynamic> json) {
recommendedSickLeaveDays = json['recommendedSickLeaveDays'];
totalLeavesByAllClinics = json['totalLeavesByAllClinics'];
totalLeavesByDoctor = json['totalLeavesByDoctor'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['recommendedSickLeaveDays'] = this.recommendedSickLeaveDays;
data['totalLeavesByAllClinics'] = this.totalLeavesByAllClinics;
data['totalLeavesByDoctor'] = this.totalLeavesByDoctor;
return data;
}
}

@ -1,6 +1,7 @@
import 'package:doctor_app_flutter/root_page.dart'; import 'package:doctor_app_flutter/root_page.dart';
import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart'; import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart';
import 'package:doctor_app_flutter/screens/medical-file/health_summary_page.dart'; import 'package:doctor_app_flutter/screens/medical-file/health_summary_page.dart';
import 'package:doctor_app_flutter/screens/patient-sick-leave/patient_sick_leave_screen.dart';
import 'package:doctor_app_flutter/screens/patients/ECGPage.dart'; import 'package:doctor_app_flutter/screens/patients/ECGPage.dart';
import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/all_lab_special_result_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/all_lab_special_result_page.dart';
@ -15,8 +16,6 @@ import 'package:doctor_app_flutter/screens/patients/profile/referral/refer-patie
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/update_soap_index.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/update_soap_index.dart';
import 'package:doctor_app_flutter/screens/prescription/prescriptions_page.dart'; import 'package:doctor_app_flutter/screens/prescription/prescriptions_page.dart';
import 'package:doctor_app_flutter/screens/procedures/procedure_screen.dart'; import 'package:doctor_app_flutter/screens/procedures/procedure_screen.dart';
import 'package:doctor_app_flutter/screens/sick-leave/add-sickleave.dart';
import 'package:doctor_app_flutter/screens/sick-leave/show-sickleave.dart';
import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart';
import './screens/auth/login_screen.dart'; import './screens/auth/login_screen.dart';
@ -65,7 +64,6 @@ const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details';
const String ORDER_PRESCRIPTION_NEW = 'prescription/prescription_new'; const String ORDER_PRESCRIPTION_NEW = 'prescription/prescription_new';
const String ORDER_PROCEDURE = 'procedure/procedure'; const String ORDER_PROCEDURE = 'procedure/procedure';
const String ADD_SICKLEAVE = 'add-sickleave'; const String ADD_SICKLEAVE = 'add-sickleave';
const String SHOW_SICKLEAVE = 'show-sickleave';
const String RADIOLOGY_PATIENT = 'radiology-patient'; const String RADIOLOGY_PATIENT = 'radiology-patient';
const String ALL_SPECIAL_LAB_RESULT = 'all-special_lab'; const String ALL_SPECIAL_LAB_RESULT = 'all-special_lab';
@ -103,8 +101,7 @@ var routes = {
isUpdate: true, isUpdate: true,
), ),
IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(), IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(),
ADD_SICKLEAVE: (_) => AddSickLeavScreen(), ADD_SICKLEAVE: (_) => PatientSickLeaveScreen(),
SHOW_SICKLEAVE: (_) => ShowSickLeaveScreen(),
ORDER_PRESCRIPTION_NEW: (_) => PrescriptionsPage(), ORDER_PRESCRIPTION_NEW: (_) => PrescriptionsPage(),
ORDER_PROCEDURE: (_) => ProcedureScreen(), ORDER_PROCEDURE: (_) => ProcedureScreen(),
MY_REFERRAL_DETAIL: (_) => MyReferralDetailScreen(), MY_REFERRAL_DETAIL: (_) => MyReferralDetailScreen(),

@ -0,0 +1,341 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
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';
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_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:intl/intl.dart';
Helpers helpers = Helpers();
class AddPatientSickLeaveScreen extends StatefulWidget {
final appointmentNo;
final patientMRN;
final PatiantInformtion patient;
final SickLeaveViewModel previousModel;
AddPatientSickLeaveScreen(
{this.appointmentNo,
this.patientMRN,
this.patient, this.previousModel});
@override
_AddPatientSickLeaveScreenState createState() =>
_AddPatientSickLeaveScreenState();
}
class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
TextEditingController _toDateController = new TextEditingController();
TextEditingController _numberOfDayController = new TextEditingController();
TextEditingController _clinicController = new TextEditingController();
TextEditingController _doctorController = new TextEditingController();
TextEditingController _remarkController = new TextEditingController();
DateTime currentDate;
AddSickLeaveRequest addSickLeave = AddSickLeaveRequest();
bool isFormSubmitted = false;
void _presentDatePicker() {
showDatePicker(
context: context,
initialDate: currentDate??DateTime.now(),
firstDate: DateTime(DateTime.now().year-1),
lastDate: DateTime(DateTime.now().year+1),
).then((pickedDate) {
if (pickedDate == null) {
return;
}
setState(() {
final df = new DateFormat('yyyy-MM-dd');
addSickLeave.startDate = df.format(pickedDate);
currentDate = pickedDate;
_toDateController.text = AppDateUtils.getDayMonthYearDateFormatted(pickedDate,isMonthShort: true );
});
});
}
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return BaseView<SickLeaveViewModel>(
onModelReady: (model) async {
await model.getDoctorProfile();
_clinicController.text = model.doctorProfile.clinicDescription;
_doctorController.text = model.doctorProfile.doctorName;
await model.preSickLeaveStatistics(
widget.appointmentNo, widget.patientMRN);
},
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;
});
},
validationError: isFormSubmitted &&
(addSickLeave.noOfDays == null)
? TranslationBase.of(context)
.pleaseEnterNoOfDays
: null,
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
height: Helpers.getTextFieldHeight(),
onClick: () {
Helpers.hideKeyboard(context);
_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,
),
Expanded(
child: AppText(
model.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: 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 model) async {
{
try {
setState(() {
isFormSubmitted = true;
});
if (addSickLeave.noOfDays == null ||
addSickLeave.startDate == null ) {
return;
} else {
GifLoaderDialogUtils.showMyDialog(context);
addSickLeave.patientMRN = widget.patient.patientMRN.toString();
addSickLeave.appointmentNo =
widget.patient.appointmentNo.toString();
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);
}
} catch (err) {
print(err);
}
}
}
}

@ -0,0 +1,298 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_patient_model.dart';
import 'package:doctor_app_flutter/core/service/AnalyticsService.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/locator.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.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';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart';
import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PatientSickLeaveScreen extends StatelessWidget {
PatiantInformtion patient;
@override
Widget build(BuildContext context) {
ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context);
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
patient = routeArgs['patient'];
bool isInpatient = routeArgs['isInpatient'];
return BaseView<SickLeaveViewModel>(
onModelReady: (model) async {
await model.getSickLeaveForPatient(patient);
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
backgroundColor: Colors.grey[100],
appBar: PatientProfileAppBar(
patient,
isInpatient: isInpatient,
),
body: Column(children: [
patient.patientStatusType == 43
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: SizeConfig.isHeightVeryShort
? 30
: SizeConfig.isHeightShort
? 35
: 10,
),
if (!projectsProvider.isArabic)
AppText(
TranslationBase.of(context).patient,
fontSize:
SizeConfig.getTextMultiplierBasedOnWidth() *
(SizeConfig.isWidthLarge ? 3 : 4),
fontWeight: FontWeight.w700,
letterSpacing: -0.72,
color: Color(0xFF2E303A),
),
AppText(
TranslationBase.of(context).sickLeave,
fontSize:
SizeConfig.getTextMultiplierBasedOnWidth() *
(SizeConfig.isWidthLarge ? 6 : 6),
fontWeight: FontWeight.bold,
letterSpacing: -1.44,
color: Color(0xFF2E303A),
),
],
),
),
AddNewOrder(
label: TranslationBase.of(context).noSickLeaveApplied,
onTap: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Add Sick Leave Screen"
"Leave Screen",
eventAction: "apply For Sick Leave",
);
openSickLeave(context, model);
}),
],
)
: SizedBox(),
model.getAllSIckLeavePatient.length > 0
? Expanded(
child: FractionallySizedBox(
widthFactor: 0.95,
child: ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model.getAllSIckLeavePatient.length,
itemBuilder: (BuildContext ctxt, int index) {
SickLeavePatientModel item =
model.getAllSIckLeavePatient[index];
return Column(
children: [
CardWithBgWidget(
padding: 0,
marginLeft: 10,
marginSymmetric: 10,
hasBorder: false,
bgColor: Colors.black,
widget: Container(
color: Colors.white,
padding: EdgeInsets.all(20),
child: InkWell(
child: Column(
children: [
if(item.doctorName != null)
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Expanded(
// width: MediaQuery.of(context).size.width*0.51,
child: AppText(
Helpers.capitalize(
item.doctorName ?? ""),
fontSize: 18,
color: Color(0xff2e303a),
fontWeight: FontWeight.w700,
fontFamily: 'Poppins',
textOverflow:
TextOverflow.ellipsis,
),
),
]),
SizedBox(
height: 10,
),
Row(
children: [
ClipRRect(
borderRadius:
BorderRadius.circular(50.0),
child: CachedNetworkImage(
imageUrl: item
.doctorImageURL ??
"https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png",
height: 30,
width: 30,
errorWidget:
(context, url, error) =>
AppText(
'No Image',
fontSize: 10,
),
),
),
SizedBox(
width: 10,
),
Column(
children: [
CustomRow(
label: TranslationBase.of(
context)
.daysSickleave +
": ",
labelSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.3,
valueSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
4,
value: (item.sickLeaveDays
.toString() !=
null &&
item.sickLeaveDays
.toString() !=
"null")
? item.sickLeaveDays
.toString()
: item.noOfDays
.toString(),
),
CustomRow(
label: TranslationBase.of(
context)
.startDate +
' ' ??
"",
labelSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.3,
valueSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
4,
value: AppDateUtils
.getDayMonthYearDateFormatted(
item.startDate.contains(
"/Date(")
? AppDateUtils
.convertStringToDate(
item
.startDate)
: DateTime.parse(
item.startDate),
),
),
CustomRow(
label: TranslationBase.of(
context)
.endDate +
' ' ??
"",
labelSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.3,
valueSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
4,
value: AppDateUtils
.getDayMonthYearDateFormatted(
item.startDate.contains(
"/Date(")
? AppDateUtils
.convertStringToDate(
item.endDate ??
"")
.add(
Duration(
days: item
.noOfDays ??
item.sickLeaveDays),
)
: DateTime.parse(
item.startDate ??
"")
.add(
Duration(
days:
item.noOfDays ??
""),
),
),
),
],
crossAxisAlignment:
CrossAxisAlignment.start,
),
],
),
],
),
),
),
),
],
);
}),
),
)
: patient.patientStatusType != 43
? ErrorMessage(
error: TranslationBase.of(context).noSickLeave,
)
: SizedBox(),
SizedBox(
height: 100,
)
]),
),
);
}
openSickLeave(BuildContext context, model) {
Navigator.push(
context,
SlideUpPageRoute(
fullscreenDialog: true,
widget: AddPatientSickLeaveScreen(
appointmentNo: patient.appointmentNo,
patientMRN: patient.patientMRN,
patient: patient,
previousModel: model,
),
),
);
}
}

@ -496,7 +496,7 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
isArabic: isArabic:
projectViewModel projectViewModel
.isArabic, .isArabic,
isMonthshort: true) isMonthShort: true)
: AppDateUtils : AppDateUtils
.getDayMonthYearDateFormatted( .getDayMonthYearDateFormatted(
DateTime.now(), DateTime.now(),

@ -46,7 +46,7 @@ class _AddMedicationState extends State<AddMedication> {
GetMedicationResponseModel _selectedMedication; GetMedicationResponseModel _selectedMedication;
GlobalKey key = GlobalKey key =
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>(); new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
bool isFormSubmitted = false; bool isFormSubmitted = false;
@override @override
@ -54,424 +54,395 @@ class _AddMedicationState extends State<AddMedication> {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return FractionallySizedBox( return FractionallySizedBox(
child: BaseView<SOAPViewModel>( child: BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
model.onAddMedicationStart(); model.onAddMedicationStart();
}, },
builder: (_, model, w) => builder: (_, model, w) => AppScaffold(
AppScaffold( baseViewModel: model,
baseViewModel: model, isShowAppBar: true,
isShowAppBar: true, appBar: BottomSheetTitle(
appBar: BottomSheetTitle( title: TranslationBase.of(context).addMedication,
title: TranslationBase ),
.of(context) body: Center(
.addMedication, child: Container(
), child: Column(
body: Center( crossAxisAlignment: CrossAxisAlignment.start,
child: Container( children: [
child: Column( SizedBox(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 10, height: 10,
), ),
Expanded( Expanded(
child: FractionallySizedBox( child: FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier * ( height: SizeConfig.heightMultiplier *
SizeConfig.isHeightVeryShort ?2:SizeConfig.isHeightShort? (SizeConfig.isHeightVeryShort
2:2), ? 2
), : SizeConfig.isHeightShort
Container( ? 2
// height: screenSize.height * 0.070, : 2),
child: InkWell( ),
onTap: model.allMedicationList != null Container(
? () { // height: screenSize.height * 0.070,
setState(() { child: InkWell(
_selectedMedication = null; onTap: model.allMedicationList != null
}); ? () {
} setState(() {
: null, _selectedMedication = null;
child: _selectedMedication == null });
? CustomAutoCompleteTextField( }
isShowError: isFormSubmitted && : null,
_selectedMedication == null, child: _selectedMedication == null
child: AutoCompleteTextField< ? CustomAutoCompleteTextField(
GetMedicationResponseModel>( isShowError: isFormSubmitted &&
decoration: TextFieldsUtils _selectedMedication == null,
.textFieldSelectorDecoration( child: AutoCompleteTextField<
TranslationBase GetMedicationResponseModel>(
.of( decoration: TextFieldsUtils
context) .textFieldSelectorDecoration(
.searchMedicineNameHere, TranslationBase.of(
null, context)
true, .searchMedicineNameHere,
suffixIcon: null,
Icons.search), true,
itemSubmitted: (item) => suffixIcon:
setState(() => Icons.search),
_selectedMedication = itemSubmitted: (item) =>
item), setState(() =>
key: key, _selectedMedication =
suggestions: item),
model.allMedicationList, key: key,
itemBuilder: (context, suggestions:
suggestion) => model.allMedicationList,
new Padding( itemBuilder: (context,
child: AppText(suggestion suggestion) =>
.description + new Padding(
'/' + child: AppText(suggestion
suggestion .description +
.genericName), '/' +
padding: suggestion
EdgeInsets.all( .genericName),
8.0)), padding: EdgeInsets.all(
itemSorter: (a, b) => 1, 8.0)),
itemFilter: (suggestion, itemSorter: (a, b) => 1,
input) => itemFilter: (suggestion,
suggestion.genericName.toLowerCase() input) =>
.startsWith(input.toLowerCase()) || suggestion.genericName.toLowerCase().startsWith(
suggestion.description input.toLowerCase()) ||
.toLowerCase() suggestion.description
.startsWith(input .toLowerCase()
.toLowerCase()) || .startsWith(input
suggestion.keywords .toLowerCase()) ||
.toLowerCase() suggestion.keywords
.startsWith(input .toLowerCase()
.toLowerCase()), .startsWith(input
), .toLowerCase()),
) ),
: AppTextFieldCustom( )
height: Helpers.getTextFieldHeight(), : AppTextFieldCustom(
hintText: _selectedMedication != height:
null Helpers.getTextFieldHeight(),
? _selectedMedication hintText: _selectedMedication !=
.description + null
(' (${_selectedMedication.genericName} )') ? _selectedMedication
: TranslationBase .description +
.of( (' (${_selectedMedication.genericName} )')
context) : TranslationBase.of(context)
.searchMedicineNameHere, .searchMedicineNameHere,
minLines: 1, minLines: 1,
maxLines: 1, maxLines: 1,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon( icon: Icon(
Icons.search, Icons.search,
color: Colors.grey.shade600, color: Colors.grey.shade600,
)), )),
enabled: false, enabled: false,
), ),
), ),
), ),
if (_selectedMedication != null)
if(_selectedMedication != null) Column(
Column( children: [
children: [ SizedBox(
SizedBox( height: 3,
height: 3, ),
), Container(
Container( width: MediaQuery.of(context)
width: MediaQuery .size
.of(context) .width *
.size 0.7,
.width * 0.7, child: AppText(
child: AppText( _selectedMedication.description +
_selectedMedication.description + (' (${_selectedMedication.genericName} )'),
(' (${_selectedMedication.genericName} )'), color: Color(0xFF575757),
color: Color(0xFF575757), fontSize: 10,
fontSize: 10, fontWeight: FontWeight.w700,
fontWeight: FontWeight.w700, letterSpacing: -0.4,
letterSpacing: -0.4, ),
), ),
), ],
], ),
), SizedBox(
SizedBox( height: 5,
height: 5, ),
), AppTextFieldCustom(
AppTextFieldCustom( height: Helpers.getTextFieldHeight(),
height: Helpers.getTextFieldHeight(), enabled: false,
enabled: false, onClick: model.medicationDoseTimeList !=
onClick: model.medicationDoseTimeList != null
null ? () {
? () { MasterKeyDailog dialog =
MasterKeyDailog dialog = MasterKeyDailog(
MasterKeyDailog( list:
list: model model.medicationDoseTimeList,
.medicationDoseTimeList, okText:
okText: TranslationBase.of(context)
TranslationBase .ok,
.of(context) selectedValue:
.ok, _selectedMedicationDose,
selectedValue: okFunction: (selectedValue) {
_selectedMedicationDose, setState(() {
okFunction: (selectedValue) { _selectedMedicationDose =
setState(() { selectedValue;
_selectedMedicationDose =
selectedValue;
doseController
.text = projectViewModel
.isArabic
? _selectedMedicationDose
.nameAr
: _selectedMedicationDose
.nameEn;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
hintText:
TranslationBase
.of(context)
.doseTime,
maxLines: 1,
minLines: 1,
isTextFieldHasSuffix: true,
controller: doseController,
validationError: isFormSubmitted &&
_selectedMedicationDose == null
? TranslationBase
.of(context)
.emptyMessage
: null,
),
SizedBox(
height: 5,
),
AppTextFieldCustom(
height: Helpers.getTextFieldHeight(),
enabled: false,
isTextFieldHasSuffix: true,
onClick: model.medicationStrengthList !=
null
? () {
MasterKeyDailog dialog =
MasterKeyDailog(
list: model
.medicationStrengthList,
okText:
TranslationBase
.of(context)
.ok,
selectedValue:
_selectedMedicationStrength,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationStrength =
selectedValue;
strengthController doseController
.text = projectViewModel .text = projectViewModel
.isArabic .isArabic
? _selectedMedicationStrength ? _selectedMedicationDose
.nameAr .nameAr
: _selectedMedicationStrength : _selectedMedicationDose
.nameEn; .nameEn;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: builder: (BuildContext context) {
(BuildContext context) { return dialog;
return dialog; },
}, );
); }
} : null,
: null, hintText:
hintText: TranslationBase.of(context).doseTime,
TranslationBase maxLines: 1,
.of(context) minLines: 1,
.strength, isTextFieldHasSuffix: true,
maxLines: 1, controller: doseController,
minLines: 1, validationError: isFormSubmitted &&
controller: strengthController, _selectedMedicationDose == null
validationError: isFormSubmitted && ? TranslationBase.of(context)
_selectedMedicationStrength == .emptyMessage
null : null,
? TranslationBase ),
.of(context) SizedBox(
.emptyMessage height: 5,
: null, ),
), AppTextFieldCustom(
SizedBox( height: Helpers.getTextFieldHeight(),
height: 5, enabled: false,
), isTextFieldHasSuffix: true,
SizedBox( onClick: model.medicationStrengthList !=
height: 5, null
), ? () {
AppTextFieldCustom( MasterKeyDailog dialog =
height: Helpers.getTextFieldHeight(), MasterKeyDailog(
enabled: false, list:
isTextFieldHasSuffix: true, model.medicationStrengthList,
onClick: model.medicationRouteList != null okText:
? () { TranslationBase.of(context)
MasterKeyDailog dialog = .ok,
MasterKeyDailog( selectedValue:
list: model.medicationRouteList, _selectedMedicationStrength,
selectedValue: okFunction: (selectedValue) {
_selectedMedicationRoute, setState(() {
okText: _selectedMedicationStrength =
TranslationBase selectedValue;
.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationRoute =
selectedValue;
routeController strengthController
.text = projectViewModel .text = projectViewModel
.isArabic .isArabic
? _selectedMedicationRoute ? _selectedMedicationStrength
.nameAr .nameAr
: _selectedMedicationRoute : _selectedMedicationStrength
.nameEn; .nameEn;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: builder: (BuildContext context) {
(BuildContext context) { return dialog;
return dialog; },
}, );
); }
} : null,
: null, hintText:
hintText: TranslationBase.of(context).strength,
TranslationBase maxLines: 1,
.of(context) minLines: 1,
.route, controller: strengthController,
maxLines: 1, validationError: isFormSubmitted &&
minLines: 1, _selectedMedicationStrength == null
controller: routeController, ? TranslationBase.of(context)
validationError: isFormSubmitted && .emptyMessage
_selectedMedicationRoute == null : null,
? TranslationBase ),
.of(context) SizedBox(
.emptyMessage height: 5,
: null, ),
), SizedBox(
SizedBox( height: 5,
height: 5, ),
), AppTextFieldCustom(
SizedBox( height: Helpers.getTextFieldHeight(),
height: 5, enabled: false,
), isTextFieldHasSuffix: true,
AppTextFieldCustom( onClick: model.medicationRouteList != null
height: Helpers.getTextFieldHeight(), ? () {
onClick: model.medicationFrequencyList != MasterKeyDailog dialog =
null MasterKeyDailog(
? () { list: model.medicationRouteList,
MasterKeyDailog dialog = selectedValue:
MasterKeyDailog( _selectedMedicationRoute,
list: model okText:
.medicationFrequencyList, TranslationBase.of(context)
okText: .ok,
TranslationBase okFunction: (selectedValue) {
.of(context) setState(() {
.ok, _selectedMedicationRoute =
selectedValue: selectedValue;
_selectedMedicationFrequency,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationFrequency =
selectedValue;
frequencyController routeController
.text = projectViewModel .text = projectViewModel
.isArabic .isArabic
? _selectedMedicationFrequency ? _selectedMedicationRoute
.nameAr .nameAr
: _selectedMedicationFrequency : _selectedMedicationRoute
.nameEn; .nameEn;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: builder: (BuildContext context) {
(BuildContext context) { return dialog;
return dialog; },
}, );
); }
} : null,
: null, hintText: TranslationBase.of(context).route,
hintText: maxLines: 1,
TranslationBase minLines: 1,
.of(context) controller: routeController,
.frequency, validationError: isFormSubmitted &&
enabled: false, _selectedMedicationRoute == null
maxLines: 1, ? TranslationBase.of(context)
minLines: 1, .emptyMessage
isTextFieldHasSuffix: true, : null,
controller: frequencyController, ),
validationError: isFormSubmitted && SizedBox(
_selectedMedicationFrequency == height: 5,
null ),
? TranslationBase SizedBox(
.of(context) height: 5,
.emptyMessage ),
: null, AppTextFieldCustom(
), height: Helpers.getTextFieldHeight(),
SizedBox( onClick: model.medicationFrequencyList !=
height: SizeConfig.heightMultiplier * null
(SizeConfig.isHeightVeryShort ? 20 : SizeConfig ? () {
.isHeightShort ? 15 : 10), MasterKeyDailog dialog =
), MasterKeyDailog(
list:
model.medicationFrequencyList,
okText:
TranslationBase.of(context)
.ok,
selectedValue:
_selectedMedicationFrequency,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationFrequency =
selectedValue;
], frequencyController
.text = projectViewModel
.isArabic
? _selectedMedicationFrequency
.nameAr
: _selectedMedicationFrequency
.nameEn;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
hintText:
TranslationBase.of(context).frequency,
enabled: false,
maxLines: 1,
minLines: 1,
isTextFieldHasSuffix: true,
controller: frequencyController,
validationError: isFormSubmitted &&
_selectedMedicationFrequency == null
? TranslationBase.of(context)
.emptyMessage
: null,
),
SizedBox(
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort
? 20
: SizeConfig.isHeightShort
? 15
: 10),
),
],
),
)),
), ),
)), ]),
), ),
]), ),
), bottomSheet: model.state != ViewState.Idle
), ? Container(
bottomSheet: model.state != ViewState.Idle height: 0,
? Container( )
height: 0, : BottomSheetDialogButton(
) label: TranslationBase.of(context).addMedication,
: BottomSheetDialogButton( onTap: () {
label: setState(() {
TranslationBase.of(context).addMedication, isFormSubmitted = true;
onTap: () { });
setState(() { if (_selectedMedication != null &&
isFormSubmitted = true; _selectedMedicationDose != null &&
}); _selectedMedicationStrength != null &&
if (_selectedMedication != null && _selectedMedicationRoute != null &&
_selectedMedicationDose != null && _selectedMedicationFrequency != null) {
_selectedMedicationStrength != null && widget.medicationController.text = widget
_selectedMedicationRoute != null && .medicationController.text +
_selectedMedicationFrequency != null) { '${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n';
widget.medicationController.text = widget Navigator.of(context).pop();
.medicationController.text + }
'${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n'; },
Navigator.of(context).pop(); )),
} ),
},
)
)
,
)
,
); );
} }
} }

@ -1,329 +0,0 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_patient_model.dart';
import 'package:doctor_app_flutter/core/service/AnalyticsService.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/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/sick-leave/sick_leave.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart';
class AddSickLeavScreen extends StatelessWidget {
PatiantInformtion patient;
@override
Widget build(BuildContext context) {
ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context);
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
patient = routeArgs['patient'];
bool isInpatient = routeArgs['isInpatient'];
return BaseView<SickLeaveViewModel>(
onModelReady: (model) async {
await model
.getSickLeavePatient(patient.patientMRN ?? patient.patientId);
await model
.getSickLeaveDoctor(patient.patientMRN ?? patient.patientId);
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
backgroundColor: Colors.grey[100],
appBar: PatientProfileAppBar(
patient,
isInpatient: isInpatient,
),
body: SingleChildScrollView(
child: Column(children: [
patient.patientStatusType == 43
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (!projectsProvider.isArabic)
AppText(
TranslationBase.of(context).patient,
fontWeight: FontWeight.bold,
),
AppText(
TranslationBase.of(context).sickLeave,
fontSize: 24,
fontWeight: FontWeight.bold,
),
],
)),
InkWell(
onTap: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Add Sick Leave Screen"
"Leave Screen",
eventAction: "apply For Sick Leave",
);
openSickLeave(
context,
false,
);
},
child: Container(
width: SizeConfig.screenWidth,
margin: EdgeInsets.only(
left: 20, right: 20, top: 10, bottom: 10),
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: HexColor('#EAEAEA')),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
child: Container(
decoration: BoxDecoration(
color: Colors.grey,
borderRadius:
BorderRadius.circular(10)),
padding: EdgeInsets.all(3),
child: IconButton(
icon: Icon(
Icons.add,
size: 35,
color: Colors.white,
),
// onPressed: () {
// openSickLeave(
// context,
// false,
// );
// },
),
)),
Padding(
child: AppText(
TranslationBase.of(context)
.noSickLeaveApplied,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 16,
textAlign: TextAlign.center,
color: HexColor('#7E7E7E')),
padding: EdgeInsets.all(10),
),
],
)),
),
],
)
: SizedBox(),
model.getAllSIckLeavePatient.length > 0
? Column(
children: model.getAllSIckLeavePatient
.map<Widget>((SickLeavePatientModel item) {
return RoundedContainer(
margin: EdgeInsets.all(10),
child: Column(
children: [
Container(
// decoration: BoxDecoration(
// border: Border(
// left: BorderSide(
// // color: item.status == 1
// // ? Colors.yellow[800]
// // : item.status == 2
// // ? Colors.green
// // : Colors.black,
// color: Colors.red,
// width: 5.0,
// ))),
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: <Widget>[
Expanded(
flex: 4,
child: Wrap(
// mainAxisAlignment:
// MainAxisAlignment.start,
children: <Widget>[
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
padding: EdgeInsets.all(3),
child: AppText(
item.doctorName ?? "",
// item.status == 1
// ? TranslationBase.of(
// context)
// .hold
// : item.status == 2
// ? TranslationBase
// .of(
// context)
// .active
// : TranslationBase
// .of(context)
// .all,
fontWeight:
FontWeight.bold,
// color: item.status == 1
// ? Colors.yellow[800]
// : item.status == 2
// ? Colors.green
// : Colors.black,
color: Colors.red,
),
),
Row(
children: [
AppText(TranslationBase
.of(context)
.daysSickleave +
": "),
AppText(
(item.sickLeaveDays
.toString() !=
null &&
item.sickLeaveDays
.toString() !=
"null")
? item.sickLeaveDays
.toString()
: item.noOfDays
.toString(),
fontWeight:
FontWeight.bold,
),
],
),
Row(
children: [
AppText(
TranslationBase.of(
context)
.startDate +
' ' ??
"",
),
Flexible(
child: AppText(
AppDateUtils.getDayMonthYearDateFormatted(item
.startDate
.contains(
"/Date(")
? AppDateUtils
.convertStringToDate(item
.startDate)
: DateTime.parse(
item.startDate)),
fontWeight:
FontWeight.bold,
),
)
],
),
Row(
children: [
AppText(
TranslationBase.of(
context)
.endDate +
' ' ??
"",
),
Flexible(
child: AppText(
AppDateUtils.getDayMonthYearDateFormatted(item
.startDate
.contains(
"/Date(")
? AppDateUtils.convertStringToDate(
item.endDate ??
"")
.add(Duration(
days: item.noOfDays ??
item
.sickLeaveDays))
: DateTime.parse(
item.startDate ?? "")
.add(Duration(days: item.noOfDays ?? ""))),
fontWeight:
FontWeight.bold,
),
)
],
),
],
),
SizedBox(
width: 20,
),
],
),
),
],
)),
],
));
}).toList(),
)
: patient.patientStatusType != 43
? Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 100,
),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
TranslationBase.of(context).noSickLeave),
)
],
),
)
: SizedBox()
]))));
}
openSickLeave(BuildContext context, isExtend,
{GetAllSickLeaveResponse extendedData}) {
// showModalBottomSheet(
// context: context,
// builder: (context) {
// return new Container(
// child:
Navigator.push(
context,
FadePage(
page: SickLeaveScreen(
appointmentNo: isExtend == true
? extendedData.appointmentNo
: patient.appointmentNo,
//extendedData.appointmentNo,
patientMRN: isExtend == true
? extendedData.patientMRN
: patient.patientMRN,
isExtended: isExtend,
extendedData: extendedData,
patient: patient)));
}
}

@ -1,198 +0,0 @@
import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.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/util/date-utils.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
import 'package:flutter/material.dart';
class ShowSickLeaveScreen extends StatelessWidget {
PatiantInformtion patient;
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
patient = routeArgs['patient'];
return BaseView<SickLeaveViewModel>(
onModelReady: (model) =>
model.getSickLeave(patient.patientMRN ?? patient.patientId),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
backgroundColor: Colors.grey[100],
appBar: PatientProfileAppBar(
patient,
),
body: SingleChildScrollView(
child: Column(
children: [
// PatientProfileHeaderNewDesign(
// patient, routeArgs['patientType'], routeArgs['arrivalType']),
model.getAllSIckLeave.length > 0
? Column(
children: model.getAllSIckLeave
.map<Widget>((GetAllSickLeaveResponse item) {
return RoundedContainer(
margin: EdgeInsets.all(10),
child: Column(
children: [
Container(
decoration: BoxDecoration(
border: Border(
left: BorderSide(
color: item.status == 1
? Colors.yellow[800]
: item.status == 2
? Colors.green
: Colors.black,
width: 5.0,
))),
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: <Widget>[
Expanded(
flex: 4,
child: Wrap(
// mainAxisAlignment:
// MainAxisAlignment.start,
children: <Widget>[
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
padding: EdgeInsets.all(3),
child: AppText(
item.status == 1
? TranslationBase.of(
context)
.hold
: item.status == 2
? TranslationBase
.of(
context)
.active
: TranslationBase
.of(context)
.all,
fontWeight:
FontWeight.bold,
color: item.status == 1
? Colors.yellow[800]
: item.status == 2
? Colors.green
: Colors.black,
),
),
Row(
children: [
AppText(
TranslationBase.of(
context)
.daysSickleave),
AppText(
item.noOfDays
.toString(),
fontWeight:
FontWeight.bold,
),
],
),
Row(
children: [
AppText(
TranslationBase.of(
context)
.startDate +
' ',
),
Flexible(
child: AppText(
AppDateUtils
.convertStringToDateFormat(
item.startDate,
'dd-MMM-yyyy'),
fontWeight:
FontWeight.bold,
))
],
),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
AppText(
item.remarks ?? "",
),
(item.status == 1)
? IconButton(
icon: Image.asset(
'assets/images/edit.png'),
// color: Colors.green, //Colors.black,
onPressed: () =>
{
if (item.status ==
1)
{
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
.sickleaveonhold)
}
// else
// {
// openSickLeave(
// context,
// true,
// extendedData:
// item)
// }
},
)
: SizedBox()
]),
],
),
SizedBox(
width: 20,
),
],
),
),
],
)),
],
));
}).toList(),
)
: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 100,
),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
TranslationBase.of(context).noSickLeave),
)
],
),
)
],
),
),
),
);
}
}

@ -1,429 +0,0 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
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/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/sick-leave/add-sickleave.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';
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_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:intl/intl.dart';
Helpers helpers = Helpers();
class SickLeaveScreen extends StatefulWidget {
final bool isExtended;
final GetAllSickLeaveResponse extendedData;
final appointmentNo;
final patientMRN;
final patient;
SickLeaveScreen({this.appointmentNo, this.patientMRN, this.isExtended = false, this.extendedData, this.patient});
@override
_SickLeaveScreenState createState() => _SickLeaveScreenState();
}
class _SickLeaveScreenState extends State<SickLeaveScreen> {
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
TextEditingController _toDateController = new TextEditingController();
String _selectedClinic;
Map profile = {};
AddSickLeaveRequest addSickLeave = AddSickLeaveRequest();
void _presentDatePicker(id) {
showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(2019),
lastDate: DateTime(2050),
).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;
});
});
}
@override
void initState() {
getProfile();
super.initState();
}
@override
Widget build(BuildContext context) {
return BaseView<PatientViewModel>(
onModelReady: (model) => model.getClinicsList(),
builder: (_, model, w) => BaseView<SickLeaveViewModel>(
onModelReady: (model2) => model2.preSickLeaveStatistics(widget.appointmentNo, widget.patientMRN),
builder: (_, model2, w) => GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(new FocusNode());
},
child: AppScaffold(
baseViewModel: model2,
appBarTitle: 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: [
// Padding(
// child: AppText(
// widget.isExtended == true
// ? TranslationBase.of(context)
// .extendSickLeave
// : TranslationBase.of(context)
// .addSickLeave,
// fontWeight: FontWeight.bold,
// ),
// padding: EdgeInsets.all(10)),
Container(
margin: EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"),
),
color: Colors.white),
padding: EdgeInsets.all(5),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Padding(
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
child: AppText(TranslationBase.of(context).sickLeave +
' ' +
TranslationBase.of(context).days)),
AppTextFormField(
borderColor: Colors.white,
onChanged: (value) {
addSickLeave.noOfDays = value;
if (widget.extendedData != null) {
widget.extendedData.noOfDays = int.parse(value);
}
},
hintText:
widget.extendedData != null ? widget.extendedData.noOfDays.toString() : '',
// validator: (value) {
// return TextValidator().validateName(value);
// },
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS)
]),
),
SizedBox(
height: 10,
),
Container(
margin: EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
color: Colors.white,
),
padding: EdgeInsets.all(5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
child: AppText(
TranslationBase.of(context).sickLeaveDate,
)),
AppTextFormField(
hintText: widget.extendedData != null ? widget.extendedData.startDate : '',
borderColor: Colors.white,
prefix: IconButton(icon: Icon(Icons.calendar_today)),
textInputType: TextInputType.number,
controller: _toDateController,
onTap: () {
_presentDatePicker('_selectedToDate');
},
inputFormatter: ONLY_DATE,
onChanged: (value) {
addSickLeave.startDate = value;
if (widget.extendedData != null) {
widget.extendedData.startDate = value;
}
}),
],
)),
Container(
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
color: Colors.white,
),
width: double.infinity,
child: Padding(
padding: EdgeInsets.only(
top: SizeConfig.widthMultiplier * 0.9,
bottom: SizeConfig.widthMultiplier * 0.9,
right: SizeConfig.widthMultiplier * 3,
left: SizeConfig.widthMultiplier * 3),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(top: 5),
child: AppText(
TranslationBase.of(context).clinicName,
)),
Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Expanded(
// add Expanded to have your dropdown button fill remaining space
child: DropdownButtonHideUnderline(
child: new IgnorePointer(
ignoring: true,
child: DropdownButton(
isExpanded: true,
value: getClinicName(model) ?? "",
iconSize: 0,
elevation: 16,
selectedItemBuilder: (BuildContext context) {
return model.getClinicNameList().map((item) {
return Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
AppText(
item,
fontSize: SizeConfig.textMultiplier * 2.1,
color: Colors.grey,
),
],
);
}).toList();
},
onChanged: (newValue) => {},
items: model.getClinicNameList().map((item) {
return DropdownMenuItem(
value: item.toString(),
child: Text(
item,
textAlign: TextAlign.end,
),
);
}).toList(),
))),
),
],
)
],
),
)),
model2.sickLeaveStatistics['recommendedSickLeaveDays'] != null
? Padding(
child: AppText(
model2.sickLeaveStatistics['recommendedSickLeaveDays'],
fontWeight: FontWeight.bold,
textAlign: TextAlign.start,
),
padding: EdgeInsets.all(10),
)
: SizedBox(
height: 10,
),
Container(
margin: EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
color: Colors.white,
),
padding: EdgeInsets.all(5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
child: AppText(
TranslationBase.of(context).doctorName,
)),
new IgnorePointer(
ignoring: true,
child: AppTextFormField(
readOnly: true,
hintText: profile['DoctorName'],
borderColor: Colors.white,
onSaved: (value) {},
// validator: (value) {
// return TextValidator().validateName(value);
// },
inputFormatter: ONLY_NUMBERS))
],
),
),
SizedBox(
height: 10,
),
Container(
margin: EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
color: Colors.white,
),
padding: EdgeInsets.all(5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
child: AppText(
TranslationBase.of(context).remarks,
)),
TextField(
maxLines: 3,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(20.0),
border: InputBorder.none,
hintText: widget.extendedData != null ? widget.extendedData.remarks : ''),
onChanged: (value) {
addSickLeave.remarks = value;
if (widget.extendedData != null) {
widget.extendedData.remarks = value;
}
},
)
],
),
),
Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: widget.isExtended == true
? TranslationBase.of(context).extend
: TranslationBase.of(context).addSickLeaverequest,
color: Colors.green,
onPressed: () async {
if (widget.isExtended) {
await model2.extendSickLeave(widget.extendedData);
DrAppToastMsg.showSuccesToast(
model2.sickleaveResponse['ListSickLeavesToExtent']['success']);
Navigator.of(context).popUntil((route) {
return route.settings.name == PATIENTS_PROFILE;
});
Navigator.of(context)
.pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
//print(value);
//});
} else {
try {
if (addSickLeave.noOfDays == null) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseEnterNoOfDays);
} else if (addSickLeave.remarks == null) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseEnterRemarks);
} else if (addSickLeave.startDate == null) {
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterDate);
} else {
addSickLeave.patientMRN = widget.patient.patientMRN.toString();
addSickLeave.appointmentNo = widget.patient.appointmentNo.toString();
await model2.addSickLeave(addSickLeave);
if (model2.sickleaveResponse['SickLeavesList']['success'] != null)
DrAppToastMsg.showSuccesToast(
model2.sickleaveResponse['SickLeavesList']['success']);
}
// Navigator.push(
// context,
// MaterialPageRoute(builder: (context) => AddSickLeavScreen()),
// );
// Navigator.of(context).popUntil((route) {
// return route.settings.name == PATIENTS_PROFILE;
// });
// Navigator.of(context)
// .pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
} catch (err) {
print(err);
}
}
},
),
],
),
),
// Column(
// children: [
// AppText(TranslationBase.of(context)
// .previousSickLeaveIssue +
// ' ')
// ],
// )
],
),
),
),
),
),
)));
}
void _validateInputs(model2) async {
try {
if (addSickLeave.noOfDays == null) {
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterNoOfDays);
} else if (addSickLeave.remarks == null) {
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterRemarks);
} else if (addSickLeave.startDate == null) {
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterDate);
} else {
addSickLeave.patientMRN = widget.patient.patientMRN.toString();
addSickLeave.appointmentNo = widget.patient.appointmentNo.toString();
await model2.addSickLeave(addSickLeave).then((value) => print(value));
DrAppToastMsg.showSuccesToast(model2.sickleaveResponse['ListSickLeavesToExtent']['success']);
Navigator.of(context).popUntil((route) {
return route.settings.name == PATIENTS_PROFILE;
});
Navigator.of(context).pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
}
} 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'] : "";
}
}

@ -297,11 +297,11 @@ class AppDateUtils {
/// get data formatted like 26 Apr 2020 /// get data formatted like 26 Apr 2020
/// [dateTime] convert DateTime to data formatted /// [dateTime] convert DateTime to data formatted
static String getDayMonthYearDateFormatted(DateTime dateTime, static String getDayMonthYearDateFormatted(DateTime dateTime,
{bool isArabic = false, bool isMonthshort = false}) { {bool isArabic = false, bool isMonthShort = false}) {
if (dateTime != null) if (dateTime != null)
return dateTime.day.toString() + 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(); dateTime.year.toString();
else else

@ -30,8 +30,6 @@ class AppTextFieldCustom extends StatefulWidget {
final bool isPrscription; final bool isPrscription;
final bool isSecure; final bool isSecure;
final bool focus; final bool focus;
///TODO Rename it to isCustomSearchablFiels
final bool isSearchTextField; final bool isSearchTextField;
AppTextFieldCustom({ AppTextFieldCustom({

Loading…
Cancel
Save