diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 26686bb0..c70c68ba 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1504,4 +1504,5 @@ const Map localizedValues = { "seeDoctorsList": { "en": "See List Of Doctors", "ar": "اعرض قائمة الأطباء" }, "covidQuestionnaire": { "en": "Please answer below questionnaire:", "ar": "الرجاء الإجابة على الاستبيان أدناه:" }, "covidBookAppo": { "en": "Booking Appointment For: ", "ar": "موعد الحجز لـ: " }, + "emptySchedule": { "en": "Doctor has no schedule.", "ar": "لا يوجد جدول حضور مسجل للطبيب" } }; diff --git a/lib/core/service/medical/ActiveMedicationsService.dart b/lib/core/service/medical/ActiveMedicationsService.dart index 926efafd..dc4a3641 100644 --- a/lib/core/service/medical/ActiveMedicationsService.dart +++ b/lib/core/service/medical/ActiveMedicationsService.dart @@ -11,8 +11,8 @@ class ActiveMedicationsService extends BaseService{ super.error = ""; Map body = Map(); body['isDentalAllowedBackend'] = false; - // body['PatientID'] = 1298851; - // body['TokenID'] = "@dm!n"; + body['PatientID'] = 1298851; + body['TokenID'] = "@dm!n"; await baseAppClient.post(ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID, onSuccess: (response, statusCode) async { activePrescriptionReport.clear(); diff --git a/lib/models/rrt/service_price.dart b/lib/models/rrt/service_price.dart index d206c986..998671f7 100644 --- a/lib/models/rrt/service_price.dart +++ b/lib/models/rrt/service_price.dart @@ -1,14 +1,14 @@ class ServicePrice { String currency; - double maxPrice; - double maxTotalPrice; - double maxVAT; - double minPrice; - double minTotalPrice; - double minVAT; - int price; - int totalPrice; - int vat; + dynamic maxPrice; + dynamic maxTotalPrice; + dynamic maxVAT; + dynamic minPrice; + dynamic minTotalPrice; + dynamic minVAT; + dynamic price; + dynamic totalPrice; + dynamic vat; ServicePrice({ this.currency, diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index 0dec924a..4d67177d 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -117,6 +117,7 @@ class _DoctorProfileState extends State with TickerProviderStateM ), buttonIcon: 'assets/images/new/Boo_ Appointment.svg', showConfirmMessageDialog: false, + isNeedToShowButton: !widget.isLiveCareAppointment, onTap: () { Navigator.push( context, @@ -139,7 +140,14 @@ class _DoctorProfileState extends State with TickerProviderStateM TabBar( onTap: (index) { setState(() { - index == 1 ? showFooterButton = true : showFooterButton = false; + if (index == 1) { + if (widget.doctor.clinicID == 17 || widget.doctor.clinicID == 23 || widget.isLiveCareAppointment) { + _tabController.index = _tabController.previousIndex; + showFooterButton = false; + } else { + showFooterButton = true; + } + } print(showFooterButton); }); }, diff --git a/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart b/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart index 9ee7bd1c..6e875749 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart @@ -39,6 +39,8 @@ class RRTMainScreenState extends State with SingleTickerProviderS return AppScaffold( appBarTitle: localize.rapidResponseTeam, isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, description: TranslationBase.of(context).rrtDDetails, imagesInfo: imagesInfo, body: BaseView( @@ -73,7 +75,7 @@ class RRTMainScreenState extends State with SingleTickerProviderS } Widget tabBar() => Container( - margin: EdgeInsets.all(15), + margin: EdgeInsets.all(0.0), clipBehavior: Clip.hardEdge, decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10)), child: TabBar(onTap: onPageChanged, indicatorWeight: 3, indicatorColor: Color(0xFFc5272d), isScrollable: false, controller: tabController, indicatorSize: TabBarIndicatorSize.label, tabs: [ diff --git a/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart b/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart index 9c4faee6..ad950d85 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/models/rrt/service_price.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -20,16 +21,16 @@ import 'package:provider/provider.dart'; import 'rrt-place-order.dart'; -class RRTRequestPickupAddressPage extends StatefulWidget{ - +class RRTRequestPickupAddressPage extends StatefulWidget { final ServicePrice servicePrice; + RRTRequestPickupAddressPage({@required this.servicePrice}); @override - State createState() => RRTRequestPickupAddressPageState(); - + State createState() => RRTRequestPickupAddressPageState(); } -class RRTRequestPickupAddressPageState extends State with SingleTickerProviderStateMixin{ + +class RRTRequestPickupAddressPageState extends State with SingleTickerProviderStateMixin { bool acceptTerms = false; bool mapIdle = true; @@ -39,7 +40,6 @@ class RRTRequestPickupAddressPageState extends State myAddresses = []; Addresses selectedAddress; StreamController addressStreamController = StreamController(); @@ -48,25 +48,24 @@ class RRTRequestPickupAddressPageState extends State addressLoadingStream; @override - void initState(){ + void initState() { super.initState(); goToCurrentLocation(); addressStream = addressStreamController.stream; addressLoadingStream = addressLoadingStreamController.stream; } - - void loadAddresses() async{ + + void loadAddresses() async { // GifLoaderDialogUtils.showMyDialog(context); myAddresses = await viewModel.getAddresses(); // GifLoaderDialogUtils.hideDialog(context); - if(myAddresses.isNotEmpty) - setState(() {}); + if (myAddresses.isNotEmpty) setState(() {}); } TranslationBase localize; RRTViewModel viewModel; - + @override Widget build(BuildContext context) { localize = TranslationBase.of(context); @@ -75,31 +74,34 @@ class RRTRequestPickupAddressPageState extends State( - onModelReady: (vm){ + onModelReady: (vm) { viewModel = vm; loadAddresses(); }, builder: (ctx, vm, widget) => AppScaffold( appBarTitle: localize.pickupLocation, isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, body: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ StreamBuilder( - stream: addressStream, - builder: (context, snapshot) { - return selectAddressField(); - } - ), + stream: addressStream, + builder: (context, snapshot) { + return selectAddressField(); + }), StreamBuilder( stream: addressLoadingStream, builder: (context, snapshot) { - return snapshot.hasData ? LinearProgressIndicator(backgroundColor: Colors.transparent) : Container(height: 4,); - } - ), + return snapshot.hasData + ? LinearProgressIndicator(backgroundColor: Colors.transparent) + : Container( + height: 4, + ); + }), Expanded( - child: - PlacePicker( + child: PlacePicker( apiKey: GOOGLE_API_KEY, enableMyLocationButton: true, automaticallyImplyAppBarLeading: false, @@ -109,19 +111,18 @@ class RRTRequestPickupAddressPageState extends State 1) - address2 = selectedPlace.addressComponents[1].longName; + if (selectedPlace.addressComponents.length > 1) address2 = selectedPlace.addressComponents[1].longName; - selectedAddress = Addresses(latLong: '${loc.lat},${loc.lng}', address1: address1, address2: address2); + selectedAddress = Addresses(latLong: '${loc.lat},${loc.lng}', address1: address1, address2: address2); addressStreamController.sink.add(0); } - }else{ + } else { addressLoadingStreamController.sink.add(0); } return Container(); @@ -132,113 +133,115 @@ class RRTRequestPickupAddressPageState extends State - Navigator.push( - context, - FadePage(page: RRTPlaceOrderPage(selectedAddress: selectedAddress, servicePrice: widget.servicePrice,)) - ), - child: Text(localize.continues, style: TextStyle(color: Colors.white, fontSize: 15, letterSpacing: 1),), - ), + child: DefaultButton(TranslationBase.of(context).continues, () { + Navigator.push( + context, + FadePage( + page: RRTPlaceOrderPage( + selectedAddress: selectedAddress, + servicePrice: widget.servicePrice, + ))); + }), ); } - - openAddressSelectDialog(){ + openAddressSelectDialog() { showMaterialResponsiveDialog( hideButtons: true, context: context, title: localize.selectAddress, child: ListView.separated( - shrinkWrap: true, + shrinkWrap: true, padding: EdgeInsets.all(10), itemCount: myAddresses.length, - itemBuilder: (ctx,idx) { + itemBuilder: (ctx, idx) { var itm = myAddresses[idx]; return ListTile( title: Text(itm.toString()), - onTap: (){ + onTap: () { setState(() { selectedAddress = itm; Navigator.pop(context); - if(itm.latLong != null && itm.latLong.isNotEmpty && itm.latLong.split(',').length > 1){ + 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{ + } else { AppToast.showErrorToast(message: 'Invalid address coordinates'); } }); }, ); }, - separatorBuilder: (ctx,idx) => Container(height: 0.25, color: Colors.grey.withOpacity(0.7),) - ) - ); + separatorBuilder: (ctx, idx) => Container( + height: 0.25, + color: Colors.grey.withOpacity(0.7), + ))); } - moveToLocation(LatLng location, {bool animate = true}) async{ + moveToLocation(LatLng location, {bool animate = true}) async { await Future.delayed(Duration(milliseconds: 200)); - mapCameraPosition = CameraPosition(target: location, zoom: 16.4746,); - if(animate) - (await mapController.future).animateCamera(CameraUpdate.newCameraPosition(mapCameraPosition),); + mapCameraPosition = CameraPosition( + target: location, + zoom: 16.4746, + ); + if (animate) + (await mapController.future).animateCamera( + CameraUpdate.newCameraPosition(mapCameraPosition), + ); else - (await mapController.future).moveCamera(CameraUpdate.newCameraPosition(mapCameraPosition),); + (await mapController.future).moveCamera( + CameraUpdate.newCameraPosition(mapCameraPosition), + ); } - goToCurrentLocation() async{ + goToCurrentLocation() async { var location = await Geolocator.getLastKnownPosition(); - if(location == null){ - Geolocator.getCurrentPosition().then((value){ + if (location == null) { + Geolocator.getCurrentPosition().then((value) { moveToLocation(LatLng(value.latitude, value.longitude)); }); return; @@ -246,4 +249,4 @@ class RRTRequestPickupAddressPageState extends State( onModelReady: (vm) => viewModel = vm, - builder: (ctx,vm,wState){ + builder: (ctx, vm, wState) { return AppScaffold( appBarTitle: localize.rapidResponseTeam, isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, body: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ @@ -44,51 +48,59 @@ class RRTPlaceOrderPage extends StatelessWidget{ child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Text(localize.selectedLocation, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),), - + Text( + localize.selectedLocation, + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18), + ), selectedAddressField(), - AspectRatio( - aspectRatio: 3/1, + aspectRatio: 3 / 1, child: ClipRRect( clipBehavior: Clip.hardEdge, borderRadius: BorderRadius.circular(10), child: Image.network( - "https://maps.googleapis.com/maps/api/staticmap?center=$lat,$lng &zoom=16&size=800x400&maptype=roadmap&markers=color:red%7C$lat,$lng&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8", + "https://maps.googleapis.com/maps/api/staticmap?center=$lat,$lng &zoom=16&size=800x600&maptype=roadmap&markers=color:red%7C$lat,$lng&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8", fit: BoxFit.cover, ), ), ), - - SizedBox(height: 10,), - + SizedBox( + height: 10, + ), Container( - height: 70, + height: 80, margin: EdgeInsets.symmetric(vertical: 5), padding: EdgeInsets.symmetric(horizontal: 15, vertical: 10), decoration: BoxDecoration( - color: Colors.white, borderRadius: BorderRadius.circular(10), - boxShadow: [BoxShadow(blurRadius: 5, spreadRadius: 2, offset: Offset(2,2), color: Colors.grey.withOpacity(0.25))] - ), + color: Colors.white, + borderRadius: BorderRadius.circular(10), + boxShadow: [BoxShadow(blurRadius: 5, spreadRadius: 2, offset: Offset(2, 2), color: Colors.grey.withOpacity(0.25))]), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(localize.totalAmountPayable, style: TextStyle(fontSize: 13),), - SizedBox(height: 5,), - Text("${servicePrice.totalPrice ?? '- - -'} ${localize.sar}" , style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),), + Text( + localize.totalAmountPayable, + style: TextStyle(fontSize: 13), + ), + SizedBox( + height: 5, + ), + Text( + "${servicePrice.totalPrice ?? '- - -'} ${localize.sar}", + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18), + ), ], ), ), - Container( height: 70, margin: EdgeInsets.symmetric(vertical: 5), padding: EdgeInsets.symmetric(horizontal: 0, vertical: 10), decoration: BoxDecoration( - color: Colors.white, borderRadius: BorderRadius.circular(10), - boxShadow: [BoxShadow(blurRadius: 5, spreadRadius: 2, offset: Offset(2,2), color: Colors.grey.withOpacity(0.25))] - ), + color: Colors.white, + borderRadius: BorderRadius.circular(10), + boxShadow: [BoxShadow(blurRadius: 5, spreadRadius: 2, offset: Offset(2, 2), color: Colors.grey.withOpacity(0.25))]), child: TextField( controller: noteController, style: TextStyle(fontSize: 18.0), @@ -105,8 +117,7 @@ class RRTPlaceOrderPage extends StatelessWidget{ borderSide: BorderSide(color: Colors.white), borderRadius: BorderRadius.circular(10), ), - ) - ), + )), ), ], ), @@ -114,26 +125,29 @@ class RRTPlaceOrderPage extends StatelessWidget{ ), submitButton(context) ], - ) - ); + )); }, ); } - - Widget selectedAddressField(){ + Widget selectedAddressField() { var address = "${selectedAddress.address1 ?? ''} ${selectedAddress.address2 ?? ''}"; return Container( margin: EdgeInsets.symmetric(vertical: 10), child: Expanded( child: MaterialButton( - height: 50, color: Colors.white, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ), - onPressed: (){}, + height: 50, + color: Colors.white, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), + onPressed: () {}, child: Row( children: [ Expanded(child: Text(address, style: TextStyle(color: Colors.black87, fontSize: 15, letterSpacing: 1))), - Icon(Icons.location_on_rounded, size: 30, color: Colors.black,) + Icon( + Icons.location_on_rounded, + size: 30, + color: Colors.black, + ) ], ), ), @@ -141,22 +155,18 @@ class RRTPlaceOrderPage extends StatelessWidget{ ); } - - Widget submitButton(BuildContext context){ + Widget submitButton(BuildContext context) { return Padding( padding: const EdgeInsets.all(15), - child: MaterialButton( - height: 50, - color: Theme.of(context).appBarTheme.color, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), - onPressed: () => placeOrder(), - child: Text(localize.submit, style: TextStyle(color: Colors.white, fontSize: 15, letterSpacing: 1),), + child: DefaultButton( + localize.submit, + () => placeOrder(), ), ); } - placeOrder() async{ - if(selectedAddress != null && selectedAddress.latLong != null && selectedAddress.latLong.isNotEmpty && selectedAddress.latLong.split(',').length > 1){ + placeOrder() async { + if (selectedAddress != null && selectedAddress.latLong != null && selectedAddress.latLong.isNotEmpty && selectedAddress.latLong.split(',').length > 1) { GifLoaderDialogUtils.showMyDialog(_context); Map params = {}; @@ -169,25 +179,23 @@ class RRTPlaceOrderPage extends StatelessWidget{ GifLoaderDialogUtils.hideDialog(_context); - if(requestId != null){ + if (requestId != null) { AlertDialogBox( context: _context, title: '', confirmMessage: localize.rrtOrderSuccessMessage, okText: localize.ok, - okFunction: (){ + okFunction: () { AlertDialogBox.closeAlertDialog(_context); gotoRRTRoot(); - } - ).showAlertDialog(_context); + }).showAlertDialog(_context); } - }else{ + } else { AppToast.showErrorToast(message: 'Invalid location selected'); } - } - - gotoRRTRoot(){ + + gotoRRTRoot() { Navigator.popUntil(_context, (route) => Utils.route(route, equalsTo: ErOptions)); } -} \ No newline at end of file +} diff --git a/lib/pages/ErService/rapid-response-team/rrt-request-page.dart b/lib/pages/ErService/rapid-response-team/rrt-request-page.dart index c1906c29..984ee35b 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-request-page.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-request-page.dart @@ -8,22 +8,22 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class RRTRequestPage extends StatefulWidget{ - - final List pendingOrders; +class RRTRequestPage extends StatefulWidget { + final List pendingOrders; final ServicePrice servicePrice; RRTRequestPage({this.pendingOrders, this.servicePrice}); @override - State createState() => RRTRequestPageState(); - + State createState() => RRTRequestPageState(); } -class RRTRequestPageState extends State{ + +class RRTRequestPageState extends State { bool acceptTerms = false; TranslationBase localize; @@ -33,22 +33,19 @@ class RRTRequestPageState extends State{ Widget build(BuildContext context) { localize = TranslationBase.of(context); return BaseView( - onModelReady: (vm){ + onModelReady: (vm) { viewModel = vm; }, - builder: (ctx, vm, widgetState){ - - if(widget.pendingOrders.isNotEmpty) + builder: (ctx, vm, widgetState) { + if (widget.pendingOrders.isNotEmpty) return currentOrderContent(); else return requestContent(); - }, ); - } - Widget requestContent(){ + Widget requestContent() { return Column( children: [ Expanded( @@ -61,37 +58,33 @@ class RRTRequestPageState extends State{ acceptPolicy(), - Container(height: 0.5, color: Theme.of(context).appBarTheme.color),// Seperator + Container(height: 0.5, color: Theme.of(context).appBarTheme.color), // Seperator Container( padding: EdgeInsets.only(top: 20, bottom: 5), alignment: Alignment.center, - child: Text(localize.youCanPayByTheFollowingOptions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w500), maxLines: 2) - ), + child: Text(localize.youCanPayByTheFollowingOptions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w500), maxLines: 2)), paymentOptions(), ], ), ), - actionButtons() ], ); } - Widget currentOrderContent(){ + Widget currentOrderContent() { var orders = widget.pendingOrders; return ListView.builder( itemCount: orders.length, itemBuilder: (ctx, idx) { - var order = orders[idx]; + var order = orders[idx]; return RRTLogListItem(order, onCancel: deleteOrder); - } - ); + }); } - Widget serviceDescription(BuildContext context) => - Padding( + Widget serviceDescription(BuildContext context) => Padding( padding: const EdgeInsets.symmetric(horizontal: 10), child: Text( localize.rrtDDetails, @@ -100,7 +93,7 @@ class RRTRequestPageState extends State{ ), ); - Widget priceTable(BuildContext context){ + Widget priceTable(BuildContext context) { var radius = Radius.circular(8); String amount = widget.servicePrice.price.toString(); String vat = widget.servicePrice.vat.toString(); @@ -113,126 +106,109 @@ class RRTRequestPageState extends State{ decoration: BoxDecoration(color: Theme.of(context).appBarTheme.color, borderRadius: BorderRadius.only(topLeft: radius, topRight: radius)), child: Center(child: Text(localize.approximateServiceFee, style: TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500, letterSpacing: 1))), ), - pricingRow(label: localize.amountBeforeTax, value: '$amount ${localize.sar}'), Container(height: 0.5, color: Theme.of(context).appBarTheme.color), - pricingRow(label: localize.taxAmount, value: '$vat ${localize.sar}'), Container(height: 0.5, color: Theme.of(context).appBarTheme.color), - pricingRow(label: localize.totalAmountPayable, value: '$total ${localize.sar}', labelBold: true), Container(height: 0.5, color: Theme.of(context).appBarTheme.color), ], ); } - Widget pricingRow({@required String label, @required String value, bool labelBold = false, bool valueBold = false}){ - return - Container( - height: 40, margin: EdgeInsets.symmetric(horizontal: 10), - child: Row( - children: [ - Text(label, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: labelBold ? FontWeight.bold : FontWeight.normal)), - Spacer(), - Container(height: 40, color: Theme.of(context).appBarTheme.color, width: 0.5,), - Container( - alignment: Alignment.center, - width: MediaQuery.of(context).size.width * 0.25, - child: Text(value, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: valueBold ? FontWeight.bold : FontWeight.normal)) - ), - ], - ), - ); + Widget pricingRow({@required String label, @required String value, bool labelBold = false, bool valueBold = false}) { + return Container( + height: 40, + margin: EdgeInsets.symmetric(horizontal: 10), + child: Row( + children: [ + Text(label, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: labelBold ? FontWeight.bold : FontWeight.normal)), + Spacer(), + Container( + height: 40, + color: Theme.of(context).appBarTheme.color, + width: 0.5, + ), + Container( + alignment: Alignment.center, + width: MediaQuery.of(context).size.width * 0.25, + child: Text(value, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: valueBold ? FontWeight.bold : FontWeight.normal))), + ], + ), + ); } - - Widget acceptPolicy(){ + Widget acceptPolicy() { return Padding( padding: const EdgeInsets.symmetric(vertical: 10), child: Row( children: [ - Checkbox(value: acceptTerms, onChanged: (v){ - setState(() => acceptTerms = v); - }), + Checkbox( + value: acceptTerms, + onChanged: (v) { + setState(() => acceptTerms = v); + }), SizedBox(width: 10), - Expanded( - child: Text(localize.iAcceptTermsConditions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color), maxLines: 2) - ), + Expanded(child: Text(localize.iAcceptTermsConditions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color), maxLines: 2)), Container( alignment: Alignment.center, width: MediaQuery.of(context).size.width * 0.25, child: TextButton( child: Text(localize.clickHere, style: TextStyle(fontSize: 12, color: Colors.blue, fontWeight: FontWeight.w400)), - onPressed: (){ - Navigator.push( - context, - FadePage( - page: RRTAgreementPage())); - } - ), + onPressed: () { + Navigator.push(context, FadePage(page: RRTAgreementPage())); + }), ) ], ), ); } - Widget paymentOptions()=> Container( + Widget paymentOptions() => Container( height: 30, alignment: Alignment.center, - child: Image.asset("assets/payment_options/payment_options.png", fit: BoxFit.fill,) - ); + child: Image.asset( + "assets/payment_options/payment_options.png", + fit: BoxFit.fill, + )); - Widget actionButtons(){ + Widget actionButtons() { return Container( margin: EdgeInsets.all(15), child: Row( children: [ Expanded( - child: MaterialButton( - height: 50, - color: Theme.of(context).appBarTheme.color, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ), - onPressed: () { }, - child: Text(localize.cancel, style: TextStyle(color: Colors.white, fontSize: 13, letterSpacing: 1),), - + child: DefaultButton( + TranslationBase.of(context).next, + () { + if (acceptTerms) + goToPickupAddress(); + else + AppToast.showErrorToast(message: localize.pleaseAcceptTerms); + }, ), ), - SizedBox(width: 20,), - Expanded( - child: MaterialButton( - height: 50, - color: Theme.of(context).appBarTheme.color, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ), - child: Text(localize.ok, style: TextStyle(color: Colors.white, fontSize: 13, letterSpacing: 1),), - onPressed: () { - if(acceptTerms) - goToPickupAddress(); - else - AppToast.showErrorToast(message: localize.pleaseAcceptTerms); - } - ), - ) ], ), ); } - - goToPickupAddress()async{ + + goToPickupAddress() async { Navigator.push( context, - FadePage(page: RRTRequestPickupAddressPage(servicePrice: widget.servicePrice,)) - ); + FadePage( + page: RRTRequestPickupAddressPage( + servicePrice: widget.servicePrice, + ))); } - - deleteOrder(PrescriptionsOrder order) async { GifLoaderDialogUtils.showMyDialog(context); var success = await viewModel.cancelOrder(order); GifLoaderDialogUtils.hideDialog(context); - if(success) + if (success) setState(() { widget.pendingOrders.remove(order); }); } -} \ No newline at end of file +} diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 69c121f4..ac4fe745 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -107,7 +107,7 @@ class _AppointmentDetailsState extends State with SingleTick "", //model.user.emailAddress, ), - isNeedToShowButton: _tabController.index == 1, + isNeedToShowButton: (widget.appo.clinicID == 17 || widget.appo.clinicID == 23 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment) ? false : true, buttonTitle: TranslationBase.of(context).schedule, buttonIcon: 'assets/images/new/Boo_ Appointment.svg', showConfirmMessageDialog: false, @@ -263,10 +263,10 @@ class _AppointmentDetailsState extends State with SingleTick } void goToBookConfirm() { - if (DocAvailableAppointments.areSlotsAvailable) + if (DocAvailableAppointments.areAppointmentsAvailable) navigateToBookConfirm(context); else - AppToast.showErrorToast(message: "Please select Time Slot to continue"); + AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule); } Future navigateToBookConfirm(context) async { diff --git a/lib/pages/MyAppointments/SchedulePage.dart b/lib/pages/MyAppointments/SchedulePage.dart index 7f800e03..83773ffd 100644 --- a/lib/pages/MyAppointments/SchedulePage.dart +++ b/lib/pages/MyAppointments/SchedulePage.dart @@ -1,3 +1,6 @@ +import 'dart:ui'; + +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; @@ -6,6 +9,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/indicator.dart import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -15,10 +19,12 @@ import 'package:flutter/material.dart'; class SchedulePage extends StatefulWidget { DoctorList doctorList; AppoitmentAllHistoryResultList appo; + SchedulePage({ this.appo, this.doctorList, }); + @override _SchedulePageState createState() => _SchedulePageState(); } @@ -36,6 +42,7 @@ class _SchedulePageState extends State { bool isPageChange = false; AppSharedPreferences sharedPref = AppSharedPreferences(); + @override void initState() { this.doctorList = widget.doctorList; @@ -67,7 +74,7 @@ class _SchedulePageState extends State { isShowDecPage: false, body: SizedBox( height: MediaQuery.of(context).size.height, - child: Stack( + child: model.freeSlots.length > 0 ? Stack( children: [ Container( margin: EdgeInsets.only(top: 40), @@ -145,16 +152,27 @@ class _SchedulePageState extends State { length: weeks.length, ) ], + ) : Container( + child: Center( + child: Text(TranslationBase.of(context).emptySchedule, style: TextStyle( + fontSize: 16.0, + color: Color(0xffC5272D) + )), + ), ))); })); } generateWeeksSchedules() { - this.weeks.clear(); - for (var i = 0; i < 8; i++) { - var weekSchedule = generateNewWeekSchedule(i); - this.markWeekFreeDays(weekSchedule); - this.weeks.add(weekSchedule); + if (this.doctorScheduleResponse.length > 0) { + this.weeks.clear(); + for (var i = 0; i < 8; i++) { + var weekSchedule = generateNewWeekSchedule(i); + this.markWeekFreeDays(weekSchedule); + this.weeks.add(weekSchedule); + } + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule); } //print(this.weeks); } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index f3e6c04c..12dddcfa 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2260,6 +2260,8 @@ class TranslationBase { String get covidBookAppo => localizedValues["covidBookAppo"][locale.languageCode]; + String get emptySchedule => localizedValues["emptySchedule"][locale.languageCode]; + } diff --git a/lib/widgets/data_display/medical/time_line_new_widget.dart b/lib/widgets/data_display/medical/time_line_new_widget.dart index ba089c69..c32fa65c 100644 --- a/lib/widgets/data_display/medical/time_line_new_widget.dart +++ b/lib/widgets/data_display/medical/time_line_new_widget.dart @@ -346,6 +346,7 @@ class TimelineNewWidget extends StatelessWidget { FadePage( page: AppointmentDetails( appo: appoitmentAllHistoryResul, + parentIndex: 2, ))); }, name: appoitmentAllHistoryResul.doctorNameObj,