Merge branch 'vaccine' into 'master'

edit on vaccine service

See merge request Cloud_Solution/diplomatic-quarter!42
merge-update-with-lab-changes
Mohammad Aljammal 5 years ago
commit fcc3a67ffb

@ -421,7 +421,7 @@ const Map<String, Map<String, String>> localizedValues = {
"MyVaccines": {"en": "My Vaccines", "ar": "تطعيماتي"}, "MyVaccines": {"en": "My Vaccines", "ar": "تطعيماتي"},
"MyVaccinesSubtitle": {"en": "List", "ar": "قائمة"}, "MyVaccinesSubtitle": {"en": "List", "ar": "قائمة"},
"Medical": {"en": "Medical", "ar": "التقارير"}, "Medical": {"en": "Medical", "ar": "التقارير"},
"MedicalSubtitle": {"Report": "List", "ar": "الطبية"}, "MedicalSubtitle": {"en": "Report", "ar": "الطبية"},
"Monthly": {"en": "Monthly", "ar": "تقارير"}, "Monthly": {"en": "Monthly", "ar": "تقارير"},
"MonthlySubtitle": {"en": "Report", "ar": "الشهرية"}, "MonthlySubtitle": {"en": "Report", "ar": "الشهرية"},
"Sick": {"en": "Sick", "ar": "الإجازات"}, "Sick": {"en": "Sick", "ar": "الإجازات"},

@ -1,91 +1,152 @@
class VaccineModel { class VaccineModel {
String to; String setupID;
String from; int projectID;
double versionID;
int channel;
int languageID;
String iPAdress;
String generalid;
int patientOutSA;
String sessionID;
bool isDentalAllowedBackend;
int deviceTypeID;
int patientID; int patientID;
String tokenID; int invoiceNo;
int patientTypeID; String procedureID;
int patientType; String vaccineName;
Null vaccineNameN;
String invoiceDate; String invoiceDate;
int doctorID;
int clinicID;
String firstName;
String middleName;
String lastName;
Null firstNameN;
Null middleNameN;
Null lastNameN;
String dateofBirth;
int actualDoctorRate;
String age;
String clinicName;
String doctorImageURL; String doctorImageURL;
String doctorName; String doctorName;
int doctorRate;
String doctorTitle; String doctorTitle;
int gender;
String genderDescription;
bool isActiveDoctorProfile;
bool isDoctorAllowVedioCall;
bool isExecludeDoctor;
int noOfPatientsRate;
String patientName;
String projectName; String projectName;
String vaccineName; String qR;
List<String> speciality;
String vaccinationDate;
VaccineModel({ VaccineModel(
this.to, {this.setupID,
this.from, this.projectID,
this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.patientOutSA,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID,
this.patientID, this.patientID,
this.tokenID, this.invoiceNo,
this.patientTypeID, this.procedureID,
this.patientType, this.vaccineName,
this.vaccineNameN,
this.invoiceDate, this.invoiceDate,
this.doctorID,
this.clinicID,
this.firstName,
this.middleName,
this.lastName,
this.firstNameN,
this.middleNameN,
this.lastNameN,
this.dateofBirth,
this.actualDoctorRate,
this.age,
this.clinicName,
this.doctorImageURL, this.doctorImageURL,
this.doctorName, this.doctorName,
this.doctorRate,
this.doctorTitle, this.doctorTitle,
this.gender,
this.genderDescription,
this.isActiveDoctorProfile,
this.isDoctorAllowVedioCall,
this.isExecludeDoctor,
this.noOfPatientsRate,
this.patientName,
this.projectName, this.projectName,
this.vaccineName, this.qR,
}); this.speciality,
this.vaccinationDate});
VaccineModel.fromJson(Map<String, dynamic> json) { VaccineModel.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID'];
projectID = json['ProjectID'];
patientID = json['PatientID'];
invoiceNo = json['InvoiceNo'];
procedureID = json['ProcedureID'];
vaccineName = json['VaccineName']; vaccineName = json['VaccineName'];
projectName = json['ProjectName']; vaccineNameN = json['VaccineNameN'];
doctorTitle = json['DoctorTitle'];
doctorName = json['DoctorName'];
doctorImageURL = json['DoctorImageURL'];
invoiceDate = json['InvoiceDate']; invoiceDate = json['InvoiceDate'];
to = json['To']; doctorID = json['DoctorID'];
from = json['From']; clinicID = json['ClinicID'];
versionID = json['VersionID']; firstName = json['FirstName'];
channel = json['Channel']; middleName = json['MiddleName'];
languageID = json['LanguageID']; lastName = json['LastName'];
iPAdress = json['IPAdress']; firstNameN = json['FirstNameN'];
generalid = json['generalid']; middleNameN = json['MiddleNameN'];
patientOutSA = json['PatientOutSA']; lastNameN = json['LastNameN'];
sessionID = json['SessionID']; dateofBirth = json['DateofBirth'];
isDentalAllowedBackend = json['isDentalAllowedBackend']; actualDoctorRate = json['ActualDoctorRate'];
deviceTypeID = json['DeviceTypeID']; age = json['Age'];
patientID = json['PatientID']; clinicName = json['ClinicName'];
tokenID = json['TokenID']; doctorImageURL = json['DoctorImageURL'];
patientTypeID = json['PatientTypeID']; doctorName = json['DoctorName'];
patientType = json['PatientType']; doctorRate = json['DoctorRate'];
doctorTitle = json['DoctorTitle'];
gender = json['Gender'];
genderDescription = json['GenderDescription'];
isActiveDoctorProfile = json['IsActiveDoctorProfile'];
isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall'];
isExecludeDoctor = json['IsExecludeDoctor'];
noOfPatientsRate = json['NoOfPatientsRate'];
patientName = json['PatientName'];
projectName = json['ProjectName'];
qR = json['QR'];
speciality = json['Speciality'].cast<String>();
vaccinationDate = json['VaccinationDate'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['To'] = this.to; data['SetupID'] = this.setupID;
data['From'] = this.from; data['ProjectID'] = this.projectID;
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['generalid'] = this.generalid;
data['PatientOutSA'] = this.patientOutSA;
data['SessionID'] = this.sessionID;
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['DeviceTypeID'] = this.deviceTypeID;
data['PatientID'] = this.patientID; data['PatientID'] = this.patientID;
data['TokenID'] = this.tokenID; data['InvoiceNo'] = this.invoiceNo;
data['PatientTypeID'] = this.patientTypeID; data['ProcedureID'] = this.procedureID;
data['PatientType'] = this.patientType; data['VaccineName'] = this.vaccineName;
data['VaccineNameN'] = this.vaccineNameN;
data['InvoiceDate'] = this.invoiceDate;
data['DoctorID'] = this.doctorID;
data['ClinicID'] = this.clinicID;
data['FirstName'] = this.firstName;
data['MiddleName'] = this.middleName;
data['LastName'] = this.lastName;
data['FirstNameN'] = this.firstNameN;
data['MiddleNameN'] = this.middleNameN;
data['LastNameN'] = this.lastNameN;
data['DateofBirth'] = this.dateofBirth;
data['ActualDoctorRate'] = this.actualDoctorRate;
data['Age'] = this.age;
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['NoOfPatientsRate'] = this.noOfPatientsRate;
data['PatientName'] = this.patientName;
data['ProjectName'] = this.projectName;
data['QR'] = this.qR;
data['Speciality'] = this.speciality;
data['VaccinationDate'] = this.vaccinationDate;
return data; return data;
} }
} }

@ -7,25 +7,10 @@ class VaccineService extends BaseService {
List<VaccineModel> get vaccineList => _vaccineList; List<VaccineModel> get vaccineList => _vaccineList;
VaccineModel _vaccineModel = VaccineModel(
to: "0",
from: "0",
channel: 3,
deviceTypeID: 2,
generalid: "Cs2020@2016\$2958",
iPAdress: "10.20.10.20",
isDentalAllowedBackend: false,
languageID: 2,
patientID: 1231755,
patientOutSA: 0,
patientType: 1,
patientTypeID: 1,
sessionID: "uoKFXSLUwEaHYPwKZNA",
tokenID: "@dm!n",
versionID: 5.5,
);
Future getMyVaccine() async { Future getMyVaccine() async {
Map<String, dynamic> body = Map();
body['To'] = "0";
body['From'] = "0";
hasError = false; hasError = false;
_vaccineList.clear(); _vaccineList.clear();
await baseAppClient.post(GET_VACCINES, await baseAppClient.post(GET_VACCINES,
@ -36,8 +21,28 @@ class VaccineService extends BaseService {
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: _vaccineModel.toJson()); }, body: body);
} }
Future sendEmail() async {} Future sendEmail() async {
Map<String, dynamic> body = Map();
body['ListVaccines'] = vaccineList.map((v) => v.toJson()).toList();
body['ListVaccines'] = user.emailAddress;
body['DateofBirth'] = user.dateofBirth;
body['PatientIditificationNum'] = user.patientIdentificationNo;
body['PatientMobileNumber'] = user.mobileNumber;
body['PatientName'] = user.firstName + " "+ user.lastName;
hasError = false;
await baseAppClient.post(GET_VACCINES,
onSuccess: (dynamic response, int statusCode) {
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
} }

@ -1,3 +1,5 @@
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'base_view_model.dart'; import 'base_view_model.dart';
import '../../locator.dart'; import '../../locator.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
@ -22,4 +24,18 @@ class VaccineViewModel extends BaseViewModel {
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future sendEmail({String message}) async {
hasError = false;
setState(ViewState.BusyLocal);
await _vaccineService.sendEmail();
if (_vaccineService.hasError) {
error = _vaccineService.error;
setState(ViewState.ErrorLocal);
AppToast.showErrorToast(message: error);
} else {
AppToast.showSuccessToast(message: message);
setState(ViewState.Idle);
}
}
} }

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.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:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart';
@ -39,6 +40,8 @@ class _InsuranceCardState extends State<InsuranceCard> {
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return RoundedContainer( return RoundedContainer(
backgroundColor: Colors.white, backgroundColor: Colors.white,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
@ -58,11 +61,23 @@ class _InsuranceCardState extends State<InsuranceCard> {
), ),
), ),
children: <Widget>[ children: <Widget>[
Divider( Container(
color: Colors.black, padding: EdgeInsets.all(14),
height: 25.0, width: double.infinity,
thickness: 0.5, decoration: BoxDecoration(
shape: BoxShape.rectangle,
border: Border.all(color: Colors.grey,width: 0.2),
borderRadius: BorderRadius.all(Radius.circular(2)),
boxShadow: [
BoxShadow(
color: Colors.white70,
),
]
), ),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts( Texts(
TranslationBase.of(context).companyName + TranslationBase.of(context).companyName +
model.insurance[index].companyName, model.insurance[index].companyName,
@ -120,15 +135,23 @@ class _InsuranceCardState extends State<InsuranceCard> {
), ),
if (model.insurance[index].isActive == true) if (model.insurance[index].isActive == true)
Container( Container(
child: Button( color: Colors.transparent,
child: SecondaryButton(
label: TranslationBase.of(context).seeDetails, label: TranslationBase.of(context).seeDetails,
textColor: Colors.white,
), ),
width: 400.0, width: double.infinity,
), ),
], ],
), ),
),
], ],
), ),
],
),
),
); );
}), }),
), ),

@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart';
@ -592,6 +593,10 @@ class _HomePageState extends State<HomePage> {
context, FadePage(page: AllHabibMedicalService())), context, FadePage(page: AllHabibMedicalService())),
), ),
DashboardItem( DashboardItem(
onTap: (){
Navigator.push(context, FadePage(page: FeedbackHomePage()));
},
child: Container( child: Container(
width: double.infinity, width: double.infinity,
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),

@ -1,15 +1,12 @@
import 'dart:typed_data';
import 'dart:convert';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import '../base/base_view.dart'; import '../base/base_view.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/core/viewModels/vaccine_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/vaccine_view_model.dart';
import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart';
import 'package:flutter_email_sender/flutter_email_sender.dart';
import 'package:popup_box/popup_box.dart'; import 'package:popup_box/popup_box.dart';
class MyVaccines extends StatefulWidget { class MyVaccines extends StatefulWidget {
@ -58,7 +55,8 @@ class _MyVaccinesState extends State<MyVaccines> {
children: <Widget>[ children: <Widget>[
Row( Row(
children: <Widget>[ children: <Widget>[
Column( Expanded(
child: Column(
children: <Widget>[ children: <Widget>[
Padding( Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
@ -78,7 +76,10 @@ class _MyVaccinesState extends State<MyVaccines> {
), ),
], ],
), ),
Container( flex: 2,
),
Expanded(
child: Container(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
@ -122,6 +123,8 @@ class _MyVaccinesState extends State<MyVaccines> {
], ],
), ),
), ),
flex: 5,
),
], ],
), ),
], ],
@ -134,30 +137,43 @@ class _MyVaccinesState extends State<MyVaccines> {
], ],
), ),
), ),
SpaceBetweenTexts(space: 165.0), // SpaceBetweenTexts(space: 165.0),
Flexible(
child: Container( ],
width: 350.0, ),
height: 80.0,
),
bottomSheet: Container(
color: Theme.of(context).scaffoldBackgroundColor,
padding: EdgeInsets.all(12),
height: MediaQuery.of(context).size.height *0.25,
width: double.infinity,
child: Column(
children: [
Divider(height: 2,thickness: 1,),
SizedBox(height: 6,),
Container(
width: double.infinity,
// height: 80.0,
child: Button( child: Button(
label: 'CHECK VACCINE AVAILABILITY', label: 'CHECK VACCINE AVAILABILITY',
backgroundColor: Color(0xff9EA3A4), backgroundColor: Color(0xff9EA3A4),
), ),
), ),
), Container(
Flexible( width: double.infinity,
child: Container( // height: 80.0,
width: 350.0, child: SecondaryButton(
height: 80.0,
child: Button(
label: 'SEND EMAIL', label: 'SEND EMAIL',
backgroundColor: Color(0xffF62426), color: Color(0xffF62426),
textColor: Colors.white,
disabled: model.vaccineList.length==0,
onTap: () async { onTap: () async {
await PopupBox.showPopupBox( await PopupBox.showPopupBox(
context: context, context: context,
button: MaterialButton( button: MaterialButton(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(3),
), ),
color: Colors.white, color: Colors.white,
child: Text( child: Text(
@ -186,135 +202,12 @@ class _MyVaccinesState extends State<MyVaccines> {
}, },
), ),
), ),
),
], ],
), ),
// child: ListView.builder(
// itemCount: model.vaccineList == null ? 0 : model.vaccineList.length,
// itemBuilder: (BuildContext context, int index) {
// return Column(
// children: <Widget>[
// RoundedContainer(
// backgroundColor: Colors.white,
// child: Column(
// children: <Widget>[
// ExpansionTile(
// title: Container(
// height: 60.0,
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: <Widget>[
// Texts('2018'),
// ],
// ),
// ),
// children: <Widget>[
// Column(
// children: <Widget>[
// Row(
// children: <Widget>[
// Column(
// children: <Widget>[
// Padding(
// padding: EdgeInsets.symmetric(
// horizontal: 20.0, vertical: 20.0),
// child: Container(
// child: Image.network(
// model.vaccineList[index]
// .doctorImageURL,
// height: SizeConfig
// .imageSizeMultiplier *
// 23,
// width: SizeConfig
// .imageSizeMultiplier *
// 20,
// fit: BoxFit.fill,
// colorBlendMode:
// BlendMode.hardLight,
// ),
// ),
// )
// ],
// ),
// Container(
// child: Column(
// mainAxisAlignment:
// MainAxisAlignment.start,
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: <Widget>[
// Text(
// model.vaccineList[index]
// .doctorTitle +
// model.vaccineList[index]
// .doctorName,
// style: TextStyle(
// fontWeight: FontWeight.w900,
// fontSize: 17.5),
// ),
// Text(
// model
// .vaccineList[index].projectName,
// style: TextStyle(
// fontSize: 19.0,
// letterSpacing: 0.3,
// color: Colors.grey,
// fontWeight: FontWeight.bold),
// ),
// Text(
// model
// .vaccineList[index].vaccineName,
// style: TextStyle(
// fontSize: 19.0,
// color: Colors.grey,
// fontWeight: FontWeight.bold),
// ),
// Text(
// 'Date Taken ' +
// convertDateFormat(model
// .vaccineList[index]
// .invoiceDate),
// style: TextStyle(
// fontSize: 19.0,
// color: Colors.grey,
// fontWeight: FontWeight.bold),
// ),
// ],
// ),
// ),
// ],
// ),
// ],
// ),
// ],
// ),
// ],
// ),
// ),
// Container(
// width: 300,
// child: Button(
// label: 'CHECK VACCINE AVAILABILITY',
// backgroundColor: Color(0xff9EA3A4),
// ),
// ),
// Container(
// width: 300,
// child: Button(
// label: 'SEND EMAIL',
// backgroundColor: Color(0xff9EA3A4),
// ),
// ),
// ],
// );
// },
// ),
), ),
), ),
); );
} }
convertDateFormat(String Date) { convertDateFormat(String Date) {
const start = "/Date("; const start = "/Date(";
const end = "+0300)"; const end = "+0300)";
@ -333,19 +226,7 @@ class _MyVaccinesState extends State<MyVaccines> {
return newDate.toString(); return newDate.toString();
} }
emailSender() async {
final Email email = Email(
body: 'Email body',
subject: 'Email subject',
recipients: ['example@example.com'],
cc: ['cc@example.com'],
bcc: ['bcc@example.com'],
attachmentPaths: ['/path/to/attachment.zip'],
isHTML: false,
);
await FlutterEmailSender.send(email);
}
} }
class SpaceBetweenTexts extends StatelessWidget { class SpaceBetweenTexts extends StatelessWidget {

Loading…
Cancel
Save