From cabe183f2758b94414b52e5a6228c93afd1c74be Mon Sep 17 00:00:00 2001 From: Vincent BRIDIER Date: Mon, 1 Sep 2025 19:33:08 +0200 Subject: [PATCH] feat: - Update select and select multiple fields to get list in alphabetical order - Close #59 --- ComApp/CHANGELOG.md | 6 ++++++ ComApp/android/app/build.gradle | 2 +- ComApp/src/App/Views/ContactDetailsScreen.js | 16 +++++++++------- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ComApp/CHANGELOG.md b/ComApp/CHANGELOG.md index d83bf45..7d1cbe9 100644 --- a/ComApp/CHANGELOG.md +++ b/ComApp/CHANGELOG.md @@ -1,5 +1,11 @@ # CHANGELOG +## 3.2.1 + +### Évolution - 3.2.1 + +- Update select and select multiple fields to get list in alphabetical order + ## 3.1.1 ### Évolution - 3.1.1 diff --git a/ComApp/android/app/build.gradle b/ComApp/android/app/build.gradle index 98f50ee..d872a7c 100644 --- a/ComApp/android/app/build.gradle +++ b/ComApp/android/app/build.gradle @@ -139,7 +139,7 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 - versionName "3.1.1" + versionName "3.2.1" buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() if (isNewArchitectureEnabled()) { diff --git a/ComApp/src/App/Views/ContactDetailsScreen.js b/ComApp/src/App/Views/ContactDetailsScreen.js index 5472640..2883371 100644 --- a/ComApp/src/App/Views/ContactDetailsScreen.js +++ b/ComApp/src/App/Views/ContactDetailsScreen.js @@ -184,7 +184,7 @@ class ContactDetailsScreen extends React.Component { contact.email.length >= 255 || !Helpers.isEmailValid(contact.email) ) { - console.debug('invalid prop email'); + console.debug('invalid prop email', contact.email); error = error.concat(i18n.t('error.invalid_email_address') + '.\n'); } const lockedFields = ['firstname', 'lastname', 'phone']; @@ -1292,12 +1292,12 @@ class ContactDetailsScreen extends React.Component { 'contact_details_s.input_select_multiple_search', )} confirmText={i18n.t('global.close')} - items={details.map(function (detail, detailIndex) { - return { + items={details + .map((detail, detailIndex) => ({ id: detailIndex, name: detail, - }; - })} + })) + .sort((a, b) => a.name.localeCompare(b.name))} IconRenderer={this.getIcon} uniqueKey="id" selectText={`${placeHolder} ${requiredStr}`} @@ -1535,8 +1535,10 @@ class ContactDetailsScreen extends React.Component { label={i18n.t('contact_details_s.input_select_please_choose')} value={''} /> - {details.map((detail, detailIndex) => ( - + {details.map((detail, index) => ({ label: detail, value: index })) + .sort((a, b) => a.label.localeCompare(b.label)) + .map((item, index) => ( + ))} ,