|
|
|
@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.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/core/viewModel/patient_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/project_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';
|
|
|
|
@ -20,6 +21,7 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
Helpers helpers = Helpers();
|
|
|
|
|
|
|
|
|
@ -32,6 +34,7 @@ class RescheduleLeaveScreen extends StatefulWidget {
|
|
|
|
|
class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
|
|
|
TextEditingController _toDateController = new TextEditingController();
|
|
|
|
|
ProjectViewModel projectsProvider;
|
|
|
|
|
String _selectedClinic;
|
|
|
|
|
Map profile = {};
|
|
|
|
|
AddSickLeaveRequest addSickLeave = AddSickLeaveRequest();
|
|
|
|
@ -59,17 +62,23 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
getProfile();
|
|
|
|
|
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
projectsProvider = Provider.of(context);
|
|
|
|
|
return BaseView<PatientViewModel>(
|
|
|
|
|
onModelReady: (model) => model.getClinicsList(),
|
|
|
|
|
builder: (_, model, w) => BaseView<SickLeaveViewModel>(
|
|
|
|
|
onModelReady: (model2) => model2.getOffTime(),
|
|
|
|
|
onModelReady: (model2) => {
|
|
|
|
|
model2.getOffTime(),
|
|
|
|
|
model2.getReasons(18),
|
|
|
|
|
model2.getCoveringDoctors()
|
|
|
|
|
},
|
|
|
|
|
builder: (_, model2, w) => AppScaffold(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
baseViewModel: model2,
|
|
|
|
|
isShowAppBar: false,
|
|
|
|
|
body: Center(
|
|
|
|
|
child: Container(
|
|
|
|
@ -79,8 +88,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
|
child: ListView(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
top: 10, left: 10, right: 10),
|
|
|
|
|
margin: EdgeInsets.all(8),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
@ -98,10 +106,6 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
// AppText(
|
|
|
|
|
// TranslationBase.of(context).clinicName,
|
|
|
|
|
// fontSize: 10,
|
|
|
|
|
// ),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
children: <Widget>[
|
|
|
|
@ -163,11 +167,9 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(left: 10, right: 10),
|
|
|
|
|
margin: EdgeInsets.all(8),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
@ -181,7 +183,9 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
|
ignoring: true,
|
|
|
|
|
child: AppTextFormField(
|
|
|
|
|
readOnly: true,
|
|
|
|
|
hintText: profile['DoctorName'],
|
|
|
|
|
hintText: profile != null
|
|
|
|
|
? profile['DoctorName']
|
|
|
|
|
: "",
|
|
|
|
|
borderColor: Colors.white,
|
|
|
|
|
onSaved: (value) {},
|
|
|
|
|
inputFormatter: ONLY_NUMBERS))
|
|
|
|
@ -190,8 +194,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
top: 10, left: 10, right: 10),
|
|
|
|
|
margin: EdgeInsets.all(8),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
@ -212,65 +215,319 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
// add Expanded to have your dropdown button fill remaining space
|
|
|
|
|
child: DropdownButtonHideUnderline(
|
|
|
|
|
child: new IgnorePointer(
|
|
|
|
|
ignoring: true,
|
|
|
|
|
child: DropdownButton(
|
|
|
|
|
focusColor: Colors.grey,
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
value: getClinicName(
|
|
|
|
|
model) ??
|
|
|
|
|
"",
|
|
|
|
|
iconSize: 40,
|
|
|
|
|
elevation: 16,
|
|
|
|
|
selectedItemBuilder:
|
|
|
|
|
(BuildContext
|
|
|
|
|
context) {
|
|
|
|
|
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()
|
|
|
|
|
model2.allOffTime.length > 0
|
|
|
|
|
? Expanded(
|
|
|
|
|
// add Expanded to have your dropdown button fill remaining space
|
|
|
|
|
child:
|
|
|
|
|
DropdownButtonHideUnderline(
|
|
|
|
|
child: DropdownButton(
|
|
|
|
|
focusColor: Colors.grey,
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
value: model2.allOffTime[0]
|
|
|
|
|
['code'],
|
|
|
|
|
iconSize: 40,
|
|
|
|
|
elevation: 16,
|
|
|
|
|
selectedItemBuilder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return model2.allOffTime
|
|
|
|
|
.map((item) {
|
|
|
|
|
return DropdownMenuItem(
|
|
|
|
|
value:
|
|
|
|
|
item.toString(),
|
|
|
|
|
child: Text(
|
|
|
|
|
item,
|
|
|
|
|
textAlign:
|
|
|
|
|
TextAlign.end,
|
|
|
|
|
),
|
|
|
|
|
return Row(
|
|
|
|
|
mainAxisSize:
|
|
|
|
|
MainAxisSize.max,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
item[
|
|
|
|
|
'description'],
|
|
|
|
|
fontSize: SizeConfig
|
|
|
|
|
.textMultiplier *
|
|
|
|
|
2.1,
|
|
|
|
|
color:
|
|
|
|
|
Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
))),
|
|
|
|
|
),
|
|
|
|
|
}).toList();
|
|
|
|
|
},
|
|
|
|
|
onChanged: (newValue) => {},
|
|
|
|
|
items: model2.allOffTime
|
|
|
|
|
.map((item) {
|
|
|
|
|
return DropdownMenuItem<
|
|
|
|
|
String>(
|
|
|
|
|
value: item['code']
|
|
|
|
|
.toString(),
|
|
|
|
|
child: Text(
|
|
|
|
|
item['description'],
|
|
|
|
|
textAlign:
|
|
|
|
|
TextAlign.end,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
)),
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(8),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
width: 1.0,
|
|
|
|
|
color: HexColor("#CCCCCC"))),
|
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
hintText: TranslationBase.of(context)
|
|
|
|
|
.fromDate,
|
|
|
|
|
borderColor: Colors.white,
|
|
|
|
|
prefix: IconButton(
|
|
|
|
|
icon: Icon(Icons.calendar_today)),
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
controller: _toDateController,
|
|
|
|
|
onTap: () {
|
|
|
|
|
_presentDatePicker('_selectedToDate');
|
|
|
|
|
},
|
|
|
|
|
inputFormatter: ONLY_DATE,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
addSickLeave.startDate = value;
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.all(8),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(6.0)),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
width: 1.0,
|
|
|
|
|
color: HexColor("#CCCCCC"))),
|
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
new AppTextFormField(
|
|
|
|
|
readOnly: true,
|
|
|
|
|
hintText: "",
|
|
|
|
|
borderColor: Colors.white,
|
|
|
|
|
onSaved: (value) {},
|
|
|
|
|
inputFormatter: ONLY_NUMBERS),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.all(8),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(6.0)),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
width: 1.0,
|
|
|
|
|
color: HexColor("#CCCCCC"))),
|
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
new AppTextFormField(
|
|
|
|
|
readOnly: true,
|
|
|
|
|
hintText: "",
|
|
|
|
|
borderColor: Colors.white,
|
|
|
|
|
onSaved: (value) {},
|
|
|
|
|
inputFormatter: ONLY_NUMBERS),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(8),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
width: 1.0,
|
|
|
|
|
color: HexColor("#CCCCCC"))),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
top: SizeConfig.widthMultiplier * 0.9,
|
|
|
|
|
bottom: SizeConfig.widthMultiplier * 0.9,
|
|
|
|
|
right: SizeConfig.widthMultiplier * 3,
|
|
|
|
|
left: SizeConfig.widthMultiplier * 3),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
model2.allReasons.length > 0
|
|
|
|
|
? Expanded(
|
|
|
|
|
// add Expanded to have your dropdown button fill remaining space
|
|
|
|
|
child:
|
|
|
|
|
DropdownButtonHideUnderline(
|
|
|
|
|
child: DropdownButton(
|
|
|
|
|
focusColor: Colors.grey,
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
value: model2.allReasons[0]
|
|
|
|
|
['id']
|
|
|
|
|
.toString(),
|
|
|
|
|
iconSize: 40,
|
|
|
|
|
elevation: 16,
|
|
|
|
|
selectedItemBuilder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return model2.allReasons
|
|
|
|
|
.map((item) {
|
|
|
|
|
return Row(
|
|
|
|
|
mainAxisSize:
|
|
|
|
|
MainAxisSize.max,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
projectsProvider
|
|
|
|
|
.isArabic
|
|
|
|
|
? item[
|
|
|
|
|
'nameAr']
|
|
|
|
|
: item[
|
|
|
|
|
'nameEn'],
|
|
|
|
|
fontSize: SizeConfig
|
|
|
|
|
.textMultiplier *
|
|
|
|
|
2.1,
|
|
|
|
|
color:
|
|
|
|
|
Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}).toList();
|
|
|
|
|
},
|
|
|
|
|
onChanged: (newValue) => {},
|
|
|
|
|
items: model2.allReasons
|
|
|
|
|
.map((item) {
|
|
|
|
|
return DropdownMenuItem<
|
|
|
|
|
String>(
|
|
|
|
|
value: item['id']
|
|
|
|
|
.toString(),
|
|
|
|
|
child: Text(
|
|
|
|
|
projectsProvider
|
|
|
|
|
.isArabic
|
|
|
|
|
? item['nameAr']
|
|
|
|
|
: item['nameEn'],
|
|
|
|
|
textAlign:
|
|
|
|
|
TextAlign.end,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
)),
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(8),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
width: 1.0,
|
|
|
|
|
color: HexColor("#CCCCCC"))),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
top: SizeConfig.widthMultiplier * 0.9,
|
|
|
|
|
bottom: SizeConfig.widthMultiplier * 0.9,
|
|
|
|
|
right: SizeConfig.widthMultiplier * 3,
|
|
|
|
|
left: SizeConfig.widthMultiplier * 3),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
model2.coveringDoctors.length > 0
|
|
|
|
|
? Expanded(
|
|
|
|
|
// add Expanded to have your dropdown button fill remaining space
|
|
|
|
|
child:
|
|
|
|
|
DropdownButtonHideUnderline(
|
|
|
|
|
child: DropdownButton(
|
|
|
|
|
focusColor: Colors.grey,
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
value: model2
|
|
|
|
|
.coveringDoctors[0]
|
|
|
|
|
['doctorID']
|
|
|
|
|
.toString(),
|
|
|
|
|
iconSize: 40,
|
|
|
|
|
elevation: 16,
|
|
|
|
|
selectedItemBuilder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return model2
|
|
|
|
|
.coveringDoctors
|
|
|
|
|
.map((item) {
|
|
|
|
|
return Row(
|
|
|
|
|
mainAxisSize:
|
|
|
|
|
MainAxisSize.max,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
projectsProvider
|
|
|
|
|
.isArabic
|
|
|
|
|
? item[
|
|
|
|
|
'doctorNameN']
|
|
|
|
|
: item[
|
|
|
|
|
'doctorName'],
|
|
|
|
|
fontSize: SizeConfig
|
|
|
|
|
.textMultiplier *
|
|
|
|
|
2.1,
|
|
|
|
|
color:
|
|
|
|
|
Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}).toList();
|
|
|
|
|
},
|
|
|
|
|
onChanged: (newValue) => {},
|
|
|
|
|
items: model2
|
|
|
|
|
.coveringDoctors
|
|
|
|
|
.map((item) {
|
|
|
|
|
return DropdownMenuItem<
|
|
|
|
|
String>(
|
|
|
|
|
value: item['doctorID']
|
|
|
|
|
.toString(),
|
|
|
|
|
child: Text(
|
|
|
|
|
projectsProvider
|
|
|
|
|
.isArabic
|
|
|
|
|
? item[
|
|
|
|
|
'doctorNameN']
|
|
|
|
|
: item[
|
|
|
|
|
'doctorName'],
|
|
|
|
|
textAlign:
|
|
|
|
|
TextAlign.start,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
)),
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(
|
|
|
|
|
SizeConfig.widthMultiplier * 5),
|
|
|
|
@ -307,9 +564,9 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getClinicName(model) {
|
|
|
|
|
var clinicInfo = model.clinicsList
|
|
|
|
|
.where((i) => i['ClinicID'] == this.profile['ClinicID'])
|
|
|
|
|
.toList();
|
|
|
|
|
var clinicID = this.profile != null ? this.profile['ClinicID'] : 1;
|
|
|
|
|
var clinicInfo =
|
|
|
|
|
model.clinicsList.where((i) => i['ClinicID'] == clinicID).toList();
|
|
|
|
|
return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|