|
|
|
|
@ -29,185 +29,255 @@ class PatientSickLeaveScreen extends StatelessWidget {
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context);
|
|
|
|
|
|
|
|
|
|
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
|
|
|
final routeArgs = ModalRoute
|
|
|
|
|
.of(context)
|
|
|
|
|
.settings
|
|
|
|
|
.arguments as Map;
|
|
|
|
|
patient = routeArgs['patient'];
|
|
|
|
|
bool isInpatient = routeArgs['isInpatient'];
|
|
|
|
|
return BaseView<SickLeaveViewModel>(
|
|
|
|
|
onModelReady: (model) async {
|
|
|
|
|
await model.getSickLeaveForPatient(patient);
|
|
|
|
|
},
|
|
|
|
|
builder: (_, model, w) => AppScaffold(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
backgroundColor: Colors.grey[100],
|
|
|
|
|
appBar: PatientProfileAppBar(
|
|
|
|
|
patient,
|
|
|
|
|
isInpatient: isInpatient,
|
|
|
|
|
),
|
|
|
|
|
body: Column(children: [
|
|
|
|
|
patient.patientStatusType == 43
|
|
|
|
|
? Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: SizeConfig.isHeightVeryShort
|
|
|
|
|
? 30
|
|
|
|
|
: SizeConfig.isHeightShort
|
|
|
|
|
? 35
|
|
|
|
|
: 10,
|
|
|
|
|
),
|
|
|
|
|
if (!projectsProvider.isArabic)
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).patient,
|
|
|
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3 : 4),
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
letterSpacing: -0.72,
|
|
|
|
|
color: Color(0xFF2E303A),
|
|
|
|
|
),
|
|
|
|
|
builder: (_, model, w) =>
|
|
|
|
|
AppScaffold(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
backgroundColor: Colors.grey[100],
|
|
|
|
|
appBar: PatientProfileAppBar(
|
|
|
|
|
patient,
|
|
|
|
|
isInpatient: isInpatient,
|
|
|
|
|
),
|
|
|
|
|
body: Column(children: [
|
|
|
|
|
patient.patientStatusType == 43
|
|
|
|
|
? Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: SizeConfig.isHeightVeryShort
|
|
|
|
|
? 30
|
|
|
|
|
: SizeConfig.isHeightShort
|
|
|
|
|
? 35
|
|
|
|
|
: 10,
|
|
|
|
|
),
|
|
|
|
|
if (!projectsProvider.isArabic)
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).sickLeave,
|
|
|
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 6 : 6),
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
letterSpacing: -1.44,
|
|
|
|
|
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),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
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, model);
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
model.getAllSIckLeavePatient.length > 0
|
|
|
|
|
? Expanded(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.95,
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: model.getAllSIckLeavePatient.length,
|
|
|
|
|
itemBuilder: (BuildContext ctxt, int index) {
|
|
|
|
|
SickLeavePatientModel item = model.getAllSIckLeavePatient[index];
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
CardWithBgWidget(
|
|
|
|
|
padding: 0,
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
marginSymmetric: 10,
|
|
|
|
|
hasBorder: false,
|
|
|
|
|
bgColor: Colors.black,
|
|
|
|
|
widget: Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
padding: EdgeInsets.all(20),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
if (item.doctorName != null)
|
|
|
|
|
Row(crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
// width: MediaQuery.of(context).size.width*0.51,
|
|
|
|
|
child: AppText(
|
|
|
|
|
Utils.capitalize(item.doctorName ?? ""),
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
color: Color(0xff2e303a),
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
textOverflow: TextOverflow.ellipsis,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
ClipRRect(
|
|
|
|
|
borderRadius: BorderRadius.circular(50.0),
|
|
|
|
|
child: CachedNetworkImage(
|
|
|
|
|
imageUrl: item.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png",
|
|
|
|
|
height: 30,
|
|
|
|
|
width: 30,
|
|
|
|
|
errorWidget: (context, url, error) => AppText(
|
|
|
|
|
'No Image',
|
|
|
|
|
fontSize: 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, model);
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
model.getAllSIckLeavePatient.length > 0
|
|
|
|
|
? Expanded(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.95,
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: model.getAllSIckLeavePatient.length,
|
|
|
|
|
itemBuilder: (BuildContext ctxt, int index) {
|
|
|
|
|
SickLeavePatientModel item = model
|
|
|
|
|
.getAllSIckLeavePatient[index];
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
CardWithBgWidget(
|
|
|
|
|
padding: 0,
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
marginSymmetric: 10,
|
|
|
|
|
hasBorder: false,
|
|
|
|
|
bgColor: Colors.black,
|
|
|
|
|
widget: Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
padding: EdgeInsets.all(20),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
if (item.doctorName != null)
|
|
|
|
|
Row(crossAxisAlignment: CrossAxisAlignment
|
|
|
|
|
.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment
|
|
|
|
|
.start,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
// width: MediaQuery.of(context).size.width*0.51,
|
|
|
|
|
child: AppText(
|
|
|
|
|
Utils.capitalize(
|
|
|
|
|
item.doctorName ?? ""),
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
color: Color(0xff2e303a),
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
textOverflow: TextOverflow
|
|
|
|
|
.ellipsis,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 10,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
CustomRow(
|
|
|
|
|
label: TranslationBase.of(context).daysSickleave,
|
|
|
|
|
labelSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.3,
|
|
|
|
|
valueSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4,
|
|
|
|
|
value:
|
|
|
|
|
(item.sickLeaveDays.toString() != null && item.sickLeaveDays.toString() != "null") ? item.sickLeaveDays.toString() : item.noOfDays.toString(),
|
|
|
|
|
]),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
ClipRRect(
|
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
|
50.0),
|
|
|
|
|
child: CachedNetworkImage(
|
|
|
|
|
imageUrl: item.doctorImageURL ??
|
|
|
|
|
"https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png",
|
|
|
|
|
height: 30,
|
|
|
|
|
width: 30,
|
|
|
|
|
errorWidget: (context, url,
|
|
|
|
|
error) =>
|
|
|
|
|
AppText(
|
|
|
|
|
'No Image',
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
),
|
|
|
|
|
CustomRow(
|
|
|
|
|
label: TranslationBase.of(context).startDate + ' ' ?? "",
|
|
|
|
|
labelSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.3,
|
|
|
|
|
valueSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4,
|
|
|
|
|
value: AppDateUtils.getDayMonthYearDateFormatted(
|
|
|
|
|
item.startDate.contains("/Date(") ? AppDateUtils.convertStringToDate(item.startDate) : DateTime.parse(item.startDate),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 10,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
CustomRow(
|
|
|
|
|
label: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.daysSickleave,
|
|
|
|
|
labelSize: SizeConfig
|
|
|
|
|
.getTextMultiplierBasedOnWidth() *
|
|
|
|
|
3.3,
|
|
|
|
|
valueSize: SizeConfig
|
|
|
|
|
.getTextMultiplierBasedOnWidth() *
|
|
|
|
|
4,
|
|
|
|
|
value:
|
|
|
|
|
(item.sickLeaveDays
|
|
|
|
|
.toString() != null &&
|
|
|
|
|
item.sickLeaveDays
|
|
|
|
|
.toString() != "null")
|
|
|
|
|
? item.sickLeaveDays
|
|
|
|
|
.toString()
|
|
|
|
|
: item.noOfDays
|
|
|
|
|
.toString(),
|
|
|
|
|
),
|
|
|
|
|
CustomRow(
|
|
|
|
|
label: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.startDate + ' ' ?? "",
|
|
|
|
|
labelSize: SizeConfig
|
|
|
|
|
.getTextMultiplierBasedOnWidth() *
|
|
|
|
|
3.3,
|
|
|
|
|
valueSize: SizeConfig
|
|
|
|
|
.getTextMultiplierBasedOnWidth() *
|
|
|
|
|
4,
|
|
|
|
|
value: AppDateUtils
|
|
|
|
|
.getDayMonthYearDateFormatted(
|
|
|
|
|
item.startDate.contains(
|
|
|
|
|
"/Date(")
|
|
|
|
|
? AppDateUtils
|
|
|
|
|
.convertStringToDate(
|
|
|
|
|
item.startDate)
|
|
|
|
|
: DateTime.parse(
|
|
|
|
|
item.startDate),
|
|
|
|
|
),
|
|
|
|
|
CustomRow(
|
|
|
|
|
label: TranslationBase.of(context).endDate + ' ' ?? "",
|
|
|
|
|
labelSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.3,
|
|
|
|
|
valueSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4,
|
|
|
|
|
value: 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 ?? ""),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
CustomRow(
|
|
|
|
|
label: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.endDate + ' ' ?? "",
|
|
|
|
|
labelSize: SizeConfig
|
|
|
|
|
.getTextMultiplierBasedOnWidth() *
|
|
|
|
|
3.3,
|
|
|
|
|
valueSize: SizeConfig
|
|
|
|
|
.getTextMultiplierBasedOnWidth() *
|
|
|
|
|
4,
|
|
|
|
|
value: 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 ??
|
|
|
|
|
""),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment
|
|
|
|
|
.start,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: patient.patientStatusType != 43
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: patient.patientStatusType != 43
|
|
|
|
|
? ErrorMessage(
|
|
|
|
|
error: TranslationBase.of(context).noSickLeave,
|
|
|
|
|
)
|
|
|
|
|
error: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.noSickLeave,
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 100,
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 100,
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -226,3 +296,4 @@ class PatientSickLeaveScreen extends StatelessWidget {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|