Merge branch 'master' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into amjad_amireh
commit
6fb063bf48
@ -0,0 +1,138 @@
|
|||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
|
||||||
|
class SickLeave {
|
||||||
|
String setupID;
|
||||||
|
int projectID;
|
||||||
|
int patientID;
|
||||||
|
int patientType;
|
||||||
|
int clinicID;
|
||||||
|
int doctorID;
|
||||||
|
int requestNo;
|
||||||
|
DateTime requestDate;
|
||||||
|
int sickLeaveDays;
|
||||||
|
int appointmentNo;
|
||||||
|
int admissionNo;
|
||||||
|
int actualDoctorRate;
|
||||||
|
String appointmentDate;
|
||||||
|
String clinicName;
|
||||||
|
String doctorImageURL;
|
||||||
|
String doctorName;
|
||||||
|
int doctorRate;
|
||||||
|
String doctorTitle;
|
||||||
|
int gender;
|
||||||
|
String genderDescription;
|
||||||
|
bool isActiveDoctorProfile;
|
||||||
|
bool isDoctorAllowVedioCall;
|
||||||
|
bool isExecludeDoctor;
|
||||||
|
bool isInOutPatient;
|
||||||
|
String isInOutPatientDescription;
|
||||||
|
String isInOutPatientDescriptionN;
|
||||||
|
int noOfPatientsRate;
|
||||||
|
Null patientName;
|
||||||
|
String projectName;
|
||||||
|
String qR;
|
||||||
|
List<String> speciality;
|
||||||
|
|
||||||
|
SickLeave(
|
||||||
|
{this.setupID,
|
||||||
|
this.projectID,
|
||||||
|
this.patientID,
|
||||||
|
this.patientType,
|
||||||
|
this.clinicID,
|
||||||
|
this.doctorID,
|
||||||
|
this.requestNo,
|
||||||
|
this.requestDate,
|
||||||
|
this.sickLeaveDays,
|
||||||
|
this.appointmentNo,
|
||||||
|
this.admissionNo,
|
||||||
|
this.actualDoctorRate,
|
||||||
|
this.appointmentDate,
|
||||||
|
this.clinicName,
|
||||||
|
this.doctorImageURL,
|
||||||
|
this.doctorName,
|
||||||
|
this.doctorRate,
|
||||||
|
this.doctorTitle,
|
||||||
|
this.gender,
|
||||||
|
this.genderDescription,
|
||||||
|
this.isActiveDoctorProfile,
|
||||||
|
this.isDoctorAllowVedioCall,
|
||||||
|
this.isExecludeDoctor,
|
||||||
|
this.isInOutPatient,
|
||||||
|
this.isInOutPatientDescription,
|
||||||
|
this.isInOutPatientDescriptionN,
|
||||||
|
this.noOfPatientsRate,
|
||||||
|
this.patientName,
|
||||||
|
this.projectName,
|
||||||
|
this.qR,
|
||||||
|
this.speciality});
|
||||||
|
|
||||||
|
SickLeave.fromJson(Map<String, dynamic> json) {
|
||||||
|
setupID = json['SetupID'];
|
||||||
|
projectID = json['ProjectID'];
|
||||||
|
patientID = json['PatientID'];
|
||||||
|
patientType = json['PatientType'];
|
||||||
|
clinicID = json['ClinicID'];
|
||||||
|
doctorID = json['DoctorID'];
|
||||||
|
requestNo = json['RequestNo'];
|
||||||
|
requestDate = DateUtil.convertStringToDate(json['RequestDate']);
|
||||||
|
sickLeaveDays = json['SickLeaveDays'];
|
||||||
|
appointmentNo = json['AppointmentNo'];
|
||||||
|
admissionNo = json['AdmissionNo'];
|
||||||
|
actualDoctorRate = json['ActualDoctorRate'];
|
||||||
|
appointmentDate = json['AppointmentDate'];
|
||||||
|
clinicName = json['ClinicName'];
|
||||||
|
doctorImageURL = json['DoctorImageURL'];
|
||||||
|
doctorName = json['DoctorName'];
|
||||||
|
doctorRate = json['DoctorRate'];
|
||||||
|
doctorTitle = json['DoctorTitle'];
|
||||||
|
gender = json['Gender'];
|
||||||
|
genderDescription = json['GenderDescription'];
|
||||||
|
isActiveDoctorProfile = json['IsActiveDoctorProfile'];
|
||||||
|
isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall'];
|
||||||
|
isExecludeDoctor = json['IsExecludeDoctor'];
|
||||||
|
isInOutPatient = json['IsInOutPatient'];
|
||||||
|
isInOutPatientDescription = json['IsInOutPatientDescription'];
|
||||||
|
isInOutPatientDescriptionN = json['IsInOutPatientDescriptionN'];
|
||||||
|
noOfPatientsRate = json['NoOfPatientsRate'];
|
||||||
|
patientName = json['PatientName'];
|
||||||
|
projectName = json['ProjectName'];
|
||||||
|
qR = json['QR'];
|
||||||
|
speciality = json['Speciality'].cast<String>();
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['SetupID'] = this.setupID;
|
||||||
|
data['ProjectID'] = this.projectID;
|
||||||
|
data['PatientID'] = this.patientID;
|
||||||
|
data['PatientType'] = this.patientType;
|
||||||
|
data['ClinicID'] = this.clinicID;
|
||||||
|
data['DoctorID'] = this.doctorID;
|
||||||
|
data['RequestNo'] = this.requestNo;
|
||||||
|
data['RequestDate'] = DateUtil.convertDateToString(requestDate);
|
||||||
|
data['SickLeaveDays'] = this.sickLeaveDays;
|
||||||
|
data['AppointmentNo'] = this.appointmentNo;
|
||||||
|
data['AdmissionNo'] = this.admissionNo;
|
||||||
|
data['ActualDoctorRate'] = this.actualDoctorRate;
|
||||||
|
data['AppointmentDate'] = this.appointmentDate;
|
||||||
|
data['ClinicName'] = this.clinicName;
|
||||||
|
data['DoctorImageURL'] = this.doctorImageURL;
|
||||||
|
data['DoctorName'] = this.doctorName;
|
||||||
|
data['DoctorRate'] = this.doctorRate;
|
||||||
|
data['DoctorTitle'] = this.doctorTitle;
|
||||||
|
data['Gender'] = this.gender;
|
||||||
|
data['GenderDescription'] = this.genderDescription;
|
||||||
|
data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile;
|
||||||
|
data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall;
|
||||||
|
data['IsExecludeDoctor'] = this.isExecludeDoctor;
|
||||||
|
data['IsInOutPatient'] = this.isInOutPatient;
|
||||||
|
data['IsInOutPatientDescription'] = this.isInOutPatientDescription;
|
||||||
|
data['IsInOutPatientDescriptionN'] = this.isInOutPatientDescriptionN;
|
||||||
|
data['NoOfPatientsRate'] = this.noOfPatientsRate;
|
||||||
|
data['PatientName'] = this.patientName;
|
||||||
|
data['ProjectName'] = this.projectName;
|
||||||
|
data['QR'] = this.qR;
|
||||||
|
data['Speciality'] = this.speciality;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
class VaccinationItem {
|
||||||
|
String dESCRIPTION;
|
||||||
|
String iTEMCODE;
|
||||||
|
|
||||||
|
VaccinationItem({this.dESCRIPTION, this.iTEMCODE});
|
||||||
|
|
||||||
|
VaccinationItem.fromJson(Map<String, dynamic> json) {
|
||||||
|
dESCRIPTION = json['DESCRIPTION'];
|
||||||
|
iTEMCODE = json['ITEM_CODE'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['DESCRIPTION'] = this.dESCRIPTION;
|
||||||
|
data['ITEM_CODE'] = this.iTEMCODE;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
class VaccinationOnHand {
|
||||||
|
int distanceInKilometers;
|
||||||
|
int iTEMONHAND;
|
||||||
|
bool isThereItems;
|
||||||
|
String oRGANIZATIONCODE;
|
||||||
|
String oRGANIZATIONNAME;
|
||||||
|
String projectAlias;
|
||||||
|
int projectID;
|
||||||
|
String projectName;
|
||||||
|
|
||||||
|
VaccinationOnHand(
|
||||||
|
{this.distanceInKilometers,
|
||||||
|
this.iTEMONHAND,
|
||||||
|
this.isThereItems,
|
||||||
|
this.oRGANIZATIONCODE,
|
||||||
|
this.oRGANIZATIONNAME,
|
||||||
|
this.projectAlias,
|
||||||
|
this.projectID,
|
||||||
|
this.projectName});
|
||||||
|
|
||||||
|
VaccinationOnHand.fromJson(Map<String, dynamic> json) {
|
||||||
|
distanceInKilometers = json['DistanceInKilometers'];
|
||||||
|
iTEMONHAND = json['ITEM_ONHAND'];
|
||||||
|
isThereItems = json['IsThereItems'];
|
||||||
|
oRGANIZATIONCODE = json['ORGANIZATION_CODE'];
|
||||||
|
oRGANIZATIONNAME = json['ORGANIZATION_NAME'];
|
||||||
|
projectAlias = json['ProjectAlias'];
|
||||||
|
projectID = json['ProjectID'];
|
||||||
|
projectName = json['ProjectName'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['DistanceInKilometers'] = this.distanceInKilometers;
|
||||||
|
data['ITEM_ONHAND'] = this.iTEMONHAND;
|
||||||
|
data['IsThereItems'] = this.isThereItems;
|
||||||
|
data['ORGANIZATION_CODE'] = this.oRGANIZATIONCODE;
|
||||||
|
data['ORGANIZATION_NAME'] = this.oRGANIZATIONNAME;
|
||||||
|
data['ProjectAlias'] = this.projectAlias;
|
||||||
|
data['ProjectID'] = this.projectID;
|
||||||
|
data['ProjectName'] = this.projectName;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
import 'package:diplomaticquarterapp/config/config.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/sick_leave/sick_leave.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
||||||
|
|
||||||
|
class PatientSickLeaveService extends BaseService {
|
||||||
|
List<SickLeave> sickLeaveList = List();
|
||||||
|
|
||||||
|
getSickLeave() async {
|
||||||
|
hasError = false;
|
||||||
|
super.error = "";
|
||||||
|
await baseAppClient.post(GET_PATIENT_SICK_LEAVE,
|
||||||
|
onSuccess: (response, statusCode) async {
|
||||||
|
sickLeaveList.clear();
|
||||||
|
response['List_SickLeave'].forEach((sickLeave) {
|
||||||
|
sickLeaveList.add(SickLeave.fromJson(sickLeave));
|
||||||
|
});
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: Map());
|
||||||
|
}
|
||||||
|
|
||||||
|
sendSickLeaveEmail(
|
||||||
|
{int requestNo, String projectName, String doctorName, int projectID,String setupID}) async {
|
||||||
|
hasError = false;
|
||||||
|
super.error = "";
|
||||||
|
Map<String, dynamic> body = Map();
|
||||||
|
body['RequestNo'] = requestNo;
|
||||||
|
body['To'] = user.emailAddress;
|
||||||
|
body['DateofBirth'] = user.dateofBirth;
|
||||||
|
body['PatientIditificationNum'] = user.patientIdentificationNo;
|
||||||
|
body['PatientMobileNumber'] = user.mobileNumber;
|
||||||
|
body['PatientName'] = user.firstName + " " + user.firstName;
|
||||||
|
body['ProjectName'] = projectName;
|
||||||
|
body['DoctorName'] = doctorName;
|
||||||
|
body['ProjectID'] = 12;
|
||||||
|
body['SetupID'] = 12;
|
||||||
|
await baseAppClient
|
||||||
|
.post(SendSickLeaveEmail, onSuccess: (response, statusCode) async {},
|
||||||
|
onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: body);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/sick_leave/sick_leave.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/medical/PatientSickLeaveService.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/locator.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||||
|
|
||||||
|
class PatientSickLeaveViewMode extends BaseViewModel {
|
||||||
|
PatientSickLeaveService _patientSickLeaveService =
|
||||||
|
locator<PatientSickLeaveService>();
|
||||||
|
|
||||||
|
List<SickLeave> get sickLeaveList => _patientSickLeaveService.sickLeaveList;
|
||||||
|
|
||||||
|
getSickLeave() async {
|
||||||
|
setState(ViewState.Busy);
|
||||||
|
await _patientSickLeaveService.getSickLeave();
|
||||||
|
if (_patientSickLeaveService.hasError) {
|
||||||
|
error = _patientSickLeaveService.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else {
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future sendSickLeaveEmail(
|
||||||
|
{String message,
|
||||||
|
int requestNo,
|
||||||
|
String projectName,
|
||||||
|
String doctorName,int projectID,String setupID}) async {
|
||||||
|
setState(ViewState.Busy);
|
||||||
|
await _patientSickLeaveService.sendSickLeaveEmail(
|
||||||
|
requestNo: requestNo, projectName: projectName, doctorName: doctorName,projectID: projectID,setupID: setupID);
|
||||||
|
if (_patientSickLeaveService.hasError) {
|
||||||
|
error = _patientSickLeaveService.error;
|
||||||
|
setState(ViewState.ErrorLocal);
|
||||||
|
AppToast.showErrorToast(message: error);
|
||||||
|
} else {
|
||||||
|
AppToast.showSuccessToast(message: message);
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/patient_sick_leave_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
|
class PatientSickLeavePage extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_PatientSickLeavePageState createState() => _PatientSickLeavePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PatientSickLeavePageState extends State<PatientSickLeavePage> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<PatientSickLeaveViewMode>(
|
||||||
|
onModelReady: (model) => model.getSickLeave(),
|
||||||
|
builder: (_, model, w) => AppScaffold(
|
||||||
|
isShowAppBar: true,
|
||||||
|
appBarTitle: 'Sick Leave',
|
||||||
|
baseViewModel: model,
|
||||||
|
body: Container(
|
||||||
|
margin: EdgeInsets.all(12),
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: model.sickLeaveList.length,
|
||||||
|
itemBuilder: (context, index) => DoctorCard(
|
||||||
|
name: model.sickLeaveList[index].doctorName,
|
||||||
|
date: DateUtil.getMonthDayYearDateFormatted(
|
||||||
|
model.sickLeaveList[index].requestDate),
|
||||||
|
profileUrl: model.sickLeaveList[index].doctorImageURL,
|
||||||
|
rat: model.sickLeaveList[index].actualDoctorRate.toDouble(),
|
||||||
|
subName: model.sickLeaveList[index].projectName,
|
||||||
|
isInOutPatientDescription:
|
||||||
|
model.sickLeaveList[index].isInOutPatientDescription,
|
||||||
|
onEmailTap: () {
|
||||||
|
model.sendSickLeaveEmail(
|
||||||
|
message: TranslationBase.of(context).emailSentSuccessfully,
|
||||||
|
requestNo: model.sickLeaveList[index].requestNo,
|
||||||
|
doctorName: model.sickLeaveList[index].doctorName,
|
||||||
|
projectName: model.sickLeaveList[index].projectName,
|
||||||
|
setupID: model.sickLeaveList[index].setupID,
|
||||||
|
projectID: model.sickLeaveList[index].projectID);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,78 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:diplomaticquarterapp/config/size_config.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import '../base/base_view.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/vaccine_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart';
|
||||||
|
import 'package:popup_box/popup_box.dart';
|
||||||
|
|
||||||
|
class MyVaccinesItemPage extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_MyVaccinesItemPageState createState() => _MyVaccinesItemPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyVaccinesItemPageState extends State<MyVaccinesItemPage> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
ProjectViewModel projectViewModel = Provider.of(context);
|
||||||
|
return BaseView<VaccineViewModel>(
|
||||||
|
onModelReady: (model) => model.getMyVaccinationItem(),
|
||||||
|
builder: (BuildContext context, VaccineViewModel model, Widget child) =>
|
||||||
|
AppScaffold(
|
||||||
|
isShowAppBar: true,
|
||||||
|
appBarTitle: TranslationBase.of(context).myVaccinesAvailability,
|
||||||
|
baseViewModel: model,
|
||||||
|
body: Container(
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
left: SizeConfig.screenWidth * 0.004,
|
||||||
|
right: SizeConfig.screenWidth * 0.004,
|
||||||
|
top: SizeConfig.screenWidth * 0.04,
|
||||||
|
),
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: model.vaccinationItemList.length,
|
||||||
|
itemBuilder: (context, index) => InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
await model.getMyVaccinationOnHand(
|
||||||
|
pItemCode: model.vaccinationItemList[index].iTEMCODE);
|
||||||
|
if (model.hasError) {
|
||||||
|
AppToast.showErrorToast(message: model.error);
|
||||||
|
} else {
|
||||||
|
//TODO show dialog
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.all(5),
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
borderRadius: BorderRadius.circular(7),
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Texts(
|
||||||
|
model.vaccinationItemList[index].dESCRIPTION)),
|
||||||
|
Icon(projectViewModel.isArabic
|
||||||
|
? Icons.arrow_forward_ios
|
||||||
|
: Icons.arrow_back_ios)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue