|
|
|
@ -48,14 +48,14 @@ class SickLeaveScreen extends StatefulWidget {
|
|
|
|
class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
|
|
TextEditingController _toDateController = new TextEditingController();
|
|
|
|
TextEditingController _toDateController = new TextEditingController();
|
|
|
|
TextEditingController _numberOfController = new TextEditingController();
|
|
|
|
TextEditingController _numberOfDayController = new TextEditingController();
|
|
|
|
TextEditingController _clinicController = new TextEditingController();
|
|
|
|
TextEditingController _clinicController = new TextEditingController();
|
|
|
|
TextEditingController _doctorController = new TextEditingController();
|
|
|
|
TextEditingController _doctorController = new TextEditingController();
|
|
|
|
TextEditingController _remarkController = new TextEditingController();
|
|
|
|
TextEditingController _remarkController = new TextEditingController();
|
|
|
|
|
|
|
|
|
|
|
|
String _selectedClinic;
|
|
|
|
|
|
|
|
Map profile = {};
|
|
|
|
Map profile = {};
|
|
|
|
AddSickLeaveRequest addSickLeave = AddSickLeaveRequest();
|
|
|
|
AddSickLeaveRequest addSickLeave = AddSickLeaveRequest();
|
|
|
|
|
|
|
|
bool isFormSubmitted = false;
|
|
|
|
|
|
|
|
|
|
|
|
void _presentDatePicker(id) {
|
|
|
|
void _presentDatePicker(id) {
|
|
|
|
showDatePicker(
|
|
|
|
showDatePicker(
|
|
|
|
@ -100,299 +100,266 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
FocusScope.of(context).requestFocus(new FocusNode());
|
|
|
|
FocusScope.of(context).requestFocus(new FocusNode());
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: AppScaffold(
|
|
|
|
child: AppScaffold(
|
|
|
|
baseViewModel: model2,
|
|
|
|
baseViewModel: model2,
|
|
|
|
appBarTitle: widget.isExtended == true
|
|
|
|
appBarTitle: widget.isExtended == true
|
|
|
|
? TranslationBase.of(context).extendSickLeave
|
|
|
|
? TranslationBase.of(context).extendSickLeave
|
|
|
|
: TranslationBase.of(context).addSickLeave,
|
|
|
|
: TranslationBase.of(context).addSickLeave,
|
|
|
|
isShowAppBar: true,
|
|
|
|
isShowAppBar: true,
|
|
|
|
body: Center(
|
|
|
|
body: Center(
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(top: 10),
|
|
|
|
margin: EdgeInsets.only(top: 10),
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
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: _numberOfController,
|
|
|
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
|
|
|
addSickLeave.noOfDays = value;
|
|
|
|
|
|
|
|
if (widget.extendedData != null) {
|
|
|
|
|
|
|
|
widget.extendedData.noOfDays =
|
|
|
|
|
|
|
|
int.parse(value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// validationError: isFormSubmitted &&
|
|
|
|
|
|
|
|
// _selectedMedicationFrequency ==
|
|
|
|
|
|
|
|
// null
|
|
|
|
|
|
|
|
// ? TranslationBase
|
|
|
|
|
|
|
|
// .of(context)
|
|
|
|
|
|
|
|
// .emptyMessage
|
|
|
|
|
|
|
|
// : 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) {
|
|
|
|
|
|
|
|
addSickLeave.startDate = value;
|
|
|
|
|
|
|
|
if (widget.extendedData != null) {
|
|
|
|
|
|
|
|
widget.extendedData.startDate = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 5,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
|
|
|
hintText:
|
|
|
|
|
|
|
|
TranslationBase.of(context).clinicName,
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
? AppText(
|
|
|
|
|
|
|
|
model2.sickLeaveStatistics[
|
|
|
|
|
|
|
|
'recommendedSickLeaveDays'],
|
|
|
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
: SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
|
|
|
hintText:
|
|
|
|
|
|
|
|
TranslationBase.of(context).doctorName,
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
|
|
|
addSickLeave.remarks = value;
|
|
|
|
|
|
|
|
if (widget.extendedData != null) {
|
|
|
|
|
|
|
|
widget.extendedData.remarks = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
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,
|
|
|
|
widthFactor: 0.9,
|
|
|
|
child: AppButton(
|
|
|
|
child: ListView(
|
|
|
|
title: widget.isExtended == true
|
|
|
|
children: [
|
|
|
|
? TranslationBase.of(context).extend
|
|
|
|
SizedBox(
|
|
|
|
: TranslationBase.of(context)
|
|
|
|
height: 30,
|
|
|
|
.addSickLeaverequest,
|
|
|
|
),
|
|
|
|
color: Colors.green,
|
|
|
|
AppTextFieldCustom(
|
|
|
|
onPressed: () async {
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
if (widget.isExtended) {
|
|
|
|
hintText: widget.extendedData != null
|
|
|
|
await model2.extendSickLeave(
|
|
|
|
? widget.extendedData.noOfDays.toString()
|
|
|
|
widget.extendedData);
|
|
|
|
: TranslationBase.of(context).sickLeave +
|
|
|
|
|
|
|
|
' ' +
|
|
|
|
DrAppToastMsg.showSuccesToast(
|
|
|
|
TranslationBase.of(context).days,
|
|
|
|
model2.sickleaveResponse[
|
|
|
|
maxLines: 1,
|
|
|
|
'ListSickLeavesToExtent']
|
|
|
|
minLines: 1,
|
|
|
|
['success']);
|
|
|
|
dropDownColor: Colors.white,
|
|
|
|
Navigator.of(context)
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
.popUntil((route) {
|
|
|
|
inputFormatters: [
|
|
|
|
return route.settings.name ==
|
|
|
|
FilteringTextInputFormatter.allow(
|
|
|
|
PATIENTS_PROFILE;
|
|
|
|
RegExp(ONLY_NUMBERS))
|
|
|
|
});
|
|
|
|
],
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
controller: _numberOfDayController,
|
|
|
|
ADD_SICKLEAVE,
|
|
|
|
onChanged: (value) {
|
|
|
|
arguments: {
|
|
|
|
setState(() {
|
|
|
|
'patient': widget.patient
|
|
|
|
addSickLeave.noOfDays = value;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
//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 {
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
DrAppToastMsg.showSuccesToast(
|
|
|
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
|
|
|
.replySuccessfully);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(
|
|
|
|
if (widget.extendedData != null) {
|
|
|
|
context);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
},
|
|
|
|
print(err);
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
}
|
|
|
|
(addSickLeave.startDate == null)
|
|
|
|
}
|
|
|
|
? TranslationBase.of(context)
|
|
|
|
},
|
|
|
|
.pleaseEnterDate
|
|
|
|
|
|
|
|
: null,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 5,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
|
|
|
hintText:
|
|
|
|
|
|
|
|
TranslationBase.of(context).clinicName,
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
? AppText(
|
|
|
|
|
|
|
|
model2.sickLeaveStatistics[
|
|
|
|
|
|
|
|
'recommendedSickLeaveDays'],
|
|
|
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
: SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
|
|
|
hintText:
|
|
|
|
|
|
|
|
TranslationBase.of(context).doctorName,
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
),
|
|
|
|
height: 5,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
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,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)),
|
|
|
|
)));
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _validateInputs(model2) async {
|
|
|
|
submitForm(SickLeaveViewModel model2) async {
|
|
|
|
try {
|
|
|
|
{
|
|
|
|
if (addSickLeave.noOfDays == null) {
|
|
|
|
if (widget.isExtended) {
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
|
|
|
TranslationBase.of(context).pleaseEnterNoOfDays);
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
} else if (addSickLeave.remarks == null) {
|
|
|
|
await model2.extendSickLeave(widget.extendedData);
|
|
|
|
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.state == ViewState.ErrorLocal) {
|
|
|
|
if (model2.state == ViewState.ErrorLocal) {
|
|
|
|
Helpers.showErrorToast(model2.error);
|
|
|
|
Helpers.showErrorToast(model2.error);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
DrAppToastMsg.showSuccesToast(
|
|
|
|
DrAppToastMsg.showSuccesToast(
|
|
|
|
TranslationBase.of(context).replySuccessfully);
|
|
|
|
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);
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
Navigator.of(context).popUntil((route) {
|
|
|
|
} else {
|
|
|
|
return route.settings.name == PATIENTS_PROFILE;
|
|
|
|
try {
|
|
|
|
});
|
|
|
|
setState(() {
|
|
|
|
Navigator.of(context)
|
|
|
|
isFormSubmitted = true;
|
|
|
|
.pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
|
|
|
|
});
|
|
|
|
|
|
|
|
if (addSickLeave.noOfDays == null ||
|
|
|
|
|
|
|
|
addSickLeave.startDate == null ||
|
|
|
|
|
|
|
|
addSickLeave.remarks == 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);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
DrAppToastMsg.showSuccesToast(
|
|
|
|
|
|
|
|
TranslationBase.of(context).replySuccessfully);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
|
|
print(err);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
|
|
|
|
print(err);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|