Medication availability

merge-requests/348/head
hussam al-habibeh 3 years ago
parent 1f52794185
commit d3868844de

File diff suppressed because it is too large Load Diff

@ -23,8 +23,7 @@ class PrescriptionsService extends BaseService {
hasError = false; hasError = false;
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
await baseAppClient.post(PRESCRIPTIONS, await baseAppClient.post(PRESCRIPTIONS, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
prescriptionsList.clear(); prescriptionsList.clear();
response['PatientPrescriptionList'].forEach((prescriptions) { response['PatientPrescriptionList'].forEach((prescriptions) {
prescriptionsList.add(Prescriptions.fromJson(prescriptions)); prescriptionsList.add(Prescriptions.fromJson(prescriptions));
@ -38,13 +37,10 @@ class PrescriptionsService extends BaseService {
Future getPrescriptionsOrders() async { Future getPrescriptionsOrders() async {
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
prescriptionsOrderList.clear(); prescriptionsOrderList.clear();
response['PatientER_GetPatientAllPresOrdersList'] response['PatientER_GetPatientAllPresOrdersList'].forEach((prescriptionsOrder) {
.forEach((prescriptionsOrder) { prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder));
prescriptionsOrderList
.add(PrescriptionsOrder.fromJson(prescriptionsOrder));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -53,8 +49,7 @@ class PrescriptionsService extends BaseService {
} }
RequestPrescriptionReport _requestPrescriptionReport = RequestPrescriptionReport _requestPrescriptionReport =
RequestPrescriptionReport( RequestPrescriptionReport(appointmentNo: 0, isDentalAllowedBackend: false);
appointmentNo: 0, isDentalAllowedBackend: false);
List<PrescriptionReport> prescriptionReportList = List(); List<PrescriptionReport> prescriptionReportList = List();
Future getPrescriptionReport({Prescriptions prescriptions}) async { Future getPrescriptionReport({Prescriptions prescriptions}) async {
@ -70,25 +65,19 @@ class PrescriptionsService extends BaseService {
_requestPrescriptionReport.episodeID = prescriptions.episodeID; _requestPrescriptionReport.episodeID = prescriptions.episodeID;
_requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo; _requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo;
await baseAppClient.post( await baseAppClient.post(prescriptions.isInOutPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT,
prescriptions.isInOutPatient
? GET_PRESCRIPTION_REPORT_ENH
: GET_PRESCRIPTION_REPORT,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
prescriptionReportList.clear(); prescriptionReportList.clear();
prescriptionReportEnhList.clear(); prescriptionReportEnhList.clear();
if (prescriptions.isInOutPatient) { if (prescriptions.isInOutPatient) {
response['ListPRM'].forEach((prescriptions) { response['ListPRM'].forEach((prescriptions) {
prescriptionReportList prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions));
.add(PrescriptionReport.fromJson(prescriptions)); prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions));
prescriptionReportEnhList
.add(PrescriptionReportEnh.fromJson(prescriptions));
}); });
} else { } else {
prescriptionReportListINP.clear(); prescriptionReportListINP.clear();
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) { response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
prescriptionReportListINP prescriptionReportListINP.add(PrescriptionReportINP.fromJson(prescriptions));
.add(PrescriptionReportINP.fromJson(prescriptions));
}); });
} }
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
@ -97,13 +86,12 @@ class PrescriptionsService extends BaseService {
}, body: _requestPrescriptionReport.toJson()); }, body: _requestPrescriptionReport.toJson());
} }
RequestSendPrescriptionEmail _requestSendPrescriptionEmail = RequestSendPrescriptionEmail _requestSendPrescriptionEmail = RequestSendPrescriptionEmail(
RequestSendPrescriptionEmail(
isDentalAllowedBackend: false, isDentalAllowedBackend: false,
); );
Future sendPrescriptionEmail(String appointmentDate, int patientID, Future sendPrescriptionEmail(
String clinicName, String doctorName, int doctorID, int projectID) async { String appointmentDate, int patientID, String clinicName, String doctorName, int doctorID, int projectID) async {
_requestSendPrescriptionEmail.listPrescriptions = prescriptionReportList; _requestSendPrescriptionEmail.listPrescriptions = prescriptionReportList;
_requestSendPrescriptionEmail.appointmentDate = appointmentDate; _requestSendPrescriptionEmail.appointmentDate = appointmentDate;
_requestSendPrescriptionEmail.patientID = patientID; _requestSendPrescriptionEmail.patientID = patientID;
@ -112,25 +100,21 @@ class PrescriptionsService extends BaseService {
_requestSendPrescriptionEmail.projectID = projectID; _requestSendPrescriptionEmail.projectID = projectID;
_requestSendPrescriptionEmail.to = user.emailAddress; _requestSendPrescriptionEmail.to = user.emailAddress;
_requestSendPrescriptionEmail.dateofBirth = user.dateofBirth; _requestSendPrescriptionEmail.dateofBirth = user.dateofBirth;
_requestSendPrescriptionEmail.patientIditificationNum = _requestSendPrescriptionEmail.patientIditificationNum = user.patientIdentificationNo;
user.patientIdentificationNo;
_requestSendPrescriptionEmail.patientMobileNumber = user.mobileNumber; _requestSendPrescriptionEmail.patientMobileNumber = user.mobileNumber;
_requestSendPrescriptionEmail.doctorID = doctorID; _requestSendPrescriptionEmail.doctorID = doctorID;
_requestSendPrescriptionEmail.patientName = _requestSendPrescriptionEmail.patientName = user.firstName + " " + user.lastName;
user.firstName + " " + user.lastName;
_requestSendPrescriptionEmail.setupID = user.setupID; _requestSendPrescriptionEmail.setupID = user.setupID;
_requestSendPrescriptionEmail.to = user.emailAddress; _requestSendPrescriptionEmail.to = user.emailAddress;
hasError = false; hasError = false;
await baseAppClient await baseAppClient.post(SEND_PRESCRIPTION_EMAIL, onSuccess: (response, statusCode) {},
.post(SEND_PRESCRIPTION_EMAIL, onSuccess: (response, statusCode) {},
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: _requestSendPrescriptionEmail.toJson()); }, body: _requestSendPrescriptionEmail.toJson());
} }
RequestGetListPharmacyForPrescriptions RequestGetListPharmacyForPrescriptions requestGetListPharmacyForPrescriptions =
requestGetListPharmacyForPrescriptions =
RequestGetListPharmacyForPrescriptions( RequestGetListPharmacyForPrescriptions(
latitude: 0, latitude: 0,
longitude: 0, longitude: 0,
@ -141,12 +125,11 @@ class PrescriptionsService extends BaseService {
Future getListPharmacyForPrescriptions({int itemId}) async { Future getListPharmacyForPrescriptions({int itemId}) async {
hasError = false; hasError = false;
requestGetListPharmacyForPrescriptions.itemID = itemId; requestGetListPharmacyForPrescriptions.itemID = itemId;
await baseAppClient.post(GET_PHARMACY_LIST, pharmacyPrescriptionsList.clear();
onSuccess: (dynamic response, int statusCode) { await baseAppClient.post(GET_PHARMACY_LIST, onSuccess: (dynamic response, int statusCode) {
pharmacyPrescriptionsList.clear(); pharmacyPrescriptionsList.clear();
response['PharmList'].forEach((prescriptions) { response['PharmList'].forEach((prescriptions) {
pharmacyPrescriptionsList pharmacyPrescriptionsList.add(PharmacyPrescriptions.fromJson(prescriptions));
.add(PharmacyPrescriptions.fromJson(prescriptions));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -154,15 +137,13 @@ class PrescriptionsService extends BaseService {
}, body: requestGetListPharmacyForPrescriptions.toJson()); }, body: requestGetListPharmacyForPrescriptions.toJson());
} }
RequestPrescriptionReportEnh _requestPrescriptionReportEnh = RequestPrescriptionReportEnh _requestPrescriptionReportEnh = RequestPrescriptionReportEnh(
RequestPrescriptionReportEnh(
isDentalAllowedBackend: false, isDentalAllowedBackend: false,
); );
List<PrescriptionReportEnh> prescriptionReportEnhList = List(); List<PrescriptionReportEnh> prescriptionReportEnhList = List();
Future getPrescriptionReportEnh( Future getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder}) async {
{PrescriptionsOrder prescriptionsOrder}) async {
///This logic copy from the old app from class [order-history.component.ts] in line 45 ///This logic copy from the old app from class [order-history.component.ts] in line 45
bool isInPatient = false; bool isInPatient = false;
prescriptionsList.forEach((element) { prescriptionsList.forEach((element) {
@ -177,8 +158,7 @@ class PrescriptionsService extends BaseService {
isInPatient = element.isInOutPatient; isInPatient = element.isInOutPatient;
} }
} else { } else {
if (int.parse(prescriptionsOrder.appointmentNo) == if (int.parse(prescriptionsOrder.appointmentNo) == element.appointmentNo) {
element.appointmentNo) {
_requestPrescriptionReportEnh.appointmentNo = element.appointmentNo; _requestPrescriptionReportEnh.appointmentNo = element.appointmentNo;
_requestPrescriptionReportEnh.clinicID = element.clinicID; _requestPrescriptionReportEnh.clinicID = element.clinicID;
_requestPrescriptionReportEnh.projectID = element.projectID; _requestPrescriptionReportEnh.projectID = element.projectID;
@ -194,20 +174,17 @@ class PrescriptionsService extends BaseService {
hasError = false; hasError = false;
await baseAppClient.post( await baseAppClient.post(isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT,
isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
prescriptionReportEnhList.clear(); prescriptionReportEnhList.clear();
if (isInPatient) { if (isInPatient) {
response['ListPRM'].forEach((prescriptions) { response['ListPRM'].forEach((prescriptions) {
prescriptionReportEnhList prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions));
.add(PrescriptionReportEnh.fromJson(prescriptions));
}); });
} else { } else {
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) { response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
PrescriptionReportEnh reportEnh = PrescriptionReportEnh reportEnh = PrescriptionReportEnh.fromJson(prescriptions);
PrescriptionReportEnh.fromJson(prescriptions);
reportEnh.itemDescription = prescriptions['ItemDescriptionN']; reportEnh.itemDescription = prescriptions['ItemDescriptionN'];
prescriptionReportEnhList.add(reportEnh); prescriptionReportEnhList.add(reportEnh);
}); });
@ -226,8 +203,7 @@ class PrescriptionsService extends BaseService {
body['RejectionReason'] = ''; body['RejectionReason'] = '';
body['PresOrderStatus'] = 4; body['PresOrderStatus'] = 4;
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
await baseAppClient.post(UPDATE_PRESS_ORDER, await baseAppClient.post(UPDATE_PRESS_ORDER, onSuccess: (dynamic response, int statusCode) {},
onSuccess: (dynamic response, int statusCode) {},
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;

@ -19,25 +19,18 @@ class PrescriptionsViewModel extends BaseViewModel {
List<PrescriptionsList> _prescriptionsOrderListClinic = List(); List<PrescriptionsList> _prescriptionsOrderListClinic = List();
List<PrescriptionsList> _prescriptionsOrderListHospital = List(); List<PrescriptionsList> _prescriptionsOrderListHospital = List();
List<PrescriptionReport> get prescriptionReportList => List<PrescriptionReport> get prescriptionReportList => _prescriptionsService.prescriptionReportList;
_prescriptionsService.prescriptionReportList;
List<PrescriptionReportINP> get prescriptionReportListINP => List<PrescriptionReportINP> get prescriptionReportListINP => _prescriptionsService.prescriptionReportListINP;
_prescriptionsService.prescriptionReportListINP;
List<Prescriptions> get prescriptionsList => List<Prescriptions> get prescriptionsList => _prescriptionsService.prescriptionsList;
_prescriptionsService.prescriptionsList;
List<PrescriptionsOrder> get prescriptionsHistory => List<PrescriptionsOrder> get prescriptionsHistory => _prescriptionsService.prescriptionsOrderList;
_prescriptionsService.prescriptionsOrderList;
List<PharmacyPrescriptions> get pharmacyPrescriptionsList => List<PharmacyPrescriptions> get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList;
_prescriptionsService.pharmacyPrescriptionsList;
List<PrescriptionsList> get prescriptionsOrderList => List<PrescriptionsList> get prescriptionsOrderList =>
filterType == FilterType.Clinic filterType == FilterType.Clinic ? _prescriptionsOrderListClinic : _prescriptionsOrderListHospital;
? _prescriptionsOrderListClinic
: _prescriptionsOrderListHospital;
getPrescriptions() async { getPrescriptions() async {
setState(ViewState.Busy); setState(ViewState.Busy);
@ -55,38 +48,32 @@ class PrescriptionsViewModel extends BaseViewModel {
void _filterList() { void _filterList() {
_prescriptionsService.prescriptionsList.forEach((element) { _prescriptionsService.prescriptionsList.forEach((element) {
/// PrescriptionsList list sort clinic /// PrescriptionsList list sort clinic
List<PrescriptionsList> prescriptionsByClinic = List<PrescriptionsList> prescriptionsByClinic = _prescriptionsOrderListClinic
_prescriptionsOrderListClinic .where((elementClinic) => elementClinic.filterName == element.clinicDescription)
.where((elementClinic) =>
elementClinic.filterName == element.clinicDescription)
.toList(); .toList();
if (prescriptionsByClinic.length != 0) { if (prescriptionsByClinic.length != 0) {
_prescriptionsOrderListClinic[ _prescriptionsOrderListClinic[_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])]
_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])]
.prescriptionsList .prescriptionsList
.add(element); .add(element);
} else { } else {
_prescriptionsOrderListClinic.add(PrescriptionsList( _prescriptionsOrderListClinic
filterName: element.clinicDescription, prescriptions: element)); .add(PrescriptionsList(filterName: element.clinicDescription, prescriptions: element));
} }
/// PrescriptionsList list sort via hospital /// PrescriptionsList list sort via hospital
List<PrescriptionsList> prescriptionsByHospital = List<PrescriptionsList> prescriptionsByHospital = _prescriptionsOrderListHospital
_prescriptionsOrderListHospital
.where( .where(
(elementClinic) => elementClinic.filterName == element.name, (elementClinic) => elementClinic.filterName == element.name,
) )
.toList(); .toList();
if (prescriptionsByHospital.length != 0) { if (prescriptionsByHospital.length != 0) {
_prescriptionsOrderListHospital[_prescriptionsOrderListHospital _prescriptionsOrderListHospital[_prescriptionsOrderListHospital.indexOf(prescriptionsByHospital[0])]
.indexOf(prescriptionsByHospital[0])]
.prescriptionsList .prescriptionsList
.add(element); .add(element);
} else { } else {
_prescriptionsOrderListHospital.add(PrescriptionsList( _prescriptionsOrderListHospital.add(PrescriptionsList(filterName: element.name, prescriptions: element));
filterName: element.name, prescriptions: element));
} }
}); });
} }
@ -108,8 +95,7 @@ class PrescriptionsViewModel extends BaseViewModel {
getPrescriptionReport({Prescriptions prescriptions}) async { getPrescriptionReport({Prescriptions prescriptions}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReport( await _prescriptionsService.getPrescriptionReport(prescriptions: prescriptions);
prescriptions: prescriptions);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -127,8 +113,8 @@ class PrescriptionsViewModel extends BaseViewModel {
String mes, String mes,
int projectID}) async { int projectID}) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _prescriptionsService.sendPrescriptionEmail(appointmentDate, await _prescriptionsService.sendPrescriptionEmail(
patientID, clinicName, doctorName, doctorID, projectID); appointmentDate, patientID, clinicName, doctorName, doctorID, projectID);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -144,19 +130,17 @@ class PrescriptionsViewModel extends BaseViewModel {
await _prescriptionsService.getListPharmacyForPrescriptions(itemId: itemId); await _prescriptionsService.getListPharmacyForPrescriptions(itemId: itemId);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.Error); setState(ViewState.ErrorLocal);
} else { } else {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
List<PrescriptionReportEnh> get prescriptionReportEnhList => List<PrescriptionReportEnh> get prescriptionReportEnhList => _prescriptionsService.prescriptionReportEnhList;
_prescriptionsService.prescriptionReportEnhList;
getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder}) async { getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReportEnh( await _prescriptionsService.getPrescriptionReportEnh(prescriptionsOrder: prescriptionsOrder);
prescriptionsOrder: prescriptionsOrder);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.Error); setState(ViewState.Error);

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_inp.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -11,19 +12,59 @@ import 'package:url_launcher/url_launcher.dart';
class PharmacyForPrescriptionsPage extends StatelessWidget { class PharmacyForPrescriptionsPage extends StatelessWidget {
final itemID; final itemID;
final PrescriptionReport prescriptionReport;
PharmacyForPrescriptionsPage({Key key, this.itemID}); PharmacyForPrescriptionsPage({Key key, this.itemID, this.prescriptionReport});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<PrescriptionsViewModel>( return BaseView<PrescriptionsViewModel>(
onModelReady: (model) => onModelReady: (model) => model.getListPharmacyForPrescriptions(itemId: itemID),
model.getListPharmacyForPrescriptions(itemId: itemID),
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: TranslationBase.of(context).availability, appBarTitle: TranslationBase.of(context).availability,
baseViewModel: model, baseViewModel: model,
body: ListView.builder( body: Column(
children: [
Container(
width: double.infinity,
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(color: Colors.grey[200], width: 0.5),
),
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network(
prescriptionReport.imageSRCUrl,
fit: BoxFit.cover,
width: 60,
height: 70,
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Texts(prescriptionReport.itemDescription.isNotEmpty
? prescriptionReport.itemDescription
: prescriptionReport.itemDescriptionN ?? ''),
),
),
)
],
),
),
model.pharmacyPrescriptionsList.isNotEmpty == true
? ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemBuilder: (context, index) => Container( itemBuilder: (context, index) => Container(
width: double.infinity, width: double.infinity,
margin: EdgeInsets.only(top: 10, left: 10, right: 10), margin: EdgeInsets.only(top: 10, left: 10, right: 10),
@ -52,8 +93,7 @@ class PharmacyForPrescriptionsPage extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Texts(model.pharmacyPrescriptionsList[index] Texts(model.pharmacyPrescriptionsList[index].locationDescription),
.locationDescription),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
@ -65,10 +105,8 @@ class PharmacyForPrescriptionsPage extends StatelessWidget {
InkWell( InkWell(
onTap: () { onTap: () {
MapsLauncher.launchCoordinates( MapsLauncher.launchCoordinates(
double.parse( double.parse(model.pharmacyPrescriptionsList[index].latitude),
model.pharmacyPrescriptionsList[index].latitude), double.parse(model.pharmacyPrescriptionsList[index].longitude));
double.parse(
model.pharmacyPrescriptionsList[index].longitude));
}, },
child: Icon( child: Icon(
Icons.pin_drop, Icons.pin_drop,
@ -81,8 +119,7 @@ class PharmacyForPrescriptionsPage extends StatelessWidget {
), ),
InkWell( InkWell(
onTap: Feedback.wrapForTap(() { onTap: Feedback.wrapForTap(() {
launch( launch("tel://${model.pharmacyPrescriptionsList[index].phoneNumber}");
"tel://${model.pharmacyPrescriptionsList[index].phoneNumber}");
}, context), }, context),
child: Container( child: Container(
child: Icon( child: Icon(
@ -96,6 +133,15 @@ class PharmacyForPrescriptionsPage extends StatelessWidget {
), ),
), ),
itemCount: model.pharmacyPrescriptionsList.length, itemCount: model.pharmacyPrescriptionsList.length,
)
: Padding(
padding: const EdgeInsets.only(top: 65.0),
child: Texts(
TranslationBase.of(context).thisItemIsNotAvailable,
textAlign: TextAlign.center,
),
),
],
), ),
), ),
); );

@ -51,8 +51,7 @@ class PrescriptionDetailsPageINP extends StatelessWidget {
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Center( child: Center(
child: Texts( child: Texts(prescriptionReport.itemDescription.isNotEmpty
prescriptionReport.itemDescription.isNotEmpty
? prescriptionReport.itemDescription ? prescriptionReport.itemDescription
: prescriptionReport.itemDescriptionN ?? ''), : prescriptionReport.itemDescriptionN ?? ''),
), ),
@ -71,7 +70,8 @@ class PrescriptionDetailsPageINP extends StatelessWidget {
context, context,
FadePage( FadePage(
page: PharmacyForPrescriptionsPage( page: PharmacyForPrescriptionsPage(
itemID: prescriptionReport.itemID), itemID: prescriptionReport.itemID,
),
), ),
), ),
child: Center( child: Center(
@ -79,9 +79,7 @@ class PrescriptionDetailsPageINP extends StatelessWidget {
children: <Widget>[ children: <Widget>[
Container( Container(
width: 50, width: 50,
decoration: BoxDecoration( decoration: BoxDecoration(color: Colors.white, shape: BoxShape.rectangle),
color: Colors.white,
shape: BoxShape.rectangle),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Icon( Icon(
@ -108,9 +106,7 @@ class PrescriptionDetailsPageINP extends StatelessWidget {
color: Colors.white, color: Colors.white,
margin: EdgeInsets.only(top: 10, left: 10, right: 10), margin: EdgeInsets.only(top: 10, left: 10, right: 10),
child: Table( child: Table(
border: TableBorder.symmetric( border: TableBorder.symmetric(inside: BorderSide(width: 0.5), outside: BorderSide(width: 0.5)),
inside: BorderSide(width: 0.5),
outside: BorderSide(width: 0.5)),
children: [ children: [
TableRow( TableRow(
children: [ children: [
@ -159,28 +155,22 @@ class PrescriptionDetailsPageINP extends StatelessWidget {
color: Colors.white, color: Colors.white,
height: 50, height: 50,
width: double.infinity, width: double.infinity,
child: Center( child: Center(child: Text(prescriptionReport.routeN ?? ''))),
child: Text(prescriptionReport.routeN ?? ''))),
Container( Container(
color: Colors.white, color: Colors.white,
height: 50, height: 50,
width: double.infinity, width: double.infinity,
child: Center( child: Center(child: Text(prescriptionReport.frequencyN ?? ''))),
child:
Text(prescriptionReport.frequencyN ?? ''))),
Container( Container(
color: Colors.white, color: Colors.white,
height: 50, height: 50,
width: double.infinity, width: double.infinity,
child: Center( child: Center(child: Text('${prescriptionReport.doseDailyQuantity}'))),
child: Text(
'${prescriptionReport.doseDailyQuantity}'))),
Container( Container(
color: Colors.white, color: Colors.white,
height: 50, height: 50,
width: double.infinity, width: double.infinity,
child: child: Center(child: Text('${prescriptionReport.days}')))
Center(child: Text('${prescriptionReport.days}')))
], ],
), ),
], ],
@ -222,18 +212,15 @@ class PrescriptionDetailsPageINP extends StatelessWidget {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
DateTime startDate = DateTime.now(); DateTime startDate = DateTime.now();
DateTime endDate = DateTime(startDate.year, startDate.month, DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days);
startDate.day + prescriptionReport.days);
print(prescriptionReport); print(prescriptionReport);
showGeneralDialog( showGeneralDialog(
barrierColor: Colors.black.withOpacity(0.5), barrierColor: Colors.black.withOpacity(0.5),
transitionBuilder: (context, a1, a2, widget) { transitionBuilder: (context, a1, a2, widget) {
final curvedValue = final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0;
Curves.easeInOutBack.transform(a1.value) - 1.0;
return Transform( return Transform(
transform: transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
child: Opacity( child: Opacity(
opacity: a1.value, opacity: a1.value,
child: ReminderDialog( child: ReminderDialog(
@ -241,8 +228,7 @@ class PrescriptionDetailsPageINP extends StatelessWidget {
title: "Prescription Reminder", title: "Prescription Reminder",
description: description:
"${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ",
startDate: startDate: "/Date(${startDate.millisecondsSinceEpoch}+0300)/",
"/Date(${startDate.millisecondsSinceEpoch}+0300)/",
endDate: "/Date(${endDate.millisecondsSinceEpoch}+0300)/", endDate: "/Date(${endDate.millisecondsSinceEpoch}+0300)/",
location: prescriptionReport.remarks, location: prescriptionReport.remarks,
), ),
@ -262,10 +248,10 @@ class PrescriptionDetailsPageINP extends StatelessWidget {
// height: 100.0, // height: 100.0,
margin: EdgeInsets.all(7.0), margin: EdgeInsets.all(7.0),
padding: EdgeInsets.only(bottom: 4.0), padding: EdgeInsets.only(bottom: 4.0),
decoration: BoxDecoration(boxShadow: [ decoration: BoxDecoration(
BoxShadow( boxShadow: [BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0)],
color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0) borderRadius: BorderRadius.circular(10),
], borderRadius: BorderRadius.circular(10), color: Colors.white), color: Colors.white),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -274,31 +260,20 @@ class PrescriptionDetailsPageINP extends StatelessWidget {
margin: EdgeInsets.fromLTRB(5.0, 5.0, 5.0, 0.0), margin: EdgeInsets.fromLTRB(5.0, 5.0, 5.0, 0.0),
child: Text("add", child: Text("add",
overflow: TextOverflow.clip, overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(color: new Color(0xffB8382C), letterSpacing: 1.0, fontSize: 18.0)),
color: new Color(0xffB8382C),
letterSpacing: 1.0,
fontSize: 18.0)),
), ),
Container( Container(
margin: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0), margin: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0),
child: Text("reminder", child: Text("reminder",
overflow: TextOverflow.clip, overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(color: Colors.black, letterSpacing: 1.0, fontSize: 15.0)),
color: Colors.black,
letterSpacing: 1.0,
fontSize: 15.0)),
), ),
Container( Container(
alignment: projectViewModel.isArabic alignment: projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight,
? Alignment.bottomLeft
: Alignment.bottomRight,
margin: projectViewModel.isArabic margin: projectViewModel.isArabic
? EdgeInsets.fromLTRB(10.0, 7.0, 0.0, 8.0) ? EdgeInsets.fromLTRB(10.0, 7.0, 0.0, 8.0)
: EdgeInsets.fromLTRB(0.0, 7.0, 10.0, 8.0), : EdgeInsets.fromLTRB(0.0, 7.0, 10.0, 8.0),
child: Image.asset( child: Image.asset("assets/images/new-design/reminder_icon.png", width: 45.0, height: 45.0),
"assets/images/new-design/reminder_icon.png",
width: 45.0,
height: 45.0),
), ),
], ],
), ),

@ -50,8 +50,7 @@ class PrescriptionDetailsPage extends StatelessWidget {
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Center( child: Center(
child: Texts( child: Texts(prescriptionReport.itemDescription.isNotEmpty
prescriptionReport.itemDescription.isNotEmpty
? prescriptionReport.itemDescription ? prescriptionReport.itemDescription
: prescriptionReport.itemDescriptionN ?? ''), : prescriptionReport.itemDescriptionN ?? ''),
), ),
@ -70,7 +69,9 @@ class PrescriptionDetailsPage extends StatelessWidget {
context, context,
FadePage( FadePage(
page: PharmacyForPrescriptionsPage( page: PharmacyForPrescriptionsPage(
itemID: prescriptionReport.itemID), itemID: prescriptionReport.itemID,
prescriptionReport: prescriptionReport,
),
), ),
), ),
child: Center( child: Center(
@ -78,9 +79,7 @@ class PrescriptionDetailsPage extends StatelessWidget {
children: <Widget>[ children: <Widget>[
Container( Container(
width: 50, width: 50,
decoration: BoxDecoration( decoration: BoxDecoration(color: Colors.white, shape: BoxShape.rectangle),
color: Colors.white,
shape: BoxShape.rectangle),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Icon( Icon(
@ -107,9 +106,7 @@ class PrescriptionDetailsPage extends StatelessWidget {
color: Colors.white, color: Colors.white,
margin: EdgeInsets.only(top: 10, left: 10, right: 10), margin: EdgeInsets.only(top: 10, left: 10, right: 10),
child: Table( child: Table(
border: TableBorder.symmetric( border: TableBorder.symmetric(inside: BorderSide(width: 0.5), outside: BorderSide(width: 0.5)),
inside: BorderSide(width: 0.5),
outside: BorderSide(width: 0.5)),
children: [ children: [
TableRow( TableRow(
children: [ children: [
@ -158,28 +155,22 @@ class PrescriptionDetailsPage extends StatelessWidget {
color: Colors.white, color: Colors.white,
height: 50, height: 50,
width: double.infinity, width: double.infinity,
child: Center( child: Center(child: Text(prescriptionReport.routeN ?? ''))),
child: Text(prescriptionReport.routeN ?? ''))),
Container( Container(
color: Colors.white, color: Colors.white,
height: 50, height: 50,
width: double.infinity, width: double.infinity,
child: Center( child: Center(child: Text(prescriptionReport.frequencyN ?? ''))),
child:
Text(prescriptionReport.frequencyN ?? ''))),
Container( Container(
color: Colors.white, color: Colors.white,
height: 50, height: 50,
width: double.infinity, width: double.infinity,
child: Center( child: Center(child: Text('${prescriptionReport.doseDailyQuantity}'))),
child: Text(
'${prescriptionReport.doseDailyQuantity}'))),
Container( Container(
color: Colors.white, color: Colors.white,
height: 50, height: 50,
width: double.infinity, width: double.infinity,
child: child: Center(child: Text('${prescriptionReport.days}')))
Center(child: Text('${prescriptionReport.days}')))
], ],
), ),
], ],
@ -221,18 +212,15 @@ class PrescriptionDetailsPage extends StatelessWidget {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
DateTime startDate = DateTime.now(); DateTime startDate = DateTime.now();
DateTime endDate = DateTime(startDate.year, startDate.month, DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days);
startDate.day + prescriptionReport.days);
print(prescriptionReport); print(prescriptionReport);
showGeneralDialog( showGeneralDialog(
barrierColor: Colors.black.withOpacity(0.5), barrierColor: Colors.black.withOpacity(0.5),
transitionBuilder: (context, a1, a2, widget) { transitionBuilder: (context, a1, a2, widget) {
final curvedValue = final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0;
Curves.easeInOutBack.transform(a1.value) - 1.0;
return Transform( return Transform(
transform: transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
child: Opacity( child: Opacity(
opacity: a1.value, opacity: a1.value,
child: ReminderDialog( child: ReminderDialog(
@ -240,8 +228,7 @@ class PrescriptionDetailsPage extends StatelessWidget {
title: "Prescription Reminder", title: "Prescription Reminder",
description: description:
"${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ",
startDate: startDate: "/Date(${startDate.millisecondsSinceEpoch}+0300)/",
"/Date(${startDate.millisecondsSinceEpoch}+0300)/",
endDate: "/Date(${endDate.millisecondsSinceEpoch}+0300)/", endDate: "/Date(${endDate.millisecondsSinceEpoch}+0300)/",
location: prescriptionReport.remarks, location: prescriptionReport.remarks,
), ),
@ -261,10 +248,10 @@ class PrescriptionDetailsPage extends StatelessWidget {
// height: 100.0, // height: 100.0,
margin: EdgeInsets.all(7.0), margin: EdgeInsets.all(7.0),
padding: EdgeInsets.only(bottom: 4.0), padding: EdgeInsets.only(bottom: 4.0),
decoration: BoxDecoration(boxShadow: [ decoration: BoxDecoration(
BoxShadow( boxShadow: [BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0)],
color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0) borderRadius: BorderRadius.circular(10),
], borderRadius: BorderRadius.circular(10), color: Colors.white), color: Colors.white),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -273,31 +260,20 @@ class PrescriptionDetailsPage extends StatelessWidget {
margin: EdgeInsets.fromLTRB(5.0, 5.0, 5.0, 0.0), margin: EdgeInsets.fromLTRB(5.0, 5.0, 5.0, 0.0),
child: Text("add", child: Text("add",
overflow: TextOverflow.clip, overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(color: new Color(0xffB8382C), letterSpacing: 1.0, fontSize: 18.0)),
color: new Color(0xffB8382C),
letterSpacing: 1.0,
fontSize: 18.0)),
), ),
Container( Container(
margin: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0), margin: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0),
child: Text("reminder", child: Text("reminder",
overflow: TextOverflow.clip, overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(color: Colors.black, letterSpacing: 1.0, fontSize: 15.0)),
color: Colors.black,
letterSpacing: 1.0,
fontSize: 15.0)),
), ),
Container( Container(
alignment: projectViewModel.isArabic alignment: projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight,
? Alignment.bottomLeft
: Alignment.bottomRight,
margin: projectViewModel.isArabic margin: projectViewModel.isArabic
? EdgeInsets.fromLTRB(10.0, 7.0, 0.0, 8.0) ? EdgeInsets.fromLTRB(10.0, 7.0, 0.0, 8.0)
: EdgeInsets.fromLTRB(0.0, 7.0, 10.0, 8.0), : EdgeInsets.fromLTRB(0.0, 7.0, 10.0, 8.0),
child: Image.asset( child: Image.asset("assets/images/new-design/reminder_icon.png", width: 45.0, height: 45.0),
"assets/images/new-design/reminder_icon.png",
width: 45.0,
height: 45.0),
), ),
], ],
), ),

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save