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,7 +29,9 @@ class AddRescheduleLeavScreen extends StatelessWidget {
appBarTitle: TranslationBase.of(context).rescheduleLeaves, appBarTitle: TranslationBase.of(context).rescheduleLeaves,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column(children: [ child: Column(children: [
AddNewOrder( Padding(
padding: const EdgeInsets.all(8.0),
child: AddNewOrder(
onTap: () async { onTap: () async {
await locator<AnalyticsService>().logEvent( await locator<AnalyticsService>().logEvent(
eventCategory: "Add Reschedule" eventCategory: "Add Reschedule"
@ -43,9 +45,12 @@ class AddRescheduleLeavScreen extends StatelessWidget {
}, },
label: TranslationBase.of(context).applyForReschedule, label: TranslationBase.of(context).applyForReschedule,
), ),
),
Column( Column(
children: model.getReschduleLeave.map<Widget>((GetRescheduleLeavesResponse item) { children: model.getReschduleLeave.map<Widget>((GetRescheduleLeavesResponse item) {
return RoundedContainer( return Padding(
padding: const EdgeInsets.all(8.0),
child: RoundedContainer(
child: Column( child: Column(
children: [ children: [
Container( Container(
@ -186,6 +191,7 @@ class AddRescheduleLeavScreen extends StatelessWidget {
)), )),
], ],
), ),
),
); );
}).toList(), }).toList(),
) )

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

Loading…
Cancel
Save