|
|
|
@ -3,9 +3,11 @@ 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/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/screens/base/base_view.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/base/base_view.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/helpers.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/helpers.dart';
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/util/text_validator.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
|
|
|
|
@ -17,10 +19,14 @@ import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart';
|
|
|
|
|
|
|
|
|
|
|
|
Helpers helpers = Helpers();
|
|
|
|
Helpers helpers = Helpers();
|
|
|
|
|
|
|
|
|
|
|
|
class SickLeaveScreen extends StatefulWidget {
|
|
|
|
class SickLeaveScreen extends StatefulWidget {
|
|
|
|
|
|
|
|
final bool isExtended;
|
|
|
|
|
|
|
|
final GetAllSickLeaveResponse extendedData;
|
|
|
|
|
|
|
|
SickLeaveScreen({this.isExtended = false, this.extendedData});
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
_SickLeaveScreenState createState() => _SickLeaveScreenState();
|
|
|
|
_SickLeaveScreenState createState() => _SickLeaveScreenState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -30,6 +36,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
TextEditingController _toDateController = new TextEditingController();
|
|
|
|
TextEditingController _toDateController = new TextEditingController();
|
|
|
|
String _selectedClinic;
|
|
|
|
String _selectedClinic;
|
|
|
|
Map profile = {};
|
|
|
|
Map profile = {};
|
|
|
|
|
|
|
|
AddSickLeaveRequest addSickLeave = AddSickLeaveRequest();
|
|
|
|
void _presentDatePicker(id) {
|
|
|
|
void _presentDatePicker(id) {
|
|
|
|
showDatePicker(
|
|
|
|
showDatePicker(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
@ -41,8 +48,12 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
var selectedDate = DateFormat.yMd().format(pickedDate);
|
|
|
|
// var selectedDate = DateFormat.yMd().format(pickedDate);
|
|
|
|
_toDateController.text = selectedDate;
|
|
|
|
final df = new DateFormat('yyyy-MM-dd');
|
|
|
|
|
|
|
|
addSickLeave.startDate = df.format(pickedDate);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_toDateController.text = addSickLeave.startDate;
|
|
|
|
|
|
|
|
//addSickLeave.startDate = selectedDate;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -59,7 +70,10 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
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(),
|
|
|
|
builder: (_, model2, w) => Center(
|
|
|
|
builder: (_, model2, w) => AppScaffold(
|
|
|
|
|
|
|
|
baseViewModel: model2,
|
|
|
|
|
|
|
|
isShowAppBar: false,
|
|
|
|
|
|
|
|
body: Center(
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(top: 10),
|
|
|
|
margin: EdgeInsets.only(top: 10),
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
@ -68,7 +82,11 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
Padding(
|
|
|
|
child: AppText(
|
|
|
|
child: AppText(
|
|
|
|
TranslationBase.of(context).addSickLeave,
|
|
|
|
widget.isExtended == true
|
|
|
|
|
|
|
|
? TranslationBase.of(context)
|
|
|
|
|
|
|
|
.extendSickLeave
|
|
|
|
|
|
|
|
: TranslationBase.of(context)
|
|
|
|
|
|
|
|
.addSickLeave,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.all(10)),
|
|
|
|
padding: EdgeInsets.all(10)),
|
|
|
|
@ -85,8 +103,13 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
AppTextFormField(
|
|
|
|
AppTextFormField(
|
|
|
|
borderColor: Colors.white,
|
|
|
|
borderColor: Colors.white,
|
|
|
|
onSaved: (value) {},
|
|
|
|
onChanged: (value) {
|
|
|
|
hintText: TranslationBase.of(context)
|
|
|
|
addSickLeave.noOfDays = value;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
hintText: widget.extendedData != null
|
|
|
|
|
|
|
|
? widget.extendedData.noOfDays
|
|
|
|
|
|
|
|
.toString()
|
|
|
|
|
|
|
|
: TranslationBase.of(context)
|
|
|
|
.sickLeaveDays,
|
|
|
|
.sickLeaveDays,
|
|
|
|
// validator: (value) {
|
|
|
|
// validator: (value) {
|
|
|
|
// return TextValidator().validateName(value);
|
|
|
|
// return TextValidator().validateName(value);
|
|
|
|
@ -103,7 +126,8 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
borderRadius:
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
border: Border.all(
|
|
|
|
border: Border.all(
|
|
|
|
width: 1.0, color: HexColor("#CCCCCC"))),
|
|
|
|
width: 1.0,
|
|
|
|
|
|
|
|
color: HexColor("#CCCCCC"))),
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
@ -113,7 +137,9 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
// fontSize: 10,
|
|
|
|
// fontSize: 10,
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
AppTextFormField(
|
|
|
|
AppTextFormField(
|
|
|
|
hintText: TranslationBase.of(context)
|
|
|
|
hintText: widget.extendedData != null
|
|
|
|
|
|
|
|
? widget.extendedData.startDate
|
|
|
|
|
|
|
|
: TranslationBase.of(context)
|
|
|
|
.sickLeaveDate,
|
|
|
|
.sickLeaveDate,
|
|
|
|
borderColor: Colors.white,
|
|
|
|
borderColor: Colors.white,
|
|
|
|
prefix: IconButton(
|
|
|
|
prefix: IconButton(
|
|
|
|
@ -124,16 +150,20 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
_presentDatePicker('_selectedToDate');
|
|
|
|
_presentDatePicker('_selectedToDate');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
inputFormatter: ONLY_DATE,
|
|
|
|
inputFormatter: ONLY_DATE,
|
|
|
|
onSaved: (value) {}),
|
|
|
|
onChanged: (value) {
|
|
|
|
|
|
|
|
addSickLeave.startDate = value;
|
|
|
|
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.all(10),
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
|
|
|
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(
|
|
|
|
border: Border.all(
|
|
|
|
width: 1.0, color: HexColor("#CCCCCC"))),
|
|
|
|
width: 1.0,
|
|
|
|
|
|
|
|
color: HexColor("#CCCCCC"))),
|
|
|
|
width: double.infinity,
|
|
|
|
width: double.infinity,
|
|
|
|
child: Padding(
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
@ -142,7 +172,8 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
right: SizeConfig.widthMultiplier * 3,
|
|
|
|
right: SizeConfig.widthMultiplier * 3,
|
|
|
|
left: SizeConfig.widthMultiplier * 3),
|
|
|
|
left: SizeConfig.widthMultiplier * 3),
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
// AppText(
|
|
|
|
// AppText(
|
|
|
|
// TranslationBase.of(context).clinicName,
|
|
|
|
// TranslationBase.of(context).clinicName,
|
|
|
|
@ -158,18 +189,21 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
ignoring: true,
|
|
|
|
ignoring: true,
|
|
|
|
child: DropdownButton(
|
|
|
|
child: DropdownButton(
|
|
|
|
isExpanded: true,
|
|
|
|
isExpanded: true,
|
|
|
|
value: getClinicName(model) ??
|
|
|
|
value: getClinicName(
|
|
|
|
|
|
|
|
model) ??
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
iconSize: 40,
|
|
|
|
iconSize: 40,
|
|
|
|
elevation: 16,
|
|
|
|
elevation: 16,
|
|
|
|
selectedItemBuilder:
|
|
|
|
selectedItemBuilder:
|
|
|
|
(BuildContext context) {
|
|
|
|
(BuildContext
|
|
|
|
|
|
|
|
context) {
|
|
|
|
return model
|
|
|
|
return model
|
|
|
|
.getClinicNameList()
|
|
|
|
.getClinicNameList()
|
|
|
|
.map((item) {
|
|
|
|
.map((item) {
|
|
|
|
return Row(
|
|
|
|
return Row(
|
|
|
|
mainAxisSize:
|
|
|
|
mainAxisSize:
|
|
|
|
MainAxisSize.max,
|
|
|
|
MainAxisSize
|
|
|
|
|
|
|
|
.max,
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
AppText(
|
|
|
|
AppText(
|
|
|
|
item,
|
|
|
|
item,
|
|
|
|
@ -181,12 +215,14 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}).toList();
|
|
|
|
}).toList();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onChanged: (newValue) => {},
|
|
|
|
onChanged: (newValue) =>
|
|
|
|
|
|
|
|
{},
|
|
|
|
items: model
|
|
|
|
items: model
|
|
|
|
.getClinicNameList()
|
|
|
|
.getClinicNameList()
|
|
|
|
.map((item) {
|
|
|
|
.map((item) {
|
|
|
|
return DropdownMenuItem(
|
|
|
|
return DropdownMenuItem(
|
|
|
|
value: item.toString(),
|
|
|
|
value:
|
|
|
|
|
|
|
|
item.toString(),
|
|
|
|
child: Text(
|
|
|
|
child: Text(
|
|
|
|
item,
|
|
|
|
item,
|
|
|
|
textAlign:
|
|
|
|
textAlign:
|
|
|
|
@ -201,6 +237,20 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
|
|
|
|
model2.sickLeaveStatistics[
|
|
|
|
|
|
|
|
'recommendedSickLeaveDays'] !=
|
|
|
|
|
|
|
|
null
|
|
|
|
|
|
|
|
? Padding(
|
|
|
|
|
|
|
|
child: AppText(
|
|
|
|
|
|
|
|
model2.sickLeaveStatistics[
|
|
|
|
|
|
|
|
'recommendedSickLeaveDays'],
|
|
|
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
: SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(left: 10, right: 10),
|
|
|
|
margin: EdgeInsets.only(left: 10, right: 10),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
@ -216,7 +266,9 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
// TranslationBase.of(context).doctorName,
|
|
|
|
// TranslationBase.of(context).doctorName,
|
|
|
|
// fontSize: 10,
|
|
|
|
// fontSize: 10,
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
AppTextFormField(
|
|
|
|
new IgnorePointer(
|
|
|
|
|
|
|
|
ignoring: true,
|
|
|
|
|
|
|
|
child: AppTextFormField(
|
|
|
|
readOnly: true,
|
|
|
|
readOnly: true,
|
|
|
|
hintText: profile['DoctorName'],
|
|
|
|
hintText: profile['DoctorName'],
|
|
|
|
borderColor: Colors.white,
|
|
|
|
borderColor: Colors.white,
|
|
|
|
@ -224,7 +276,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
// validator: (value) {
|
|
|
|
// validator: (value) {
|
|
|
|
// return TextValidator().validateName(value);
|
|
|
|
// return TextValidator().validateName(value);
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
inputFormatter: ONLY_NUMBERS)
|
|
|
|
inputFormatter: ONLY_NUMBERS))
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -248,43 +300,60 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
AppTextFormField(
|
|
|
|
AppTextFormField(
|
|
|
|
borderColor: Colors.white,
|
|
|
|
borderColor: Colors.white,
|
|
|
|
hintText: TranslationBase.of(context).remarks,
|
|
|
|
hintText: widget.extendedData != null
|
|
|
|
onSaved: (value) {},
|
|
|
|
? widget.extendedData.remarks
|
|
|
|
// validator: (value) {
|
|
|
|
: TranslationBase.of(context).remarks,
|
|
|
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
|
|
|
addSickLeave.remarks = value;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
validator: (value) {
|
|
|
|
// return TextValidator().validateName(value);
|
|
|
|
// return TextValidator().validateName(value);
|
|
|
|
// },
|
|
|
|
},
|
|
|
|
inputFormatter: ONLY_NUMBERS)
|
|
|
|
inputFormatter: ONLY_LETTERS)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin:
|
|
|
|
margin: EdgeInsets.all(
|
|
|
|
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: TranslationBase.of(context).add,
|
|
|
|
title: widget.isExtended == true
|
|
|
|
|
|
|
|
? TranslationBase.of(context).extend
|
|
|
|
|
|
|
|
: TranslationBase.of(context).add,
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () {
|
|
|
|
// _validateInputs();
|
|
|
|
if (widget.isExtended) {
|
|
|
|
|
|
|
|
model2
|
|
|
|
|
|
|
|
.extendSickLeave(
|
|
|
|
|
|
|
|
widget.extendedData)
|
|
|
|
|
|
|
|
.then((value) => (value) {
|
|
|
|
|
|
|
|
print(value);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
model2
|
|
|
|
|
|
|
|
.addSickLeave(addSickLeave)
|
|
|
|
|
|
|
|
.then((value) => print(value));
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Column(
|
|
|
|
// Column(
|
|
|
|
children: [
|
|
|
|
// children: [
|
|
|
|
Texts(TranslationBase.of(context)
|
|
|
|
// Texts(TranslationBase.of(context)
|
|
|
|
.previousSickLeaveIssue +
|
|
|
|
// .previousSickLeaveIssue +
|
|
|
|
' ')
|
|
|
|
// ' ')
|
|
|
|
],
|
|
|
|
// ],
|
|
|
|
)
|
|
|
|
// )
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
));
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getProfile() async {
|
|
|
|
getProfile() async {
|
|
|
|
|