Compare commits

...

6 Commits

@ -4,13 +4,15 @@ class GetSickLeaveDoctorRequestModel {
int status;
String vidaAuthTokenID;
String vidaRefreshTokenID;
int admissionNo;
GetSickLeaveDoctorRequestModel(
{this.patientMRN,
this.appointmentNo,
this.status,
this.vidaAuthTokenID,
this.vidaRefreshTokenID});
this.vidaRefreshTokenID,
this.admissionNo});
GetSickLeaveDoctorRequestModel.fromJson(Map<String, dynamic> json) {
patientMRN = json['PatientMRN'];
@ -18,6 +20,7 @@ class GetSickLeaveDoctorRequestModel {
status = json['status'];
vidaAuthTokenID = json['VidaAuthTokenID'];
vidaRefreshTokenID = json['VidaRefreshTokenID'];
admissionNo = json['AdmissionNo'];
}
Map<String, dynamic> toJson() {
@ -27,6 +30,7 @@ class GetSickLeaveDoctorRequestModel {
data['status'] = this.status;
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['VidaRefreshTokenID'] = this.vidaRefreshTokenID;
data['AdmissionNo'] = this.admissionNo;
return data;
}
}

@ -135,9 +135,9 @@ class SickLeaveService extends BaseService {
);
}
Future getSickLeaveDoctor(patientMRN) async {
Future getSickLeaveDoctor(patientMRN, {int admissionNo}) async {
_sickLeaveDoctorRequestModel =
GetSickLeaveDoctorRequestModel(patientMRN: patientMRN);
GetSickLeaveDoctorRequestModel(patientMRN: patientMRN, admissionNo: admissionNo);
hasError = false;
getAllSickLeaveDoctor = [];
getAllSickLeaveDoctor.clear();

@ -1,10 +1,10 @@
import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/service/patient/patient_service.dart';
import 'package:doctor_app_flutter/core/service/patient_medical_file/sick_leave/sickleave_service.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/model/sickleave/add_sickleave_request.dart';
import 'package:doctor_app_flutter/core/model/sickleave/get_all_sickleave_response.dart';
import 'package:doctor_app_flutter/core/model/sickleave/sick_leave_statisitics_model.dart';
import 'package:doctor_app_flutter/core/service/patient/patient_service.dart';
import 'package:doctor_app_flutter/core/service/patient_medical_file/sick_leave/sickleave_service.dart';
import '../../locator.dart';
import 'base_view_model.dart';
@ -88,7 +88,7 @@ class SickLeaveViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getSickLeaveForPatient(PatiantInformtion patient,
Future getSickLeaveForPatient(PatiantInformtion patient, bool isInpatient,
{bool isLocalBusy = false}) async {
if (isLocalBusy)
setState(ViewState.BusyLocal);
@ -97,7 +97,8 @@ class SickLeaveViewModel extends BaseViewModel {
var patientMRN = patient.patientMRN ?? patient.patientId;
var services = [
_sickLeaveService.getSickLeavePatient(patientMRN),
_sickLeaveService.getSickLeaveDoctor(patientMRN)
_sickLeaveService.getSickLeaveDoctor(patientMRN,
admissionNo: isInpatient ? 2019008644 : 0)
];
final results = await Future.wait(services);

@ -30,9 +30,10 @@ class AddPatientSickLeaveScreen extends StatefulWidget {
final patientMRN;
final PatiantInformtion patient;
final SickLeaveViewModel previousModel;
final bool isInpatient;
AddPatientSickLeaveScreen(
{this.appointmentNo, this.patientMRN, this.patient, this.previousModel});
{this.appointmentNo, this.patientMRN, this.patient, this.previousModel, this.isInpatient});
@override
_AddPatientSickLeaveScreenState createState() =>
@ -322,7 +323,7 @@ class _AddPatientSickLeaveScreenState extends State<AddPatientSickLeaveScreen> {
Utils.showErrorToast(model.error);
} else {
await widget.previousModel
.getSickLeaveForPatient(widget.patient, isLocalBusy: true);
.getSickLeaveForPatient(widget.patient, widget.isInpatient, isLocalBusy: true);
DrAppToastMsg.showSuccesToast(
TranslationBase.of(context).replySuccessfully);
Navigator.of(context).pop();

@ -34,7 +34,7 @@ class PatientSickLeaveScreen extends StatelessWidget {
bool isInpatient = routeArgs['isInpatient'];
return BaseView<SickLeaveViewModel>(
onModelReady: (model) async {
await model.getSickLeaveForPatient(patient);
await model.getSickLeaveForPatient(patient, isInpatient);
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
@ -45,8 +45,7 @@ class PatientSickLeaveScreen extends StatelessWidget {
isInpatient: isInpatient,
),
body: Column(children: [
patient.patientStatusType == 43
? Column(
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
@ -91,13 +90,11 @@ class PatientSickLeaveScreen extends StatelessWidget {
"Leave Screen",
eventAction: "apply For Sick Leave",
);
openSickLeave(context, model);
openSickLeave(context, model, isInpatient);
}),
],
)
: SizedBox(),
model.getAllSIckLeavePatient.length > 0
? Expanded(
),
Expanded(
child: FractionallySizedBox(
widthFactor: 0.95,
child: ListView.builder(
@ -267,12 +264,7 @@ class PatientSickLeaveScreen extends StatelessWidget {
);
}),
),
)
: patient.patientStatusType != 43
? ErrorMessage(
error: TranslationBase.of(context).noSickLeave,
)
: SizedBox(),
),
SizedBox(
height: 100,
)
@ -281,7 +273,7 @@ class PatientSickLeaveScreen extends StatelessWidget {
);
}
openSickLeave(BuildContext context, model) {
openSickLeave(BuildContext context, model, isInpatient) {
Navigator.push(
context,
SlideUpPageRoute(
@ -291,6 +283,7 @@ class PatientSickLeaveScreen extends StatelessWidget {
patientMRN: patient.patientMRN,
patient: patient,
previousModel: model,
isInpatient: isInpatient
),
),
);

@ -197,8 +197,8 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
.progressNote,
//TranslationBase.of(context).addProgressNote,
controller: progressNoteController,
maxLines: 35,
minLines: 25,
maxLines: 40,
minLines: 20,
hasBorder: true,
// isTextFieldHasSuffix: true,

@ -91,6 +91,10 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
TextInputType localKeyboardType = widget.inputType ??
(widget.maxLines == 1
? TextInputType.text
: TextInputType.multiline);
return Column(
children: [
@ -124,17 +128,12 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
// if ((widget.controller != null &&
// widget.controller.text != "") ||
// widget.dropDownText != null)
AppText(
widget.hintText,
// marginTop: widget.hasHintmargin ? 0 : 30,
color: Color(0xFF2E303A),
fontSize: widget.isPrscription == false
? 11.0
// SizeConfig.getHeightMultiplier() *
// (SizeConfig.isWidthLarge ? 1.1 : 1.3)
: 0,
fontWeight: FontWeight.w600,
letterSpacing: -0.44,
@ -146,42 +145,53 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
widget.height != 0 && widget.maxLines == 1
? widget.height - 22
: null,
child: TextFormField(
textAlign: projectViewModel.isArabic
? TextAlign.right
: TextAlign.left,
focusNode: _focusNode,
textAlignVertical: TextAlignVertical.top,
decoration: TextFieldsUtils
.textFieldSelectorDecoration(
widget.hintText, null, true),
style: TextStyle(
fontSize: SizeConfig.textMultiplier * 1.7,
fontFamily: 'Poppins',
color: Color(0xFF575757),
fontWeight: FontWeight.w400,
letterSpacing: -0.56,
),
controller: widget.controller,
keyboardType: widget.inputType ??
(widget.maxLines == 1
? TextInputType.text
: TextInputType.multiline),
enabled: widget.enabled,
minLines: widget.minLines,
maxLines: widget.maxLines,
inputFormatters:
widget.inputFormatters != null
? widget.inputFormatters
: [],
onChanged: (value) {
setState(() {});
if (widget.onChanged != null) {
widget.onChanged(value);
}
},
onFieldSubmitted: widget.onFieldSubmitted,
obscureText: widget.isSecure),
child: RawKeyboardListener(
focusNode: FocusNode(),
autofocus: false,
onKey: (rawKeyEvent) {
final isFormSkippedEnterEvent = rawKeyEvent is RawKeyDownEvent &&
rawKeyEvent.isKeyPressed(LogicalKeyboardKey.enter);
final needToInsertNewLine = isFormSkippedEnterEvent &&
localKeyboardType == TextInputType.multiline;
if (needToInsertNewLine) {
TextEditingControllerHelper.insertText(widget.controller, '\n');
}
},
child: TextFormField(
textAlign: projectViewModel.isArabic
? TextAlign.right
: TextAlign.left,
focusNode: _focusNode,
textAlignVertical: TextAlignVertical.top,
decoration: TextFieldsUtils
.textFieldSelectorDecoration(
widget.hintText, null, true),
style: TextStyle(
fontSize: SizeConfig.textMultiplier * 1.7,
fontFamily: 'Poppins',
color: Color(0xFF575757),
fontWeight: FontWeight.w400,
letterSpacing: -0.56,
),
controller: widget.controller,
keyboardType: localKeyboardType,
enabled: widget.enabled,
minLines: widget.minLines,
maxLines: widget.maxLines,
inputFormatters:
widget.inputFormatters != null
? widget.inputFormatters
: [],
onChanged: (value) {
setState(() {});
if (widget.onChanged != null) {
widget.onChanged(value);
}
},
onFieldSubmitted: widget.onFieldSubmitted,
obscureText: widget.isSecure),
),
)
: AppText(
Utils.convertToTitleCase(widget.dropDownText),
@ -224,3 +234,24 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
);
}
}
class TextEditingControllerHelper {
static insertText(TextEditingController controller, String textToInsert) {
final selection = controller.selection;
final cursorPosition = selection.base.offset;
if (cursorPosition < 0) {
controller.text += textToInsert;
return;
}
final text = controller.text;
final newText =
text.replaceRange(selection.start, selection.end, textToInsert);
controller.value = controller.value.copyWith(
text: newText,
selection: TextSelection.collapsed(
offset: selection.baseOffset + textToInsert.length,
),
);
}
}
Loading…
Cancel
Save