add sick leave
parent
4f96cff585
commit
e61f3f0281
@ -0,0 +1,32 @@
|
||||
class AddSickLeaveRequest {
|
||||
String patientMRN;
|
||||
String appointmentNo;
|
||||
String startDate;
|
||||
String noOfDays;
|
||||
String remarks;
|
||||
|
||||
AddSickLeaveRequest(
|
||||
{this.patientMRN,
|
||||
this.appointmentNo,
|
||||
this.startDate,
|
||||
this.noOfDays,
|
||||
this.remarks});
|
||||
|
||||
AddSickLeaveRequest.fromJson(Map<String, dynamic> json) {
|
||||
patientMRN = json['PatientMRN'];
|
||||
appointmentNo = json['AppointmentNo'];
|
||||
startDate = json['StartDate'];
|
||||
noOfDays = json['NoOfDays'];
|
||||
remarks = json['Remarks'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['PatientMRN'] = this.patientMRN;
|
||||
data['AppointmentNo'] = this.appointmentNo;
|
||||
data['StartDate'] = this.startDate;
|
||||
data['NoOfDays'] = this.noOfDays;
|
||||
data['Remarks'] = this.remarks;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
class ExtendSickLeaveRequest {
|
||||
String patientMRN;
|
||||
String previousRequestNo;
|
||||
String noOfDays;
|
||||
String remarks;
|
||||
|
||||
ExtendSickLeaveRequest(
|
||||
{this.patientMRN, this.previousRequestNo, this.noOfDays, this.remarks});
|
||||
|
||||
ExtendSickLeaveRequest.fromJson(Map<String, dynamic> json) {
|
||||
patientMRN = json['PatientMRN'];
|
||||
previousRequestNo = json['PreviousRequestNo'];
|
||||
noOfDays = json['NoOfDays'];
|
||||
remarks = json['Remarks'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['PatientMRN'] = this.patientMRN;
|
||||
data['PreviousRequestNo'] = this.previousRequestNo;
|
||||
data['NoOfDays'] = this.noOfDays;
|
||||
data['Remarks'] = this.remarks;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
class GetAllSickLeaveResponse {
|
||||
int appointmentNo;
|
||||
bool isExtendedLeave;
|
||||
int noOfDays;
|
||||
int patientMRN;
|
||||
String remarks;
|
||||
int requestNo;
|
||||
String startDate;
|
||||
int status;
|
||||
|
||||
GetAllSickLeaveResponse(
|
||||
{this.appointmentNo,
|
||||
this.isExtendedLeave,
|
||||
this.noOfDays,
|
||||
this.patientMRN,
|
||||
this.remarks,
|
||||
this.requestNo,
|
||||
this.startDate,
|
||||
this.status});
|
||||
|
||||
GetAllSickLeaveResponse.fromJson(Map<String, dynamic> json) {
|
||||
appointmentNo = json['appointmentNo'];
|
||||
isExtendedLeave = json['isExtendedLeave'];
|
||||
noOfDays = json['noOfDays'];
|
||||
patientMRN = json['patientMRN'];
|
||||
remarks = json['remarks'];
|
||||
requestNo = json['requestNo'];
|
||||
startDate = json['startDate'];
|
||||
status = json['status'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['appointmentNo'] = this.appointmentNo;
|
||||
data['isExtendedLeave'] = this.isExtendedLeave;
|
||||
data['noOfDays'] = this.noOfDays;
|
||||
data['patientMRN'] = this.patientMRN;
|
||||
data['remarks'] = this.remarks;
|
||||
data['requestNo'] = this.requestNo;
|
||||
data['startDate'] = this.startDate;
|
||||
data['status'] = this.status;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -1,58 +1,184 @@
|
||||
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/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 AddSickLeavScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
appBarTitle: TranslationBase.of(context).sickleave,
|
||||
body: new Builder(builder: (context) {
|
||||
return Center(
|
||||
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: () {
|
||||
openSickLeave(context);
|
||||
return BaseView<SickLeaveViewModel>(
|
||||
onModelReady: (model) => model.getSickLeave(),
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
appBarTitle: TranslationBase.of(context).sickleave,
|
||||
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: Row(
|
||||
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,
|
||||
),
|
||||
AppText(item.startDate)
|
||||
],
|
||||
),
|
||||
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: () {
|
||||
openSickLeave(
|
||||
context,
|
||||
false,
|
||||
);
|
||||
}),
|
||||
),
|
||||
Padding(
|
||||
child: AppText(
|
||||
TranslationBase.of(context).noSickLeaveApplied,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
padding: EdgeInsets.all(10),
|
||||
),
|
||||
AppText(
|
||||
TranslationBase.of(context).applyNow,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: HexColor('#B8382C'),
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
}),
|
||||
),
|
||||
Padding(
|
||||
child: AppText(
|
||||
TranslationBase.of(context).noSickLeaveApplied,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
padding: EdgeInsets.all(10),
|
||||
),
|
||||
AppText(
|
||||
TranslationBase.of(context).applyNow,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: HexColor('#B8382C'),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
openSickLeave(BuildContext context) {
|
||||
openSickLeave(BuildContext context, isExtend,
|
||||
{GetAllSickLeaveResponse extendedData}) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return new Container(child: SickLeaveScreen());
|
||||
return new Container(
|
||||
child: SickLeaveScreen(
|
||||
isExtended: isExtend,
|
||||
extendedData: extendedData,
|
||||
));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue