|
|
|
@ -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/patient_view_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/sick_leave_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/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/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/routes.dart';
|
|
|
|
import 'package:doctor_app_flutter/routes.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/base/base_view.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/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_shared_pref.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/dr_app_toast_msg.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/helpers.dart';
|
|
|
|
@ -28,21 +30,19 @@ import 'package:intl/intl.dart';
|
|
|
|
Helpers helpers = Helpers();
|
|
|
|
Helpers helpers = Helpers();
|
|
|
|
|
|
|
|
|
|
|
|
class AddPatientSickLeaveScreen extends StatefulWidget {
|
|
|
|
class AddPatientSickLeaveScreen extends StatefulWidget {
|
|
|
|
final bool isExtended;
|
|
|
|
|
|
|
|
final GetAllSickLeaveResponse extendedData;
|
|
|
|
|
|
|
|
final appointmentNo;
|
|
|
|
final appointmentNo;
|
|
|
|
final patientMRN;
|
|
|
|
final patientMRN;
|
|
|
|
final patient;
|
|
|
|
final PatiantInformtion patient;
|
|
|
|
|
|
|
|
final SickLeaveViewModel previousModel;
|
|
|
|
|
|
|
|
|
|
|
|
AddPatientSickLeaveScreen(
|
|
|
|
AddPatientSickLeaveScreen(
|
|
|
|
{this.appointmentNo,
|
|
|
|
{this.appointmentNo,
|
|
|
|
this.patientMRN,
|
|
|
|
this.patientMRN,
|
|
|
|
this.isExtended = false,
|
|
|
|
this.patient, this.previousModel});
|
|
|
|
this.extendedData,
|
|
|
|
|
|
|
|
this.patient});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
_AddPatientSickLeaveScreenState createState() => _AddPatientSickLeaveScreenState();
|
|
|
|
_AddPatientSickLeaveScreenState createState() =>
|
|
|
|
|
|
|
|
_AddPatientSickLeaveScreenState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
@ -53,57 +53,51 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
TextEditingController _doctorController = new TextEditingController();
|
|
|
|
TextEditingController _doctorController = new TextEditingController();
|
|
|
|
TextEditingController _remarkController = new TextEditingController();
|
|
|
|
TextEditingController _remarkController = new TextEditingController();
|
|
|
|
|
|
|
|
|
|
|
|
Map profile = {};
|
|
|
|
|
|
|
|
AddSickLeaveRequest addSickLeave = AddSickLeaveRequest();
|
|
|
|
AddSickLeaveRequest addSickLeave = AddSickLeaveRequest();
|
|
|
|
bool isFormSubmitted = false;
|
|
|
|
bool isFormSubmitted = false;
|
|
|
|
|
|
|
|
|
|
|
|
void _presentDatePicker(id) {
|
|
|
|
void _presentDatePicker() {
|
|
|
|
showDatePicker(
|
|
|
|
showDatePicker(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
initialDate: DateTime.now(),
|
|
|
|
initialDate: DateTime.now(),
|
|
|
|
firstDate: DateTime(2019),
|
|
|
|
firstDate: DateTime(DateTime.now().year-1),
|
|
|
|
lastDate: DateTime(2050),
|
|
|
|
lastDate: DateTime(DateTime.now().year+1),
|
|
|
|
).then((pickedDate) {
|
|
|
|
).then((pickedDate) {
|
|
|
|
if (pickedDate == null) {
|
|
|
|
if (pickedDate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
// var selectedDate = DateFormat.yMd().format(pickedDate);
|
|
|
|
|
|
|
|
final df = new DateFormat('yyyy-MM-dd');
|
|
|
|
final df = new DateFormat('yyyy-MM-dd');
|
|
|
|
addSickLeave.startDate = df.format(pickedDate);
|
|
|
|
addSickLeave.startDate = df.format(pickedDate);
|
|
|
|
|
|
|
|
_toDateController.text = AppDateUtils.getDayMonthYearDateFormatted(pickedDate,isMonthShort: true );
|
|
|
|
_toDateController.text = addSickLeave.startDate;
|
|
|
|
|
|
|
|
//addSickLeave.startDate = selectedDate;
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
getProfile();
|
|
|
|
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return BaseView<PatientViewModel>(
|
|
|
|
return BaseView<SickLeaveViewModel>(
|
|
|
|
onModelReady: (model) async {
|
|
|
|
onModelReady: (model) async {
|
|
|
|
await model.getClinicsList();
|
|
|
|
await model.getDoctorProfile();
|
|
|
|
_clinicController.text = getClinicName(model);
|
|
|
|
_clinicController.text = model.doctorProfile.clinicDescription;
|
|
|
|
_doctorController.text = profile['DoctorName'];
|
|
|
|
_doctorController.text = model.doctorProfile.doctorName;
|
|
|
|
|
|
|
|
await model.preSickLeaveStatistics(
|
|
|
|
|
|
|
|
widget.appointmentNo, widget.patientMRN);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
builder: (_, model, w) => BaseView<SickLeaveViewModel>(
|
|
|
|
builder: (_, model, w) => GestureDetector(
|
|
|
|
onModelReady: (model2) => model2.preSickLeaveStatistics(
|
|
|
|
|
|
|
|
widget.appointmentNo, widget.patientMRN),
|
|
|
|
|
|
|
|
builder: (_, model2, w) => GestureDetector(
|
|
|
|
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
FocusScope.of(context).requestFocus(new FocusNode());
|
|
|
|
FocusScope.of(context).requestFocus(new FocusNode());
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: AppScaffold(
|
|
|
|
child: AppScaffold(
|
|
|
|
baseViewModel: model2,
|
|
|
|
baseViewModel: model,
|
|
|
|
appBar: BottomSheetTitle(title: widget.isExtended == true
|
|
|
|
appBar: BottomSheetTitle(
|
|
|
|
? TranslationBase.of(context).extendSickLeave
|
|
|
|
title: TranslationBase.of(context).addSickLeave,
|
|
|
|
: TranslationBase.of(context).addSickLeave,),
|
|
|
|
),
|
|
|
|
isShowAppBar: true,
|
|
|
|
isShowAppBar: true,
|
|
|
|
body: Center(
|
|
|
|
body: Center(
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
@ -117,9 +111,7 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
AppTextFieldCustom(
|
|
|
|
AppTextFieldCustom(
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
hintText: widget.extendedData != null
|
|
|
|
hintText: TranslationBase.of(context).sickLeave +
|
|
|
|
? widget.extendedData.noOfDays.toString()
|
|
|
|
|
|
|
|
: TranslationBase.of(context).sickLeave +
|
|
|
|
|
|
|
|
' ' +
|
|
|
|
' ' +
|
|
|
|
TranslationBase.of(context).days,
|
|
|
|
TranslationBase.of(context).days,
|
|
|
|
maxLines: 1,
|
|
|
|
maxLines: 1,
|
|
|
|
@ -130,16 +122,14 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
FilteringTextInputFormatter.allow(
|
|
|
|
FilteringTextInputFormatter.allow(
|
|
|
|
RegExp(ONLY_NUMBERS))
|
|
|
|
RegExp(ONLY_NUMBERS))
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
inputType:TextInputType.number,
|
|
|
|
controller: _numberOfDayController,
|
|
|
|
controller: _numberOfDayController,
|
|
|
|
onChanged: (value) {
|
|
|
|
onChanged: (value) {
|
|
|
|
|
|
|
|
if(value.isNotEmpty)
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
addSickLeave.noOfDays = value;
|
|
|
|
addSickLeave.noOfDays = value;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (widget.extendedData != null) {
|
|
|
|
|
|
|
|
widget.extendedData.noOfDays =
|
|
|
|
|
|
|
|
int.parse(value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
(addSickLeave.noOfDays == null)
|
|
|
|
(addSickLeave.noOfDays == null)
|
|
|
|
@ -153,11 +143,9 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
AppTextFieldCustom(
|
|
|
|
AppTextFieldCustom(
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
onClick: () {
|
|
|
|
onClick: () {
|
|
|
|
_presentDatePicker('_selectedToDate');
|
|
|
|
_presentDatePicker();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
hintText: widget.extendedData != null
|
|
|
|
hintText: TranslationBase.of(context)
|
|
|
|
? widget.extendedData.startDate
|
|
|
|
|
|
|
|
: TranslationBase.of(context)
|
|
|
|
|
|
|
|
.sickLeaveDate,
|
|
|
|
.sickLeaveDate,
|
|
|
|
enabled: false,
|
|
|
|
enabled: false,
|
|
|
|
maxLines: 1,
|
|
|
|
maxLines: 1,
|
|
|
|
@ -174,9 +162,7 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
addSickLeave.startDate = value;
|
|
|
|
addSickLeave.startDate = value;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (widget.extendedData != null) {
|
|
|
|
|
|
|
|
widget.extendedData.startDate = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
(addSickLeave.startDate == null)
|
|
|
|
(addSickLeave.startDate == null)
|
|
|
|
@ -189,8 +175,7 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
AppTextFieldCustom(
|
|
|
|
AppTextFieldCustom(
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
hintText:
|
|
|
|
hintText: TranslationBase.of(context).clinic,
|
|
|
|
TranslationBase.of(context).clinic,
|
|
|
|
|
|
|
|
enabled: false,
|
|
|
|
enabled: false,
|
|
|
|
maxLines: 1,
|
|
|
|
maxLines: 1,
|
|
|
|
minLines: 1,
|
|
|
|
minLines: 1,
|
|
|
|
@ -206,8 +191,7 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
height: 10,
|
|
|
|
height: 10,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
model2.sickLeaveStatistics[
|
|
|
|
model.sickLeaveStatistics.recommendedSickLeaveDays!=
|
|
|
|
'recommendedSickLeaveDays'] !=
|
|
|
|
|
|
|
|
null
|
|
|
|
null
|
|
|
|
? Row(
|
|
|
|
? Row(
|
|
|
|
crossAxisAlignment:
|
|
|
|
crossAxisAlignment:
|
|
|
|
@ -225,8 +209,7 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
width: 10,
|
|
|
|
width: 10,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
AppText(
|
|
|
|
AppText(
|
|
|
|
model2.sickLeaveStatistics[
|
|
|
|
model.sickLeaveStatistics.recommendedSickLeaveDays,
|
|
|
|
'recommendedSickLeaveDays'],
|
|
|
|
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
fontSize: 12,
|
|
|
|
fontSize: 12,
|
|
|
|
color: IN_PROGRESS_COLOR,
|
|
|
|
color: IN_PROGRESS_COLOR,
|
|
|
|
@ -241,8 +224,7 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
AppTextFieldCustom(
|
|
|
|
AppTextFieldCustom(
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
hintText:
|
|
|
|
hintText: TranslationBase.of(context).doctor,
|
|
|
|
TranslationBase.of(context).doctor,
|
|
|
|
|
|
|
|
enabled: false,
|
|
|
|
enabled: false,
|
|
|
|
maxLines: 1,
|
|
|
|
maxLines: 1,
|
|
|
|
minLines: 1,
|
|
|
|
minLines: 1,
|
|
|
|
@ -260,9 +242,7 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
AppTextFieldCustom(
|
|
|
|
AppTextFieldCustom(
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
hintText: widget.extendedData != null
|
|
|
|
hintText: TranslationBase.of(context).remarks,
|
|
|
|
? widget.extendedData.remarks
|
|
|
|
|
|
|
|
: TranslationBase.of(context).remarks,
|
|
|
|
|
|
|
|
maxLines: 30,
|
|
|
|
maxLines: 30,
|
|
|
|
minLines: 5,
|
|
|
|
minLines: 5,
|
|
|
|
dropDownColor: Colors.white,
|
|
|
|
dropDownColor: Colors.white,
|
|
|
|
@ -272,22 +252,14 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
addSickLeave.remarks = value;
|
|
|
|
addSickLeave.remarks = value;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (widget.extendedData != null) {
|
|
|
|
|
|
|
|
widget.extendedData.remarks = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
|
|
|
|
(addSickLeave.remarks == null)
|
|
|
|
|
|
|
|
? TranslationBase.of(context)
|
|
|
|
|
|
|
|
.pleaseEnterRemarks
|
|
|
|
|
|
|
|
: null,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
bottomSheet: model2.state == ViewState.Busy ||
|
|
|
|
bottomSheet: model.state == ViewState.Busy ||
|
|
|
|
model.state == ViewState.Busy
|
|
|
|
model.state == ViewState.Busy
|
|
|
|
? Container(
|
|
|
|
? Container(
|
|
|
|
height: 0,
|
|
|
|
height: 0,
|
|
|
|
@ -312,13 +284,11 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
FractionallySizedBox(
|
|
|
|
FractionallySizedBox(
|
|
|
|
widthFactor: 0.9,
|
|
|
|
widthFactor: 0.9,
|
|
|
|
child: AppButton(
|
|
|
|
child: AppButton(
|
|
|
|
title: widget.isExtended == true
|
|
|
|
title: TranslationBase.of(context)
|
|
|
|
? TranslationBase.of(context).extend
|
|
|
|
|
|
|
|
: TranslationBase.of(context)
|
|
|
|
|
|
|
|
.addSickLeaverequest,
|
|
|
|
.addSickLeaverequest,
|
|
|
|
color: Colors.green,
|
|
|
|
color: Colors.green,
|
|
|
|
onPressed: () async {
|
|
|
|
onPressed: () async {
|
|
|
|
submitForm(model2);
|
|
|
|
submitForm(model);
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
@ -327,47 +297,32 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
)));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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 {
|
|
|
|
try {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
isFormSubmitted = true;
|
|
|
|
isFormSubmitted = true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (addSickLeave.noOfDays == null ||
|
|
|
|
if (addSickLeave.noOfDays == null ||
|
|
|
|
addSickLeave.startDate == null ||
|
|
|
|
addSickLeave.startDate == null ) {
|
|
|
|
addSickLeave.remarks == null) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
addSickLeave.patientMRN = widget.patient.patientMRN.toString();
|
|
|
|
addSickLeave.patientMRN = widget.patient.patientMRN.toString();
|
|
|
|
addSickLeave.appointmentNo =
|
|
|
|
addSickLeave.appointmentNo =
|
|
|
|
widget.patient.appointmentNo.toString();
|
|
|
|
widget.patient.appointmentNo.toString();
|
|
|
|
await model2.addSickLeave(addSickLeave);
|
|
|
|
await model.addSickLeave(addSickLeave);
|
|
|
|
if (model2.state == ViewState.ErrorLocal) {
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
Helpers.showErrorToast(model2.error);
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
await widget.previousModel
|
|
|
|
|
|
|
|
.getSickLeaveForPatient(widget.patient, isLocalBusy: true);
|
|
|
|
DrAppToastMsg.showSuccesToast(
|
|
|
|
DrAppToastMsg.showSuccesToast(
|
|
|
|
TranslationBase.of(context).replySuccessfully);
|
|
|
|
TranslationBase.of(context).replySuccessfully);
|
|
|
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
@ -375,21 +330,8 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
print(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'] : "";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|