Merge branch 'medical_report_changes' into 'development'

Medical report changes

See merge request Cloud_Solution/doctor_app_flutter!770
merge-requests/771/merge
Mohammad Aljammal 3 years ago
commit d63fa42178

@ -231,6 +231,7 @@ const GET_SPECIAL_CLINICAL_CARE_MAPPING_LIST = "Services/DoctorApplication.svc/R
const INSERT_MEDICAL_REPORT = "Services/Patients.svc/REST/DAPP_InsertMedicalReport_New";
const UPDATE_MEDICAL_REPORT = "Services/Patients.svc/REST/DAPP_UpdateMedicalReport";
const GET_SICK_LEAVE_DOCTOR_APP = "Services/DoctorApplication.svc/REST/GetAllSickLeaves";
var selectedPatientType = 1;

@ -0,0 +1,28 @@
class GetSickLeaveDoctorRequestModel {
int patientMRN;
String appointmentNo;
int status;
String vidaAuthTokenID;
String vidaRefreshTokenID;
GetSickLeaveDoctorRequestModel(
{this.patientMRN, this.appointmentNo, this.status, this.vidaAuthTokenID, this.vidaRefreshTokenID});
GetSickLeaveDoctorRequestModel.fromJson(Map<String, dynamic> json) {
patientMRN = json['PatientMRN'];
appointmentNo = json['AppointmentNo'];
status = json['status'];
vidaAuthTokenID = json['VidaAuthTokenID'];
vidaRefreshTokenID = json['VidaRefreshTokenID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['PatientMRN'] = this.patientMRN;
data['AppointmentNo'] = this.appointmentNo;
data['status'] = this.status;
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['VidaRefreshTokenID'] = this.vidaRefreshTokenID;
return data;
}
}

@ -36,6 +36,11 @@ class SickLeavePatientModel {
String strRequestDate;
String startDate;
String endDate;
dynamic isExtendedLeave;
dynamic noOfDays;
dynamic patientMRN;
dynamic remarks;
dynamic status;
SickLeavePatientModel(
{this.setupID,
@ -72,10 +77,19 @@ class SickLeavePatientModel {
// this.speciality,
this.strRequestDate,
this.startDate,
this.endDate});
this.endDate,
this.isExtendedLeave,
this.noOfDays,
this.patientMRN,
this.remarks,
this.status});
SickLeavePatientModel.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID'];
isExtendedLeave = json['isExtendedLeave'];
noOfDays = json['noOfDays'];
patientMRN = json['patientMRN'];
status = json['status'];
projectID = json['ProjectID'];
patientID = json['PatientID'];
@ -109,13 +123,17 @@ class SickLeavePatientModel {
qR = json['QR'];
// speciality = json['Speciality'].cast<String>();
strRequestDate = json['StrRequestDate'];
startDate = json['StartDate'];
startDate = json['StartDate'] ?? json['startDate'];
endDate = json['EndDate'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['SetupID'] = this.setupID;
data['status'] = this.status;
data['isExtendedLeave'] = this.isExtendedLeave;
data['noOfDays'] = this.noOfDays;
data['patientMRN'] = this.patientMRN;
data['ProjectID'] = this.projectID;
data['PatientID'] = this.patientID;

@ -10,6 +10,7 @@ class SickLeavePatientRequestModel {
int patientTypeID;
String tokenID;
int patientID;
int patientMRN;
String sessionID;
SickLeavePatientRequestModel(
@ -24,10 +25,12 @@ class SickLeavePatientRequestModel {
this.patientTypeID,
this.tokenID,
this.patientID,
this.sessionID});
this.sessionID,
this.patientMRN});
SickLeavePatientRequestModel.fromJson(Map<String, dynamic> json) {
versionID = json['VersionID'];
patientMRN = json['PatientMRN'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
@ -44,6 +47,7 @@ class SickLeavePatientRequestModel {
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['VersionID'] = this.versionID;
data['PatientMRN'] = this.patientMRN;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;

@ -1,4 +1,5 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_doctor_request_model.dart';
import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_patient_model.dart';
import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_patient_request_model.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
@ -21,8 +22,7 @@ class SickLeaveService extends BaseService {
List get coveringDoctorsList => _coveringDoctors;
List _coveringDoctors = [];
List<GetRescheduleLeavesResponse> get getAllRescheduleLeave =>
_getReScheduleLeave;
List<GetRescheduleLeavesResponse> get getAllRescheduleLeave => _getReScheduleLeave;
List<GetRescheduleLeavesResponse> _getReScheduleLeave = [];
dynamic get postReschedule => _postReschedule;
dynamic _postReschedule;
@ -31,9 +31,11 @@ class SickLeaveService extends BaseService {
dynamic _sickLeaveResponse;
List<SickLeavePatientModel> getAllSickLeavePatient = List();
List<SickLeavePatientModel> getAllSickLeaveDoctor = List();
//getAllSickLeavePatient.addAll(getAllSickLeaveDoctor);
SickLeavePatientRequestModel _sickLeavePatientRequestModel =
SickLeavePatientRequestModel();
SickLeavePatientRequestModel _sickLeavePatientRequestModel = SickLeavePatientRequestModel();
GetSickLeaveDoctorRequestModel _sickLeaveDoctorRequestModel = GetSickLeaveDoctorRequestModel();
Future getStatistics(appoNo, patientMRN) async {
hasError = false;
@ -56,6 +58,7 @@ class SickLeaveService extends BaseService {
// addSickLeaveRequest.appointmentNo = '2016054661';
// addSickLeaveRequest.patientMRN = '3120746';
hasError = false;
_sickLeaveResponse.clear();
await baseAppClient.post(
ADD_SICK_LEAVE,
onSuccess: (dynamic response, int statusCode) {
@ -73,8 +76,7 @@ class SickLeaveService extends BaseService {
Future extendSickLeave(GetAllSickLeaveResponse request) async {
var extendSickLeaveRequest = ExtendSickLeaveRequest();
extendSickLeaveRequest.patientMRN =
request.patientMRN.toString(); //'3120746';
extendSickLeaveRequest.patientMRN = request.patientMRN.toString(); //'3120746';
extendSickLeaveRequest.previousRequestNo = request.requestNo.toString();
extendSickLeaveRequest.noOfDays = request.noOfDays.toString();
extendSickLeaveRequest.remarks = request.remarks;
@ -114,8 +116,8 @@ class SickLeaveService extends BaseService {
}
Future getSickLeavePatient(patientMRN) async {
_sickLeavePatientRequestModel = SickLeavePatientRequestModel(
patientID: patientMRN, patientTypeID: 2, patientType: 1);
_sickLeavePatientRequestModel =
SickLeavePatientRequestModel(patientID: patientMRN, patientTypeID: 2, patientType: 1);
hasError = false;
getAllSickLeavePatient = [];
getAllSickLeavePatient.clear();
@ -136,6 +138,28 @@ class SickLeaveService extends BaseService {
);
}
Future getSickLeaveDoctor(patientMRN) async {
_sickLeaveDoctorRequestModel = GetSickLeaveDoctorRequestModel(patientMRN: patientMRN);
hasError = false;
getAllSickLeaveDoctor = [];
getAllSickLeaveDoctor.clear();
await baseAppClient.post(
GET_SICK_LEAVE_DOCTOR_APP,
onSuccess: (dynamic response, int statusCode) {
Future.value(response);
getAllSickLeaveDoctor.clear();
response['SickLeavesList']['entityList'].forEach((v) {
getAllSickLeaveDoctor.add(SickLeavePatientModel.fromJson(v));
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: _sickLeaveDoctorRequestModel.toJson(),
);
}
Future getRescheduleLeave() async {
hasError = false;
await baseAppClient.post(

@ -10,13 +10,17 @@ class SickLeaveViewModel extends BaseViewModel {
SickLeaveService _sickLeaveService = locator<SickLeaveService>();
get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics;
get getAllSIckLeave => _sickLeaveService.getAllSickLeave;
get getAllSIckLeavePatient => _sickLeaveService.getAllSickLeavePatient;
//get getAllSIckLeavePatient => _sickLeaveService.getAllSickLeavePatient;
get sickleaveResponse => _sickLeaveService.sickLeaveResponse;
List get allOffTime => _sickLeaveService.getOffTimeList;
List get allReasons => _sickLeaveService.getReasons;
List get coveringDoctors => _sickLeaveService.coveringDoctorsList;
List get sickLeaveDoctor => _sickLeaveService.getAllSickLeaveDoctor;
get getReschduleLeave => _sickLeaveService.getAllRescheduleLeave;
get postSechedule => _sickLeaveService.postReschedule;
get sickleaveResponse => _sickLeaveService.sickLeaveResponse;
get getAllSIckLeavePatient =>
[..._sickLeaveService.getAllSickLeavePatient, ..._sickLeaveService.getAllSickLeaveDoctor];
Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async {
setState(ViewState.Busy);
await _sickLeaveService.addSickLeave(addSickLeaveRequest);
@ -67,6 +71,16 @@ class SickLeaveViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getSickLeaveDoctor(patientMRN) async {
setState(ViewState.Busy);
await _sickLeaveService.getSickLeaveDoctor(patientMRN);
if (_sickLeaveService.hasError) {
error = _sickLeaveService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future getRescheduleLeave() async {
setState(ViewState.Busy);
await _sickLeaveService.getRescheduleLeave();

@ -43,7 +43,9 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
String txtOfMedicalReport;
return BaseView<PatientMedicalReportViewModel>(
onModelReady: (model) async {},
onModelReady: (model) async {
model.getMedicalReportTemplate();
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,

@ -28,8 +28,10 @@ class AddSickLeavScreen extends StatelessWidget {
patient = routeArgs['patient'];
bool isInpatient = routeArgs['isInpatient'];
return BaseView<SickLeaveViewModel>(
onModelReady: (model) =>
model.getSickLeavePatient(patient.patientMRN ?? patient.patientId),
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,
@ -61,22 +63,26 @@ class AddSickLeavScreen extends StatelessWidget {
),
],
)),
Container(
InkWell(
onTap: () {
openSickLeave(
context,
false,
);
},
child: Container(
width: SizeConfig.screenWidth,
margin: EdgeInsets.only(
left: 20, right: 20, top: 10, bottom: 10),
margin: EdgeInsets.only(left: 20, right: 20, top: 10, bottom: 10),
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: HexColor('#EAEAEA')),
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)),
decoration:
BoxDecoration(color: Colors.grey, borderRadius: BorderRadius.circular(10)),
padding: EdgeInsets.all(3),
child: IconButton(
icon: Icon(
@ -84,17 +90,16 @@ class AddSickLeavScreen extends StatelessWidget {
size: 35,
color: Colors.white,
),
onPressed: () {
openSickLeave(
context,
false,
);
}),
// onPressed: () {
// openSickLeave(
// context,
// false,
// );
// },
),
)),
Padding(
child: AppText(
TranslationBase.of(context)
.noSickLeaveApplied,
child: AppText(TranslationBase.of(context).noSickLeaveApplied,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 16,
@ -104,13 +109,13 @@ class AddSickLeavScreen extends StatelessWidget {
),
],
)),
),
],
)
: SizedBox(),
model.getAllSIckLeavePatient.length > 0
? Column(
children: model.getAllSIckLeavePatient
.map<Widget>((SickLeavePatientModel item) {
children: model.getAllSIckLeavePatient.map<Widget>((SickLeavePatientModel item) {
return RoundedContainer(
margin: EdgeInsets.all(10),
child: Column(
@ -129,8 +134,7 @@ class AddSickLeavScreen extends StatelessWidget {
// ))),
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment:
MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
flex: 4,
@ -139,13 +143,12 @@ class AddSickLeavScreen extends StatelessWidget {
// MainAxisAlignment.start,
children: <Widget>[
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
padding: EdgeInsets.all(3),
child: AppText(
item.doctorName,
item.doctorName ?? "",
// item.status == 1
// ? TranslationBase.of(
// context)
@ -158,8 +161,7 @@ class AddSickLeavScreen extends StatelessWidget {
// : TranslationBase
// .of(context)
// .all,
fontWeight:
FontWeight.bold,
fontWeight: FontWeight.bold,
// color: item.status == 1
// ? Colors.yellow[800]
// : item.status == 2
@ -170,34 +172,25 @@ class AddSickLeavScreen extends StatelessWidget {
),
Row(
children: [
AppText(TranslationBase
.of(context)
.daysSickleave +
": "),
AppText(TranslationBase.of(context).daysSickleave + ": "),
AppText(
item.sickLeaveDays
.toString(),
fontWeight:
FontWeight.bold,
item.sickLeaveDays ?? item.noOfDays.toString(),
fontWeight: FontWeight.bold,
),
],
),
Row(
children: [
AppText(
TranslationBase.of(
context)
.startDate +
' ',
TranslationBase.of(context).startDate + ' ' ?? "",
),
Flexible(
child: AppText(
AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils
.convertStringToDate(
item.startDate)),
fontWeight:
FontWeight.bold,
item.startDate.contains("/Date(")
? AppDateUtils.convertStringToDate(item.startDate)
: DateTime.parse(item.startDate)),
fontWeight: FontWeight.bold,
),
)
],
@ -205,42 +198,21 @@ class AddSickLeavScreen extends StatelessWidget {
Row(
children: [
AppText(
TranslationBase.of(context)
.endDate +
' ',
TranslationBase.of(context).endDate + ' ' ?? "",
),
Flexible(
child: AppText(
AppDateUtils
.getDayMonthYearDateFormatted(
AppDateUtils
.convertStringToDate(
item.endDate,
)),
fontWeight:
FontWeight.bold,
AppDateUtils.getDayMonthYearDateFormatted(
item.startDate.contains("/Date(")
? AppDateUtils.convertStringToDate(item.endDate)
.add(Duration(days: item.noOfDays))
: DateTime.parse(item.startDate)
.add(Duration(days: item.noOfDays))),
fontWeight: FontWeight.bold,
),
)
],
),
Row(children: [
AppText(TranslationBase.of(
context)
.branch +
": "),
AppText(
item.projectName ?? "",
),
]),
Row(children: [
AppText(TranslationBase.of(
context)
.clinic +
": "),
AppText(
item.clinicName ?? "",
),
]),
],
),
SizedBox(
@ -266,8 +238,7 @@ class AddSickLeavScreen extends StatelessWidget {
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
TranslationBase.of(context).noSickLeave),
child: AppText(TranslationBase.of(context).noSickLeave),
)
],
),
@ -276,8 +247,7 @@ class AddSickLeavScreen extends StatelessWidget {
]))));
}
openSickLeave(BuildContext context, isExtend,
{GetAllSickLeaveResponse extendedData}) {
openSickLeave(BuildContext context, isExtend, {GetAllSickLeaveResponse extendedData}) {
// showModalBottomSheet(
// context: context,
// builder: (context) {
@ -287,12 +257,9 @@ class AddSickLeavScreen extends StatelessWidget {
context,
FadePage(
page: SickLeaveScreen(
appointmentNo: isExtend == true
? extendedData.appointmentNo
: patient.appointmentNo, //extendedData.appointmentNo,
patientMRN: isExtend == true
? extendedData.patientMRN
: patient.patientMRN,
appointmentNo:
isExtend == true ? extendedData.appointmentNo : patient.appointmentNo, //extendedData.appointmentNo,
patientMRN: isExtend == true ? extendedData.patientMRN : patient.patientMRN,
isExtended: isExtend,
extendedData: extendedData,
patient: patient)));

@ -1,12 +1,14 @@
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';
@ -28,12 +30,7 @@ class SickLeaveScreen extends StatefulWidget {
final appointmentNo;
final patientMRN;
final patient;
SickLeaveScreen(
{this.appointmentNo,
this.patientMRN,
this.isExtended = false,
this.extendedData,
this.patient});
SickLeaveScreen({this.appointmentNo, this.patientMRN, this.isExtended = false, this.extendedData, this.patient});
@override
_SickLeaveScreenState createState() => _SickLeaveScreenState();
}
@ -76,8 +73,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
return BaseView<PatientViewModel>(
onModelReady: (model) => model.getClinicsList(),
builder: (_, model, w) => BaseView<SickLeaveViewModel>(
onModelReady: (model2) => model2.preSickLeaveStatistics(
widget.appointmentNo, widget.patientMRN),
onModelReady: (model2) => model2.preSickLeaveStatistics(widget.appointmentNo, widget.patientMRN),
builder: (_, model2, w) => GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(new FocusNode());
@ -108,44 +104,33 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
Container(
margin: EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
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: [
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Padding(
padding: EdgeInsets.only(
top: 5, left: 10, right: 10),
child: AppText(
TranslationBase.of(context)
.sickLeave +
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
child: AppText(TranslationBase.of(context).sickLeave +
' ' +
TranslationBase.of(context)
.days)),
TranslationBase.of(context).days)),
AppTextFormField(
borderColor: Colors.white,
onChanged: (value) {
addSickLeave.noOfDays = value;
if (widget.extendedData != null) {
widget.extendedData.noOfDays =
int.parse(value);
widget.extendedData.noOfDays = int.parse(value);
}
},
hintText: widget.extendedData != null
? widget.extendedData.noOfDays
.toString()
: '',
hintText:
widget.extendedData != null ? widget.extendedData.noOfDays.toString() : '',
// validator: (value) {
// return TextValidator().validateName(value);
// },
textInputType:TextInputType.number,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS)
]),
),
@ -155,129 +140,93 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
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")),
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,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(
top: 5, left: 10, right: 10),
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
child: AppText(
TranslationBase.of(context)
.sickLeaveDate,
TranslationBase.of(context).sickLeaveDate,
)),
AppTextFormField(
hintText: widget.extendedData != null
? widget.extendedData.startDate
: '',
hintText: widget.extendedData != null ? widget.extendedData.startDate : '',
borderColor: Colors.white,
prefix: IconButton(
icon: Icon(Icons.calendar_today)),
prefix: IconButton(icon: Icon(Icons.calendar_today)),
textInputType: TextInputType.number,
controller: _toDateController,
onTap: () {
_presentDatePicker(
'_selectedToDate');
_presentDatePicker('_selectedToDate');
},
inputFormatter: ONLY_DATE,
onChanged: (value) {
addSickLeave.startDate = value;
if (widget.extendedData != null) {
widget.extendedData.startDate =
value;
widget.extendedData.startDate = value;
}
}),
],
)),
Container(
margin: EdgeInsets.only(
top: 10, left: 10, right: 10),
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")),
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,
bottom: SizeConfig.widthMultiplier * 0.9,
right: SizeConfig.widthMultiplier * 3,
left: SizeConfig.widthMultiplier * 3),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(top: 5),
child: AppText(
TranslationBase.of(context)
.clinicName,
TranslationBase.of(context).clinicName,
)),
Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Expanded(
// add Expanded to have your dropdown button fill remaining space
child:
DropdownButtonHideUnderline(
child: DropdownButtonHideUnderline(
child: new IgnorePointer(
ignoring: true,
child: DropdownButton(
isExpanded: true,
value: getClinicName(
model) ??
"",
value: getClinicName(model) ?? "",
iconSize: 0,
elevation: 16,
selectedItemBuilder:
(BuildContext
context) {
return model
.getClinicNameList()
.map((item) {
selectedItemBuilder: (BuildContext context) {
return model.getClinicNameList().map((item) {
return Row(
mainAxisSize:
MainAxisSize
.max,
children: <
Widget>[
mainAxisSize: MainAxisSize.max,
children: <Widget>[
AppText(
item,
fontSize:
SizeConfig.textMultiplier *
2.1,
color: Colors
.grey,
fontSize: SizeConfig.textMultiplier * 2.1,
color: Colors.grey,
),
],
);
}).toList();
},
onChanged:
(newValue) =>
{},
items: model
.getClinicNameList()
.map((item) {
onChanged: (newValue) => {},
items: model.getClinicNameList().map((item) {
return DropdownMenuItem(
value: item
.toString(),
value: item.toString(),
child: Text(
item,
textAlign:
TextAlign
.end,
textAlign: TextAlign.end,
),
);
}).toList(),
@ -288,13 +237,10 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
],
),
)),
model2.sickLeaveStatistics[
'recommendedSickLeaveDays'] !=
null
model2.sickLeaveStatistics['recommendedSickLeaveDays'] != null
? Padding(
child: AppText(
model2.sickLeaveStatistics[
'recommendedSickLeaveDays'],
model2.sickLeaveStatistics['recommendedSickLeaveDays'],
fontWeight: FontWeight.bold,
textAlign: TextAlign.start,
),
@ -306,10 +252,8 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
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")),
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
color: Colors.white,
),
padding: EdgeInsets.all(5),
@ -317,11 +261,9 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(
top: 5, left: 10, right: 10),
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
child: AppText(
TranslationBase.of(context)
.doctorName,
TranslationBase.of(context).doctorName,
)),
new IgnorePointer(
ignoring: true,
@ -343,10 +285,8 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
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")),
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
color: Colors.white,
),
padding: EdgeInsets.all(5),
@ -354,8 +294,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(
top: 5, left: 10, right: 10),
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
child: AppText(
TranslationBase.of(context).remarks,
)),
@ -364,9 +303,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
decoration: InputDecoration(
contentPadding: EdgeInsets.all(20.0),
border: InputBorder.none,
hintText: widget.extendedData != null
? widget.extendedData.remarks
: ''),
hintText: widget.extendedData != null ? widget.extendedData.remarks : ''),
onChanged: (value) {
addSickLeave.remarks = value;
if (widget.extendedData != null) {
@ -378,40 +315,60 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
),
),
Container(
margin: EdgeInsets.all(
SizeConfig.widthMultiplier * 5),
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,
: TranslationBase.of(context).addSickLeaverequest,
color: Colors.green,
onPressed: () async {
if (widget.isExtended) {
await model2.extendSickLeave(
widget.extendedData);
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
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 {
_validateInputs(model2);
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);
}
}
},
),
@ -437,26 +394,21 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
void _validateInputs(model2) async {
try {
if (addSickLeave.noOfDays == null) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseEnterNoOfDays);
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterNoOfDays);
} else if (addSickLeave.remarks == null) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseEnterRemarks);
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterRemarks);
} else if (addSickLeave.startDate == null) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseEnterDate);
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']);
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});
Navigator.of(context).pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
}
} catch (err) {
print(err);
@ -471,9 +423,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
}
getClinicName(model) {
var clinicInfo = model.clinicsList
.where((i) => i['ClinicID'] == this.profile['ClinicID'])
.toList();
var clinicInfo = model.clinicsList.where((i) => i['ClinicID'] == this.profile['ClinicID']).toList();
return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : "";
}
}

Loading…
Cancel
Save