|
|
|
|
@ -5,11 +5,13 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/routes.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/date-utils.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/helpers.dart';
|
|
|
|
|
@ -28,21 +30,19 @@ import 'package:intl/intl.dart';
|
|
|
|
|
Helpers helpers = Helpers();
|
|
|
|
|
|
|
|
|
|
class AddPatientSickLeaveScreen extends StatefulWidget {
|
|
|
|
|
final bool isExtended;
|
|
|
|
|
final GetAllSickLeaveResponse extendedData;
|
|
|
|
|
final appointmentNo;
|
|
|
|
|
final patientMRN;
|
|
|
|
|
final patient;
|
|
|
|
|
final PatiantInformtion patient;
|
|
|
|
|
final SickLeaveViewModel previousModel;
|
|
|
|
|
|
|
|
|
|
AddPatientSickLeaveScreen(
|
|
|
|
|
{this.appointmentNo,
|
|
|
|
|
this.patientMRN,
|
|
|
|
|
this.isExtended = false,
|
|
|
|
|
this.extendedData,
|
|
|
|
|
this.patient});
|
|
|
|
|
this.patient, this.previousModel});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_AddPatientSickLeaveScreenState createState() => _AddPatientSickLeaveScreenState();
|
|
|
|
|
_AddPatientSickLeaveScreenState createState() =>
|
|
|
|
|
_AddPatientSickLeaveScreenState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
|
@ -53,321 +53,276 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
|
TextEditingController _doctorController = new TextEditingController();
|
|
|
|
|
TextEditingController _remarkController = new TextEditingController();
|
|
|
|
|
|
|
|
|
|
Map profile = {};
|
|
|
|
|
AddSickLeaveRequest addSickLeave = AddSickLeaveRequest();
|
|
|
|
|
bool isFormSubmitted = false;
|
|
|
|
|
|
|
|
|
|
void _presentDatePicker(id) {
|
|
|
|
|
void _presentDatePicker() {
|
|
|
|
|
showDatePicker(
|
|
|
|
|
context: context,
|
|
|
|
|
initialDate: DateTime.now(),
|
|
|
|
|
firstDate: DateTime(2019),
|
|
|
|
|
lastDate: DateTime(2050),
|
|
|
|
|
firstDate: DateTime(DateTime.now().year-1),
|
|
|
|
|
lastDate: DateTime(DateTime.now().year+1),
|
|
|
|
|
).then((pickedDate) {
|
|
|
|
|
if (pickedDate == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
setState(() {
|
|
|
|
|
// var selectedDate = DateFormat.yMd().format(pickedDate);
|
|
|
|
|
final df = new DateFormat('yyyy-MM-dd');
|
|
|
|
|
addSickLeave.startDate = df.format(pickedDate);
|
|
|
|
|
|
|
|
|
|
_toDateController.text = addSickLeave.startDate;
|
|
|
|
|
//addSickLeave.startDate = selectedDate;
|
|
|
|
|
_toDateController.text = AppDateUtils.getDayMonthYearDateFormatted(pickedDate,isMonthShort: true );
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
getProfile();
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return BaseView<PatientViewModel>(
|
|
|
|
|
return BaseView<SickLeaveViewModel>(
|
|
|
|
|
onModelReady: (model) async {
|
|
|
|
|
await model.getClinicsList();
|
|
|
|
|
_clinicController.text = getClinicName(model);
|
|
|
|
|
_doctorController.text = profile['DoctorName'];
|
|
|
|
|
await model.getDoctorProfile();
|
|
|
|
|
_clinicController.text = model.doctorProfile.clinicDescription;
|
|
|
|
|
_doctorController.text = model.doctorProfile.doctorName;
|
|
|
|
|
await model.preSickLeaveStatistics(
|
|
|
|
|
widget.appointmentNo, widget.patientMRN);
|
|
|
|
|
},
|
|
|
|
|
builder: (_, model, w) => BaseView<SickLeaveViewModel>(
|
|
|
|
|
onModelReady: (model2) => model2.preSickLeaveStatistics(
|
|
|
|
|
widget.appointmentNo, widget.patientMRN),
|
|
|
|
|
builder: (_, model2, w) => GestureDetector(
|
|
|
|
|
onTap: () {
|
|
|
|
|
FocusScope.of(context).requestFocus(new FocusNode());
|
|
|
|
|
},
|
|
|
|
|
child: AppScaffold(
|
|
|
|
|
baseViewModel: model2,
|
|
|
|
|
appBar: BottomSheetTitle(title: widget.isExtended == true
|
|
|
|
|
? TranslationBase.of(context).extendSickLeave
|
|
|
|
|
: TranslationBase.of(context).addSickLeave,),
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
body: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 10),
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: ListView(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 30,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
hintText: widget.extendedData != null
|
|
|
|
|
? widget.extendedData.noOfDays.toString()
|
|
|
|
|
: TranslationBase.of(context).sickLeave +
|
|
|
|
|
' ' +
|
|
|
|
|
TranslationBase.of(context).days,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
dropDownColor: Colors.white,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
FilteringTextInputFormatter.allow(
|
|
|
|
|
RegExp(ONLY_NUMBERS))
|
|
|
|
|
],
|
|
|
|
|
controller: _numberOfDayController,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
addSickLeave.noOfDays = value;
|
|
|
|
|
});
|
|
|
|
|
builder: (_, model, w) => GestureDetector(
|
|
|
|
|
onTap: () {
|
|
|
|
|
FocusScope.of(context).requestFocus(new FocusNode());
|
|
|
|
|
},
|
|
|
|
|
child: AppScaffold(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
appBar: BottomSheetTitle(
|
|
|
|
|
title: TranslationBase.of(context).addSickLeave,
|
|
|
|
|
),
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
body: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 10),
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: ListView(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 30,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
hintText: TranslationBase.of(context).sickLeave +
|
|
|
|
|
' ' +
|
|
|
|
|
TranslationBase.of(context).days,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
dropDownColor: Colors.white,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
FilteringTextInputFormatter.allow(
|
|
|
|
|
RegExp(ONLY_NUMBERS))
|
|
|
|
|
],
|
|
|
|
|
inputType:TextInputType.number,
|
|
|
|
|
controller: _numberOfDayController,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
if(value.isNotEmpty)
|
|
|
|
|
setState(() {
|
|
|
|
|
addSickLeave.noOfDays = value;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (widget.extendedData != null) {
|
|
|
|
|
widget.extendedData.noOfDays =
|
|
|
|
|
int.parse(value);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
|
(addSickLeave.noOfDays == null)
|
|
|
|
|
? TranslationBase.of(context)
|
|
|
|
|
.pleaseEnterNoOfDays
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
onClick: () {
|
|
|
|
|
_presentDatePicker('_selectedToDate');
|
|
|
|
|
},
|
|
|
|
|
hintText: widget.extendedData != null
|
|
|
|
|
? widget.extendedData.startDate
|
|
|
|
|
: TranslationBase.of(context)
|
|
|
|
|
.sickLeaveDate,
|
|
|
|
|
enabled: false,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
|
icon: Icon(Icons.calendar_today)),
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
FilteringTextInputFormatter.allow(
|
|
|
|
|
RegExp(ONLY_NUMBERS))
|
|
|
|
|
],
|
|
|
|
|
controller: _toDateController,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
addSickLeave.startDate = value;
|
|
|
|
|
});
|
|
|
|
|
if (widget.extendedData != null) {
|
|
|
|
|
widget.extendedData.startDate = value;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
|
(addSickLeave.startDate == null)
|
|
|
|
|
? TranslationBase.of(context)
|
|
|
|
|
.pleaseEnterDate
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).clinic,
|
|
|
|
|
enabled: false,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
dropDownColor: Colors.white,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
FilteringTextInputFormatter.allow(
|
|
|
|
|
RegExp(ONLY_NUMBERS))
|
|
|
|
|
],
|
|
|
|
|
controller: _clinicController,
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
model2.sickLeaveStatistics[
|
|
|
|
|
'recommendedSickLeaveDays'] !=
|
|
|
|
|
null
|
|
|
|
|
? Row(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 10,
|
|
|
|
|
),
|
|
|
|
|
Icon(
|
|
|
|
|
DoctorApp.warning,
|
|
|
|
|
size: 20,
|
|
|
|
|
color: IN_PROGRESS_COLOR,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 10,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
model2.sickLeaveStatistics[
|
|
|
|
|
'recommendedSickLeaveDays'],
|
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: IN_PROGRESS_COLOR,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).doctor,
|
|
|
|
|
enabled: false,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
dropDownColor: Colors.white,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
FilteringTextInputFormatter.allow(
|
|
|
|
|
RegExp(ONLY_NUMBERS))
|
|
|
|
|
],
|
|
|
|
|
controller: _doctorController,
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
hintText: widget.extendedData != null
|
|
|
|
|
? widget.extendedData.remarks
|
|
|
|
|
: TranslationBase.of(context).remarks,
|
|
|
|
|
maxLines: 30,
|
|
|
|
|
minLines: 5,
|
|
|
|
|
dropDownColor: Colors.white,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
controller: _remarkController,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
addSickLeave.remarks = value;
|
|
|
|
|
});
|
|
|
|
|
if (widget.extendedData != null) {
|
|
|
|
|
widget.extendedData.remarks = value;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
|
(addSickLeave.remarks == null)
|
|
|
|
|
? TranslationBase.of(context)
|
|
|
|
|
.pleaseEnterRemarks
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
|
(addSickLeave.noOfDays == null)
|
|
|
|
|
? TranslationBase.of(context)
|
|
|
|
|
.pleaseEnterNoOfDays
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
onClick: () {
|
|
|
|
|
_presentDatePicker();
|
|
|
|
|
},
|
|
|
|
|
hintText: TranslationBase.of(context)
|
|
|
|
|
.sickLeaveDate,
|
|
|
|
|
enabled: false,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
|
icon: Icon(Icons.calendar_today)),
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
FilteringTextInputFormatter.allow(
|
|
|
|
|
RegExp(ONLY_NUMBERS))
|
|
|
|
|
],
|
|
|
|
|
controller: _toDateController,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
addSickLeave.startDate = value;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
|
(addSickLeave.startDate == null)
|
|
|
|
|
? TranslationBase.of(context)
|
|
|
|
|
.pleaseEnterDate
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
hintText: TranslationBase.of(context).clinic,
|
|
|
|
|
enabled: false,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
dropDownColor: Colors.white,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
FilteringTextInputFormatter.allow(
|
|
|
|
|
RegExp(ONLY_NUMBERS))
|
|
|
|
|
],
|
|
|
|
|
controller: _clinicController,
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
model.sickLeaveStatistics.recommendedSickLeaveDays!=
|
|
|
|
|
null
|
|
|
|
|
? Row(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 10,
|
|
|
|
|
),
|
|
|
|
|
Icon(
|
|
|
|
|
DoctorApp.warning,
|
|
|
|
|
size: 20,
|
|
|
|
|
color: IN_PROGRESS_COLOR,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 10,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
model.sickLeaveStatistics.recommendedSickLeaveDays,
|
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: IN_PROGRESS_COLOR,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: model2.state == ViewState.Busy ||
|
|
|
|
|
model.state == ViewState.Busy
|
|
|
|
|
? Container(
|
|
|
|
|
height: 0,
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(0.0),
|
|
|
|
|
),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: HexColor('#707070'), width: 0),
|
|
|
|
|
),
|
|
|
|
|
height: SizeConfig.heightMultiplier *
|
|
|
|
|
(SizeConfig.isHeightVeryShort ? 12 : 10),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title: widget.isExtended == true
|
|
|
|
|
? TranslationBase.of(context).extend
|
|
|
|
|
: TranslationBase.of(context)
|
|
|
|
|
.addSickLeaverequest,
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
submitForm(model2);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
)));
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
hintText: TranslationBase.of(context).doctor,
|
|
|
|
|
enabled: false,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
dropDownColor: Colors.white,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
FilteringTextInputFormatter.allow(
|
|
|
|
|
RegExp(ONLY_NUMBERS))
|
|
|
|
|
],
|
|
|
|
|
controller: _doctorController,
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
hintText: TranslationBase.of(context).remarks,
|
|
|
|
|
maxLines: 30,
|
|
|
|
|
minLines: 5,
|
|
|
|
|
dropDownColor: Colors.white,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
controller: _remarkController,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
addSickLeave.remarks = value;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: model.state == ViewState.Busy ||
|
|
|
|
|
model.state == ViewState.Busy
|
|
|
|
|
? Container(
|
|
|
|
|
height: 0,
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(0.0),
|
|
|
|
|
),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: HexColor('#707070'), width: 0),
|
|
|
|
|
),
|
|
|
|
|
height: SizeConfig.heightMultiplier *
|
|
|
|
|
(SizeConfig.isHeightVeryShort ? 12 : 10),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title: TranslationBase.of(context)
|
|
|
|
|
.addSickLeaverequest,
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
submitForm(model);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
submitForm(SickLeaveViewModel model2) async {
|
|
|
|
|
submitForm(SickLeaveViewModel model) async {
|
|
|
|
|
{
|
|
|
|
|
if (widget.isExtended) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model2.extendSickLeave(widget.extendedData);
|
|
|
|
|
if (model2.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(model2.error);
|
|
|
|
|
} else {
|
|
|
|
|
DrAppToastMsg.showSuccesToast(
|
|
|
|
|
TranslationBase.of(context).replySuccessfully);
|
|
|
|
|
Navigator.of(context).popUntil((route) {
|
|
|
|
|
return route.settings.name == PATIENTS_PROFILE;
|
|
|
|
|
});
|
|
|
|
|
Navigator.of(context)
|
|
|
|
|
.pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
|
setState(() {
|
|
|
|
|
isFormSubmitted = true;
|
|
|
|
|
});
|
|
|
|
|
if (addSickLeave.noOfDays == null ||
|
|
|
|
|
addSickLeave.startDate == null ||
|
|
|
|
|
addSickLeave.remarks == null) {
|
|
|
|
|
addSickLeave.startDate == null ) {
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
addSickLeave.patientMRN = widget.patient.patientMRN.toString();
|
|
|
|
|
addSickLeave.appointmentNo =
|
|
|
|
|
widget.patient.appointmentNo.toString();
|
|
|
|
|
await model2.addSickLeave(addSickLeave);
|
|
|
|
|
if (model2.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(model2.error);
|
|
|
|
|
await model.addSickLeave(addSickLeave);
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
|
} else {
|
|
|
|
|
await widget.previousModel
|
|
|
|
|
.getSickLeaveForPatient(widget.patient, isLocalBusy: true);
|
|
|
|
|
DrAppToastMsg.showSuccesToast(
|
|
|
|
|
TranslationBase.of(context).replySuccessfully);
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
@ -375,21 +330,8 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
|
|
|
|
} 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'] : "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|