diff --git a/CHANGELOG.md b/CHANGELOG.md index 5803e0b20d..7e004597d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,46 @@ +## [101.14.1](https://github.com/dhis2/capture-app/compare/v101.14.0...v101.14.1) (2024-10-22) + + +### Bug Fixes + +* [DHIS2-16010] app crashes on invalid programid ([#3765](https://github.com/dhis2/capture-app/issues/3765)) ([9133a63](https://github.com/dhis2/capture-app/commit/9133a63e138517c633a192b5d51f39a43c57e327)) + +# [101.14.0](https://github.com/dhis2/capture-app/compare/v101.13.0...v101.14.0) (2024-10-21) + + +### Features + +* [DHIS2-17792] Org unit context in forms ([#3828](https://github.com/dhis2/capture-app/issues/3828)) ([c8ccf63](https://github.com/dhis2/capture-app/commit/c8ccf63e0cde97a190cec6248dc25a4a4d747646)) + +# [101.13.0](https://github.com/dhis2/capture-app/compare/v101.12.2...v101.13.0) (2024-10-21) + + +### Features + +* [DHIS2-16992] Fixed size for changelog modal and columns ([#3834](https://github.com/dhis2/capture-app/issues/3834)) ([3b021cf](https://github.com/dhis2/capture-app/commit/3b021cf5569338db5038d8ed231a810a0fa909f3)) +* [DHIS2-17991] Show orgUnit selector in Enter details now ([#3824](https://github.com/dhis2/capture-app/issues/3824)) ([bf2f1ca](https://github.com/dhis2/capture-app/commit/bf2f1cabebe4ddf100cb8054be0a4af2fbec3965)) + +## [101.12.2](https://github.com/dhis2/capture-app/compare/v101.12.1...v101.12.2) (2024-10-20) + + +### Bug Fixes + +* **translations:** sync translations from transifex (master) ([9bf7696](https://github.com/dhis2/capture-app/commit/9bf7696de59baf42dd8f8ee1869f4696f83c007a)) + +## [101.12.1](https://github.com/dhis2/capture-app/compare/v101.12.0...v101.12.1) (2024-10-16) + + +### Bug Fixes + +* [DHIS2-17978] use title instead of alt on missing icons ([#3847](https://github.com/dhis2/capture-app/issues/3847)) ([b5940f2](https://github.com/dhis2/capture-app/commit/b5940f21204cf26afce6c28ba88b50c09728265f)) + +# [101.12.0](https://github.com/dhis2/capture-app/compare/v101.11.2...v101.12.0) (2024-10-15) + + +### Features + +* [DHIS2-17956] Display name for org unit in changelog ([#3826](https://github.com/dhis2/capture-app/issues/3826)) ([5299f37](https://github.com/dhis2/capture-app/commit/5299f37d33448616c0074ec6568a82c9c96f65cb)) + ## [101.11.2](https://github.com/dhis2/capture-app/compare/v101.11.1...v101.11.2) (2024-10-15) diff --git a/cypress/e2e/MainPage/MainPage.js b/cypress/e2e/MainPage/MainPage.js index a420c317b5..01a56c2777 100644 --- a/cypress/e2e/MainPage/MainPage.js +++ b/cypress/e2e/MainPage/MainPage.js @@ -1,4 +1,4 @@ -import { Given, Then, defineStep as And } from '@badeball/cypress-cucumber-preprocessor'; +import { defineStep as And, Given, Then } from '@badeball/cypress-cucumber-preprocessor'; Given('you are in the search page with Ngelehun and MNCH PNC context', () => { cy.visit('/#/search?orgUnitId=DiszpKrYNg8&programId=uy2gU8kT1jF'); @@ -20,13 +20,13 @@ And('you can load the view with the name Events assigned to me', () => { }); Then('the icon is rendered as a custom icon', () => { - cy.get('[alt="child_program_positive"]') + cy.get('[title="child_program_positive"]') .invoke('attr', 'src') .should('match', /\/icons\/child_program_positive\/icon$/); }); Then('the icon is rendered as an svg', () => { - cy.get('[alt="child_program_positive"]') + cy.get('[title="child_program_positive"]') .invoke('attr', 'src') .should('match', /\/icons\/child_program_positive\/icon.svg$/); }); diff --git a/cypress/e2e/ScopeSelector/ScopeSelector.feature b/cypress/e2e/ScopeSelector/ScopeSelector.feature index a53da4790d..ec80a5d2b0 100644 --- a/cypress/e2e/ScopeSelector/ScopeSelector.feature +++ b/cypress/e2e/ScopeSelector/ScopeSelector.feature @@ -28,8 +28,6 @@ Feature: User uses the ScopeSelector to navigate When you select both org unit and program Malaria case registration Then you should see the table - # DHIS2-16010 - App crashes on invalid program id - @skip Scenario: Main page > Url with invalid program id Given you land on a main page with an invalid program id Then you should see error message diff --git a/cypress/e2e/WidgetsForEnrollmentPages/WidgetEnrollment/index.js b/cypress/e2e/WidgetsForEnrollmentPages/WidgetEnrollment/index.js index ca5bef0b08..fb01545e49 100644 --- a/cypress/e2e/WidgetsForEnrollmentPages/WidgetEnrollment/index.js +++ b/cypress/e2e/WidgetsForEnrollmentPages/WidgetEnrollment/index.js @@ -66,7 +66,7 @@ Then('the user sees the enrollment organisation unit', () => { cy.get('[data-test="widget-enrollment"]').within(() => { cy.get('[data-test="widget-enrollment-icon-orgunit"]').should('exist'); cy.get('[data-test="widget-enrollment-orgunit"]') - .contains('Started at: Ngelehun CHC') + .contains('Started at:Ngelehun CHC') .should('exist'); }); }); @@ -77,7 +77,7 @@ Then('the user sees the owner organisation unit', () => { 'exist', ); cy.get('[data-test="widget-enrollment-owner-orgunit"]') - .contains('Owned by: Ngelehun CHC') + .contains('Owned by:Ngelehun CHC') .should('exist'); }); }); @@ -232,7 +232,7 @@ Then(/^the user successfully transfers the enrollment/, () => { cy.get('[data-test="widget-enrollment"]').within(() => { cy.get('[data-test="widget-enrollment-owner-orgunit"]') - .contains('Owned by: Njandama MCHP') + .contains('Owned by:Njandama MCHP') .should('exist'); }); }); @@ -246,7 +246,7 @@ Then(/^the user types in (.*)/, (orgunit) => { Given(/^the enrollment owner organisation unit is (.*)/, (orgunit) => { cy.get('[data-test="widget-enrollment"]').within(() => { cy.get('[data-test="widget-enrollment-owner-orgunit"]') - .contains(`Owned by: ${orgunit}`) + .contains(`Owned by:${orgunit}`) .should('exist'); }); }); diff --git a/i18n/cs.po b/i18n/cs.po index 040d421b6b..a280598f67 100644 --- a/i18n/cs.po +++ b/i18n/cs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" -"POT-Creation-Date: 2024-09-02T11:08:16.281Z\n" +"POT-Creation-Date: 2024-10-14T14:53:34.553Z\n" "PO-Revision-Date: 2019-06-27 07:31+0000\n" "Last-Translator: Jiří Podhorecký , 2024\n" "Language-Team: Czech (https://app.transifex.com/hisp-uio/teams/100509/cs/)\n" @@ -625,53 +625,6 @@ msgstr "Oznámení" msgid "Close the notice" msgstr "Zavřít oznámení" -msgid "Use new Enrollment dashboard for {{programName}}" -msgstr "Použít nový ovládací panel zápisu pro {{programName}}" - -msgid "Opt in for {{programName}}" -msgstr "Přihlásit se do {{programName}}" - -msgid "" -"By clicking opt-in below, you will start using the new enrollment dashboard " -"in the Capture app for this Tracker program. At the moment, there is certain" -" functionality from Tracker Capture that has not yet been added, including " -"relationship and referral functionality. The work on including this Tracker " -"functionality in Capture is ongoing and will be added in upcoming app " -"releases." -msgstr "" -"Kliknutím na přihlášení níže začnete používat nový ovládací panel registrace" -" v aplikaci Capture pro tento program Tracker. V současné době existuje " -"určitá funkce z aplikace Tracker Capture, která ještě nebyla přidána, včetně" -" funkcí vztahů a doporučení. Práce na zahrnutí této funkce sledování do " -"Capture pokračují a budou přidány v nadcházejících vydáních aplikace." - -msgid "" -"The core team appreciates any feedback on this new functionality which is " -"currently being beta tested, please report any issues and feedback in the " -"DHIS2 JIRA project." -msgstr "" -"Základní tým oceňuje jakoukoli zpětnou vazbu k této nové funkcionalitě, " -"která je v současné době beta testována, nahlaste prosím jakékoli problémy a" -" zpětnou vazbu v projektu DHIS2 JIRA." - -msgid "" -"Click the button below to opt-in to the new enrollment dashboard " -"functionality in the Capture app (beta) for this Tracker program for all " -"users." -msgstr "" -"Kliknutím na tlačítko níže se přihlásíte k nové funkci ovládacího panelu " -"registrace v aplikaci Capture (beta) pro tento program Tracker pro všechny " -"uživatele." - -msgid "Yes, opt in" -msgstr "Ano, přihlásit se" - -msgid "Stop using new Enrollment dashboard for {{programName}}" -msgstr "Přestat používat nový ovládací panel zápisu pro {{programName}}" - -msgid "Opt out for {{programName}}" -msgstr "Odhlásit se z {{programName}}" - msgid "Enrollment with id \"{{enrollmentId}}\" does not exist" msgstr "Zápis s ID \"{{enrollmentId}}\" neexistuje" diff --git a/i18n/en.pot b/i18n/en.pot index 6eace7c8d0..3bee26bc80 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -5,8 +5,8 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" -"POT-Creation-Date: 2024-10-24T12:19:48.721Z\n" -"PO-Revision-Date: 2024-10-24T12:19:48.721Z\n" +"POT-Creation-Date: 2024-10-14T14:53:34.553Z\n" +"PO-Revision-Date: 2024-10-14T14:53:34.553Z\n" msgid "Choose one or more dates..." msgstr "Choose one or more dates..." @@ -705,9 +705,6 @@ msgstr "View working list in this program." msgid "Page is missing required values from URL" msgstr "Page is missing required values from URL" -msgid "Program is not valid" -msgstr "Program is not valid" - msgid "Org unit is not valid with current program" msgstr "Org unit is not valid with current program" @@ -1224,6 +1221,12 @@ msgstr "Enrollment widget could not be loaded. Please try again later" msgid "Follow-up" msgstr "Follow-up" +msgid "Started at{{escape}}" +msgstr "Started at{{escape}}" + +msgid "Owned by{{escape}}" +msgstr "Owned by{{escape}}" + msgid "Cancelled" msgstr "Cancelled" @@ -1414,13 +1417,6 @@ msgstr "{{ linkableStageLabel }} has no linkable events" msgid "Ambiguous relationships, contact system administrator" msgstr "Ambiguous relationships, contact system administrator" -msgid "" -"Enter {{linkableStageLabel}} details in the next step after completing this " -"{{currentStageLabel}}." -msgstr "" -"Enter {{linkableStageLabel}} details in the next step after completing this " -"{{currentStageLabel}}." - msgid "Enter details now" msgstr "Enter details now" @@ -1505,6 +1501,9 @@ msgstr "Changelog" msgid "No changes to display" msgstr "No changes to display" +msgid "Updated" +msgstr "Updated" + msgid "Created" msgstr "Created" @@ -1523,6 +1522,9 @@ msgstr "Data item" msgid "Change" msgstr "Change" +msgid "Value" +msgstr "Value" + msgid "New {{trackedEntityTypeName}} relationship" msgstr "New {{trackedEntityTypeName}} relationship" diff --git a/i18n/es.po b/i18n/es.po index f102174f36..bfd046a3bf 100644 --- a/i18n/es.po +++ b/i18n/es.po @@ -18,7 +18,7 @@ msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" -"POT-Creation-Date: 2024-09-02T11:08:16.281Z\n" +"POT-Creation-Date: 2024-10-14T14:53:34.553Z\n" "PO-Revision-Date: 2019-06-27 07:31+0000\n" "Last-Translator: Juan M Alcantara Acosta , 2024\n" "Language-Team: Spanish (https://app.transifex.com/hisp-uio/teams/100509/es/)\n" @@ -646,54 +646,6 @@ msgstr "Aviso" msgid "Close the notice" msgstr "cerrar el aviso" -msgid "Use new Enrollment dashboard for {{programName}}" -msgstr "Usar el nuevo panel de inscripción para {{programName}}" - -msgid "Opt in for {{programName}}" -msgstr "Utilizar el nuevo capture para {{programName}}" - -msgid "" -"By clicking opt-in below, you will start using the new enrollment dashboard " -"in the Capture app for this Tracker program. At the moment, there is certain" -" functionality from Tracker Capture that has not yet been added, including " -"relationship and referral functionality. The work on including this Tracker " -"functionality in Capture is ongoing and will be added in upcoming app " -"releases." -msgstr "" -"Al hacer clic en registrarse a continuación, comenzará a utilizar el nuevo " -"panel de inscripción en la aplicación Capture para este programa. Por el " -"momento, hay ciertas funciones de la Tracker Capture que aún no se han " -"agregado, incluida la función de relación y referencia. El trabajo para " -"incluir esta funcionalidad Tracker en Capture está en curso y se agregará en" -" próximos lanzamientos de la aplicación." - -msgid "" -"The core team appreciates any feedback on this new functionality which is " -"currently being beta tested, please report any issues and feedback in the " -"DHIS2 JIRA project." -msgstr "" -"El equipo de desarrollo agradece cualquier comentario sobre esta nueva " -"funcionalidad que actualmente se está probando en versión beta. Informe " -"cualquier problema y comentario en el proyecto de JIRA de DHIS2" - -msgid "" -"Click the button below to opt-in to the new enrollment dashboard " -"functionality in the Capture app (beta) for this Tracker program for all " -"users." -msgstr "" -"Haga clic en el botón de abajo para optar por la nueva funcionalidad del " -"panel de inscripción en la aplicación Capture (beta) para este programa " -"Tracker para todos los usuarios." - -msgid "Yes, opt in" -msgstr "Sí, aceptar" - -msgid "Stop using new Enrollment dashboard for {{programName}}" -msgstr "Deje de usar el nuevo panel de inscripción para {{programName}}" - -msgid "Opt out for {{programName}}" -msgstr "Salir de la prueba del nuevo Capture {{programName}}" - msgid "Enrollment with id \"{{enrollmentId}}\" does not exist" msgstr "La inscripción con el ID \"{{enrollmentId}}\" no existe" diff --git a/i18n/fr.po b/i18n/fr.po index f74f7e4d77..277a314448 100644 --- a/i18n/fr.po +++ b/i18n/fr.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" -"POT-Creation-Date: 2024-09-02T11:08:16.281Z\n" +"POT-Creation-Date: 2024-10-14T14:53:34.553Z\n" "PO-Revision-Date: 2019-06-27 07:31+0000\n" "Last-Translator: Bram Piot , 2024\n" "Language-Team: French (https://app.transifex.com/hisp-uio/teams/100509/fr/)\n" @@ -644,45 +644,6 @@ msgstr "" msgid "Close the notice" msgstr "" -msgid "Use new Enrollment dashboard for {{programName}}" -msgstr "" -"Utiliser un nouveau tableau de bord d'inscription pour {{programName}}" - -msgid "Opt in for {{programName}}" -msgstr "Choisir {{programName}}" - -msgid "" -"By clicking opt-in below, you will start using the new enrollment dashboard " -"in the Capture app for this Tracker program. At the moment, there is certain" -" functionality from Tracker Capture that has not yet been added, including " -"relationship and referral functionality. The work on including this Tracker " -"functionality in Capture is ongoing and will be added in upcoming app " -"releases." -msgstr "" - -msgid "" -"The core team appreciates any feedback on this new functionality which is " -"currently being beta tested, please report any issues and feedback in the " -"DHIS2 JIRA project." -msgstr "" - -msgid "" -"Click the button below to opt-in to the new enrollment dashboard " -"functionality in the Capture app (beta) for this Tracker program for all " -"users." -msgstr "" - -msgid "Yes, opt in" -msgstr "Oui, choisir" - -msgid "Stop using new Enrollment dashboard for {{programName}}" -msgstr "" -"Ne plus utiliser le tableau de bord des nouvelles inscriptions pour " -"{{programName}}" - -msgid "Opt out for {{programName}}" -msgstr "Ne pas chosir {{programName}}" - msgid "Enrollment with id \"{{enrollmentId}}\" does not exist" msgstr "L'inscription avec id \"{{enrollmentId}}\" n'existe pas" diff --git a/i18n/id.po b/i18n/id.po index 7c64de57cb..c4fca90018 100644 --- a/i18n/id.po +++ b/i18n/id.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" -"POT-Creation-Date: 2024-09-02T11:08:16.281Z\n" +"POT-Creation-Date: 2024-10-14T14:53:34.553Z\n" "PO-Revision-Date: 2019-06-27 07:31+0000\n" "Last-Translator: Aprisa Chrysantina , 2024\n" "Language-Team: Indonesian (https://app.transifex.com/hisp-uio/teams/100509/id/)\n" @@ -630,42 +630,6 @@ msgstr "" msgid "Close the notice" msgstr "" -msgid "Use new Enrollment dashboard for {{programName}}" -msgstr "Gunakan dasbor pendaftaran baru pada {{programName}}" - -msgid "Opt in for {{programName}}" -msgstr "" - -msgid "" -"By clicking opt-in below, you will start using the new enrollment dashboard " -"in the Capture app for this Tracker program. At the moment, there is certain" -" functionality from Tracker Capture that has not yet been added, including " -"relationship and referral functionality. The work on including this Tracker " -"functionality in Capture is ongoing and will be added in upcoming app " -"releases." -msgstr "" - -msgid "" -"The core team appreciates any feedback on this new functionality which is " -"currently being beta tested, please report any issues and feedback in the " -"DHIS2 JIRA project." -msgstr "" - -msgid "" -"Click the button below to opt-in to the new enrollment dashboard " -"functionality in the Capture app (beta) for this Tracker program for all " -"users." -msgstr "" - -msgid "Yes, opt in" -msgstr "" - -msgid "Stop using new Enrollment dashboard for {{programName}}" -msgstr "Berhenti menggunakan dasbor pendafataran baru pada {{programName}}" - -msgid "Opt out for {{programName}}" -msgstr "" - msgid "Enrollment with id \"{{enrollmentId}}\" does not exist" msgstr "Pendaftaran dengan id \"{{enrollmentId}}\" tidak tersedia" diff --git a/i18n/lo.po b/i18n/lo.po index 24d7ea4464..2f880d5d1f 100644 --- a/i18n/lo.po +++ b/i18n/lo.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" -"POT-Creation-Date: 2024-09-02T11:08:16.281Z\n" +"POT-Creation-Date: 2024-10-14T14:53:34.553Z\n" "PO-Revision-Date: 2019-06-27 07:31+0000\n" "Last-Translator: Namwan Chanthavisouk, 2024\n" "Language-Team: Lao (https://app.transifex.com/hisp-uio/teams/100509/lo/)\n" @@ -623,51 +623,6 @@ msgstr "ການແຈ້ງເຕືອນ" msgid "Close the notice" msgstr "ປິດການແຈ້ງເຕືອນ" -msgid "Use new Enrollment dashboard for {{programName}}" -msgstr "ໃຊ້ກະດານຂ່າວລົງທະບຽນໃໝ່ເພື່ອ {{programName}}" - -msgid "Opt in for {{programName}}" -msgstr "ຕົວເລືອກໃນ {{programName}}" - -msgid "" -"By clicking opt-in below, you will start using the new enrollment dashboard " -"in the Capture app for this Tracker program. At the moment, there is certain" -" functionality from Tracker Capture that has not yet been added, including " -"relationship and referral functionality. The work on including this Tracker " -"functionality in Capture is ongoing and will be added in upcoming app " -"releases." -msgstr "" -"ໂດຍການຄລິກເລືອກເຂົ້າທາງລຸ່ມນີ້, ທ່ານຈະເລີ່ມໃຊ້ກະດານຂ່າວລົງທະບຽນໃໝ່ໃນແອັບ " -"Capture ສຳລັບໂປແກຣມຕິດຕາມນີ້. ເຊິ່ງໃນປັດຈຸບັນໜ້າທີ່ຫຼັກຈາກການຕິດຕາມ Capture " -"ແມ່ນຍັງບໍ່ໄດ້ເພີ່ມເຂົ້າເທື່ອ, ລວມທັງເຊື່ອມໂຍງ ແລະ ການສົ່ງຕໍ່. " -"ການເຮັດວຽກກ່ຽວກັບໜ້າທີ່ຫຼັກຈາກການຕິດຕາມນີ້ໃນ Capture ແມ່ນກໍາລັງດໍາເນີນຢູ່ " -"ແລະ ຈະຖືກເພີ່ມເຂົ້າໃນແອັບໃໝ່." - -msgid "" -"The core team appreciates any feedback on this new functionality which is " -"currently being beta tested, please report any issues and feedback in the " -"DHIS2 JIRA project." -msgstr "" -"ທີມງານເຮົາຂໍຂອບໃຈສຳລັບຄໍາຕິຊົມກ່ຽວກັບຫນ້າທີ່ໃຫມ່ນີ້ທີ່ກໍາລັງຖືກທົດສອບຢູ່ໃນເບຕ້າ," -" ກະລຸນາລາຍງານບັນຫາ ແລະ ຄໍາຕິຊົມໃນໂຄງການ DHIS2 JIRA." - -msgid "" -"Click the button below to opt-in to the new enrollment dashboard " -"functionality in the Capture app (beta) for this Tracker program for all " -"users." -msgstr "" -"ຄລິກທີ່ປຸ່ມຂ້າງລຸ່ມເພື່ອເລືອກເຂົ້າໃຊ້ໜ້າທີ່ການລົງທະບຽນໃໝ່ຂອງກະດານຂ່າວໃນແອັບ " -"Capture (ເບຕ້າ) ສຳລັບໂປແກຣມການຕິດຕາມນີ້ສຳລັບຜູ້ໃຊ້ທັງໝົດ." - -msgid "Yes, opt in" -msgstr "ຕົກລົງ, ເລືອກເຂົ້າ" - -msgid "Stop using new Enrollment dashboard for {{programName}}" -msgstr "ຢຸດໃຊ້ກະດານຂ່າວການລົງທະບຽນໃໝ່ໃນ {{programName}}" - -msgid "Opt out for {{programName}}" -msgstr "ເລືອກອອກສຳລັບ {{programName}}" - msgid "Enrollment with id \"{{enrollmentId}}\" does not exist" msgstr "ລົງທະບຽນດ້ວຍໄອດີ \" {{enrollmentId}} \" ແມ່ນບໍ່ພົບ" diff --git a/i18n/nb.po b/i18n/nb.po index 7f32ad1482..6ec77b1236 100644 --- a/i18n/nb.po +++ b/i18n/nb.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" -"POT-Creation-Date: 2024-09-02T11:08:16.281Z\n" +"POT-Creation-Date: 2024-10-14T14:53:34.553Z\n" "PO-Revision-Date: 2019-06-27 07:31+0000\n" "Last-Translator: Merethe Wollan Blisten, 2024\n" "Language-Team: Norwegian Bokmål (https://app.transifex.com/hisp-uio/teams/100509/nb/)\n" @@ -626,54 +626,6 @@ msgstr "Merknad" msgid "Close the notice" msgstr "Lukk merknaden" -msgid "Use new Enrollment dashboard for {{programName}}" -msgstr "Bruk nytt registreringsdashbord for {{programName}}" - -msgid "Opt in for {{programName}}" -msgstr "Meld på for {{programName}}" - -msgid "" -"By clicking opt-in below, you will start using the new enrollment dashboard " -"in the Capture app for this Tracker program. At the moment, there is certain" -" functionality from Tracker Capture that has not yet been added, including " -"relationship and referral functionality. The work on including this Tracker " -"functionality in Capture is ongoing and will be added in upcoming app " -"releases." -msgstr "" -"Ved å klikke på \"meld på\" nedenfor, vil du begynne å bruke det nye " -"registreringsdashbordet i Capture-appen for dette Tracker-programmet. For " -"øyeblikket er det noe funksjonalitet fra Tracker Capture som ennå ikke er " -"lagt til, inkludert relasjons- og henvisningsfunksjonalitet. Arbeidet med å " -"inkludere denne Tracker-funksjonaliteten i Capture pågår og vil bli lagt til" -" i kommende apputgivelser." - -msgid "" -"The core team appreciates any feedback on this new functionality which is " -"currently being beta tested, please report any issues and feedback in the " -"DHIS2 JIRA project." -msgstr "" -"Kjerneteamet setter pris på all tilbakemelding på denne nye funksjonaliteten" -" som for øyeblikket blir betatestet, vennligst rapporter eventuelle " -"problemer og tilbakemeldinger i DHIS2 JIRA-prosjektet." - -msgid "" -"Click the button below to opt-in to the new enrollment dashboard " -"functionality in the Capture app (beta) for this Tracker program for all " -"users." -msgstr "" -"Klikk på knappen nedenfor for å melde deg på den nye funksjonen for " -"registreringsdashbord i Capture-appen (beta) for dette Tracker-programmet " -"for alle brukere." - -msgid "Yes, opt in" -msgstr "Ja, meld på" - -msgid "Stop using new Enrollment dashboard for {{programName}}" -msgstr "Slutt å bruke nytt registreringsdashbord for {{programName}}" - -msgid "Opt out for {{programName}}" -msgstr "Meld ut for {{programName}}" - msgid "Enrollment with id \"{{enrollmentId}}\" does not exist" msgstr "Registrering med ID-en \"{{enrollmentId}}\" eksisterer ikke" diff --git a/i18n/nl.po b/i18n/nl.po index 98e3e09bf6..62c2f2c8f9 100644 --- a/i18n/nl.po +++ b/i18n/nl.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" -"POT-Creation-Date: 2024-09-02T11:08:16.281Z\n" +"POT-Creation-Date: 2024-10-14T14:53:34.553Z\n" "PO-Revision-Date: 2019-06-27 07:31+0000\n" "Last-Translator: Charel van den Elsen, 2024\n" "Language-Team: Dutch (https://app.transifex.com/hisp-uio/teams/100509/nl/)\n" @@ -632,57 +632,6 @@ msgstr "" msgid "Close the notice" msgstr "" -msgid "Use new Enrollment dashboard for {{programName}}" -msgstr "Gebruik nieuw inschrijvingsdashboard voor {{programName}}" - -msgid "Opt in for {{programName}}" -msgstr "Aanmelden voor {{programName}}" - -msgid "" -"By clicking opt-in below, you will start using the new enrollment dashboard " -"in the Capture app for this Tracker program. At the moment, there is certain" -" functionality from Tracker Capture that has not yet been added, including " -"relationship and referral functionality. The work on including this Tracker " -"functionality in Capture is ongoing and will be added in upcoming app " -"releases." -msgstr "" -"Door hieronder op opt-in te klikken, gaat u het nieuwe " -"inschrijvingsdashboard in de Capture-app voor dit Tracker-programma " -"gebruiken. Op dit moment is er bepaalde functionaliteit van Tracker Capture " -"die nog niet is toegevoegd, waaronder relatie- en " -"verwijzingsfunctionaliteit. Het werk om deze Tracker-functionaliteit in " -"Capture op te nemen is aan de gang en zal worden toegevoegd in aankomende " -"app-releases." - -msgid "" -"The core team appreciates any feedback on this new functionality which is " -"currently being beta tested, please report any issues and feedback in the " -"DHIS2 JIRA project." -msgstr "" -"Het kernteam stelt alle feedback op prijs over deze nieuwe functionaliteit " -"die momenteel in bèta wordt getest. Meld eventuele problemen en feedback in " -"het DHIS2 JIRA-project." - -msgid "" -"Click the button below to opt-in to the new enrollment dashboard " -"functionality in the Capture app (beta) for this Tracker program for all " -"users." -msgstr "" -"Klik op de onderstaande knop om u aan te melden voor de nieuwe " -"functionaliteit van het inschrijvingsdashboard in de Capture-app (bèta) voor" -" dit Tracker-programma voor alle gebruikers." - -msgid "Yes, opt in" -msgstr "Ja, opt-in" - -msgid "Stop using new Enrollment dashboard for {{programName}}" -msgstr "" -"Stop met het gebruik van het nieuwe inschrijvingsdashboard voor " -"{{programName}}" - -msgid "Opt out for {{programName}}" -msgstr "Afmelden voor {{programName}}" - msgid "Enrollment with id \"{{enrollmentId}}\" does not exist" msgstr "" diff --git a/i18n/pt.po b/i18n/pt.po index 45ada7e10f..0f02ab2cdc 100644 --- a/i18n/pt.po +++ b/i18n/pt.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" -"POT-Creation-Date: 2024-09-02T11:08:16.281Z\n" +"POT-Creation-Date: 2024-10-14T14:53:34.553Z\n" "PO-Revision-Date: 2019-06-27 07:31+0000\n" "Last-Translator: Juan M Alcantara Acosta , 2024\n" "Language-Team: Portuguese (https://app.transifex.com/hisp-uio/teams/100509/pt/)\n" @@ -635,54 +635,6 @@ msgstr "Aviso" msgid "Close the notice" msgstr "Fechar o aviso" -msgid "Use new Enrollment dashboard for {{programName}}" -msgstr "Use o novo painel de inscrição para {{programName}}" - -msgid "Opt in for {{programName}}" -msgstr "Opte por {{programName}}" - -msgid "" -"By clicking opt-in below, you will start using the new enrollment dashboard " -"in the Capture app for this Tracker program. At the moment, there is certain" -" functionality from Tracker Capture that has not yet been added, including " -"relationship and referral functionality. The work on including this Tracker " -"functionality in Capture is ongoing and will be added in upcoming app " -"releases." -msgstr "" -"Ao clicar em aceitar abaixo, começará a usar o novo painel de registro no " -"aplicativo Capture para este programa Rastreador. No momento, há certas " -"funcionalidades do Tracker Capture que ainda não foram adicionadas, " -"incluindo funcionalidade de relacionamento e referência. O trabalho para " -"incluir essa funcionalidade do Rastreador no Capture está em andamento e " -"será adicionado nas próximas versões do aplicativo." - -msgid "" -"The core team appreciates any feedback on this new functionality which is " -"currently being beta tested, please report any issues and feedback in the " -"DHIS2 JIRA project." -msgstr "" -"A equipe principal agradece qualquer feedback sobre esta nova funcionalidade" -" que está sendo testada na versão beta. Relate quaisquer problemas e " -"comentários no projeto DHIS2 JIRA." - -msgid "" -"Click the button below to opt-in to the new enrollment dashboard " -"functionality in the Capture app (beta) for this Tracker program for all " -"users." -msgstr "" -"Clique no botão abaixo para aceitar a nova funcionalidade do painel de " -"registro no aplicativo Capture (beta) para este programa Rastreador para " -"todos os utilizadores." - -msgid "Yes, opt in" -msgstr "Sim, aceite" - -msgid "Stop using new Enrollment dashboard for {{programName}}" -msgstr "Pare de usar o novo painel de inscrição para {{programName}}" - -msgid "Opt out for {{programName}}" -msgstr "Desativar {{programName}}" - msgid "Enrollment with id \"{{enrollmentId}}\" does not exist" msgstr "" diff --git a/i18n/ro.po b/i18n/ro.po index 1308197957..ee6543821a 100644 --- a/i18n/ro.po +++ b/i18n/ro.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" -"POT-Creation-Date: 2024-09-02T11:08:16.281Z\n" +"POT-Creation-Date: 2024-10-14T14:53:34.553Z\n" "PO-Revision-Date: 2019-06-27 07:31+0000\n" "Last-Translator: Valeriu Plesca , 2024\n" "Language-Team: Romanian (https://app.transifex.com/hisp-uio/teams/100509/ro/)\n" @@ -621,42 +621,6 @@ msgstr "" msgid "Close the notice" msgstr "" -msgid "Use new Enrollment dashboard for {{programName}}" -msgstr "" - -msgid "Opt in for {{programName}}" -msgstr "" - -msgid "" -"By clicking opt-in below, you will start using the new enrollment dashboard " -"in the Capture app for this Tracker program. At the moment, there is certain" -" functionality from Tracker Capture that has not yet been added, including " -"relationship and referral functionality. The work on including this Tracker " -"functionality in Capture is ongoing and will be added in upcoming app " -"releases." -msgstr "" - -msgid "" -"The core team appreciates any feedback on this new functionality which is " -"currently being beta tested, please report any issues and feedback in the " -"DHIS2 JIRA project." -msgstr "" - -msgid "" -"Click the button below to opt-in to the new enrollment dashboard " -"functionality in the Capture app (beta) for this Tracker program for all " -"users." -msgstr "" - -msgid "Yes, opt in" -msgstr "" - -msgid "Stop using new Enrollment dashboard for {{programName}}" -msgstr "" - -msgid "Opt out for {{programName}}" -msgstr "Renunțare la {{programName}}" - msgid "Enrollment with id \"{{enrollmentId}}\" does not exist" msgstr "" diff --git a/i18n/ru.po b/i18n/ru.po index 3182a61401..68ea9d95c7 100644 --- a/i18n/ru.po +++ b/i18n/ru.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" -"POT-Creation-Date: 2024-09-02T11:08:16.281Z\n" +"POT-Creation-Date: 2024-10-14T14:53:34.553Z\n" "PO-Revision-Date: 2019-06-27 07:31+0000\n" "Last-Translator: Philip Larsen Donnelly, 2024\n" "Language-Team: Russian (https://app.transifex.com/hisp-uio/teams/100509/ru/)\n" @@ -633,55 +633,6 @@ msgstr "Заметка" msgid "Close the notice" msgstr "Закрыть заметку" -msgid "Use new Enrollment dashboard for {{programName}}" -msgstr "" -"Использовать новую регистрационную панель для программы{{programName}}" - -msgid "Opt in for {{programName}}" -msgstr "Применить для программы {{programName}}" - -msgid "" -"By clicking opt-in below, you will start using the new enrollment dashboard " -"in the Capture app for this Tracker program. At the moment, there is certain" -" functionality from Tracker Capture that has not yet been added, including " -"relationship and referral functionality. The work on including this Tracker " -"functionality in Capture is ongoing and will be added in upcoming app " -"releases." -msgstr "" -"Нажав \"применить\" ниже, вы получите доступ к новой панель регистрации в " -"приложении Capture для данной программы. На данный момент некоторые функции " -"из приложения Tracker Capture еще не добавлены, в том числе функции " -"\"Связи\" и \"Направления\". Эти функции будут включены в приложение Capture" -" в ближайших релизах." - -msgid "" -"The core team appreciates any feedback on this new functionality which is " -"currently being beta tested, please report any issues and feedback in the " -"DHIS2 JIRA project." -msgstr "" -"Команда DHIS2 будет признательна за любые отзывы касательно данного " -"функционала, проходящего в данный момент бета-тестирование. Пожалуйста, " -"сообщайте о любых проблемах и делитесь отзывами в проекте DHIS2 JIRA." - -msgid "" -"Click the button below to opt-in to the new enrollment dashboard " -"functionality in the Capture app (beta) for this Tracker program for all " -"users." -msgstr "" -"Нажмите на кнопку ниже, чтобы дать доступ всем пользователям данной " -"программы к новой панели регистрации в приложении Capture (бета-версия)." - -msgid "Yes, opt in" -msgstr "Да, получить доступ" - -msgid "Stop using new Enrollment dashboard for {{programName}}" -msgstr "" -"Перестать использовать новую панель регистрации для программы " -"{{programName}}" - -msgid "Opt out for {{programName}}" -msgstr "Отменить доступ для программы {{programName}}" - msgid "Enrollment with id \"{{enrollmentId}}\" does not exist" msgstr "" "Регистрационная запись с идентификатором \"{{enrollmentId}}\" не существует" diff --git a/i18n/zh_CN.po b/i18n/zh_CN.po index 68ce40fc28..3f3a8e6b43 100644 --- a/i18n/zh_CN.po +++ b/i18n/zh_CN.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" -"POT-Creation-Date: 2024-09-02T11:08:16.281Z\n" +"POT-Creation-Date: 2024-10-14T14:53:34.553Z\n" "PO-Revision-Date: 2019-06-27 07:31+0000\n" "Last-Translator: 晓东 林 <13981924470@126.com>, 2024\n" "Language-Team: Chinese (China) (https://app.transifex.com/hisp-uio/teams/100509/zh_CN/)\n" @@ -609,44 +609,6 @@ msgstr "注意" msgid "Close the notice" msgstr "关闭通知" -msgid "Use new Enrollment dashboard for {{programName}}" -msgstr "为 {{programName}} 使用新的注册仪表板" - -msgid "Opt in for {{programName}}" -msgstr "选择加入 {{programName}}" - -msgid "" -"By clicking opt-in below, you will start using the new enrollment dashboard " -"in the Capture app for this Tracker program. At the moment, there is certain" -" functionality from Tracker Capture that has not yet been added, including " -"relationship and referral functionality. The work on including this Tracker " -"functionality in Capture is ongoing and will be added in upcoming app " -"releases." -msgstr "" -"通过单击下面的选择加入,您将开始使用 Capture 应用程序中的新注册仪表板来执行此跟踪程序。目前,Tracker Capture " -"的某些功能尚未添加,包括关系和推荐功能。在 Capture 中包含此 Tracker 功能的工作正在进行中,并将添加到即将发布的应用程序中。" - -msgid "" -"The core team appreciates any feedback on this new functionality which is " -"currently being beta tested, please report any issues and feedback in the " -"DHIS2 JIRA project." -msgstr "核心团队感谢对目前正在 Beta 测试的这个新功能的任何反馈,请报告 DHIS2 JIRA 项目中的任何问题和反馈。" - -msgid "" -"Click the button below to opt-in to the new enrollment dashboard " -"functionality in the Capture app (beta) for this Tracker program for all " -"users." -msgstr "单击下面的按钮,为所有用户选择加入此 Tracker 程序的 Capture 应用程序(测试版)中的新注册仪表板功能。" - -msgid "Yes, opt in" -msgstr "是的,选择加入" - -msgid "Stop using new Enrollment dashboard for {{programName}}" -msgstr "停止为 {{programName}} 使用新的注册仪表板" - -msgid "Opt out for {{programName}}" -msgstr "选择退出 {{programName}}" - msgid "Enrollment with id \"{{enrollmentId}}\" does not exist" msgstr "ID为“ {{enrollmentId}}”的报名不存在" diff --git a/package.json b/package.json index 240f84d11a..2fce1e4512 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "capture-app", "homepage": ".", - "version": "101.11.2", + "version": "101.14.1", "cacheVersion": "7", "serverVersion": "38", "license": "BSD-3-Clause", @@ -10,7 +10,7 @@ "packages/rules-engine" ], "dependencies": { - "@dhis2/rules-engine-javascript": "101.11.2", + "@dhis2/rules-engine-javascript": "101.14.1", "@dhis2/app-runtime": "^3.9.3", "@dhis2/d2-i18n": "^1.1.0", "@dhis2/d2-icons": "^1.0.1", diff --git a/packages/rules-engine/package.json b/packages/rules-engine/package.json index 61172d6e21..757d7f3547 100644 --- a/packages/rules-engine/package.json +++ b/packages/rules-engine/package.json @@ -1,6 +1,6 @@ { "name": "@dhis2/rules-engine-javascript", - "version": "101.11.2", + "version": "101.14.1", "license": "BSD-3-Clause", "main": "./build/cjs/index.js", "scripts": { diff --git a/src/core_modules/capture-core/HOC/withErrorMessageHandler.js b/src/core_modules/capture-core/HOC/withErrorMessageHandler.js index 7fc48e201d..8e6f4dcbda 100644 --- a/src/core_modules/capture-core/HOC/withErrorMessageHandler.js +++ b/src/core_modules/capture-core/HOC/withErrorMessageHandler.js @@ -1,11 +1,11 @@ // @flow import * as React from 'react'; import { withStyles } from '@material-ui/core/styles'; +import { NoticeBox } from '@dhis2/ui'; -const getStyles = (theme: Theme) => ({ +const getStyles = () => ({ errorContainer: { margin: 20, - color: theme.palette.error.main, }, }); @@ -23,12 +23,13 @@ export const withErrorMessageHandler = () => if (error) { return ( -
- {error} -
+
{error}
+ ); } diff --git a/src/core_modules/capture-core/components/FormFields/New/Fields/OrgUnitField/SingleOrgUnitSelectField.component.js b/src/core_modules/capture-core/components/FormFields/New/Fields/OrgUnitField/SingleOrgUnitSelectField.component.js index 6c252f087b..48c8bb1a99 100644 --- a/src/core_modules/capture-core/components/FormFields/New/Fields/OrgUnitField/SingleOrgUnitSelectField.component.js +++ b/src/core_modules/capture-core/components/FormFields/New/Fields/OrgUnitField/SingleOrgUnitSelectField.component.js @@ -1,14 +1,21 @@ // @flow import * as React from 'react'; import { withStyles } from '@material-ui/core'; -import { Chip } from '@dhis2/ui'; +import { Chip, colors } from '@dhis2/ui'; import { OrgUnitField } from './OrgUnitField.component'; +import { TooltipOrgUnit } from '../../../../Tooltips/TooltipOrgUnit/TooltipOrgUnit.component'; const getStyles = () => ({ selectedOrgUnitContainer: { display: 'flex', alignItems: 'center', }, + chip: { + cursor: 'text !important', + '&:hover': { + backgroundColor: `${colors.grey200} !important`, + }, + }, }); type OrgUnitValue = { @@ -27,9 +34,7 @@ type Props = { disabled?: ?boolean, classes: { selectedOrgUnitContainer: string, - clearSelectedOrgUnitButton: string, - clearSelectedOrgUnitButtonDisabled: string, - selectedOrgUnitText: string, + chip: string, } } @@ -44,7 +49,12 @@ class SingleOrgUnitSelectFieldPlain extends React.Component { const { classes } = this.props; return (
- {selectedOrgUnit.name} + + +
); } diff --git a/src/core_modules/capture-core/components/Pages/Enrollment/EnrollmentPage.component.js b/src/core_modules/capture-core/components/Pages/Enrollment/EnrollmentPage.component.js index 9de818c2b2..baf588711b 100644 --- a/src/core_modules/capture-core/components/Pages/Enrollment/EnrollmentPage.component.js +++ b/src/core_modules/capture-core/components/Pages/Enrollment/EnrollmentPage.component.js @@ -9,7 +9,7 @@ import { LoadingMaskForPage } from '../../LoadingMasks/LoadingMaskForPage.compon import { withErrorMessageHandler } from '../../../HOC'; import { MissingMessage } from './MissingMessage.component'; import { EnrollmentPageDefault } from './EnrollmentPageDefault'; -import { TopBar } from './TopBar.container'; + const getStyles = ({ typography }) => ({ loadingMask: { @@ -22,36 +22,19 @@ const getStyles = ({ typography }) => ({ const EnrollmentPagePlain = ({ classes, - programId, - orgUnitId, - enrollmentId, - trackedEntityName, - teiDisplayName, enrollmentPageStatus, - enrollmentsAsOptions, }) => ( - <> - - -
- {enrollmentPageStatus === enrollmentPageStatuses.MISSING_SELECTIONS && } +
+ {enrollmentPageStatus === enrollmentPageStatuses.MISSING_SELECTIONS && } - {enrollmentPageStatus === enrollmentPageStatuses.DEFAULT && } + {enrollmentPageStatus === enrollmentPageStatuses.DEFAULT && } - {enrollmentPageStatus === enrollmentPageStatuses.LOADING && ( -
- -
- )} -
- + {enrollmentPageStatus === enrollmentPageStatuses.LOADING && ( +
+ +
+ )} +
); export const EnrollmentPageComponent: ComponentType<$Diff> = compose( diff --git a/src/core_modules/capture-core/components/Pages/Enrollment/EnrollmentPage.container.js b/src/core_modules/capture-core/components/Pages/Enrollment/EnrollmentPage.container.js index bacc367ac1..9de18b5331 100644 --- a/src/core_modules/capture-core/components/Pages/Enrollment/EnrollmentPage.container.js +++ b/src/core_modules/capture-core/components/Pages/Enrollment/EnrollmentPage.container.js @@ -24,6 +24,7 @@ import { useSetEnrollmentId, } from '../../ScopeSelector'; import { useLocationQuery } from '../../../utils/routing'; +import { TopBar } from './TopBar.container'; const useComponentLifecycle = () => { const dispatch = useDispatch(); @@ -114,15 +115,26 @@ export const EnrollmentPage: ComponentType<{||}> = () => { useSelector(({ activePage }) => activePage.selectionsError && activePage.selectionsError.error); return ( - + <> + + + + ); }; diff --git a/src/core_modules/capture-core/components/Pages/Enrollment/TopBar.container.js b/src/core_modules/capture-core/components/Pages/Enrollment/TopBar.container.js index 47477a965d..c258a96dc3 100644 --- a/src/core_modules/capture-core/components/Pages/Enrollment/TopBar.container.js +++ b/src/core_modules/capture-core/components/Pages/Enrollment/TopBar.container.js @@ -52,19 +52,21 @@ export const TopBar = ({ onResetOrgUnitId={() => resetOrgUnitId()} onStartAgain={() => reset()} > - resetTeiId('/')} - options={[ - { - label: teiDisplayName, - value: 'alwaysPreselected', - }, - ]} - selectedValue="alwaysPreselected" - title={trackedEntityName} - displayOnly - /> + {trackedEntityName ? ( + resetTeiId('/')} + options={[ + { + label: teiDisplayName, + value: 'alwaysPreselected', + }, + ]} + selectedValue="alwaysPreselected" + title={trackedEntityName} + displayOnly + /> + ) : <>} {enrollmentsAsOptions?.length > 0 ? ( { + const history = useHistory(); const { teiId, programId, orgUnitId, enrollmentId } = useLocationQuery(); const { valid: validIds, loading, error: validatedIdsError } = useValidatedIDsFromCache({ programId, orgUnitId }); const { @@ -63,6 +65,12 @@ const EnrollmentAddEventPagePlain = ({ classes }: Props) => { return EnrollmentAddEventPageStatuses.DEFAULT; }, [enrollmentId, isLoading, loading, pageIsInvalid, programId, teiId, validIds]); + useEffect(() => { + if (pageStatus === EnrollmentAddEventPageStatuses.PROGRAM_INVALID) { + history.push(`/enrollment?${buildUrlQueryString({ orgUnitId, teiId, enrollmentId })}`); + } + }, [pageStatus, orgUnitId, teiId, enrollmentId, history]); + if (pageStatus === EnrollmentAddEventPageStatuses.LOADING) { return ; } @@ -89,10 +97,6 @@ const EnrollmentAddEventPagePlain = ({ classes }: Props) => { i18n.t('Page is missing required values from URL') )} - {pageStatus === EnrollmentAddEventPageStatuses.PROGRAM_INVALID && ( - i18n.t('Program is not valid') - )} - {pageStatus === EnrollmentAddEventPageStatuses.ORG_UNIT_INVALID && ( i18n.t('Org unit is not valid with current program') )} diff --git a/src/core_modules/capture-core/components/Pages/EnrollmentAddEvent/EnrollmentAddEventPageDefault/EnrollmentAddEventPageDefault.container.js b/src/core_modules/capture-core/components/Pages/EnrollmentAddEvent/EnrollmentAddEventPageDefault/EnrollmentAddEventPageDefault.container.js index fb3656915b..88b39abb5d 100644 --- a/src/core_modules/capture-core/components/Pages/EnrollmentAddEvent/EnrollmentAddEventPageDefault/EnrollmentAddEventPageDefault.container.js +++ b/src/core_modules/capture-core/components/Pages/EnrollmentAddEvent/EnrollmentAddEventPageDefault/EnrollmentAddEventPageDefault.container.js @@ -109,9 +109,9 @@ export const EnrollmentAddEventPageDefault = ({ const dataEntryHasChanges = useSelector(state => getDataEntryHasChanges(state, widgetReducerName)); const { program } = useProgramInfo(programId); - const selectedProgramStage = [...program.stages.values()].find(item => item.id === stageId); + const selectedProgramStage = [...program?.stages.values() ?? []].find(item => item.id === stageId); const outputEffects = useWidgetDataFromStore(widgetReducerName); - const hideWidgets = useHideWidgetByRuleLocations(program.programRules.concat(selectedProgramStage?.programRules ?? [])); + const hideWidgets = useHideWidgetByRuleLocations(program?.programRules.concat(selectedProgramStage?.programRules ?? [])); // $FlowFixMe const trackedEntityName = program?.trackedEntityType?.name; diff --git a/src/core_modules/capture-core/components/Pages/EnrollmentAddEvent/EnrollmentAddEventPageDefault/EnrollmentAddEventPageDefault.types.js b/src/core_modules/capture-core/components/Pages/EnrollmentAddEvent/EnrollmentAddEventPageDefault/EnrollmentAddEventPageDefault.types.js index d900462c76..a8929f2b14 100644 --- a/src/core_modules/capture-core/components/Pages/EnrollmentAddEvent/EnrollmentAddEventPageDefault/EnrollmentAddEventPageDefault.types.js +++ b/src/core_modules/capture-core/components/Pages/EnrollmentAddEvent/EnrollmentAddEventPageDefault/EnrollmentAddEventPageDefault.types.js @@ -7,7 +7,7 @@ import type { import { Program } from '../../../../metaData'; export type Props = {| - program: Program, + program: ?Program, stageId: string, orgUnitId: string, teiId: string, diff --git a/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/EnrollmentEditEventPage.component.js b/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/EnrollmentEditEventPage.component.js index 03b56579de..d2acb94e3b 100644 --- a/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/EnrollmentEditEventPage.component.js +++ b/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/EnrollmentEditEventPage.component.js @@ -60,7 +60,7 @@ export const EnrollmentEditEventPageComponent = ({ mode={mode} programStage={programStage} enrollmentId={enrollmentId} - programId={program.id} + programId={program?.id} enrollmentsAsOptions={enrollmentsAsOptions} trackedEntityName={trackedEntityName} teiDisplayName={teiDisplayName} diff --git a/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/EnrollmentEditEventPage.container.js b/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/EnrollmentEditEventPage.container.js index 9ba1bfcdd8..995fca5429 100644 --- a/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/EnrollmentEditEventPage.container.js +++ b/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/EnrollmentEditEventPage.container.js @@ -132,8 +132,8 @@ const EnrollmentEditEventPageWithContextPlain = ({ }, [dispatch]); const { program } = useProgramInfo(programId); - const programStage = [...program.stages?.values()].find(item => item.id === stageId); - const hideWidgets = useHideWidgetByRuleLocations(program.programRules.concat(programStage?.programRules)); + const programStage = [...program?.stages?.values() ?? []].find(item => item.id === stageId); + const hideWidgets = useHideWidgetByRuleLocations(program?.programRules.concat(programStage?.programRules)); const onDeleteTrackedEntitySuccess = useCallback(() => { history.push(`/?${buildUrlQueryString({ orgUnitId, programId })}`); diff --git a/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/EnrollmentEditEventPage.types.js b/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/EnrollmentEditEventPage.types.js index e164d9fc02..7f48be3b24 100644 --- a/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/EnrollmentEditEventPage.types.js +++ b/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/EnrollmentEditEventPage.types.js @@ -17,7 +17,7 @@ export type PlainProps = {| enrollmentId: string, eventId: string, stageId: string, - program: Program, + program: ?Program, trackedEntityTypeId: string, mode: string, orgUnitId: string, diff --git a/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/TopBar.container.js b/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/TopBar.container.js index 1798a80a16..e613228db2 100644 --- a/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/TopBar.container.js +++ b/src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/TopBar.container.js @@ -21,7 +21,7 @@ import { TopBarActions } from '../../TopBarActions'; type Props = {| programStage: ?ProgramStage, enrollmentId: string, - programId: string, + programId: ?string, mode: string, orgUnitId: string, trackedEntityName: string, diff --git a/src/core_modules/capture-core/components/Pages/MainPage/MainPage.component.js b/src/core_modules/capture-core/components/Pages/MainPage/MainPage.component.js index 2d29de6e9b..5c9952f28d 100644 --- a/src/core_modules/capture-core/components/Pages/MainPage/MainPage.component.js +++ b/src/core_modules/capture-core/components/Pages/MainPage/MainPage.component.js @@ -3,13 +3,13 @@ import React, { useMemo } from 'react'; import { compose } from 'redux'; import { colors, spacers } from '@dhis2/ui'; import { withStyles } from '@material-ui/core/styles'; +import type { ComponentType } from 'react'; +import type { Props, ContainerProps } from './mainPage.types'; import { WorkingListsType } from './WorkingListsType'; -import type { Props, PlainProps } from './mainPage.types'; import { MainPageStatuses } from './MainPage.constants'; import { WithoutOrgUnitSelectedMessage } from './WithoutOrgUnitSelectedMessage/WithoutOrgUnitSelectedMessage'; import { WithoutCategorySelectedMessage } from './WithoutCategorySelectedMessage/WithoutCategorySelectedMessage'; import { withErrorMessageHandler, withLoadingIndicator } from '../../../HOC'; -import { TopBar } from './TopBar.container'; import { SearchBox } from '../../SearchBox'; import { TemplateSelector } from '../../TemplateSelector'; import { @@ -41,79 +41,66 @@ const getStyles = () => ({ }, }); -const useShowMainPage = ({ programId, orgUnitId, trackedEntityTypeId, displayFrontPageList, selectedTemplateId }) => - useMemo(() => { - const noProgramSelected = !programId; - const noOrgUnitSelected = !orgUnitId; - const isEventProgram = !trackedEntityTypeId; - - return noProgramSelected || noOrgUnitSelected || isEventProgram || displayFrontPageList || selectedTemplateId; - }, [programId, orgUnitId, trackedEntityTypeId, displayFrontPageList, selectedTemplateId]); - -const MainPageBody = compose( - withErrorMessageHandler(), - withStyles(getStyles), -)(({ MainPageStatus, setShowAccessible, programId, showMainPage, classes, ...passOnProps }: PlainProps) => ( - <> - {showMainPage ? ( - <> - {MainPageStatus === MainPageStatuses.WITHOUT_ORG_UNIT_SELECTED && ( - - )} - {MainPageStatus === MainPageStatuses.CATEGORY_OPTION_INVALID_FOR_ORG_UNIT && ( - - )} - {MainPageStatus === MainPageStatuses.WITHOUT_PROGRAM_CATEGORY_SELECTED && ( - - )} - {MainPageStatus === MainPageStatuses.SHOW_WORKING_LIST && ( -
- -
- )} - - ) : ( -
-
- -
-
- -
-
- )} - -)); - -const MainPage = ({ +const MainPagePlain = ({ programId, orgUnitId, trackedEntityTypeId, displayFrontPageList, selectedTemplateId, - selectedCategories, - ...passOnProps + MainPageStatus, + setShowAccessible, + classes, + onChangeTemplate, }: Props) => { - const showMainPage = useShowMainPage({ - programId, - orgUnitId, - trackedEntityTypeId, - displayFrontPageList, - selectedTemplateId, - }); + const showMainPage = useMemo(() => { + const noProgramSelected = !programId; + const noOrgUnitSelected = !orgUnitId; + const isEventProgram = !trackedEntityTypeId; + return noProgramSelected || noOrgUnitSelected || isEventProgram || displayFrontPageList || selectedTemplateId; + }, [programId, orgUnitId, trackedEntityTypeId, displayFrontPageList, selectedTemplateId]); return ( <> - - + {showMainPage ? ( + <> + {MainPageStatus === MainPageStatuses.WITHOUT_ORG_UNIT_SELECTED && ( + + )} + {MainPageStatus === MainPageStatuses.CATEGORY_OPTION_INVALID_FOR_ORG_UNIT && ( + + )} + {MainPageStatus === MainPageStatuses.WITHOUT_PROGRAM_CATEGORY_SELECTED && ( + + )} + {MainPageStatus === MainPageStatuses.SHOW_WORKING_LIST && ( +
+ +
+ )} + + ) : ( +
+
+ +
+
+ +
+
+ )} ); }; -export const MainPageComponent = withLoadingIndicator()(MainPage); + +export const MainPageComponent: ComponentType = + compose( + withLoadingIndicator(), + withErrorMessageHandler(), + withStyles(getStyles), + )(MainPagePlain); diff --git a/src/core_modules/capture-core/components/Pages/MainPage/MainPage.container.js b/src/core_modules/capture-core/components/Pages/MainPage/MainPage.container.js index 32ac19a65b..3dc90d8bd5 100644 --- a/src/core_modules/capture-core/components/Pages/MainPage/MainPage.container.js +++ b/src/core_modules/capture-core/components/Pages/MainPage/MainPage.container.js @@ -11,6 +11,7 @@ import { buildUrlQueryString, useLocationQuery } from '../../../utils/routing'; import { MainPageStatuses } from './MainPage.constants'; import { OrgUnitFetcher } from '../../OrgUnitFetcher'; import { useCategoryOptionIsValidForOrgUnit } from '../../../hooks/useCategoryComboIsValidForOrgUnit'; +import { TopBar } from './TopBar.container'; const mapStateToProps = (state: ReduxState) => ({ error: state.activePage.selectionsError && state.activePage.selectionsError.error, // TODO: Should probably remove this @@ -169,6 +170,7 @@ const MainPageContainer = () => { return ( + { error={error} ready={ready} displayFrontPageList={displayFrontPageList} - selectedCategories={selectedCategories} /> ); diff --git a/src/core_modules/capture-core/components/Pages/MainPage/WithoutCategorySelectedMessage/WithoutCategorySelectedMessage.js b/src/core_modules/capture-core/components/Pages/MainPage/WithoutCategorySelectedMessage/WithoutCategorySelectedMessage.js index d30ef8e3dd..fd23dceaa9 100644 --- a/src/core_modules/capture-core/components/Pages/MainPage/WithoutCategorySelectedMessage/WithoutCategorySelectedMessage.js +++ b/src/core_modules/capture-core/components/Pages/MainPage/WithoutCategorySelectedMessage/WithoutCategorySelectedMessage.js @@ -32,7 +32,7 @@ const WithoutCategorySelectedMessagePlain = ({ programId, classes }) => { categories: currentSelections.categories, }), shallowEqual); - if (!program.categoryCombination) { + if (!program?.categoryCombination) { log.error(errorCreator(errorMessages.MISSING_CATEGORY)({ programId })); throw Error(i18n.t(errorMessages.GENERIC_ERROR)); } diff --git a/src/core_modules/capture-core/components/Pages/MainPage/WithoutOrgUnitSelectedMessage/WithoutOrgUnitSelectedMessage.js b/src/core_modules/capture-core/components/Pages/MainPage/WithoutOrgUnitSelectedMessage/WithoutOrgUnitSelectedMessage.js index f791f50b93..cb2379c151 100644 --- a/src/core_modules/capture-core/components/Pages/MainPage/WithoutOrgUnitSelectedMessage/WithoutOrgUnitSelectedMessage.js +++ b/src/core_modules/capture-core/components/Pages/MainPage/WithoutOrgUnitSelectedMessage/WithoutOrgUnitSelectedMessage.js @@ -39,16 +39,15 @@ type Props = {| |} const WithoutOrgUnitSelectedMessagePlain = ({ programId, setShowAccessible, classes }: Props) => { - // TODO - this hook breaks the app when the program is not found const { program, programType } = useProgramInfo(programId); const IncompleteSelectionMessage = useMemo(() => (programType === programTypes.TRACKER_PROGRAM ? ( i18n.t('Or see all records accessible to you in {{program}} ', { - program: program.name, + program: program?.name, interpolation: { escapeValue: false }, }) ) : i18n.t('Or see all events accessible to you in {{program}}', - { program: program.name, interpolation: { escapeValue: false } })), - [program.name, programType]); + { program: program?.name, interpolation: { escapeValue: false } })), + [program?.name, programType]); return (
void, -|}>; - -export type PlainProps = $ReadOnly<{| - ...PassOnProps, setShowAccessible: () => void, MainPageStatus: boolean, selectedTemplateId: string, - showMainPage: boolean, - ...CssClasses, -|}>; - -export type Props = $ReadOnly<{| - ...PassOnProps, - ...PlainProps, error: boolean, ready: boolean, - trackedEntityTypeId?: string, - displayFrontPageList?: boolean, - selectedCategories: ?{ [categoryId: string]: { writeAccess: boolean } }, +|} +>; + +export type Props = $ReadOnly<{| + ...ContainerProps, + ...CssClasses |}>; diff --git a/src/core_modules/capture-core/components/Pages/New/NewPage.component.js b/src/core_modules/capture-core/components/Pages/New/NewPage.component.js index a7b070193b..35939b44f6 100644 --- a/src/core_modules/capture-core/components/Pages/New/NewPage.component.js +++ b/src/core_modules/capture-core/components/Pages/New/NewPage.component.js @@ -7,7 +7,7 @@ import withStyles from '@material-ui/core/styles/withStyles'; import { OrgUnitFetcher } from 'capture-core/components/OrgUnitFetcher'; import i18n from '@dhis2/d2-i18n'; import { Button } from '@dhis2/ui'; -import { TopBar } from './TopBar.container'; + import type { ContainerProps, Props } from './NewPage.types'; import { withErrorMessageHandler, withLoadingIndicator } from '../../../HOC'; import { NEW_TEI_DATA_ENTRY_ID, newPageStatuses } from './NewPage.constants'; @@ -36,11 +36,7 @@ const NewPagePlain = ({ categoryOptionIsInvalidForOrgUnit, missingCategoriesInProgramSelection, orgUnitSelectionIncomplete, - isUserInteractionInProgress, - programId, - teiId, trackedEntityName, - teiDisplayName, trackedEntityInstanceAttributes, }: Props) => { const { scopeType } = useScopeInfo(currentScopeId); @@ -72,16 +68,7 @@ const NewPagePlain = ({ ]); const orgUnitId = useSelector(({ currentSelections }) => currentSelections.orgUnitId); - return (<> - + return (
{ !writeAccess ? @@ -154,7 +141,7 @@ const NewPagePlain = ({ }
- ); + ); }; export const NewPageComponent: ComponentType = diff --git a/src/core_modules/capture-core/components/Pages/New/NewPage.container.js b/src/core_modules/capture-core/components/Pages/New/NewPage.container.js index 8ea87c19e2..4286ee2c70 100644 --- a/src/core_modules/capture-core/components/Pages/New/NewPage.container.js +++ b/src/core_modules/capture-core/components/Pages/New/NewPage.container.js @@ -9,7 +9,7 @@ import { showDefaultViewOnNewPage, showMessageToSelectProgramCategoryOnNewPage, showMessageThatCategoryOptionIsInvalidForOrgUnit, } from './NewPage.actions'; -import { typeof newPageStatuses } from './NewPage.constants'; +import { newPageStatuses } from './NewPage.constants'; import { buildUrlQueryString, useLocationQuery } from '../../../utils/routing'; import { getScopeFromScopeId, TrackerProgram, TrackedEntityType } from '../../../metaData'; import { useMissingCategoriesInProgramSelection } from '../../../hooks/useMissingCategoriesInProgramSelection'; @@ -18,6 +18,7 @@ import { useTrackedEntityInstances } from './hooks'; import { deriveTeiName } from '../common/EnrollmentOverviewDomain/useTeiDisplayName'; import { programCollection } from '../../../metaDataMemoryStores/programCollection/programCollection'; import { useCategoryOptionIsValidForOrgUnit } from '../../../hooks/useCategoryComboIsValidForOrgUnit'; +import { TopBar } from './TopBar.container'; const useUserWriteAccess = (scopeId) => { const scope = getScopeFromScopeId(scopeId); @@ -89,7 +90,7 @@ export const NewPage: ComponentType<{||}> = () => { ({ currentSelections }) => !currentSelections.orgUnitId && !currentSelections.complete, ); - const newPageStatus: $Keys = + const newPageStatus: $Keys = useSelector(({ newPage }) => newPage.newPageStatus); const handleMainPageNavigation = () => { @@ -108,26 +109,34 @@ export const NewPage: ComponentType<{||}> = () => { ); return ( - ); + <> + + + + ); }; diff --git a/src/core_modules/capture-core/components/Pages/New/NewPage.types.js b/src/core_modules/capture-core/components/Pages/New/NewPage.types.js index 438b61a88f..9004f99945 100644 --- a/src/core_modules/capture-core/components/Pages/New/NewPage.types.js +++ b/src/core_modules/capture-core/components/Pages/New/NewPage.types.js @@ -29,7 +29,6 @@ export type ContainerProps = $ReadOnly<{| writeAccess: boolean, error: boolean, ready: boolean, - isUserInteractionInProgress: boolean, programId?: string, teiId?: string, trackedEntityName?: string, diff --git a/src/core_modules/capture-core/components/Pages/NewRelationship/RegisterTei/RegistrationSection/RegUnitSelector/RegUnitSelector.component.js b/src/core_modules/capture-core/components/Pages/NewRelationship/RegisterTei/RegistrationSection/RegUnitSelector/RegUnitSelector.component.js index ea39476d43..fc4f52cfa5 100644 --- a/src/core_modules/capture-core/components/Pages/NewRelationship/RegisterTei/RegistrationSection/RegUnitSelector/RegUnitSelector.component.js +++ b/src/core_modules/capture-core/components/Pages/NewRelationship/RegisterTei/RegistrationSection/RegUnitSelector/RegUnitSelector.component.js @@ -47,7 +47,7 @@ class RegUnitSelectorPlain extends React.Component { return; } - onUpdateSelectedOrgUnit(orgUnit, program.organisationUnits ? !program.organisationUnits[orgUnit.id] : false); + onUpdateSelectedOrgUnit(orgUnit, program?.organisationUnits ? !program.organisationUnits[orgUnit.id] : false); } render() { diff --git a/src/core_modules/capture-core/components/Pages/ViewEvent/epics/getCategoriesDataFromEvent.js b/src/core_modules/capture-core/components/Pages/ViewEvent/epics/getCategoriesDataFromEvent.js index c3609baa25..1f98cf8bcd 100644 --- a/src/core_modules/capture-core/components/Pages/ViewEvent/epics/getCategoriesDataFromEvent.js +++ b/src/core_modules/capture-core/components/Pages/ViewEvent/epics/getCategoriesDataFromEvent.js @@ -25,7 +25,7 @@ export async function getCategoriesDataFromEventAsync( const program = getProgramFromProgramIdThrowIfNotFound(event.programId); - const categoryCombination = program.categoryCombination; + const categoryCombination = program?.categoryCombination; if (!categoryCombination) { return null; } diff --git a/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/RegisterTei/RegistrationSection/RegUnitSelector/RegUnitSelector.component.js b/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/RegisterTei/RegistrationSection/RegUnitSelector/RegUnitSelector.component.js index e75b8513ea..42cba9027f 100644 --- a/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/RegisterTei/RegistrationSection/RegUnitSelector/RegUnitSelector.component.js +++ b/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/RegisterTei/RegistrationSection/RegUnitSelector/RegUnitSelector.component.js @@ -47,7 +47,7 @@ class RegUnitSelectorPlain extends React.Component { return; } - onUpdateSelectedOrgUnit(orgUnit, program.organisationUnits ? !program.organisationUnits[orgUnit.id] : false); + onUpdateSelectedOrgUnit(orgUnit, program?.organisationUnits ? !program.organisationUnits[orgUnit.id] : false); } render() { diff --git a/src/core_modules/capture-core/components/ScopeSelector/QuickSelector/QuickSelector.types.js b/src/core_modules/capture-core/components/ScopeSelector/QuickSelector/QuickSelector.types.js index 3b8451471c..148a0b7bfd 100644 --- a/src/core_modules/capture-core/components/ScopeSelector/QuickSelector/QuickSelector.types.js +++ b/src/core_modules/capture-core/components/ScopeSelector/QuickSelector/QuickSelector.types.js @@ -3,7 +3,7 @@ import type { Node } from 'react'; export type Props = { selectedOrgUnitId?: string, - selectedProgramId?: string, + selectedProgramId?: ?string, selectedCategories: Object, selectedOrgUnit: Object, previousOrgUnitId?: string, diff --git a/src/core_modules/capture-core/components/ScopeSelector/ScopeSelector.types.js b/src/core_modules/capture-core/components/ScopeSelector/ScopeSelector.types.js index e92d91a8a2..09faa0ece8 100644 --- a/src/core_modules/capture-core/components/ScopeSelector/ScopeSelector.types.js +++ b/src/core_modules/capture-core/components/ScopeSelector/ScopeSelector.types.js @@ -5,7 +5,7 @@ export type OwnProps = $ReadOnly<{| isUserInteractionInProgress?: boolean, pageToPush?: string, selectedOrgUnitId?: string, - selectedProgramId?: string, + selectedProgramId?: ?string, previousOrgUnitId?: string, selectedCategories?: { [categoryId: string]: { writeAccess: boolean } }, onSetProgramId?: (id: string) => void, diff --git a/src/core_modules/capture-core/components/TopBarActions/TopBarActions.types.js b/src/core_modules/capture-core/components/TopBarActions/TopBarActions.types.js index 0f13e109f2..249ab2faa9 100644 --- a/src/core_modules/capture-core/components/TopBarActions/TopBarActions.types.js +++ b/src/core_modules/capture-core/components/TopBarActions/TopBarActions.types.js @@ -1,13 +1,13 @@ // @flow export type Props = { - selectedProgramId?: string, + selectedProgramId?: ?string, selectedOrgUnitId?: string, isUserInteractionInProgress?: boolean, }; export type PlainProps = { - selectedProgramId?: string, + selectedProgramId?: ?string, onNewClick: () => void, onNewClickWithoutProgramId: () => void, onFindClick: () => void, diff --git a/src/core_modules/capture-core/components/WidgetEnrollment/WidgetEnrollment.component.js b/src/core_modules/capture-core/components/WidgetEnrollment/WidgetEnrollment.component.js index 00c44c0a6e..1cd597f02d 100644 --- a/src/core_modules/capture-core/components/WidgetEnrollment/WidgetEnrollment.component.js +++ b/src/core_modules/capture-core/components/WidgetEnrollment/WidgetEnrollment.component.js @@ -136,7 +136,9 @@ export const WidgetEnrollmentPlain = ({ - {i18n.t('Started at: ')} + {i18n.t('Started at{{escape}}', { + escape: ':', + })} {convertValue(orgUnitClientValue, type)}
@@ -144,7 +146,9 @@ export const WidgetEnrollmentPlain = ({ - {i18n.t('Owned by: ')} + {i18n.t('Owned by{{escape}}', { + escape: ':', + })} {convertValue(ownerOrgUnitClientValue, type)} diff --git a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/getConvertedRelatedStageEvent/getConvertedRelatedStageEvent.js b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/getConvertedRelatedStageEvent/getConvertedRelatedStageEvent.js index 2da2338fe6..07832fe83f 100644 --- a/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/getConvertedRelatedStageEvent/getConvertedRelatedStageEvent.js +++ b/src/core_modules/capture-core/components/WidgetEnrollmentEventNew/Validated/getConvertedRelatedStageEvent/getConvertedRelatedStageEvent.js @@ -47,7 +47,6 @@ const getEventDetailsByLinkMode = ({ }), ); } - return ({ linkedEvent: { ...baseEventDetails, @@ -56,23 +55,34 @@ const getEventDetailsByLinkMode = ({ }, linkedEventId: baseEventDetails.event, }); - } else if (linkMode === RelatedStageModes.ENTER_DATA) { + } + + if (linkMode === RelatedStageModes.ENTER_DATA) { + const { orgUnit: linkedEventOrgUnit } = relatedStageDataValues; + if (!linkedEventOrgUnit) { + throw new Error( + errorCreator('Missing required data for creating related stage event')({ + linkedEventOrgUnit, + }), + ); + } return ({ linkedEvent: { ...baseEventDetails, scheduledAt: convertFn(clientRequestEvent.scheduledAt, dataElementTypes.DATE), - orgUnit: clientRequestEvent.orgUnit, + orgUnit: convertFn(linkedEventOrgUnit, dataElementTypes.ORGANISATION_UNIT), }, linkedEventId: baseEventDetails.event, }); - } else if (linkMode === RelatedStageModes.LINK_EXISTING_RESPONSE) { + } + + if (linkMode === RelatedStageModes.LINK_EXISTING_RESPONSE) { const { linkedEventId } = relatedStageDataValues; return { linkedEvent: null, linkedEventId, }; } - log.error(errorCreator(`Referral mode ${linkMode} is not supported`)()); return { linkedEvent: null, diff --git a/src/core_modules/capture-core/components/WidgetRelatedStages/EnterDataInOrgUnit/EnterData.component.js b/src/core_modules/capture-core/components/WidgetRelatedStages/EnterDataInOrgUnit/EnterData.component.js new file mode 100644 index 0000000000..47ff354bed --- /dev/null +++ b/src/core_modules/capture-core/components/WidgetRelatedStages/EnterDataInOrgUnit/EnterData.component.js @@ -0,0 +1,114 @@ +// @flow +import React from 'react'; +import i18n from '@dhis2/d2-i18n'; +import type { ComponentType } from 'react'; +import { withStyles } from '@material-ui/core'; +import { colors, spacers, spacersNum, IconInfo16 } from '@dhis2/ui'; +import { OrgUnitSelectorForRelatedStages } from '../FormComponents'; +import type { ErrorMessagesForRelatedStages } from '../RelatedStagesActions'; +import type { RelatedStageDataValueStates } from '../WidgetRelatedStages.types'; + +const styles = { + wrapper: { + padding: `${spacers.dp16} 0`, + maxWidth: '55.75rem', + }, + fieldWrapper: { + display: 'flex', + flexWrap: 'wrap', + alignItems: 'start', + justifyContent: 'space-between', + padding: `${spacers.dp8} ${spacers.dp16}`, + }, + fieldLabel: { + color: colors.grey900, + paddingTop: spacersNum.dp12, + paddingRight: spacersNum.dp16, + flexBasis: '200px', + }, + fieldContent: { + flexBasis: '150px', + flexGrow: 1, + }, + alternateColor: { + backgroundColor: colors.grey100, + }, + infoBox: { + margin: '8px 8px', + display: 'flex', + fontSize: '14px', + gap: '5px', + background: colors.grey100, + padding: '12px 8px', + border: `1px solid ${colors.grey600}`, + }, +}; + +type Props = { + linkableStageLabel: string, + relatedStagesDataValues: RelatedStageDataValueStates, + setRelatedStagesDataValues: (() => Object) => void, + currentStageLabel: string, + saveAttempted: boolean, + errorMessages: ErrorMessagesForRelatedStages, + ...CssClasses +} + +export const EnterDataInOrgUnitPlain = ({ + linkableStageLabel, + relatedStagesDataValues, + setRelatedStagesDataValues, + saveAttempted, + errorMessages, + currentStageLabel, + classes, +}: Props) => { + const onSelectOrgUnit = (e: { id: string, displayName: string, path: string }) => { + const orgUnit = { + id: e.id, + name: e.displayName, + path: e.path, + }; + + setRelatedStagesDataValues(prevValues => ({ + ...prevValues, + orgUnit, + })); + }; + + const onDeselectOrgUnit = () => { + setRelatedStagesDataValues(prevValues => ({ + ...prevValues, + orgUnit: null, + })); + }; + + return ( +
+
+ +
+
+ + {i18n.t( + relatedStagesDataValues?.orgUnit?.name + ? 'Enter {{linkableStageLabel}} details for {{orgUnitLabel}} in the next step after completing this {{currentStageLabel}}.' + : 'Select organisation unit and enter {{linkableStageLabel}} details in the next step after completing this {{currentStageLabel}}.', + { + linkableStageLabel, + currentStageLabel, + orgUnitLabel: relatedStagesDataValues?.orgUnit?.name, + }, + )} +
+
+ ); +}; + +export const EnterDataInOrgUnit: ComponentType<$Diff> = withStyles(styles)(EnterDataInOrgUnitPlain); diff --git a/src/core_modules/capture-core/components/WidgetRelatedStages/EnterDataInOrgUnit/index.js b/src/core_modules/capture-core/components/WidgetRelatedStages/EnterDataInOrgUnit/index.js new file mode 100644 index 0000000000..0d5a3fe03e --- /dev/null +++ b/src/core_modules/capture-core/components/WidgetRelatedStages/EnterDataInOrgUnit/index.js @@ -0,0 +1,2 @@ +// @flow +export { EnterDataInOrgUnit } from './EnterData.component'; diff --git a/src/core_modules/capture-core/components/WidgetRelatedStages/LinkToExisting/LinkToExisting.component.js b/src/core_modules/capture-core/components/WidgetRelatedStages/LinkToExisting/LinkToExisting.component.js index 47f623af6e..a53c05eb3f 100644 --- a/src/core_modules/capture-core/components/WidgetRelatedStages/LinkToExisting/LinkToExisting.component.js +++ b/src/core_modules/capture-core/components/WidgetRelatedStages/LinkToExisting/LinkToExisting.component.js @@ -68,5 +68,4 @@ export const LinkToExistingPlain = ({ ); }; -export const LinkToExisting = - withStyles(styles)(LinkToExistingPlain); +export const LinkToExisting = withStyles(styles)(LinkToExistingPlain); diff --git a/src/core_modules/capture-core/components/WidgetRelatedStages/RelatedStagesActions/RelatedStagesActions.component.js b/src/core_modules/capture-core/components/WidgetRelatedStages/RelatedStagesActions/RelatedStagesActions.component.js index 4266eaf52a..38bbb6e24b 100644 --- a/src/core_modules/capture-core/components/WidgetRelatedStages/RelatedStagesActions/RelatedStagesActions.component.js +++ b/src/core_modules/capture-core/components/WidgetRelatedStages/RelatedStagesActions/RelatedStagesActions.component.js @@ -1,7 +1,7 @@ // @flow import React, { type ComponentType, useMemo } from 'react'; import i18n from '@dhis2/d2-i18n'; -import { Button, colors, IconInfo16, Radio, spacers, spacersNum } from '@dhis2/ui'; +import { Button, colors, Radio, spacers, spacersNum } from '@dhis2/ui'; import { withStyles } from '@material-ui/core'; import { ConditionalTooltip } from 'capture-core/components/Tooltips/ConditionalTooltip'; import { actions as RelatedStagesActionTypes, mainOptionTranslatedTexts, relatedStageStatus } from '../constants'; @@ -11,6 +11,7 @@ import { ScheduleInOrgUnit } from '../ScheduleInOrgUnit'; import { useProgramStageInfo } from '../../../metaDataMemoryStores/programCollection/helpers'; import type { Props } from './RelatedStagesActions.types'; import { LinkToExisting } from '../LinkToExisting'; +import { EnterDataInOrgUnit } from '../EnterDataInOrgUnit/EnterData.component'; const styles = () => ({ wrapper: { @@ -37,15 +38,6 @@ const styles = () => ({ clearSelections: { padding: spacers.dp8, }, - infoBox: { - margin: '8px 8px', - display: 'flex', - fontSize: '14px', - gap: '5px', - background: colors.grey100, - padding: '12px 8px', - border: `1px solid ${colors.grey600}`, - }, }); export const RelatedStagesActionsPlain = ({ @@ -171,16 +163,14 @@ export const RelatedStagesActionsPlain = ({ )} {selectedAction === RelatedStagesActionTypes.ENTER_DATA && ( -
- - {i18n.t( - 'Enter {{linkableStageLabel}} details in the next step after completing this {{currentStageLabel}}.', - { - linkableStageLabel: programStage.stageForm.name, - currentStageLabel, - }, - )} -
+ )} {selectedAction === RelatedStagesActionTypes.LINK_EXISTING_RESPONSE && ( diff --git a/src/core_modules/capture-core/components/WidgetRelatedStages/ScheduleInOrgUnit/ScheduleInOrgUnit.container.js b/src/core_modules/capture-core/components/WidgetRelatedStages/ScheduleInOrgUnit/ScheduleInOrgUnit.component.js similarity index 100% rename from src/core_modules/capture-core/components/WidgetRelatedStages/ScheduleInOrgUnit/ScheduleInOrgUnit.container.js rename to src/core_modules/capture-core/components/WidgetRelatedStages/ScheduleInOrgUnit/ScheduleInOrgUnit.component.js diff --git a/src/core_modules/capture-core/components/WidgetRelatedStages/ScheduleInOrgUnit/index.js b/src/core_modules/capture-core/components/WidgetRelatedStages/ScheduleInOrgUnit/index.js index 2e1a21bf88..c547d9d70d 100644 --- a/src/core_modules/capture-core/components/WidgetRelatedStages/ScheduleInOrgUnit/index.js +++ b/src/core_modules/capture-core/components/WidgetRelatedStages/ScheduleInOrgUnit/index.js @@ -1,2 +1,2 @@ // @flow -export { ScheduleInOrgUnit } from './ScheduleInOrgUnit.container'; +export { ScheduleInOrgUnit } from './ScheduleInOrgUnit.component'; diff --git a/src/core_modules/capture-core/components/WidgetRelatedStages/relatedStageEventIsValid/ValidationFunctions.js b/src/core_modules/capture-core/components/WidgetRelatedStages/relatedStageEventIsValid/ValidationFunctions.js index 07ad6a17a8..b02e1f5ae5 100644 --- a/src/core_modules/capture-core/components/WidgetRelatedStages/relatedStageEventIsValid/ValidationFunctions.js +++ b/src/core_modules/capture-core/components/WidgetRelatedStages/relatedStageEventIsValid/ValidationFunctions.js @@ -44,6 +44,23 @@ const scheduleInOrgUnit = (props) => { return scheduledAtIsValid && orgUnitIsValid; }; +const enterData = (props) => { + const { orgUnit, setErrorMessages } = props ?? {}; + const orgUnitIsValid = isValidOrgUnit(orgUnit); + + if (!orgUnitIsValid) { + setErrorMessages({ + orgUnit: i18n.t('Please provide a valid organisation unit'), + }); + } else { + setErrorMessages({ + orgUnit: null, + }); + } + + return orgUnitIsValid; +}; + const linkToExistingResponse = (props) => { const { linkedEventId, setErrorMessages } = props ?? {}; const linkedEventIdIsValid = !!linkedEventId; @@ -64,7 +81,7 @@ const linkToExistingResponse = (props) => { export const ValidationFunctionsByLinkMode: { [key: string]: (props: ?Props) => boolean } = { [RelatedStageModes.SCHEDULE_IN_ORG]: props => scheduleInOrgUnit(props), - [RelatedStageModes.ENTER_DATA]: () => true, + [RelatedStageModes.ENTER_DATA]: props => enterData(props), [RelatedStageModes.LINK_EXISTING_RESPONSE]: props => linkToExistingResponse(props), }; diff --git a/src/core_modules/capture-core/components/WidgetsChangelog/common/Changelog/Changelog.component.js b/src/core_modules/capture-core/components/WidgetsChangelog/common/Changelog/Changelog.component.js index 9f853a80e1..d43b9a0620 100644 --- a/src/core_modules/capture-core/components/WidgetsChangelog/common/Changelog/Changelog.component.js +++ b/src/core_modules/capture-core/components/WidgetsChangelog/common/Changelog/Changelog.component.js @@ -34,7 +34,9 @@ export const ChangelogComponent = ({ - + ( + + {label} + +); + + +export const ChangelogChangeCell = ({ changeType }: Object) => { + const config = changeTypeConfigs[changeType]; + + if (!config) { + log.error(errorCreator('Changelog component not found')({ changeType })); + return null; + } + + return ( + + ); +}; + diff --git a/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogChangeCell.js b/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogCells/ChangelogValueCell.js similarity index 60% rename from src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogChangeCell.js rename to src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogCells/ChangelogValueCell.js index 1ec493edff..246c7c2651 100644 --- a/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogChangeCell.js +++ b/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogCells/ChangelogValueCell.js @@ -1,11 +1,10 @@ // @flow import React from 'react'; import log from 'loglevel'; -import { colors, IconArrowRight16, spacers, Tag } from '@dhis2/ui'; -import i18n from '@dhis2/d2-i18n'; +import { colors, IconArrowRight16, spacers } from '@dhis2/ui'; import { withStyles } from '@material-ui/core/styles'; -import { CHANGE_TYPES } from '../Changelog/Changelog.constants'; -import { errorCreator } from '../../../../../capture-core-utils'; +import { CHANGE_TYPES } from '../../Changelog/Changelog.constants'; +import { errorCreator } from '../../../../../../capture-core-utils'; type Props = { changeType: $Values, @@ -15,14 +14,16 @@ type Props = { container: string, previousValue: string, currentValue: string, + updatePreviousValue: string, + updateCurrentValue: string, + updateArrow: string, } } const styles = { container: { - display: 'flex', alignItems: 'center', - gap: spacers.dp4, + display: 'flex', }, previousValue: { color: colors.grey700, @@ -30,19 +31,31 @@ const styles = { currentValue: { color: colors.grey900, }, + updatePreviousValue: { + color: colors.grey700, + maxWidth: '45%', + }, + updateCurrentValue: { + color: colors.grey900, + maxWidth: '45%', + }, + updateArrow: { + display: 'inline-flex', + alignItems: 'center', + margin: `${spacers.dp4}`, + }, }; const Updated = ({ previousValue, currentValue, classes }) => (
- {previousValue} - - {currentValue} + {previousValue} + + {currentValue}
); const Created = ({ currentValue, classes }) => (
- {i18n.t('Created')} {currentValue}
); @@ -50,8 +63,6 @@ const Created = ({ currentValue, classes }) => ( const Deleted = ({ previousValue, classes }) => (
{previousValue} - - {i18n.t('Deleted')}
); @@ -61,7 +72,7 @@ const ChangelogComponentsByType = { [CHANGE_TYPES.DELETED]: Deleted, }; -const ChangelogChangeCellPlain = ({ changeType, currentValue, previousValue, classes }: Props) => { +const ChangelogValueCellPlain = ({ changeType, currentValue, previousValue, classes }: Props) => { const ChangelogComponent = ChangelogComponentsByType[changeType]; if (!ChangelogComponent) { @@ -78,4 +89,4 @@ const ChangelogChangeCellPlain = ({ changeType, currentValue, previousValue, cla ); }; -export const ChangelogChangeCell = withStyles(styles)(ChangelogChangeCellPlain); +export const ChangelogValueCell = withStyles(styles)(ChangelogValueCellPlain); diff --git a/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogCells/index.js b/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogCells/index.js new file mode 100644 index 0000000000..d5f9ff3167 --- /dev/null +++ b/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogCells/index.js @@ -0,0 +1,4 @@ +// @flow + +export { ChangelogChangeCell } from './ChangelogChangeCell'; +export { ChangelogValueCell } from './ChangelogValueCell'; diff --git a/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogTableHeader.js b/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogTableHeader.js index 9c3ebd671a..26dc592540 100644 --- a/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogTableHeader.js +++ b/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogTableHeader.js @@ -9,27 +9,30 @@ type Props = { setSortDirection: SetSortDirection, }; -export const ChangelogTableHeader = ({ - sortDirection, - setSortDirection, -}: Props) => ( +export const ChangelogTableHeader = ({ sortDirection, setSortDirection }: Props) => ( setSortDirection(direction)} sortDirection={sortDirection} + fixed + top="0" + width="140px" > {i18n.t('Date')} - + {i18n.t('User')} - + {i18n.t('Data item')} - + {i18n.t('Change')} + + {i18n.t('Value')} + ); diff --git a/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogTableRow.js b/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogTableRow.js index 31c9a1ddbb..e93571cbf2 100644 --- a/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogTableRow.js +++ b/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/ChangelogTableRow.js @@ -1,29 +1,35 @@ // @flow import React from 'react'; import { DataTableCell, DataTableRow } from '@dhis2/ui'; -import { ChangelogChangeCell } from './ChangelogChangeCell'; -import type { ChangelogRecord } from '../Changelog/Changelog.types'; +import { withStyles } from '@material-ui/core/styles'; +import { ChangelogChangeCell, ChangelogValueCell } from './ChangelogCells'; -type Props = {| - record: ChangelogRecord, -|} +type Props = { + record: { + date: string, + user: string, + dataItemLabel: string, + changeType: string, + }, + classes: { + dataItemColumn: string, + valueColumn: string, + }, +}; -export const ChangelogTableRow = ({ record }: Props) => ( - - - {record.date} - - - {record.user} - - - {record.dataItemLabel} - +const styles = { + dataItemColumn: { wordWrap: 'break-word', hyphens: 'auto' }, + valueColumn: { wordWrap: 'break-word' }, +}; - - - +const ChangelogTableRowPlain = ({ record, classes }: Props) => ( + + {record.date} + {record.user} + {record.dataItemLabel} + + ); + +export const ChangelogTableRow = withStyles(styles)(ChangelogTableRowPlain); diff --git a/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/index.js b/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/index.js index 6f2fa32294..f18acb8934 100644 --- a/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/index.js +++ b/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogTable/index.js @@ -1,6 +1,5 @@ // @flow export { ChangelogTableHeader } from './ChangelogTableHeader'; -export { ChangelogChangeCell } from './ChangelogChangeCell'; export { ChangelogTableRow } from './ChangelogTableRow'; diff --git a/src/core_modules/capture-core/converters/clientToList.js b/src/core_modules/capture-core/converters/clientToList.js index 870d0d7981..e72b837179 100644 --- a/src/core_modules/capture-core/converters/clientToList.js +++ b/src/core_modules/capture-core/converters/clientToList.js @@ -38,7 +38,6 @@ type ImageClientValue = { previewUrl: string, }; - function convertFileForDisplay(clientValue: FileClientValue) { // Fallback until https://dhis2.atlassian.net/browse/DHIS2-16994 is implemented if (typeof clientValue === 'string' || clientValue instanceof String) { @@ -88,9 +87,10 @@ function convertStatusForDisplay(clientValue: Object) { ); } -function convertOrgUnitForDisplay(clientValue: { id: string }) { +function convertOrgUnitForDisplay(clientValue: string | {id: string}) { + const orgUnitId = typeof clientValue === 'string' ? clientValue : clientValue.id; return ( - + ); } diff --git a/src/core_modules/capture-core/hooks/useProgramInfo/useProgramInfo.js b/src/core_modules/capture-core/hooks/useProgramInfo/useProgramInfo.js index dc2437ed04..2b2a4ddbbb 100644 --- a/src/core_modules/capture-core/hooks/useProgramInfo/useProgramInfo.js +++ b/src/core_modules/capture-core/hooks/useProgramInfo/useProgramInfo.js @@ -4,9 +4,16 @@ import { getProgramFromProgramIdThrowIfNotFound, TrackerProgram } from '../../me import { programTypes } from './programTypes.const'; export const useProgramInfo = (programId: string) => useMemo(() => { - const program = getProgramFromProgramIdThrowIfNotFound(programId); - return { - program, - programType: program instanceof TrackerProgram ? programTypes.TRACKER_PROGRAM : programTypes.EVENT_PROGRAM, - }; + try { + const program = getProgramFromProgramIdThrowIfNotFound(programId); + return { + program, + programType: program instanceof TrackerProgram ? programTypes.TRACKER_PROGRAM : programTypes.EVENT_PROGRAM, + }; + } catch (error) { + return { + program: undefined, + programType: undefined, + }; + } }, [programId]); diff --git a/src/core_modules/capture-core/metaData/helpers/getProgramEventAccess.js b/src/core_modules/capture-core/metaData/helpers/getProgramEventAccess.js index 8fad80830f..3fddd73db8 100644 --- a/src/core_modules/capture-core/metaData/helpers/getProgramEventAccess.js +++ b/src/core_modules/capture-core/metaData/helpers/getProgramEventAccess.js @@ -14,7 +14,7 @@ export function getProgramEventAccess( if (program instanceof EventProgram) { stage = program.stage; } else if (programStageId) { - stage = program.getStage(programStageId); + stage = program?.getStage(programStageId); } if (!stage) { log.error(errorCreator('stage not found')({ programId, programStageId })); diff --git a/src/core_modules/capture-ui/NonBundledIcon/NonBundledIcon.component.js b/src/core_modules/capture-ui/NonBundledIcon/NonBundledIcon.component.js index dda968e42f..b906adcebb 100644 --- a/src/core_modules/capture-ui/NonBundledIcon/NonBundledIcon.component.js +++ b/src/core_modules/capture-ui/NonBundledIcon/NonBundledIcon.component.js @@ -27,7 +27,9 @@ export const NonBundledIcon = ({ {alternativeText} ) }