|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
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';
|
|
|
|
|
@ -14,6 +15,7 @@ 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_text_form_field.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
@ -29,7 +31,7 @@ class SickLeaveScreen extends StatefulWidget {
|
|
|
|
|
final patientMRN;
|
|
|
|
|
final patient;
|
|
|
|
|
SickLeaveScreen(
|
|
|
|
|
{this.appointmentNo, this.patientMRN, this.isExtended = false, required this.extendedData, this.patient});
|
|
|
|
|
{this.appointmentNo, this.patientMRN, this.isExtended = false, required this.extendedData, this.patient});
|
|
|
|
|
@override
|
|
|
|
|
_SickLeaveScreenState createState() => _SickLeaveScreenState();
|
|
|
|
|
}
|
|
|
|
|
@ -69,7 +71,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return BaseView<PatientViewModel>(
|
|
|
|
|
return BaseView<PatientViewModel>(
|
|
|
|
|
onModelReady: (model) => model.getClinicsList(),
|
|
|
|
|
builder: (_, model, w) => BaseView<SickLeaveViewModel>(
|
|
|
|
|
onModelReady: (model2) => model2.preSickLeaveStatistics(widget.appointmentNo, widget.patientMRN),
|
|
|
|
|
@ -120,12 +122,12 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
|
borderColor: Colors.white,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
addSickLeave.noOfDays = value;
|
|
|
|
|
if (widget.extendedData != null) {
|
|
|
|
|
if (widget.extendedData.noOfDays != null) {
|
|
|
|
|
widget.extendedData.noOfDays = int.parse(value);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
hintText:
|
|
|
|
|
widget.extendedData != null ? widget.extendedData.noOfDays.toString() : '',
|
|
|
|
|
widget.extendedData.noOfDays != null ? widget.extendedData.noOfDays.toString() : '',
|
|
|
|
|
// validator: (value) {
|
|
|
|
|
// return TextValidator().validateName(value);
|
|
|
|
|
// },
|
|
|
|
|
@ -371,13 +373,21 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
|
|
|
|
} else {
|
|
|
|
|
addSickLeave.patientMRN = widget.patient.patientMRN.toString();
|
|
|
|
|
addSickLeave.appointmentNo = widget.patient.appointmentNo.toString();
|
|
|
|
|
await model2.addSickLeave(addSickLeave).then((value) => print(value));
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model2.addSickLeave(addSickLeave);
|
|
|
|
|
if(model2.state == ViewState.ErrorLocal){
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
DrAppToastMsg.showErrorToast(model2.error);
|
|
|
|
|
} else {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
DrAppToastMsg.showSuccesToast("Sick leave created successfully");
|
|
|
|
|
Navigator.of(context).popUntil((route) {
|
|
|
|
|
return route.settings.name == PATIENTS_PROFILE;
|
|
|
|
|
});
|
|
|
|
|
Navigator.of(context).pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|