Merge branch 'sick_leave' into 'development'
Sick leave See merge request Cloud_Solution/doctor_app_flutter!847merge-requests/848/merge
commit
c231ae378a
@ -0,0 +1,24 @@
|
|||||||
|
class SickLeaveStatisticsModel {
|
||||||
|
String recommendedSickLeaveDays;
|
||||||
|
int totalLeavesByAllClinics;
|
||||||
|
int totalLeavesByDoctor;
|
||||||
|
|
||||||
|
SickLeaveStatisticsModel(
|
||||||
|
{this.recommendedSickLeaveDays,
|
||||||
|
this.totalLeavesByAllClinics,
|
||||||
|
this.totalLeavesByDoctor});
|
||||||
|
|
||||||
|
SickLeaveStatisticsModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
recommendedSickLeaveDays = json['recommendedSickLeaveDays'];
|
||||||
|
totalLeavesByAllClinics = json['totalLeavesByAllClinics'];
|
||||||
|
totalLeavesByDoctor = json['totalLeavesByDoctor'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['recommendedSickLeaveDays'] = this.recommendedSickLeaveDays;
|
||||||
|
data['totalLeavesByAllClinics'] = this.totalLeavesByAllClinics;
|
||||||
|
data['totalLeavesByDoctor'] = this.totalLeavesByDoctor;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,341 @@
|
|||||||
|
import 'package:doctor_app_flutter/config/config.dart';
|
||||||
|
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/enum/viewstate.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/patient/patiant_info_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart';
|
||||||
|
import 'package:doctor_app_flutter/routes.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/date-utils.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/helpers.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/buttons/app_buttons_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
Helpers helpers = Helpers();
|
||||||
|
|
||||||
|
class AddPatientSickLeaveScreen extends StatefulWidget {
|
||||||
|
final appointmentNo;
|
||||||
|
final patientMRN;
|
||||||
|
final PatiantInformtion patient;
|
||||||
|
final SickLeaveViewModel previousModel;
|
||||||
|
|
||||||
|
AddPatientSickLeaveScreen(
|
||||||
|
{this.appointmentNo,
|
||||||
|
this.patientMRN,
|
||||||
|
this.patient, this.previousModel});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AddPatientSickLeaveScreenState createState() =>
|
||||||
|
_AddPatientSickLeaveScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
|
||||||
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
||||||
|
TextEditingController _toDateController = new TextEditingController();
|
||||||
|
TextEditingController _numberOfDayController = new TextEditingController();
|
||||||
|
TextEditingController _clinicController = new TextEditingController();
|
||||||
|
TextEditingController _doctorController = new TextEditingController();
|
||||||
|
TextEditingController _remarkController = new TextEditingController();
|
||||||
|
DateTime currentDate;
|
||||||
|
|
||||||
|
AddSickLeaveRequest addSickLeave = AddSickLeaveRequest();
|
||||||
|
bool isFormSubmitted = false;
|
||||||
|
void _presentDatePicker() {
|
||||||
|
showDatePicker(
|
||||||
|
context: context,
|
||||||
|
initialDate: currentDate??DateTime.now(),
|
||||||
|
firstDate: DateTime(DateTime.now().year-1),
|
||||||
|
lastDate: DateTime(DateTime.now().year+1),
|
||||||
|
).then((pickedDate) {
|
||||||
|
if (pickedDate == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
final df = new DateFormat('yyyy-MM-dd');
|
||||||
|
addSickLeave.startDate = df.format(pickedDate);
|
||||||
|
currentDate = pickedDate;
|
||||||
|
_toDateController.text = AppDateUtils.getDayMonthYearDateFormatted(pickedDate,isMonthShort: true );
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<SickLeaveViewModel>(
|
||||||
|
onModelReady: (model) async {
|
||||||
|
await model.getDoctorProfile();
|
||||||
|
_clinicController.text = model.doctorProfile.clinicDescription;
|
||||||
|
_doctorController.text = model.doctorProfile.doctorName;
|
||||||
|
await model.preSickLeaveStatistics(
|
||||||
|
widget.appointmentNo, widget.patientMRN);
|
||||||
|
},
|
||||||
|
builder: (_, model, w) => GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusScope.of(context).requestFocus(new FocusNode());
|
||||||
|
},
|
||||||
|
child: AppScaffold(
|
||||||
|
baseViewModel: model,
|
||||||
|
appBar: BottomSheetTitle(
|
||||||
|
title: TranslationBase.of(context).addSickLeave,
|
||||||
|
),
|
||||||
|
isShowAppBar: true,
|
||||||
|
body: Center(
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.only(top: 10),
|
||||||
|
child: FractionallySizedBox(
|
||||||
|
widthFactor: 0.9,
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
AppTextFieldCustom(
|
||||||
|
height: Helpers.getTextFieldHeight(),
|
||||||
|
hintText: TranslationBase.of(context).sickLeave +
|
||||||
|
' ' +
|
||||||
|
TranslationBase.of(context).days,
|
||||||
|
maxLines: 1,
|
||||||
|
minLines: 1,
|
||||||
|
dropDownColor: Colors.white,
|
||||||
|
isTextFieldHasSuffix: true,
|
||||||
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.allow(
|
||||||
|
RegExp(ONLY_NUMBERS))
|
||||||
|
],
|
||||||
|
inputType:TextInputType.number,
|
||||||
|
controller: _numberOfDayController,
|
||||||
|
onChanged: (value) {
|
||||||
|
if(value.isNotEmpty)
|
||||||
|
setState(() {
|
||||||
|
addSickLeave.noOfDays = value;
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
validationError: isFormSubmitted &&
|
||||||
|
(addSickLeave.noOfDays == null)
|
||||||
|
? TranslationBase.of(context)
|
||||||
|
.pleaseEnterNoOfDays
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
AppTextFieldCustom(
|
||||||
|
height: Helpers.getTextFieldHeight(),
|
||||||
|
onClick: () {
|
||||||
|
Helpers.hideKeyboard(context);
|
||||||
|
_presentDatePicker();
|
||||||
|
},
|
||||||
|
hintText: TranslationBase.of(context)
|
||||||
|
.sickLeaveDate,
|
||||||
|
enabled: false,
|
||||||
|
maxLines: 1,
|
||||||
|
minLines: 1,
|
||||||
|
isTextFieldHasSuffix: true,
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(Icons.calendar_today)),
|
||||||
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.allow(
|
||||||
|
RegExp(ONLY_NUMBERS))
|
||||||
|
],
|
||||||
|
controller: _toDateController,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
addSickLeave.startDate = value;
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
validationError: isFormSubmitted &&
|
||||||
|
(addSickLeave.startDate == null)
|
||||||
|
? TranslationBase.of(context)
|
||||||
|
.pleaseEnterDate
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
|
AppTextFieldCustom(
|
||||||
|
height: Helpers.getTextFieldHeight(),
|
||||||
|
hintText: TranslationBase.of(context).clinic,
|
||||||
|
enabled: false,
|
||||||
|
maxLines: 1,
|
||||||
|
minLines: 1,
|
||||||
|
dropDownColor: Colors.white,
|
||||||
|
isTextFieldHasSuffix: true,
|
||||||
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.allow(
|
||||||
|
RegExp(ONLY_NUMBERS))
|
||||||
|
],
|
||||||
|
controller: _clinicController,
|
||||||
|
onChanged: (value) {},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
model.sickLeaveStatistics.recommendedSickLeaveDays!=
|
||||||
|
null
|
||||||
|
? Row(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
DoctorApp.warning,
|
||||||
|
size: 20,
|
||||||
|
color: IN_PROGRESS_COLOR,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: AppText(
|
||||||
|
model.sickLeaveStatistics.recommendedSickLeaveDays,
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
fontSize: 12,
|
||||||
|
color: IN_PROGRESS_COLOR,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
AppTextFieldCustom(
|
||||||
|
height: Helpers.getTextFieldHeight(),
|
||||||
|
hintText: TranslationBase.of(context).doctor,
|
||||||
|
enabled: false,
|
||||||
|
maxLines: 1,
|
||||||
|
minLines: 1,
|
||||||
|
dropDownColor: Colors.white,
|
||||||
|
isTextFieldHasSuffix: true,
|
||||||
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.allow(
|
||||||
|
RegExp(ONLY_NUMBERS))
|
||||||
|
],
|
||||||
|
controller: _doctorController,
|
||||||
|
onChanged: (value) {},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
AppTextFieldCustom(
|
||||||
|
height: Helpers.getTextFieldHeight(),
|
||||||
|
hintText: TranslationBase.of(context).remarks,
|
||||||
|
maxLines: 30,
|
||||||
|
minLines: 5,
|
||||||
|
dropDownColor: Colors.white,
|
||||||
|
isTextFieldHasSuffix: true,
|
||||||
|
controller: _remarkController,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
addSickLeave.remarks = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomSheet: model.state == ViewState.Busy ||
|
||||||
|
model.state == ViewState.Busy
|
||||||
|
? Container(
|
||||||
|
height: 0,
|
||||||
|
)
|
||||||
|
: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(0.0),
|
||||||
|
),
|
||||||
|
border: Border.all(
|
||||||
|
color: HexColor('#707070'), width: 0),
|
||||||
|
),
|
||||||
|
height: SizeConfig.heightMultiplier *
|
||||||
|
(SizeConfig.isHeightVeryShort ? 12 : 10),
|
||||||
|
width: double.infinity,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
FractionallySizedBox(
|
||||||
|
widthFactor: 0.9,
|
||||||
|
child: AppButton(
|
||||||
|
title: TranslationBase.of(context)
|
||||||
|
.addSickLeaverequest,
|
||||||
|
color: Colors.green,
|
||||||
|
onPressed: () async {
|
||||||
|
submitForm(model);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
submitForm(SickLeaveViewModel model) async {
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
setState(() {
|
||||||
|
isFormSubmitted = true;
|
||||||
|
});
|
||||||
|
if (addSickLeave.noOfDays == null ||
|
||||||
|
addSickLeave.startDate == null ) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
addSickLeave.patientMRN = widget.patient.patientMRN.toString();
|
||||||
|
addSickLeave.appointmentNo =
|
||||||
|
widget.patient.appointmentNo.toString();
|
||||||
|
await model.addSickLeave(addSickLeave);
|
||||||
|
if (model.state == ViewState.ErrorLocal) {
|
||||||
|
Helpers.showErrorToast(model.error);
|
||||||
|
} else {
|
||||||
|
await widget.previousModel
|
||||||
|
.getSickLeaveForPatient(widget.patient, isLocalBusy: true);
|
||||||
|
DrAppToastMsg.showSuccesToast(
|
||||||
|
TranslationBase.of(context).replySuccessfully);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
print(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,298 @@
|
|||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_patient_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/service/AnalyticsService.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/locator.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/patient-sick-leave/add_patient_sick_leave_screen.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/date-utils.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/helpers.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/card_with_bg_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class PatientSickLeaveScreen extends StatelessWidget {
|
||||||
|
PatiantInformtion patient;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context);
|
||||||
|
|
||||||
|
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),
|
||||||
|
),
|
||||||
|
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(
|
||||||
|
Helpers.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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
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 ??
|
||||||
|
""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: patient.patientStatusType != 43
|
||||||
|
? ErrorMessage(
|
||||||
|
error: TranslationBase.of(context).noSickLeave,
|
||||||
|
)
|
||||||
|
: SizedBox(),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
openSickLeave(BuildContext context, model) {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
SlideUpPageRoute(
|
||||||
|
fullscreenDialog: true,
|
||||||
|
widget: AddPatientSickLeaveScreen(
|
||||||
|
appointmentNo: patient.appointmentNo,
|
||||||
|
patientMRN: patient.patientMRN,
|
||||||
|
patient: patient,
|
||||||
|
previousModel: model,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,329 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_patient_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/service/AnalyticsService.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
|
||||||
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/locator.dart';
|
|
||||||
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/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/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/rounded_container_widget.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hexcolor/hexcolor.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
class AddSickLeavScreen extends StatelessWidget {
|
|
||||||
PatiantInformtion patient;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context);
|
|
||||||
|
|
||||||
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
||||||
patient = routeArgs['patient'];
|
|
||||||
bool isInpatient = routeArgs['isInpatient'];
|
|
||||||
return BaseView<SickLeaveViewModel>(
|
|
||||||
onModelReady: (model) async {
|
|
||||||
await model
|
|
||||||
.getSickLeavePatient(patient.patientMRN ?? patient.patientId);
|
|
||||||
await model
|
|
||||||
.getSickLeaveDoctor(patient.patientMRN ?? patient.patientId);
|
|
||||||
},
|
|
||||||
builder: (_, model, w) => AppScaffold(
|
|
||||||
baseViewModel: model,
|
|
||||||
isShowAppBar: true,
|
|
||||||
backgroundColor: Colors.grey[100],
|
|
||||||
appBar: PatientProfileAppBar(
|
|
||||||
patient,
|
|
||||||
isInpatient: isInpatient,
|
|
||||||
),
|
|
||||||
body: SingleChildScrollView(
|
|
||||||
child: Column(children: [
|
|
||||||
patient.patientStatusType == 43
|
|
||||||
? Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.all(10),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
if (!projectsProvider.isArabic)
|
|
||||||
AppText(
|
|
||||||
TranslationBase.of(context).patient,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
AppText(
|
|
||||||
TranslationBase.of(context).sickLeave,
|
|
||||||
fontSize: 24,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
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),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: 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,
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
));
|
|
||||||
}).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),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: SizedBox()
|
|
||||||
]))));
|
|
||||||
}
|
|
||||||
|
|
||||||
openSickLeave(BuildContext context, isExtend,
|
|
||||||
{GetAllSickLeaveResponse extendedData}) {
|
|
||||||
// showModalBottomSheet(
|
|
||||||
// context: context,
|
|
||||||
// builder: (context) {
|
|
||||||
// return new Container(
|
|
||||||
// child:
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
FadePage(
|
|
||||||
page: SickLeaveScreen(
|
|
||||||
appointmentNo: isExtend == true
|
|
||||||
? extendedData.appointmentNo
|
|
||||||
: patient.appointmentNo,
|
|
||||||
//extendedData.appointmentNo,
|
|
||||||
patientMRN: isExtend == true
|
|
||||||
? extendedData.patientMRN
|
|
||||||
: patient.patientMRN,
|
|
||||||
isExtended: isExtend,
|
|
||||||
extendedData: extendedData,
|
|
||||||
patient: patient)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,198 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart';
|
|
||||||
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/screens/base/base_view.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/translations_delegate_base.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/rounded_container_widget.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class ShowSickLeaveScreen extends StatelessWidget {
|
|
||||||
PatiantInformtion patient;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
||||||
patient = routeArgs['patient'];
|
|
||||||
return BaseView<SickLeaveViewModel>(
|
|
||||||
onModelReady: (model) =>
|
|
||||||
model.getSickLeave(patient.patientMRN ?? patient.patientId),
|
|
||||||
builder: (_, model, w) => AppScaffold(
|
|
||||||
baseViewModel: model,
|
|
||||||
isShowAppBar: true,
|
|
||||||
backgroundColor: Colors.grey[100],
|
|
||||||
appBar: PatientProfileAppBar(
|
|
||||||
patient,
|
|
||||||
),
|
|
||||||
body: SingleChildScrollView(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
// PatientProfileHeaderNewDesign(
|
|
||||||
// patient, routeArgs['patientType'], routeArgs['arrivalType']),
|
|
||||||
model.getAllSIckLeave.length > 0
|
|
||||||
? Column(
|
|
||||||
children: model.getAllSIckLeave
|
|
||||||
.map<Widget>((GetAllSickLeaveResponse 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,
|
|
||||||
width: 5.0,
|
|
||||||
))),
|
|
||||||
padding: EdgeInsets.all(10),
|
|
||||||
child: Row(
|
|
||||||
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.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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
AppText(
|
|
||||||
TranslationBase.of(
|
|
||||||
context)
|
|
||||||
.daysSickleave),
|
|
||||||
AppText(
|
|
||||||
item.noOfDays
|
|
||||||
.toString(),
|
|
||||||
fontWeight:
|
|
||||||
FontWeight.bold,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
AppText(
|
|
||||||
TranslationBase.of(
|
|
||||||
context)
|
|
||||||
.startDate +
|
|
||||||
' ',
|
|
||||||
),
|
|
||||||
Flexible(
|
|
||||||
child: AppText(
|
|
||||||
AppDateUtils
|
|
||||||
.convertStringToDateFormat(
|
|
||||||
item.startDate,
|
|
||||||
'dd-MMM-yyyy'),
|
|
||||||
fontWeight:
|
|
||||||
FontWeight.bold,
|
|
||||||
))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment
|
|
||||||
.spaceBetween,
|
|
||||||
children: [
|
|
||||||
AppText(
|
|
||||||
item.remarks ?? "",
|
|
||||||
),
|
|
||||||
(item.status == 1)
|
|
||||||
? 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()
|
|
||||||
]),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 20,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
));
|
|
||||||
}).toList(),
|
|
||||||
)
|
|
||||||
: 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),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,429 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/config/config.dart';
|
|
||||||
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
|
||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/enum/viewstate.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/models/sickleave/add_sickleave_request.dart';
|
|
||||||
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart';
|
|
||||||
import 'package:doctor_app_flutter/routes.dart';
|
|
||||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
||||||
import 'package:doctor_app_flutter/screens/sick-leave/add-sickleave.dart';
|
|
||||||
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
|
||||||
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
|
||||||
import 'package:doctor_app_flutter/util/helpers.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/buttons/app_buttons_widget.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hexcolor/hexcolor.dart';
|
|
||||||
import 'package:intl/intl.dart';
|
|
||||||
|
|
||||||
Helpers helpers = Helpers();
|
|
||||||
|
|
||||||
class SickLeaveScreen extends StatefulWidget {
|
|
||||||
final bool isExtended;
|
|
||||||
final GetAllSickLeaveResponse extendedData;
|
|
||||||
final appointmentNo;
|
|
||||||
final patientMRN;
|
|
||||||
final patient;
|
|
||||||
SickLeaveScreen({this.appointmentNo, this.patientMRN, this.isExtended = false, this.extendedData, this.patient});
|
|
||||||
@override
|
|
||||||
_SickLeaveScreenState createState() => _SickLeaveScreenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
||||||
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
||||||
TextEditingController _toDateController = new TextEditingController();
|
|
||||||
String _selectedClinic;
|
|
||||||
Map profile = {};
|
|
||||||
AddSickLeaveRequest addSickLeave = AddSickLeaveRequest();
|
|
||||||
void _presentDatePicker(id) {
|
|
||||||
showDatePicker(
|
|
||||||
context: context,
|
|
||||||
initialDate: DateTime.now(),
|
|
||||||
firstDate: DateTime(2019),
|
|
||||||
lastDate: DateTime(2050),
|
|
||||||
).then((pickedDate) {
|
|
||||||
if (pickedDate == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setState(() {
|
|
||||||
// var selectedDate = DateFormat.yMd().format(pickedDate);
|
|
||||||
final df = new DateFormat('yyyy-MM-dd');
|
|
||||||
addSickLeave.startDate = df.format(pickedDate);
|
|
||||||
|
|
||||||
_toDateController.text = addSickLeave.startDate;
|
|
||||||
//addSickLeave.startDate = selectedDate;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
getProfile();
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return BaseView<PatientViewModel>(
|
|
||||||
onModelReady: (model) => model.getClinicsList(),
|
|
||||||
builder: (_, model, w) => BaseView<SickLeaveViewModel>(
|
|
||||||
onModelReady: (model2) => model2.preSickLeaveStatistics(widget.appointmentNo, widget.patientMRN),
|
|
||||||
builder: (_, model2, w) => GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
FocusScope.of(context).requestFocus(new FocusNode());
|
|
||||||
},
|
|
||||||
child: AppScaffold(
|
|
||||||
baseViewModel: model2,
|
|
||||||
appBarTitle: widget.isExtended == true
|
|
||||||
? TranslationBase.of(context).extendSickLeave
|
|
||||||
: TranslationBase.of(context).addSickLeave,
|
|
||||||
isShowAppBar: true,
|
|
||||||
body: Center(
|
|
||||||
child: Container(
|
|
||||||
margin: EdgeInsets.only(top: 10),
|
|
||||||
child: FractionallySizedBox(
|
|
||||||
widthFactor: 0.9,
|
|
||||||
child: ListView(
|
|
||||||
children: [
|
|
||||||
// Padding(
|
|
||||||
// child: AppText(
|
|
||||||
// widget.isExtended == true
|
|
||||||
// ? TranslationBase.of(context)
|
|
||||||
// .extendSickLeave
|
|
||||||
// : TranslationBase.of(context)
|
|
||||||
// .addSickLeave,
|
|
||||||
// fontWeight: FontWeight.bold,
|
|
||||||
// ),
|
|
||||||
// padding: EdgeInsets.all(10)),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(left: 10, right: 10),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
|
||||||
border: Border.all(
|
|
||||||
width: 1.0,
|
|
||||||
color: HexColor("#CCCCCC"),
|
|
||||||
),
|
|
||||||
color: Colors.white),
|
|
||||||
padding: EdgeInsets.all(5),
|
|
||||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
|
|
||||||
child: AppText(TranslationBase.of(context).sickLeave +
|
|
||||||
' ' +
|
|
||||||
TranslationBase.of(context).days)),
|
|
||||||
AppTextFormField(
|
|
||||||
borderColor: Colors.white,
|
|
||||||
onChanged: (value) {
|
|
||||||
addSickLeave.noOfDays = value;
|
|
||||||
if (widget.extendedData != null) {
|
|
||||||
widget.extendedData.noOfDays = int.parse(value);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
hintText:
|
|
||||||
widget.extendedData != null ? widget.extendedData.noOfDays.toString() : '',
|
|
||||||
// validator: (value) {
|
|
||||||
// return TextValidator().validateName(value);
|
|
||||||
// },
|
|
||||||
textInputType: TextInputType.number,
|
|
||||||
inputFormatter: ONLY_NUMBERS)
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(left: 10, right: 10),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
|
||||||
border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
padding: EdgeInsets.all(5),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
|
|
||||||
child: AppText(
|
|
||||||
TranslationBase.of(context).sickLeaveDate,
|
|
||||||
)),
|
|
||||||
AppTextFormField(
|
|
||||||
hintText: widget.extendedData != null ? widget.extendedData.startDate : '',
|
|
||||||
borderColor: Colors.white,
|
|
||||||
prefix: IconButton(icon: Icon(Icons.calendar_today)),
|
|
||||||
textInputType: TextInputType.number,
|
|
||||||
controller: _toDateController,
|
|
||||||
onTap: () {
|
|
||||||
_presentDatePicker('_selectedToDate');
|
|
||||||
},
|
|
||||||
inputFormatter: ONLY_DATE,
|
|
||||||
onChanged: (value) {
|
|
||||||
addSickLeave.startDate = value;
|
|
||||||
if (widget.extendedData != null) {
|
|
||||||
widget.extendedData.startDate = value;
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
|
||||||
border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
width: double.infinity,
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
top: SizeConfig.widthMultiplier * 0.9,
|
|
||||||
bottom: SizeConfig.widthMultiplier * 0.9,
|
|
||||||
right: SizeConfig.widthMultiplier * 3,
|
|
||||||
left: SizeConfig.widthMultiplier * 3),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(top: 5),
|
|
||||||
child: AppText(
|
|
||||||
TranslationBase.of(context).clinicName,
|
|
||||||
)),
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
// add Expanded to have your dropdown button fill remaining space
|
|
||||||
child: DropdownButtonHideUnderline(
|
|
||||||
child: new IgnorePointer(
|
|
||||||
ignoring: true,
|
|
||||||
child: DropdownButton(
|
|
||||||
isExpanded: true,
|
|
||||||
value: getClinicName(model) ?? "",
|
|
||||||
iconSize: 0,
|
|
||||||
elevation: 16,
|
|
||||||
selectedItemBuilder: (BuildContext context) {
|
|
||||||
return model.getClinicNameList().map((item) {
|
|
||||||
return Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: <Widget>[
|
|
||||||
AppText(
|
|
||||||
item,
|
|
||||||
fontSize: SizeConfig.textMultiplier * 2.1,
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}).toList();
|
|
||||||
},
|
|
||||||
onChanged: (newValue) => {},
|
|
||||||
items: model.getClinicNameList().map((item) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: item.toString(),
|
|
||||||
child: Text(
|
|
||||||
item,
|
|
||||||
textAlign: TextAlign.end,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}).toList(),
|
|
||||||
))),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
model2.sickLeaveStatistics['recommendedSickLeaveDays'] != null
|
|
||||||
? Padding(
|
|
||||||
child: AppText(
|
|
||||||
model2.sickLeaveStatistics['recommendedSickLeaveDays'],
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
),
|
|
||||||
padding: EdgeInsets.all(10),
|
|
||||||
)
|
|
||||||
: SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(left: 10, right: 10),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
|
||||||
border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
padding: EdgeInsets.all(5),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
|
|
||||||
child: AppText(
|
|
||||||
TranslationBase.of(context).doctorName,
|
|
||||||
)),
|
|
||||||
new IgnorePointer(
|
|
||||||
ignoring: true,
|
|
||||||
child: AppTextFormField(
|
|
||||||
readOnly: true,
|
|
||||||
hintText: profile['DoctorName'],
|
|
||||||
borderColor: Colors.white,
|
|
||||||
onSaved: (value) {},
|
|
||||||
// validator: (value) {
|
|
||||||
// return TextValidator().validateName(value);
|
|
||||||
// },
|
|
||||||
inputFormatter: ONLY_NUMBERS))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(left: 10, right: 10),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
|
||||||
border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
padding: EdgeInsets.all(5),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
|
|
||||||
child: AppText(
|
|
||||||
TranslationBase.of(context).remarks,
|
|
||||||
)),
|
|
||||||
TextField(
|
|
||||||
maxLines: 3,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
contentPadding: EdgeInsets.all(20.0),
|
|
||||||
border: InputBorder.none,
|
|
||||||
hintText: widget.extendedData != null ? widget.extendedData.remarks : ''),
|
|
||||||
onChanged: (value) {
|
|
||||||
addSickLeave.remarks = value;
|
|
||||||
if (widget.extendedData != null) {
|
|
||||||
widget.extendedData.remarks = value;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
|
||||||
child: Wrap(
|
|
||||||
alignment: WrapAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
AppButton(
|
|
||||||
title: widget.isExtended == true
|
|
||||||
? TranslationBase.of(context).extend
|
|
||||||
: TranslationBase.of(context).addSickLeaverequest,
|
|
||||||
color: Colors.green,
|
|
||||||
onPressed: () async {
|
|
||||||
if (widget.isExtended) {
|
|
||||||
await model2.extendSickLeave(widget.extendedData);
|
|
||||||
|
|
||||||
DrAppToastMsg.showSuccesToast(
|
|
||||||
model2.sickleaveResponse['ListSickLeavesToExtent']['success']);
|
|
||||||
Navigator.of(context).popUntil((route) {
|
|
||||||
return route.settings.name == PATIENTS_PROFILE;
|
|
||||||
});
|
|
||||||
Navigator.of(context)
|
|
||||||
.pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
|
|
||||||
//print(value);
|
|
||||||
//});
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
if (addSickLeave.noOfDays == null) {
|
|
||||||
DrAppToastMsg.showErrorToast(
|
|
||||||
TranslationBase.of(context).pleaseEnterNoOfDays);
|
|
||||||
} else if (addSickLeave.remarks == null) {
|
|
||||||
DrAppToastMsg.showErrorToast(
|
|
||||||
TranslationBase.of(context).pleaseEnterRemarks);
|
|
||||||
} else if (addSickLeave.startDate == null) {
|
|
||||||
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterDate);
|
|
||||||
} else {
|
|
||||||
addSickLeave.patientMRN = widget.patient.patientMRN.toString();
|
|
||||||
addSickLeave.appointmentNo = widget.patient.appointmentNo.toString();
|
|
||||||
await model2.addSickLeave(addSickLeave);
|
|
||||||
|
|
||||||
if (model2.sickleaveResponse['SickLeavesList']['success'] != null)
|
|
||||||
DrAppToastMsg.showSuccesToast(
|
|
||||||
model2.sickleaveResponse['SickLeavesList']['success']);
|
|
||||||
}
|
|
||||||
// Navigator.push(
|
|
||||||
// context,
|
|
||||||
// MaterialPageRoute(builder: (context) => AddSickLeavScreen()),
|
|
||||||
// );
|
|
||||||
|
|
||||||
// Navigator.of(context).popUntil((route) {
|
|
||||||
// return route.settings.name == PATIENTS_PROFILE;
|
|
||||||
// });
|
|
||||||
// Navigator.of(context)
|
|
||||||
// .pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
|
|
||||||
} catch (err) {
|
|
||||||
print(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// Column(
|
|
||||||
// children: [
|
|
||||||
// AppText(TranslationBase.of(context)
|
|
||||||
// .previousSickLeaveIssue +
|
|
||||||
// ' ')
|
|
||||||
// ],
|
|
||||||
// )
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void _validateInputs(model2) async {
|
|
||||||
try {
|
|
||||||
if (addSickLeave.noOfDays == null) {
|
|
||||||
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterNoOfDays);
|
|
||||||
} else if (addSickLeave.remarks == null) {
|
|
||||||
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterRemarks);
|
|
||||||
} else if (addSickLeave.startDate == null) {
|
|
||||||
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterDate);
|
|
||||||
} else {
|
|
||||||
addSickLeave.patientMRN = widget.patient.patientMRN.toString();
|
|
||||||
addSickLeave.appointmentNo = widget.patient.appointmentNo.toString();
|
|
||||||
await model2.addSickLeave(addSickLeave).then((value) => print(value));
|
|
||||||
|
|
||||||
DrAppToastMsg.showSuccesToast(model2.sickleaveResponse['ListSickLeavesToExtent']['success']);
|
|
||||||
Navigator.of(context).popUntil((route) {
|
|
||||||
return route.settings.name == PATIENTS_PROFILE;
|
|
||||||
});
|
|
||||||
Navigator.of(context).pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
print(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getProfile() async {
|
|
||||||
Map p = await sharedPref.getObj(DOCTOR_PROFILE);
|
|
||||||
setState(() {
|
|
||||||
this.profile = p;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getClinicName(model) {
|
|
||||||
var clinicInfo = model.clinicsList.where((i) => i['ClinicID'] == this.profile['ClinicID']).toList();
|
|
||||||
return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue