|
|
|
@ -6,8 +6,10 @@ 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/project_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/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/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/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/text_validator.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
@ -23,6 +25,7 @@ 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';
|
|
|
|
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart';
|
|
|
|
|
|
|
|
|
|
|
|
Helpers helpers = Helpers();
|
|
|
|
Helpers helpers = Helpers();
|
|
|
|
|
|
|
|
|
|
|
|
@ -39,21 +42,32 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
TextEditingController _toDateController = new TextEditingController();
|
|
|
|
TextEditingController _toDateController = new TextEditingController();
|
|
|
|
TextEditingController _toDateController2 = new TextEditingController();
|
|
|
|
TextEditingController _toDateController2 = new TextEditingController();
|
|
|
|
ProjectViewModel projectsProvider;
|
|
|
|
ProjectViewModel projectsProvider;
|
|
|
|
|
|
|
|
SickLeaveViewModel sickLeaveViewModel;
|
|
|
|
String _selectedClinic;
|
|
|
|
String _selectedClinic;
|
|
|
|
Map profile = {};
|
|
|
|
Map profile = {};
|
|
|
|
var offTime = '2';
|
|
|
|
var offTime = '1';
|
|
|
|
var date;
|
|
|
|
var date;
|
|
|
|
var doctorID;
|
|
|
|
var doctorID;
|
|
|
|
var reason;
|
|
|
|
var reason;
|
|
|
|
var fromDate;
|
|
|
|
var fromDate;
|
|
|
|
var toDate;
|
|
|
|
var toDate;
|
|
|
|
var clinicID;
|
|
|
|
var clinicID;
|
|
|
|
|
|
|
|
var fromTime;
|
|
|
|
|
|
|
|
var toTime;
|
|
|
|
TextEditingController _controller4;
|
|
|
|
TextEditingController _controller4;
|
|
|
|
|
|
|
|
TextEditingController _controller5;
|
|
|
|
void _presentDatePicker(id) {
|
|
|
|
void _presentDatePicker(id) {
|
|
|
|
|
|
|
|
var date = new DateTime.now();
|
|
|
|
|
|
|
|
var initialDate = id == 'fromDate'
|
|
|
|
|
|
|
|
? new DateTime(date.year, date.month, date.day + 15)
|
|
|
|
|
|
|
|
: new DateTime(fromDate.year, fromDate.month, fromDate.day);
|
|
|
|
|
|
|
|
var firstDate = id == 'fromDate'
|
|
|
|
|
|
|
|
? new DateTime(date.year, date.month, date.day + 15)
|
|
|
|
|
|
|
|
: new DateTime(fromDate.year, fromDate.month, fromDate.day);
|
|
|
|
showDatePicker(
|
|
|
|
showDatePicker(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
initialDate: DateTime.now(),
|
|
|
|
initialDate: initialDate,
|
|
|
|
firstDate: DateTime.now(),
|
|
|
|
firstDate: firstDate,
|
|
|
|
lastDate: DateTime(2050),
|
|
|
|
lastDate: DateTime(2050),
|
|
|
|
).then((pickedDate) {
|
|
|
|
).then((pickedDate) {
|
|
|
|
if (pickedDate == null) {
|
|
|
|
if (pickedDate == null) {
|
|
|
|
@ -69,6 +83,13 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
_toDateController2.text = df.format(pickedDate);
|
|
|
|
_toDateController2.text = df.format(pickedDate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
final df = new DateFormat('yyyy-MM-dd');
|
|
|
|
|
|
|
|
fromDate = pickedDate; //df.format();
|
|
|
|
|
|
|
|
_toDateController.text = df.format(pickedDate);
|
|
|
|
|
|
|
|
toDate = pickedDate;
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -82,6 +103,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
projectsProvider = Provider.of(context);
|
|
|
|
projectsProvider = Provider.of(context);
|
|
|
|
|
|
|
|
|
|
|
|
return BaseView<PatientViewModel>(
|
|
|
|
return BaseView<PatientViewModel>(
|
|
|
|
onModelReady: (model) => model.getClinicsList(),
|
|
|
|
onModelReady: (model) => model.getClinicsList(),
|
|
|
|
builder: (_, model, w) => BaseView<SickLeaveViewModel>(
|
|
|
|
builder: (_, model, w) => BaseView<SickLeaveViewModel>(
|
|
|
|
@ -130,10 +152,12 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
child: DropdownButton(
|
|
|
|
child: DropdownButton(
|
|
|
|
focusColor: Colors.grey,
|
|
|
|
focusColor: Colors.grey,
|
|
|
|
isExpanded: true,
|
|
|
|
isExpanded: true,
|
|
|
|
|
|
|
|
dropdownColor:
|
|
|
|
|
|
|
|
Colors.grey,
|
|
|
|
value: getClinicName(
|
|
|
|
value: getClinicName(
|
|
|
|
model) ??
|
|
|
|
model) ??
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
iconSize: 40,
|
|
|
|
iconSize: 0,
|
|
|
|
elevation: 16,
|
|
|
|
elevation: 16,
|
|
|
|
selectedItemBuilder:
|
|
|
|
selectedItemBuilder:
|
|
|
|
(BuildContext
|
|
|
|
(BuildContext
|
|
|
|
@ -151,8 +175,8 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
fontSize: SizeConfig
|
|
|
|
fontSize: SizeConfig
|
|
|
|
.textMultiplier *
|
|
|
|
.textMultiplier *
|
|
|
|
2.1,
|
|
|
|
2.1,
|
|
|
|
color:
|
|
|
|
color: Colors
|
|
|
|
Colors.grey,
|
|
|
|
.grey[500],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@ -234,7 +258,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
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]
|
|
|
|
? model2.allOffTime[0]
|
|
|
|
@ -256,8 +280,8 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
fontSize: SizeConfig
|
|
|
|
fontSize: SizeConfig
|
|
|
|
.textMultiplier *
|
|
|
|
.textMultiplier *
|
|
|
|
2.1,
|
|
|
|
2.1,
|
|
|
|
color:
|
|
|
|
// color:
|
|
|
|
Colors.grey,
|
|
|
|
// Colors.grey,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@ -313,13 +337,13 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
AppTextFormField(
|
|
|
|
AppTextFormField(
|
|
|
|
hintText: TranslationBase.of(
|
|
|
|
hintText:
|
|
|
|
context)
|
|
|
|
TranslationBase.of(context)
|
|
|
|
.fromDate,
|
|
|
|
.fromDate,
|
|
|
|
borderColor: Colors.white,
|
|
|
|
borderColor: Colors.white,
|
|
|
|
prefix: IconButton(
|
|
|
|
prefix: IconButton(
|
|
|
|
icon: Icon(Icons
|
|
|
|
icon: Icon(
|
|
|
|
.calendar_today)),
|
|
|
|
Icons.calendar_today)),
|
|
|
|
textInputType:
|
|
|
|
textInputType:
|
|
|
|
TextInputType.number,
|
|
|
|
TextInputType.number,
|
|
|
|
controller: _toDateController,
|
|
|
|
controller: _toDateController,
|
|
|
|
@ -328,9 +352,11 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
'fromDate');
|
|
|
|
'fromDate');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
inputFormatter: ONLY_DATE,
|
|
|
|
inputFormatter: ONLY_DATE,
|
|
|
|
onChanged: (value) {
|
|
|
|
onChanged: (val) =>
|
|
|
|
fromDate = value;
|
|
|
|
fromDate = val,
|
|
|
|
}),
|
|
|
|
onSaved: (val) =>
|
|
|
|
|
|
|
|
fromDate = val,
|
|
|
|
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
@ -351,32 +377,24 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
crossAxisAlignment:
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
// new AppTextFormField(
|
|
|
|
|
|
|
|
// readOnly: true,
|
|
|
|
|
|
|
|
// hintText: "",
|
|
|
|
|
|
|
|
// borderColor: Colors.white,
|
|
|
|
|
|
|
|
// onSaved: (value) {},
|
|
|
|
|
|
|
|
// inputFormatter: ONLY_NUMBERS),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DateTimePicker(
|
|
|
|
DateTimePicker(
|
|
|
|
|
|
|
|
timeHintText:
|
|
|
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
|
|
|
context)
|
|
|
|
|
|
|
|
.fromTime,
|
|
|
|
type:
|
|
|
|
type:
|
|
|
|
DateTimePickerType.time,
|
|
|
|
DateTimePickerType.time,
|
|
|
|
controller: _controller4,
|
|
|
|
controller: _controller4,
|
|
|
|
//initialValue: _initialValue,
|
|
|
|
onChanged: (val) =>
|
|
|
|
// icon: Icon(Icons.access_time),
|
|
|
|
fromTime = val,
|
|
|
|
|
|
|
|
|
|
|
|
//use24HourFormat: false,
|
|
|
|
|
|
|
|
//locale: Locale('en', 'US'),
|
|
|
|
|
|
|
|
onChanged: (val) => () {
|
|
|
|
|
|
|
|
print(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,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -399,17 +417,15 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
DateTimePicker(
|
|
|
|
DateTimePicker(
|
|
|
|
|
|
|
|
timeHintText:
|
|
|
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
|
|
|
context)
|
|
|
|
|
|
|
|
.toTime,
|
|
|
|
type:
|
|
|
|
type:
|
|
|
|
DateTimePickerType.time,
|
|
|
|
DateTimePickerType.time,
|
|
|
|
controller: _controller4,
|
|
|
|
controller: _controller5,
|
|
|
|
//initialValue: _initialValue,
|
|
|
|
onChanged: (val) =>
|
|
|
|
// icon: Icon(Icons.access_time),
|
|
|
|
toTime = val,
|
|
|
|
|
|
|
|
|
|
|
|
//use24HourFormat: false,
|
|
|
|
|
|
|
|
//locale: Locale('en', 'US'),
|
|
|
|
|
|
|
|
onChanged: (val) => () {
|
|
|
|
|
|
|
|
print(val);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
validator: (val) {
|
|
|
|
validator: (val) {
|
|
|
|
print(val);
|
|
|
|
print(val);
|
|
|
|
// setState(
|
|
|
|
// setState(
|
|
|
|
@ -417,7 +433,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onSaved: (val) =>
|
|
|
|
onSaved: (val) =>
|
|
|
|
{print(val)},
|
|
|
|
toTime = val,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -481,7 +497,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
AppTextFormField(
|
|
|
|
AppTextFormField(
|
|
|
|
hintText: TranslationBase
|
|
|
|
hintText: TranslationBase
|
|
|
|
.of(context)
|
|
|
|
.of(context)
|
|
|
|
.fromDate,
|
|
|
|
.toDate,
|
|
|
|
borderColor: Colors.white,
|
|
|
|
borderColor: Colors.white,
|
|
|
|
prefix: IconButton(
|
|
|
|
prefix: IconButton(
|
|
|
|
icon: Icon(
|
|
|
|
icon: Icon(
|
|
|
|
@ -560,8 +576,8 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
fontSize: SizeConfig
|
|
|
|
fontSize: SizeConfig
|
|
|
|
.textMultiplier *
|
|
|
|
.textMultiplier *
|
|
|
|
2.1,
|
|
|
|
2.1,
|
|
|
|
color:
|
|
|
|
// color:
|
|
|
|
Colors.grey,
|
|
|
|
// Colors.grey,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@ -654,8 +670,6 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
fontSize: SizeConfig
|
|
|
|
fontSize: SizeConfig
|
|
|
|
.textMultiplier *
|
|
|
|
.textMultiplier *
|
|
|
|
2.1,
|
|
|
|
2.1,
|
|
|
|
color:
|
|
|
|
|
|
|
|
Colors.grey,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@ -731,9 +745,10 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
|
|
|
|
|
|
|
|
getProfile() async {
|
|
|
|
getProfile() async {
|
|
|
|
Map p = await sharedPref.getObj(DOCTOR_PROFILE);
|
|
|
|
Map p = await sharedPref.getObj(DOCTOR_PROFILE);
|
|
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
if (widget.updateData != null) {
|
|
|
|
|
|
|
|
this.profile = p;
|
|
|
|
this.profile = p;
|
|
|
|
|
|
|
|
if (widget.updateData != null) {
|
|
|
|
this.clinicID = widget.updateData.clinicId;
|
|
|
|
this.clinicID = widget.updateData.clinicId;
|
|
|
|
|
|
|
|
|
|
|
|
_toDateController.text = widget.updateData.dateTimeFrom;
|
|
|
|
_toDateController.text = widget.updateData.dateTimeFrom;
|
|
|
|
@ -749,16 +764,34 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : "";
|
|
|
|
return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
addRecheduleLeave(model) {
|
|
|
|
addRecheduleLeave(model) async {
|
|
|
|
final df = new DateFormat('yyyy-MM-ddThh:mm:ss');
|
|
|
|
final df = new DateFormat('yyyy-MM-ddTHH:MM:ss');
|
|
|
|
|
|
|
|
final dateFormat = new DateFormat('yyyy-MM-dd');
|
|
|
|
|
|
|
|
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()));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
fromDate = df.format(fromDates);
|
|
|
|
|
|
|
|
toDate = df.format(toDates);
|
|
|
|
|
|
|
|
}
|
|
|
|
Map<String, dynamic> request = {
|
|
|
|
Map<String, dynamic> request = {
|
|
|
|
"Requisition": {
|
|
|
|
"Requisition": {
|
|
|
|
"requisitionNo": 0,
|
|
|
|
"requisitionNo": 0,
|
|
|
|
"requisitionType": offTime,
|
|
|
|
"requisitionType": offTime,
|
|
|
|
"clinicId": this.profile['ClinicID'],
|
|
|
|
"clinicId": this.profile['ClinicID'],
|
|
|
|
"doctorId": this.profile['ClinicID'],
|
|
|
|
"doctorId": this.profile['DoctorID'],
|
|
|
|
"dateTimeFrom": df.format(fromDate),
|
|
|
|
"dateTimeFrom": fromDate,
|
|
|
|
"dateTimeTo": df.format(toDate),
|
|
|
|
"dateTimeTo": toDate,
|
|
|
|
"date": df.format(DateTime.now()),
|
|
|
|
"date": df.format(DateTime.now()),
|
|
|
|
"reasonId": reason == null ? model.allOffTime[0]['code'] : reason,
|
|
|
|
"reasonId": reason == null ? model.allOffTime[0]['code'] : reason,
|
|
|
|
"coveringDoctorId":
|
|
|
|
"coveringDoctorId":
|
|
|
|
@ -769,8 +802,8 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
"weekDayId": 1,
|
|
|
|
"weekDayId": 1,
|
|
|
|
"shiftId": 1,
|
|
|
|
"shiftId": 1,
|
|
|
|
"isOpen": true,
|
|
|
|
"isOpen": true,
|
|
|
|
"timeFrom": null,
|
|
|
|
"timeFrom": "",
|
|
|
|
"timeTo": null,
|
|
|
|
"timeTo": "",
|
|
|
|
"timeFromstr": "",
|
|
|
|
"timeFromstr": "",
|
|
|
|
"timeTostr": ""
|
|
|
|
"timeTostr": ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -778,21 +811,41 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
model.addReschedule(request).then((response) {
|
|
|
|
await model.addReschedule(request).then((value) {
|
|
|
|
print(response);
|
|
|
|
if (model.postSechedule != null) {
|
|
|
|
|
|
|
|
DrAppToastMsg.showSuccesToast(TranslationBase.of(context).leaveCreated);
|
|
|
|
|
|
|
|
Navigator.pushNamedAndRemoveUntil(context, HOME, (r) => false);
|
|
|
|
|
|
|
|
Navigator.push(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
|
|
|
builder: (context) => AddRescheduleLeavScreen(),
|
|
|
|
|
|
|
|
// MyReferredPatient(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
updateRecheduleLeave(model) {
|
|
|
|
updateRecheduleLeave(model) {
|
|
|
|
final df = new DateFormat('yyyy-MM-ddThh:mm:ss');
|
|
|
|
final df = new DateFormat('yyyy-MM-ddThh:mm:ss');
|
|
|
|
|
|
|
|
final dateFormat = new DateFormat('yyyy-MM-dd');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (offTime == '1') {
|
|
|
|
|
|
|
|
fromDate = dateFormat.format(fromDate) + 'T' + fromTime + '00';
|
|
|
|
|
|
|
|
toDate = dateFormat.format(fromDate) + 'T' + toTime + '00';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
fromDate = df.format(fromDate);
|
|
|
|
|
|
|
|
toDate = df.format(toDate);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> request = {
|
|
|
|
Map<String, dynamic> request = {
|
|
|
|
"Requisition": {
|
|
|
|
"Requisition": {
|
|
|
|
"requisitionNo": 0,
|
|
|
|
"requisitionNo": 0,
|
|
|
|
"requisitionType": offTime,
|
|
|
|
"requisitionType": offTime,
|
|
|
|
"clinicId": this.profile['ClinicID'],
|
|
|
|
"clinicId": this.profile['ClinicID'],
|
|
|
|
"doctorId": this.profile['ClinicID'],
|
|
|
|
"doctorId": this.profile['DoctorID'],
|
|
|
|
"dateTimeFrom": df.format(fromDate),
|
|
|
|
"dateTimeFrom": fromDate,
|
|
|
|
"dateTimeTo": df.format(toDate),
|
|
|
|
"dateTimeTo": toDate,
|
|
|
|
"date": df.format(DateTime.now()),
|
|
|
|
"date": df.format(DateTime.now()),
|
|
|
|
"reasonId": reason == null ? model.allOffTime[0]['code'] : reason,
|
|
|
|
"reasonId": reason == null ? model.allOffTime[0]['code'] : reason,
|
|
|
|
"coveringDoctorId":
|
|
|
|
"coveringDoctorId":
|
|
|
|
@ -803,8 +856,8 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
"weekDayId": 1,
|
|
|
|
"weekDayId": 1,
|
|
|
|
"shiftId": 1,
|
|
|
|
"shiftId": 1,
|
|
|
|
"isOpen": true,
|
|
|
|
"isOpen": true,
|
|
|
|
"timeFrom": null,
|
|
|
|
"timeFrom": fromTime,
|
|
|
|
"timeTo": null,
|
|
|
|
"timeTo": toTime,
|
|
|
|
"timeFromstr": "",
|
|
|
|
"timeFromstr": "",
|
|
|
|
"timeTostr": ""
|
|
|
|
"timeTostr": ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -813,7 +866,17 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
model.updateReschedule(request).then((response) {
|
|
|
|
model.updateReschedule(request).then((response) {
|
|
|
|
print(response);
|
|
|
|
if (model.postSechedule != null) {
|
|
|
|
|
|
|
|
DrAppToastMsg.showSuccesToast(TranslationBase.of(context).leaveCreated);
|
|
|
|
|
|
|
|
Navigator.pushNamedAndRemoveUntil(context, HOME, (r) => false);
|
|
|
|
|
|
|
|
Navigator.push(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
|
|
|
builder: (context) => AddRescheduleLeavScreen(),
|
|
|
|
|
|
|
|
// MyReferredPatient(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|