diff --git a/lib/config/config.dart b/lib/config/config.dart index 7ef2a306..9b910e66 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -54,6 +54,10 @@ const GET_PATIENT_VITAL_SIGN = const GET_NEAREST_HOSPITAL= 'Services/Patients.svc/REST/Patient_GetProjectAvgERWaitingTime'; +///Er Nearest +const GET_AMBULANCE_REQUEST= + 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod'; + diff --git a/lib/core/model/er/get_all_transportation_method_list_model.dart b/lib/core/model/er/get_all_transportation_method_list_model.dart new file mode 100644 index 00000000..3402873e --- /dev/null +++ b/lib/core/model/er/get_all_transportation_method_list_model.dart @@ -0,0 +1,79 @@ +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +class PatientER_RRT_GetAllTransportationMethodListModel { + int id; + DateTime createDate; + DateTime lastEditDate; + int createdBy; + int lastEditBy; + bool isActive; + String title; + String titleAR; + int price; + Null isDefault; + int visibility; + Null durationId; + String description; + String descriptionAR; + int totalPrice; + int vAT; + + PatientER_RRT_GetAllTransportationMethodListModel( + { + this.id, + this.createDate, + this.lastEditDate, + this.createdBy, + this.lastEditBy, + this.isActive, + this.title, + this.titleAR, + this.price, + this.isDefault, + this.visibility, + this.durationId, + this.description, + this.descriptionAR, + this.totalPrice, + this.vAT}); + + PatientER_RRT_GetAllTransportationMethodListModel.fromJson( + Map json) { + id = json['Id']; + createDate = DateUtil.convertStringToDate(json['CreateDate']); + lastEditDate = DateUtil.convertStringToDate(json['LastEditDate']); + createdBy = json['CreatedBy']; + lastEditBy = json['LastEditBy']; + isActive = json['IsActive']; + title = json['Title']; + titleAR = json['TitleAR']; + price = json['Price']; + isDefault = json['isDefault']; + visibility = json['Visibility']; + durationId = json['DurationId']; + description = json['Description']; + descriptionAR = json['DescriptionAR']; + totalPrice = json['TotalPrice']; + vAT = json['VAT']; + } + + Map toJson() { + final Map data = new Map(); + data['Id'] = this.id; + data['CreateDate'] = this.createDate; + data['LastEditDate'] = this.lastEditDate; + data['CreatedBy'] = this.createdBy; + data['LastEditBy'] = this.lastEditBy; + data['IsActive'] = this.isActive; + data['Title'] = this.title; + data['TitleAR'] = this.titleAR; + data['Price'] = this.price; + data['isDefault'] = this.isDefault; + data['Visibility'] = this.visibility; + data['DurationId'] = this.durationId; + data['Description'] = this.description; + data['DescriptionAR'] = this.descriptionAR; + data['TotalPrice'] = this.totalPrice; + data['VAT'] = this.vAT; + return data; + } +} \ No newline at end of file diff --git a/lib/core/service/er/am_service.dart b/lib/core/service/er/am_service.dart new file mode 100644 index 00000000..181ad37b --- /dev/null +++ b/lib/core/service/er/am_service.dart @@ -0,0 +1,25 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; +import '../base_service.dart'; + +class AmService extends BaseService { + List AmModelList = List(); + Map body = Map(); + + Future getAllTransportationOrders() async { + hasError = false; + + await baseAppClient.post(GET_AMBULANCE_REQUEST, + onSuccess: (dynamic response, int statusCode) { + AmModelList.clear(); + response['AmModelList'].forEach((vital) { + AmModelList.add( + PatientER_RRT_GetAllTransportationMethodListModel.fromJson(vital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/viewModels/er/am_request_view_model.dart b/lib/core/viewModels/er/am_request_view_model.dart new file mode 100644 index 00000000..db1acbf0 --- /dev/null +++ b/lib/core/viewModels/er/am_request_view_model.dart @@ -0,0 +1,32 @@ + +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; +import 'package:diplomaticquarterapp/core/service/er/am_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import '../base_view_model.dart'; +import '../../../locator.dart'; + +class AmRequestViewModel extends BaseViewModel{ + + + AmService _amService = locator(); + + List get AmRequestModeList=> + _amService.AmModelList; + + getAmRequestOrders({int id, int projectID}) async { + setState(ViewState.Busy); + + + await _amService.getAllTransportationOrders(); + + if ( _amService.hasError) { + error = _amService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + + +} \ No newline at end of file diff --git a/lib/locator.dart b/lib/locator.dart index 6c8d178e..93715c99 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -5,6 +5,7 @@ import 'package:get_it/get_it.dart'; import 'core/service/appointment_rate_service.dart'; import 'core/service/dashboard_service.dart'; +import 'core/service/er/am_service.dart'; import 'core/service/er/er_service.dart'; import 'core/service/feedback/feedback_service.dart'; import 'core/service/hospital_service.dart'; @@ -18,6 +19,7 @@ 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/viewModels/appointment_rate_view_model.dart'; +import 'core/viewModels/er/am_request_view_model.dart'; import 'core/viewModels/er/near_hospital_view_model.dart'; import 'core/viewModels/feedback/feedback_view_model.dart'; import 'core/service/medical/reports_service.dart'; @@ -63,6 +65,9 @@ void setupLocator() { locator.registerFactory(() => VaccineService()); locator.registerLazySingleton(() => ReportsMonthlyService()); locator.registerLazySingleton(() => ErService()); + locator.registerLazySingleton(() => AmService()); + + locator.registerLazySingleton(() => PatientSickLeaveService()); locator.registerLazySingleton(() => MyBalanceService()); @@ -84,6 +89,7 @@ void setupLocator() { locator.registerFactory(() => QrViewModel()); locator.registerFactory(() => ReportsMonthlyViewModel()); locator.registerFactory(() => NearHospitalViewModel()); + locator.registerFactory(() => AmRequestViewModel()); locator.registerFactory(() => PatientSickLeaveViewMode()); locator.registerFactory(() => MyBalanceViewModel()); diff --git a/lib/pages/ErService/AmbulanceReq.dart b/lib/pages/ErService/AmbulanceReq.dart index e69de29b..9c4dfa29 100644 --- a/lib/pages/ErService/AmbulanceReq.dart +++ b/lib/pages/ErService/AmbulanceReq.dart @@ -0,0 +1,125 @@ +import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'dart:ui'; +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'; + +class AmbulanceReq extends StatefulWidget { + @override + _AmbulanceReqState createState() => _AmbulanceReqState(); +} + +class _AmbulanceReqState extends State + 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 BaseView( + onModelReady: (model) => model.getPrescriptions(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: "Ambulance Request", + body: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight(65.0), + child: Stack( + children: [ + 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.40, + child: Center( + child: Texts("Ambulance Request"),//TranslationBase.of(context).prescriptions + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.30, + child: Center( + child: Texts("Orders Log"), + ), + ), + ], + ), + ), + ), + ), + ], + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + PrescriptionsPage( + prescriptionsViewModel: model, + ), + PrescriptionsHistoryPage( + prescriptionsViewModel: model, + ) + ], + ), + ) + ], + ), + ), + ), + ); + } + +} diff --git a/lib/pages/ErService/ErOptions.dart b/lib/pages/ErService/ErOptions.dart index 6b6166bb..886d47d2 100644 --- a/lib/pages/ErService/ErOptions.dart +++ b/lib/pages/ErService/ErOptions.dart @@ -37,12 +37,7 @@ class _ErOptionsState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ -// Text(TranslationBase.of(context).searchBy, -// style: TextStyle( -// fontSize: 24.0, -// letterSpacing: 1.0, -// fontWeight: FontWeight.bold, -// color: new Color(0xFF60686b))), + Container( margin: EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 10.0), child: Row( diff --git a/lib/pages/ErService/widgets/card_common.dart b/lib/pages/ErService/widgets/card_common.dart index c65789c5..35ece966 100644 --- a/lib/pages/ErService/widgets/card_common.dart +++ b/lib/pages/ErService/widgets/card_common.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import '../AmbulanceReq.dart'; import '../NearestEr.dart'; class CardCommonEr extends StatelessWidget { @@ -21,7 +22,7 @@ class CardCommonEr extends StatelessWidget { return GestureDetector( onTap: () { navigateToSearch(context, this.type); - print("=============this.type============="+this.type); + }, child: Container( margin: EdgeInsets.fromLTRB(9.0, 9.0, 9.0, 9.0), @@ -61,16 +62,15 @@ class CardCommonEr extends StatelessWidget { Future navigateToSearch(context, type) async { //===Switch case=== if(type==0) - {print("========Ambalunce=========");} + { + + Navigator.push( + context, + FadePage( + page: AmbulanceReq())); + } else{ - print("=========Nearest ER==========="); -// Navigator.push( -// context, -// -// FadePage( -// // page: NearestEr(isAppbar: true,))); -// page: NearestEr())); Navigator.push( context, FadePage( @@ -79,11 +79,5 @@ class CardCommonEr extends StatelessWidget { } -// Navigator.push( -// context, -// MaterialPageRoute( -// builder: (context) => Search( -// type: type, -// ))); } } diff --git a/lib/pages/ErService/widgets/card_position.dart b/lib/pages/ErService/widgets/card_position.dart index 457f646d..8647ad62 100644 --- a/lib/pages/ErService/widgets/card_position.dart +++ b/lib/pages/ErService/widgets/card_position.dart @@ -40,7 +40,7 @@ class CardPosition extends StatelessWidget { }, child: Container( - width:170, + width:MediaQuery.of(context).size.width * 0.47,//165, margin: EdgeInsets.fromLTRB(7.0, 7.0, 7.0, 7.0), decoration: BoxDecoration(boxShadow: [ BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0) @@ -79,10 +79,8 @@ class CardPosition extends StatelessWidget { Future navigateToSearch(context, type,telephone,networkImage,latitude,longitude,projectname) async { -//===Switch case=== - print("================"+type); - print("================"+telephone); - print("================"+networkImage); + + showDialog( context: context,builder: (_) => AssetGiffyDialog( @@ -98,22 +96,6 @@ class CardPosition extends StatelessWidget { onOkButtonPressed: () { MapsLauncher.launchCoordinates(double.parse(latitude),double.parse(longitude),projectname);}, onCancelButtonPressed :() {launch("tel://" +telephone);} -// double.parse( -// _medicineProvider.pharmaciesList[index]["Latitude"]), -// double.parse( -// _medicineProvider.pharmaciesList[index]["Longitude"]), -// _medicineProvider.pharmaciesList[index] -// ["LocationDescription"]); - //launch("tel://" +telephone); -//================ -// MapsLauncher.launchCoordinates( -// double.parse( -// _medicineProvider.pharmaciesList[index]["Latitude"]), -// double.parse( -// _medicineProvider.pharmaciesList[index]["Longitude"]), -// _medicineProvider.pharmaciesList[index] -// ["LocationDescription"]); -//=================