From dfa7d9a713f023cc985da56bb421b4cfda573d35 Mon Sep 17 00:00:00 2001 From: aamir-csol Date: Wed, 28 Jan 2026 10:05:36 +0300 Subject: [PATCH] approval level commented Code for filter . --- assets/langs/ar-SA.json | 1 + assets/langs/en-US.json | 1 + lib/api/etqan_ovr_api_client.dart | 4 +-- lib/generated/codegen_loader.g.dart | 2 ++ lib/generated/locale_keys.g.dart | 1 + lib/provider/etqan_ovr_provider.dart | 10 +++++- lib/ui/etqan_ovr/etqan_create_request.dart | 39 ++++++++++++++++++++++ 7 files changed, 55 insertions(+), 3 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 84c9b46..da79f14 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -258,6 +258,7 @@ "fullName": "الأسم الكامل", "remove": "حذف", "submit": "ارسال", + "submitAsAnonymous": "إرسال كمجهول", "areYouSureYouWantToSubmit": "هل أنت متأكد أنك تريد أن تقدم؟", "comments": "تعليقات", "writeComment": "أكتب تعليقا", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 8f95e9a..f1600be 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -256,6 +256,7 @@ "remove": "Remove", "Attendance": "Attendance", "submit": "Submit", + "submitAsAnonymous": "Submit as Anonymous", "areYouSureYouWantToSubmit": "Are you sure you want to submit?", "comments": "Comments", "writeComment": "Write a comment", diff --git a/lib/api/etqan_ovr_api_client.dart b/lib/api/etqan_ovr_api_client.dart index f9d97bd..3f595a4 100644 --- a/lib/api/etqan_ovr_api_client.dart +++ b/lib/api/etqan_ovr_api_client.dart @@ -93,7 +93,7 @@ class EtqanApiClient { ); } - Future createRequest(String description, int? projectID, String? attachmentBase64) async { + Future createRequest(String description, int? projectID, String? attachmentBase64, bool? isAnonymous) async { String url = "${ApiConsts.cocRest}ETQAN_CreateIncident"; Map postParams = { "P_SELECTED_EMPLOYEE_NUMBER": AppState().memberInformationList?.eMPLOYEENUMBER, @@ -102,7 +102,7 @@ class EtqanApiClient { "ETQAN_Description": description, "ETQAN_ProjectId": projectID, "ETQAN_FileInfoBase64": attachmentBase64, - "ETQAN_IsAnonymous": false, + "ETQAN_IsAnonymous": isAnonymous ?? false, }; postParams.addAll(AppState().postParamsJson); diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 4cb2359..3eef24e 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -274,6 +274,7 @@ class CodegenLoader extends AssetLoader{ "fullName": "الأسم الكامل", "remove": "حذف", "submit": "ارسال", + "submitAsAnonymous": "إرسال كمجهول", "areYouSureYouWantToSubmit": "هل أنت متأكد أنك تريد أن تقدم؟", "comments": "تعليقات", "writeComment": "أكتب تعليقا", @@ -919,6 +920,7 @@ static const Map _en_US = { "remove": "Remove", "Attendance": "Attendance", "submit": "Submit", + "submitAsAnonymous": "Submit as Anonymous", "areYouSureYouWantToSubmit": "Are you sure you want to submit?", "comments": "Comments", "writeComment": "Write a comment", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index c4efa13..8402214 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -261,6 +261,7 @@ abstract class LocaleKeys { static const fullName = 'fullName'; static const remove = 'remove'; static const submit = 'submit'; + static const submitAsAnonymous = 'submitAsAnonymous'; static const areYouSureYouWantToSubmit = 'areYouSureYouWantToSubmit'; static const comments = 'comments'; static const writeComment = 'writeComment'; diff --git a/lib/provider/etqan_ovr_provider.dart b/lib/provider/etqan_ovr_provider.dart index a063463..83e4c9b 100644 --- a/lib/provider/etqan_ovr_provider.dart +++ b/lib/provider/etqan_ovr_provider.dart @@ -43,6 +43,7 @@ class EtqanOvrProviderModel with ChangeNotifier, DiagnosticableTreeMixin { File? attachment; String? attachmentBase64; String description = ''; + bool isAnonymous = false; /// Initialize speech recognition - call this once when screen loads Future initSpeech() async { @@ -149,6 +150,12 @@ class EtqanOvrProviderModel with ChangeNotifier, DiagnosticableTreeMixin { notifyListeners(); } + // Set isAnonymous + void setIsAnonymous(bool value) { + isAnonymous = value; + notifyListeners(); + } + // Clear create request form void clearCreateRequestForm() { selectedProject = null; @@ -156,6 +163,7 @@ class EtqanOvrProviderModel with ChangeNotifier, DiagnosticableTreeMixin { attachment = null; attachmentBase64 = null; description = ''; + isAnonymous = false; notifyListeners(); } @@ -163,7 +171,7 @@ class EtqanOvrProviderModel with ChangeNotifier, DiagnosticableTreeMixin { Future submitRequest(BuildContext context) async { try { Utils.showLoading(context); - int? isSuccess = await EtqanApiClient().createRequest(description, selectedProject?.projectId, attachmentBase64); + int? isSuccess = await EtqanApiClient().createRequest(description, selectedProject?.projectId, attachmentBase64, isAnonymous); Utils.hideLoading(context); if (isSuccess == 1) { getEtqanEmployeeRequestsList = await EtqanApiClient().getEmployeeEtqanRequests(); diff --git a/lib/ui/etqan_ovr/etqan_create_request.dart b/lib/ui/etqan_ovr/etqan_create_request.dart index 93925e0..8bc320e 100644 --- a/lib/ui/etqan_ovr/etqan_create_request.dart +++ b/lib/ui/etqan_ovr/etqan_create_request.dart @@ -74,6 +74,8 @@ class _EtqanOvrCreateRequestState extends State { _buildAttachmentSection(provider), 16.height, _buildDescriptionField(provider), + 16.height, + _buildAnonymousCheckbox(provider), 24.height, ], )).expanded, @@ -276,4 +278,41 @@ class _EtqanOvrCreateRequestState extends State { ), ); } + + Widget _buildAnonymousCheckbox(EtqanOvrProviderModel provider) { + return InkWell( + onTap: () { + provider.setIsAnonymous(!provider.isAnonymous); + }, + borderRadius: BorderRadius.circular(15), + child: Row( + children: [ + Checkbox( + value: provider.isAnonymous, + onChanged: (bool? value) { + if (value != null) { + provider.setIsAnonymous(value); + } + }, + activeColor: MyColors.gradiantEndColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4), + ), + ), + const SizedBox(width: 8), + Expanded( + child: Text( + LocaleKeys.submitAsAnonymous.tr(), + style: const TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + ), + ], + ), + ); + } }