Merge branch 'sultan' into 'development'

Sultan

See merge request Cloud_Solution/doctor_app_flutter!385
merge-requests/386/merge
Mohammad Aljammal 5 years ago
commit 64f23187b6

@ -277,7 +277,7 @@ const Map<String, Map<String, String>> localizedValues = {
"doc-name": {"en": "Doctor Name", "ar": "اسم الطبيب"}, "doc-name": {"en": "Doctor Name", "ar": "اسم الطبيب"},
"clinicname": {"en": "Clinic Name", "ar": "اسم العيادة"}, "clinicname": {"en": "Clinic Name", "ar": "اسم العيادة"},
"sick-leave-date": {"en": "Sick leave date ", "ar": "تاريخ الاجازة."}, "sick-leave-date": {"en": "Sick leave date ", "ar": "تاريخ الاجازة."},
"sick-leave-days": {"en": "Sick leave days", "ar": "عدد ايام الاجازة."}, "sick-leave-days": {"en": "Leave Days: ", "ar": " :أيام الإجازة"},
'admissionDetail': {'en': 'ADMISSION DETAIL: ', 'ar': 'تفاصيل القبول: '}, 'admissionDetail': {'en': 'ADMISSION DETAIL: ', 'ar': 'تفاصيل القبول: '},
'dateTime': {'en': 'DATE / TIME:', 'ar': 'التاريخ / الوقت:'}, 'dateTime': {'en': 'DATE / TIME:', 'ar': 'التاريخ / الوقت:'},
'date': {'en': 'Date', 'ar': 'التاريخ'}, 'date': {'en': 'Date', 'ar': 'التاريخ'},
@ -302,8 +302,8 @@ const Map<String, Map<String, String>> localizedValues = {
"ar": "يرجى ادخال هذا الحقل" "ar": "يرجى ادخال هذا الحقل"
}, },
'no-sickleve-applied': { 'no-sickleve-applied': {
'en': "No sick leave applied", 'en': "No sick leave available, apply Now",
'ar': 'لم تطبق إجازة مرضية' 'ar': 'لا توجد إجازة مرضية متاحة ، تقدم بطلب الآن'
}, },
'applynow': {'en': "Apply Now", 'ar': 'قدم الآن'}, 'applynow': {'en': "Apply Now", 'ar': 'قدم الآن'},
'add-sickleave': {'en': "ADD SICK LEAVE", 'ar': 'أضف إجازة مرضية'}, 'add-sickleave': {'en': "ADD SICK LEAVE", 'ar': 'أضف إجازة مرضية'},
@ -802,4 +802,13 @@ const Map<String, Map<String, String>> localizedValues = {
"add-reschedule": {"en": "Add reschedule", "ar": "أضف إعادة الجدولة"}, "add-reschedule": {"en": "Add reschedule", "ar": "أضف إعادة الجدولة"},
"update-reschedule": {"en": "Update reschedule", "ar": "تحديث إعادة الجدولة"}, "update-reschedule": {"en": "Update reschedule", "ar": "تحديث إعادة الجدولة"},
"sick_leave": {"en": "Sick Leave", "ar": "أجازة مرضية"},
"addSickLeaveRequest": {
"en": "Add Sick Leave Request",
"ar": "إضافة طلب إجازة مرضية"
},
"extendSickLeaveRequest": {
"en": "Extend Sick Leave Request",
"ar": "تمديد طلب الإجازة المرضية"
},
}; };

@ -26,7 +26,8 @@ class AddRescheduleLeavScreen extends StatelessWidget {
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
appBarTitle: TranslationBase.of(context).rescheduleLeaves, appBarTitle: TranslationBase.of(context).rescheduleLeaves,
body: Column(children: [ body: SingleChildScrollView(
child: Column(children: [
Container( Container(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
margin: EdgeInsets.all(10), margin: EdgeInsets.all(10),
@ -68,10 +69,7 @@ class AddRescheduleLeavScreen extends StatelessWidget {
], ],
), ),
), ),
Container( Column(
height: MediaQuery.of(context).size.height * .65,
child: SingleChildScrollView(
child: Column(
children: model.getReschduleLeave children: model.getReschduleLeave
.map<Widget>((GetRescheduleLeavesResponse item) { .map<Widget>((GetRescheduleLeavesResponse item) {
return RoundedContainer( return RoundedContainer(
@ -100,9 +98,14 @@ class AddRescheduleLeavScreen extends StatelessWidget {
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Container( Container(
padding: EdgeInsets.all(3), padding: EdgeInsets.all(3),
margin: EdgeInsets.only(top: 10), margin:
EdgeInsets.only(top: 10),
child: AppText( child: AppText(
item.status == 1 item.status == 1
? TranslationBase.of( ? TranslationBase.of(
@ -124,6 +127,17 @@ class AddRescheduleLeavScreen extends StatelessWidget {
fontSize: 14, fontSize: 14,
), ),
), ),
Padding(
padding:
EdgeInsets.only(top: 10),
child: AppText(
DateUtils
.convertStringToDateFormat(
item.dateTimeTo,
'yyyy-MM-dd HH:mm'),
fontWeight: FontWeight.bold,
))
]),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
@ -141,12 +155,10 @@ class AddRescheduleLeavScreen extends StatelessWidget {
height: 5, height: 5,
), ),
Row(children: [ Row(children: [
AppText( AppText(TranslationBase.of(context)
TranslationBase.of(context)
.startDate), .startDate),
AppText( AppText(
DateUtils DateUtils.convertStringToDateFormat(
.convertStringToDateFormat(
item.dateTimeFrom, item.dateTimeFrom,
'yyyy-MM-dd HH:mm'), 'yyyy-MM-dd HH:mm'),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -164,8 +176,7 @@ class AddRescheduleLeavScreen extends StatelessWidget {
), ),
Row( Row(
children: [ children: [
AppText( AppText(TranslationBase.of(context)
TranslationBase.of(context)
.endDate), .endDate),
AppText( AppText(
DateUtils DateUtils
@ -183,16 +194,14 @@ class AddRescheduleLeavScreen extends StatelessWidget {
model.coveringDoctors.length > 0 model.coveringDoctors.length > 0
? Row(children: [ ? Row(children: [
AppText( AppText(
TranslationBase.of( TranslationBase.of(context)
context)
.coveringDoctor, .coveringDoctor,
), ),
AppText( AppText(
getDoctor( getDoctor(
model.coveringDoctors, model.coveringDoctors,
item.coveringDoctorId), item.coveringDoctorId),
fontWeight: fontWeight: FontWeight.bold,
FontWeight.bold,
) )
]) ])
: SizedBox(), : SizedBox(),
@ -203,8 +212,7 @@ class AddRescheduleLeavScreen extends StatelessWidget {
// ), // ),
Row( Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment MainAxisAlignment.spaceBetween,
.spaceBetween,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
@ -218,10 +226,8 @@ class AddRescheduleLeavScreen extends StatelessWidget {
'assets/images/edit.png'), 'assets/images/edit.png'),
// color: Colors.green, //Colors.black, // color: Colors.green, //Colors.black,
onPressed: () => { onPressed: () => {
openLeave( openLeave(context, true,
context, true, extendedData: item)
extendedData:
item)
}, },
) )
: SizedBox(), : SizedBox(),
@ -240,8 +246,8 @@ class AddRescheduleLeavScreen extends StatelessWidget {
), ),
); );
}).toList(), }).toList(),
))) )
])), ]))),
); );
} }

@ -128,121 +128,121 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
widthFactor: 0.9, widthFactor: 0.9,
child: ListView( child: ListView(
children: [ children: [
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( // border: Border.all(
width: 1.0, // width: 1.0,
color: HexColor("#CCCCCC"))), // 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,
children: <Widget>[ // children: <Widget>[
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: new IgnorePointer( // child: new IgnorePointer(
ignoring: true, // ignoring: true,
child: DropdownButton( // child: DropdownButton(
focusColor: // focusColor:
Colors.grey, // Colors.grey,
isExpanded: true, // isExpanded: true,
dropdownColor: // dropdownColor:
Colors.grey, // Colors.grey,
value: getClinicName( // value: getClinicName(
model) ?? // model) ??
"", // "",
iconSize: 0, // iconSize: 0,
elevation: 16, // elevation: 16,
selectedItemBuilder: // selectedItemBuilder:
(BuildContext // (BuildContext
context) { // context) {
return model // return model
.getClinicNameList() // .getClinicNameList()
.map((item) { // .map((item) {
return Row( // return Row(
mainAxisSize: // mainAxisSize:
MainAxisSize // MainAxisSize
.max, // .max,
children: < // children: <
Widget>[ // Widget>[
AppText( // AppText(
item, // item,
fontSize: // fontSize:
SizeConfig.textMultiplier * // SizeConfig.textMultiplier *
2.1, // 2.1,
color: Colors // color: Colors
.grey[ // .grey[
500], // 500],
), // ),
], // ],
); // );
}).toList(); // }).toList();
}, // },
onChanged: // onChanged:
(newValue) => // (newValue) =>
{}, // {},
items: model // items: model
.getClinicNameList() // .getClinicNameList()
.map((item) { // .map((item) {
return DropdownMenuItem( // return DropdownMenuItem(
value: item // value: item
.toString(), // .toString(),
child: Text( // child: Text(
item, // item,
textAlign: // textAlign:
TextAlign // TextAlign
.end, // .end,
), // ),
); // );
}).toList(), // }).toList(),
))), // ))),
), // ),
], // ],
) // )
], // ],
), // ),
)), // )),
Container( // Container(
margin: EdgeInsets.all(8), // margin: EdgeInsets.all(8),
decoration: BoxDecoration( // decoration: BoxDecoration(
borderRadius: // borderRadius:
BorderRadius.all(Radius.circular(6.0)), // BorderRadius.all(Radius.circular(6.0)),
border: Border.all( // border: Border.all(
width: 1.0, // width: 1.0,
color: HexColor("#CCCCCC"))), // color: HexColor("#CCCCCC"))),
padding: EdgeInsets.all(5), // padding: EdgeInsets.all(5),
child: Column( // child: Column(
crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ // children: [
new IgnorePointer( // new IgnorePointer(
ignoring: true, // ignoring: true,
child: AppTextFormField( // child: AppTextFormField(
readOnly: true, // readOnly: true,
hintText: profile != null // hintText: profile != null
? profile['DoctorName'] // ? profile['DoctorName']
: "", // : "",
borderColor: Colors.white, // borderColor: Colors.white,
onSaved: (value) {}, // onSaved: (value) {},
inputFormatter: ONLY_NUMBERS)) // inputFormatter: ONLY_NUMBERS))
], // ],
), // ),
), // ),
Container( Container(
margin: EdgeInsets.all(8), margin: EdgeInsets.all(8),
@ -842,6 +842,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
], ],
), ),
)), )),
SizedBox(height: SizeConfig.screenHeight * .3),
Container( Container(
margin: EdgeInsets.all( margin: EdgeInsets.all(
SizeConfig.widthMultiplier * 5), SizeConfig.widthMultiplier * 5),

@ -6,12 +6,16 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.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:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
@ -25,19 +29,94 @@ class AddSickLeavScreen extends StatelessWidget {
onModelReady: (model) => model.getSickLeave(patient.patientMRN), onModelReady: (model) => model.getSickLeave(patient.patientMRN),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false,
appBarTitle: TranslationBase.of(context).sickleave, appBarTitle: TranslationBase.of(context).sickleave,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column(children: [ child: Column(children: [
PatientPageHeaderWidget(patient), PatientProfileHeaderNewDesign(
patient, routeArgs['patientType'], routeArgs['arrivalType']),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).patient,
fontWeight: FontWeight.bold,
),
AppText(
TranslationBase.of(context).sickLeave,
fontSize: 24,
fontWeight: FontWeight.bold,
),
],
)),
Container(
width: SizeConfig.screenWidth,
margin: EdgeInsets.only(
left: 20, right: 20, top: 10, bottom: 10),
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: HexColor('#EAEAEA')),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
child: Container(
decoration: BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.circular(10)),
padding: EdgeInsets.all(3),
child: IconButton(
icon: Icon(
Icons.add,
size: 35,
color: Colors.white,
),
onPressed: () {
openSickLeave(
context,
false,
);
}),
)),
Padding(
child: AppText(
TranslationBase.of(context).noSickLeaveApplied,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 16,
textAlign: TextAlign.center,
color: HexColor('#7E7E7E')),
padding: EdgeInsets.all(10),
),
],
)),
],
),
model.getAllSIckLeave.length > 0 model.getAllSIckLeave.length > 0
? Column( ? Column(
children: model.getAllSIckLeave children: model.getAllSIckLeave
.map<Widget>((GetAllSickLeaveResponse item) { .map<Widget>((GetAllSickLeaveResponse item) {
return CardWithBgWidgetNew( return RoundedContainer(
widget: Column( child: Column(
children: [ children: [
Container( Container(
padding: EdgeInsets.only(left: 10, right: 10), decoration: BoxDecoration(
border: Border(
left: BorderSide(
color: item.status == 1
? Colors.yellow[800]
: item.status == 2
? Colors.green
: Colors.black,
width: 5.0,
))),
padding: EdgeInsets.all(10),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
@ -66,64 +145,59 @@ class AddSickLeavScreen extends StatelessWidget {
context) context)
.all, .all,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.white,
),
color: item.status == 1 color: item.status == 1
? Colors.yellow[800] ? Colors.yellow[800]
: item.status == 2 : item.status == 2
? Colors.green ? Colors.green
: Colors.black, : Colors.black,
), ),
),
Row( Row(
children: [ children: [
AppText(TranslationBase.of(
context)
.daysSickleave),
AppText( AppText(
TranslationBase.of(context) item.noOfDays.toString(),
.leaveStartDate +
' ',
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
Flexible(
child: Text(
item.startDate,
overflow:
TextOverflow.ellipsis,
))
], ],
), ),
Row(
children: [
AppText( AppText(
item.noOfDays.toString() +
' ' +
TranslationBase.of(context) TranslationBase.of(context)
.daysSickleave, .startDate +
' ',
),
Flexible(
child: AppText(
DateUtils
.convertStringToDateFormat(
item.startDate,
'dd-MMM-yyyy'),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
))
],
), ),
Row(children: [ Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
AppText( AppText(
item.remarks ?? "", item.remarks ?? "",
)
]),
],
),
SizedBox(
width: 20,
),
],
),
),
(item.status == 1 || item.status == 2)
? Expanded(
flex: 1,
child: IconButton(
icon: Icon(
Icons.open_in_full,
size: 25,
color: item.status == 1
? Colors.grey[400]
: Colors.black,
), ),
(item.status == 1 ||
item.status == 2)
? IconButton(
icon: Image.asset(
'assets/images/edit.png'),
// color: Colors.green, //Colors.black, // color: Colors.green, //Colors.black,
onPressed: () => { onPressed: () => {
if (item.status == 1) if (item.status ==
1)
{ {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
TranslationBase.of( TranslationBase.of(
@ -132,41 +206,73 @@ class AddSickLeavScreen extends StatelessWidget {
} }
else else
{ {
openSickLeave(context, true, openSickLeave(
extendedData: item) context,
true,
extendedData:
item)
} }
}, },
)) )
: SizedBox(), : SizedBox()
]),
], ],
)), ),
SizedBox( SizedBox(
height: 20, width: 20,
),
],
), ),
Divider(
height: 1,
), ),
], ],
)),
],
)); ));
}).toList(), }).toList(),
) )
: new Builder(builder: (context) { : new Builder(builder: (context) {
return Container( return Column(
height: MediaQuery.of(context).size.height * .7, crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).patient,
fontWeight: FontWeight.bold,
),
AppText(
TranslationBase.of(context).sickLeave,
fontSize: 24,
fontWeight: FontWeight.bold,
),
],
)),
Container(
width: SizeConfig.screenWidth,
margin: EdgeInsets.only(
left: 20, right: 20, top: 20, bottom: 20),
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: HexColor('#EAEAEA')),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Container( Container(
padding: EdgeInsets.all(40), child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( color: Colors.grey,
color: HexColor('#B8382C'), width: 4),
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(100))), BorderRadius.circular(10)),
padding: EdgeInsets.all(3),
child: IconButton( child: IconButton(
icon: Icon( icon: Icon(
Icons.add, Icons.add,
size: 35, size: 35,
color: Colors.white,
), ),
onPressed: () { onPressed: () {
openSickLeave( openSickLeave(
@ -174,33 +280,40 @@ class AddSickLeavScreen extends StatelessWidget {
false, false,
); );
}), }),
), )),
Padding( Padding(
child: AppText( child: AppText(
TranslationBase.of(context) TranslationBase.of(context)
.noSickLeaveApplied, .noSickLeaveApplied,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), fontFamily: 'Poppins',
fontSize: 16,
textAlign: TextAlign.center,
color: HexColor('#7E7E7E')),
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
), ),
AppText( ],
TranslationBase.of(context).applyNow, )),
fontWeight: FontWeight.bold, SizedBox(
color: HexColor('#B8382C'), height: SizeConfig.screenHeight * .6,
) )
], ],
)); );
}), }),
])))); ]))));
} }
openSickLeave(BuildContext context, isExtend, openSickLeave(BuildContext context, isExtend,
{GetAllSickLeaveResponse extendedData}) { {GetAllSickLeaveResponse extendedData}) {
showModalBottomSheet( // showModalBottomSheet(
context: context, // context: context,
builder: (context) { // builder: (context) {
return new Container( // return new Container(
child: SickLeaveScreen( // child:
Navigator.push(
context,
FadePage(
page: SickLeaveScreen(
appointmentNo: isExtend == true appointmentNo: isExtend == true
? extendedData.appointmentNo ? extendedData.appointmentNo
: patient.appointmentNo, //extendedData.appointmentNo, : patient.appointmentNo, //extendedData.appointmentNo,
@ -209,7 +322,6 @@ class AddSickLeavScreen extends StatelessWidget {
: patient.patientMRN, : patient.patientMRN,
isExtended: isExtend, isExtended: isExtend,
extendedData: extendedData, extendedData: extendedData,
patient: patient)); patient: patient)));
});
} }
} }

@ -6,12 +6,15 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.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:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
@ -23,22 +26,34 @@ class ShowSickLeaveScreen extends StatelessWidget {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
patient = routeArgs['patient']; patient = routeArgs['patient'];
return BaseView<SickLeaveViewModel>( return BaseView<SickLeaveViewModel>(
onModelReady: (model) => model.getSickLeave(patient.patientMRN ?? patient.patientId), onModelReady: (model) =>
model.getSickLeave(patient.patientMRN ?? patient.patientId),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
appBarTitle: TranslationBase.of(context).sickleave, appBarTitle: TranslationBase.of(context).sickleave,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
PatientPageHeaderWidget(patient), PatientProfileHeaderNewDesign(
patient, routeArgs['patientType'], routeArgs['arrivalType']),
Column( Column(
children: model.getAllSIckLeave children: model.getAllSIckLeave
.map<Widget>((GetAllSickLeaveResponse item) { .map<Widget>((GetAllSickLeaveResponse item) {
return CardWithBgWidgetNew( return RoundedContainer(
widget: Column( child: Column(
children: [ children: [
Container( Container(
padding: EdgeInsets.only(left: 10, right: 10), decoration: BoxDecoration(
border: Border(
left: BorderSide(
color: item.status == 1
? Colors.yellow[800]
: item.status == 2
? Colors.green
: Colors.black,
width: 5.0,
))),
padding: EdgeInsets.all(10),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
@ -66,40 +81,73 @@ class ShowSickLeaveScreen extends StatelessWidget {
context) context)
.all, .all,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.white,
),
color: item.status == 1 color: item.status == 1
? Colors.yellow[800] ? Colors.yellow[800]
: item.status == 2 : item.status == 2
? Colors.green ? Colors.green
: Colors.black, : Colors.black,
), ),
),
Row( Row(
children: [ children: [
AppText(TranslationBase.of(context)
.daysSickleave),
AppText( AppText(
TranslationBase.of(context) item.noOfDays.toString(),
.leaveStartDate +
' ',
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
Flexible(
child: Text(
item.startDate,
overflow: TextOverflow.ellipsis,
))
], ],
), ),
Row(
children: [
AppText( AppText(
item.noOfDays.toString() +
' ' +
TranslationBase.of(context) TranslationBase.of(context)
.daysSickleave, .startDate +
' ',
),
Flexible(
child: AppText(
DateUtils
.convertStringToDateFormat(
item.startDate,
'dd-MMM-yyyy'),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
))
],
), ),
Row(children: [ Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
AppText( AppText(
item.remarks ?? "", item.remarks ?? "",
),
(item.status == 1 ||
item.status == 2)
? IconButton(
icon: Image.asset(
'assets/images/edit.png'),
// color: Colors.green, //Colors.black,
onPressed: () => {
if (item.status == 1)
{
DrAppToastMsg.showErrorToast(
TranslationBase.of(
context)
.sickleaveonhold)
}
// else
// {
// openSickLeave(
// context,
// true,
// extendedData:
// item)
// }
},
) )
: SizedBox()
]), ]),
], ],
), ),
@ -109,15 +157,8 @@ class ShowSickLeaveScreen extends StatelessWidget {
], ],
), ),
), ),
], ],
)), )),
SizedBox(
height: 20,
),
Divider(
height: 1,
),
], ],
)); ));
}).toList(), }).toList(),
@ -128,6 +169,4 @@ class ShowSickLeaveScreen extends StatelessWidget {
), ),
); );
} }
} }

@ -89,7 +89,10 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
}, },
child: AppScaffold( child: AppScaffold(
baseViewModel: model2, baseViewModel: model2,
isShowAppBar: false, appBarTitle: widget.isExtended == true
? TranslationBase.of(context).extendSickLeave
: TranslationBase.of(context).addSickLeave,
isShowAppBar: true,
body: Center( body: Center(
child: Container( child: Container(
margin: EdgeInsets.only(top: 10), margin: EdgeInsets.only(top: 10),
@ -97,16 +100,16 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
widthFactor: 0.9, widthFactor: 0.9,
child: ListView( child: ListView(
children: [ children: [
Padding( // Padding(
child: AppText( // child: AppText(
widget.isExtended == true // widget.isExtended == true
? TranslationBase.of(context) // ? TranslationBase.of(context)
.extendSickLeave // .extendSickLeave
: TranslationBase.of(context) // : TranslationBase.of(context)
.addSickLeave, // .addSickLeave,
fontWeight: FontWeight.bold, // fontWeight: FontWeight.bold,
), // ),
padding: EdgeInsets.all(10)), // padding: EdgeInsets.all(10)),
Container( Container(
margin: EdgeInsets.only(left: 10, right: 10), margin: EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -114,12 +117,23 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
BorderRadius.all(Radius.circular(6.0)), BorderRadius.all(Radius.circular(6.0)),
border: Border.all( border: Border.all(
width: 1.0, width: 1.0,
color: HexColor("#CCCCCC"))), color: HexColor("#CCCCCC"),
),
color: Colors.white),
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Padding(
padding: EdgeInsets.only(
top: 5, left: 10, right: 10),
child: AppText(
TranslationBase.of(context)
.sickLeave +
' ' +
TranslationBase.of(context)
.days)),
AppTextFormField( AppTextFormField(
borderColor: Colors.white, borderColor: Colors.white,
onChanged: (value) { onChanged: (value) {
@ -132,8 +146,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
hintText: widget.extendedData != null hintText: widget.extendedData != null
? widget.extendedData.noOfDays ? widget.extendedData.noOfDays
.toString() .toString()
: TranslationBase.of(context) : '',
.sickLeaveDays,
// validator: (value) { // validator: (value) {
// return TextValidator().validateName(value); // return TextValidator().validateName(value);
// }, // },
@ -146,25 +159,28 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
Container( Container(
margin: EdgeInsets.only(left: 10, right: 10), margin: EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all( borderRadius:
Radius.circular(6.0)), BorderRadius.all(Radius.circular(6.0)),
border: Border.all( border: Border.all(
width: 1.0, width: 1.0, color: HexColor("#CCCCCC")),
color: HexColor("#CCCCCC"))), color: Colors.white,
),
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
// AppText( Padding(
// TranslationBase.of(context).sickLeaveDate, padding: EdgeInsets.only(
// fontSize: 10, top: 5, left: 10, right: 10),
// ), child: AppText(
TranslationBase.of(context)
.sickLeaveDate,
)),
AppTextFormField( AppTextFormField(
hintText: widget.extendedData != null hintText: widget.extendedData != null
? widget.extendedData.startDate ? widget.extendedData.startDate
: TranslationBase.of(context) : '',
.sickLeaveDate,
borderColor: Colors.white, borderColor: Colors.white,
prefix: IconButton( prefix: IconButton(
icon: Icon(Icons.calendar_today)), icon: Icon(Icons.calendar_today)),
@ -188,11 +204,12 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: 10, left: 10, right: 10), top: 10, left: 10, right: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all( borderRadius:
Radius.circular(6.0)), BorderRadius.all(Radius.circular(6.0)),
border: Border.all( border: Border.all(
width: 1.0, width: 1.0, color: HexColor("#CCCCCC")),
color: HexColor("#CCCCCC"))), color: Colors.white,
),
width: double.infinity, width: double.infinity,
child: Padding( child: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
@ -205,10 +222,12 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
// AppText( Padding(
// TranslationBase.of(context).clinicName, padding: EdgeInsets.only(top: 5),
// fontSize: 10, child: AppText(
// ), TranslationBase.of(context)
.clinicName,
)),
Row( Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -294,16 +313,20 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(6.0)), BorderRadius.all(Radius.circular(6.0)),
border: Border.all( border: Border.all(
width: 1.0, width: 1.0, color: HexColor("#CCCCCC")),
color: HexColor("#CCCCCC"))), color: Colors.white,
),
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// AppText( Padding(
// TranslationBase.of(context).doctorName, padding: EdgeInsets.only(
// fontSize: 10, top: 5, left: 10, right: 10),
// ), child: AppText(
TranslationBase.of(context)
.doctorName,
)),
new IgnorePointer( new IgnorePointer(
ignoring: true, ignoring: true,
child: AppTextFormField( child: AppTextFormField(
@ -327,16 +350,19 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(6.0)), BorderRadius.all(Radius.circular(6.0)),
border: Border.all( border: Border.all(
width: 1.0, width: 1.0, color: HexColor("#CCCCCC")),
color: HexColor("#CCCCCC"))), color: Colors.white,
),
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// AppText( Padding(
// TranslationBase.of(context).remarks, padding: EdgeInsets.only(
// fontSize: 10, top: 5, left: 10, right: 10),
// ), child: AppText(
TranslationBase.of(context).remarks,
)),
TextField( TextField(
maxLines: 3, maxLines: 3,
decoration: InputDecoration( decoration: InputDecoration(
@ -344,8 +370,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
border: InputBorder.none, border: InputBorder.none,
hintText: widget.extendedData != null hintText: widget.extendedData != null
? widget.extendedData.remarks ? widget.extendedData.remarks
: TranslationBase.of(context) : ''),
.remarks),
onChanged: (value) { onChanged: (value) {
addSickLeave.remarks = value; addSickLeave.remarks = value;
if (widget.extendedData != null) { if (widget.extendedData != null) {
@ -365,7 +390,9 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
AppButton( AppButton(
title: widget.isExtended == true title: widget.isExtended == true
? TranslationBase.of(context).extend ? TranslationBase.of(context).extend
: TranslationBase.of(context).add, : TranslationBase.of(context)
.addSickLeaverequest,
color: Colors.green,
onPressed: () async { onPressed: () async {
if (widget.isExtended) { if (widget.isExtended) {
await model2.extendSickLeave( await model2.extendSickLeave(

@ -523,7 +523,10 @@ class TranslationBase {
localizedValues['add-sickleave'][locale.languageCode]; localizedValues['add-sickleave'][locale.languageCode];
String get add => localizedValues['add'][locale.languageCode]; String get add => localizedValues['add'][locale.languageCode];
String get addSickLeaverequest =>
localizedValues['addSickLeaveRequest'][locale.languageCode];
String get extendSickLeaverequest =>
localizedValues['extendSickLeaveRequest'][locale.languageCode];
String get approved => localizedValues['approved'][locale.languageCode]; String get approved => localizedValues['approved'][locale.languageCode];
String get extended => localizedValues['extended'][locale.languageCode]; String get extended => localizedValues['extended'][locale.languageCode];
@ -1184,6 +1187,7 @@ class TranslationBase {
localizedValues['add-reschedule'][locale.languageCode]; localizedValues['add-reschedule'][locale.languageCode];
String get updateReschedule => String get updateReschedule =>
localizedValues['update-reschedule'][locale.languageCode]; localizedValues['update-reschedule'][locale.languageCode];
String get sickLeave => localizedValues['sick_leave'][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save