Merge branch 'sultan' into 'development'
Sultan See merge request Cloud_Solution/doctor_app_flutter!214merge-requests/213/merge
commit
e70406c954
Binary file not shown.
@ -0,0 +1,7 @@
|
||||
<svg id="enter" xmlns="http://www.w3.org/2000/svg" width="42" height="42" viewBox="0 0 42 42">
|
||||
<path id="Path_1146" data-name="Path 1146" d="M17.938,210.625H1.313a1.313,1.313,0,1,1,0-2.625H17.938a1.313,1.313,0,1,1,0,2.625Zm0,0" transform="translate(22.749 -190.938)"/>
|
||||
<path id="Path_1147" data-name="Path 1147" d="M123.984,143.736a1.313,1.313,0,0,1-.928-2.242l5.635-5.635-5.635-5.633a1.313,1.313,0,0,1,1.857-1.857l6.563,6.562a1.313,1.313,0,0,1,0,1.857l-6.562,6.562A1.31,1.31,0,0,1,123.984,143.736Zm0,0" transform="translate(-89.86 -117.486)"/>
|
||||
<path id="Path_1148" data-name="Path 1148" d="M312.668,42.076a3.5,3.5,0,0,0,3.5-3.5V7.076A3.522,3.522,0,0,0,313.8,3.753L303.284.248a3.537,3.537,0,0,0-4.616,3.329v31.5a3.524,3.524,0,0,0,2.368,3.321L311.553,41.9A3.662,3.662,0,0,0,312.668,42.076ZM302.168,2.7a1.03,1.03,0,0,1,.313.046l10.47,3.491a.9.9,0,0,1,.592.838v31.5a.922.922,0,0,1-1.188.83l-10.47-3.491a.905.905,0,0,1-.591-.838V3.576A.876.876,0,0,1,302.168,2.7Zm0,0" transform="translate(-298.668 -0.076)"/>
|
||||
<path id="Path_1149" data-name="Path 1149" d="M195.168,8.75a1.313,1.313,0,0,0,1.313-1.312V4.813A4.816,4.816,0,0,0,191.668,0H171.98a1.313,1.313,0,0,0,0,2.625h19.688a2.19,2.19,0,0,1,2.187,2.188V7.438A1.313,1.313,0,0,0,195.168,8.75Zm0,0" transform="translate(-168.48)"/>
|
||||
<path id="Path_1150" data-name="Path 1150" d="M171.98,350.082h7a4.816,4.816,0,0,0,4.812-4.813v-2.625a1.313,1.313,0,0,0-2.625,0v2.625a2.19,2.19,0,0,1-2.187,2.188h-7a1.313,1.313,0,0,0,0,2.625Zm0,0" transform="translate(-155.793 -313.332)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,52 @@
|
||||
class GetRescheduleLeavesResponse {
|
||||
int clinicId;
|
||||
var coveringDoctorId;
|
||||
String date;
|
||||
String dateTimeFrom;
|
||||
String dateTimeTo;
|
||||
int doctorId;
|
||||
int reasonId;
|
||||
int requisitionNo;
|
||||
int requisitionType;
|
||||
int status;
|
||||
|
||||
GetRescheduleLeavesResponse(
|
||||
{this.clinicId,
|
||||
this.coveringDoctorId,
|
||||
this.date,
|
||||
this.dateTimeFrom,
|
||||
this.dateTimeTo,
|
||||
this.doctorId,
|
||||
this.reasonId,
|
||||
this.requisitionNo,
|
||||
this.requisitionType,
|
||||
this.status});
|
||||
|
||||
GetRescheduleLeavesResponse.fromJson(Map<String, dynamic> json) {
|
||||
clinicId = json['clinicId'];
|
||||
coveringDoctorId = json['coveringDoctorId'];
|
||||
date = json['date'];
|
||||
dateTimeFrom = json['dateTimeFrom'];
|
||||
dateTimeTo = json['dateTimeTo'];
|
||||
doctorId = json['doctorId'];
|
||||
reasonId = json['reasonId'];
|
||||
requisitionNo = json['requisitionNo'];
|
||||
requisitionType = json['requisitionType'];
|
||||
status = json['status'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['clinicId'] = this.clinicId;
|
||||
data['coveringDoctorId'] = this.coveringDoctorId;
|
||||
data['date'] = this.date;
|
||||
data['dateTimeFrom'] = this.dateTimeFrom;
|
||||
data['dateTimeTo'] = this.dateTimeTo;
|
||||
data['doctorId'] = this.doctorId;
|
||||
data['reasonId'] = this.reasonId;
|
||||
data['requisitionNo'] = this.requisitionNo;
|
||||
data['requisitionType'] = this.requisitionType;
|
||||
data['status'] = this.status;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,292 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/leave_rechdule_response.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/icons_app/doctor_app_icons.dart';
|
||||
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/screens/reschedule-leaves/reschedule_leave.dart';
|
||||
import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class AddRescheduleLeavScreen extends StatelessWidget {
|
||||
ProjectViewModel projectsProvider;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
projectsProvider = Provider.of(context);
|
||||
return BaseView<SickLeaveViewModel>(
|
||||
onModelReady: (model) =>
|
||||
{model.getRescheduleLeave(), model.getCoveringDoctors()},
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
appBarTitle: TranslationBase.of(context).rescheduleLeaves,
|
||||
body: model.getReschduleLeave.length > 0
|
||||
? SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.only(left: 15, right: 15, top: 20),
|
||||
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).requestLeave,
|
||||
borderColor: Colors.white,
|
||||
prefix: IconButton(
|
||||
icon: Icon(
|
||||
Icons.add_circle,
|
||||
color: Colors.red,
|
||||
)),
|
||||
textInputType: TextInputType.text,
|
||||
onTap: () {
|
||||
openLeave(
|
||||
context,
|
||||
false,
|
||||
);
|
||||
},
|
||||
inputFormatter: ONLY_LETTERS,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: model.getReschduleLeave.map<Widget>(
|
||||
(GetRescheduleLeavesResponse item) {
|
||||
return CardWithBgWidgetNew(
|
||||
widget: Column(
|
||||
children: [
|
||||
Container(
|
||||
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>[
|
||||
Container(
|
||||
padding:
|
||||
EdgeInsets.all(3),
|
||||
child: AppText(
|
||||
item.status == 1
|
||||
? TranslationBase
|
||||
.of(context)
|
||||
.approved
|
||||
: item.status == 2
|
||||
? TranslationBase.of(
|
||||
context)
|
||||
.pending
|
||||
: TranslationBase.of(
|
||||
context)
|
||||
.rejected,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
color: item.status == 1
|
||||
? Colors.green
|
||||
: item.status == 2
|
||||
? Colors
|
||||
.yellow[800]
|
||||
: Colors.red[800],
|
||||
),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Container(
|
||||
child: AppText(
|
||||
TranslationBase.of(
|
||||
context)
|
||||
.holiday +
|
||||
' ',
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
)),
|
||||
Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
item.dateTimeFrom +
|
||||
' ' +
|
||||
TranslationBase.of(
|
||||
context)
|
||||
.to +
|
||||
' ' +
|
||||
item.dateTimeTo,
|
||||
// overflow:
|
||||
// TextOverflow.ellipsis,
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
AppText(
|
||||
TranslationBase.of(
|
||||
context)
|
||||
.coveringDoctor,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
),
|
||||
model.coveringDoctors
|
||||
.length >
|
||||
0
|
||||
? Row(children: [
|
||||
AppText(getDoctor(
|
||||
model
|
||||
.coveringDoctors,
|
||||
item.doctorId))
|
||||
])
|
||||
: SizedBox(),
|
||||
AppText(
|
||||
TranslationBase.of(
|
||||
context)
|
||||
.reasons,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
),
|
||||
model.allReasons.length > 0
|
||||
? Row(children: [
|
||||
AppText(getReasons(
|
||||
model
|
||||
.allReasons,
|
||||
item.reasonId))
|
||||
])
|
||||
: SizedBox(),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
(item.status == 1)
|
||||
? Expanded(
|
||||
flex: 1,
|
||||
child: IconButton(
|
||||
icon: Icon(
|
||||
Icons.edit_outlined,
|
||||
size: 30,
|
||||
),
|
||||
// color: Colors.green, //Colors.black,
|
||||
onPressed: () => {
|
||||
openLeave(context, true,
|
||||
extendedData: item)
|
||||
},
|
||||
))
|
||||
: SizedBox(),
|
||||
],
|
||||
)),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Divider(
|
||||
height: 1,
|
||||
),
|
||||
],
|
||||
));
|
||||
}).toList(),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
: new Builder(builder: (context) {
|
||||
return Center(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(40),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: HexColor('#B8382C'), width: 4),
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(100))),
|
||||
child: IconButton(
|
||||
icon: Icon(
|
||||
Icons.add,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () {
|
||||
openLeave(
|
||||
context,
|
||||
false,
|
||||
);
|
||||
}),
|
||||
),
|
||||
Padding(
|
||||
child: AppText(
|
||||
TranslationBase.of(context).noReScheduleLeave,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
padding: EdgeInsets.all(10),
|
||||
),
|
||||
AppText(
|
||||
TranslationBase.of(context).applyNow,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: HexColor('#B8382C'),
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
}),
|
||||
));
|
||||
}
|
||||
|
||||
openLeave(BuildContext context, isExtend, {extendedData}) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return new Container(
|
||||
child: RescheduleLeaveScreen(
|
||||
isExtend,
|
||||
extendedData,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
getDoctor(model, doctorId) {
|
||||
var obj;
|
||||
obj = model.where((i) => i['doctorID'] == doctorId).toList();
|
||||
print(obj);
|
||||
|
||||
return obj.length > 0 ? obj[0]['doctorName'] : "";
|
||||
}
|
||||
|
||||
getReasons(model, reasonID) {
|
||||
var obj;
|
||||
obj = model.where((i) => i['id'] == reasonID).toList();
|
||||
print(obj);
|
||||
|
||||
return obj.length > 0
|
||||
? projectsProvider.isArabic == true
|
||||
? obj[0]['nameAr']
|
||||
: obj[0]['nameEn']
|
||||
: "";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,819 @@
|
||||
import 'package:date_time_picker/date_time_picker.dart';
|
||||
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';
|
||||
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/text_validator.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/app_buttons_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
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();
|
||||
|
||||
class RescheduleLeaveScreen extends StatefulWidget {
|
||||
final isUpdate;
|
||||
final updateData;
|
||||
RescheduleLeaveScreen(this.isUpdate, this.updateData);
|
||||
@override
|
||||
_RescheduleLeaveScreen createState() => _RescheduleLeaveScreen();
|
||||
}
|
||||
|
||||
class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
||||
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
||||
TextEditingController _toDateController = new TextEditingController();
|
||||
TextEditingController _toDateController2 = new TextEditingController();
|
||||
ProjectViewModel projectsProvider;
|
||||
String _selectedClinic;
|
||||
Map profile = {};
|
||||
var offTime = '2';
|
||||
var date;
|
||||
var doctorID;
|
||||
var reason;
|
||||
var fromDate;
|
||||
var toDate;
|
||||
var clinicID;
|
||||
TextEditingController _controller4;
|
||||
void _presentDatePicker(id) {
|
||||
showDatePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime.now(),
|
||||
lastDate: DateTime(2050),
|
||||
).then((pickedDate) {
|
||||
if (pickedDate == null) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
final df = new DateFormat('yyyy-MM-dd');
|
||||
if (id == 'fromDate') {
|
||||
fromDate = pickedDate; //df.format();
|
||||
_toDateController.text = df.format(pickedDate);
|
||||
} else {
|
||||
toDate = pickedDate; //
|
||||
_toDateController2.text = df.format(pickedDate);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@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(),
|
||||
model2.getReasons(18),
|
||||
model2.getCoveringDoctors()
|
||||
},
|
||||
builder: (_, model2, w) => AppScaffold(
|
||||
baseViewModel: model2,
|
||||
isShowAppBar: false,
|
||||
body: Center(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
child: FractionallySizedBox(
|
||||
widthFactor: 0.9,
|
||||
child: ListView(
|
||||
children: [
|
||||
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>[
|
||||
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()
|
||||
.map((item) {
|
||||
return DropdownMenuItem(
|
||||
value:
|
||||
item.toString(),
|
||||
child: Text(
|
||||
item,
|
||||
textAlign:
|
||||
TextAlign.end,
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
))),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
|
||||
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 IgnorePointer(
|
||||
ignoring: true,
|
||||
child: AppTextFormField(
|
||||
readOnly: true,
|
||||
hintText: profile != null
|
||||
? profile['DoctorName']
|
||||
: "",
|
||||
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.allOffTime.length > 0
|
||||
? Expanded(
|
||||
// add Expanded to have your dropdown button fill remaining space
|
||||
child:
|
||||
DropdownButtonHideUnderline(
|
||||
child: DropdownButton(
|
||||
focusColor: Colors.grey,
|
||||
isExpanded: true,
|
||||
value: offTime == null
|
||||
? model2.allOffTime[0]
|
||||
['code']
|
||||
: offTime,
|
||||
iconSize: 40,
|
||||
elevation: 16,
|
||||
selectedItemBuilder:
|
||||
(BuildContext context) {
|
||||
return model2.allOffTime
|
||||
.map((item) {
|
||||
return Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
AppText(
|
||||
item[
|
||||
'description'],
|
||||
fontSize: SizeConfig
|
||||
.textMultiplier *
|
||||
2.1,
|
||||
color:
|
||||
Colors.grey,
|
||||
),
|
||||
],
|
||||
);
|
||||
}).toList();
|
||||
},
|
||||
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)}
|
||||
},
|
||||
items: model2.allOffTime
|
||||
.map((item) {
|
||||
return DropdownMenuItem<
|
||||
String>(
|
||||
value: item['code']
|
||||
.toString(),
|
||||
child: Text(
|
||||
item['description'],
|
||||
textAlign:
|
||||
TextAlign.end,
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
)),
|
||||
)
|
||||
: SizedBox(),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
offTime == '1'
|
||||
? Column(
|
||||
children: [
|
||||
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(
|
||||
'fromDate');
|
||||
},
|
||||
inputFormatter: ONLY_DATE,
|
||||
onChanged: (value) {
|
||||
fromDate = 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),
|
||||
|
||||
DateTimePicker(
|
||||
type:
|
||||
DateTimePickerType.time,
|
||||
controller: _controller4,
|
||||
//initialValue: _initialValue,
|
||||
// icon: Icon(Icons.access_time),
|
||||
|
||||
//use24HourFormat: false,
|
||||
//locale: Locale('en', 'US'),
|
||||
onChanged: (val) => () {
|
||||
print(val);
|
||||
},
|
||||
validator: (val) {
|
||||
print(val);
|
||||
// setState(
|
||||
// () => _valueToValidate4 = val);
|
||||
return null;
|
||||
},
|
||||
onSaved: (val) => {},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
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: [
|
||||
DateTimePicker(
|
||||
type:
|
||||
DateTimePickerType.time,
|
||||
controller: _controller4,
|
||||
//initialValue: _initialValue,
|
||||
// icon: Icon(Icons.access_time),
|
||||
|
||||
//use24HourFormat: false,
|
||||
//locale: Locale('en', 'US'),
|
||||
onChanged: (val) => () {
|
||||
print(val);
|
||||
},
|
||||
validator: (val) {
|
||||
print(val);
|
||||
// setState(
|
||||
// () => _valueToValidate4 = val);
|
||||
return null;
|
||||
},
|
||||
onSaved: (val) =>
|
||||
{print(val)},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
: Column(
|
||||
children: [
|
||||
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(
|
||||
'fromDate');
|
||||
},
|
||||
inputFormatter: ONLY_DATE,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
toDate = value;
|
||||
});
|
||||
}),
|
||||
],
|
||||
)),
|
||||
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:
|
||||
_toDateController2,
|
||||
onTap: () {
|
||||
_presentDatePicker(
|
||||
'toDate');
|
||||
},
|
||||
inputFormatter: ONLY_DATE,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
toDate = value;
|
||||
});
|
||||
}),
|
||||
],
|
||||
))
|
||||
],
|
||||
),
|
||||
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: reason == null
|
||||
? model2.allReasons[0]
|
||||
['id']
|
||||
.toString()
|
||||
: reason,
|
||||
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) => {
|
||||
setState(() {
|
||||
reason = 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: doctorID == null
|
||||
? model2
|
||||
.coveringDoctors[0]
|
||||
['doctorID']
|
||||
.toString()
|
||||
: doctorID,
|
||||
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) => {
|
||||
setState(() {
|
||||
doctorID = 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),
|
||||
child: Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
children: <Widget>[
|
||||
AppButton(
|
||||
title: widget.isUpdate == true
|
||||
? TranslationBase.of(context).update
|
||||
: TranslationBase.of(context).add,
|
||||
onPressed: () {
|
||||
if (widget.isUpdate == true) {
|
||||
updateRecheduleLeave(model2);
|
||||
} else {
|
||||
addRecheduleLeave(model2);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Column(
|
||||
// children: [
|
||||
// Texts(TranslationBase.of(context)
|
||||
// .previousSickLeaveIssue +
|
||||
// ' ')
|
||||
// ],
|
||||
// )
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)));
|
||||
}
|
||||
|
||||
getProfile() async {
|
||||
Map p = await sharedPref.getObj(DOCTOR_PROFILE);
|
||||
setState(() {
|
||||
if (widget.updateData != null) {
|
||||
this.profile = p;
|
||||
this.clinicID = widget.updateData.clinicId;
|
||||
|
||||
_toDateController.text = widget.updateData.dateTimeFrom;
|
||||
_toDateController2.text = widget.updateData.dateTimeTo;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getClinicName(model) {
|
||||
var clinicID = this.profile['ClinicID'] ?? 1;
|
||||
var clinicInfo =
|
||||
model.clinicsList.where((i) => i['ClinicID'] == clinicID).toList();
|
||||
return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : "";
|
||||
}
|
||||
|
||||
addRecheduleLeave(model) {
|
||||
final df = new DateFormat('yyyy-MM-ddThh:mm:ss');
|
||||
Map<String, dynamic> request = {
|
||||
"Requisition": {
|
||||
"requisitionNo": 0,
|
||||
"requisitionType": offTime,
|
||||
"clinicId": this.profile['ClinicID'],
|
||||
"doctorId": this.profile['ClinicID'],
|
||||
"dateTimeFrom": df.format(fromDate),
|
||||
"dateTimeTo": df.format(toDate),
|
||||
"date": df.format(DateTime.now()),
|
||||
"reasonId": reason == null ? model.allOffTime[0]['code'] : reason,
|
||||
"coveringDoctorId":
|
||||
doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID,
|
||||
"status": 2,
|
||||
"schedule": [
|
||||
{
|
||||
"weekDayId": 1,
|
||||
"shiftId": 1,
|
||||
"isOpen": true,
|
||||
"timeFrom": null,
|
||||
"timeTo": null,
|
||||
"timeFromstr": "",
|
||||
"timeTostr": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
model.addReschedule(request).then((response) {
|
||||
print(response);
|
||||
});
|
||||
}
|
||||
|
||||
updateRecheduleLeave(model) {
|
||||
final df = new DateFormat('yyyy-MM-ddThh:mm:ss');
|
||||
Map<String, dynamic> request = {
|
||||
"Requisition": {
|
||||
"requisitionNo": 0,
|
||||
"requisitionType": offTime,
|
||||
"clinicId": this.profile['ClinicID'],
|
||||
"doctorId": this.profile['ClinicID'],
|
||||
"dateTimeFrom": df.format(fromDate),
|
||||
"dateTimeTo": df.format(toDate),
|
||||
"date": df.format(DateTime.now()),
|
||||
"reasonId": reason == null ? model.allOffTime[0]['code'] : reason,
|
||||
"coveringDoctorId":
|
||||
doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID,
|
||||
"status": 2,
|
||||
"schedule": [
|
||||
{
|
||||
"weekDayId": 1,
|
||||
"shiftId": 1,
|
||||
"isOpen": true,
|
||||
"timeFrom": null,
|
||||
"timeTo": null,
|
||||
"timeFromstr": "",
|
||||
"timeTostr": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
model.updateReschedule(request).then((response) {
|
||||
print(response);
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue