diff --git a/lib/config/config.dart b/lib/config/config.dart index 1496b764..fe8aad21 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -21,8 +21,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; -// var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; +var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.201.204.103/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; @@ -709,6 +709,9 @@ var GET_PRESCRIPTION_INSTRUCTIONS_PDF = 'Services/ChatBot_Service.svc/REST/Chatb //PAYFORT var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails"; var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse"; + +var GET_SERVICES_PRICE_LIST = 'Services/OUTPs.svc/REST/GetServicesPriceList'; + var payFortEnvironment = FortEnvironment.production; var applePayMerchantId = "merchant.com.hmgwebservices"; // var payFortEnvironment = FortEnvironment.test; diff --git a/lib/core/model/services_price_list_response_model.dart b/lib/core/model/services_price_list_response_model.dart new file mode 100644 index 00000000..bb60094a --- /dev/null +++ b/lib/core/model/services_price_list_response_model.dart @@ -0,0 +1,54 @@ +class ServicesPriceListResponseModel { + int? createdBy; + String? createdOn; + int? editedBy; + String? editedOn; + int? id; + bool? isEnabled; + String? nameAR; + String? nameEN; + num? price; + int? rowID; + + ServicesPriceListResponseModel({ + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn, + this.id, + this.isEnabled, + this.nameAR, + this.nameEN, + this.price, + this.rowID, + }); + + ServicesPriceListResponseModel.fromJson(Map json) { + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + id = json['ID']; + isEnabled = json['IsEnabled']; + nameAR = json['NameAR']; + nameEN = json['NameEN']; + price = json['Price']; + rowID = json['RowID']; + } + + Map toJson() { + final Map data = {}; + data['CreatedBy'] = createdBy; + data['CreatedOn'] = createdOn; + data['EditedBy'] = editedBy; + data['EditedOn'] = editedOn; + data['ID'] = id; + data['IsEnabled'] = isEnabled; + data['NameAR'] = nameAR; + data['NameEN'] = nameEN; + data['Price'] = price; + data['RowID'] = rowID; + return data; + } +} + diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 61945a72..2c77ec83 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -189,8 +189,8 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; //0560717232 - // body['PatientID'] = 2039078; //4609100 - // body['TokenID'] = "@dm!n"; + body['PatientID'] = 4768663; //4609100 + body['TokenID'] = "@dm!n"; // Patient ID: 3027574 // Mobile no.: 0502303285 diff --git a/lib/core/service/privilege_service.dart b/lib/core/service/privilege_service.dart index a572d1a8..cd4a2be7 100644 --- a/lib/core/service/privilege_service.dart +++ b/lib/core/service/privilege_service.dart @@ -3,6 +3,7 @@ import 'package:hmg_patient_app/core/model/privilege/HMCProjectListModel.dart'; import 'package:hmg_patient_app/core/model/privilege/PrivilegeModel.dart'; import 'package:hmg_patient_app/core/model/privilege/ProjectDetailListModel.dart'; import 'package:hmg_patient_app/core/model/privilege/VidaPlusProjectListModel.dart'; +import 'package:hmg_patient_app/core/model/services_price_list_response_model.dart'; import 'package:hmg_patient_app/core/service/base_service.dart'; import 'package:hmg_patient_app/main.dart'; @@ -12,6 +13,8 @@ class PrivilegeService extends BaseService { List hMCProjectListModel = []; List projectDetailListModel = []; + List servicesPriceList = []; + dynamic hisOffersList; Future offerDetailsAPICall() async { @@ -28,6 +31,25 @@ class PrivilegeService extends BaseService { return Future.value(localRes); } + Future getServicesPriceList({ + String searchKey = "", + int pageIndex = 0, + int pageSize = 0, + }) async { + Map request = {"ID": 1, "SearchKey": searchKey, "PageIndex": pageIndex, "PageSize": pageSize, "RowCount": 0, "TokenID": "@dm!n"}; + + dynamic localRes; + await baseAppClient.post(GET_SERVICES_PRICE_LIST, onSuccess: (response, statusCode) async { + response['getServicesPriceList'].forEach((item) { + servicesPriceList.add(ServicesPriceListResponseModel.fromJson(item)); + }); + servicesPriceList.removeWhere((element) => element.isEnabled == false); + }, onFailure: (String error, int statusCode) { + localRes = {"error": error}; + // throw error; + }, body: request); + } + Future getPrivilege() async { Map body = Map(); body['PatientType'] = 4; diff --git a/lib/pages/servicesPriceList/services_price_list.dart b/lib/pages/servicesPriceList/services_price_list.dart index dbe5b84e..e6aff6c9 100644 --- a/lib/pages/servicesPriceList/services_price_list.dart +++ b/lib/pages/servicesPriceList/services_price_list.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:hmg_patient_app/core/service/privilege_service.dart'; import 'package:hmg_patient_app/core/viewModels/project_view_model.dart'; +import 'package:hmg_patient_app/locator.dart'; import 'package:hmg_patient_app/theme/colors.dart'; import 'package:hmg_patient_app/uitl/translations_delegate_base.dart'; import 'package:hmg_patient_app/uitl/utils_new.dart'; @@ -11,6 +13,7 @@ class ServicesPriceList extends StatelessWidget { ServicesPriceList({super.key}); ProjectViewModel? projectViewModel; + PrivilegeService _privilegeService = locator(); @override Widget build(BuildContext context) { @@ -75,262 +78,67 @@ class ServicesPriceList extends StatelessWidget { height: 1, color: CustomColors.black, ), - SizedBox(height: 8), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - TranslationBase.of(context).servicePriceList1, - style: TextStyle( - color: CustomColors.textColor, - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.64, - ), - ), - Row( - children: [ - projectViewModel!.isArabic ? Container() : SvgPicture.asset("assets/images/new/Saudi_Riyal_Symbol.svg", width: 16, height: 16), - mWidth(6), - Text( - "315", - style: TextStyle( - color: CustomColors.textDarkColor, - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.64, - ), - ), - mWidth(6), - projectViewModel!.isArabic ? SvgPicture.asset("assets/images/new/Saudi_Riyal_Symbol.svg", width: 16, height: 16) : Container(), - ], - ), - ], - ), - SizedBox(height: 16), - Divider( - height: 1, - color: CustomColors.devider, - ), - SizedBox(height: 16), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - TranslationBase.of(context).servicePriceList2, - style: TextStyle( - color: CustomColors.textColor, - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.64, - ), - ), - Row( - children: [ - projectViewModel!.isArabic ? Container() : SvgPicture.asset("assets/images/new/Saudi_Riyal_Symbol.svg", width: 16, height: 16), - mWidth(6), - Text( - "210", - style: TextStyle( - color: CustomColors.textDarkColor, - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.64, - ), - ), - mWidth(6), - projectViewModel!.isArabic ? SvgPicture.asset("assets/images/new/Saudi_Riyal_Symbol.svg", width: 16, height: 16) : Container(), - ], - ), - ], - ), SizedBox(height: 16), - Divider( - height: 1, - color: CustomColors.devider, - ), - SizedBox(height: 16), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - TranslationBase.of(context).servicePriceList3, - style: TextStyle( - color: CustomColors.textColor, - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.64, - ), - ), - Row( - children: [ - projectViewModel!.isArabic ? Container() : SvgPicture.asset("assets/images/new/Saudi_Riyal_Symbol.svg", width: 16, height: 16), - mWidth(6), - Text( - "160", - style: TextStyle( - color: CustomColors.textDarkColor, - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.64, - ), - ), - mWidth(6), - projectViewModel!.isArabic ? SvgPicture.asset("assets/images/new/Saudi_Riyal_Symbol.svg", width: 16, height: 16) : Container(), - ], - ), - ], - ), - SizedBox(height: 16), - Divider( - height: 1, - color: CustomColors.devider, - ), - SizedBox(height: 16), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - TranslationBase.of(context).servicePriceList4, - style: TextStyle( - color: CustomColors.textColor, - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.64, - ), - ), - Row( - children: [ - projectViewModel!.isArabic ? Container() : SvgPicture.asset("assets/images/new/Saudi_Riyal_Symbol.svg", width: 16, height: 16), - mWidth(6), - Text( - "210", - style: TextStyle( - color: CustomColors.textDarkColor, - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.64, - ), - ), - mWidth(6), - projectViewModel!.isArabic ? SvgPicture.asset("assets/images/new/Saudi_Riyal_Symbol.svg", width: 16, height: 16) : Container(), - ], - ), - ], - ), - SizedBox(height: 16), - Divider( - height: 1, - color: CustomColors.devider, - ), - SizedBox(height: 16), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - TranslationBase.of(context).servicePriceList5, - style: TextStyle( - color: CustomColors.textColor, - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.64, - ), - ), - Row( - children: [ - projectViewModel!.isArabic ? Container() : SvgPicture.asset("assets/images/new/Saudi_Riyal_Symbol.svg", width: 16, height: 16), - mWidth(6), - Text( - "160", - style: TextStyle( - color: CustomColors.textDarkColor, - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.64, - ), - ), - mWidth(6), - projectViewModel!.isArabic ? SvgPicture.asset("assets/images/new/Saudi_Riyal_Symbol.svg", width: 16, height: 16) : Container(), - ], - ), - ], - ), - SizedBox(height: 16), - Divider( - height: 1, - color: CustomColors.devider, - ), - SizedBox(height: 16), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - TranslationBase.of(context).servicePriceList6, - style: TextStyle( - color: CustomColors.textColor, - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.64, - ), - ), - Row( - children: [ - projectViewModel!.isArabic ? Container() : SvgPicture.asset("assets/images/new/Saudi_Riyal_Symbol.svg", width: 16, height: 16), - mWidth(6), - Text( - "160", - style: TextStyle( - color: CustomColors.textDarkColor, - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.64, - ), + + ListView.separated( + shrinkWrap: true, + padding: EdgeInsets.zero, + physics: NeverScrollableScrollPhysics(), + itemCount: _privilegeService.servicesPriceList.length, + separatorBuilder: (context, index) => + Padding( + padding: EdgeInsets.symmetric(vertical: 12), + child: Divider( + height: 1, + color: CustomColors.devider, ), - mWidth(6), - projectViewModel!.isArabic ? SvgPicture.asset("assets/images/new/Saudi_Riyal_Symbol.svg", width: 16, height: 16) : Container(), - ], - ), - ], - ), - SizedBox(height: 16), - Divider( - height: 1, - color: CustomColors.devider, - ), - SizedBox(height: 16), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - TranslationBase.of(context).servicePriceList7, - style: TextStyle( - color: CustomColors.textColor, - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.64, ), - ), - Row( + itemBuilder: (context, index) { + final service = _privilegeService.servicesPriceList[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - projectViewModel!.isArabic ? Container() : SvgPicture.asset("assets/images/new/Saudi_Riyal_Symbol.svg", width: 16, height: 16), - mWidth(6), - Text( - "150", - style: TextStyle( - color: CustomColors.textDarkColor, - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.64, - ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + (projectViewModel!.isArabic ? service.nameAR ?? service.nameEN ?? '' : service.nameEN ?? service.nameAR ?? ''), + style: TextStyle( + color: CustomColors.textColor, + fontSize: 14, + fontWeight: FontWeight.bold, + letterSpacing: -0.64, + ), + ), + ), + Row( + children: [ + projectViewModel!.isArabic ? Container() : SvgPicture.asset("assets/images/new/Saudi_Riyal_Symbol.svg", width: 16, height: 16), + mWidth(6), + Text( + '${service.price ?? 0}', + style: TextStyle( + color: CustomColors.textDarkColor, + fontSize: 14, + fontWeight: FontWeight.bold, + letterSpacing: -0.64, + ), + ), + mWidth(6), + projectViewModel!.isArabic ? SvgPicture.asset("assets/images/new/Saudi_Riyal_Symbol.svg", width: 16, height: 16) : Container(), + ], + ), + ], ), - mWidth(6), - projectViewModel!.isArabic ? SvgPicture.asset("assets/images/new/Saudi_Riyal_Symbol.svg", width: 16, height: 16) : Container(), ], - ), - ], + ); + }, ), ], )), + SizedBox(height: 16), Container( padding: EdgeInsets.all(16), diff --git a/lib/splashPage.dart b/lib/splashPage.dart index 9319ecc6..8fe39a48 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -51,6 +51,7 @@ class _SplashScreenState extends State { LocalNotification.init(onNotificationClick: (payload) {}); // LocalNotification.getInstance().showNow(title: "Payload", subtitle: "Subtitle", payload: "Payload"); if (!_privilegeService.hasError) { + _privilegeService.getServicesPriceList(); Navigator.of(context).pushReplacement( MaterialPageRoute( builder: (BuildContext context) => LandingPage(), diff --git a/pubspec.yaml b/pubspec.yaml index fe3d066a..cf5e9986 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,8 +1,8 @@ name: hmg_patient_app description: A new Flutter application. -#version: 4.6.022+1 -version: 4.6.0982+40500982 +version: 4.6.028+1 +#version: 4.6.0982+40500982 environment: # sdk: ">=3.0.0 <3.13.0"