Merge branch 'all_special_lab_result' into 'development'

fix reschedule

See merge request Cloud_Solution/doctor_app_flutter!851
merge-requests/852/head
Mohammad Aljammal 4 years ago
commit 35bfa85a1a

@ -29,162 +29,168 @@ class AddRescheduleLeavScreen extends StatelessWidget {
appBarTitle: TranslationBase.of(context).rescheduleLeaves,
body: SingleChildScrollView(
child: Column(children: [
AddNewOrder(
onTap: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Add Reschedule"
"Leave Screen",
eventAction: "apply For Reschedule",
);
openLeave(
context,
false,
);
},
label: TranslationBase.of(context).applyForReschedule,
Padding(
padding: const EdgeInsets.all(8.0),
child: AddNewOrder(
onTap: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Add Reschedule"
"Leave Screen",
eventAction: "apply For Reschedule",
);
openLeave(
context,
false,
);
},
label: TranslationBase.of(context).applyForReschedule,
),
),
Column(
children: model.getReschduleLeave.map<Widget>((GetRescheduleLeavesResponse item) {
return RoundedContainer(
child: Column(
children: [
Container(
decoration: BoxDecoration(
border: Border(
left: BorderSide(
color: item.status == 10
? Colors.red[800]
: item.status == 2
? HexColor('#CC9B14')
: item.status == 9
? Colors.green
: Colors.red,
width: 5.0,
))),
padding: EdgeInsets.only(left: 10, right: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
flex: 4,
child: Wrap(
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Container(
padding: EdgeInsets.all(3),
margin: EdgeInsets.only(top: 10),
child: AppText(
item.statusDescription,
fontWeight: FontWeight.bold,
color: item.status == 10
? Colors.red[800]
: item.status == 2
? HexColor('#CC9B14')
: item.status == 9
? Colors.green
: Colors.red,
fontSize: 14,
return Padding(
padding: const EdgeInsets.all(8.0),
child: RoundedContainer(
child: Column(
children: [
Container(
decoration: BoxDecoration(
border: Border(
left: BorderSide(
color: item.status == 10
? Colors.red[800]
: item.status == 2
? HexColor('#CC9B14')
: item.status == 9
? Colors.green
: Colors.red,
width: 5.0,
))),
padding: EdgeInsets.only(left: 10, right: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
flex: 4,
child: Wrap(
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Container(
padding: EdgeInsets.all(3),
margin: EdgeInsets.only(top: 10),
child: AppText(
item.statusDescription,
fontWeight: FontWeight.bold,
color: item.status == 10
? Colors.red[800]
: item.status == 2
? HexColor('#CC9B14')
: item.status == 9
? Colors.green
: Colors.red,
fontSize: 14,
),
),
Padding(
padding: EdgeInsets.only(top: 10),
child: AppText(
AppDateUtils.convertStringToDateFormat(
item.createdOn, 'yyyy-MM-dd HH:mm'),
fontWeight: FontWeight.bold,
))
]),
SizedBox(
height: 5,
),
Padding(
padding: EdgeInsets.only(top: 10),
Container(
child: AppText(
AppDateUtils.convertStringToDateFormat(
item.createdOn, 'yyyy-MM-dd HH:mm'),
fontWeight: FontWeight.bold,
))
]),
SizedBox(
height: 5,
),
Container(
child: AppText(
item.requisitionType == 1
? TranslationBase.of(context).offTime
: item.requisitionType == 2
? TranslationBase.of(context).holiday
: item.requisitionType == 3
? TranslationBase.of(context).changeOfSchedule
: TranslationBase.of(context).newSchedule,
fontWeight: FontWeight.bold,
)),
SizedBox(
height: 5,
),
Row(children: [
AppText(TranslationBase.of(context).startDate),
AppText(
AppDateUtils.convertStringToDateFormat(
item.dateTimeFrom, 'yyyy-MM-dd HH:mm'),
item.requisitionType == 1
? TranslationBase.of(context).offTime
: item.requisitionType == 2
? TranslationBase.of(context).holiday
: item.requisitionType == 3
? TranslationBase.of(context).changeOfSchedule
: TranslationBase.of(context).newSchedule,
fontWeight: FontWeight.bold,
)
// overflow:
// TextOverflow.ellipsis,
]),
// overflow:
// TextOverflow.ellipsis,
SizedBox(
height: 5,
),
Row(
children: [
AppText(TranslationBase.of(context).endDate),
)),
SizedBox(
height: 5,
),
Row(children: [
AppText(TranslationBase.of(context).startDate),
AppText(
AppDateUtils.convertStringToDateFormat(
item.dateTimeTo, 'yyyy-MM-dd HH:mm'),
item.dateTimeFrom, 'yyyy-MM-dd HH:mm'),
fontWeight: FontWeight.bold,
)
],
),
SizedBox(
height: 5,
),
model.coveringDoctors.length > 0
? Row(children: [
AppText(
TranslationBase.of(context).coveringDoctor,
),
AppText(
getDoctor(model.coveringDoctors, item.coveringDoctorId),
fontWeight: FontWeight.bold,
)
])
: SizedBox(),
// AppText(
// TranslationBase.of(context)
// .reasons,
// fontWeight: FontWeight.bold,
// ),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Padding(
padding: EdgeInsets.only(bottom: 5),
child: AppText(getReasons(model.allReasons, item.reasonId))),
(item.status == 2)
? IconButton(
icon: Image.asset('assets/images/edit.png'),
// color: Colors.green, //Colors.black,
onPressed: () => {openLeave(context, true, extendedData: item)},
)
// overflow:
// TextOverflow.ellipsis,
]),
// overflow:
// TextOverflow.ellipsis,
SizedBox(
height: 5,
),
Row(
children: [
AppText(TranslationBase.of(context).endDate),
AppText(
AppDateUtils.convertStringToDateFormat(
item.dateTimeTo, 'yyyy-MM-dd HH:mm'),
fontWeight: FontWeight.bold,
)
],
),
SizedBox(
height: 5,
),
model.coveringDoctors.length > 0
? Row(children: [
AppText(
TranslationBase.of(context).coveringDoctor,
),
AppText(
getDoctor(model.coveringDoctors, item.coveringDoctorId),
fontWeight: FontWeight.bold,
)
])
: SizedBox(),
]),
],
),
SizedBox(
width: 10,
),
],
// AppText(
// TranslationBase.of(context)
// .reasons,
// fontWeight: FontWeight.bold,
// ),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Padding(
padding: EdgeInsets.only(bottom: 5),
child: AppText(getReasons(model.allReasons, item.reasonId))),
(item.status == 2)
? IconButton(
icon: Image.asset('assets/images/edit.png'),
// color: Colors.green, //Colors.black,
onPressed: () => {openLeave(context, true, extendedData: item)},
)
: SizedBox(),
]),
],
),
SizedBox(
width: 10,
),
],
),
),
),
],
)),
],
],
)),
],
),
),
);
}).toList(),

@ -45,8 +45,8 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
var date;
var doctorID;
var reason;
var fromDate;
var toDate;
dynamic fromDate;
dynamic toDate;
var clinicID;
String fromTime;
String toTime;
@ -80,12 +80,12 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
}
});
setState(() {
final df = new DateFormat('yyyy-MM-dd');
fromDate = pickedDate; //df.format();
_toDateController.text = df.format(pickedDate);
toDate = pickedDate;
});
// setState(() {
// final df = new DateFormat('yyyy-MM-dd');
// fromDate = pickedDate; //df.format();
// //_toDateController2.text = df.format(pickedDate);
// //toDate = pickedDate;
// });
});
}
@ -99,9 +99,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
@override
Widget build(BuildContext context) {
projectsProvider = Provider.of(context);
offTime = widget.updateData != null
? widget.updateData.requisitionType.toString()
: offTime;
offTime = widget.updateData != null ? widget.updateData.requisitionType.toString() : offTime;
return BaseView<PatientViewModel>(
onModelReady: (model) => model.getClinicsList(),
builder: (_, model, w) => BaseView<SickLeaveViewModel>(
@ -248,22 +246,17 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
Container(
margin: EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
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,
bottom: SizeConfig.widthMultiplier * 0.9,
right: SizeConfig.widthMultiplier * 3,
left: SizeConfig.widthMultiplier * 3),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisSize: MainAxisSize.max,
@ -271,34 +264,22 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
model2.allOffTime.length > 0
? Expanded(
// add Expanded to have your dropdown button fill remaining space
child:
DropdownButtonHideUnderline(
child:
DropdownButton(
child: DropdownButtonHideUnderline(
child: DropdownButton(
// focusColor: Colors.grey,
isExpanded: true,
value: offTime == null
? model2.allOffTime[0]
['code']
: offTime,
value: offTime == null ? model2.allOffTime[0]['code'] : offTime,
iconSize: 40,
elevation: 16,
selectedItemBuilder:
(BuildContext
context) {
return model2.allOffTime
.map((item) {
selectedItemBuilder: (BuildContext context) {
return model2.allOffTime.map((item) {
return Row(
mainAxisSize:
MainAxisSize
.max,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
AppText(
item[
'description'],
fontSize: SizeConfig
.textMultiplier *
2.1,
item['description'],
fontSize: SizeConfig.textMultiplier * 2.1,
// color:
// Colors.grey,
),
@ -306,38 +287,27 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
);
}).toList();
},
onChanged: (newValue) => {
onChanged: (newValue) {
setState(() {
offTime = newValue;
}),
if (offTime == '1')
{
model2
.getReasons(18)
}
else if (offTime == '2')
{
model2
.getReasons(19)
}
else if (offTime ==
'3' ||
offTime == '5')
{
model2
.getReasons(102)
}
});
if (offTime == '1') {
model2.getReasons(18);
} else if (offTime == '2') {
model2.getReasons(19);
} else if (offTime == '3' || offTime == '5') {
model2.getReasons(102);
setState(() {
offTime = newValue;
});
}
},
items: model2.allOffTime
.map((item) {
return DropdownMenuItem<
String>(
value: item['code']
.toString(),
items: model2.allOffTime.map((item) {
return DropdownMenuItem<String>(
value: item['code'].toString(),
child: Text(
item['description'],
textAlign:
TextAlign.end,
textAlign: TextAlign.end,
),
);
}).toList(),
@ -355,37 +325,24 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
Container(
margin: EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color:
HexColor("#CCCCCC"))),
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,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppTextFormField(
hintText: TranslationBase.of(
context)
.fromDate,
hintText: TranslationBase.of(context).fromDate,
borderColor: Colors.white,
prefix: IconButton(
icon: Icon(Icons
.calendar_today)),
textInputType:
TextInputType.number,
prefix: IconButton(icon: Icon(Icons.calendar_today)),
textInputType: TextInputType.number,
controller: _toDateController,
onTap: () {
_presentDatePicker(
'fromDate');
_presentDatePicker('fromDate');
},
inputFormatter: ONLY_DATE,
onChanged: (val) =>
fromDate = val,
onSaved: (val) =>
fromDate = val,
onChanged: (val) => fromDate = val,
onSaved: (val) => fromDate = val,
)
],
)),
@ -395,37 +352,24 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
child: Container(
margin: EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(
Radius.circular(
6.0)),
border: Border.all(
width: 1.0,
color: HexColor(
"#CCCCCC"))),
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,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DateTimePicker(
timeHintText:
TranslationBase.of(
context)
.fromTime,
type: DateTimePickerType
.time,
timeHintText: TranslationBase.of(context).fromTime,
type: DateTimePickerType.time,
controller: _controller4,
onChanged: (val) =>
fromTime = val,
onChanged: (val) => fromTime = val,
validator: (val) {
print(val);
// setState(
// () => _valueToValidate4 = val);
return null;
},
onSaved: (val) =>
fromTime = val,
onSaved: (val) => fromTime = val,
)
],
),
@ -435,37 +379,24 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
child: Container(
margin: EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(
Radius.circular(
6.0)),
border: Border.all(
width: 1.0,
color: HexColor(
"#CCCCCC"))),
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,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DateTimePicker(
timeHintText:
TranslationBase.of(
context)
.toTime,
type: DateTimePickerType
.time,
timeHintText: TranslationBase.of(context).toTime,
type: DateTimePickerType.time,
controller: _controller5,
onChanged: (val) =>
toTime = val,
onChanged: (val) => toTime = val,
validator: (val) {
print(val);
// setState(
// () => _valueToValidate4 = val);
return null;
},
onSaved: (val) =>
toTime = val,
onSaved: (val) => toTime = val,
)
],
),
@ -480,38 +411,26 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
Container(
margin: EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color:
HexColor("#CCCCCC"))),
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,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppTextFormField(
hintText:
TranslationBase.of(
context)
.fromDate,
hintText: TranslationBase.of(context).fromDate,
borderColor: Colors.white,
prefix: IconButton(
icon: Icon(Icons
.calendar_today)),
textInputType:
TextInputType.number,
controller:
_toDateController,
prefix: IconButton(icon: Icon(Icons.calendar_today)),
textInputType: TextInputType.number,
readOnly: true,
controller: _toDateController,
onTap: () {
_presentDatePicker(
'fromDate');
_presentDatePicker('fromDate');
},
inputFormatter: ONLY_DATE,
onChanged: (value) {
setState(() {
toDate = value;
fromDate = value;
});
}),
],
@ -519,33 +438,21 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
Container(
margin: EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color:
HexColor("#CCCCCC"))),
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,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppTextFormField(
hintText:
TranslationBase
.of(context)
.toDate,
hintText: TranslationBase.of(context).toDate,
readOnly: true,
borderColor: Colors.white,
prefix: IconButton(
icon: Icon(Icons
.calendar_today)),
textInputType:
TextInputType.number,
controller:
_toDateController2,
prefix: IconButton(icon: Icon(Icons.calendar_today)),
textInputType: TextInputType.number,
controller: _toDateController2,
onTap: () {
_presentDatePicker(
'toDate');
_presentDatePicker('toDate');
},
inputFormatter: ONLY_DATE,
onChanged: (value) {
@ -560,22 +467,17 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
Container(
margin: EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
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,
bottom: SizeConfig.widthMultiplier * 0.9,
right: SizeConfig.widthMultiplier * 3,
left: SizeConfig.widthMultiplier * 3),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisSize: MainAxisSize.max,
@ -583,39 +485,23 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
model2.allReasons.length > 0
? Expanded(
// add Expanded to have your dropdown button fill remaining space
child:
DropdownButtonHideUnderline(
child:
DropdownButton(
child: DropdownButtonHideUnderline(
child: DropdownButton(
focusColor: Colors.grey,
isExpanded: true,
value: reason == null
? model2.allReasons[0]
['id']
.toString()
: reason,
value: model2.allReasons[0]['id'].toString() ?? "",
iconSize: 40,
elevation: 16,
selectedItemBuilder:
(BuildContext
context) {
return model2.allReasons
.map((item) {
selectedItemBuilder: (BuildContext context) {
return model2.allReasons.map((item) {
return Row(
mainAxisSize:
MainAxisSize
.max,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
AppText(
projectsProvider
.isArabic
? item[
'nameAr']
: item[
'nameEn'],
fontSize: SizeConfig
.textMultiplier *
2.1,
projectsProvider.isArabic
? item['nameAr']
: item['nameEn'],
fontSize: SizeConfig.textMultiplier * 2.1,
// color:
// Colors.grey,
),
@ -628,20 +514,12 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
reason = newValue;
})
},
items: model2.allReasons
.map((item) {
return DropdownMenuItem<
String>(
value: item['id']
.toString(),
items: model2.allReasons.map((item) {
return DropdownMenuItem<String>(
value: item['id'].toString(),
child: Text(
projectsProvider
.isArabic
? item['nameAr']
: item[
'nameEn'],
textAlign:
TextAlign.end,
projectsProvider.isArabic ? item['nameAr'] : item['nameEn'],
textAlign: TextAlign.end,
),
);
}).toList(),
@ -657,22 +535,17 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
Container(
margin: EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
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,
bottom: SizeConfig.widthMultiplier * 0.9,
right: SizeConfig.widthMultiplier * 3,
left: SizeConfig.widthMultiplier * 3),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisSize: MainAxisSize.max,
@ -683,69 +556,35 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
child: DropdownSearch(
mode: Mode.BOTTOM_SHEET,
dropdownSearchDecoration:
InputDecoration(
contentPadding:
EdgeInsets
.all(0),
border:
InputBorder
.none),
dropdownSearchDecoration: InputDecoration(
contentPadding: EdgeInsets.all(0), border: InputBorder.none),
//maxHeight: 300,
items: model2
.coveringDoctors
.map((item) {
return projectsProvider
.isArabic
? item[
'doctorNameN']
: item[
'doctorName'];
items: model2.coveringDoctors.map((item) {
return projectsProvider.isArabic
? item['doctorNameN']
: item['doctorName'];
}).toList(),
// label: "Doctor List",
onChanged: (item) {
model2.coveringDoctors
.forEach(
(newVal) => {
if (newVal['doctorName'] ==
item ||
newVal['doctorName'] ==
item)
{
doctorID =
newVal['DoctorID']
}
});
model2.coveringDoctors.forEach((newVal) => {
if (newVal['doctorName'] == item)
doctorID = newVal['DoctorID']
});
},
selectedItem:
getSelectedDoctor(
model2),
selectedItem: getSelectedDoctor(model2),
showSearchBox: true,
searchBoxDecoration:
InputDecoration(
border:
OutlineInputBorder(),
contentPadding:
EdgeInsets.fromLTRB(
12, 12, 8, 0),
labelText:
"Search Doctor",
searchBoxDecoration: InputDecoration(
border: OutlineInputBorder(),
contentPadding: EdgeInsets.fromLTRB(12, 12, 8, 0),
labelText: "Search Doctor",
),
popupTitle: Container(
height: 50,
decoration:
BoxDecoration(
color: Theme.of(
context)
.primaryColorDark,
borderRadius:
BorderRadius.only(
topLeft:
Radius.circular(
20),
topRight:
Radius.circular(
20),
decoration: BoxDecoration(
color: Theme.of(context).primaryColorDark,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
),
child: Center(
@ -753,25 +592,16 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
'',
style: TextStyle(
fontSize: 24,
fontWeight:
FontWeight
.bold,
color:
Colors.white,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
),
popupShape:
RoundedRectangleBorder(
borderRadius:
BorderRadius.only(
topLeft:
Radius.circular(
24),
topRight:
Radius.circular(
24),
popupShape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24),
topRight: Radius.circular(24),
),
),
),
@ -845,17 +675,14 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
)),
SizedBox(height: SizeConfig.screenHeight * .3),
Container(
margin: EdgeInsets.all(
SizeConfig.widthMultiplier * 5),
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: widget.isUpdate == true
? TranslationBase.of(context)
.updateReschedule
: TranslationBase.of(context)
.addReschedule,
? TranslationBase.of(context).updateReschedule
: TranslationBase.of(context).addReschedule,
color: HexColor('#359846'),
onPressed: () {
if (offTime == '1' || offTime == '2') {
@ -865,9 +692,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
addRecheduleLeave(model2);
}
} else {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
.onlyOfftimeHoliday);
DrAppToastMsg.showErrorToast(TranslationBase.of(context).onlyOfftimeHoliday);
}
},
),
@ -900,16 +725,13 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
final df = new DateFormat('HH:mm:ss');
final dateFormat = new DateFormat('yyyy-MM-dd');
this.offTime = widget.updateData.requisitionType.toString();
_toDateController.text =
dateFormat.format(DateTime.parse(widget.updateData.dateTimeFrom));
_toDateController.text = dateFormat.format(DateTime.parse(widget.updateData.dateTimeFrom));
//df.format(DateTime.parse(widget.updateData.dateTimeFrom));
this.fromTime =
df.format(DateTime.parse(widget.updateData.dateTimeFrom));
this.fromTime = df.format(DateTime.parse(widget.updateData.dateTimeFrom));
this.fromTime = this.fromTime.substring(0, this.fromTime.length - 3);
this.toTime = df.format(DateTime.parse(widget.updateData.dateTimeTo));
this.toTime = this.toTime.substring(0, this.toTime.length - 3);
_toDateController2.text =
dateFormat.format(DateTime.parse(widget.updateData.dateTimeTo));
_toDateController2.text = dateFormat.format(DateTime.parse(widget.updateData.dateTimeTo));
_controller5.text = toTime;
_controller4.text = fromTime;
toDate = _toDateController2.text;
@ -922,8 +744,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
getClinicName(model) {
var clinicID = this.profile['ClinicID'] ?? 1;
var clinicInfo =
model.clinicsList.where((i) => i['ClinicID'] == clinicID).toList();
var clinicInfo = model.clinicsList.where((i) => i['ClinicID'] == clinicID).toList();
return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : "";
}
@ -933,16 +754,10 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
var fromDates = fromDate;
var toDates = toDate;
if (offTime == '1') {
fromDate = df.format(DateTime.parse(dateFormat.format(fromDates) +
'T' +
fromTime +
':' +
DateTime.now().second.toString()));
toDate = df.format(DateTime.parse(dateFormat.format(fromDates) +
'T' +
toTime +
':' +
DateTime.now().second.toString()));
fromDate = df.format(
DateTime.parse(dateFormat.format(fromDates) + 'T' + fromTime + ':' + DateTime.now().second.toString()));
toDate = df
.format(DateTime.parse(dateFormat.format(fromDates) + 'T' + toTime + ':' + DateTime.now().second.toString()));
} else {
fromDate = df.format(fromDates);
toDate = df.format(toDates);
@ -957,8 +772,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
"dateTimeTo": toDate,
"date": offTime == '1' ? fromDate : df.format(DateTime.now()),
"reasonId": reason == null ? model.allOffTime[0]['code'] : reason,
"coveringDoctorId":
doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID,
"coveringDoctorId": doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID,
"status": 2,
"schedule": [
{
@ -981,10 +795,9 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AddRescheduleLeavScreen(),
settings: RouteSettings(name: 'AddRescheduleLeaveScreen')
// MyReferredPatient(),
),
builder: (context) => AddRescheduleLeavScreen(), settings: RouteSettings(name: 'AddRescheduleLeaveScreen')
// MyReferredPatient(),
),
);
}
});
@ -993,22 +806,17 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
updateRecheduleLeave(model) {
// final df = new DateFormat('yyyy-MM-ddTHH:MM:ss');
final df = new DateFormat('yyyy-MM-dd');
var fromDates = fromDate;
var toDates = toDate;
String dataS = DateTime.now().toIso8601String();
dynamic fromDates = fromDate;
dynamic toDates = toDate;
if (offTime == '1') {
fromDate = df.format(DateTime.parse(_toDateController.text)) +
'T' +
fromTime +
':' +
DateTime.now().second.toString();
toDate = df.format(DateTime.parse(_toDateController.text)) +
'T' +
toTime +
':' +
DateTime.now().second.toString();
fromDate =
df.format(DateTime.parse(_toDateController.text)) + 'T' + fromTime + ':' + DateTime.now().second.toString();
toDate =
df.format(DateTime.parse(_toDateController2.text)) + 'T' + toTime + ':' + DateTime.now().second.toString();
} else {
fromDate = df.format(fromDates);
toDate = df.format(toDates);
fromDate = df.format(fromDates is DateTime ? fromDates : DateTime.parse(fromDates));
toDate = df.format(toDates is DateTime ? toDates : DateTime.parse(toDates));
}
Map<String, dynamic> request = {
@ -1021,8 +829,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
"dateTimeTo": toDate,
"date": offTime == '1' ? fromDate : df.format(DateTime.now()),
"reasonId": reason == null ? model.allOffTime[0]['code'] : reason,
"coveringDoctorId":
doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID,
"coveringDoctorId": doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID,
"status": 2,
"schedule": [
{
@ -1045,9 +852,8 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AddRescheduleLeavScreen(),
settings: RouteSettings(name: 'AddRescheduleLeaveScreen')
),
builder: (context) => AddRescheduleLeavScreen(),
settings: RouteSettings(name: 'AddRescheduleLeaveScreen')),
);
}
});
@ -1061,8 +867,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
: model2.coveringDoctors[0]['doctorName'];
else {
model2.coveringDoctors.forEach((newVal) => {
if (newVal['doctorID'].toString() == doctorID)
{doctorName = newVal['doctorName']}
if (newVal['doctorID'].toString() == doctorID) {doctorName = newVal['doctorName']}
});
return doctorName;
}

Loading…
Cancel
Save