Browse Source

对用户的默认小区名称的抽取

liukai 2 months ago
parent
commit
973fce29ff

+ 7 - 6
packages/cpt_form/lib/modules/form/form_types.dart

@@ -12,6 +12,7 @@ import 'package:cpt_form/modules/apply/type_of_application_page.dart';
 import 'package:cpt_form/modules/apply/vehicle_info_page.dart';
 import 'package:cs_resources/generated/assets.dart';
 import 'package:cs_resources/generated/l10n.dart';
+import 'package:plugin_basic/provider/user_config/user_config_service.dart';
 
 //每一种 formType 对应的详情页面类型
 enum DetailPageType {
@@ -164,7 +165,7 @@ class FormTypes {
         ],
         'detail_data': {
           'note_management_txt': '${S.current.car_cancel_txt}\n\n${S.current.car_cancel_txt_1}\n${S.current.car_cancel_txt_2}',
-          'signature_txt': S.current.signature_vehicle,
+          'signature_txt': S.current.car_cancel_signature_txt(UserConfigService.getState().getDefaultEstateName() ?? "-"),
         }
       },
       //Moving In
@@ -208,7 +209,7 @@ class FormTypes {
         ],
         'detail_data': {
           'note_management_txt': S.current.overnight_parking_msg,
-          'signature_txt': S.current.signature_vehicle,
+          'signature_txt': S.current.signature_vehicle(UserConfigService.getState().getDefaultEstateName() ?? "-"),
         }
       },
       //Registration of 2nd Vehicle
@@ -224,7 +225,7 @@ class FormTypes {
         'detail_data': {
           'attachment_txt': '${S.current.label_txt}\n\n${S.current.label_txt_1}\n\n${S.current.label_txt_2}\n\n${S.current.label_txt_3}',
           'note_management_txt': S.current.moving_in_msg,
-          'signature_txt': S.current.signature_vehicle,
+          'signature_txt': S.current.signature_vehicle(UserConfigService.getState().getDefaultEstateName() ?? "-"),
         }
       },
       //Renovation
@@ -259,7 +260,7 @@ class FormTypes {
         'detail_data': {
           'attachment_txt': '${S.current.label_txt}\n\n${S.current.label_txt_1}\n\n${S.current.label_txt_2}\n\n${S.current.label_txt_3}',
           'note_management_txt': S.current.moving_in_msg,
-          'signature_txt': S.current.signature_vehicle,
+          'signature_txt': S.current.signature_vehicle(UserConfigService.getState().getDefaultEstateName() ?? "-"),
         }
       },
       //Re-Registration of 1st Vehicle-Owner
@@ -275,7 +276,7 @@ class FormTypes {
         'detail_data': {
           'attachment_txt': '${S.current.label_txt}\n\n${S.current.label_txt_1}\n\n${S.current.label_txt_2}\n\n${S.current.label_txt_3}',
           'note_management_txt': S.current.moving_in_msg,
-          'signature_txt': S.current.signature_vehicle,
+          'signature_txt': S.current.signature_vehicle(UserConfigService.getState().getDefaultEstateName() ?? "-"),
         }
       },
       //Re-Registration of Bicycles
@@ -307,7 +308,7 @@ class FormTypes {
         'detail_data': {
           'attachment_txt': '${S.current.label_txt}\n\n${S.current.label_txt_1}\n\n${S.current.label_txt_2}\n\n${S.current.label_txt_3}',
           'note_management_txt': S.current.label_replace_note,
-          'signature_txt': S.current.signature_vehicle,
+          'signature_txt': S.current.signature_vehicle(UserConfigService.getState().getDefaultEstateName() ?? "-"),
         }
       },
     };

+ 10 - 0
packages/cs_plugin_basic/lib/provider/user_config/user_config.dart

@@ -20,6 +20,16 @@ class UserConfig {
   //用户的未读消息数量
   int unreadNotificationsCount = 0;
 
+  /// 获取用户默认的房产名称
+  String? getDefaultEstateName() {
+    return user?.estates
+        ?.firstWhere(
+          (estate) => estate.accounts?.any((a) => a.isDefault == 1) ?? false,
+          orElse: () => UserMeEstates(), // 如果没有匹配项返回 null name
+        )
+        .name;
+  }
+
   /// ===================================  插件自动生成-无需手动修改  ↓  ===================================
 
 //<editor-fold desc="Data Methods">

File diff suppressed because it is too large
+ 24 - 22
packages/cs_resources/lib/generated/intl/messages_en.dart


File diff suppressed because it is too large
+ 24 - 22
packages/cs_resources/lib/generated/intl/messages_zh_CN.dart


File diff suppressed because it is too large
+ 24 - 22
packages/cs_resources/lib/generated/intl/messages_zh_HK.dart


+ 4 - 4
packages/cs_resources/lib/generated/l10n.dart

@@ -2420,13 +2420,13 @@ class S {
     );
   }
 
-  /// `the resident,herein confirm that we have read and will fully abide by the rules & regulations governing car parking of Parc Life. We  further undertake to display the car park label, prominently on the top left(passenger side) portion of the front windscreen of our vehicle at all times whilst in Parc Life.`
-  String get car_cancel_signature_txt {
+  /// `the resident,herein confirm that we have read and will fully abide by the rules & regulations governing car parking of {name}. We further undertake to display the car park label, prominently on the top left(passenger side) portion of the front windscreen of our vehicle at all times whilst in {name}.`
+  String car_cancel_signature_txt(Object name) {
     return Intl.message(
-      'the resident,herein confirm that we have read and will fully abide by the rules & regulations governing car parking of Parc Life. We  further undertake to display the car park label, prominently on the top left(passenger side) portion of the front windscreen of our vehicle at all times whilst in Parc Life.',
+      'the resident,herein confirm that we have read and will fully abide by the rules & regulations governing car parking of $name. We further undertake to display the car park label, prominently on the top left(passenger side) portion of the front windscreen of our vehicle at all times whilst in $name.',
       name: 'car_cancel_signature_txt',
       desc: '',
-      args: [],
+      args: [name],
     );
   }
 

+ 1 - 1
packages/cs_resources/lib/l10n/intl_en.arb

@@ -237,7 +237,7 @@
   "car_cancel_txt_1": "1. Car decals serial number",
   "car_cancel_txt_2": "2.Effective date of cancellation",
   "signature": "SIGNATURE",
-  "car_cancel_signature_txt": "the resident,herein confirm that we have read and will fully abide by the rules & regulations governing car parking of Parc Life. We  further undertake to display the car park label, prominently on the top left(passenger side) portion of the front windscreen of our vehicle at all times whilst in Parc Life.",
+  "car_cancel_signature_txt": "the resident,herein confirm that we have read and will fully abide by the rules & regulations governing car parking of {name}. We further undertake to display the car park label, prominently on the top left(passenger side) portion of the front windscreen of our vehicle at all times whilst in {name}.",
   "signed_and_agreed_by": "Signed and agreed by",
   "moving_in_msg": "If you would like to leave the Management a note to accompany this application or have any special requests, please leave them here.",
   "overnight_parking_msg": "Please provide the period of overnight parking.",

+ 1 - 1
packages/cs_resources/lib/l10n/intl_zh_CN.arb

@@ -237,7 +237,7 @@
   "car_cancel_txt_1": "1.车辆序列号",
   "car_cancel_txt_2": "2.车位取消的实施日期",
   "signature": "签名",
-  "car_cancel_signature_txt": "居民在此确认,我们已阅读并将完全遵守Parc Life的停车规则和规定。我们进一步承诺,在Parc Life期间,我们将始终在车辆前挡风玻璃的左上角(乘客侧)突出显示停车场标签。",
+  "car_cancel_signature_txt": "居民在此确认,我们已阅读并将完全遵守{name}的停车规则和规定。我们进一步承诺,在{name}期间,我们将始终在车辆前挡风玻璃的左上角(乘客侧)突出显示停车场标签。",
   "signed_and_agreed_by": "签字并同意",
   "moving_in_msg": "如果您想在申请时给管理层留一张便条或有任何特殊要求,请在此处留下。",
   "overnight_parking_msg": "请提供过夜停车时间。",

+ 1 - 1
packages/cs_resources/lib/l10n/intl_zh_HK.arb

@@ -223,7 +223,7 @@
   "car_cancel_txt_1": "1.车辆序列号",
   "car_cancel_txt_2": "2.车位取消的实施日期",
   "signature": "签名",
-  "car_cancel_signature_txt": "居民在此确认,我们已阅读并将完全遵守Parc Life的停车规则和规定。我们进一步承诺,在Parc Life期间,我们将始终在车辆前挡风玻璃的左上角(乘客侧)突出显示停车场标签。",
+  "car_cancel_signature_txt": "居民在此确认,我们已阅读并将完全遵守{name}的停车规则和规定。我们进一步承诺,在{name}期间,我们将始终在车辆前挡风玻璃的左上角(乘客侧)突出显示停车场标签。",
   "signed_and_agreed_by": "签字并同意",
   "moving_in_msg": "如果您想在申请时给管理层留一张便条或有任何特殊要求,请在此处留下。",
   "overnight_parking_msg": "请提供过夜停车时间。",