feedback Service done

merge-update-with-lab-changes
Mohammad Aljammal 5 years ago
parent 29768feefd
commit cfd5b2ccff

@ -30,6 +30,11 @@ const GET_PATIENT_ORDERS_DETAILS = '/Patients.svc/REST/Rad_UpdatePatientRadOrder
const GET_RAD_IMAGE_URL = '/Patients.svc/Rest/GetRadImageURL';
const SEND_RAD_REPORT_EMAIL = '/Notifications.svc/REST/SendRadReportEmail';
///Feedback
const SEND_FEEDBACK = '/COCWS.svc/REST/InsertCOCItemInSPList';
const GET_STATUS_FOR_COCO = '/COCWS.svc/REST/GetStatusforCOC';
//const BASE_URL = 'https://hmgwebservices.com/'; // Production Environment
//const BASE_URL = 'https://uat.hmgwebservices.com/Services'; // UAT Environment

@ -0,0 +1,120 @@
class COCItem {
Null appointment;
String appointmentClinicName;
String appointmentDate;
String appointmentProjectName;
String cOCID;
String cOCTitle;
String channel;
dynamic clinic;
String clinicID;
String date;
dynamic detail;
dynamic doctor;
String doctorID;
String formType;
int formTypeID;
dynamic identificationNo;
int itemID;
dynamic mobileNo;
dynamic naturename;
dynamic patientID;
dynamic patientName;
dynamic project;
dynamic projectID;
String solution;
String status;
String statusAr;
dynamic statusEn;
COCItem(
{this.appointment,
this.appointmentClinicName,
this.appointmentDate,
this.appointmentProjectName,
this.cOCID,
this.cOCTitle,
this.channel,
this.clinic,
this.clinicID,
this.date,
this.detail,
this.doctor,
this.doctorID,
this.formType,
this.formTypeID,
this.identificationNo,
this.itemID,
this.mobileNo,
this.naturename,
this.patientID,
this.patientName,
this.project,
this.projectID,
this.solution,
this.status,
this.statusAr,
this.statusEn});
COCItem.fromJson(Map<String, dynamic> json) {
appointment = json['Appointment'];
appointmentClinicName = json['AppointmentClinicName'];
appointmentDate = json['AppointmentDate'];
appointmentProjectName = json['AppointmentProjectName'];
cOCID = json['COCID'];
cOCTitle = json['COCTitle'];
channel = json['Channel'];
clinic = json['Clinic'];
clinicID = json['ClinicID'];
date = json['Date'];
detail = json['Detail'];
doctor = json['Doctor'];
doctorID = json['DoctorID'];
formType = json['FormType'];
formTypeID = json['FormTypeID'];
identificationNo = json['IdentificationNo'];
itemID = json['ItemID'];
mobileNo = json['MobileNo'];
naturename = json['Naturename'];
patientID = json['PatientID'];
patientName = json['PatientName'];
project = json['Project'];
projectID = json['ProjectID'];
solution = json['Solution'];
status = json['Status'];
statusAr = json['StatusAr'];
statusEn = json['StatusEn'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Appointment'] = this.appointment;
data['AppointmentClinicName'] = this.appointmentClinicName;
data['AppointmentDate'] = this.appointmentDate;
data['AppointmentProjectName'] = this.appointmentProjectName;
data['COCID'] = this.cOCID;
data['COCTitle'] = this.cOCTitle;
data['Channel'] = this.channel;
data['Clinic'] = this.clinic;
data['ClinicID'] = this.clinicID;
data['Date'] = this.date;
data['Detail'] = this.detail;
data['Doctor'] = this.doctor;
data['DoctorID'] = this.doctorID;
data['FormType'] = this.formType;
data['FormTypeID'] = this.formTypeID;
data['IdentificationNo'] = this.identificationNo;
data['ItemID'] = this.itemID;
data['MobileNo'] = this.mobileNo;
data['Naturename'] = this.naturename;
data['PatientID'] = this.patientID;
data['PatientName'] = this.patientName;
data['Project'] = this.project;
data['ProjectID'] = this.projectID;
data['Solution'] = this.solution;
data['Status'] = this.status;
data['StatusAr'] = this.statusAr;
data['StatusEn'] = this.statusEn;
return data;
}
}

@ -0,0 +1,132 @@
class RequestInsertCOCItem {
bool isUserLoggedIn;
String mobileNo;
int identificationNo;
int patientID;
int patientOutSA;
int patientTypeID;
String tokenID;
String patientName;
int projectID;
String fileName;
String attachment;
String uILanguage;
String browserInfo;
String cOCTypeName;
String formTypeID;
String details;
String deviceInfo;
String deviceType;
String title;
String resolution;
double versionID;
int channel;
int languageID;
String iPAdress;
String generalid;
String sessionID;
bool isDentalAllowedBackend;
int deviceTypeID;
int patientType;
double appVersion;
RequestInsertCOCItem(
{this.isUserLoggedIn,
this.mobileNo,
this.identificationNo,
this.patientID,
this.patientOutSA,
this.patientTypeID,
this.tokenID,
this.patientName,
this.projectID,
this.fileName,
this.attachment,
this.uILanguage,
this.browserInfo,
this.cOCTypeName,
this.formTypeID,
this.details,
this.deviceInfo,
this.deviceType,
this.title,
this.resolution,
this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID,
this.patientType,
this.appVersion});
RequestInsertCOCItem.fromJson(Map<String, dynamic> json) {
isUserLoggedIn = json['IsUserLoggedIn'];
mobileNo = json['MobileNo'];
identificationNo = json['IdentificationNo'];
patientID = json['PatientID'];
patientOutSA = json['PatientOutSA'];
patientTypeID = json['PatientTypeID'];
tokenID = json['TokenID'];
patientName = json['PatientName'];
projectID = json['ProjectID'];
fileName = json['FileName'];
attachment = json['Attachment'];
uILanguage = json['UILanguage'];
browserInfo = json['BrowserInfo'];
cOCTypeName = json['COCTypeName'];
formTypeID = json['FormTypeID'];
details = json['Details'];
deviceInfo = json['DeviceInfo'];
deviceType = json['DeviceType'];
title = json['Title'];
resolution = json['Resolution'];
versionID = json['VersionID'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
sessionID = json['SessionID'];
isDentalAllowedBackend = json['isDentalAllowedBackend'];
deviceTypeID = json['DeviceTypeID'];
patientType = json['PatientType'];
appVersion = json['AppVersion'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['IsUserLoggedIn'] = this.isUserLoggedIn;
data['MobileNo'] = this.mobileNo;
data['IdentificationNo'] = this.identificationNo;
data['PatientID'] = this.patientID;
data['PatientOutSA'] = this.patientOutSA;
data['PatientTypeID'] = this.patientTypeID;
data['TokenID'] = this.tokenID;
data['PatientName'] = this.patientName;
data['ProjectID'] = this.projectID;
data['FileName'] = this.fileName;
data['Attachment'] = this.attachment;
data['UILanguage'] = this.uILanguage;
data['BrowserInfo'] = this.browserInfo;
data['COCTypeName'] = this.cOCTypeName;
data['FormTypeID'] = this.formTypeID;
data['Details'] = this.details;
data['DeviceInfo'] = this.deviceInfo;
data['DeviceType'] = this.deviceType;
data['Title'] = this.title;
data['Resolution'] = this.resolution;
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['generalid'] = this.generalid;
data['SessionID'] = this.sessionID;
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['DeviceTypeID'] = this.deviceTypeID;
data['PatientType'] = this.patientType;
data['AppVersion'] = this.appVersion;
return data;
}
}

@ -0,0 +1,65 @@
import 'dart:io';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/feedback/COC_items.dart';
import 'package:diplomaticquarterapp/core/model/feedback/request_insert_coc_item.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
class FeedbackService extends BaseService {
List<COCItem> cOCItemList = List();
RequestInsertCOCItem _requestInsertCOCItem = RequestInsertCOCItem();
Future sendCOCItem(
{String title,
String details,
String cOCTypeName,
String attachment}) async {
hasError = false;
_requestInsertCOCItem.attachment = attachment;
_requestInsertCOCItem.title = title;
_requestInsertCOCItem.details = details;
_requestInsertCOCItem.cOCTypeName = cOCTypeName;
_requestInsertCOCItem.formTypeID = cOCTypeName;
_requestInsertCOCItem.mobileNo =
"966537503378"; //TODO Change it to be dynamic
_requestInsertCOCItem.isUserLoggedIn = true;
_requestInsertCOCItem.projectID = 1231755;
_requestInsertCOCItem.patientName = "TAMER FANASHEH";
_requestInsertCOCItem.fileName = "";
_requestInsertCOCItem.uILanguage = "ar"; //TODO Change it to be dynamic
_requestInsertCOCItem.browserInfo = Platform.localHostname;
_requestInsertCOCItem.deviceInfo = Platform.localHostname;
_requestInsertCOCItem.resolution = "400x847";
_requestInsertCOCItem.projectID = 0;
_requestInsertCOCItem.identificationNo = 2344670985;
await baseAppClient
.post(SEND_FEEDBACK, onSuccess: (dynamic response, int statusCode) {
var asd = "";
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _requestInsertCOCItem.toJson());
}
Future getStatusCOC() async {
hasError = false;
Map<String, dynamic> body = new Map<String, dynamic>();
body['IdentificationNo'] = '2344670985';
body['MobileNo'] = '966537503378';
body['Searching_type'] = '1';
await baseAppClient.post(GET_STATUS_FOR_COCO,
onSuccess: (dynamic response, int statusCode) {
cOCItemList = [];
response['ListCOCItems'].forEach((cOC) {
cOCItemList.add(COCItem.fromJson(cOC));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
}

@ -0,0 +1,46 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/feedback/COC_items.dart';
import 'package:diplomaticquarterapp/core/service/feedback/feedback_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import '../../../locator.dart';
class FeedbackViewModel extends BaseViewModel {
FeedbackService _feedbackService = locator<FeedbackService>();
List<COCItem> get cOCItemList => _feedbackService.cOCItemList;
Future<bool> sendCOCItem(
{String title,
String details,
String cOCTypeName,
String attachment}) async {
setState(ViewState.BusyLocal);
await _feedbackService.sendCOCItem(
title: title,
details: details,
cOCTypeName: cOCTypeName,
attachment: attachment);
if (_feedbackService.hasError) {
error = _feedbackService.error;
setState(ViewState.ErrorLocal);
return false;
} else {
getCOC();
setState(ViewState.Idle);
return true;
}
}
getCOC({bool call = true}) async {
setState(ViewState.Busy);
await _feedbackService.getStatusCOC();
if (_feedbackService.hasError) {
error = _feedbackService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
}

@ -1,13 +1,9 @@
import 'package:diplomaticquarterapp/core/enum/filter_type.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/doctor/doctor_profile.dart';
import 'package:diplomaticquarterapp/core/model/doctor/doctor_rating.dart';
import 'package:diplomaticquarterapp/core/model/doctor/patient_doctor_appointment.dart';
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_special_result.dart';
import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart';
import 'package:diplomaticquarterapp/core/service/medical/my_doctor_service.dart';
import '../../../locator.dart';
import '../base_view_model.dart';

@ -8,7 +8,6 @@ import '../../../core/enum/filter_type.dart';
import '../../../core/enum/viewstate.dart';
import '../../../core/model/prescriptions/Prescriptions.dart';
import '../../../core/service/medical/prescriptions_service.dart';
import '../../../locator.dart';
import '../base_view_model.dart';

@ -1,13 +1,6 @@
import 'package:diplomaticquarterapp/core/enum/filter_type.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/doctor/doctor_profile.dart';
import 'package:diplomaticquarterapp/core/model/doctor/doctor_rating.dart';
import 'package:diplomaticquarterapp/core/model/doctor/patient_doctor_appointment.dart';
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_special_result.dart';
import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart';
import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart';
import 'package:diplomaticquarterapp/core/service/medical/my_doctor_service.dart';
import 'package:diplomaticquarterapp/core/service/medical/radiology_service.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';

@ -1,11 +1,13 @@
import 'package:diplomaticquarterapp/routes.dart';
import 'package:get_it/get_it.dart';
import 'core/service/feedback/feedback_service.dart';
import 'core/service/hospital_service.dart';
import 'core/service/medical/labs_service.dart';
import 'core/service/medical/my_doctor_service.dart';
import 'core/service/medical/prescriptions_service.dart';
import 'core/service/medical/radiology_service.dart';
import 'core/viewModels/feedback/feedback_view_model.dart';
import 'core/viewModels/hospital_view_model.dart';
import 'core/viewModels/medical/labs_view_model.dart';
import 'core/viewModels/medical/my_doctor_view_model.dart';
@ -25,6 +27,7 @@ void setupLocator() {
locator.registerLazySingleton(() => PrescriptionsService());
locator.registerLazySingleton(() => LabsService());
locator.registerLazySingleton(() => RadiologyService());
locator.registerLazySingleton(() => FeedbackService());
/// View Model
locator.registerFactory(() => HospitalViewModel());
@ -33,5 +36,6 @@ void setupLocator() {
locator.registerFactory(() => PrescriptionsViewModel());
locator.registerFactory(() => LabsViewModel());
locator.registerFactory(() => RadiologyViewModel());
locator.registerFactory(() => FeedbackViewModel());
}

@ -0,0 +1,98 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class StatusFeedbackPage extends StatefulWidget {
@override
_StatusFeedbackPageState createState() => _StatusFeedbackPageState();
}
class _StatusFeedbackPageState extends State<StatusFeedbackPage> {
@override
Widget build(BuildContext context) {
return BaseView<FeedbackViewModel>(
onModelReady: (model) => model.getCOC(),
builder: (_, model, widget) => AppScaffold(
baseViewModel: model,
body: Container(
margin: EdgeInsets.all(8.0),
padding: EdgeInsets.all(15.0),
child: ListView.builder(
itemCount: model.cOCItemList.length,
itemBuilder: (context, index) => Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
border: Border.all(color: Colors.white, width: 0.5),
borderRadius: BorderRadius.all(Radius.circular(5)),
color: Colors.white,
),
margin: EdgeInsets.all(4),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(height: 8,),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Texts('${model.cOCItemList[index].cOCTitle}'),
Texts(
'Number :${model.cOCItemList[index].itemID}',
variant: 'overline',
),
],
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Texts('${model.cOCItemList[index].status}'),
Texts(
'${model.cOCItemList[index].date}',
variant: 'overline',
),
],
),
],
),
Texts('${model.cOCItemList[index].formType}'),
Divider(height: 4.5,color: Colors.grey[500],)
],
),
),
)),
),
bottomSheet: Container(
height: MediaQuery.of(context).size.height * 0.13,
width: double.infinity,
padding: EdgeInsets.all(8.0),
child: Center(
child: Container(
height: MediaQuery.of(context).size.height * 0.1,
width: MediaQuery.of(context).size.width * 0.8,
child: Button(
label: 'Search',
loading: model.state == ViewState.BusyLocal,
onTap: () {
//TODO When come back
},
),
),
),
),
),
);
}
}

@ -0,0 +1,118 @@
import 'dart:ui';
import 'package:diplomaticquarterapp/pages/feedback/send_feedback_page.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'Status_feedback_page.dart';
class FeedbackHomePage extends StatefulWidget {
@override
_FeedbackHomePageState createState() => _FeedbackHomePageState();
}
class _FeedbackHomePageState extends State<FeedbackHomePage>
with SingleTickerProviderStateMixin {
TabController _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(length: 2, vsync: this);
}
@override
void dispose() {
super.dispose();
_tabController.dispose();
}
@override
Widget build(BuildContext context) {
return AppScaffold(
isShowAppBar: true,
appBarTitle: 'Feedback',
body: Scaffold(
extendBodyBehindAppBar: true,
appBar: PreferredSize(
preferredSize: Size.fromHeight(65.0),
child: Stack(
children: <Widget>[
Positioned(
bottom: 1,
left: 0,
right: 0,
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
child: Container(
color: Theme.of(context)
.scaffoldBackgroundColor
.withOpacity(0.8),
height: 70.0,
),
),
),
Center(
child: Container(
height: 60.0,
margin: EdgeInsets.only(top: 10.0),
width: MediaQuery.of(context).size.width * 0.9,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Theme.of(context).dividerColor,
width: 0.7),
),
color: Colors.white),
child: Center(
child: TabBar(
isScrollable: true,
controller: _tabController,
indicatorWeight: 5.0,
indicatorSize: TabBarIndicatorSize.label,
indicatorColor: Colors.red[800],
labelColor: Theme.of(context).primaryColor,
labelPadding:
EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0),
unselectedLabelColor: Colors.grey[800],
tabs: [
Container(
width: MediaQuery.of(context).size.width * 0.30,
child: Center(
child: Texts('Send'),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.30,
child: Center(
child: Texts('Status'),
),
),
],
),
),
),
),
],
),
),
body: Column(
children: <Widget>[
Expanded(
child: TabBarView(
physics: BouncingScrollPhysics(),
controller: _tabController,
children: <Widget>[
SendFeedbackPage(),
StatusFeedbackPage()
],
),
)
],
),
),
);
}
}

@ -0,0 +1,561 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
enum MessageType {
ComplaintOnAnAppointment,
ComplaintWithoutAppointment,
Question,
Compliment,
Suggestion,
NON
}
class SendFeedbackPage extends StatefulWidget {
@override
_SendFeedbackPageState createState() => _SendFeedbackPageState();
}
class _SendFeedbackPageState extends State<SendFeedbackPage> {
TextEditingController titleController = TextEditingController();
TextEditingController messageController = TextEditingController();
MessageType messageType = MessageType.NON;
String _selected = "not selected";
List<String> images = [];
String title;
String message;
final formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return BaseView<FeedbackViewModel>(
builder: (_, model, widget) => AppScaffold(
baseViewModel: model,
body: Container(
height: MediaQuery.of(context).size.height * 0.8,
child: SingleChildScrollView(
child: Form(
key: formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 65,
),
Container(
margin: EdgeInsets.only(left: 20, right: 20, top: 8),
child: Texts(
'We\'d love to hear your feedback about the health care services and online services. Please fill in the required fields',
//يسعدنا سماع ملاحظاتك حول خدمات الرعاية الصحية والخدمات الإلكترونية. يرجى تعبئة الحقول المطلوبة
textAlign: TextAlign.center,
variant: 'body2Link',
),
),
InkWell(
onTap: () {
confirmBox();
},
child: Container(
margin: EdgeInsets.only(left: 10, right: 10, top: 15),
height: 50,
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
borderRadius: BorderRadius.circular(7),
color: Colors.white,
shape: BoxShape.rectangle,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
child: Texts(
_selected,
variant: 'bodyText',
),
margin: EdgeInsets.only(left: 10),
),
Icon(
Icons.arrow_drop_down,
size: 22,
color: Colors.grey,
)
],
),
),
),
Container(
margin: EdgeInsets.only(left: 10, right: 10, top: 15),
child: TextFields(
hintText: 'Title',
controller: titleController,
fontSize: 13.5,
hintColor: Colors.black,
fontWeight: FontWeight.w600,
validator: (value) {
if (value == null)
return "please Enter title";
else
return null;
},
),
),
Container(
margin: EdgeInsets.only(left: 10, right: 10, top: 15),
child: TextFields(
hintText: 'message',
fontSize: 13.5,
hintColor: Colors.black,
fontWeight: FontWeight.w600,
maxLines: 25,
minLines: 13,
controller: messageController,
validator: (value) {
if (value == null)
return "please Enter message";
else
return null;
}),
),
InkWell(
onTap: () {
ImageOptions.showImageOptions(context, (String image) {
setState(() {
images.add(image);
});
});
},
child: Container(
margin: EdgeInsets.only(left: 10, right: 10, top: 15),
height: 50,
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
borderRadius: BorderRadius.circular(7),
color: Colors.white,
shape: BoxShape.rectangle,
),
child: Center(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(Icons.attach_file),
Texts(
'selected attachment',
variant: 'bodyText',
textAlign: TextAlign.center,
),
],
),
),
),
),
...List.generate(
images.length,
(index) => Container(
margin: EdgeInsets.all(10),
padding: EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Icon(FontAwesomeIcons.paperclip),
SizedBox(
width: 8,
),
Texts(
'image ${index + 1}.png',
),
],
),
InkWell(
onTap: () {
setState(() {
images.remove(images[index]);
});
},
child: Icon(
FontAwesomeIcons.trashAlt,
color: Colors.red[300],
))
],
),
)),
SizedBox(
height: 30,
),
],
),
),
),
),
bottomSheet: Container(
height: MediaQuery.of(context).size.height * 0.13,
width: double.infinity,
padding: EdgeInsets.all(8.0),
child: Center(
child: Container(
height: MediaQuery.of(context).size.height * 0.1,
width: MediaQuery.of(context).size.width * 0.8,
child: Button(
label: 'Send',
loading: model.state == ViewState.BusyLocal,
onTap: () {
final form = formKey.currentState;
if (form.validate()) if (messageType != MessageType.NON)
model
.sendCOCItem(
title: titleController.text,
attachment: images.length > 0 ? images[0] : "",
details: messageController.text,
cOCTypeName: getCOCName())
.then((value) {
if (value) {
setState(() {
titleController.text = "";
messageController.text = "";
});
AppToast.showSuccessToast(message: "Your feedback was sended");
} else {
AppToast.showErrorToast(message: model.error);
}
});
else {
AppToast.showErrorToast(message: "Please select COC");
}
},
),
),
),
),
),
);
}
String getCOCName() {
switch (messageType) {
case MessageType.ComplaintOnAnAppointment:
return "1";
break;
case MessageType.ComplaintWithoutAppointment:
return "2";
break;
case MessageType.Question:
return "3";
break;
case MessageType.Compliment:
return "4";
break;
case MessageType.Suggestion:
return "5";
break;
case MessageType.NON:
return "";
break;
}
return "";
}
// Show Dialog function
void confirmBox() {
showDialog(
context: context,
child: FeedbackTypeDialog(
onValueChange: _onValueChange,
initialValue: messageType,
onValueSelected: () {
setState(() {
switch (messageType) {
case MessageType.ComplaintOnAnAppointment:
_selected = "Complaint on an appointment";
break;
case MessageType.ComplaintWithoutAppointment:
_selected = "Complaint without appointment";
break;
case MessageType.Question:
_selected = "Question";
break;
case MessageType.Compliment:
_selected = "Compliment";
break;
case MessageType.Suggestion:
_selected = "Suggestion";
break;
case MessageType.NON:
break;
}
});
Navigator.pop(context);
},
));
}
void _onValueChange(MessageType value) {
setState(() {
messageType = value;
});
}
}
class FeedbackTypeDialog extends StatefulWidget {
const FeedbackTypeDialog(
{this.onValueChange, this.initialValue, this.onValueSelected});
final MessageType initialValue;
final void Function(MessageType) onValueChange;
final GestureTapCallback onValueSelected;
@override
State createState() => new FeedbackTypeDialogState();
}
class FeedbackTypeDialogState extends State<FeedbackTypeDialog> {
MessageType _messageType;
@override
void initState() {
super.initState();
_messageType = widget.initialValue;
}
Widget build(BuildContext context) {
return new SimpleDialog(
title: Text(
"Message Type",
textAlign: TextAlign.center,
),
children: <Widget>[
Container(
// padding: const EdgeInsets.all(10.0),
child: Column(
children: <Widget>[
Divider(
height: 2.5,
color: Colors.grey[500],
),
Row(
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () {
setState(() {
_messageType = MessageType.ComplaintOnAnAppointment;
widget.onValueChange(_messageType);
});
},
child: ListTile(
title: const Text('Complaint on an appointment'),
leading: Radio(
value: MessageType.ComplaintOnAnAppointment,
groupValue: _messageType,
activeColor: Colors.red[800],
onChanged: (MessageType value) {
setState(() {
_messageType = MessageType.ComplaintOnAnAppointment;
widget.onValueChange(_messageType);
});
},
),
),
),
)
],
),
SizedBox(
height: 5.0,
),
Row(
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () {
setState(() {
_messageType = MessageType.ComplaintWithoutAppointment;
widget.onValueChange(_messageType);
});
},
child: ListTile(
title: const Text('Complaint without appointment'),
leading: Radio(
value: MessageType.ComplaintWithoutAppointment,
groupValue: _messageType,
activeColor: Colors.red[800],
onChanged: (MessageType value) {
setState(() {
_messageType =
MessageType.ComplaintWithoutAppointment;
widget.onValueChange(_messageType);
});
},
),
),
),
)
],
),
SizedBox(
height: 5.0,
),
Row(
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () {
setState(() {
_messageType = MessageType.Question;
widget.onValueChange(_messageType);
});
},
child: ListTile(
title: const Text('Question'),
leading: Radio(
value: MessageType.Question,
groupValue: _messageType,
activeColor: Colors.red[800],
onChanged: (MessageType value) {
setState(() {
_messageType = MessageType.Question;
widget.onValueChange(_messageType);
});
},
),
),
),
)
],
),
SizedBox(
height: 5.0,
),
Row(
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () {
setState(() {
_messageType = MessageType.Compliment;
widget.onValueChange(_messageType);
});
},
child: ListTile(
title: const Text('compliment'),
leading: Radio(
value: MessageType.Compliment,
groupValue: _messageType,
activeColor: Colors.red[800],
onChanged: (MessageType value) {
setState(() {
_messageType = MessageType.Compliment;
widget.onValueChange(_messageType);
});
},
),
),
),
)
],
),
SizedBox(
height: 5.0,
),
Row(
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () {
setState(() {
_messageType = MessageType.Suggestion;
widget.onValueChange(_messageType);
});
},
child: ListTile(
title: const Text('Suggestion'),
leading: Radio(
value: MessageType.Suggestion,
groupValue: _messageType,
activeColor: Colors.red[800],
onChanged: (MessageType value) {
setState(() {
_messageType = MessageType.Suggestion;
widget.onValueChange(_messageType);
});
},
),
),
),
)
],
),
SizedBox(
height: 5.0,
),
Divider(
height: 2.5,
color: Colors.grey[500],
),
SizedBox(
height: 5,
),
Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.pop(context);
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Center(
child: Texts(
'cancel',
color: Colors.red,
))),
),
)),
Container(
width: 1,
height: 30,
color: Colors.grey[500],
),
Expanded(
flex: 1,
child: InkWell(
onTap: widget.onValueSelected,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Texts(
'ok',
fontWeight: FontWeight.w400,
)),
),
)),
],
)
],
)),
],
);
}
}

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/hospital_view_model.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart';
@ -9,6 +10,7 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacies_view_model.dart'
import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_list_model.dart';
import '../base/base_view.dart';
import '../feedback/feedback_home_page.dart';
class HomePage extends StatefulWidget {
@override
@ -18,54 +20,38 @@ class HomePage extends StatefulWidget {
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return BaseView<PharmacyViewModel>(
onModelReady: (model) => model.getMedicine(),
builder: (BuildContext context, PharmacyViewModel model, Widget child) =>
AppScaffold(
baseViewModel: model,
body: Column(
children: <Widget>[
InkWell(
onTap: () {
model.getMedicine();
},
child: Container(
child: Texts('call api'),
return AppScaffold(
body: Container(
width: double.infinity,
child: FractionallySizedBox(
widthFactor: 0.95,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
InkWell(
onTap: ()=>Navigator.push(context, FadePage(page: FeedbackHomePage())),
child: Container(
margin: EdgeInsets.only(top: 12),
width: double.infinity,
height: 180,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.circular(12.0),
border: Border.all(
color: Colors.grey[400],
width: 1.0,
),
),
child: Center(
child: Texts('Feedback'),
),
),
),
),
Expanded(
child: _getHospitals(model.pharmacy),
)
// BaseView<DoctorViewModel>(
// onModelReady: (dctorViewModel) => dctorViewModel.getHospitals(),
// builder: (BuildContext context, DoctorViewModel dctorViewModel,
// Widget child) =>
// InkWell(
// onTap: () {
// dctorViewModel.getHospitals();
// },
// child: Container(
// width: double.infinity,
// height: 150,
// child: NetworkBaseView(
// baseViewModel: dctorViewModel,
// child: Container(
// child: Texts('The API 2'),
// ),
// ),
// ),
// ),
// ),
],
],
),
),
),
);
}
Widget _getHospitals(List<PharmaciesModel> hospitals) => ListView.builder(
itemCount: hospitals.length,
itemBuilder: (BuildContext context, int index) => Container(
child: Texts(hospitals[index].itemDes),
),
);
}

@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:permission_handler/permission_handler.dart';
import 'home_page.dart';
class LandingPage extends StatefulWidget {
@ -38,10 +39,19 @@ class _LandingPageState extends State<LandingPage> {
if (token != null) {
checkUserStatus(token);
}
requestPermissions();
//assert(token != null);
});
}
void requestPermissions() async {
await [
Permission.location,
Permission.storage,
Permission.camera,
Permission.photos,
Permission.accessMediaLocation
].request();
}
@override
Widget build(BuildContext context) {
@ -69,7 +79,8 @@ class _LandingPageState extends State<LandingPage> {
body: PageView(
physics: NeverScrollableScrollPhysics(),
controller: pageController,
children: [Container(), MedicalProfilePage(), MyAdmissionsPage(), ToDo()],
children: [HomePage(), MedicalProfilePage(), MyAdmissionsPage(), ToDo()],
),
bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab),
);

@ -1,5 +1,4 @@
import 'package:diplomaticquarterapp/core/enum/filter_type.dart';
import 'package:diplomaticquarterapp/core/model/doctor/patient_doctor_appointment.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/my_doctor_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
@ -9,7 +8,6 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'doctor_profile_page.dart';

@ -1,5 +1,3 @@
import 'dart:math';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart';

@ -5,8 +5,8 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:maps_launcher/maps_launcher.dart';
import 'package:url_launcher/url_launcher.dart';
class PharmacyForPrescriptionsPage extends StatelessWidget {
final PrescriptionReport prescriptionReport;

@ -1,7 +1,6 @@
import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/widgets/buttons/BottomButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';

@ -0,0 +1,141 @@
import 'dart:convert';
import 'dart:io';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:feather_icons_flutter/feather_icons_flutter.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
class ImageOptions {
static showImageOptions(BuildContext context, Function(String) image) {
showModalBottomSheet(
backgroundColor: Colors.transparent,
context: context,
builder: (BuildContext bc) {
return _BottomSheet(
children: <Widget>[
_BottomSheetItem(
title: "Select file souse",
),
_BottomSheetItem(
title: "Gallery",
icon: FeatherIcons.image,
onTap: () async {
File _image =
await ImagePicker.pickImage(source: ImageSource.gallery);
String fileName = _image.path;
final bytes = File(fileName).readAsBytesSync();
String base64Encode = base64.encode(bytes);
if (base64Encode != null) {
image(base64Encode);
}
},
),
_BottomSheetItem(
title: "Camera",
icon: FeatherIcons.camera,
onTap: () async {
File _image =
await ImagePicker.pickImage(source: ImageSource.camera);
String fileName = _image.path;
final bytes = File(fileName).readAsBytesSync();
String base64Encode = base64.encode(bytes);
if (base64Encode != null) {
image(base64Encode);
}
},
),
_BottomSheetItem(
title: "Cancel",
onTap: (){},
)
],
);
});
}
}
class _BottomSheet extends StatelessWidget {
final List<Widget> children;
_BottomSheet({Key key, @required this.children}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(vertical: 12.0),
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0))),
child: SafeArea(
top: false,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
decoration: BoxDecoration(
color: Theme.of(context).dividerColor,
borderRadius: BorderRadius.circular(3.0)),
width: 40.0,
height: 6.0,
),
...children
],
),
),
);
}
}
class _BottomSheetItem extends StatelessWidget {
final Function onTap;
final IconData icon;
final String title;
final ITEM_COLOR color;
_BottomSheetItem(
{Key key,
this.onTap,
@required this.title,
this.icon,
this.color = ITEM_COLOR.primary})
: super(key: key);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
if (onTap != null) {
Navigator.pop(context);
onTap();
}
},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 18.0, vertical: 18.0),
child: Row(
children: <Widget>[
if (icon != null)
Icon(
icon,
color: color == ITEM_COLOR.error
? Theme.of(context).errorColor
: Theme.of(context).primaryColor,
size: 18.0,
),
if (icon != null) SizedBox(width: 24.0),
Texts(
title ?? "",
style: "bodyText2",
color: color == ITEM_COLOR.error
? Theme.of(context).errorColor
: null,
),
],
),
),
);
}
}
enum ITEM_COLOR { primary, error }

@ -71,10 +71,12 @@ class TextFields extends StatefulWidget {
this.onTap,
this.fontSize = 16.0,
this.fontWeight = FontWeight.w700,
this.autoValidate = false})
this.autoValidate = false,
this.hintColor})
: super(key: key);
final String hintText;
// final String initialValue;
final String type;
final bool autoFocus;
@ -105,6 +107,7 @@ class TextFields extends StatefulWidget {
final EdgeInsets padding;
final bool focus;
final bool borderOnlyError;
final Color hintColor;
@override
_TextFieldsState createState() => _TextFieldsState();
@ -208,6 +211,7 @@ class _TextFieldsState extends State<TextFields> {
blurRadius: focus ? 34.0 : 12.0)
]),
child: TextFormField(
keyboardAppearance: Theme.of(context).brightness,
scrollPhysics: BouncingScrollPhysics(),
autovalidate: widget.autoValidate,
@ -250,7 +254,8 @@ class _TextFieldsState extends State<TextFields> {
hintStyle: TextStyle(
fontSize: widget.fontSize,
fontWeight: widget.fontWeight,
color: Theme.of(context).hintColor),
color: widget.hintColor ?? Theme.of(context).hintColor,
),
contentPadding: widget.padding != null
? widget.padding
: EdgeInsets.symmetric(

Loading…
Cancel
Save