Merge branch 'development_new_design_2.0' into haroon-new-design

merge-requests/404/head
haroon amjad 5 years ago
commit dfeb249a54

@ -0,0 +1,35 @@
//package com.cloud.diplomaticquarterapp
package com.ejada.hmg
import io.flutter.app.FlutterApplication
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
import io.flutter.plugins.GeneratedPluginRegistrant
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
class Application : FlutterApplication(), PluginRegistrantCallback {
override fun onCreate() {
super.onCreate()
FlutterFirebaseMessagingService.setPluginRegistrant(this)
}
override fun registerWith(registry: PluginRegistry) {
io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
}
}
//import io.flutter.app.FlutterApplication
//import io.flutter.plugin.common.PluginRegistry
//import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
//import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
//
//class Application : FlutterApplication(), PluginRegistrantCallback {
// override fun onCreate() {
// super.onCreate()
// FlutterFirebaseMessagingService.setPluginRegistrant(this)
// }
//
// override fun registerWith(registry: PluginRegistry?) {
// FirebaseCloudMessagingPluginRegistrant.registerWith(registry)
// }
//}

@ -0,0 +1,23 @@
//package com.cloud.diplomaticquarterapp
package com.ejada.hmg
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin
object FirebaseCloudMessagingPluginRegistrant {
fun registerWith(registry: PluginRegistry?) {
if (alreadyRegisteredWith(registry)) {
return
}
FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"))
}
private fun alreadyRegisteredWith(registry: PluginRegistry?): Boolean {
val key: String? = FirebaseCloudMessagingPluginRegistrant::class.java.canonicalName
if (registry?.hasPlugin(key)!!) {
return true
}
registry.registrarFor(key)
return false
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

@ -12,16 +12,16 @@ const PACKAGES_PRODUCTS = '/api/products';
const PACKAGES_CUSTOMER = '/api/customers';
const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items';
const PACKAGES_ORDERS = '/api/orders';
const BASE_URL = 'https://uat.hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
// Pharmacy UAT URLs
const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
// const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
// const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
// Pharmacy Production URLs
// const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/';
// const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/';
const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/';
const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/';
const PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity';

@ -4,13 +4,14 @@ import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart';
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/models/rrt/service_price.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import '../base_view_model.dart';
class RRTService extends BaseService {}
@ -25,6 +26,9 @@ class RRTViewModel extends BaseViewModel {
var _service = RRTService();
var _pharmacy_service = locator<PharmacyModuleService>();
var _pharmacy_address_service = locator<PharmacyAddressService>();
CustomerAddressesService _customerAddressesService = locator<CustomerAddressesService>();
List<AddressInfo> get addressesList => _customerAddressesService.addressesList;
_RRTServiceData rrtServiceData = _RRTServiceData();
@ -44,7 +48,6 @@ class RRTViewModel extends BaseViewModel {
int requestNo;
await _service.baseAppClient.post(PATIENT_ER_INSERT_PRES_ORDER, body: body, onSuccess: (response, statusCode) {
localRes = response;
requestNo = response['RequestNo'];
}, onFailure: (error, statusCode) {
AppToast.showErrorToast(message: error);
@ -124,9 +127,7 @@ class RRTViewModel extends BaseViewModel {
return Future.value(success);
}
Future getCancelReasons() {}
Future<List<Addresses>> getAddresses() async {
Future<List<AddressInfo>> getAddresses() async {
Object error;
try {
var token = await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN);
@ -140,4 +141,29 @@ class RRTViewModel extends BaseViewModel {
}
Future.error(error);
}
Future getCustomerAddresses() async {
setState(ViewState.Busy);
await _customerAddressesService.getCustomerAddresses();
if (_customerAddressesService.hasError) {
error = _customerAddressesService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
Future getCustomerInfo() async {
setState(ViewState.Busy);
await _pharmacy_service.generatePharmacyToken();
if (_customerAddressesService.hasError) {
error = _customerAddressesService.error;
await _pharmacy_service.createUser();
await getCustomerAddresses();
setState(ViewState.ErrorLocal);
} else {
await _customerAddressesService.getCustomerInfo();
await getCustomerAddresses();
}
}
}

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Country.dart';
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart';
import 'package:google_maps_place_picker/google_maps_place_picker.dart';
@ -9,10 +10,9 @@ import '../../../locator.dart';
import '../base_view_model.dart';
class PharmacyAddressesViewModel extends BaseViewModel {
PharmacyAddressService _pharmacyAddressService =
locator<PharmacyAddressService>();
PharmacyAddressService _pharmacyAddressService = locator<PharmacyAddressService>();
List<Addresses> get addresses => _pharmacyAddressService.addresses;
List<AddressInfo> get addresses => _pharmacyAddressService.addresses;
int get selectedAddressIndex => _pharmacyAddressService.selectedAddressIndex;
@ -33,13 +33,13 @@ class PharmacyAddressesViewModel extends BaseViewModel {
}
}
Future addEditAddress(PickResult value, Addresses editedAddress) async {
Future addEditAddress(PickResult value, AddressInfo editedAddress) async {
setState(ViewState.Busy);
Addresses sendingAddress;
AddressInfo sendingAddress;
if (editedAddress == null) {
sendingAddress = Addresses();
sendingAddress = AddressInfo();
sendingAddress.id = "0";
sendingAddress.firstName = user.firstName;
sendingAddress.lastName = user.lastName;
@ -88,7 +88,7 @@ class PharmacyAddressesViewModel extends BaseViewModel {
}
}
Future deleteAddresses(Addresses sendingAddress) async {
Future deleteAddresses(AddressInfo sendingAddress) async {
setState(ViewState.Busy);
await _pharmacyAddressService.deleteCustomerAddress(sendingAddress);
if (_pharmacyAddressService.hasError) {
@ -99,7 +99,7 @@ class PharmacyAddressesViewModel extends BaseViewModel {
}
}
Future saveSelectedAddressLocally(Addresses selectedAddress) async {
Future saveSelectedAddressLocally(AddressInfo selectedAddress) async {
await sharedPref.setObject(PHARMACY_SELECTED_ADDRESS, selectedAddress);
}
}

@ -102,50 +102,51 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
return mDivider(Colors.grey);
},
itemCount: widget.model.cmcAllServicesList.length),
Card(
shape: cardRadius(12),
elevation: 4,
child: Container(
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(left: 12, right: 12, top: 12),
child: Text(
TranslationBase.of(context).coveredService,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.45,
),
),
),
ListView.separated(
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.all(12.0),
child: Text(
widget.model.checkupItems[index].itemName,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: -0.45,
),
),
);
},
separatorBuilder: (context, index) {
return mDivider(Colors.grey);
},
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: widget.model.checkupItems.length,
),
],
),
),
),
Image.asset(projectViewModel.isArabic?"assets/images/cc_ar.png":"assets/images/cc_en.png",width: double.infinity,),
// Card(
// shape: cardRadius(12),
// elevation: 4,
// child: Container(
// width: double.infinity,
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Padding(
// padding: const EdgeInsets.only(left: 12, right: 12, top: 12),
// child: Text(
// TranslationBase.of(context).coveredService,
// style: TextStyle(
// fontSize: 14,
// fontWeight: FontWeight.w600,
// letterSpacing: -0.45,
// ),
// ),
// ),
// ListView.separated(
// itemBuilder: (context, index) {
// return Padding(
// padding: const EdgeInsets.all(12.0),
// child: Text(
// widget.model.checkupItems[index].itemName,
// style: TextStyle(
// fontSize: 12,
// fontWeight: FontWeight.w600,
// letterSpacing: -0.45,
// ),
// ),
// );
// },
// separatorBuilder: (context, index) {
// return mDivider(Colors.grey);
// },
// physics: NeverScrollableScrollPhysics(),
// shrinkWrap: true,
// itemCount: widget.model.checkupItems.length,
// ),
// ],
// ),
// ),
// ),
],
),
),

@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -27,468 +28,148 @@ class OrdersLogDetailsPage extends StatelessWidget {
void showConfirmMessage(CMCViewModel model, GetHHCAllPresOrdersResponseModel order) {
showDialog(
context: context,
child: ConfirmCancelOrderDialog(
model: model,
onTap: () async {
UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3);
await model.updateCmcPresOrder(updatePresOrderRequestModel);
if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
} else {
AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully);
await model.getCmcAllPresOrders();
}
},
));
context: context,
child: ConfirmCancelOrderDialog(
model: model,
onTap: () async {
UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3);
await model.updateCmcPresOrder(updatePresOrderRequestModel);
if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
} else {
AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully);
await model.getCmcAllPresOrders();
}
},
),
);
}
return AppScaffold(
isShowAppBar: false,
baseViewModel: model,
body:
// ListView.separated(
// physics: BouncingScrollPhysics(),
// padding: EdgeInsets.all(21),
// separatorBuilder: (context, index) {
// return SizedBox(height: 12);
// },
// itemBuilder: (context, index) {
// int status = model.cmcAllPresOrders[index].status;
// String _statusDisp = projectViewModel.isArabic ? model.cmcAllPresOrders[index].descriptionN : model.cmcAllPresOrders[index].description;
// Color _color;
// if (status == 1) {
// //pending
// _color = Color(0xffCC9B14);
// } else if (status == 2) {
// //processing
// _color = Color(0xff2E303A);
// } else if (status == 3) {
// //completed
// _color = Color(0xff359846);
// } else if (status == 4) {
// //cancel // Rejected
// _color = Color(0xffD02127);
// }
//
// return InkWell(
// // onTap: () => Navigator.push(
// // context,
// // FadePage(
// // page: PrescriptionsHistoryDetailsPage(
// // prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index],
// // ),
// // ),
// // ),
// child: Container(
// height: 65,
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.all(
// Radius.circular(10.0),
// ),
// boxShadow: [
// BoxShadow(
// color: Color(0xff000000).withOpacity(.05),
// blurRadius: 27,
// offset: Offset(0, -3),
// ),
// ],
// ),
// child: Row(
// mainAxisSize: MainAxisSize.min,
// children: [
// Container(
// width: 6,
// decoration: BoxDecoration(
// color: _color,
// borderRadius: BorderRadius.only(
// topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
// bottomLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
// topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
// bottomRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
// ),
// ),
// ),
// Expanded(
// child: Padding(
// padding: EdgeInsets.only(left: projectViewModel.isArabic ? 6 : 12, right: projectViewModel.isArabic ? 12 : 6),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisSize: MainAxisSize.min,
// children: [
// Expanded(
// child: Column(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// _statusDisp,
// style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10),
// ),
// Text(
// '${TranslationBase.of(context).orderNo}. ${model.cmcAllPresOrders[index].iD}',
// style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
// ),
// ],
// ),
// ),
// Column(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.end,
// children: [
// Text(
// DateUtil.formatDateToDate(DateUtil.convertStringToDate(model.cmcAllPresOrders[index].createdOn), projectViewModel.isArabic),
// style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10),
// ),
// Text(
// DateUtil.formatDateToTime(DateUtil.convertStringToDate(model.cmcAllPresOrders[index].createdOn)),
// style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
// ),
// ],
// )
// ],
// ),
// ),
// ),
// Icon(
// Icons.arrow_forward_ios,
// size: 16,
// ),
// mWidth(6),
// ],
// ),
// ));
// },
// itemCount: model.cmcAllPresOrders.length,
// ),
body: ListView.separated(
padding: EdgeInsets.all(21),
physics: BouncingScrollPhysics(),
itemBuilder: (context, index) {
GetHHCAllPresOrdersResponseModel order = model.cmcAllPresOrders[index];
SingleChildScrollView(
physics: ScrollPhysics(),
child: Container(
margin: EdgeInsets.all(10),
child: Center(
child: FractionallySizedBox(
widthFactor: 0.94,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: model.cmcAllPresOrders.map((order) {
return Container(
// margin: EdgeInsets.all(10),
child: Container(
width: double.infinity,
padding: EdgeInsets.only(left: 12, right: 12, top: 12),
child: Card(
shape: cardRadius(12),
elevation: 2,
margin: EdgeInsets.zero,
color: order.status == 4
? Colors.red[900]
: order.status == 3
? Colors.green[400]
: Color(0xffcd9e1b),
clipBehavior: Clip.antiAlias,
child: Container(
// decoration: containerColorRadiusLeft(Colors.white, 12),
margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 8, right: projectViewModel.isArabic ? 8 : 0),
padding: EdgeInsets.all(12),
// color: Colors.white,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0),
topRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero,
bottomLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0),
bottomRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero,
),
),
// clipBehavior: Clip.antiAlias,
child: Row(
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context).OrderStatus + ' ' + (projectViewModel.isArabic ? order.descriptionN : order.description),
bold: false,
fontSize: 12,
color: order.status == 4
? Colors.red[900]
: order.status == 3
? Colors.green[400]
: Color(0xffcd9e1b),
fontWeight: FontWeight.bold,
),
Texts(
TranslationBase.of(context).requestID + ' ' + order.iD.toString(),
fontWeight: FontWeight.w600,
fontSize: 18,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context).orderLocation,
bold: false,
fontSize: 13,
),
SizedBox(
height: 4,
),
Texts(
!projectViewModel.isArabic ? order.nearestProjectDescription.toString() : order.nearestProjectDescriptionN.toString(),
fontSize: 13,
),
],
)
],
)),
Column(
children: [
Texts(
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(order.createdOn)),
fontSize: 14,
),
SizedBox(height: 8),
(order.status == 1 || order.status == 2)
? SecondaryButton(
onTap: () {
showConfirmMessage(model, order);
},
label: TranslationBase.of(context).cancel,
color: Colors.red[900],
small: true,
)
: SizedBox()
],
),
],
))),
));
}).toList())
int status = order.status;
String _statusDisp = projectViewModel.isArabic ? order.descriptionN : order.description;
Color _color;
if (status == 1) {
//pending
_color = Color(0xffCC9B14);
} else if (status == 2) {
//processing
_color = Color(0xff2E303A);
} else if (status == 3) {
//completed
_color = Color(0xff359846);
} else if (status == 4) {
//cancel // Rejected
_color = Color(0xffD02127);
}
return Container(
decoration: BoxDecoration(
color: _color,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
blurRadius: 27,
offset: Offset(0, -3),
),
],
),
),
),
),
),
// SingleChildScrollView(
// physics: ScrollPhysics(),
// child: Container(
// margin: EdgeInsets.all(12),
// child: Center(
// child: FractionallySizedBox(
// widthFactor: 0.94,
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: model.cmcAllPresOrders.map((order) {
// return Container(
// width: double.infinity,
// margin: EdgeInsets.only(top: 12),
// clipBehavior: Clip.antiAlias,
// decoration: BoxDecoration(border: Border.all(color: Colors.grey, width: 1), borderRadius: BorderRadius.circular(12), color: Colors.white),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// SizedBox(
// height: 6,
// ),
// Container(
// width: double.infinity,
// padding: EdgeInsets.only(left: 15, bottom: 15, top: 8, right: 15),
// decoration: BoxDecoration(
// border: Border(
// bottom: BorderSide(
// color: Colors.grey,
// width: 1.0,
// ),
// ),
// // borderRadius: BorderRadius.circular(12),
// ),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// TranslationBase.of(context).requestID,
// style: TextStyle(
// fontSize: 13,
// fontWeight: FontWeight.w600,
// letterSpacing: -0.45,
// ),
// ),
// SizedBox(
// height: 4,
// ),
// Text(
// order.iD.toString(),
// style: TextStyle(
// fontSize: 18,
// fontWeight: FontWeight.w600,
// letterSpacing: -0.45,
// ),
// ),
// ],
// ),
// ),
// Container(
// width: double.infinity,
// padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15),
// decoration: BoxDecoration(
// border: Border(
// bottom: BorderSide(
// color: Colors.grey,
// width: 1.0,
// ),
// ),
// // borderRadius: BorderRadius.circular(12),
// ),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// TranslationBase.of(context).OrderStatus,
// style: TextStyle(
// fontSize: 13,
// fontWeight: FontWeight.w600,
// letterSpacing: -0.45,
// ),
// ),
// SizedBox(
// height: 4,
// ),
// Text(
// projectViewModel.isArabic ? order.descriptionN : order.description,
// style: TextStyle(
// fontSize: 18,
// fontWeight: FontWeight.w600,
// letterSpacing: -0.45,
// ),
// ),
// ],
// ),
// ),
// Container(
// width: double.infinity,
// padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15),
// decoration: BoxDecoration(
// border: Border(
// bottom: BorderSide(
// color: Colors.grey,
// width: 1.0,
// ),
// ),
// // borderRadius: BorderRadius.circular(12),
// ),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// TranslationBase.of(context).pickupDate,
// style: TextStyle(
// fontSize: 13,
// fontWeight: FontWeight.w600,
// letterSpacing: -0.45,
// ),
// ),
// SizedBox(
// height: 4,
// ),
// Text(
// DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(order.createdOn)),
// style: TextStyle(
// fontSize: 18,
// fontWeight: FontWeight.w600,
// letterSpacing: -0.45,
// ),
// ),
// ],
// ),
// ),
// Container(
// width: double.infinity,
// clipBehavior: Clip.antiAlias,
// padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15),
// decoration: BoxDecoration(
// border: Border(
// bottom: BorderSide(
// color: (order.status == 1 || order.status == 2) ? Colors.grey : Colors.transparent,
// width: (order.status == 1 || order.status == 2) ? 1.0 : 0,
// ),
// ),
// // borderRadius: BorderRadius.circular(12),
// ),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// TranslationBase.of(context).orderLocation,
// style: TextStyle(
// fontSize: 13,
// fontWeight: FontWeight.w600,
// letterSpacing: -0.45,
// ),
// ),
// SizedBox(
// height: 4,
// ),
// Text(
// !projectViewModel.isArabic ? order.projectDescription.toString() : order.projectDescriptionN.toString(),
// style: TextStyle(
// fontSize: 13,
// fontWeight: FontWeight.w600,
// letterSpacing: -0.45,
// ),
// ),
// ],
// ),
// ),
// (order.status == 1 || order.status == 2)
// ? SizedBox(
// height: 12,
// )
// : Container(),
// if (order.status == 1 || order.status == 2)
// Center(
// child: Container(
// width: MediaQuery.of(context).size.width * 0.85,
// child: SecondaryButton(
// label: TranslationBase.of(context).cancel.toUpperCase(),
// onTap: () {
// showConfirmMessage(model, order);
// },
// color: Colors.red[800],
// disabled: false,
// textColor: Theme.of(context).backgroundColor),
// ),
// ),
// (order.status == 1 || order.status == 2)
// ? SizedBox(
// height: 12,
// )
// : SizedBox(
// height: 2,
// ),
// ],
// ),
// );
// }).toList())
// ],
// ),
// ),
// ),
// ),
// ),
child: Container(
// decoration: containerColorRadiusLeft(Colors.white, 12),
margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0),
padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.white, width: 1),
borderRadius: BorderRadius.only(
bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
),
),
// clipBehavior: Clip.antiAlias,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_statusDisp,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10),
),
SizedBox(height: 6),
Text(
'${TranslationBase.of(context).requestID}: ${order.iD}',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context).serviceName + ": ",
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
),
Expanded(
child: Text(
!projectViewModel.isArabic ? order.nearestProjectDescription.trim().toString() : order.nearestProjectDescriptionN.toString(),
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56),
),
),
],
)
],
),
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.createdOn), projectViewModel.isArabic),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10),
),
SizedBox(height: 12),
if (order.status == 1 || order.status == 2)
InkWell(
onTap: () {
showConfirmMessage(model, order);
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14),
decoration: BoxDecoration(
color: Color(0xffD02127),
border: Border.all(color: Colors.white, width: 1),
borderRadius: BorderRadius.circular(10),
),
child: Text(
TranslationBase.of(context).cancel_nocaps,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4),
),
),
),
],
),
],
),
),
);
},
separatorBuilder: (context, index) => SizedBox(height: 12),
itemCount: model.cmcAllPresOrders.length),
);
}
}

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/PatientERHHCInsertServicesList.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart';
@ -7,6 +8,7 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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';
@ -45,107 +47,76 @@ class _NewHomeHealthCareStepOnePageState extends State<NewHomeHealthCareStepOneP
body: Column(
children: [
Expanded(
child: SingleChildScrollView(
physics: ScrollPhysics(),
child: Container(
margin: EdgeInsets.only(left: MediaQuery.of(context).size.width * 0.05, right: MediaQuery.of(context).size.width * 0.05, top: MediaQuery.of(context).size.width * 0.05),
child: Center(
child: FractionallySizedBox(
widthFactor: 1,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
child: ListView.separated(
physics: BouncingScrollPhysics(),
padding: EdgeInsets.only(left: 21, right: 21, top: 12, bottom: 12),
itemBuilder: (context, index) {
HHCGetAllServicesResponseModel service = widget.model.hhcAllServicesList[index];
return Padding(
padding: const EdgeInsets.only(top: 4, bottom: 4),
child: Row(
children: [
// Texts(
// TranslationBase.of(context).selectHomeHealthCareServices,
// textAlign: TextAlign.center,
// ),
Column(
children: widget.model.hhcAllServicesList.map((service) {
return Container(
margin: EdgeInsets.only(top: 10),
decoration: BoxDecoration(
// border: Border.all(color: Colors.grey, width: 1),
borderRadius: BorderRadius.circular(12),
),
child: Column(
children: [
Row(
children: [
Checkbox(
value: isServiceSelected(service.serviceID),
activeColor: Colors.red[800],
tristate: false,
onChanged: (bool newValue) {
setState(() {
if (!isServiceSelected(service.serviceID))
widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.add(PatientERHHCInsertServicesList(
recordID: widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length,
serviceID: service.serviceID,
serviceName: service.description));
else
removeSelected(service.serviceID);
// widget.patientERInsertPresOrderRequestModel
// isPatientInsured = newValue;
});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 0.0, right: 10),
child: Texts(
projectViewModel.isArabic ? service.descriptionN : service.description.toLowerCase()?.capitalize(),
fontSize: 15,
style: 'letterSpacing: -0.48',
fontWeight: FontWeight.bold,
),
),
),
],
),
Divider(
height: 1,
color: Colors.grey,
)
],
),
);
}).toList(),
Checkbox(
value: isServiceSelected(service.serviceID),
activeColor: Color(0xffD02127),
tristate: false,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onChanged: (bool newValue) {
setState(() {
if (!isServiceSelected(service.serviceID))
widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.add(PatientERHHCInsertServicesList(
recordID: widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length, serviceID: service.serviceID, serviceName: service.description));
else
removeSelected(service.serviceID);
// widget.patientERInsertPresOrderRequestModel
// isPatientInsured = newValue;
});
}),
SizedBox(width: 6),
Expanded(
child: Text(
projectViewModel.isArabic ? service.descriptionN : service.description.toLowerCase()?.capitalize(),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64),
),
),
SizedBox(height: 20)
],
),
),
),
),
),
);
},
separatorBuilder: (context, index) => Divider(
height: 1,
color: Color(0xffE5E5E5),
),
itemCount: widget.model.hhcAllServicesList.length),
),
Container(
width: MediaQuery.of(context).size.width,
height: 70.0,
color: Theme.of(context).scaffoldBackgroundColor,
margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0),
child: Button(
onTap: () async {
widget.model.setState(ViewState.Busy);
await widget.model.getCustomerInfo();
if (widget.model.state == ViewState.ErrorLocal) {
Utils.showErrorToast();
} else {
Navigator.push(
context,
FadePage(
page: NewHomeHealthCareStepTowPage(
patientERInsertPresOrderRequestModel: widget.patientERInsertPresOrderRequestModel,
model: widget.model,
),
),
);
}
},
label: TranslationBase.of(context).next,
backgroundColor:
(this.widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length == 0 || widget.model.state == ViewState.BusyLocal) ? Colors.grey : Colors.red[900],
disabled: this.widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length == 0 || widget.model.state == ViewState.BusyLocal,
loading: widget.model.state == ViewState.BusyLocal,
color: Colors.white,
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
child: DefaultButton(
TranslationBase.of(context).next,
(this.widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length == 0 || widget.model.state == ViewState.BusyLocal)
? null
: () async {
widget.model.setState(ViewState.Busy);
await widget.model.getCustomerInfo();
if (widget.model.state == ViewState.ErrorLocal) {
Utils.showErrorToast();
} else {
Navigator.push(
context,
FadePage(
page: NewHomeHealthCareStepTowPage(
patientERInsertPresOrderRequestModel: widget.patientERInsertPresOrderRequestModel,
model: widget.model,
),
),
);
}
},
disabledColor: Color(0xff575757),
),
),
],

@ -2,12 +2,14 @@ import 'dart:ui';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.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/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'NewHomeHealthCare/new_home_health_care_page.dart';
import 'orders_log_details_page.dart';
@ -34,6 +36,7 @@ class _HomeHealthCarePageState extends State<HomeHealthCarePage> with SingleTick
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<HomeHealthCareViewModel>(
onModelReady: (model) {
model.getHHCAllPresOrders();
@ -45,67 +48,44 @@ class _HomeHealthCarePageState extends State<HomeHealthCarePage> with SingleTick
showNewAppBar: true,
showNewAppBarTitle: true,
imagesInfo: [ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/HHC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/HHC/en/0.png')],
body: Scaffold(
extendBodyBehindAppBar: true,
appBar: PreferredSize(
preferredSize: Size.fromHeight(65.0),
child: Stack(
children: <Widget>[
Center(
child: Center(
child: TabBar(
isScrollable: true,
controller: _tabController,
indicatorWeight: 5.0,
indicatorSize: TabBarIndicatorSize.tab,
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.37,
child: Center(
child: Texts(
TranslationBase.of(context).homeHealthCare,
color: Colors.black,
),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.37,
child: Center(
child: Texts(
TranslationBase.of(context).orderLog,
color: Colors.black,
),
),
),
],
),
),
),
],
body: Column(
children: <Widget>[
TabBar(
controller: _tabController,
indicatorWeight: 3.0,
indicatorSize: TabBarIndicatorSize.tab,
labelColor: Color(0xff2B353E),
unselectedLabelColor: Color(0xff575757),
labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20),
labelStyle: TextStyle(
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
),
unselectedLabelStyle: TextStyle(
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
),
tabs: [Text(TranslationBase.of(context).homeHealthCare), Text(TranslationBase.of(context).orderLog)],
),
),
body: Column(
children: <Widget>[
Expanded(
child: TabBarView(
physics: BouncingScrollPhysics(),
controller: _tabController,
children: <Widget>[
NewHomeHealthCarePage(
model: model,
),
OrdersLogDetailsPage(
model: model,
)
],
),
)
],
),
Expanded(
child: TabBarView(
physics: BouncingScrollPhysics(),
controller: _tabController,
children: <Widget>[
NewHomeHealthCarePage(
model: model,
),
OrdersLogDetailsPage(
model: model,
)
],
),
)
],
),
),
);

@ -27,142 +27,150 @@ class OrdersLogDetailsPage extends StatelessWidget {
void showConfirmMessage(HomeHealthCareViewModel model, GetHHCAllPresOrdersResponseModel order) {
showDialog(
context: context,
child: ConfirmCancelOrderDialog(
model: model,
onTap: () async {
UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3);
model.setState(ViewState.Busy);
await model.updateHHCPresOrder(updatePresOrderRequestModel);
if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
} else {
AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully);
await model.getHHCAllPresOrders();
// await model.getHHCAllServices();
}
},
));
context: context,
child: ConfirmCancelOrderDialog(
model: model,
onTap: () async {
UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3);
model.setState(ViewState.Busy);
await model.updateHHCPresOrder(updatePresOrderRequestModel);
if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
} else {
AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully);
await model.getHHCAllPresOrders();
// await model.getHHCAllServices();
}
},
),
);
}
return AppScaffold(
isShowAppBar: false,
baseViewModel: model,
body: SingleChildScrollView(
physics: ScrollPhysics(),
child: Container(
margin: EdgeInsets.all(0),
child: Center(
child: FractionallySizedBox(
widthFactor: 0.94,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: model.hhcAllPresOrders.map((order) {
return Container(
// margin: EdgeInsets.all(10),
child: Container(
width: double.infinity,
padding: EdgeInsets.only(left: 12, right: 12, top: 12),
child: Card(
shape: cardRadius(12),
elevation: 2,
margin: EdgeInsets.zero,
color: order.status == 4
? Colors.red[900]
: order.status == 3
? Colors.green[400]
: Color(0xffcd9e1b),
clipBehavior: Clip.antiAlias,
child: Container(
// decoration: containerColorRadiusLeft(Colors.white, 12),
margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 8, right: projectViewModel.isArabic ? 8 : 0),
padding: EdgeInsets.all(12),
// color: Colors.white,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0),
topRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero,
bottomLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0),
bottomRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero,
),
),
// clipBehavior: Clip.antiAlias,
child: Row(
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context).OrderStatus + ' ' + (projectViewModel.isArabic ? order.descriptionN : order.description),
bold: false,
fontSize: 12,
color: order.status == 4
? Colors.red[900]
: order.status == 3
? Colors.green[400]
: Color(0xffcd9e1b),
fontWeight: FontWeight.bold,
),
Texts(
TranslationBase.of(context).requestID + ' ' + order.iD.toString(),
fontWeight: FontWeight.w600,
fontSize: 18,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context).orderLocation,
bold: false,
fontSize: 13,
),
SizedBox(
height: 4,
),
Texts(
!projectViewModel.isArabic ? order.nearestProjectDescription.toString() : order.nearestProjectDescriptionN.toString(),
fontSize: 13,
),
],
)
],
)),
Column(
children: [
Texts(
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(order.createdOn)),
fontSize: 14,
),
SizedBox(height: 8),
(order.status == 1 || order.status == 2)
? SecondaryButton(
onTap: () {
showConfirmMessage(model, order);
},
label: TranslationBase.of(context).cancel,
color: Colors.red[900],
small: true,
)
: SizedBox()
],
),
],
))),
));
}).toList())
body: ListView.separated(
padding: EdgeInsets.all(21),
physics: BouncingScrollPhysics(),
itemBuilder: (context, index) {
GetHHCAllPresOrdersResponseModel order = model.hhcAllPresOrders[index];
int status = order.status;
String _statusDisp = projectViewModel.isArabic ? order.descriptionN : order.description;
Color _color;
if (status == 1) {
//pending
_color = Color(0xffCC9B14);
} else if (status == 2) {
//processing
_color = Color(0xff2E303A);
} else if (status == 3) {
//completed
_color = Color(0xff359846);
} else if (status == 4) {
//cancel // Rejected
_color = Color(0xffD02127);
}
return Container(
decoration: BoxDecoration(
color: _color,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
blurRadius: 27,
offset: Offset(0, -3),
),
],
),
),
),
),
),
child: Container(
// decoration: containerColorRadiusLeft(Colors.white, 12),
margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0),
padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.white, width: 1),
borderRadius: BorderRadius.only(
bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
),
),
// clipBehavior: Clip.antiAlias,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_statusDisp,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10),
),
SizedBox(height: 6),
Text(
'${TranslationBase.of(context).requestID}: ${order.iD}',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context).serviceName + ": ",
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
),
Expanded(
child: Text(
!projectViewModel.isArabic ? order.nearestProjectDescription.trim().toString() : order.nearestProjectDescriptionN.toString(),
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56),
),
),
],
)
],
),
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.createdOn), projectViewModel.isArabic),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10),
),
SizedBox(height: 12),
if (order.status == 1 || order.status == 2)
InkWell(
onTap: () {
showConfirmMessage(model, order);
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14),
decoration: BoxDecoration(
color: Color(0xffD02127),
border: Border.all(color: Colors.white, width: 1),
borderRadius: BorderRadius.circular(10),
),
child: Text(
TranslationBase.of(context).cancel_nocaps,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4),
),
),
),
],
),
],
),
),
);
},
separatorBuilder: (context, index) => SizedBox(height: 12),
itemCount: model.hhcAllPresOrders.length),
);
}
}

@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/rrt/service_price.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -18,8 +19,12 @@ import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_maps_place_picker/google_maps_place_picker.dart';
import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'rrt-place-order.dart';
import 'package:diplomaticquarterapp/widgets/app_map/google_huawei_map.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart';
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart';
class RRTRequestPickupAddressPage extends StatefulWidget {
final ServicePrice servicePrice;
@ -35,32 +40,73 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
bool mapIdle = true;
Completer<GoogleMapController> mapController = Completer();
CameraPosition mapCameraPosition = CameraPosition(
target: LatLng(24.7114693, 46.67469582),
static CameraPosition cameraPosition = CameraPosition(
target: LatLng(37.42796133580664, -122.085749655962),
zoom: 14.4746,
);
List<Addresses> myAddresses = [];
Addresses selectedAddress;
LatLng currentPostion;
List<AddressInfo> myAddresses = [];
AddressInfo selectedAddress;
StreamController<int> addressStreamController = StreamController();
Stream<int> addressStream;
StreamController<int> addressLoadingStreamController = StreamController();
Stream<int> addressLoadingStream;
AddressInfo _selectedAddress;
double latitude = 0;
double longitude = 0;
AppMap appMap;
bool showCurrentLocation = false;
@override
void initState() {
super.initState();
goToCurrentLocation();
addressStream = addressStreamController.stream;
addressLoadingStream = addressLoadingStreamController.stream;
// addressStream = addressStreamController.stream;
// addressLoadingStream = addressLoadingStreamController.stream;
}
setLatitudeAndLongitude({bool isSetState = false, String latLong}) async {
print("latLong " + latLong.toString());
if (latLong == null) {
if (myAddresses.isEmpty) {
setState(() {
showCurrentLocation = true;
});
} else {
latLong = myAddresses[myAddresses.length - 1].latLong;
}
}
if (!showCurrentLocation) {
List latLongArr = latLong.split(',');
latitude = double.parse(latLongArr[0]);
longitude = double.parse(latLongArr[1]);
print("sssss1 " + latitude.toString());
print("sssss2 " + longitude.toString());
currentPostion = LatLng(latitude, longitude);
selectedAddress = AddressInfo(latLong: '${latitude},${longitude}', address1: "", address2: "");
setMap();
}
}
setMap() {
setState(() {
cameraPosition = CameraPosition(
target: currentPostion,
zoom: 14.4746,
);
appMap.moveTo(cameraPostion: cameraPosition);
});
}
void loadAddresses() async {
// GifLoaderDialogUtils.showMyDialog(context);
myAddresses = await viewModel.getAddresses();
await viewModel.getCustomerInfo();
// GifLoaderDialogUtils.hideDialog(context);
if (myAddresses.isNotEmpty) setState(() {});
if (viewModel.addressesList.isNotEmpty) setState(() {});
}
TranslationBase localize;
@ -77,63 +123,164 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
onModelReady: (vm) {
viewModel = vm;
loadAddresses();
myAddresses = viewModel.addressesList;
},
builder: (ctx, vm, widget) => AppScaffold(
appBarTitle: localize.pickupLocation,
isShowAppBar: true,
showNewAppBar: true,
showNewAppBarTitle: true,
baseViewModel: viewModel,
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
StreamBuilder<Object>(
stream: addressStream,
builder: (context, snapshot) {
return selectAddressField();
}),
StreamBuilder<Object>(
stream: addressLoadingStream,
builder: (context, snapshot) {
return snapshot.hasData
? LinearProgressIndicator(backgroundColor: Colors.transparent)
: Container(
height: 4,
);
}),
Card(
margin: EdgeInsets.only(left: 12, right: 12, bottom: 12, top: 12),
shape: cardRadius(12),
elevation: 3,
child: Container(
child: InkWell(
onTap: () => confirmSelectLocationDialog(myAddresses),
child: Container(
padding: EdgeInsets.all(8),
width: double.infinity,
// height: 65,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
getAddressName(),
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 12,
letterSpacing: -0.45,
),
),
),
Icon(Icons.arrow_drop_down)
],
),
),
),
height: 50,
width: double.infinity,
),
),
InkWell(
onTap: () async {
Navigator.push(
context,
FadePage(
page: LocationPage(
latitude: latitude,
longitude: longitude,
),
),
);
},
child: Padding(
padding: EdgeInsets.only(left: 12, right: 12, bottom: 16, top: 8),
child: Row(
children: [
Icon(Icons.add_circle_outline_sharp),
mWidth(12),
Text(
TranslationBase.of(context).addNewAddress,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.46,
),
),
],
),
),
),
Expanded(
child: PlacePicker(
apiKey: GOOGLE_API_KEY,
enableMyLocationButton: true,
automaticallyImplyAppBarLeading: false,
autocompleteOnTrailingWhitespace: true,
selectInitialPosition: true,
autocompleteLanguage: projectViewModel.currentLanguage,
enableMapTypeButton: true,
searchForInitialValue: false,
selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) {
if (state == SearchingState.Idle) {
addressLoadingStreamController.sink.add(null);
if (selectedPlace != null) {
var loc = selectedPlace.geometry.location;
var address1 = selectedPlace.addressComponents.first.longName;
var address2 = "";
if (selectedPlace.addressComponents.length > 1) address2 = selectedPlace.addressComponents[1].longName;
selectedAddress = Addresses(latLong: '${loc.lat},${loc.lng}', address1: address1, address2: address2);
addressStreamController.sink.add(0);
}
} else {
addressLoadingStreamController.sink.add(0);
}
return Container();
},
initialPosition: LatLng(24.7114693, 46.67469582),
useCurrentLocation: false,
child: Stack(
alignment: Alignment.center,
children: [
appMap = AppMap(cameraPosition.toMap(), onCameraMove: (camera) {
_updatePosition(camera);
}),
Icon(
Icons.place,
color: CustomColors.accentColor,
size: 50,
),
],
),
),
continueButton()
Padding(
padding: const EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14),
child: continueButton(),
),
],
)));
)
// Column(
// crossAxisAlignment: CrossAxisAlignment.stretch,
// children: [
// StreamBuilder<Object>(
// stream: addressStream,
// builder: (context, snapshot) {
// return selectAddressField();
// }),
// StreamBuilder<Object>(
// stream: addressLoadingStream,
// builder: (context, snapshot) {
// return snapshot.hasData
// ? LinearProgressIndicator(backgroundColor: Colors.transparent)
// : Container(
// height: 4,
// );
// }),
// Expanded(
// child: PlacePicker(
// apiKey: GOOGLE_API_KEY,
// enableMyLocationButton: true,
// automaticallyImplyAppBarLeading: false,
// autocompleteOnTrailingWhitespace: true,
// selectInitialPosition: true,
// autocompleteLanguage: projectViewModel.currentLanguage,
// enableMapTypeButton: true,
// searchForInitialValue: false,
// selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) {
// if (state == SearchingState.Idle) {
// addressLoadingStreamController.sink.add(null);
// if (selectedPlace != null) {
// var loc = selectedPlace.geometry.location;
// var address1 = selectedPlace.addressComponents.first.longName;
// var address2 = "";
// if (selectedPlace.addressComponents.length > 1) address2 = selectedPlace.addressComponents[1].longName;
// selectedAddress = Addresses(latLong: '${loc.lat},${loc.lng}', address1: address1, address2: address2);
// addressStreamController.sink.add(0);
// }
// } else {
// addressLoadingStreamController.sink.add(0);
// }
// return Container();
// },
// initialPosition: LatLng(24.7114693, 46.67469582),
// useCurrentLocation: false,
// ),
// ),
// continueButton()
// ],
// )
));
}
void _updatePosition(CameraPosition _position) {
latitude = _position.target.latitude;
longitude = _position.target.longitude;
selectedAddress = AddressInfo(latLong: '${latitude},${longitude}', address1: "", address2: "");
}
Widget centerTargetPoint() {
@ -149,29 +296,29 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
);
}
Widget selectAddressField() {
var text = selectedAddress == null ? localize.selectAddress : selectedAddress.toString();
return Container(
margin: EdgeInsets.all(10),
height: 50,
child: MaterialButton(
height: 50,
color: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
onPressed: openAddressSelectDialog,
child: Row(
children: [
Expanded(child: Text(text, style: TextStyle(color: Colors.grey, fontSize: 13, letterSpacing: 1))),
Icon(
Icons.keyboard_arrow_down,
size: 20,
color: Colors.grey,
)
],
),
),
);
}
// Widget selectAddressField() {
// var text = selectedAddress == null ? localize.selectAddress : selectedAddress.toString();
// return Container(
// margin: EdgeInsets.all(10),
// height: 50,
// child: MaterialButton(
// height: 50,
// color: Colors.white,
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
// onPressed: openAddressSelectDialog,
// child: Row(
// children: [
// Expanded(child: Text(text, style: TextStyle(color: Colors.grey, fontSize: 13, letterSpacing: 1))),
// Icon(
// Icons.keyboard_arrow_down,
// size: 20,
// color: Colors.grey,
// )
// ],
// ),
// ),
// );
// }
Widget continueButton() {
return Padding(
@ -188,53 +335,78 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
);
}
openAddressSelectDialog() {
showMaterialResponsiveDialog(
hideButtons: true,
context: context,
title: localize.selectAddress,
child: ListView.separated(
shrinkWrap: true,
padding: EdgeInsets.all(10),
itemCount: myAddresses.length,
itemBuilder: (ctx, idx) {
var itm = myAddresses[idx];
return ListTile(
title: Text(itm.toString()),
onTap: () {
setState(() {
selectedAddress = itm;
Navigator.pop(context);
if (itm.latLong != null && itm.latLong.isNotEmpty && itm.latLong.split(',').length > 1) {
var cordinates = itm.latLong.split(',');
var latlng = LatLng(double.parse(cordinates.first), double.parse(cordinates.last));
moveToLocation(latlng);
} else {
AppToast.showErrorToast(message: 'Invalid address coordinates');
}
});
},
);
},
separatorBuilder: (ctx, idx) => Container(
height: 0.25,
color: Colors.grey.withOpacity(0.7),
)));
// openAddressSelectDialog() {
// showMaterialResponsiveDialog(
// hideButtons: true,
// context: context,
// title: localize.selectAddress,
// child: ListView.separated(
// shrinkWrap: true,
// padding: EdgeInsets.all(10),
// itemCount: myAddresses.length,
// itemBuilder: (ctx, idx) {
// var itm = myAddresses[idx];
// return ListTile(
// title: Text(itm.toString()),
// onTap: () {
// setState(() {
// selectedAddress = itm;
// Navigator.pop(context);
// if (itm.latLong != null && itm.latLong.isNotEmpty && itm.latLong.split(',').length > 1) {
// var cordinates = itm.latLong.split(',');
// var latlng = LatLng(double.parse(cordinates.first), double.parse(cordinates.last));
// //moveToLocation(latlng);
// } else {
// AppToast.showErrorToast(message: 'Invalid address coordinates');
// }
// });
// },
// );
// },
// separatorBuilder: (ctx, idx) => Container(
// height: 0.25,
// color: Colors.grey.withOpacity(0.7),
// )));
// }
void confirmSelectLocationDialog(List<AddressInfo> addresses) {
showDialog(
context: context,
child: SelectLocationDialog(
addresses: addresses,
selectedAddress: _selectedAddress,
onValueSelected: (value) {
showCurrentLocation = false;
setLatitudeAndLongitude(latLong: value.latLong);
setState(() {
_selectedAddress = value;
});
},
),
);
}
String getAddressName() {
if (_selectedAddress != null)
return _selectedAddress.address1;
else
return TranslationBase.of(context).selectAddress;
}
moveToLocation(LatLng location, {bool animate = true}) async {
await Future.delayed(Duration(milliseconds: 200));
mapCameraPosition = CameraPosition(
cameraPosition = CameraPosition(
target: location,
zoom: 16.4746,
);
if (animate)
(await mapController.future).animateCamera(
CameraUpdate.newCameraPosition(mapCameraPosition),
CameraUpdate.newCameraPosition(cameraPosition),
);
else
(await mapController.future).moveCamera(
CameraUpdate.newCameraPosition(mapCameraPosition),
CameraUpdate.newCameraPosition(cameraPosition),
);
}
@ -246,7 +418,8 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
});
return;
}
moveToLocation(LatLng(location.latitude, location.longitude), animate: false);
}
// moveToLocation(LatLng(location.latitude, location.longitude), animate: false);
// }
}

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart';
import 'package:diplomaticquarterapp/models/rrt/service_price.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart';
@ -16,7 +17,7 @@ import 'package:google_maps_flutter/google_maps_flutter.dart';
class RRTPlaceOrderPage extends StatelessWidget {
TranslationBase localize;
RRTViewModel viewModel;
Addresses selectedAddress;
AddressInfo selectedAddress;
final ServicePrice servicePrice;
RRTPlaceOrderPage({@required this.selectedAddress, @required this.servicePrice});

@ -109,7 +109,9 @@ class _Login extends State<Login> {
// inputWidget("Phone Number", "5xxxxxxxx", prefix: countryCode),
PhoneNumberSelectorWidget(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value),
SizedBox(height: 12),
inputWidget(loginType == 1 ? TranslationBase.of(context).nationalIdNumber : TranslationBase.of(context).medicalFileNumber, "Xxxxxxxxx", nationalIDorFile),
Directionality(
textDirection: TextDirection.ltr,
child: inputWidget(loginType == 1 ? TranslationBase.of(context).nationalIdNumber : TranslationBase.of(context).medicalFileNumber, "Xxxxxxxxx", nationalIDorFile)),
],
),
),

@ -42,7 +42,7 @@ class _AddWeightPageState extends State<AddWeightPage> {
];
final List<String> measureUnitArList = ["كيلو جرام", "باوند"];
String measureTimeSelectedType;
bool isButtonDisabled = false;
bool isButtonDisabled = true;
@override
void initState() {
@ -221,8 +221,8 @@ class _AddWeightPageState extends State<AddWeightPage> {
child: Button(
onTap: () async {
if (_weightValueController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
if (widget.isUpdate) {
GifLoaderDialogUtils.showMyDialog(context);
widget.model
.updateWeightResult(
weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00',
@ -253,7 +253,7 @@ class _AddWeightPageState extends State<AddWeightPage> {
}
},
label: TranslationBase.of(context).save.toUpperCase(),
backgroundColor: Colors.red[900],
backgroundColor: isButtonDisabled ? Colors.grey : Colors.red[900],
disabled: isButtonDisabled,
),
));
@ -288,11 +288,11 @@ class _AddWeightPageState extends State<AddWeightPage> {
void validateForm() {
if (_weightValueController.text.length > 0 && measureTimeSelectedType != null) {
setState(() {
isButtonDisabled = true;
isButtonDisabled = false;
});
} else {
setState(() {
isButtonDisabled = false;
isButtonDisabled = true;
});
}
}

@ -10,7 +10,9 @@ 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:provider/provider.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'AddWeightPage.dart';
import 'WeightMonthlyPage.dart';
import 'WeightWeeklyPage.dart';
@ -38,6 +40,7 @@ class _WeightHomePageState extends State<WeightHomePage> with SingleTickerProvid
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<WeightPressureViewModel>(
onModelReady: (model) => model.getWeight(),
builder: (_, model, w) => AppScaffold(
@ -103,29 +106,35 @@ class _WeightHomePageState extends State<WeightHomePage> with SingleTickerProvid
)
],
),
floatingActionButton: InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: AddWeightPage(
model: model,
)));
},
child: Container(
width: 55,
height: 55,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).primaryColor,
),
child: Center(
child: Icon(
Icons.add,
color: Colors.white,
),
),
),
floatingActionButton: Stack(
children: [
Positioned(
bottom: 80,
right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * .85 : 0,
child: InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: AddWeightPage(
model: model,
)));
},
child: Container(
width: 55,
height: 55,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).primaryColor,
),
child: Center(
child: Icon(
Icons.add,
color: Colors.white,
),
),
)))
],
),
),
),

@ -38,7 +38,7 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
DateTime bloodSugarDate = DateTime.now();
DateTime timeSugarDate = DateTime.now();
int measuredArm = 1;
bool isButtonDisabled = false;
bool isButtonDisabled = true;
final List<String> measureTimeEnList = [
'Left Arm ',
'Right Arm',
@ -119,7 +119,7 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(measureTimeSelectedType),
Texts(projectViewModel.isArabic ? measureTimeArList[0] : measureTimeEnList[0]),
Icon(
Icons.arrow_drop_down,
color: Colors.grey,
@ -254,7 +254,7 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
}
},
label: TranslationBase.of(context).save.toUpperCase(),
backgroundColor: Colors.red[900],
backgroundColor: isButtonDisabled ? Colors.grey : Colors.red[900],
disabled: isButtonDisabled,
),
));
@ -288,13 +288,13 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
void validateForm() {
print("_bloodSystolicValueController " + _bloodSystolicValueController.text.length.toString());
if (measureTimeSelectedType != 'Left Arm' && _bloodSystolicValueController.text.length > 0 && _bloodDiastolicValueController.text.length > 0) {
if (_bloodSystolicValueController.text.length > 0 && _bloodDiastolicValueController.text.length > 0) {
setState(() {
isButtonDisabled = true;
isButtonDisabled = false;
});
} else {
setState(() {
isButtonDisabled = false;
isButtonDisabled = true;
});
}
// if(measureTimeSelectedType == 'Left Arm'){

@ -14,7 +14,9 @@ import 'AddBloodPressurePage.dart';
import 'BloodPressureMonthly.dart';
import 'BloodPressureYeaPage.dart';
import 'bloodPressureWeeklyPage.dart';
import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
class BloodPressureHomePage extends StatefulWidget {
@override
@ -38,6 +40,7 @@ class _BloodPressureHomePageState extends State<BloodPressureHomePage> with Sing
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<BloodPressureViewMode>(
onModelReady: (model) => model.getBloodPressure(),
builder: (_, model, w) => AppScaffold(
@ -75,7 +78,7 @@ class _BloodPressureHomePageState extends State<BloodPressureHomePage> with Sing
floatingActionButton: Stack(children: [
Positioned(
bottom: 80,
right: 0,
right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * .85 : 0,
child: InkWell(
onTap: () {
Navigator.push(

@ -38,7 +38,7 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
DateTime timeSugarDate = DateTime.now();
String measureUnitSelectedType = 'mg/dlt';
int measuredTime = 1;
bool isButtonDisabled = false;
bool isButtonDisabled = true;
final List<String> measureUnitList = ['mg/dlt', 'mol/L'];
final List<String> measureTimeEnList = [
'Before Breakfast',
@ -264,8 +264,8 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
child: Button(
onTap: () async {
if (_bloodSugarValueController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
if (widget.isUpdate) {
GifLoaderDialogUtils.showMyDialog(context);
await widget.bloodSugarViewMode.updateDiabtecResult(
month: bloodSugarDate,
hour: timeSugarDate,
@ -280,7 +280,6 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
else
Navigator.pop(context);
} else {
GifLoaderDialogUtils.showMyDialog(context);
await widget.bloodSugarViewMode.addDiabtecResult(
diabtecUnit: measureUnitSelectedType,
measuredTime: measuredTime,
@ -297,7 +296,7 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
}
},
label: TranslationBase.of(context).save.toUpperCase(),
backgroundColor: Colors.red[900],
backgroundColor: isButtonDisabled ? Colors.grey : Colors.red[900],
disabled: isButtonDisabled,
),
));
@ -347,11 +346,11 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
void validateForm() {
if (_bloodSugarValueController.text.length > 0) {
setState(() {
isButtonDisabled = true;
isButtonDisabled = false;
});
} else {
setState(() {
isButtonDisabled = false;
isButtonDisabled = true;
});
}
}

@ -1,4 +1,3 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
@ -12,10 +11,11 @@ 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:provider/provider.dart';
import 'AddBloodSugarPage.dart';
import 'BloodMonthly.dart';
import 'BloodYeaPage.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'blood_sugar_weekly_page.dart';
class BloodSugarHomePage extends StatefulWidget {
@ -40,6 +40,7 @@ class _BloodSugarHomePageState extends State<BloodSugarHomePage> with SingleTick
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<BloodSugarViewMode>(
onModelReady: (model) => model.getBloodSugar(),
builder: (_, model, w) => AppScaffold(
@ -84,8 +85,8 @@ class _BloodSugarHomePageState extends State<BloodSugarHomePage> with SingleTick
floatingActionButton: Stack(
children: [
Positioned(
bottom: 80,
right: 0,
bottom: 130,
right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * .85 : 0,
child: InkWell(
onTap: () {
Navigator.push(

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -9,7 +10,7 @@ import 'package:geolocator/geolocator.dart';
import 'package:google_maps_place_picker/google_maps_place_picker.dart';
class AddAddressPage extends StatefulWidget {
final Addresses editedAddress;
final AddressInfo editedAddress;
final Function(PickResult) onPick;
AddAddressPage(this.editedAddress, this.onPick);
@ -25,9 +26,7 @@ class _AddAddressPageState extends State<AddAddressPage> {
@override
void initState() {
super.initState();
if (widget.editedAddress != null &&
widget.editedAddress.latLong != null &&
widget.editedAddress.latLong != "") {
if (widget.editedAddress != null && widget.editedAddress.latLong != null && widget.editedAddress.latLong != "") {
List<String> latLng = widget.editedAddress.latLong.split(",");
_latitude = double.parse(latLng[0]);
_longitude = double.parse(latLng[1]);
@ -49,9 +48,7 @@ class _AddAddressPageState extends State<AddAddressPage> {
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
final height = mediaQuery.size.height -
60 -
mediaQuery.padding.top;
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
return BaseView<PharmacyAddressesViewModel>(
builder: (_, model, wi) => AppScaffold(

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/AddAddress.dart';
@ -18,8 +19,7 @@ class PharmacyAddressesPage extends StatefulWidget {
}
class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
void navigateToAddressPage(
BuildContext ctx, PharmacyAddressesViewModel model, Addresses address) {
void navigateToAddressPage(BuildContext ctx, PharmacyAddressesViewModel model, AddressInfo address) {
Navigator.push(
ctx,
FadePage(
@ -106,10 +106,8 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
fontSize: 14,
vPadding: 8,
handler: () {
model.saveSelectedAddressLocally(
model.addresses[model.selectedAddressIndex]);
Navigator.pop(
context, model.addresses[model.selectedAddressIndex]);
model.saveSelectedAddressLocally(model.addresses[model.selectedAddressIndex]);
Navigator.pop(context, model.addresses[model.selectedAddressIndex]);
},
),
),
@ -123,13 +121,12 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
class AddressItemWidget extends StatelessWidget {
final PharmacyAddressesViewModel model;
final Addresses address;
final AddressInfo address;
final Function selectAddress;
final bool isSelected;
final Function(Addresses) onTabEditAddress;
final Function(AddressInfo) onTabEditAddress;
AddressItemWidget(this.model, this.address, this.selectAddress,
this.isSelected, this.onTabEditAddress);
AddressItemWidget(this.model, this.address, this.selectAddress, this.isSelected, this.onTabEditAddress);
@override
Widget build(BuildContext context) {
@ -155,18 +152,13 @@ class AddressItemWidget extends StatelessWidget {
decoration: new BoxDecoration(
color: !isSelected ? Colors.white : Colors.green,
shape: BoxShape.circle,
border: Border.all(
color: Colors.grey,
style: BorderStyle.solid,
width: 1.0),
border: Border.all(color: Colors.grey, style: BorderStyle.solid, width: 1.0),
),
child: Padding(
padding: const EdgeInsets.all(0.0),
child: Icon(
Icons.check,
color: isSelected
? Colors.white
: Colors.transparent,
color: isSelected ? Colors.white : Colors.transparent,
size: 25,
),
),
@ -179,8 +171,7 @@ class AddressItemWidget extends StatelessWidget {
Expanded(
child: Container(
child: Container(
margin:
EdgeInsets.symmetric(vertical: 12, horizontal: 12),
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -243,8 +234,7 @@ class AddressItemWidget extends StatelessWidget {
),
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: SizedBox(
child: Container(
width: 1,
@ -262,21 +252,13 @@ class AddressItemWidget extends StatelessWidget {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
title: "Are you sure want to delete",
confirmMessage:
"${address.address1} ${address.address2}",
okText:
TranslationBase.of(context).delete,
cancelText: TranslationBase.of(context)
.cancel_nocaps,
confirmMessage: "${address.address1} ${address.address2}",
okText: TranslationBase.of(context).delete,
cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () => {
model
.deleteAddresses(address)
.then((_) {
ConfirmDialog.closeAlertDialog(
context);
AppToast.showErrorToast(
message:
"Address has been deleted");
model.deleteAddresses(address).then((_) {
ConfirmDialog.closeAlertDialog(context);
AppToast.showErrorToast(message: "Address has been deleted");
})
},
cancelFunction: () => {});

@ -4,15 +4,16 @@ import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Country.dart';
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
class PharmacyAddressService extends BaseService {
List<Addresses> addresses = List();
List<AddressInfo> addresses = List();
CountryData country;
int selectedAddressIndex = 0;
Future<List<Addresses>> getAddresses() async {
Future<List<AddressInfo>> getAddresses() async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
Map<String, String> queryParams = {'fields': 'addresses'};
hasError = false;
@ -20,17 +21,15 @@ class PharmacyAddressService extends BaseService {
try {
var completer = Completer();
await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId",
onSuccess: (dynamic response, int statusCode) async {
await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId", onSuccess: (dynamic response, int statusCode) async {
addresses.clear();
var savedAddress =
await sharedPref.getObject(PHARMACY_SELECTED_ADDRESS);
var savedAddress = await sharedPref.getObject(PHARMACY_SELECTED_ADDRESS);
if (savedAddress != null) {
selectedAddress = Addresses.fromJson(savedAddress);
}
int index = 0;
response['customers'][0]['addresses'].forEach((item) {
Addresses address = Addresses.fromJson(item);
AddressInfo address = AddressInfo.fromJson(item);
if (selectedAddress != null && selectedAddress.id == item["id"]) {
selectedAddressIndex = index;
}
@ -44,8 +43,7 @@ class PharmacyAddressService extends BaseService {
}, queryParams: queryParams);
await completer.future;
} catch (error){
} catch (error) {
throw error;
}
@ -55,12 +53,10 @@ class PharmacyAddressService extends BaseService {
Future getCountries(String countryName) async {
hasError = false;
try {
await baseAppClient.getPharmacy("$PHARMACY_GET_COUNTRY",
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.getPharmacy("$PHARMACY_GET_COUNTRY", onSuccess: (dynamic response, int statusCode) {
// countries.clear();
response['countries'].forEach((item) {
if (CountryData.fromJson(item).name == countryName ||
CountryData.fromJson(item).namen == countryName) {
if (CountryData.fromJson(item).name == countryName || CountryData.fromJson(item).namen == countryName) {
country = CountryData.fromJson(item);
}
// countries.add(CountryData.fromJson(item));
@ -74,19 +70,19 @@ class PharmacyAddressService extends BaseService {
}
}
Future addCustomerAddress(Addresses address) async {
Future addCustomerAddress(AddressInfo address) async {
makeCustomerAddress(address, ADD_CUSTOMER_ADDRESS);
}
Future editCustomerAddress(Addresses address) async {
Future editCustomerAddress(AddressInfo address) async {
makeCustomerAddress(address, EDIT_CUSTOMER_ADDRESS);
}
Future deleteCustomerAddress(Addresses address) async {
Future deleteCustomerAddress(AddressInfo address) async {
makeCustomerAddress(address, DELETE_CUSTOMER_ADDRESS);
}
Future makeCustomerAddress(Addresses address, String url) async {
Future makeCustomerAddress(AddressInfo address, String url) async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false;
super.error = "";
@ -102,7 +98,7 @@ class PharmacyAddressService extends BaseService {
await baseAppClient.postPharmacy("$url", onSuccess: (response, statusCode) async {
addresses.clear();
response['customers'][0]['addresses'].forEach((item) {
addresses.add(Addresses.fromJson(item));
addresses.add(AddressInfo.fromJson(item));
});
}, onFailure: (String error, int statusCode) {
hasError = true;

@ -53,7 +53,7 @@ class _PhoneNumberSelectorWidgetState extends State<PhoneNumberSelectorWidget> {
children: [
inputWidget(TranslationBase.of(context).country, countryName, isEnable: false, hasSelection: true),
SizedBox(height: 12),
inputWidget(TranslationBase.of(context).phoneNumber, "5xxxxxxxx", prefix: countryCode),
Directionality(textDirection: TextDirection.ltr, child: inputWidget(TranslationBase.of(context).phoneNumber, "5xxxxxxxx", prefix: countryCode)),
],
);
}

Loading…
Cancel
Save