|
|
@ -1,12 +1,14 @@
|
|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
import 'package:doctor_app_flutter/config/shared_pref_kay.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/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/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/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/sick-leave/add-sickleave.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,12 +30,7 @@ class SickLeaveScreen extends StatefulWidget {
|
|
|
|
final appointmentNo;
|
|
|
|
final appointmentNo;
|
|
|
|
final patientMRN;
|
|
|
|
final patientMRN;
|
|
|
|
final patient;
|
|
|
|
final patient;
|
|
|
|
SickLeaveScreen(
|
|
|
|
SickLeaveScreen({this.appointmentNo, this.patientMRN, this.isExtended = false, this.extendedData, this.patient});
|
|
|
|
{this.appointmentNo,
|
|
|
|
|
|
|
|
this.patientMRN,
|
|
|
|
|
|
|
|
this.isExtended = false,
|
|
|
|
|
|
|
|
this.extendedData,
|
|
|
|
|
|
|
|
this.patient});
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
_SickLeaveScreenState createState() => _SickLeaveScreenState();
|
|
|
|
_SickLeaveScreenState createState() => _SickLeaveScreenState();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -76,8 +73,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
return BaseView<PatientViewModel>(
|
|
|
|
return BaseView<PatientViewModel>(
|
|
|
|
onModelReady: (model) => model.getClinicsList(),
|
|
|
|
onModelReady: (model) => model.getClinicsList(),
|
|
|
|
builder: (_, model, w) => BaseView<SickLeaveViewModel>(
|
|
|
|
builder: (_, model, w) => BaseView<SickLeaveViewModel>(
|
|
|
|
onModelReady: (model2) => model2.preSickLeaveStatistics(
|
|
|
|
onModelReady: (model2) => model2.preSickLeaveStatistics(widget.appointmentNo, widget.patientMRN),
|
|
|
|
widget.appointmentNo, widget.patientMRN),
|
|
|
|
|
|
|
|
builder: (_, model2, w) => GestureDetector(
|
|
|
|
builder: (_, model2, w) => GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
FocusScope.of(context).requestFocus(new FocusNode());
|
|
|
|
FocusScope.of(context).requestFocus(new FocusNode());
|
|
|
@ -108,46 +104,35 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(left: 10, right: 10),
|
|
|
|
margin: EdgeInsets.only(left: 10, right: 10),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius:
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
|
|
|
|
border: Border.all(
|
|
|
|
border: Border.all(
|
|
|
|
width: 1.0,
|
|
|
|
width: 1.0,
|
|
|
|
color: HexColor("#CCCCCC"),
|
|
|
|
color: HexColor("#CCCCCC"),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
color: Colors.white),
|
|
|
|
color: Colors.white),
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
child: Column(
|
|
|
|
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
|
|
crossAxisAlignment:
|
|
|
|
Padding(
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
|
|
|
|
children: [
|
|
|
|
child: AppText(TranslationBase.of(context).sickLeave +
|
|
|
|
Padding(
|
|
|
|
' ' +
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
TranslationBase.of(context).days)),
|
|
|
|
top: 5, left: 10, right: 10),
|
|
|
|
AppTextFormField(
|
|
|
|
child: AppText(
|
|
|
|
borderColor: Colors.white,
|
|
|
|
TranslationBase.of(context)
|
|
|
|
onChanged: (value) {
|
|
|
|
.sickLeave +
|
|
|
|
addSickLeave.noOfDays = value;
|
|
|
|
' ' +
|
|
|
|
if (widget.extendedData != null) {
|
|
|
|
TranslationBase.of(context)
|
|
|
|
widget.extendedData.noOfDays = int.parse(value);
|
|
|
|
.days)),
|
|
|
|
}
|
|
|
|
AppTextFormField(
|
|
|
|
},
|
|
|
|
borderColor: Colors.white,
|
|
|
|
hintText:
|
|
|
|
onChanged: (value) {
|
|
|
|
widget.extendedData != null ? widget.extendedData.noOfDays.toString() : '',
|
|
|
|
addSickLeave.noOfDays = value;
|
|
|
|
// validator: (value) {
|
|
|
|
if (widget.extendedData != null) {
|
|
|
|
// return TextValidator().validateName(value);
|
|
|
|
widget.extendedData.noOfDays =
|
|
|
|
// },
|
|
|
|
int.parse(value);
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
}
|
|
|
|
inputFormatter: ONLY_NUMBERS)
|
|
|
|
},
|
|
|
|
]),
|
|
|
|
hintText: widget.extendedData != null
|
|
|
|
|
|
|
|
? widget.extendedData.noOfDays
|
|
|
|
|
|
|
|
.toString()
|
|
|
|
|
|
|
|
: '',
|
|
|
|
|
|
|
|
// validator: (value) {
|
|
|
|
|
|
|
|
// return TextValidator().validateName(value);
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
textInputType:TextInputType.number,
|
|
|
|
|
|
|
|
inputFormatter: ONLY_NUMBERS)
|
|
|
|
|
|
|
|
]),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
height: 10,
|
|
|
|
height: 10,
|
|
|
@ -155,146 +140,107 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(left: 10, right: 10),
|
|
|
|
margin: EdgeInsets.only(left: 10, right: 10),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius:
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
|
|
|
|
border: Border.all(
|
|
|
|
|
|
|
|
width: 1.0, color: HexColor("#CCCCCC")),
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment:
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
|
|
|
|
top: 5, left: 10, right: 10),
|
|
|
|
|
|
|
|
child: AppText(
|
|
|
|
child: AppText(
|
|
|
|
TranslationBase.of(context)
|
|
|
|
TranslationBase.of(context).sickLeaveDate,
|
|
|
|
.sickLeaveDate,
|
|
|
|
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
AppTextFormField(
|
|
|
|
AppTextFormField(
|
|
|
|
hintText: widget.extendedData != null
|
|
|
|
hintText: widget.extendedData != null ? widget.extendedData.startDate : '',
|
|
|
|
? widget.extendedData.startDate
|
|
|
|
|
|
|
|
: '',
|
|
|
|
|
|
|
|
borderColor: Colors.white,
|
|
|
|
borderColor: Colors.white,
|
|
|
|
prefix: IconButton(
|
|
|
|
prefix: IconButton(icon: Icon(Icons.calendar_today)),
|
|
|
|
icon: Icon(Icons.calendar_today)),
|
|
|
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
controller: _toDateController,
|
|
|
|
controller: _toDateController,
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
_presentDatePicker(
|
|
|
|
_presentDatePicker('_selectedToDate');
|
|
|
|
'_selectedToDate');
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
inputFormatter: ONLY_DATE,
|
|
|
|
inputFormatter: ONLY_DATE,
|
|
|
|
onChanged: (value) {
|
|
|
|
onChanged: (value) {
|
|
|
|
addSickLeave.startDate = value;
|
|
|
|
addSickLeave.startDate = value;
|
|
|
|
if (widget.extendedData != null) {
|
|
|
|
if (widget.extendedData != null) {
|
|
|
|
widget.extendedData.startDate =
|
|
|
|
widget.extendedData.startDate = value;
|
|
|
|
value;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
|
|
|
|
top: 10, left: 10, right: 10),
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius:
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
|
|
|
|
border: Border.all(
|
|
|
|
|
|
|
|
width: 1.0, color: HexColor("#CCCCCC")),
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
width: double.infinity,
|
|
|
|
width: double.infinity,
|
|
|
|
child: Padding(
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: SizeConfig.widthMultiplier * 0.9,
|
|
|
|
top: SizeConfig.widthMultiplier * 0.9,
|
|
|
|
bottom:
|
|
|
|
bottom: SizeConfig.widthMultiplier * 0.9,
|
|
|
|
SizeConfig.widthMultiplier * 0.9,
|
|
|
|
|
|
|
|
right: SizeConfig.widthMultiplier * 3,
|
|
|
|
right: SizeConfig.widthMultiplier * 3,
|
|
|
|
left: SizeConfig.widthMultiplier * 3),
|
|
|
|
left: SizeConfig.widthMultiplier * 3),
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment:
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(top: 5),
|
|
|
|
padding: EdgeInsets.only(top: 5),
|
|
|
|
child: AppText(
|
|
|
|
child: AppText(
|
|
|
|
TranslationBase.of(context)
|
|
|
|
TranslationBase.of(context).clinicName,
|
|
|
|
.clinicName,
|
|
|
|
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
// add Expanded to have your dropdown button fill remaining space
|
|
|
|
// add Expanded to have your dropdown button fill remaining space
|
|
|
|
child:
|
|
|
|
child: DropdownButtonHideUnderline(
|
|
|
|
DropdownButtonHideUnderline(
|
|
|
|
child: new IgnorePointer(
|
|
|
|
child: new IgnorePointer(
|
|
|
|
ignoring: true,
|
|
|
|
ignoring: true,
|
|
|
|
child: DropdownButton(
|
|
|
|
child: DropdownButton(
|
|
|
|
isExpanded: true,
|
|
|
|
isExpanded: true,
|
|
|
|
value: getClinicName(model) ?? "",
|
|
|
|
value: getClinicName(
|
|
|
|
iconSize: 0,
|
|
|
|
model) ??
|
|
|
|
elevation: 16,
|
|
|
|
"",
|
|
|
|
selectedItemBuilder: (BuildContext context) {
|
|
|
|
iconSize: 0,
|
|
|
|
return model.getClinicNameList().map((item) {
|
|
|
|
elevation: 16,
|
|
|
|
return Row(
|
|
|
|
selectedItemBuilder:
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
(BuildContext
|
|
|
|
children: <Widget>[
|
|
|
|
context) {
|
|
|
|
AppText(
|
|
|
|
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,
|
|
|
|
item,
|
|
|
|
textAlign:
|
|
|
|
fontSize: SizeConfig.textMultiplier * 2.1,
|
|
|
|
TextAlign
|
|
|
|
color: Colors.grey,
|
|
|
|
.end,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
],
|
|
|
|
}).toList(),
|
|
|
|
);
|
|
|
|
))),
|
|
|
|
}).toList();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onChanged: (newValue) => {},
|
|
|
|
|
|
|
|
items: model.getClinicNameList().map((item) {
|
|
|
|
|
|
|
|
return DropdownMenuItem(
|
|
|
|
|
|
|
|
value: item.toString(),
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
item,
|
|
|
|
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}).toList(),
|
|
|
|
|
|
|
|
))),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
model2.sickLeaveStatistics[
|
|
|
|
model2.sickLeaveStatistics['recommendedSickLeaveDays'] != null
|
|
|
|
'recommendedSickLeaveDays'] !=
|
|
|
|
|
|
|
|
null
|
|
|
|
|
|
|
|
? Padding(
|
|
|
|
? Padding(
|
|
|
|
child: AppText(
|
|
|
|
child: AppText(
|
|
|
|
model2.sickLeaveStatistics[
|
|
|
|
model2.sickLeaveStatistics['recommendedSickLeaveDays'],
|
|
|
|
'recommendedSickLeaveDays'],
|
|
|
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -306,10 +252,8 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(left: 10, right: 10),
|
|
|
|
margin: EdgeInsets.only(left: 10, right: 10),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius:
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
|
|
|
|
border: Border.all(
|
|
|
|
|
|
|
|
width: 1.0, color: HexColor("#CCCCCC")),
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
@ -317,11 +261,9 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
|
|
|
|
top: 5, left: 10, right: 10),
|
|
|
|
|
|
|
|
child: AppText(
|
|
|
|
child: AppText(
|
|
|
|
TranslationBase.of(context)
|
|
|
|
TranslationBase.of(context).doctorName,
|
|
|
|
.doctorName,
|
|
|
|
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
new IgnorePointer(
|
|
|
|
new IgnorePointer(
|
|
|
|
ignoring: true,
|
|
|
|
ignoring: true,
|
|
|
@ -343,10 +285,8 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(left: 10, right: 10),
|
|
|
|
margin: EdgeInsets.only(left: 10, right: 10),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius:
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
|
|
|
|
border: Border.all(
|
|
|
|
|
|
|
|
width: 1.0, color: HexColor("#CCCCCC")),
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
@ -354,8 +294,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
|
|
|
|
top: 5, left: 10, right: 10),
|
|
|
|
|
|
|
|
child: AppText(
|
|
|
|
child: AppText(
|
|
|
|
TranslationBase.of(context).remarks,
|
|
|
|
TranslationBase.of(context).remarks,
|
|
|
|
)),
|
|
|
|
)),
|
|
|
@ -364,9 +303,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
decoration: InputDecoration(
|
|
|
|
decoration: InputDecoration(
|
|
|
|
contentPadding: EdgeInsets.all(20.0),
|
|
|
|
contentPadding: EdgeInsets.all(20.0),
|
|
|
|
border: InputBorder.none,
|
|
|
|
border: InputBorder.none,
|
|
|
|
hintText: widget.extendedData != null
|
|
|
|
hintText: widget.extendedData != null ? widget.extendedData.remarks : ''),
|
|
|
|
? widget.extendedData.remarks
|
|
|
|
|
|
|
|
: ''),
|
|
|
|
|
|
|
|
onChanged: (value) {
|
|
|
|
onChanged: (value) {
|
|
|
|
addSickLeave.remarks = value;
|
|
|
|
addSickLeave.remarks = value;
|
|
|
|
if (widget.extendedData != null) {
|
|
|
|
if (widget.extendedData != null) {
|
|
|
@ -378,40 +315,60 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.all(
|
|
|
|
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
|
|
|
SizeConfig.widthMultiplier * 5),
|
|
|
|
|
|
|
|
child: Wrap(
|
|
|
|
child: Wrap(
|
|
|
|
alignment: WrapAlignment.center,
|
|
|
|
alignment: WrapAlignment.center,
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
AppButton(
|
|
|
|
AppButton(
|
|
|
|
title: widget.isExtended == true
|
|
|
|
title: widget.isExtended == true
|
|
|
|
? TranslationBase.of(context).extend
|
|
|
|
? TranslationBase.of(context).extend
|
|
|
|
: TranslationBase.of(context)
|
|
|
|
: TranslationBase.of(context).addSickLeaverequest,
|
|
|
|
.addSickLeaverequest,
|
|
|
|
|
|
|
|
color: Colors.green,
|
|
|
|
color: Colors.green,
|
|
|
|
onPressed: () async {
|
|
|
|
onPressed: () async {
|
|
|
|
if (widget.isExtended) {
|
|
|
|
if (widget.isExtended) {
|
|
|
|
await model2.extendSickLeave(
|
|
|
|
await model2.extendSickLeave(widget.extendedData);
|
|
|
|
widget.extendedData);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DrAppToastMsg.showSuccesToast(
|
|
|
|
DrAppToastMsg.showSuccesToast(
|
|
|
|
model2.sickleaveResponse[
|
|
|
|
model2.sickleaveResponse['ListSickLeavesToExtent']['success']);
|
|
|
|
'ListSickLeavesToExtent']
|
|
|
|
Navigator.of(context).popUntil((route) {
|
|
|
|
['success']);
|
|
|
|
return route.settings.name == PATIENTS_PROFILE;
|
|
|
|
Navigator.of(context)
|
|
|
|
|
|
|
|
.popUntil((route) {
|
|
|
|
|
|
|
|
return route.settings.name ==
|
|
|
|
|
|
|
|
PATIENTS_PROFILE;
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
Navigator.of(context)
|
|
|
|
ADD_SICKLEAVE,
|
|
|
|
.pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
|
|
|
|
arguments: {
|
|
|
|
|
|
|
|
'patient': widget.patient
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
//print(value);
|
|
|
|
//print(value);
|
|
|
|
//});
|
|
|
|
//});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
_validateInputs(model2);
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -437,26 +394,21 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
void _validateInputs(model2) async {
|
|
|
|
void _validateInputs(model2) async {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (addSickLeave.noOfDays == null) {
|
|
|
|
if (addSickLeave.noOfDays == null) {
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterNoOfDays);
|
|
|
|
TranslationBase.of(context).pleaseEnterNoOfDays);
|
|
|
|
|
|
|
|
} else if (addSickLeave.remarks == null) {
|
|
|
|
} else if (addSickLeave.remarks == null) {
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterRemarks);
|
|
|
|
TranslationBase.of(context).pleaseEnterRemarks);
|
|
|
|
|
|
|
|
} else if (addSickLeave.startDate == null) {
|
|
|
|
} else if (addSickLeave.startDate == null) {
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterDate);
|
|
|
|
TranslationBase.of(context).pleaseEnterDate);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
addSickLeave.patientMRN = widget.patient.patientMRN.toString();
|
|
|
|
addSickLeave.patientMRN = widget.patient.patientMRN.toString();
|
|
|
|
addSickLeave.appointmentNo = widget.patient.appointmentNo.toString();
|
|
|
|
addSickLeave.appointmentNo = widget.patient.appointmentNo.toString();
|
|
|
|
await model2.addSickLeave(addSickLeave).then((value) => print(value));
|
|
|
|
await model2.addSickLeave(addSickLeave).then((value) => print(value));
|
|
|
|
|
|
|
|
|
|
|
|
DrAppToastMsg.showSuccesToast(
|
|
|
|
DrAppToastMsg.showSuccesToast(model2.sickleaveResponse['ListSickLeavesToExtent']['success']);
|
|
|
|
model2.sickleaveResponse['ListSickLeavesToExtent']['success']);
|
|
|
|
|
|
|
|
Navigator.of(context).popUntil((route) {
|
|
|
|
Navigator.of(context).popUntil((route) {
|
|
|
|
return route.settings.name == PATIENTS_PROFILE;
|
|
|
|
return route.settings.name == PATIENTS_PROFILE;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
Navigator.of(context)
|
|
|
|
Navigator.of(context).pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
|
|
|
|
.pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
print(err);
|
|
|
|
print(err);
|
|
|
@ -471,9 +423,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getClinicName(model) {
|
|
|
|
getClinicName(model) {
|
|
|
|
var clinicInfo = model.clinicsList
|
|
|
|
var clinicInfo = model.clinicsList.where((i) => i['ClinicID'] == this.profile['ClinicID']).toList();
|
|
|
|
.where((i) => i['ClinicID'] == this.profile['ClinicID'])
|
|
|
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : "";
|
|
|
|
return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|