fix bug sick leave

merge-requests/828/head
mosazaid 5 years ago
parent 09c8d9c09e
commit 6a96a9cb28

@ -22,6 +22,7 @@ import 'package:provider/provider.dart';
class AddSickLeavScreen extends StatelessWidget { class AddSickLeavScreen extends StatelessWidget {
PatiantInformtion patient; PatiantInformtion patient;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context); ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context);
@ -31,8 +32,10 @@ class AddSickLeavScreen extends StatelessWidget {
bool isInpatient = routeArgs['isInpatient']; bool isInpatient = routeArgs['isInpatient'];
return BaseView<SickLeaveViewModel>( return BaseView<SickLeaveViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
await model.getSickLeavePatient(patient.patientMRN ?? patient.patientId); await model
await model.getSickLeaveDoctor(patient.patientMRN ?? patient.patientId); .getSickLeavePatient(patient.patientMRN ?? patient.patientId);
await model
.getSickLeaveDoctor(patient.patientMRN ?? patient.patientId);
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
@ -79,17 +82,21 @@ class AddSickLeavScreen extends StatelessWidget {
}, },
child: Container( child: Container(
width: SizeConfig.screenWidth, width: SizeConfig.screenWidth,
margin: EdgeInsets.only(left: 20, right: 20, top: 10, bottom: 10), margin: EdgeInsets.only(
left: 20, right: 20, top: 10, bottom: 10),
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
decoration: decoration: BoxDecoration(
BoxDecoration(borderRadius: BorderRadius.circular(10), color: HexColor('#EAEAEA')), borderRadius: BorderRadius.circular(10),
color: HexColor('#EAEAEA')),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Container( Container(
child: Container( child: Container(
decoration: decoration: BoxDecoration(
BoxDecoration(color: Colors.grey, borderRadius: BorderRadius.circular(10)), color: Colors.grey,
borderRadius:
BorderRadius.circular(10)),
padding: EdgeInsets.all(3), padding: EdgeInsets.all(3),
child: IconButton( child: IconButton(
icon: Icon( icon: Icon(
@ -106,7 +113,9 @@ class AddSickLeavScreen extends StatelessWidget {
), ),
)), )),
Padding( Padding(
child: AppText(TranslationBase.of(context).noSickLeaveApplied, child: AppText(
TranslationBase.of(context)
.noSickLeaveApplied,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: 16, fontSize: 16,
@ -122,7 +131,8 @@ class AddSickLeavScreen extends StatelessWidget {
: SizedBox(), : SizedBox(),
model.getAllSIckLeavePatient.length > 0 model.getAllSIckLeavePatient.length > 0
? Column( ? Column(
children: model.getAllSIckLeavePatient.map<Widget>((SickLeavePatientModel item) { children: model.getAllSIckLeavePatient
.map<Widget>((SickLeavePatientModel item) {
return RoundedContainer( return RoundedContainer(
margin: EdgeInsets.all(10), margin: EdgeInsets.all(10),
child: Column( child: Column(
@ -141,7 +151,8 @@ class AddSickLeavScreen extends StatelessWidget {
// ))), // ))),
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 4, flex: 4,
@ -150,7 +161,8 @@ class AddSickLeavScreen extends StatelessWidget {
// MainAxisAlignment.start, // MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Container( Container(
padding: EdgeInsets.all(3), padding: EdgeInsets.all(3),
@ -168,7 +180,8 @@ class AddSickLeavScreen extends StatelessWidget {
// : TranslationBase // : TranslationBase
// .of(context) // .of(context)
// .all, // .all,
fontWeight: FontWeight.bold, fontWeight:
FontWeight.bold,
// color: item.status == 1 // color: item.status == 1
// ? Colors.yellow[800] // ? Colors.yellow[800]
// : item.status == 2 // : item.status == 2
@ -179,25 +192,48 @@ class AddSickLeavScreen extends StatelessWidget {
), ),
Row( Row(
children: [ children: [
AppText(TranslationBase.of(context).daysSickleave + ": "), AppText(TranslationBase
.of(context)
.daysSickleave +
": "),
AppText( AppText(
item.sickLeaveDays.toString() ?? item.noOfDays.toString(), (item.sickLeaveDays
fontWeight: FontWeight.bold, .toString() !=
null &&
item.sickLeaveDays
.toString() !=
"null")
? item.sickLeaveDays
.toString()
: item.noOfDays
.toString(),
fontWeight:
FontWeight.bold,
), ),
], ],
), ),
Row( Row(
children: [ children: [
AppText( AppText(
TranslationBase.of(context).startDate + ' ' ?? "", TranslationBase.of(
context)
.startDate +
' ' ??
"",
), ),
Flexible( Flexible(
child: AppText( child: AppText(
AppDateUtils.getDayMonthYearDateFormatted( AppDateUtils.getDayMonthYearDateFormatted(item
item.startDate.contains("/Date(") .startDate
? AppDateUtils.convertStringToDate(item.startDate) .contains(
: DateTime.parse(item.startDate)), "/Date(")
fontWeight: FontWeight.bold, ? AppDateUtils
.convertStringToDate(item
.startDate)
: DateTime.parse(
item.startDate)),
fontWeight:
FontWeight.bold,
), ),
) )
], ],
@ -205,18 +241,30 @@ class AddSickLeavScreen extends StatelessWidget {
Row( Row(
children: [ children: [
AppText( AppText(
TranslationBase.of(context).endDate + ' ' ?? "", TranslationBase.of(
context)
.endDate +
' ' ??
"",
), ),
Flexible( Flexible(
child: AppText( child: AppText(
AppDateUtils.getDayMonthYearDateFormatted( AppDateUtils.getDayMonthYearDateFormatted(item
item.startDate.contains("/Date(") .startDate
? AppDateUtils.convertStringToDate(item.endDate ?? "") .contains(
.add(Duration( "/Date(")
days: item.noOfDays ?? item.sickLeaveDays)) ? AppDateUtils.convertStringToDate(
: DateTime.parse(item.startDate ?? "") item.endDate ??
.add(Duration(days: item.noOfDays ?? ""))), "")
fontWeight: FontWeight.bold, .add(Duration(
days: item.noOfDays ??
item
.sickLeaveDays))
: DateTime.parse(
item.startDate ?? "")
.add(Duration(days: item.noOfDays ?? ""))),
fontWeight:
FontWeight.bold,
), ),
) )
], ],
@ -246,7 +294,8 @@ class AddSickLeavScreen extends StatelessWidget {
Image.asset('assets/images/no-data.png'), Image.asset('assets/images/no-data.png'),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: AppText(TranslationBase.of(context).noSickLeave), child: AppText(
TranslationBase.of(context).noSickLeave),
) )
], ],
), ),
@ -255,7 +304,8 @@ class AddSickLeavScreen extends StatelessWidget {
])))); ]))));
} }
openSickLeave(BuildContext context, isExtend, {GetAllSickLeaveResponse extendedData}) { openSickLeave(BuildContext context, isExtend,
{GetAllSickLeaveResponse extendedData}) {
// showModalBottomSheet( // showModalBottomSheet(
// context: context, // context: context,
// builder: (context) { // builder: (context) {
@ -265,9 +315,13 @@ class AddSickLeavScreen extends StatelessWidget {
context, context,
FadePage( FadePage(
page: SickLeaveScreen( page: SickLeaveScreen(
appointmentNo: appointmentNo: isExtend == true
isExtend == true ? extendedData.appointmentNo : patient.appointmentNo, //extendedData.appointmentNo, ? extendedData.appointmentNo
patientMRN: isExtend == true ? extendedData.patientMRN : patient.patientMRN, : patient.appointmentNo,
//extendedData.appointmentNo,
patientMRN: isExtend == true
? extendedData.patientMRN
: patient.patientMRN,
isExtended: isExtend, isExtended: isExtend,
extendedData: extendedData, extendedData: extendedData,
patient: patient))); patient: patient)));

Loading…
Cancel
Save