From 2c1d7c511e72d3888b8c7d018ed67e19c316c68c Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Thu, 7 Oct 2021 17:19:08 +0300 Subject: [PATCH] family file changes --- lib/config/localized_values.dart | 1 + lib/core/viewModels/er/rrt-view-model.dart | 1 + .../GetAllSharedRecordByStatusResponse.dart | 34 ++- lib/pages/DrawerPages/family/my-family.dart | 198 +++++++++------ .../rapid-response-team/rrt-logs-page.dart | 25 +- .../rapid-response-team/rrt-main-screen.dart | 2 + .../rrt-order-list-item.dart | 240 ++++++++++-------- .../rapid-response-team/rrt-place-order.dart | 6 +- lib/uitl/translations_delegate_base.dart | 2 + 9 files changed, 325 insertions(+), 184 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 0bd3fad3..5b9b5e5f 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1065,6 +1065,7 @@ const Map localizedValues = { "pharmacyServiceTermsCondition": {"en": "I agree with the terms of service and I adhere to them unconditionally", "ar": " أوافق على شروط الخدمة وألتزم بها دون قيد أو شرط"}, "Year": {"en": "YEAR", "ar": "السنة"}, + "years": {"en": "Years", "ar": "السنة"}, "Month": {"en": "MONTH", "ar": "الشهر"}, "point": {"en": "POINT", "ar": "النقاط"}, "riyal": {"en": "RIYAL", "ar": "الريال"}, diff --git a/lib/core/viewModels/er/rrt-view-model.dart b/lib/core/viewModels/er/rrt-view-model.dart index dcd1f5c1..339f6874 100644 --- a/lib/core/viewModels/er/rrt-view-model.dart +++ b/lib/core/viewModels/er/rrt-view-model.dart @@ -115,6 +115,7 @@ class RRTViewModel extends BaseViewModel { var success = false; await _service.baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, body: body, onSuccess: (response, statusCode) { success = true; + rrtServiceData.pendingOrders.remove(order); }, onFailure: (error, statusCode) { AppToast.showErrorToast(message: error); success = false; diff --git a/lib/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart b/lib/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart index c1755cc1..b92962eb 100644 --- a/lib/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart +++ b/lib/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart @@ -295,13 +295,21 @@ class GetAllSharedRecordsByStatusList { int iD; int patientID; int responseID; + Null relationshipID; + Null relationship; + Null relationshipN; int regionID; int status; - dynamic isActive; + Null isActive; String editedOn; String createdOn; + int age; String emaiLAddress; + int gender; + String genderDescription; + String genderImage; String mobileNumber; + int patientDataVerified; String patientIdenficationNumber; String patientName; String statusDescription; @@ -310,13 +318,21 @@ class GetAllSharedRecordsByStatusList { {this.iD, this.patientID, this.responseID, + this.relationshipID, + this.relationship, + this.relationshipN, this.regionID, this.status, this.isActive, this.editedOn, this.createdOn, + this.age, this.emaiLAddress, + this.gender, + this.genderDescription, + this.genderImage, this.mobileNumber, + this.patientDataVerified, this.patientIdenficationNumber, this.patientName, this.statusDescription}); @@ -325,13 +341,21 @@ class GetAllSharedRecordsByStatusList { iD = json['ID']; patientID = json['PatientID']; responseID = json['ResponseID']; + relationshipID = json['RelationshipID']; + relationship = json['Relationship']; + relationshipN = json['RelationshipN']; regionID = json['RegionID']; status = json['Status']; isActive = json['IsActive']; editedOn = json['EditedOn']; createdOn = json['CreatedOn']; + age = json['Age']; emaiLAddress = json['EmaiLAddress']; + gender = json['Gender']; + genderDescription = json['GenderDescription']; + genderImage = json['GenderImage']; mobileNumber = json['MobileNumber']; + patientDataVerified = json['PatientDataVerified']; patientIdenficationNumber = json['PatientIdenficationNumber']; patientName = json['PatientName']; statusDescription = json['StatusDescription']; @@ -342,13 +366,21 @@ class GetAllSharedRecordsByStatusList { data['ID'] = this.iD; data['PatientID'] = this.patientID; data['ResponseID'] = this.responseID; + data['RelationshipID'] = this.relationshipID; + data['Relationship'] = this.relationship; + data['RelationshipN'] = this.relationshipN; data['RegionID'] = this.regionID; data['Status'] = this.status; data['IsActive'] = this.isActive; data['EditedOn'] = this.editedOn; data['CreatedOn'] = this.createdOn; + data['Age'] = this.age; data['EmaiLAddress'] = this.emaiLAddress; + data['Gender'] = this.gender; + data['GenderDescription'] = this.genderDescription; + data['GenderImage'] = this.genderImage; data['MobileNumber'] = this.mobileNumber; + data['PatientDataVerified'] = this.patientDataVerified; data['PatientIdenficationNumber'] = this.patientIdenficationNumber; data['PatientName'] = this.patientName; data['StatusDescription'] = this.statusDescription; diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index a3f67a03..b7c6f68d 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -32,6 +32,8 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:provider/provider.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; class MyFamily extends StatefulWidget { final bool isAppbarVisible; @@ -55,6 +57,7 @@ class _MyFamily extends State with TickerProviderStateMixin { PharmacyModuleViewModel pharmacyModuleViewModel = locator(); ToDoCountProviderModel toDoProvider; var isVaiable = false; + bool isSwitchUser = false; @override void initState() { _tabController = new TabController(length: 2, vsync: this, initialIndex: 0); @@ -195,50 +198,105 @@ class _MyFamily extends State with TickerProviderStateMixin { return Padding( padding: EdgeInsets.only(top: 50), child: Column(children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 3, - child: Texts( - TranslationBase.of(context).request, - textAlign: TextAlign.center, - )), - Expanded(flex: 2, child: Texts(TranslationBase.of(context).switchUser, textAlign: TextAlign.center)), - Expanded(flex: 1, child: Texts(TranslationBase.of(context).deleteView, textAlign: TextAlign.center)), - ], - ), + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // Expanded( + // flex: 3, + // child: Texts( + // TranslationBase.of(context).request, + // textAlign: TextAlign.center, + // )), + // Expanded(flex: 2, child: Texts(TranslationBase.of(context).switchUser, textAlign: TextAlign.center)), + // Expanded(flex: 1, child: Texts(TranslationBase.of(context).deleteView, textAlign: TextAlign.center)), + // ], + // ), Column( mainAxisAlignment: MainAxisAlignment.start, children: snapshot.data.getAllSharedRecordsByStatusList.map((result) { return result.status == 3 - ? Padding( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded(flex: 3, child: Text(result.patientName)), - Expanded( - flex: 2, - child: IconButton( - icon: Icon(Icons.group), - color: Colors.black, - onPressed: () { - switchUser(result, context); - }, - )), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.delete, - color: Colors.black, - ), - onPressed: () { - deleteFamily(result, context); - }, - )), - ], - )) + ? Card( + margin: EdgeInsets.all(10), + shape: cardRadius(15), + color: result.gender == 1 ? Color(0xff6EA8FF) : Color(0xffFDA4B0), + elevation: 3, + child: Container( + // height: 130, + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + result.patientName.toLowerCase().capitalizeFirstofEach, + fontSize: 22, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + Texts(TranslationBase.of(context).fileNumber + ': ' + result.responseID.toString(), fontSize: 12, color: Colors.white), + Texts(result.age.toString() + ' ' + TranslationBase.of(context).years + ', ' + result.genderDescription, fontSize: 12, color: Colors.white), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + CupertinoSwitch( + value: isSwitchUser, + onChanged: (value) { + setState(() { + isSwitchUser = value; + }); + if (isSwitchUser == true) switchUser(result, context); + }, + ), + Texts( + TranslationBase.of(context).switchUser, + color: Colors.white, + fontSize: 12, + ) + ], + ), + InkWell( + onTap: () { + deleteFamily(result, context); + }, + child: Row( + children: [ + Texts( + TranslationBase.of(context).delete, + color: Colors.white, + fontSize: 12, + ), + Icon( + Icons.delete, + color: Colors.white, + ), + ], + )) + ], + ) + // Expanded( + // flex: 2, + // child: IconButton( + // icon: Icon(Icons.group), + // color: Colors.black, + // onPressed: () { + // switchUser(result, context); + // }, + // )), + // Expanded( + // flex: 1, + // child: IconButton( + // icon: Icon( + // Icons.delete, + // color: Colors.black, + // ), + // onPressed: () { + // deleteFamily(result, context); + // }, + // )), + ], + ))) : SizedBox(); }).toList()) ])); @@ -308,35 +366,34 @@ class _MyFamily extends State with TickerProviderStateMixin { ])), Column( children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map((result) { - return Padding( - padding: EdgeInsets.all(10), + return Card( child: Row( - children: [ - Expanded(flex: 3, child: Text(result.patientName)), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.check_circle, - color: Colors.black, - ), - onPressed: () { - acceptRemoveRequest(result.iD, 3, context); - }, - )), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.delete, - color: Colors.black, - ), - onPressed: () { - acceptRemoveRequest(result.iD, 4, context); - }, - )) - ], - )); + children: [ + Expanded(flex: 3, child: Text(result.patientName)), + Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.check_circle, + color: Colors.black, + ), + onPressed: () { + acceptRemoveRequest(result.iD, 3, context); + }, + )), + Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.delete, + color: Colors.black, + ), + onPressed: () { + acceptRemoveRequest(result.iD, 4, context); + }, + )) + ], + )); }).toList()) ]) ], @@ -525,7 +582,6 @@ class _MyFamily extends State with TickerProviderStateMixin { } loginAfter(result, context) async { - GifLoaderDialogUtils.hideDialog(context); var currentLang = await sharedPref.getString(APP_LANGUAGE); Provider.of(context, listen: false).setPrivilege(privilegeList: result, isLoginChild: true); result = list.CheckActivationCode.fromJson(result); @@ -559,7 +615,7 @@ class _MyFamily extends State with TickerProviderStateMixin { .getIsLastAppointmentRatedList() .then((value) => { getToDoCount(), - // Utils.hideProgressDialog(), + GifLoaderDialogUtils.hideDialog(context), if (appointmentRateViewModel.isHaveAppointmentNotRate) { Navigator.pushAndRemoveUntil( @@ -582,7 +638,7 @@ class _MyFamily extends State with TickerProviderStateMixin { .catchError((err) { print(err); // Utils.hideProgressDialog(); - // GifLoaderDialogUtils.hideDialog(context); + GifLoaderDialogUtils.hideDialog(context); }); } diff --git a/lib/pages/ErService/rapid-response-team/rrt-logs-page.dart b/lib/pages/ErService/rapid-response-team/rrt-logs-page.dart index 289785f1..c7c12a2d 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-logs-page.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-logs-page.dart @@ -5,6 +5,10 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-main-screen.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; class RRTLogPage extends StatefulWidget { final List orders; @@ -18,10 +22,18 @@ class RRTLogPage extends StatefulWidget { class RRTLogPageState extends State { RRTViewModel viewModel; + @override + void initState() { + setState(() {}); + super.initState(); + } + @override Widget build(BuildContext context) { return BaseView( - onModelReady: (vm) => viewModel = vm, + onModelReady: (vm) => { + viewModel = vm, + }, builder: (ctx, vm, widgetState) { return ListView.builder( itemCount: widget.orders.length, @@ -36,12 +48,13 @@ class RRTLogPageState extends State { deleteOrder(PrescriptionsOrder order) async { GifLoaderDialogUtils.showMyDialog(context); var success = await viewModel.cancelOrder(order); - GifLoaderDialogUtils.hideDialog(context); + if (success) { - setState(() { - widget.orders.remove(order); - }); + viewModel.setState(ViewState.Busy); + await viewModel.getAllOrders(); + viewModel.setState(ViewState.Idle); + Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RRTMainScreen)); + Navigator.push(context, FadePage(page: RRTMainScreen())); } - await viewModel.getAllOrders(); } } 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 6e875749..351c918a 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart @@ -9,6 +9,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class RRTMainScreen extends StatefulWidget { + final index = 0; + RRTMainScreen({index}); @override State createState() => RRTMainScreenState(); } diff --git a/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart b/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart index 656d47e0..a2ef7cd0 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart @@ -5,26 +5,37 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-main-screen.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; final _item_content_seperator = Container(height: 0.25, padding: EdgeInsets.all(10), color: Colors.grey.withOpacity(0.5)); -class RRTLogListItem extends StatelessWidget { +class RRTLogListItem extends StatefulWidget { final PrescriptionsOrder order; final Function(PrescriptionsOrder) onCancel; RRTLogListItem(this.order, {this.onCancel}); - + @override + State createState() => RRTLogListItemState(); BuildContext _context; +} +class RRTLogListItemState extends State { + RRTViewModel viewModel; TranslationBase localize; @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - _context = context; + localize = TranslationBase.of(context); - int status = order.status; - String _statusDisp = projectViewModel.isArabic ? order.descriptionN : order.description; + int status = widget.order.status; + String _statusDisp = projectViewModel.isArabic ? widget.order.descriptionN : widget.order.description; Color _color; if (status == 1) { //pending @@ -39,119 +50,126 @@ class RRTLogListItem extends StatelessWidget { //cancel // Rejected _color = Color(0xffD02127); } - return Container( - margin: EdgeInsets.all(5), - 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, + return BaseView( + onModelReady: (vm) => { + viewModel = vm, + }, + builder: (ctx, vm, widgetState) { + return Container( + margin: EdgeInsets.all(5), + 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: [ - 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).locationa + ": ", - 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), + 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}: ${widget.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).locationa + ": ", + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + !projectViewModel.isArabic ? widget.order.nearestProjectDescription.trim().toString() : widget.order.nearestProjectDescriptionN.toString(), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + localize.pickupDate + ": ", + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + widget.order.getFormattedDateTime(), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), + ), + ), + ], + ), + ], + ), ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - localize.pickupDate + ": ", - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + DateUtil.getDayMonthYearDateFormattedLang(widget.order.createdOn, projectViewModel.isArabic), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), ), - Expanded( - child: Text( - order.getFormattedDateTime(), - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), + SizedBox(height: 12), + if (widget.order.status == 1 || widget.order.status == 2) + InkWell( + onTap: () { + //onCancel(order); + cancelOrders(widget.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), + ), + ), ), - ), ], ), ], ), ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - DateUtil.getDayMonthYearDateFormattedLang(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: () { - onCancel(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), - ), - ), - ), - ], - ), - ], - ), - ), - ); + ); + }); // return Container( // padding: EdgeInsets.all(15), @@ -207,4 +225,16 @@ class RRTLogListItem extends StatelessWidget { // style: TextStyle(color: Colors.white, fontSize: 13), // ), // ); + cancelOrders(order) async { + GifLoaderDialogUtils.showMyDialog(context); + var success = await viewModel.cancelOrder(order); + + if (success) { + viewModel.setState(ViewState.Busy); + await viewModel.getAllOrders(); + viewModel.setState(ViewState.Idle); + Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RRTMainScreen)); + Navigator.push(context, FadePage(page: RRTMainScreen())); + } + } } diff --git a/lib/pages/ErService/rapid-response-team/rrt-place-order.dart b/lib/pages/ErService/rapid-response-team/rrt-place-order.dart index 262ef1b6..ea72c75d 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-place-order.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-place-order.dart @@ -16,6 +16,7 @@ import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-main-screen.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; class RRTPlaceOrderPage extends StatelessWidget { TranslationBase localize; @@ -206,7 +207,10 @@ class RRTPlaceOrderPage extends StatelessWidget { } } - gotoRRTRoot() { + gotoRRTRoot() async { + viewModel.setState(ViewState.Busy); + await viewModel.getAllOrders(); + viewModel.setState(ViewState.Idle); Navigator.popUntil(_context, (route) => Utils.route(route, equalsTo: RRTMainScreen)); Navigator.push(_context, FadePage(page: RRTMainScreen())); } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 682da6a6..e5ced453 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1788,6 +1788,8 @@ class TranslationBase { String get year => localizedValues['Year'][locale.languageCode]; + String get years => localizedValues['years'][locale.languageCode]; + String get month => localizedValues['Month'][locale.languageCode]; String get point => localizedValues['point'][locale.languageCode];