doctor leave
parent
94cdce2dea
commit
49e9ecfa4a
@ -0,0 +1,193 @@
|
|||||||
|
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/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_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';
|
||||||
|
|
||||||
|
class AddRescheduleLeavScreen extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<SickLeaveViewModel>(
|
||||||
|
onModelReady: (model) => model.getRescheduleLeave(),
|
||||||
|
builder: (_, model, w) => AppScaffold(
|
||||||
|
baseViewModel: model,
|
||||||
|
appBarTitle: TranslationBase.of(context).rescheduleLeaves,
|
||||||
|
body: model.getAllSIckLeave.length > 0
|
||||||
|
? SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: model.getAllSIckLeave
|
||||||
|
.map<Widget>((GetAllSickLeaveResponse 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(
|
||||||
|
// mainAxisAlignment:
|
||||||
|
// MainAxisAlignment.start,
|
||||||
|
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)
|
||||||
|
.extended
|
||||||
|
: TranslationBase
|
||||||
|
.of(context)
|
||||||
|
.pending,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
color: item.status == 1
|
||||||
|
? Colors.green
|
||||||
|
: Colors.yellow[800],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
TranslationBase.of(
|
||||||
|
context)
|
||||||
|
.leaveStartDate +
|
||||||
|
' ',
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.bold,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: Text(
|
||||||
|
item.startDate,
|
||||||
|
overflow:
|
||||||
|
TextOverflow.ellipsis,
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
AppText(
|
||||||
|
item.noOfDays.toString() +
|
||||||
|
' ' +
|
||||||
|
TranslationBase.of(
|
||||||
|
context)
|
||||||
|
.daysSickleave,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
Row(children: [
|
||||||
|
AppText(
|
||||||
|
item.remarks,
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 20,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(item.status == 1 || item.status == 2)
|
||||||
|
? Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.open_in_full,
|
||||||
|
size: 40,
|
||||||
|
),
|
||||||
|
// color: Colors.green, //Colors.black,
|
||||||
|
onPressed: () => {
|
||||||
|
// openSickLeave(context, true,
|
||||||
|
// extendedData: item)
|
||||||
|
},
|
||||||
|
))
|
||||||
|
: SizedBox(),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
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,
|
||||||
|
{GetAllSickLeaveResponse extendedData}) {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return new Container(
|
||||||
|
child: RescheduleLeaveScreen(
|
||||||
|
// appointmentNo: extendedData.appointmentNo,
|
||||||
|
// patientMRN: extendedData.patientMRN,
|
||||||
|
// isExtended: isExtend,
|
||||||
|
// extendedData: extendedData,
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,315 @@
|
|||||||
|
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/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';
|
||||||
|
|
||||||
|
Helpers helpers = Helpers();
|
||||||
|
|
||||||
|
class RescheduleLeaveScreen extends StatefulWidget {
|
||||||
|
RescheduleLeaveScreen();
|
||||||
|
@override
|
||||||
|
_RescheduleLeaveScreen createState() => _RescheduleLeaveScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
|
||||||
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
||||||
|
TextEditingController _toDateController = new TextEditingController();
|
||||||
|
String _selectedClinic;
|
||||||
|
Map profile = {};
|
||||||
|
AddSickLeaveRequest addSickLeave = AddSickLeaveRequest();
|
||||||
|
void _presentDatePicker(id) {
|
||||||
|
showDatePicker(
|
||||||
|
context: context,
|
||||||
|
initialDate: DateTime.now(),
|
||||||
|
firstDate: DateTime(2019),
|
||||||
|
lastDate: DateTime.now(),
|
||||||
|
).then((pickedDate) {
|
||||||
|
if (pickedDate == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
// var selectedDate = DateFormat.yMd().format(pickedDate);
|
||||||
|
final df = new DateFormat('yyyy-MM-dd');
|
||||||
|
addSickLeave.startDate = df.format(pickedDate);
|
||||||
|
|
||||||
|
_toDateController.text = addSickLeave.startDate;
|
||||||
|
//addSickLeave.startDate = selectedDate;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
getProfile();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<PatientViewModel>(
|
||||||
|
onModelReady: (model) => model.getClinicsList(),
|
||||||
|
builder: (_, model, w) => BaseView<SickLeaveViewModel>(
|
||||||
|
onModelReady: (model2) => model2.getOffTime(),
|
||||||
|
builder: (_, model2, w) => AppScaffold(
|
||||||
|
baseViewModel: model,
|
||||||
|
isShowAppBar: false,
|
||||||
|
body: Center(
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.only(top: 10),
|
||||||
|
child: FractionallySizedBox(
|
||||||
|
widthFactor: 0.9,
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
top: 10, left: 10, right: 10),
|
||||||
|
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: [
|
||||||
|
// AppText(
|
||||||
|
// TranslationBase.of(context).clinicName,
|
||||||
|
// fontSize: 10,
|
||||||
|
// ),
|
||||||
|
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(),
|
||||||
|
))),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(left: 10, right: 10),
|
||||||
|
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['DoctorName'],
|
||||||
|
borderColor: Colors.white,
|
||||||
|
onSaved: (value) {},
|
||||||
|
inputFormatter: ONLY_NUMBERS))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
top: 10, left: 10, right: 10),
|
||||||
|
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(
|
||||||
|
SizeConfig.widthMultiplier * 5),
|
||||||
|
child: Wrap(
|
||||||
|
alignment: WrapAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
AppButton(
|
||||||
|
title: TranslationBase.of(context).add,
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Column(
|
||||||
|
// children: [
|
||||||
|
// Texts(TranslationBase.of(context)
|
||||||
|
// .previousSickLeaveIssue +
|
||||||
|
// ' ')
|
||||||
|
// ],
|
||||||
|
// )
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
getProfile() async {
|
||||||
|
Map p = await sharedPref.getObj(DOCTOR_PROFILE);
|
||||||
|
setState(() {
|
||||||
|
this.profile = p;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getClinicName(model) {
|
||||||
|
var clinicInfo = model.clinicsList
|
||||||
|
.where((i) => i['ClinicID'] == this.profile['ClinicID'])
|
||||||
|
.toList();
|
||||||
|
return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue