|
|
|
|
@ -11,9 +11,11 @@ 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/util/date-utils.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.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/errors/error_message.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';
|
|
|
|
|
@ -56,250 +58,184 @@ class AddSickLeavScreen extends StatelessWidget {
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(height: SizeConfig.isHeightVeryShort?30:SizeConfig.isHeightShort?35: 10,),
|
|
|
|
|
if (!projectsProvider.isArabic)
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).patient,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).sickLeave,
|
|
|
|
|
fontSize: 24,
|
|
|
|
|
TranslationBase.of(context).patient,
|
|
|
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge? 3: 4),
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
letterSpacing:-0.72,
|
|
|
|
|
color: Color(0xFF2E303A),
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
AppText(TranslationBase.of(context).sickLeave,
|
|
|
|
|
fontSize:SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge? 6: 6),
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
letterSpacing:-1.44,
|
|
|
|
|
color: Color(0xFF2E303A),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
await locator<AnalyticsService>().logEvent(
|
|
|
|
|
eventCategory: "Add Sick Leave Screen"
|
|
|
|
|
"Leave Screen",
|
|
|
|
|
eventAction: "apply For Sick Leave",
|
|
|
|
|
);
|
|
|
|
|
openSickLeave(
|
|
|
|
|
context,
|
|
|
|
|
false,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: 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),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
AddNewOrder(label: TranslationBase.of(context)
|
|
|
|
|
.noSickLeaveApplied, onTap: () async {
|
|
|
|
|
await locator<AnalyticsService>().logEvent(
|
|
|
|
|
eventCategory: "Add Sick Leave Screen"
|
|
|
|
|
"Leave Screen",
|
|
|
|
|
eventAction: "apply For Sick Leave",
|
|
|
|
|
);
|
|
|
|
|
openSickLeave(
|
|
|
|
|
context,
|
|
|
|
|
false,
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
model.getAllSIckLeavePatient.length > 0
|
|
|
|
|
? Column(
|
|
|
|
|
children: model.getAllSIckLeavePatient
|
|
|
|
|
.map<Widget>((SickLeavePatientModel item) {
|
|
|
|
|
return RoundedContainer(
|
|
|
|
|
margin: EdgeInsets.all(10),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
// border: Border(
|
|
|
|
|
// left: BorderSide(
|
|
|
|
|
// // color: item.status == 1
|
|
|
|
|
// // ? Colors.yellow[800]
|
|
|
|
|
// // : item.status == 2
|
|
|
|
|
// // ? Colors.green
|
|
|
|
|
// // : Colors.black,
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
// width: 5.0,
|
|
|
|
|
// ))),
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
|
? ListView.builder(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: model.getAllSIckLeavePatient.length,
|
|
|
|
|
itemBuilder: (BuildContext ctxt, int index) {
|
|
|
|
|
var item = model.getAllSIckLeavePatient[index];
|
|
|
|
|
return Container(
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 4,
|
|
|
|
|
child: Wrap(
|
|
|
|
|
// 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.doctorName ?? "",
|
|
|
|
|
// item.status == 1
|
|
|
|
|
// ? TranslationBase.of(
|
|
|
|
|
// context)
|
|
|
|
|
// .hold
|
|
|
|
|
// : item.status == 2
|
|
|
|
|
// ? TranslationBase
|
|
|
|
|
// .of(
|
|
|
|
|
// context)
|
|
|
|
|
// .active
|
|
|
|
|
// : TranslationBase
|
|
|
|
|
// .of(context)
|
|
|
|
|
// .all,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.bold,
|
|
|
|
|
// color: item.status == 1
|
|
|
|
|
// ? Colors.yellow[800]
|
|
|
|
|
// : item.status == 2
|
|
|
|
|
// ? Colors.green
|
|
|
|
|
// : Colors.black,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
AppText(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.daysSickleave +
|
|
|
|
|
": "),
|
|
|
|
|
AppText(
|
|
|
|
|
(item.sickLeaveDays
|
|
|
|
|
.toString() !=
|
|
|
|
|
null &&
|
|
|
|
|
item.sickLeaveDays
|
|
|
|
|
.toString() !=
|
|
|
|
|
"null")
|
|
|
|
|
? item.sickLeaveDays
|
|
|
|
|
.toString()
|
|
|
|
|
: item.noOfDays
|
|
|
|
|
.toString(),
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.startDate +
|
|
|
|
|
' ' ??
|
|
|
|
|
"",
|
|
|
|
|
),
|
|
|
|
|
Flexible(
|
|
|
|
|
child: AppText(
|
|
|
|
|
AppDateUtils.getDayMonthYearDateFormatted(item
|
|
|
|
|
.startDate
|
|
|
|
|
.contains(
|
|
|
|
|
"/Date(")
|
|
|
|
|
? AppDateUtils
|
|
|
|
|
.convertStringToDate(item
|
|
|
|
|
.startDate)
|
|
|
|
|
: DateTime.parse(
|
|
|
|
|
item.startDate)),
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.all(3),
|
|
|
|
|
child: AppText(
|
|
|
|
|
item = model.getAllSIckLeavePatient[index].doctorName ?? "",
|
|
|
|
|
// item.status == 1
|
|
|
|
|
// ? TranslationBase.of(
|
|
|
|
|
// context)
|
|
|
|
|
// .hold
|
|
|
|
|
// : item.status == 2
|
|
|
|
|
// ? TranslationBase
|
|
|
|
|
// .of(
|
|
|
|
|
// context)
|
|
|
|
|
// .active
|
|
|
|
|
// : TranslationBase
|
|
|
|
|
// .of(context)
|
|
|
|
|
// .all,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.bold,
|
|
|
|
|
// color: item.status == 1
|
|
|
|
|
// ? Colors.yellow[800]
|
|
|
|
|
// : item.status == 2
|
|
|
|
|
// ? Colors.green
|
|
|
|
|
// : Colors.black,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
AppText(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.daysSickleave +
|
|
|
|
|
": "),
|
|
|
|
|
AppText(
|
|
|
|
|
(item.sickLeaveDays
|
|
|
|
|
.toString() !=
|
|
|
|
|
null &&
|
|
|
|
|
item.sickLeaveDays
|
|
|
|
|
.toString() !=
|
|
|
|
|
"null")
|
|
|
|
|
? item.sickLeaveDays
|
|
|
|
|
.toString()
|
|
|
|
|
: item.noOfDays
|
|
|
|
|
.toString(),
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.startDate +
|
|
|
|
|
' ' ??
|
|
|
|
|
"",
|
|
|
|
|
),
|
|
|
|
|
Flexible(
|
|
|
|
|
child: AppText(
|
|
|
|
|
AppDateUtils.getDayMonthYearDateFormatted(item
|
|
|
|
|
.startDate
|
|
|
|
|
.contains(
|
|
|
|
|
"/Date(")
|
|
|
|
|
? AppDateUtils
|
|
|
|
|
.convertStringToDate(item
|
|
|
|
|
.startDate)
|
|
|
|
|
: DateTime.parse(
|
|
|
|
|
item.startDate)),
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.endDate +
|
|
|
|
|
' ' ??
|
|
|
|
|
"",
|
|
|
|
|
),
|
|
|
|
|
Flexible(
|
|
|
|
|
child: AppText(
|
|
|
|
|
AppDateUtils.getDayMonthYearDateFormatted(item
|
|
|
|
|
.startDate
|
|
|
|
|
.contains(
|
|
|
|
|
"/Date(")
|
|
|
|
|
? AppDateUtils.convertStringToDate(
|
|
|
|
|
item.endDate ??
|
|
|
|
|
"")
|
|
|
|
|
.add(Duration(
|
|
|
|
|
days: item.noOfDays ??
|
|
|
|
|
item
|
|
|
|
|
.sickLeaveDays))
|
|
|
|
|
: DateTime.parse(
|
|
|
|
|
item.startDate ?? "")
|
|
|
|
|
.add(Duration(days: item.noOfDays ?? ""))),
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.endDate +
|
|
|
|
|
' ' ??
|
|
|
|
|
"",
|
|
|
|
|
),
|
|
|
|
|
Flexible(
|
|
|
|
|
child: AppText(
|
|
|
|
|
AppDateUtils.getDayMonthYearDateFormatted(item
|
|
|
|
|
.startDate
|
|
|
|
|
.contains(
|
|
|
|
|
"/Date(")
|
|
|
|
|
? AppDateUtils.convertStringToDate(
|
|
|
|
|
item.endDate ??
|
|
|
|
|
"")
|
|
|
|
|
.add(Duration(
|
|
|
|
|
days: item.noOfDays ??
|
|
|
|
|
item
|
|
|
|
|
.sickLeaveDays))
|
|
|
|
|
: DateTime.parse(
|
|
|
|
|
item.startDate ?? "")
|
|
|
|
|
.add(Duration(days: item.noOfDays ?? ""))),
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 20,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 20,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
],
|
|
|
|
|
));
|
|
|
|
|
}).toList(),
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
));
|
|
|
|
|
})
|
|
|
|
|
: patient.patientStatusType != 43
|
|
|
|
|
? Center(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 100,
|
|
|
|
|
),
|
|
|
|
|
Image.asset('assets/images/no-data.png'),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: AppText(
|
|
|
|
|
TranslationBase.of(context).noSickLeave),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
? ErrorMessage(
|
|
|
|
|
error: TranslationBase.of(context)
|
|
|
|
|
.noSickLeave,
|
|
|
|
|
)
|
|
|
|
|
: SizedBox()
|
|
|
|
|
]))));
|
|
|
|
|
}
|
|
|
|
|
|