First step from notifications_page

fix_issues
Elham Rababah 4 years ago
parent 55e25fade8
commit 9f2beceb22

@ -339,7 +339,8 @@ const PATIENT_ER_UPDATE_PRES_ORDER ="Services/Patients.svc/REST/PatientER_Update
const GET_ORDER_DETAIL_BY_ID ="Services/Patients.svc/REST/PatientER_HHC_GetTransactionsForOrder";
const GET_CMC_ORDER_DETAIL_BY_ID ="Services/Patients.svc/REST/PatientER_CMC_GetTransactionsForOrder";
const GET_CHECK_UP_ITEMS ="Services/Patients.svc/REST/GetCheckUpItems";
const PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS =
'Services/MobileNotifications.svc/REST/PushNotification_GetAllNotifications';
const TIMER_MIN = 10;
const GOOGLE_API_KEY = "AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw";

@ -676,5 +676,6 @@ const Map<String, Map<String, String>> localizedValues = {
"Book": {"en": "Book", "ar": "احجز"},
"AppointmentLabel": {"en": "Appointment", "ar": "موعد"},
"BloodType": {"en": "Blood Type", "ar": "فصيلة الدم"},
"notifications": {"en": "Notifications", "ar": "إشعارات"},
};

@ -0,0 +1,22 @@
class GetNotificationsRequestModel {
int notificationStatusID;
int pagingSize;
int currentPage;
GetNotificationsRequestModel(
{this.notificationStatusID, this.pagingSize, this.currentPage});
GetNotificationsRequestModel.fromJson(Map<String, dynamic> json) {
notificationStatusID = json['NotificationStatusID'];
pagingSize = json['pagingSize'];
currentPage = json['currentPage'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['NotificationStatusID'] = this.notificationStatusID;
data['pagingSize'] = this.pagingSize;
data['currentPage'] = this.currentPage;
return data;
}
}

@ -0,0 +1,96 @@
class GetNotificationsResponseModel {
int id;
int recordId;
int patientID;
bool projectOutSA;
String deviceType;
String deviceToken;
String message;
String messageType;
String messageTypeData;
dynamic videoURL;
bool isQueue;
String isQueueOn;
String createdOn;
String createdBy;
String notificationType;
bool isSent;
String isSentOn;
bool isRead;
String isReadOn;
int channelID;
int projectID;
GetNotificationsResponseModel(
{this.id,
this.recordId,
this.patientID,
this.projectOutSA,
this.deviceType,
this.deviceToken,
this.message,
this.messageType,
this.messageTypeData,
this.videoURL,
this.isQueue,
this.isQueueOn,
this.createdOn,
this.createdBy,
this.notificationType,
this.isSent,
this.isSentOn,
this.isRead,
this.isReadOn,
this.channelID,
this.projectID});
GetNotificationsResponseModel.fromJson(Map<String, dynamic> json) {
id = json['Id'];
recordId = json['RecordId'];
patientID = json['PatientID'];
projectOutSA = json['ProjectOutSA'];
deviceType = json['DeviceType'];
deviceToken = json['DeviceToken'];
message = json['Message'];
messageType = json['MessageType'];
messageTypeData = json['MessageTypeData'];
videoURL = json['VideoURL'];
isQueue = json['IsQueue'];
isQueueOn = json['IsQueueOn'];
createdOn = json['CreatedOn'];
createdBy = json['CreatedBy'];
notificationType = json['NotificationType'];
isSent = json['IsSent'];
isSentOn = json['IsSentOn'];
isRead = json['IsRead'];
isReadOn = json['IsReadOn'];
channelID = json['ChannelID'];
projectID = json['ProjectID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Id'] = this.id;
data['RecordId'] = this.recordId;
data['PatientID'] = this.patientID;
data['ProjectOutSA'] = this.projectOutSA;
data['DeviceType'] = this.deviceType;
data['DeviceToken'] = this.deviceToken;
data['Message'] = this.message;
data['MessageType'] = this.messageType;
data['MessageTypeData'] = this.messageTypeData;
data['VideoURL'] = this.videoURL;
data['IsQueue'] = this.isQueue;
data['IsQueueOn'] = this.isQueueOn;
data['CreatedOn'] = this.createdOn;
data['CreatedBy'] = this.createdBy;
data['NotificationType'] = this.notificationType;
data['IsSent'] = this.isSent;
data['IsSentOn'] = this.isSentOn;
data['IsRead'] = this.isRead;
data['IsReadOn'] = this.isReadOn;
data['ChannelID'] = this.channelID;
data['ProjectID'] = this.projectID;
return data;
}
}

@ -0,0 +1,22 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_request_model.dart';
import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_response_model.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
class NotificationService extends BaseService {
List<GetNotificationsResponseModel> notificationsList = List();
Future getAllNotifications(GetNotificationsRequestModel getNotificationsRequestModel ) async {
hasError = false;
await baseAppClient.post(PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS,
onSuccess: (dynamic response, int statusCode) {
notificationsList.clear();
response['List_GetAllNotificationsFromPool'].forEach((appoint) {
notificationsList.add(GetNotificationsResponseModel.fromJson(appoint));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: getNotificationsRequestModel.toJson());
}
}

@ -0,0 +1,25 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_request_model.dart';
import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_response_model.dart';
import 'package:diplomaticquarterapp/core/service/notifications_service.dart';
import '../../locator.dart';
import 'base_view_model.dart';
class NotificationViewModel extends BaseViewModel {
NotificationService _notificationService =
locator<NotificationService>();
List<GetNotificationsResponseModel> get notifications => _notificationService.notificationsList;
Future getNotifications() async {
setState(ViewState.Busy);
GetNotificationsRequestModel getNotificationsRequestModel = new GetNotificationsRequestModel(currentPage: 0,pagingSize: 14,notificationStatusID: 2);
await _notificationService.getAllNotifications(getNotificationsRequestModel);
if (_notificationService.hasError) {
error = _notificationService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
}

@ -42,6 +42,7 @@ import 'core/service/medical/prescriptions_service.dart';
import 'core/service/medical/radiology_service.dart';
import 'core/service/medical/reports_monthly_service.dart';
import 'core/service/medical/vital_sign_service.dart';
import 'core/service/notifications_service.dart';
import 'core/viewModels/AlHabibMedicalService/cmc_view_model.dart';
import 'core/viewModels/all_habib_medical_services/e_referral_view_model.dart';
import 'core/viewModels/appointment_rate_view_model.dart';
@ -74,6 +75,7 @@ import 'core/viewModels/medical/reports_monthly_view_model.dart';
import 'core/viewModels/medical/vital_sign_view_model.dart';
import 'core/viewModels/medical/reports_view_model.dart';
import 'core/viewModels/medical/weight_pressure_view_model.dart';
import 'core/viewModels/notifications_view_model.dart';
import 'core/viewModels/pharmacies_view_model.dart';
import 'core/service/pharmacies_service.dart';
import 'core/service/insurance_service.dart';
@ -110,8 +112,6 @@ void setupLocator() {
locator.registerLazySingleton(() => EReferralService());
locator.registerLazySingleton(() => HomeHealthCareService());
locator.registerLazySingleton(() => CMCService());
locator.registerLazySingleton(() => PatientSickLeaveService());
locator.registerLazySingleton(() => MyBalanceService());
locator.registerLazySingleton(() => BloodSugarService());
@ -124,17 +124,14 @@ void setupLocator() {
locator.registerLazySingleton(() => FindusService());
locator.registerLazySingleton(() => LiveChatService());
locator.registerLazySingleton(() => H2OService());
locator.registerLazySingleton(() => BloodDonationService());
locator.registerLazySingleton(() => BloodDetailsService());
locator.registerLazySingleton(() => ChildVaccinesService());
locator.registerLazySingleton(() => UserInformationService());
locator.registerLazySingleton(() => CreteNewBabyService());
locator.registerLazySingleton(() => DeleteBabyService());
locator.registerLazySingleton(() => VaccinationTableService());
locator.registerLazySingleton(() => NotificationService());
/// View Model
@ -166,9 +163,6 @@ void setupLocator() {
locator.registerFactory(() => ChildVaccinesViewModel());
locator.registerFactory(() => UserInformationViewModel());
locator.registerFactory(() => VaccinationTableViewModel());
locator.registerFactory(() => AddNewChildViewModel());
locator.registerFactory(() => H2OViewModel());
locator.registerFactory(() => BloodSugarViewMode());
@ -180,5 +174,6 @@ void setupLocator() {
locator.registerFactory(() => AllergiesViewModel());
locator.registerFactory(() => HomeHealthCareViewModel());
locator.registerFactory(() => CMCViewModel());
locator.registerFactory(() => NotificationViewModel());
}

@ -11,9 +11,9 @@ import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart';
import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart';
import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart';
import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart';
import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart';
import 'package:diplomaticquarterapp/pages/family/my-family.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart';
import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart';

@ -3,7 +3,6 @@ import 'package:diplomaticquarterapp/core/model/family-file/add_family_file_requ
import 'package:diplomaticquarterapp/core/model/family-file/insert_share_file_request.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/pages/family/add-family_type.dart';
import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -20,6 +19,8 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'add-family_type.dart';
class AddMember extends StatefulWidget {
@override
_AddMember createState() => _AddMember();

@ -0,0 +1,89 @@
import 'package:diplomaticquarterapp/core/viewModels/notifications_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
class NotificationsPage extends StatelessWidget {
getDateForm(String date) {
DateTime d = DateUtil.convertStringToDate(date);
String monthName = DateUtil.getMonth(d.month).toString();
TimeOfDay timeOfDay = TimeOfDay(hour: d.hour, minute: d.minute);
String minute = timeOfDay.minute < 10
? timeOfDay.minute.toString().padLeft(2, '0')
: timeOfDay.minute.toString();
String hour = '${timeOfDay.hourOfPeriod}:$minute';
if (timeOfDay.period == DayPeriod.am) {
hour = hour + "AM";
} else {
{
hour = hour + "PM";
}
}
//DayPeriod.am
return monthName + ',${d.day},${d.year}, $hour';
}
@override
Widget build(BuildContext context) {
var prescriptionReport;
return BaseView<NotificationViewModel>(
onModelReady: (model) => model.getNotifications(),
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).notifications,
baseViewModel: model,
body: ListView.builder(
itemBuilder: (context, index) => Container(
width: double.infinity,
margin: EdgeInsets.only(top: 5, left: 10, right: 10, bottom: 5),
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(
color: model.notifications[index].isRead
? Colors.grey[200]
: Theme.of(context).primaryColor,
width: 0.5),
),
child: Row(
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(
getDateForm(model.notifications[index].createdOn)),
SizedBox(
height: 5,
),
Texts(model.notifications[index].message),
SizedBox(
height: 5,
),
Texts(model.notifications[index].notificationType),
],
),
),
),
SizedBox(
width: 15,
),
],
),
),
itemCount: model.notifications.length,
),
),
);
}
}

@ -15,86 +15,86 @@ class PharmacyForPrescriptionsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BaseView<PrescriptionsViewModel>(
onModelReady: (model) => model.getListPharmacyForPrescriptions(itemId: prescriptionReport.itemID),
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
appBarTitle: 'Title',
baseViewModel: model,
body: ListView.builder(
itemBuilder: (context, index) => 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(
model.pharmacyPrescriptionsList[index].projectImageURL,
fit: BoxFit.cover,
width: 60,
height: 70,
),
return BaseView<PrescriptionsViewModel>(
onModelReady: (model) => model.getListPharmacyForPrescriptions(itemId: prescriptionReport.itemID),
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
appBarTitle: 'Title',
baseViewModel: model,
body: ListView.builder(
itemBuilder: (context, index) => 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),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(model.pharmacyPrescriptionsList[index]
.locationDescription),
SizedBox(
height: 5,
),
Texts(model.pharmacyPrescriptionsList[index].cityName),
],
border: Border.all(color: Colors.grey[200], width: 0.5),
),
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network(
model.pharmacyPrescriptionsList[index].projectImageURL,
fit: BoxFit.cover,
width: 60,
height: 70,
),
),
),
InkWell(
onTap: () {
MapsLauncher.launchCoordinates(
double.parse(
model.pharmacyPrescriptionsList[index].latitude),
double.parse(
model.pharmacyPrescriptionsList[index].longitude));
},
child: Icon(
Icons.pin_drop,
size: 18,
color: Colors.red[900],
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(model.pharmacyPrescriptionsList[index]
.locationDescription),
SizedBox(
height: 5,
),
Texts(model.pharmacyPrescriptionsList[index].cityName),
],
),
),
),
),
SizedBox(
width: 15,
),
InkWell(
onTap: Feedback.wrapForTap((){
launch("tel://${model.pharmacyPrescriptionsList[index].phoneNumber}");
},context),
child: Container(
InkWell(
onTap: () {
MapsLauncher.launchCoordinates(
double.parse(
model.pharmacyPrescriptionsList[index].latitude),
double.parse(
model.pharmacyPrescriptionsList[index].longitude));
},
child: Icon(
Icons.call,
Icons.pin_drop,
size: 18,
color: Colors.red[900],
),
),
)
],
SizedBox(
width: 15,
),
InkWell(
onTap: Feedback.wrapForTap((){
launch("tel://${model.pharmacyPrescriptionsList[index].phoneNumber}");
},context),
child: Container(
child: Icon(
Icons.call,
size: 18,
color: Colors.red[900],
),
),
)
],
),
),
itemCount: model.pharmacyPrescriptionsList.length,
),
itemCount: model.pharmacyPrescriptionsList.length,
),
),
);
);
}
}

@ -1,4 +1,6 @@
import 'package:diplomaticquarterapp/pages/family/my-family.dart';
import 'package:diplomaticquarterapp/pages/DrawerPages/family/add-family-member.dart';
import 'package:diplomaticquarterapp/pages/DrawerPages/family/add-family_type.dart';
import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart';
import 'package:diplomaticquarterapp/pages/login/confirm-login.dart';
@ -8,8 +10,6 @@ import 'package:diplomaticquarterapp/pages/login/welcome.dart';
import 'package:diplomaticquarterapp/pages/login/login-type.dart';
import 'package:diplomaticquarterapp/pages/login/login.dart';
import 'package:diplomaticquarterapp/pages/login/register.dart';
import 'package:diplomaticquarterapp/pages/family/add-family_type.dart';
import 'package:diplomaticquarterapp/pages/family/add-family-member.dart';
import 'package:diplomaticquarterapp/pages/symptom-checker/info.dart';
import 'package:diplomaticquarterapp/pages/symptom-checker/select-gender.dart';
import 'package:diplomaticquarterapp/pages/symptom-checker/symtom-checker.dart';

@ -733,6 +733,7 @@ class TranslationBase {
String get bloodType => localizedValues['BloodType'][locale.languageCode];
String get loginToUseService => localizedValues['loginToUseService'][locale.languageCode];
String get notifications => localizedValues['notifications'][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart';
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
import 'package:diplomaticquarterapp/pages/DrawerPages/notifications_page.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
@ -238,9 +239,13 @@ class _AppDrawerState extends State<AppDrawer> {
.notification,
Icons.notifications),
onTap: () {
Navigator.of(context).pushNamed(
WELCOME_LOGIN,
);
//NotificationsPage
Navigator.of(context).pop();
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
NotificationsPage()));
},
),
InkWell(

@ -13,11 +13,11 @@ import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart';
import 'package:diplomaticquarterapp/pages/Blood/my_balance_page.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart';
import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart';
import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart';
import 'package:diplomaticquarterapp/pages/ErService/AmbulanceReq.dart';
import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart';
import 'package:diplomaticquarterapp/pages/ErService/NearestEr.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart';
import 'package:diplomaticquarterapp/pages/family/my-family.dart';
import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';

Loading…
Cancel
Save