diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 2c79e3e5..f67c1850 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -606,6 +606,8 @@ const Map localizedValues = { "select-gender": {"en": "Select Gender", "ar": "اختر الجنس"}, "i-am-a": {"en": "I am a ...", "ar": "أنا ..."}, "select-age": {"en": "Select Your Age", "ar": "حدد العمر"}, + + "select": {"en": "Select", "ar": "يختار"}, "i-am": {"en": "I am", "ar": "أنا"}, "years-old": {"en": "years old", "ar": "سنة"}, "drag-point": {"en": "Drag point to change your age", "ar": "اسحب لتغيير عمرك"}, @@ -1299,6 +1301,8 @@ const Map localizedValues = { "app-update": {"en": "UPDATE THE APP", "ar": "تحديث التطبيق"}, "covid-alert": {"en": "Alert", "ar": "تنبيه"}, "enterIdentificationNumber": {"en": "Enter Identification Number", "ar": "أدخل رقم التعريف"}, + "identificationNumber": {"en": "Identification Number", "ar": "رقم الهوية"}, + "complaintNumber": {"en": "Complaint Number", "ar": "رقم الشكوى"}, "accountActivationDesc": { "en": " This service allows you to activate your LAKUM account after registering completed.", "ar": " تتيح لك هذه الخدمة تفعيل حساب برنامج الولاء لكم بعد اكتمال التسجيل. " @@ -1500,6 +1504,10 @@ const Map localizedValues = { "invoiceDetails": {"en": "Invoice Details", "ar": "تفاصيل الفاتورة"}, "appoDetails": {"en": "Appointment Details", "ar": "تفاصيل الموعد"}, "appoPaymentConfirm": {"en": "Are you sure you Want to make payment for this appointment?", "ar": "هل أنت متأكد من أنك تريد سداد هذا الموعد؟"}, + "selectSearchCriteria": {"en": "Select the search criteria", "ar": "حدد معايير البحث"}, + "enterComplainNumber": {"en": "Enter the Complain Number", "ar": "أدخل رقم الشكوى"}, + "enterfileNumber": {"en": "Enter File Number", "ar": "أدخل رقم الملف"}, + "please_select_from_below_options": {"en": "Please select from below options:", "ar": "الرجاء التحديد من الخيارات أدناه:"}, "selectLanguage": { "en": "Please select any language:", "ar": ":الرجاء تحديد أي لغة" }, "recAlert": { "en": "How do you want to receive alerts?", "ar": "كيف تريد تلقي التنبيهات؟" }, "modesBelow": { "en": "Please select the modes below:", "ar": ":الرجاء تحديد الأوضاع أدناه" }, diff --git a/lib/core/service/feedback/feedback_service.dart b/lib/core/service/feedback/feedback_service.dart index 57bb9c51..9e2245e6 100644 --- a/lib/core/service/feedback/feedback_service.dart +++ b/lib/core/service/feedback/feedback_service.dart @@ -13,37 +13,28 @@ class FeedbackService extends BaseService { RequestInsertCOCItem _requestInsertCOCItem = RequestInsertCOCItem(); List appointHistoryList = List(); - Future sendCOCItem( - {String title, - String details, - String cOCTypeName, - String attachment, - AppoitmentAllHistoryResultList appointHistory}) async { + Future sendCOCItem({String title, String details, String cOCTypeName, String attachment, AppoitmentAllHistoryResultList appointHistory}) async { hasError = false; - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); _requestInsertCOCItem.attachment = attachment; _requestInsertCOCItem.title = title; _requestInsertCOCItem.details = details; _requestInsertCOCItem.cOCTypeName = cOCTypeName; _requestInsertCOCItem.formTypeID = cOCTypeName; - _requestInsertCOCItem.mobileNo = - "966" + Utils.getPhoneNumberWithoutZero(user.mobileNumber); + _requestInsertCOCItem.mobileNo = "966" + Utils.getPhoneNumberWithoutZero(user.mobileNumber); _requestInsertCOCItem.isUserLoggedIn = true; _requestInsertCOCItem.projectID = user.projectID; _requestInsertCOCItem.patientName = user.firstName + " " + user.lastName; _requestInsertCOCItem.fileName = ""; _requestInsertCOCItem.appVersion = VERSION_ID; - _requestInsertCOCItem.uILanguage = - languageID; //TODO Change it to be dynamic + _requestInsertCOCItem.uILanguage = languageID; //TODO Change it to be dynamic _requestInsertCOCItem.browserInfo = Platform.localHostname; _requestInsertCOCItem.deviceInfo = Platform.localHostname; _requestInsertCOCItem.resolution = "400x847"; _requestInsertCOCItem.projectID = 0; _requestInsertCOCItem.tokenID = "C0c@@dm!n?T&A&A@Barcha202029582948"; - _requestInsertCOCItem.identificationNo = - int.parse(user.patientIdentificationNo); + _requestInsertCOCItem.identificationNo = int.parse(user.patientIdentificationNo); if (BASE_URL.contains('uat')) { _requestInsertCOCItem.forDemo = true; } else { @@ -61,9 +52,7 @@ class FeedbackService extends BaseService { body['ProjectName'] = appointHistory.projectName; } - await baseAppClient - .post(SEND_FEEDBACK, onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(SEND_FEEDBACK, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); @@ -73,15 +62,34 @@ class FeedbackService extends BaseService { hasError = false; Map body = new Map(); body['IdentificationNo'] = user.patientIdentificationNo; - body['MobileNo'] = - "966" + Utils.getPhoneNumberWithoutZero(user.mobileNumber); + body['MobileNo'] = "966" + Utils.getPhoneNumberWithoutZero(user.mobileNumber); body['Searching_type'] = '1'; if (BASE_URL.contains('uat')) { body['ForDemo'] = true; } - await baseAppClient.post(GET_STATUS_FOR_COCO, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_STATUS_FOR_COCO, onSuccess: (dynamic response, int statusCode) { + cOCItemList = []; + response['ListCOCItems'].forEach((cOC) { + cOCItemList.add(COCItem.fromJson(cOC)); + }); + cOCItemList = cOCItemList.reversed.toList(); // Sort list in desc order + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future searchFeedback(String countryCode, String phoneNumber, int type, String idNumber) async { + hasError = false; + Map body = new Map(); + body['IdentificationNo'] = idNumber; + body['MobileNo'] = countryCode + Utils.getPhoneNumberWithoutZero(phoneNumber); + body['Searching_type'] = "$type"; + if (BASE_URL.contains('uat')) { + body['ForDemo'] = true; + } + await baseAppClient.post(GET_STATUS_FOR_COCO, onSuccess: (dynamic response, int statusCode) { cOCItemList = []; response['ListCOCItems'].forEach((cOC) { cOCItemList.add(COCItem.fromJson(cOC)); @@ -97,12 +105,10 @@ class FeedbackService extends BaseService { hasError = false; Map body = new Map(); body['IsComingFromCOC'] = true; - baseAppClient.post(GET_PATIENT_AppointmentHistory, - onSuccess: (dynamic response, int statusCode) { + baseAppClient.post(GET_PATIENT_AppointmentHistory, onSuccess: (dynamic response, int statusCode) { appointHistoryList = []; response['AppoimentAllHistoryResultList'].forEach((appoint) { - appointHistoryList - .add(AppoitmentAllHistoryResultList.fromJson(appoint)); + appointHistoryList.add(AppoitmentAllHistoryResultList.fromJson(appoint)); }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/viewModels/feedback/feedback_view_model.dart b/lib/core/viewModels/feedback/feedback_view_model.dart index 6cea3085..0aac283a 100644 --- a/lib/core/viewModels/feedback/feedback_view_model.dart +++ b/lib/core/viewModels/feedback/feedback_view_model.dart @@ -6,37 +6,18 @@ import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResu import '../../../locator.dart'; -enum MessageType { - ComplaintOnAnAppointment, - ComplaintWithoutAppointment, - Question, - Compliment, - Suggestion, - NON -} +enum MessageType { ComplaintOnAnAppointment, ComplaintWithoutAppointment, Question, Compliment, Suggestion, NON } class FeedbackViewModel extends BaseViewModel { FeedbackService _feedbackService = locator(); List get cOCItemList => _feedbackService.cOCItemList; + List get appointHistoryList => _feedbackService.appointHistoryList; - List get appointHistoryList => - _feedbackService.appointHistoryList; - - Future sendCOCItem( - {String title, - String details, - String cOCTypeName, - String attachment, - AppoitmentAllHistoryResultList appointHistory}) async { + Future sendCOCItem({String title, String details, String cOCTypeName, String attachment, AppoitmentAllHistoryResultList appointHistory}) async { setState(ViewState.BusyLocal); - await _feedbackService.sendCOCItem( - title: title, - details: details, - cOCTypeName: cOCTypeName, - attachment: attachment, - appointHistory: appointHistory); + await _feedbackService.sendCOCItem(title: title, details: details, cOCTypeName: cOCTypeName, attachment: attachment, appointHistory: appointHistory); if (_feedbackService.hasError) { error = _feedbackService.error; setState(ViewState.ErrorLocal); @@ -58,7 +39,18 @@ class FeedbackViewModel extends BaseViewModel { } } - Future getPatentAppointmentHistory() async { + searchFeedback(String countryCode, String phoneNumber, int type, String idNumber) async { + setState(ViewState.Busy); + await _feedbackService.searchFeedback(countryCode, phoneNumber, type, idNumber); + if (_feedbackService.hasError) { + error = _feedbackService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future getPatentAppointmentHistory() async { setState(ViewState.Busy); await _feedbackService.getPatentAppointmentHistory(); if (_feedbackService.hasError) { diff --git a/lib/pages/feedback/status_feedback_page.dart b/lib/pages/feedback/status_feedback_page.dart index 3ab445b2..269b336d 100644 --- a/lib/pages/feedback/status_feedback_page.dart +++ b/lib/pages/feedback/status_feedback_page.dart @@ -1,11 +1,17 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/feedback/COC_items.dart'; import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback-detail.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/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -18,6 +24,12 @@ class StatusFeedbackPage extends StatefulWidget { } class _StatusFeedbackPageState extends State { + String countryCode = '966'; + String mobileNo = ""; + TextEditingController complainNumberController = TextEditingController(); + StatusType statusType = StatusType.ComplaintNumber; + int selectedStatusIndex = 3; + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -29,111 +41,273 @@ class _StatusFeedbackPageState extends State { body: Column( children: [ Expanded( - child: model.cOCItemList.isNotEmpty - ? Container( - margin: EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0, bottom: 80), - child: ListView.builder( - itemCount: model.cOCItemList.length, - itemBuilder: (context, index) => InkWell( - onTap: () { - }, - child: Card( - shape: cardRadius(12), - margin: EdgeInsets.all(10), - child: Padding( - padding: const EdgeInsets.all(12.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(projectViewModel.isArabic ? model.cOCItemList[index].statusAr : model.cOCItemList[index].status, - style: TextStyle(fontSize: 14.0, letterSpacing: -0.56, fontWeight: FontWeight.bold)), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Text(model.cOCItemList[index].formType.toString(), - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', - color: Color(0xff2B353E), - letterSpacing: -0.48, - height: 18 / 12))), - myRichText(TranslationBase.of(context).number + ": ", model.cOCItemList[index].itemID.toString(), projectViewModel.isArabic), - Text(model.cOCItemList[index].cOCTitle, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', - color: Color(0xff2B353E), - letterSpacing: -0.48, - height: 18 / 12)), - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text(model.cOCItemList[index].date.split(" ")[0], - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', - color: Color(0xff2B353E), - letterSpacing: -0.48)), - Text(model.cOCItemList[index].date.split(" ")[1].substring(0, 4), - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', - color: Color(0xff2B353E), - letterSpacing: -0.48)), - ], - ), - ], - ), - ), + child: projectViewModel.isLogin + ? !model.cOCItemList.isNotEmpty + ? listData(model.cOCItemList, projectViewModel.isArabic, true) + : Center( + child: Column( + children: [ + SizedBox( + height: MediaQuery.of(context).size.height * 0.4, + ), + Image.asset( + 'assets/images/comments.png', + width: 80, + height: 80, + ), + SizedBox( + height: 15, + ), + Text( + TranslationBase.of(context).noSearchResult, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + color: Color(0xff2B353E), ), - )), - ) - : Center( + ), + ], + ), + ) + : SingleChildScrollView( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: MediaQuery.of(context).size.height * 0.4, - ), - Image.asset( - 'assets/images/comments.png', - width: 80, - height: 80, - ), - SizedBox( - height: 15, - ), Text( - TranslationBase.of(context).noSearchResult, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - letterSpacing: -0.48, - color: Color(0xff2B353E), + TranslationBase.of(context).selectSearchCriteria, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + ), + SizedBox(height: 21), + InkWell( + onTap: () { + List list = [ + RadioSelectionDialogModel(TranslationBase.of(context).complaintNumber, 3), + RadioSelectionDialogModel(TranslationBase.of(context).fileNumber, 1), + RadioSelectionDialogModel(TranslationBase.of(context).identificationNumber, 2), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: selectedStatusIndex, + onValueSelected: (index) { + selectedStatusIndex = index; + setState(() { + if (index == 3) { + statusType = StatusType.ComplaintNumber; + } else if (index == 1) { + statusType = StatusType.FileNumber; + } else { + statusType = StatusType.IdentificationNumber; + } + }); + }, + ), + ); + }, + child: Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + getSelected(context), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + color: Color(0xff2B353E), + ), + ), + Icon( + Icons.keyboard_arrow_down, + size: 22, + color: Colors.grey, + ) + ], + ), ), ), + SizedBox(height: 12), + Directionality( + textDirection: TextDirection.ltr, + child: inputWidget( + statusType == StatusType.ComplaintNumber + ? TranslationBase.of(context).enterComplainNumber + : (statusType == StatusType.FileNumber ? TranslationBase.of(context).enterfileNumber : TranslationBase.of(context).enterIdentificationNumber), + "", + complainNumberController, + isInputTypeNum: true)), + SizedBox(height: 12), + PhoneNumberSelectorWidget(onNumberChange: (value) { + setState(() { + mobileNo = value; + }); + }, onCountryChange: (value) { + setState(() { + countryCode = value; + }); + }), ], ), ), ), + if (!projectViewModel.isLogin) + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).search, + projectViewModel.isLogin || (mobileNo.length < 9) || (complainNumberController.text.isEmpty) + ? null + : () { + model.searchFeedback(countryCode, mobileNo, selectedStatusIndex, complainNumberController.text).then((value) { + if (model.state == ViewState.ErrorLocal) { + Future.delayed(Duration(seconds: 1), () { + AppToast.showErrorToast(message: model.error); + }); + } else { + listData(model.cOCItemList, projectViewModel.isArabic, false); + } + }); + }, + disabledColor: Colors.grey, + ), + ), ], ), - bottomSheet: projectViewModel.isLogin ? Container( - color: Colors.white, - padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), - child: DefaultButton( - TranslationBase.of(context).search, - projectViewModel.isLogin ? null : () => {}, - disabledColor: Colors.grey, + ), + ); + } + + Widget listData(List cOCItemList, bool isArabic, bool isLogin) { + return ListView.builder( + padding: isLogin ? EdgeInsets.all(21) : null, + itemCount: cOCItemList.length, + shrinkWrap: isLogin ? false : true, + physics: isLogin ? null : NeverScrollableScrollPhysics(), + itemBuilder: (context, index) => InkWell( + onTap: () {}, + child: Card( + shape: cardRadius(12), + margin: EdgeInsets.all(10), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(isArabic ? cOCItemList[index].statusAr : cOCItemList[index].status, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56, fontWeight: FontWeight.bold)), + Container( + margin: EdgeInsets.only(top: 5.0), + child: Text(cOCItemList[index].formType.toString(), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12))), + myRichText(TranslationBase.of(context).number + ": ", cOCItemList[index].itemID.toString(), isArabic), + Text(cOCItemList[index].cOCTitle, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12)), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text(cOCItemList[index].date.split(" ")[0], + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48)), + Text(cOCItemList[index].date.split(" ")[1].substring(0, 4), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48)), + ], + ), + ], + ), ), - ) : Container(), + ), + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, + {VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: isInputTypeNum ? TextInputType.number : TextInputType.text, + controller: _controller, + maxLines: lines, + onChanged: (value) => {setState(() {})}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + suffixIconConstraints: BoxConstraints(minWidth: 50), + suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), ), ); } @@ -141,4 +315,25 @@ class _StatusFeedbackPageState extends State { gotodetails(item) { Navigator.pushReplacement(context, FadePage(page: FeedbackDetails(items: item))); } + + String getSelected(BuildContext context) { + switch (statusType) { + case StatusType.ComplaintNumber: + return TranslationBase.of(context).complaintNumber; + break; + case StatusType.FileNumber: + return TranslationBase.of(context).fileNumber; + break; + case StatusType.IdentificationNumber: + return TranslationBase.of(context).identificationNumber; + break; + } + return TranslationBase.of(context).notClassified; + } +} + +enum StatusType { + ComplaintNumber, + FileNumber, + IdentificationNumber, } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 98ac31f9..edc2e2e0 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -805,6 +805,12 @@ class TranslationBase { String get fileNumber => localizedValues['FileNumber'][locale.languageCode]; + String get enterfileNumber => localizedValues['enterfileNumber'][locale.languageCode]; + + String get complaintNumber => localizedValues['complaintNumber'][locale.languageCode]; + + String get identificationNumber => localizedValues['identificationNumber'][locale.languageCode]; + String get amount => localizedValues['Amount'][locale.languageCode]; String get depositorEmail => localizedValues['DepositorEmail'][locale.languageCode]; @@ -1504,6 +1510,8 @@ class TranslationBase { String get selectAll => localizedValues['select-all'][locale.languageCode]; + String get select => localizedValues['select'][locale.languageCode]; + String get selectMap => localizedValues['select-map'][locale.languageCode]; String get noAppointment => localizedValues['no-appointment'][locale.languageCode]; @@ -2374,6 +2382,9 @@ class TranslationBase { String get appoPaymentConfirm => localizedValues["appoPaymentConfirm"][locale.languageCode]; + String get selectSearchCriteria => localizedValues["selectSearchCriteria"][locale.languageCode]; + + String get enterComplainNumber => localizedValues["enterComplainNumber"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 07947508..b7e0f16b 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -183,6 +183,8 @@ class Utils { String newNumber = ""; if (number.startsWith('0')) { newNumber = number.substring(1); + } else { + newNumber = number; } return newNumber; } diff --git a/lib/widgets/dialogs/radio_selection_dialog.dart b/lib/widgets/dialogs/radio_selection_dialog.dart new file mode 100644 index 00000000..198e25de --- /dev/null +++ b/lib/widgets/dialogs/radio_selection_dialog.dart @@ -0,0 +1,121 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:flutter/material.dart'; + +class RadioSelectionDialogModel { + String title; + int value; + + RadioSelectionDialogModel(this.title, this.value); +} + +class RadioSelectionDialog extends StatefulWidget { + final Function(int) onValueSelected; + final List listData; + final int selectedIndex; + + const RadioSelectionDialog({Key key, this.onValueSelected, this.listData, this.selectedIndex}) : super(key: key); + + @override + State createState() => new RadioSelectionDialogState(); +} + +class RadioSelectionDialogState extends State { + int selectedIndex; + + @override + void initState() { + selectedIndex = widget.selectedIndex ?? 0; + super.initState(); + } + + Widget build(BuildContext context) { + return Dialog( + backgroundColor: Colors.white, + shape: RoundedRectangleBorder(), + insetPadding: EdgeInsets.only(left: 21, right: 21), + child: Padding( + padding: EdgeInsets.only(left: 20, right: 20, top: 18, bottom: 28), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.only(top: 16.0), + child: Text( + TranslationBase.of(context).select, + style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Color(0xff2B353E), height: 35 / 24, letterSpacing: -0.96), + ), + ), + ), + IconButton( + padding: EdgeInsets.zero, + icon: Icon(Icons.close), + color: Color(0xff2B353E), + constraints: BoxConstraints(), + onPressed: () { + Navigator.pop(context); + }, + ) + ], + ), + SizedBox(height: 21), + Text( + TranslationBase.of(context).pleaseSelectFromBelowOptions, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), + ), + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.only(bottom: 42, top: 10), + itemBuilder: (context, index) { + return Row( + children: [ + SizedBox( + width: 22, + height: 22, + child: Radio( + value: widget.listData[index].value, + groupValue: selectedIndex, + onChanged: (value) { + setState(() { + selectedIndex = value; + }); + }, + ), + ), + SizedBox(width: 8), + Text( + widget.listData[index].title, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.56), + ), + ], + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 10), + itemCount: widget.listData.length), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).save, + () { + Navigator.pop(context); + widget.onValueSelected(selectedIndex); + }, + color: Color(0xff349745), + ), + ), + ], + ), + ], + ), + ), + ); + } +}