From a35d45630839c335dfddaabed6899edd721c2225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 4 Jun 2025 16:54:44 +0200 Subject: [PATCH 01/23] Fix participant condition in list_with_period.html.twig Updated the condition to properly handle cases where the first participation's person is not the current person. --- .../Resources/views/Person/list_with_period.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig index 7d06c51c3..670ce2ec7 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig @@ -96,7 +96,7 @@ {% endif %} - {% if acp.currentParticipations|length > 1 %} + {% if acp.currentParticipations|length > 1 or (acp.currentParticipations|first).person is not same as person %}

From fca10ada717b84bfe9dce44ddb36c7a1f3592ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 4 Jun 2025 16:54:58 +0200 Subject: [PATCH 02/23] Fix translation keys and participant pluralization in list_with_period.html.twig Updated French translations for "Participants" and improved pluralization handling in accompanying_period keys. Modified list_with_period.html.twig to dynamically translate "Participants" based on the count of current participations. --- .changes/unreleased/Fixed-20250604-165550.yaml | 6 ++++++ .../Resources/views/Person/list_with_period.html.twig | 2 +- .../translations/messages+intl-icu.fr.yaml | 8 ++++++++ src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .changes/unreleased/Fixed-20250604-165550.yaml diff --git a/.changes/unreleased/Fixed-20250604-165550.yaml b/.changes/unreleased/Fixed-20250604-165550.yaml new file mode 100644 index 000000000..0544c9402 --- /dev/null +++ b/.changes/unreleased/Fixed-20250604-165550.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: Display the list of participant in the results, even if there is only one participant and that the search result display the requestor +time: 2025-06-04T16:55:50.107852336+02:00 +custom: + Issue: "390" + SchemaChange: No schema change diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig index 670ce2ec7..41bc51864 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig @@ -100,7 +100,7 @@

- {{ 'Participants'|trans }} + {{ 'accompanying_period.Participants_without_count'|trans({count: acp.currentParticipations|length}) }}

diff --git a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml index 830e21d2d..6e42a362b 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml @@ -13,6 +13,14 @@ Requestor: >- neutral {Demandeur·euse} } +accompanying_period: + Participants_without_count: >- + {count, plural, + =0 {Participant} + =1 {Participant} + other {Participants} + } + person: from_the: depuis le And himself: >- diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 9bce912a0..0f62e4f5b 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -208,7 +208,7 @@ Pediod closing form is not valid: Le formulaire n'est pas valide Accompanying user: Accompagnant No accompanying user: Aucun accompagnant No data given: Pas d'information -Participants: Usagers impliquées +Participants: Usagers impliqués Create an accompanying course: Créer un parcours Accompanying courses of users: Parcours des utilisateurs This accompanying course is still a draft: Ce parcours est encore à l'état brouillon. From c2842148c6b28cb075f693a5e214cad4de15d4ec Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 17 Jun 2025 19:26:23 +0200 Subject: [PATCH 03/23] Improve UX with better labeling in person resource form --- .changes/unreleased/UX-20250617-192650.yaml | 6 ++++++ .../ChillPersonBundle/Form/PersonResourceType.php | 10 ++++------ .../Resources/views/PersonResource/form.html.twig | 12 ++++++------ .../ChillPersonBundle/translations/messages.fr.yml | 4 ++++ 4 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 .changes/unreleased/UX-20250617-192650.yaml diff --git a/.changes/unreleased/UX-20250617-192650.yaml b/.changes/unreleased/UX-20250617-192650.yaml new file mode 100644 index 000000000..810758b10 --- /dev/null +++ b/.changes/unreleased/UX-20250617-192650.yaml @@ -0,0 +1,6 @@ +kind: UX +body: Improve labeling of fields in person resource creation form +time: 2025-06-17T19:26:50.599703116+02:00 +custom: + Issue: "" + SchemaChange: No schema change diff --git a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php index 2063b0e21..1412733bc 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php @@ -16,10 +16,8 @@ use Chill\MainBundle\Form\Type\CommentType; use Chill\PersonBundle\Entity\Person\PersonResource; use Chill\PersonBundle\Entity\Person\PersonResourceKind; use Chill\PersonBundle\Form\Type\PickPersonDynamicType; -use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Chill\PersonBundle\Templating\Entity\ResourceKindRender; use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType; -use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender; use Doctrine\ORM\EntityRepository; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; @@ -29,7 +27,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class PersonResourceType extends AbstractType { - public function __construct(private readonly ResourceKindRender $resourceKindRender, private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly ResourceKindRender $resourceKindRender, private readonly TranslatorInterface $translator) {} public function buildForm(FormBuilderInterface $builder, array $options) { @@ -52,13 +50,13 @@ final class PersonResourceType extends AbstractType }, ]) ->add('person', PickPersonDynamicType::class, [ - 'label' => 'Usager', + 'label' => $this->translator->trans('person_resource.person_non_prof'), ]) ->add('thirdparty', PickThirdpartyDynamicType::class, [ - 'label' => 'Tiers', + 'label' => $this->translator->trans('person_resource.thirdparty_prof'), ]) ->add('freetext', ChillTextareaType::class, [ - 'label' => 'Description libre', + 'label' => $this->translator->trans('person_resource.freetext'), 'required' => false, ]) ->add('comment', CommentType::class, [ diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/form.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/form.html.twig index 9bda2856b..5542074fa 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/form.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/form.html.twig @@ -10,28 +10,28 @@
{% if resource is defined and resource.person is not null %} - + {% else %} - + {% endif %}
{% if resource is defined and resource.thirdparty is not null %} - + {% else %} - + {% endif %}
{% if resource is defined and resource.freeText is not null %} - + {% else %} - + {% endif %}
diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 9bce912a0..94e6083ca 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -265,6 +265,10 @@ no comment found: "Aucun commentaire" Select a type: "Choisissez un type" Select a person: "Choisissez un usager" Kind: "Type" +person_resource: + person_non_prof: "Usager/ Tiers non-professionnel" + thirdparty_prof: "Tiers professionnel" + freetext: "Description libre" # pickAPersonType From ec957a2fe39e43ef7bf4fbca3efc4ed2270df4bd Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 17 Jun 2025 19:26:23 +0200 Subject: [PATCH 04/23] Improve UX with better labeling in person resource form --- .changes/unreleased/UX-20250617-192650.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/UX-20250617-192650.yaml diff --git a/.changes/unreleased/UX-20250617-192650.yaml b/.changes/unreleased/UX-20250617-192650.yaml new file mode 100644 index 000000000..810758b10 --- /dev/null +++ b/.changes/unreleased/UX-20250617-192650.yaml @@ -0,0 +1,6 @@ +kind: UX +body: Improve labeling of fields in person resource creation form +time: 2025-06-17T19:26:50.599703116+02:00 +custom: + Issue: "" + SchemaChange: No schema change From 606435a6b33057f085f5dbe77c921d28df594721 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Jul 2025 14:42:54 +0200 Subject: [PATCH 05/23] Pipeline corrections --- .../Controller/ActivityReasonController.php | 1 - .../vuejs/_components/Entity/UserRenderBoxBadge.vue | 8 ++++---- .../vuejs/AccompanyingCourse/components/StickyNav.vue | 2 +- .../components/FormEvaluation.vue | 3 ++- .../vuejs/_components/AccompanyingPeriod/SetReferrer.vue | 2 +- .../src/Resources/public/module/pending/index.ts | 2 -- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php index 0167273c5..7512b21ed 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php @@ -17,7 +17,6 @@ use Chill\ActivityBundle\Repository\ActivityReasonRepository; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** * ActivityReason controller. diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserRenderBoxBadge.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserRenderBoxBadge.vue index 4645f322d..63c43c37f 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserRenderBoxBadge.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserRenderBoxBadge.vue @@ -1,11 +1,11 @@ diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/Components/EditLocation.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/Components/EditLocation.vue index 86d4a6c5a..5f434052e 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/Components/EditLocation.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/Components/EditLocation.vue @@ -1,28 +1,28 @@ diff --git a/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue b/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue index 1bcc95fd0..3a2f4fd59 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue +++ b/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue @@ -1,59 +1,54 @@ diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/js/async-upload/uploader.ts b/src/Bundle/ChillDocStoreBundle/Resources/public/js/async-upload/uploader.ts index a09c4a5f6..367ab0829 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/js/async-upload/uploader.ts +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/js/async-upload/uploader.ts @@ -6,20 +6,20 @@ const algo = "AES-CBC"; const URL_POST = "/asyncupload/temp_url/generate/post"; const keyDefinition = { - name: algo, - length: 256, + name: algo, + length: 256, }; const createFilename = (): string => { - let text = ""; - const possible = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + let text = ""; + const possible = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - for (let i = 0; i < 7; i++) { - text += possible.charAt(Math.floor(Math.random() * possible.length)); - } + for (let i = 0; i < 7; i++) { + text += possible.charAt(Math.floor(Math.random() * possible.length)); + } - return text; + return text; }; /** @@ -30,59 +30,59 @@ const createFilename = (): string => { * @returns {Promise} A Promise that resolves to the newly created StoredObject. */ export const fetchNewStoredObject = async (): Promise => { - return makeFetch("POST", "/api/1.0/doc-store/stored-object/create", null); + return makeFetch("POST", "/api/1.0/doc-store/stored-object/create", null); }; export const uploadVersion = async ( - uploadFile: ArrayBuffer, - storedObject: StoredObject, + uploadFile: ArrayBuffer, + storedObject: StoredObject, ): Promise => { - const params = new URLSearchParams(); - params.append("expires_delay", "180"); - params.append("submit_delay", "180"); - const asyncData: PostStoreObjectSignature = await makeFetch( - "GET", - `/api/1.0/doc-store/async-upload/temp_url/${storedObject.uuid}/generate/post` + - "?" + - params.toString(), - ); - const suffix = createFilename(); - const filename = asyncData.prefix + suffix; - const formData = new FormData(); - formData.append("redirect", asyncData.redirect); - formData.append("max_file_size", asyncData.max_file_size.toString()); - formData.append("max_file_count", asyncData.max_file_count.toString()); - formData.append("expires", asyncData.expires.toString()); - formData.append("signature", asyncData.signature); - formData.append(filename, new Blob([uploadFile]), suffix); + const params = new URLSearchParams(); + params.append("expires_delay", "180"); + params.append("submit_delay", "180"); + const asyncData: PostStoreObjectSignature = await makeFetch( + "GET", + `/api/1.0/doc-store/async-upload/temp_url/${storedObject.uuid}/generate/post` + + "?" + + params.toString(), + ); + const suffix = createFilename(); + const filename = asyncData.prefix + suffix; + const formData = new FormData(); + formData.append("redirect", asyncData.redirect); + formData.append("max_file_size", asyncData.max_file_size.toString()); + formData.append("max_file_count", asyncData.max_file_count.toString()); + formData.append("expires", asyncData.expires.toString()); + formData.append("signature", asyncData.signature); + formData.append(filename, new Blob([uploadFile]), suffix); - const response = await window.fetch(asyncData.url, { - method: "POST", - body: formData, - }); + const response = await window.fetch(asyncData.url, { + method: "POST", + body: formData, + }); - if (!response.ok) { - console.error("Error while sending file to store", response); - throw new Error(response.statusText); - } + if (!response.ok) { + console.error("Error while sending file to store", response); + throw new Error(response.statusText); + } - return Promise.resolve(filename); + return Promise.resolve(filename); }; export const encryptFile = async ( - originalFile: ArrayBuffer, + originalFile: ArrayBuffer, ): Promise<[ArrayBuffer, Uint8Array, JsonWebKey]> => { - const iv = crypto.getRandomValues(new Uint8Array(16)); - const key = await window.crypto.subtle.generateKey(keyDefinition, true, [ - "encrypt", - "decrypt", - ]); - const exportedKey = await window.crypto.subtle.exportKey("jwk", key); - const encrypted = await window.crypto.subtle.encrypt( - { name: algo, iv: iv }, - key, - originalFile, - ); + const iv = crypto.getRandomValues(new Uint8Array(16)); + const key = await window.crypto.subtle.generateKey(keyDefinition, true, [ + "encrypt", + "decrypt", + ]); + const exportedKey = await window.crypto.subtle.exportKey("jwk", key); + const encrypted = await window.crypto.subtle.encrypt( + { name: algo, iv: iv }, + key, + originalFile, + ); - return Promise.resolve([encrypted, iv, exportedKey]); + return Promise.resolve([encrypted, iv, exportedKey]); }; diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/js/generic-doc-api.ts b/src/Bundle/ChillDocStoreBundle/Resources/public/js/generic-doc-api.ts index c15eff711..aaff2a331 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/js/generic-doc-api.ts +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/js/generic-doc-api.ts @@ -2,9 +2,9 @@ import { fetchResults } from "ChillMainAssets/lib/api/apiMethods"; import { GenericDocForAccompanyingPeriod } from "ChillDocStoreAssets/types/generic_doc"; export function fetch_generic_docs_by_accompanying_period( - periodId: number, + periodId: number, ): Promise { - return fetchResults( - `/api/1.0/doc-store/generic-doc/by-period/${periodId}/index`, - ); + return fetchResults( + `/api/1.0/doc-store/generic-doc/by-period/${periodId}/index`, + ); } diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/index.ts b/src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/index.ts index 30fe2b26a..97e0d3aa3 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/index.ts +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/index.ts @@ -6,117 +6,116 @@ import { _createI18n } from "../../../../../ChillMainBundle/Resources/public/vue const i18n = _createI18n({}); const startApp = ( - divElement: HTMLDivElement, - collectionEntry: null | HTMLLIElement, + divElement: HTMLDivElement, + collectionEntry: null | HTMLLIElement, ): void => { - console.log("app started", divElement); + console.log("app started", divElement); - const inputTitle = collectionEntry?.querySelector("input[type='text']"); + const inputTitle = collectionEntry?.querySelector("input[type='text']"); - const input_stored_object: HTMLInputElement | null = - divElement.querySelector("input[data-stored-object]"); - if (null === input_stored_object) { - throw new Error("input to stored object not found"); - } + const input_stored_object: HTMLInputElement | null = divElement.querySelector( + "input[data-stored-object]", + ); + if (null === input_stored_object) { + throw new Error("input to stored object not found"); + } - let existingDoc: StoredObject | null = null; - if (input_stored_object.value !== "") { - existingDoc = JSON.parse(input_stored_object.value); - } - const app_container = document.createElement("div"); - divElement.appendChild(app_container); + let existingDoc: StoredObject | null = null; + if (input_stored_object.value !== "") { + existingDoc = JSON.parse(input_stored_object.value); + } + const app_container = document.createElement("div"); + divElement.appendChild(app_container); - const app = createApp({ - template: - '', - data() { - return { - existingDoc: existingDoc, - inputTitle: inputTitle, - }; - }, - components: { - DropFileWidget, - }, - methods: { - addDocument: function ({ - stored_object, - stored_object_version, - file_name, - }: { - stored_object: StoredObject; - stored_object_version: StoredObjectVersion; - file_name: string; - }): void { - stored_object.title = file_name; - console.log("object added", stored_object); - console.log("version added", stored_object_version); - this.$data.existingDoc = stored_object; - this.$data.existingDoc.currentVersion = stored_object_version; - input_stored_object.value = JSON.stringify( - this.$data.existingDoc, - ); - if (this.$data.inputTitle) { - if (!this.$data.inputTitle?.value) { - this.$data.inputTitle.value = file_name; - } - } - }, - removeDocument: function (object: StoredObject): void { - console.log("catch remove document", object); - input_stored_object.value = ""; - this.$data.existingDoc = undefined; - console.log("collectionEntry", collectionEntry); + const app = createApp({ + template: + '', + data() { + return { + existingDoc: existingDoc, + inputTitle: inputTitle, + }; + }, + components: { + DropFileWidget, + }, + methods: { + addDocument: function ({ + stored_object, + stored_object_version, + file_name, + }: { + stored_object: StoredObject; + stored_object_version: StoredObjectVersion; + file_name: string; + }): void { + stored_object.title = file_name; + console.log("object added", stored_object); + console.log("version added", stored_object_version); + this.$data.existingDoc = stored_object; + this.$data.existingDoc.currentVersion = stored_object_version; + input_stored_object.value = JSON.stringify(this.$data.existingDoc); + if (this.$data.inputTitle) { + if (!this.$data.inputTitle?.value) { + this.$data.inputTitle.value = file_name; + } + } + }, + removeDocument: function (object: StoredObject): void { + console.log("catch remove document", object); + input_stored_object.value = ""; + this.$data.existingDoc = undefined; + console.log("collectionEntry", collectionEntry); - if (null !== collectionEntry) { - console.log("will remove collection"); - collectionEntry.remove(); - } - }, - }, - }); + if (null !== collectionEntry) { + console.log("will remove collection"); + collectionEntry.remove(); + } + }, + }, + }); - app.use(i18n).mount(app_container); + app.use(i18n).mount(app_container); }; window.addEventListener("collection-add-entry", (( - e: CustomEvent, + e: CustomEvent, ) => { - const detail = e.detail; - const divElement: null | HTMLDivElement = detail.entry.querySelector( - "div[data-stored-object]", - ); + const detail = e.detail; + const divElement: null | HTMLDivElement = detail.entry.querySelector( + "div[data-stored-object]", + ); - if (null === divElement) { - throw new Error("div[data-stored-object] not found"); - } + if (null === divElement) { + throw new Error("div[data-stored-object] not found"); + } - startApp(divElement, detail.entry); + startApp(divElement, detail.entry); }) as EventListener); window.addEventListener("DOMContentLoaded", () => { - const upload_inputs: NodeListOf = document.querySelectorAll( - "div[data-stored-object]", - ); + const upload_inputs: NodeListOf = document.querySelectorAll( + "div[data-stored-object]", + ); - upload_inputs.forEach((input: HTMLDivElement): void => { - // test for a parent to check if this is a collection entry - let collectionEntry: null | HTMLLIElement = null; - const parent = input.parentElement; - console.log("parent", parent); - if (null !== parent) { - const grandParent = parent.parentElement; - console.log("grandParent", grandParent); - if (null !== grandParent) { - if ( - grandParent.tagName.toLowerCase() === "li" && - grandParent.classList.contains("entry") - ) { - collectionEntry = grandParent as HTMLLIElement; - } - } + upload_inputs.forEach((input: HTMLDivElement): void => { + // test for a parent to check if this is a collection entry + let collectionEntry: null | HTMLLIElement = null; + const parent = input.parentElement; + console.log("parent", parent); + if (null !== parent) { + const grandParent = parent.parentElement; + console.log("grandParent", grandParent); + if (null !== grandParent) { + if ( + grandParent.tagName.toLowerCase() === "li" && + grandParent.classList.contains("entry") + ) { + collectionEntry = grandParent as HTMLLIElement; } - startApp(input, collectionEntry); - }); + } + } + startApp(input, collectionEntry); + }); }); export {}; diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/module/button_download/index.ts b/src/Bundle/ChillDocStoreBundle/Resources/public/module/button_download/index.ts index 30b9e29d1..4ab819ddf 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/module/button_download/index.ts +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/module/button_download/index.ts @@ -9,26 +9,26 @@ import ToastPlugin from "vue-toast-notification"; const i18n = _createI18n({}); window.addEventListener("DOMContentLoaded", function (e) { - document - .querySelectorAll("div[data-download-button-single]") - .forEach((el) => { - const storedObject = JSON.parse( - el.dataset.storedObject as string, - ) as StoredObject; - const title = el.dataset.title as string; - const app = createApp({ - components: { DownloadButton }, - data() { - return { - storedObject, - title, - classes: { btn: true, "btn-outline-primary": true }, - }; - }, - template: - '', - }); + document + .querySelectorAll("div[data-download-button-single]") + .forEach((el) => { + const storedObject = JSON.parse( + el.dataset.storedObject as string, + ) as StoredObject; + const title = el.dataset.title as string; + const app = createApp({ + components: { DownloadButton }, + data() { + return { + storedObject, + title, + classes: { btn: true, "btn-outline-primary": true }, + }; + }, + template: + '', + }); - app.use(i18n).use(ToastPlugin).mount(el); - }); + app.use(i18n).use(ToastPlugin).mount(el); + }); }); diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/module/document_action_buttons_group/index.ts b/src/Bundle/ChillDocStoreBundle/Resources/public/module/document_action_buttons_group/index.ts index 5874e88fe..080f63c66 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/module/document_action_buttons_group/index.ts +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/module/document_action_buttons_group/index.ts @@ -8,66 +8,66 @@ import ToastPlugin from "vue-toast-notification"; const i18n = _createI18n({}); window.addEventListener("DOMContentLoaded", function (e) { - document - .querySelectorAll("div[data-download-buttons]") - .forEach((el) => { - const app = createApp({ - components: { DocumentActionButtonsGroup }, - data() { - const datasets = el.dataset as { - filename: string; - canEdit: string; - storedObject: string; - buttonSmall: string; - davLink: string; - davLinkExpiration: string; - }; + document + .querySelectorAll("div[data-download-buttons]") + .forEach((el) => { + const app = createApp({ + components: { DocumentActionButtonsGroup }, + data() { + const datasets = el.dataset as { + filename: string; + canEdit: string; + storedObject: string; + buttonSmall: string; + davLink: string; + davLinkExpiration: string; + }; - const storedObject = JSON.parse( - datasets.storedObject, - ) as StoredObject, - filename = datasets.filename, - canEdit = datasets.canEdit === "1", - small = datasets.buttonSmall === "1", - davLink = - "davLink" in datasets && datasets.davLink !== "" - ? datasets.davLink - : null, - davLinkExpiration = - "davLinkExpiration" in datasets - ? Number.parseInt(datasets.davLinkExpiration) - : null; - return { - storedObject, - filename, - canEdit, - small, - davLink, - davLinkExpiration, - }; - }, - template: - '', - methods: { - onStoredObjectStatusChange: function ( - newStatus: StoredObjectStatusChange, - ): void { - this.$data.storedObject.status = newStatus.status; - this.$data.storedObject.filename = newStatus.filename; - this.$data.storedObject.type = newStatus.type; + const storedObject = JSON.parse( + datasets.storedObject, + ) as StoredObject, + filename = datasets.filename, + canEdit = datasets.canEdit === "1", + small = datasets.buttonSmall === "1", + davLink = + "davLink" in datasets && datasets.davLink !== "" + ? datasets.davLink + : null, + davLinkExpiration = + "davLinkExpiration" in datasets + ? Number.parseInt(datasets.davLinkExpiration) + : null; + return { + storedObject, + filename, + canEdit, + small, + davLink, + davLinkExpiration, + }; + }, + template: + '', + methods: { + onStoredObjectStatusChange: function ( + newStatus: StoredObjectStatusChange, + ): void { + this.$data.storedObject.status = newStatus.status; + this.$data.storedObject.filename = newStatus.filename; + this.$data.storedObject.type = newStatus.type; - // remove eventual div which inform pending status - document - .querySelectorAll( - `[data-docgen-is-pending="${this.$data.storedObject.id}"]`, - ) - .forEach(function (el) { - el.remove(); - }); - }, - }, - }); + // remove eventual div which inform pending status + document + .querySelectorAll( + `[data-docgen-is-pending="${this.$data.storedObject.id}"]`, + ) + .forEach(function (el) { + el.remove(); + }); + }, + }, + }); - app.use(i18n).use(ToastPlugin).mount(el); - }); + app.use(i18n).use(ToastPlugin).mount(el); + }); }); diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/types/generic_doc.ts b/src/Bundle/ChillDocStoreBundle/Resources/public/types/generic_doc.ts index facc55e58..9cda25cad 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/types/generic_doc.ts +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/types/generic_doc.ts @@ -2,7 +2,7 @@ import { DateTime } from "ChillMainAssets/types"; import { StoredObject } from "ChillDocStoreAssets/types/index"; export interface GenericDocMetadata { - isPresent: boolean; + isPresent: boolean; } /** @@ -15,57 +15,57 @@ export interface EmptyMetadata extends GenericDocMetadata {} * Minimal Metadata for a GenericDoc with a normalizer */ export interface BaseMetadata extends GenericDocMetadata { - title: string; + title: string; } /** * A generic doc is a document attached to a Person or an AccompanyingPeriod. */ export interface GenericDoc { - type: "doc_store_generic_doc"; - uniqueKey: string; - key: string; - identifiers: object; - context: "person" | "accompanying-period"; - doc_date: DateTime; - metadata: GenericDocMetadata; - storedObject: StoredObject | null; + type: "doc_store_generic_doc"; + uniqueKey: string; + key: string; + identifiers: object; + context: "person" | "accompanying-period"; + doc_date: DateTime; + metadata: GenericDocMetadata; + storedObject: StoredObject | null; } export interface GenericDocForAccompanyingPeriod extends GenericDoc { - context: "accompanying-period"; + context: "accompanying-period"; } interface BaseMetadataWithHtml extends BaseMetadata { - html: string; + html: string; } export interface GenericDocForAccompanyingCourseDocument - extends GenericDocForAccompanyingPeriod { - key: "accompanying_course_document"; - metadata: BaseMetadataWithHtml; + extends GenericDocForAccompanyingPeriod { + key: "accompanying_course_document"; + metadata: BaseMetadataWithHtml; } export interface GenericDocForAccompanyingCourseActivityDocument - extends GenericDocForAccompanyingPeriod { - key: "accompanying_course_activity_document"; - metadata: BaseMetadataWithHtml; + extends GenericDocForAccompanyingPeriod { + key: "accompanying_course_activity_document"; + metadata: BaseMetadataWithHtml; } export interface GenericDocForAccompanyingCourseCalendarDocument - extends GenericDocForAccompanyingPeriod { - key: "accompanying_course_calendar_document"; - metadata: BaseMetadataWithHtml; + extends GenericDocForAccompanyingPeriod { + key: "accompanying_course_calendar_document"; + metadata: BaseMetadataWithHtml; } export interface GenericDocForAccompanyingCoursePersonDocument - extends GenericDocForAccompanyingPeriod { - key: "person_document"; - metadata: BaseMetadataWithHtml; + extends GenericDocForAccompanyingPeriod { + key: "person_document"; + metadata: BaseMetadataWithHtml; } export interface GenericDocForAccompanyingCourseWorkEvaluationDocument - extends GenericDocForAccompanyingPeriod { - key: "accompanying_period_work_evaluation_document"; - metadata: BaseMetadataWithHtml; + extends GenericDocForAccompanyingPeriod { + key: "accompanying_period_work_evaluation_document"; + metadata: BaseMetadataWithHtml; } diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/types/index.ts b/src/Bundle/ChillDocStoreBundle/Resources/public/types/index.ts index 5b34b8f73..f71ed0350 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/types/index.ts +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/types/index.ts @@ -4,73 +4,73 @@ import { SignedUrlGet } from "ChillDocStoreAssets/vuejs/StoredObjectButton/helpe export type StoredObjectStatus = "empty" | "ready" | "failure" | "pending"; export interface StoredObject { - id: number; - title: string | null; - uuid: string; - prefix: string; - status: StoredObjectStatus; - currentVersion: - | null - | StoredObjectVersionCreated - | StoredObjectVersionPersisted; - totalVersions: number; - datas: object; - /** @deprecated */ - creationDate: DateTime; - createdAt: DateTime | null; - createdBy: User | null; - _permissions: { - canEdit: boolean; - canSee: boolean; - }; - _links?: { - dav_link?: { - href: string; - expiration: number; - }; - downloadLink?: SignedUrlGet; + id: number; + title: string | null; + uuid: string; + prefix: string; + status: StoredObjectStatus; + currentVersion: + | null + | StoredObjectVersionCreated + | StoredObjectVersionPersisted; + totalVersions: number; + datas: object; + /** @deprecated */ + creationDate: DateTime; + createdAt: DateTime | null; + createdBy: User | null; + _permissions: { + canEdit: boolean; + canSee: boolean; + }; + _links?: { + dav_link?: { + href: string; + expiration: number; }; + downloadLink?: SignedUrlGet; + }; } export interface StoredObjectVersion { - /** - * filename of the object in the object storage - */ - filename: string; - iv: number[]; - keyInfos: JsonWebKey; - type: string; + /** + * filename of the object in the object storage + */ + filename: string; + iv: number[]; + keyInfos: JsonWebKey; + type: string; } export interface StoredObjectVersionCreated extends StoredObjectVersion { - persisted: false; + persisted: false; } export interface StoredObjectVersionPersisted - extends StoredObjectVersionCreated { - version: number; - id: number; - createdAt: DateTime | null; - createdBy: User | null; + extends StoredObjectVersionCreated { + version: number; + id: number; + createdAt: DateTime | null; + createdBy: User | null; } export interface StoredObjectStatusChange { - id: number; - filename: string; - status: StoredObjectStatus; - type: string; + id: number; + filename: string; + status: StoredObjectStatus; + type: string; } export interface StoredObjectVersionWithPointInTime - extends StoredObjectVersionPersisted { - "point-in-times": StoredObjectPointInTime[]; - "from-restored": StoredObjectVersionPersisted | null; + extends StoredObjectVersionPersisted { + "point-in-times": StoredObjectPointInTime[]; + "from-restored": StoredObjectVersionPersisted | null; } export interface StoredObjectPointInTime { - id: number; - byUser: User | null; - reason: "keep-before-conversion" | "keep-by-user"; + id: number; + byUser: User | null; + reason: "keep-before-conversion" | "keep-by-user"; } /** @@ -82,63 +82,63 @@ export type WopiEditButtonExecutableBeforeLeaveFunction = () => Promise; * Object containing information for performering a POST request to a swift object store */ export interface PostStoreObjectSignature { - method: "POST"; - max_file_size: number; - max_file_count: 1; - expires: number; - submit_delay: 180; - redirect: string; - prefix: string; - url: string; - signature: string; + method: "POST"; + max_file_size: number; + max_file_count: 1; + expires: number; + submit_delay: 180; + redirect: string; + prefix: string; + url: string; + signature: string; } export interface PDFPage { - index: number; - width: number; - height: number; + index: number; + width: number; + height: number; } export interface SignatureZone { - index: number | null; - x: number; - y: number; - width: number; - height: number; - PDFPage: PDFPage; + index: number | null; + x: number; + y: number; + width: number; + height: number; + PDFPage: PDFPage; } export interface Signature { - id: number; - storedObject: StoredObject; - zones: SignatureZone[]; + id: number; + storedObject: StoredObject; + zones: SignatureZone[]; } export type SignedState = - | "pending" - | "signed" - | "rejected" - | "canceled" - | "error"; + | "pending" + | "signed" + | "rejected" + | "canceled" + | "error"; export interface CheckSignature { - state: SignedState; - storedObject: StoredObject; + state: SignedState; + storedObject: StoredObject; } export type CanvasEvent = "select" | "add"; export interface ZoomLevel { - id: number; - zoom: number; - label: { - fr?: string; - nl?: string; - }; + id: number; + zoom: number; + label: { + fr?: string; + nl?: string; + }; } export interface GenericDoc { - type: "doc_store_generic_doc"; - key: string; - context: "person" | "accompanying-period"; - doc_date: DateTime; + type: "doc_store_generic_doc"; + key: string; + context: "person" | "accompanying-period"; + doc_date: DateTime; } diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentActionButtonsGroup.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentActionButtonsGroup.vue index 85548f6d3..8fd348807 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentActionButtonsGroup.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentActionButtonsGroup.vue @@ -1,67 +1,65 @@ diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/App.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/App.vue index ea195da4b..3021de36e 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/App.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/App.vue @@ -1,355 +1,338 @@ diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/index.ts b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/index.ts index a46257b5e..e3ace5b40 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/index.ts +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/index.ts @@ -4,36 +4,36 @@ import { _createI18n } from "ChillMainAssets/vuejs/_js/i18n"; import App from "./App.vue"; const appMessages = { - fr: { - yes: "Oui", - are_you_sure: "Êtes-vous sûr·e?", - you_are_going_to_sign: "Vous allez signer le document", - signature_confirmation: "Confirmation de la signature", - sign: "Signer", - choose_another_signature: "Choisir une autre zone", - cancel: "Annuler", - last_sign_zone: "Zone de signature précédente", - next_sign_zone: "Zone de signature suivante", - add_sign_zone: "Ajouter une zone de signature", - click_on_document: "Cliquer sur le document", - last_zone: "Zone précédente", - next_zone: "Zone suivante", - add_zone: "Ajouter une zone", - another_zone: "Autre zone", - electronic_signature_in_progress: "Signature électronique en cours...", - loading: "Chargement...", - remove_sign_zone: "Enlever la zone", - return: "Retour", - see_all_pages: "Voir toutes les pages", - all_pages: "Toutes les pages", - }, + fr: { + yes: "Oui", + are_you_sure: "Êtes-vous sûr·e?", + you_are_going_to_sign: "Vous allez signer le document", + signature_confirmation: "Confirmation de la signature", + sign: "Signer", + choose_another_signature: "Choisir une autre zone", + cancel: "Annuler", + last_sign_zone: "Zone de signature précédente", + next_sign_zone: "Zone de signature suivante", + add_sign_zone: "Ajouter une zone de signature", + click_on_document: "Cliquer sur le document", + last_zone: "Zone précédente", + next_zone: "Zone suivante", + add_zone: "Ajouter une zone", + another_zone: "Autre zone", + electronic_signature_in_progress: "Signature électronique en cours...", + loading: "Chargement...", + remove_sign_zone: "Enlever la zone", + return: "Retour", + see_all_pages: "Voir toutes les pages", + all_pages: "Toutes les pages", + }, }; const i18n = _createI18n(appMessages); const app = createApp({ - template: ``, + template: ``, }) - .use(i18n) - .component("app", App) - .mount("#document-signature"); + .use(i18n) + .component("app", App) + .mount("#document-signature"); diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFile.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFile.vue index 017629ee4..c731ef19f 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFile.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFile.vue @@ -1,208 +1,206 @@ diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFileModal.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFileModal.vue index 956b3e859..bde094487 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFileModal.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFileModal.vue @@ -6,24 +6,24 @@ import { computed, reactive } from "vue"; import { useToast } from "vue-toast-notification"; interface DropFileConfig { - allowRemove: boolean; - existingDoc?: StoredObject; + allowRemove: boolean; + existingDoc?: StoredObject; } const props = withDefaults(defineProps(), { - allowRemove: false, + allowRemove: false, }); const emit = defineEmits<{ - ( - e: "addDocument", - { - stored_object: StoredObject, - stored_object_version: StoredObjectVersion, - file_name: string, - }, - ): void; - (e: "removeDocument"): void; + ( + e: "addDocument", + { + stored_object: StoredObject, + stored_object_version: StoredObjectVersion, + file_name: string, + }, + ): void; + (e: "removeDocument"): void; }>(); const $toast = useToast(); @@ -33,67 +33,67 @@ const state = reactive({ showModal: false }); const modalClasses = { "modal-dialog-centered": true, "modal-md": true }; const buttonState = computed<"add" | "replace">(() => { - if (props.existingDoc === undefined || props.existingDoc === null) { - return "add"; - } + if (props.existingDoc === undefined || props.existingDoc === null) { + return "add"; + } - return "replace"; + return "replace"; }); function onAddDocument({ - stored_object, - stored_object_version, - file_name, + stored_object, + stored_object_version, + file_name, }: { - stored_object: StoredObject; - stored_object_version: StoredObjectVersion; - file_name: string; + stored_object: StoredObject; + stored_object_version: StoredObjectVersion; + file_name: string; }): void { - const message = - buttonState.value === "add" ? "Document ajouté" : "Document remplacé"; - $toast.success(message); - emit("addDocument", { stored_object_version, stored_object, file_name }); - state.showModal = false; + const message = + buttonState.value === "add" ? "Document ajouté" : "Document remplacé"; + $toast.success(message); + emit("addDocument", { stored_object_version, stored_object, file_name }); + state.showModal = false; } function onRemoveDocument(): void { - emit("removeDocument"); + emit("removeDocument"); } function openModal(): void { - state.showModal = true; + state.showModal = true; } function closeModal(): void { - state.showModal = false; + state.showModal = false; } diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFileWidget.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFileWidget.vue index 54f8ddf0c..8ead08b45 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFileWidget.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFileWidget.vue @@ -5,97 +5,97 @@ import DropFile from "ChillDocStoreAssets/vuejs/DropFileWidget/DropFile.vue"; import DocumentActionButtonsGroup from "ChillDocStoreAssets/vuejs/DocumentActionButtonsGroup.vue"; interface DropFileConfig { - allowRemove: boolean; - existingDoc?: StoredObject; + allowRemove: boolean; + existingDoc?: StoredObject; } const props = withDefaults(defineProps(), { - allowRemove: false, + allowRemove: false, }); const emit = defineEmits<{ - ( - e: "addDocument", - { - stored_object: StoredObject, - stored_object_version: StoredObjectVersion, - file_name: string, - }, - ): void; - (e: "removeDocument"): void; + ( + e: "addDocument", + { + stored_object: StoredObject, + stored_object_version: StoredObjectVersion, + file_name: string, + }, + ): void; + (e: "removeDocument"): void; }>(); const has_existing_doc = computed(() => { - return props.existingDoc !== undefined && props.existingDoc !== null; + return props.existingDoc !== undefined && props.existingDoc !== null; }); const dav_link_expiration = computed(() => { - if (props.existingDoc === undefined || props.existingDoc === null) { - return undefined; - } - if (props.existingDoc.status !== "ready") { - return undefined; - } + if (props.existingDoc === undefined || props.existingDoc === null) { + return undefined; + } + if (props.existingDoc.status !== "ready") { + return undefined; + } - return props.existingDoc._links?.dav_link?.expiration; + return props.existingDoc._links?.dav_link?.expiration; }); const dav_link_href = computed(() => { - if (props.existingDoc === undefined || props.existingDoc === null) { - return undefined; - } - if (props.existingDoc.status !== "ready") { - return undefined; - } + if (props.existingDoc === undefined || props.existingDoc === null) { + return undefined; + } + if (props.existingDoc.status !== "ready") { + return undefined; + } - return props.existingDoc._links?.dav_link?.href; + return props.existingDoc._links?.dav_link?.href; }); const onAddDocument = ({ - stored_object, - stored_object_version, - file_name, + stored_object, + stored_object_version, + file_name, }: { - stored_object: StoredObject; - stored_object_version: StoredObjectVersion; - file_name: string; + stored_object: StoredObject; + stored_object_version: StoredObjectVersion; + file_name: string; }): void => { - emit("addDocument", { stored_object, stored_object_version, file_name }); + emit("addDocument", { stored_object, stored_object_version, file_name }); }; const onRemoveDocument = (e: Event): void => { - e.stopPropagation(); - e.preventDefault(); - emit("removeDocument"); + e.stopPropagation(); + e.preventDefault(); + emit("removeDocument"); }; diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/FileIcon.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/FileIcon.vue index 5260095fa..ba2c44f6a 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/FileIcon.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/FileIcon.vue @@ -1,46 +1,46 @@ diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/ConvertButton.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/ConvertButton.vue index b6c6a496f..8cb60bc12 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/ConvertButton.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/ConvertButton.vue @@ -1,28 +1,28 @@ diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/DesktopEditButton.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/DesktopEditButton.vue index 2b74f76bd..f00889a8e 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/DesktopEditButton.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/DesktopEditButton.vue @@ -3,13 +3,13 @@ import Modal from "ChillMainAssets/vuejs/_components/Modal.vue"; import { computed, reactive } from "vue"; export interface DesktopEditButtonConfig { - editLink: null; - classes: Record; - expirationLink: number | Date; + editLink: null; + classes: Record; + expirationLink: number | Date; } interface DesktopEditButtonState { - modalOpened: boolean; + modalOpened: boolean; } const state: DesktopEditButtonState = reactive({ modalOpened: false }); @@ -17,80 +17,76 @@ const state: DesktopEditButtonState = reactive({ modalOpened: false }); const props = defineProps(); const buildCommand = computed( - () => "vnd.libreoffice.command:ofe|u|" + props.editLink, + () => "vnd.libreoffice.command:ofe|u|" + props.editLink, ); const editionUntilFormatted = computed(() => { - let d; + let d; - if (props.expirationLink instanceof Date) { - d = props.expirationLink; - } else { - d = new Date(props.expirationLink * 1000); - } - console.log(props.expirationLink); + if (props.expirationLink instanceof Date) { + d = props.expirationLink; + } else { + d = new Date(props.expirationLink * 1000); + } + console.log(props.expirationLink); - return new Intl.DateTimeFormat(undefined, { - dateStyle: "long", - timeStyle: "medium", - }).format(d); + return new Intl.DateTimeFormat(undefined, { + dateStyle: "long", + timeStyle: "medium", + }).format(d); }); diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/DownloadButton.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/DownloadButton.vue index d28b49cdf..8316229ce 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/DownloadButton.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/DownloadButton.vue @@ -1,26 +1,26 @@ diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton.vue index 71a8d42ea..f8c1c4ead 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton.vue @@ -1,20 +1,20 @@ diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/HistoryButtonList.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/HistoryButtonList.vue index ac4bf4591..cf70e3db3 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/HistoryButtonList.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/HistoryButtonList.vue @@ -1,26 +1,26 @@ diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/HistoryButtonListItem.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/HistoryButtonListItem.vue index bf5e3fffb..2a563d853 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/HistoryButtonListItem.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/HistoryButtonListItem.vue @@ -1,8 +1,8 @@ diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/HistoryButtonModal.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/HistoryButtonModal.vue index b9535ca2e..0d9a951e5 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/HistoryButtonModal.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/HistoryButtonModal.vue @@ -3,54 +3,54 @@ import Modal from "ChillMainAssets/vuejs/_components/Modal.vue"; import { reactive } from "vue"; import HistoryButtonList from "ChillDocStoreAssets/vuejs/StoredObjectButton/HistoryButton/HistoryButtonList.vue"; import { - StoredObject, - StoredObjectVersionWithPointInTime, + StoredObject, + StoredObjectVersionWithPointInTime, } from "./../../../types"; interface HistoryButtonListConfig { - versions: StoredObjectVersionWithPointInTime[]; - storedObject: StoredObject; - canEdit: boolean; + versions: StoredObjectVersionWithPointInTime[]; + storedObject: StoredObject; + canEdit: boolean; } const emit = defineEmits<{ - restoreVersion: [newVersion: StoredObjectVersionWithPointInTime]; + restoreVersion: [newVersion: StoredObjectVersionWithPointInTime]; }>(); interface HistoryButtonModalState { - opened: boolean; + opened: boolean; } const props = defineProps(); const state = reactive({ opened: false }); const open = () => { - state.opened = true; + state.opened = true; }; const onRestoreVersion = (payload: { - newVersion: StoredObjectVersionWithPointInTime; + newVersion: StoredObjectVersionWithPointInTime; }) => emit("restoreVersion", payload); defineExpose({ open }); diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/RestoreVersionButton.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/RestoreVersionButton.vue index 41ae8e978..595d3781a 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/RestoreVersionButton.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/RestoreVersionButton.vue @@ -1,17 +1,17 @@ diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/api.ts b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/api.ts index cb7581eab..b003e26b7 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/api.ts +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/api.ts @@ -1,33 +1,33 @@ import { - StoredObject, - StoredObjectVersionPersisted, - StoredObjectVersionWithPointInTime, + StoredObject, + StoredObjectVersionPersisted, + StoredObjectVersionWithPointInTime, } from "../../../types"; import { - fetchResults, - makeFetch, + fetchResults, + makeFetch, } from "../../../../../../ChillMainBundle/Resources/public/lib/api/apiMethods"; export const get_versions = async ( - storedObject: StoredObject, + storedObject: StoredObject, ): Promise => { - const versions = await fetchResults( - `/api/1.0/doc-store/stored-object/${storedObject.uuid}/versions`, - ); + const versions = await fetchResults( + `/api/1.0/doc-store/stored-object/${storedObject.uuid}/versions`, + ); - return versions.sort( - ( - a: StoredObjectVersionWithPointInTime, - b: StoredObjectVersionWithPointInTime, - ) => b.version - a.version, - ); + return versions.sort( + ( + a: StoredObjectVersionWithPointInTime, + b: StoredObjectVersionWithPointInTime, + ) => b.version - a.version, + ); }; export const restore_version = async ( - version: StoredObjectVersionPersisted, + version: StoredObjectVersionPersisted, ): Promise => { - return await makeFetch( - "POST", - `/api/1.0/doc-store/stored-object/restore-from-version/${version.id}`, - ); + return await makeFetch( + "POST", + `/api/1.0/doc-store/stored-object/restore-from-version/${version.id}`, + ); }; diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/WopiEditButton.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/WopiEditButton.vue index b57c1f188..97073e4e1 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/WopiEditButton.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/WopiEditButton.vue @@ -1,29 +1,27 @@ diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/helpers.ts b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/helpers.ts index ff1e6219d..aceaa038b 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/helpers.ts +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/helpers.ts @@ -1,235 +1,230 @@ import { - StoredObject, - StoredObjectStatus, - StoredObjectStatusChange, - StoredObjectVersion, + StoredObject, + StoredObjectStatus, + StoredObjectStatusChange, + StoredObjectVersion, } from "../../types"; import { makeFetch } from "../../../../../ChillMainBundle/Resources/public/lib/api/apiMethods"; const MIMES_EDIT = new Set([ - "application/vnd.ms-powerpoint", - "application/vnd.ms-excel", - "application/vnd.oasis.opendocument.text", - "application/vnd.oasis.opendocument.text-flat-xml", - "application/vnd.oasis.opendocument.spreadsheet", - "application/vnd.oasis.opendocument.spreadsheet-flat-xml", - "application/vnd.oasis.opendocument.presentation", - "application/vnd.oasis.opendocument.presentation-flat-xml", - "application/vnd.oasis.opendocument.graphics", - "application/vnd.oasis.opendocument.graphics-flat-xml", - "application/vnd.oasis.opendocument.chart", - "application/msword", - "application/vnd.ms-excel", - "application/vnd.ms-powerpoint", - "application/vnd.openxmlformats-officedocument.wordprocessingml.document", - "application/vnd.ms-word.document.macroEnabled.12", - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", - "application/vnd.ms-excel.sheet.binary.macroEnabled.12", - "application/vnd.ms-excel.sheet.macroEnabled.12", - "application/vnd.openxmlformats-officedocument.presentationml.presentation", - "application/vnd.ms-powerpoint.presentation.macroEnabled.12", - "application/x-dif-document", - "text/spreadsheet", - "text/csv", - "application/x-dbase", - "text/rtf", - "text/plain", - "application/vnd.openxmlformats-officedocument.presentationml.slideshow", + "application/vnd.ms-powerpoint", + "application/vnd.ms-excel", + "application/vnd.oasis.opendocument.text", + "application/vnd.oasis.opendocument.text-flat-xml", + "application/vnd.oasis.opendocument.spreadsheet", + "application/vnd.oasis.opendocument.spreadsheet-flat-xml", + "application/vnd.oasis.opendocument.presentation", + "application/vnd.oasis.opendocument.presentation-flat-xml", + "application/vnd.oasis.opendocument.graphics", + "application/vnd.oasis.opendocument.graphics-flat-xml", + "application/vnd.oasis.opendocument.chart", + "application/msword", + "application/vnd.ms-excel", + "application/vnd.ms-powerpoint", + "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "application/vnd.ms-word.document.macroEnabled.12", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "application/vnd.ms-excel.sheet.binary.macroEnabled.12", + "application/vnd.ms-excel.sheet.macroEnabled.12", + "application/vnd.openxmlformats-officedocument.presentationml.presentation", + "application/vnd.ms-powerpoint.presentation.macroEnabled.12", + "application/x-dif-document", + "text/spreadsheet", + "text/csv", + "application/x-dbase", + "text/rtf", + "text/plain", + "application/vnd.openxmlformats-officedocument.presentationml.slideshow", ]); const MIMES_VIEW = new Set([ - ...MIMES_EDIT, - [ - "image/svg+xml", - "application/vnd.sun.xml.writer", - "application/vnd.sun.xml.calc", - "application/vnd.sun.xml.impress", - "application/vnd.sun.xml.draw", - "application/vnd.sun.xml.writer.global", - "application/vnd.sun.xml.writer.template", - "application/vnd.sun.xml.calc.template", - "application/vnd.sun.xml.impress.template", - "application/vnd.sun.xml.draw.template", - "application/vnd.oasis.opendocument.text-master", - "application/vnd.oasis.opendocument.text-template", - "application/vnd.oasis.opendocument.text-master-template", - "application/vnd.oasis.opendocument.spreadsheet-template", - "application/vnd.oasis.opendocument.presentation-template", - "application/vnd.oasis.opendocument.graphics-template", - "application/vnd.ms-word.template.macroEnabled.12", - "application/vnd.openxmlformats-officedocument.spreadsheetml.template", - "application/vnd.ms-excel.template.macroEnabled.12", - "application/vnd.openxmlformats-officedocument.presentationml.template", - "application/vnd.ms-powerpoint.template.macroEnabled.12", - "application/vnd.wordperfect", - "application/x-aportisdoc", - "application/x-hwp", - "application/vnd.ms-works", - "application/x-mswrite", - "application/vnd.lotus-1-2-3", - "image/cgm", - "image/vnd.dxf", - "image/x-emf", - "image/x-wmf", - "application/coreldraw", - "application/vnd.visio2013", - "application/vnd.visio", - "application/vnd.ms-visio.drawing", - "application/x-mspublisher", - "application/x-sony-bbeb", - "application/x-gnumeric", - "application/macwriteii", - "application/x-iwork-numbers-sffnumbers", - "application/vnd.oasis.opendocument.text-web", - "application/x-pagemaker", - "application/x-fictionbook+xml", - "application/clarisworks", - "image/x-wpg", - "application/x-iwork-pages-sffpages", - "application/x-iwork-keynote-sffkey", - "application/x-abiword", - "image/x-freehand", - "application/vnd.sun.xml.chart", - "application/x-t602", - "image/bmp", - "image/png", - "image/gif", - "image/tiff", - "image/jpg", - "image/jpeg", - "application/pdf", - ], + ...MIMES_EDIT, + [ + "image/svg+xml", + "application/vnd.sun.xml.writer", + "application/vnd.sun.xml.calc", + "application/vnd.sun.xml.impress", + "application/vnd.sun.xml.draw", + "application/vnd.sun.xml.writer.global", + "application/vnd.sun.xml.writer.template", + "application/vnd.sun.xml.calc.template", + "application/vnd.sun.xml.impress.template", + "application/vnd.sun.xml.draw.template", + "application/vnd.oasis.opendocument.text-master", + "application/vnd.oasis.opendocument.text-template", + "application/vnd.oasis.opendocument.text-master-template", + "application/vnd.oasis.opendocument.spreadsheet-template", + "application/vnd.oasis.opendocument.presentation-template", + "application/vnd.oasis.opendocument.graphics-template", + "application/vnd.ms-word.template.macroEnabled.12", + "application/vnd.openxmlformats-officedocument.spreadsheetml.template", + "application/vnd.ms-excel.template.macroEnabled.12", + "application/vnd.openxmlformats-officedocument.presentationml.template", + "application/vnd.ms-powerpoint.template.macroEnabled.12", + "application/vnd.wordperfect", + "application/x-aportisdoc", + "application/x-hwp", + "application/vnd.ms-works", + "application/x-mswrite", + "application/vnd.lotus-1-2-3", + "image/cgm", + "image/vnd.dxf", + "image/x-emf", + "image/x-wmf", + "application/coreldraw", + "application/vnd.visio2013", + "application/vnd.visio", + "application/vnd.ms-visio.drawing", + "application/x-mspublisher", + "application/x-sony-bbeb", + "application/x-gnumeric", + "application/macwriteii", + "application/x-iwork-numbers-sffnumbers", + "application/vnd.oasis.opendocument.text-web", + "application/x-pagemaker", + "application/x-fictionbook+xml", + "application/clarisworks", + "image/x-wpg", + "application/x-iwork-pages-sffpages", + "application/x-iwork-keynote-sffkey", + "application/x-abiword", + "image/x-freehand", + "application/vnd.sun.xml.chart", + "application/x-t602", + "image/bmp", + "image/png", + "image/gif", + "image/tiff", + "image/jpg", + "image/jpeg", + "application/pdf", + ], ]); export interface SignedUrlGet { - method: "GET" | "HEAD"; - url: string; - expires: number; - object_name: string; + method: "GET" | "HEAD"; + url: string; + expires: number; + object_name: string; } function is_extension_editable(mimeType: string): boolean { - return MIMES_EDIT.has(mimeType); + return MIMES_EDIT.has(mimeType); } function is_extension_viewable(mimeType: string): boolean { - return MIMES_VIEW.has(mimeType); + return MIMES_VIEW.has(mimeType); } function build_convert_link(uuid: string) { - return `/chill/wopi/convert/${uuid}`; + return `/chill/wopi/convert/${uuid}`; } function build_download_info_link( - storedObject: StoredObject, - atVersion: null | StoredObjectVersion, + storedObject: StoredObject, + atVersion: null | StoredObjectVersion, ): string { - const url = `/api/1.0/doc-store/async-upload/temp_url/${storedObject.uuid}/generate/get`; + const url = `/api/1.0/doc-store/async-upload/temp_url/${storedObject.uuid}/generate/get`; - if (null !== atVersion) { - const params = new URLSearchParams({ version: atVersion.filename }); + if (null !== atVersion) { + const params = new URLSearchParams({ version: atVersion.filename }); - return url + "?" + params.toString(); - } + return url + "?" + params.toString(); + } - return url; + return url; } async function download_info_link( - storedObject: StoredObject, - atVersion: null | StoredObjectVersion, + storedObject: StoredObject, + atVersion: null | StoredObjectVersion, ): Promise { - return makeFetch("GET", build_download_info_link(storedObject, atVersion)); + return makeFetch("GET", build_download_info_link(storedObject, atVersion)); } function build_wopi_editor_link(uuid: string, returnPath?: string) { - if (returnPath === undefined) { - returnPath = - window.location.pathname + - window.location.search + - window.location.hash; - } + if (returnPath === undefined) { + returnPath = + window.location.pathname + window.location.search + window.location.hash; + } - return ( - `/chill/wopi/edit/${uuid}?returnPath=` + encodeURIComponent(returnPath) - ); + return ( + `/chill/wopi/edit/${uuid}?returnPath=` + encodeURIComponent(returnPath) + ); } function download_doc(url: string): Promise { - return window.fetch(url).then((r) => { - if (r.ok) { - return r.blob(); - } + return window.fetch(url).then((r) => { + if (r.ok) { + return r.blob(); + } - throw new Error("Could not download document"); - }); + throw new Error("Could not download document"); + }); } async function download_and_decrypt_doc( - storedObject: StoredObject, - atVersion: null | StoredObjectVersion, + storedObject: StoredObject, + atVersion: null | StoredObjectVersion, ): Promise { - const algo = "AES-CBC"; + const algo = "AES-CBC"; - const atVersionToDownload = atVersion ?? storedObject.currentVersion; + const atVersionToDownload = atVersion ?? storedObject.currentVersion; - if (null === atVersionToDownload) { - throw new Error("no version associated to stored object"); - } + if (null === atVersionToDownload) { + throw new Error("no version associated to stored object"); + } - // sometimes, the downloadInfo may be embedded into the storedObject - console.log("storedObject", storedObject); - let downloadInfo; - if ( - typeof storedObject._links !== "undefined" && - typeof storedObject._links.downloadLink !== "undefined" - ) { - downloadInfo = storedObject._links.downloadLink; - } else { - downloadInfo = await download_info_link( - storedObject, - atVersionToDownload, - ); - } + // sometimes, the downloadInfo may be embedded into the storedObject + console.log("storedObject", storedObject); + let downloadInfo; + if ( + typeof storedObject._links !== "undefined" && + typeof storedObject._links.downloadLink !== "undefined" + ) { + downloadInfo = storedObject._links.downloadLink; + } else { + downloadInfo = await download_info_link(storedObject, atVersionToDownload); + } - const rawResponse = await window.fetch(downloadInfo.url); + const rawResponse = await window.fetch(downloadInfo.url); - if (!rawResponse.ok) { - throw new Error( - "error while downloading raw file " + - rawResponse.status + - " " + - rawResponse.statusText, - ); - } + if (!rawResponse.ok) { + throw new Error( + "error while downloading raw file " + + rawResponse.status + + " " + + rawResponse.statusText, + ); + } - if (atVersionToDownload.iv.length === 0) { - return rawResponse.blob(); - } + if (atVersionToDownload.iv.length === 0) { + return rawResponse.blob(); + } - const rawBuffer = await rawResponse.arrayBuffer(); - try { - const key = await window.crypto.subtle.importKey( - "jwk", - atVersionToDownload.keyInfos, - { name: algo }, - false, - ["decrypt"], - ); - const iv = Uint8Array.from(atVersionToDownload.iv); - const decrypted = await window.crypto.subtle.decrypt( - { name: algo, iv: iv }, - key, - rawBuffer, - ); + const rawBuffer = await rawResponse.arrayBuffer(); + try { + const key = await window.crypto.subtle.importKey( + "jwk", + atVersionToDownload.keyInfos, + { name: algo }, + false, + ["decrypt"], + ); + const iv = Uint8Array.from(atVersionToDownload.iv); + const decrypted = await window.crypto.subtle.decrypt( + { name: algo, iv: iv }, + key, + rawBuffer, + ); - return Promise.resolve(new Blob([decrypted])); - } catch (e) { - console.error("encounter error while keys and decrypt operations"); - console.error(e); + return Promise.resolve(new Blob([decrypted])); + } catch (e) { + console.error("encounter error while keys and decrypt operations"); + console.error(e); - throw e; - } + throw e; + } } /** @@ -239,48 +234,45 @@ async function download_and_decrypt_doc( * storage. */ async function download_doc_as_pdf(storedObject: StoredObject): Promise { - if (null === storedObject.currentVersion) { - throw new Error("the stored object does not count any version"); - } + if (null === storedObject.currentVersion) { + throw new Error("the stored object does not count any version"); + } - if (storedObject.currentVersion?.type === "application/pdf") { - return download_and_decrypt_doc( - storedObject, - storedObject.currentVersion, - ); - } + if (storedObject.currentVersion?.type === "application/pdf") { + return download_and_decrypt_doc(storedObject, storedObject.currentVersion); + } - const convertLink = build_convert_link(storedObject.uuid); - const response = await fetch(convertLink); + const convertLink = build_convert_link(storedObject.uuid); + const response = await fetch(convertLink); - if (!response.ok) { - throw new Error("Could not convert the document: " + response.status); - } + if (!response.ok) { + throw new Error("Could not convert the document: " + response.status); + } - return response.blob(); + return response.blob(); } async function is_object_ready( - storedObject: StoredObject, + storedObject: StoredObject, ): Promise { - const new_status_response = await window.fetch( - `/api/1.0/doc-store/stored-object/${storedObject.uuid}/is-ready`, - ); + const new_status_response = await window.fetch( + `/api/1.0/doc-store/stored-object/${storedObject.uuid}/is-ready`, + ); - if (!new_status_response.ok) { - throw new Error("could not fetch the new status"); - } + if (!new_status_response.ok) { + throw new Error("could not fetch the new status"); + } - return await new_status_response.json(); + return await new_status_response.json(); } export { - build_convert_link, - build_wopi_editor_link, - download_and_decrypt_doc, - download_doc, - download_doc_as_pdf, - is_extension_editable, - is_extension_viewable, - is_object_ready, + build_convert_link, + build_wopi_editor_link, + download_and_decrypt_doc, + download_doc, + download_doc_as_pdf, + is_extension_editable, + is_extension_viewable, + is_object_ready, }; diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index 8a31779f9..3325a9c83 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -613,4 +613,14 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter return $this; } + + /** + * Check if the current object is an instance of User. + * + * @return bool returns true if the current object is an instance of User, false otherwise + */ + public function isUser(): bool + { + return true; + } } diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php index 27ee7f44c..b8105fe5f 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php @@ -27,6 +27,8 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Contracts\Translation\TranslatableInterface; use Symfony\Contracts\Translation\TranslatorInterface; +// command to get the report with curl : curl --user "center a_social:password" "http://localhost:8000/fr/exports/generate/count_person?export[filters][person_gender_filter][enabled]=&export[filters][person_nationality_filter][enabled]=&export[filters][person_nationality_filter][form][nationalities]=&export[aggregators][person_nationality_aggregator][order]=1&export[aggregators][person_nationality_aggregator][form][group_by_level]=country&export[submit]=&export[_token]=RHpjHl389GrK-bd6iY5NsEqrD5UKOTHH40QKE9J1edU" --globoff + /** * Create a CSV List for the export. */ diff --git a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php index a73c3c71c..8a7574ac0 100644 --- a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php +++ b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php @@ -76,6 +76,24 @@ final class PhonenumberHelper implements PhoneNumberHelperInterface ->formatOutOfCountryCallingNumber($phoneNumber, $this->config['default_carrier_code']); } + /** + * @throws NumberParseException + */ + public function parse(string $phoneNumber): PhoneNumber + { + $sanitizedPhoneNumber = $phoneNumber; + + if (str_starts_with($sanitizedPhoneNumber, '00')) { + $sanitizedPhoneNumber = '+'.substr($sanitizedPhoneNumber, 2, null); + } + + if (!str_starts_with($sanitizedPhoneNumber, '+') && !str_starts_with($sanitizedPhoneNumber, '0')) { + $sanitizedPhoneNumber = '+'.$sanitizedPhoneNumber; + } + + return $this->phoneNumberUtil->parse($sanitizedPhoneNumber, $this->config['default_carrier_code']); + } + /** * Get type (mobile, landline, ...) for phone number. */ diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/js/date.ts b/src/Bundle/ChillMainBundle/Resources/public/chill/js/date.ts index 8a0d7cce0..233d802a0 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/js/date.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/js/date.ts @@ -13,15 +13,15 @@ * */ export const dateToISO = (date: Date | null): string | null => { - if (null === date) { - return null; - } + if (null === date) { + return null; + } - return [ - date.getFullYear(), - (date.getMonth() + 1).toString().padStart(2, "0"), - date.getDate().toString().padStart(2, "0"), - ].join("-"); + return [ + date.getFullYear(), + (date.getMonth() + 1).toString().padStart(2, "0"), + date.getDate().toString().padStart(2, "0"), + ].join("-"); }; /** @@ -30,16 +30,16 @@ export const dateToISO = (date: Date | null): string | null => { * **Experimental** */ export const ISOToDate = (str: string | null): Date | null => { - if (null === str) { - return null; - } - if ("" === str.trim()) { - return null; - } + if (null === str) { + return null; + } + if ("" === str.trim()) { + return null; + } - const [year, month, day] = str.split("-").map((p) => parseInt(p)); + const [year, month, day] = str.split("-").map((p) => parseInt(p)); - return new Date(year, month - 1, day, 0, 0, 0, 0); + return new Date(year, month - 1, day, 0, 0, 0, 0); }; /** @@ -47,21 +47,19 @@ export const ISOToDate = (str: string | null): Date | null => { * */ export const ISOToDatetime = (str: string | null): Date | null => { - if (null === str) { - return null; - } + if (null === str) { + return null; + } - const [cal, times] = str.split("T"), - [year, month, date] = cal.split("-").map((s) => parseInt(s)), - [time, timezone] = times.split(times.charAt(8)), - [hours, minutes, seconds] = time.split(":").map((s) => parseInt(s)); - if ("0000" === timezone) { - return new Date( - Date.UTC(year, month - 1, date, hours, minutes, seconds), - ); - } + const [cal, times] = str.split("T"), + [year, month, date] = cal.split("-").map((s) => parseInt(s)), + [time, timezone] = times.split(times.charAt(8)), + [hours, minutes, seconds] = time.split(":").map((s) => parseInt(s)); + if ("0000" === timezone) { + return new Date(Date.UTC(year, month - 1, date, hours, minutes, seconds)); + } - return new Date(year, month - 1, date, hours, minutes, seconds); + return new Date(year, month - 1, date, hours, minutes, seconds); }; /** @@ -69,96 +67,94 @@ export const ISOToDatetime = (str: string | null): Date | null => { * */ export const datetimeToISO = (date: Date): string => { - let cal, time, offset; - cal = [ - date.getFullYear(), - (date.getMonth() + 1).toString().padStart(2, "0"), - date.getDate().toString().padStart(2, "0"), - ].join("-"); + let cal, time, offset; + cal = [ + date.getFullYear(), + (date.getMonth() + 1).toString().padStart(2, "0"), + date.getDate().toString().padStart(2, "0"), + ].join("-"); - time = [ - date.getHours().toString().padStart(2, "0"), - date.getMinutes().toString().padStart(2, "0"), - date.getSeconds().toString().padStart(2, "0"), - ].join(":"); + time = [ + date.getHours().toString().padStart(2, "0"), + date.getMinutes().toString().padStart(2, "0"), + date.getSeconds().toString().padStart(2, "0"), + ].join(":"); - offset = [ - date.getTimezoneOffset() <= 0 ? "+" : "-", - Math.abs(Math.floor(date.getTimezoneOffset() / 60)) - .toString() - .padStart(2, "0"), - ":", - Math.abs(date.getTimezoneOffset() % 60) - .toString() - .padStart(2, "0"), - ].join(""); + offset = [ + date.getTimezoneOffset() <= 0 ? "+" : "-", + Math.abs(Math.floor(date.getTimezoneOffset() / 60)) + .toString() + .padStart(2, "0"), + ":", + Math.abs(date.getTimezoneOffset() % 60) + .toString() + .padStart(2, "0"), + ].join(""); - const x = cal + "T" + time + offset; + const x = cal + "T" + time + offset; - return x; + return x; }; export const intervalDaysToISO = (days: number | string | null): string => { - if (null === days) { - return "P0D"; - } + if (null === days) { + return "P0D"; + } - return `P${days}D`; + return `P${days}D`; }; export const intervalISOToDays = (str: string | null): number | null => { - if (null === str) { - return null; - } + if (null === str) { + return null; + } - if ("" === str.trim()) { - return null; - } + if ("" === str.trim()) { + return null; + } - let days = 0; - let isDate = true; - let vstring = ""; - for (let i = 0; i < str.length; i = i + 1) { - if (!isDate) { - continue; - } - switch (str.charAt(i)) { - case "P": - isDate = true; - break; - case "T": - isDate = false; - break; - case "0": - case "1": - case "2": - case "3": - case "4": - case "5": - case "6": - case "7": - case "8": - case "9": - vstring = vstring + str.charAt(i); - break; - case "Y": - days = days + Number.parseInt(vstring) * 365; - vstring = ""; - break; - case "M": - days = days + Number.parseInt(vstring) * 30; - vstring = ""; - break; - case "D": - days = days + Number.parseInt(vstring); - vstring = ""; - break; - default: - throw Error( - "this character should not appears: " + str.charAt(i), - ); - } + let days = 0; + let isDate = true; + let vstring = ""; + for (let i = 0; i < str.length; i = i + 1) { + if (!isDate) { + continue; } + switch (str.charAt(i)) { + case "P": + isDate = true; + break; + case "T": + isDate = false; + break; + case "0": + case "1": + case "2": + case "3": + case "4": + case "5": + case "6": + case "7": + case "8": + case "9": + vstring = vstring + str.charAt(i); + break; + case "Y": + days = days + Number.parseInt(vstring) * 365; + vstring = ""; + break; + case "M": + days = days + Number.parseInt(vstring) * 30; + vstring = ""; + break; + case "D": + days = days + Number.parseInt(vstring); + vstring = ""; + break; + default: + throw Error("this character should not appears: " + str.charAt(i)); + } + } - return days; + return days; }; diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/api/address.ts b/src/Bundle/ChillMainBundle/Resources/public/lib/api/address.ts index 896cbd323..864f6cd52 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/api/address.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/api/address.ts @@ -1,61 +1,61 @@ import { - Address, - GeographicalUnitLayer, - SimpleGeographicalUnit, + Address, + GeographicalUnitLayer, + SimpleGeographicalUnit, } from "../../types"; import { fetchResults, makeFetch } from "./apiMethods"; export const getAddressById = async (address_id: number): Promise
=> { - const url = `/api/1.0/main/address/${address_id}.json`; + const url = `/api/1.0/main/address/${address_id}.json`; - const response = await fetch(url); + const response = await fetch(url); - if (response.ok) { - return response.json(); - } + if (response.ok) { + return response.json(); + } - throw Error("Error with request resource response"); + throw Error("Error with request resource response"); }; export const getGeographicalUnitsByAddress = async ( - address: Address, + address: Address, ): Promise => { - return fetchResults( - `/api/1.0/main/geographical-unit/by-address/${address.address_id}.json`, - ); + return fetchResults( + `/api/1.0/main/geographical-unit/by-address/${address.address_id}.json`, + ); }; export const getAllGeographicalUnitLayers = async (): Promise< - GeographicalUnitLayer[] + GeographicalUnitLayer[] > => { - return fetchResults( - `/api/1.0/main/geographical-unit-layer.json`, - ); + return fetchResults( + `/api/1.0/main/geographical-unit-layer.json`, + ); }; export const syncAddressWithReference = async ( - address: Address, + address: Address, ): Promise
=> { - return makeFetch( - "POST", - `/api/1.0/main/address/reference-match/${address.address_id}/sync-with-reference`, - ); + return makeFetch( + "POST", + `/api/1.0/main/address/reference-match/${address.address_id}/sync-with-reference`, + ); }; export const markAddressReviewed = async ( - address: Address, + address: Address, ): Promise
=> { - return makeFetch( - "POST", - `/api/1.0/main/address/reference-match/${address.address_id}/set/reviewed`, - ); + return makeFetch( + "POST", + `/api/1.0/main/address/reference-match/${address.address_id}/set/reviewed`, + ); }; export const markAddressToReview = async ( - address: Address, + address: Address, ): Promise
=> { - return makeFetch( - "POST", - `/api/1.0/main/address/reference-match/${address.address_id}/set/to_review`, - ); + return makeFetch( + "POST", + `/api/1.0/main/address/reference-match/${address.address_id}/set/to_review`, + ); }; diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/api/apiMethods.ts b/src/Bundle/ChillMainBundle/Resources/public/lib/api/apiMethods.ts index e8256b348..9bfb952b5 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/api/apiMethods.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/api/apiMethods.ts @@ -6,57 +6,57 @@ export type fetchOption = Record; export type Params = Record; export interface PaginationResponse { - pagination: { - more: boolean; - items_per_page: number; - }; - results: T[]; - count: number; + pagination: { + more: boolean; + items_per_page: number; + }; + results: T[]; + count: number; } export type FetchParams = Record; export interface TransportExceptionInterface { - name: string; + name: string; } export interface ValidationExceptionInterface - extends TransportExceptionInterface { - name: "ValidationException"; - error: object; - violations: string[]; - titles: string[]; - propertyPaths: string[]; + extends TransportExceptionInterface { + name: "ValidationException"; + error: object; + violations: string[]; + titles: string[]; + propertyPaths: string[]; } export interface ValidationErrorResponse extends TransportExceptionInterface { - violations: { - title: string; - propertyPath: string; - }[]; + violations: { + title: string; + propertyPath: string; + }[]; } export interface AccessExceptionInterface extends TransportExceptionInterface { - name: "AccessException"; - violations: string[]; + name: "AccessException"; + violations: string[]; } export interface NotFoundExceptionInterface - extends TransportExceptionInterface { - name: "NotFoundException"; + extends TransportExceptionInterface { + name: "NotFoundException"; } export interface ServerExceptionInterface extends TransportExceptionInterface { - name: "ServerException"; - message: string; - code: number; - body: string; + name: "ServerException"; + message: string; + code: number; + body: string; } export interface ConflictHttpExceptionInterface - extends TransportExceptionInterface { - name: "ConflictHttpException"; - violations: string[]; + extends TransportExceptionInterface { + name: "ConflictHttpException"; + violations: string[]; } /** @@ -66,223 +66,223 @@ export interface ConflictHttpExceptionInterface * and use of the @link{fetchResults} method. */ export const makeFetch = ( - method: "POST" | "GET" | "PUT" | "PATCH" | "DELETE", - url: string, - body?: body | Input | null, - options?: FetchParams, + method: "POST" | "GET" | "PUT" | "PATCH" | "DELETE", + url: string, + body?: body | Input | null, + options?: FetchParams, ): Promise => { - let opts = { - method: method, - headers: { - "Content-Type": "application/json;charset=utf-8", - }, + let opts = { + method: method, + headers: { + "Content-Type": "application/json;charset=utf-8", + }, + }; + + if (body !== null && typeof body !== "undefined") { + Object.assign(opts, { body: JSON.stringify(body) }); + } + + if (typeof options !== "undefined") { + opts = Object.assign(opts, options); + } + return fetch(url, opts).then((response) => { + if (response.status === 204) { + return Promise.resolve(); + } + + if (response.ok) { + return response.json(); + } + + if (response.status === 422) { + return response.json().then((response) => { + throw ValidationException(response); + }); + } + + if (response.status === 403) { + throw AccessException(response); + } + + if (response.status === 409) { + throw ConflictHttpException(response); + } + + throw { + name: "Exception", + sta: response.status, + txt: response.statusText, + err: new Error(), + violations: response.body, }; - - if (body !== null && typeof body !== "undefined") { - Object.assign(opts, { body: JSON.stringify(body) }); - } - - if (typeof options !== "undefined") { - opts = Object.assign(opts, options); - } - return fetch(url, opts).then((response) => { - if (response.status === 204) { - return Promise.resolve(); - } - - if (response.ok) { - return response.json(); - } - - if (response.status === 422) { - return response.json().then((response) => { - throw ValidationException(response); - }); - } - - if (response.status === 403) { - throw AccessException(response); - } - - if (response.status === 409) { - throw ConflictHttpException(response); - } - - throw { - name: "Exception", - sta: response.status, - txt: response.statusText, - err: new Error(), - violations: response.body, - }; - }); + }); }; /** * Fetch results with certain parameters */ function _fetchAction( - page: number, - uri: string, - params?: FetchParams, + page: number, + uri: string, + params?: FetchParams, ): Promise> { - const item_per_page = 50; + const item_per_page = 50; - const searchParams = new URLSearchParams(); - searchParams.append("item_per_page", item_per_page.toString()); - searchParams.append("page", page.toString()); + const searchParams = new URLSearchParams(); + searchParams.append("item_per_page", item_per_page.toString()); + searchParams.append("page", page.toString()); - if (params !== undefined) { - Object.keys(params).forEach((key) => { - const v = params[key]; - if (typeof v === "string") { - searchParams.append(key, v); - } else if (typeof v === "number") { - searchParams.append(key, v.toString()); - } else if (v === null) { - searchParams.append(key, ""); - } + if (params !== undefined) { + Object.keys(params).forEach((key) => { + const v = params[key]; + if (typeof v === "string") { + searchParams.append(key, v); + } else if (typeof v === "number") { + searchParams.append(key, v.toString()); + } else if (v === null) { + searchParams.append(key, ""); + } + }); + } + + const url = uri + "?" + searchParams.toString(); + + return fetch(url, { + method: "GET", + headers: { + "Content-Type": "application/json;charset=utf-8", + }, + }) + .then((response) => { + if (response.ok) { + return response.json(); + } + + if (response.status === 404) { + throw NotFoundException(response); + } + + if (response.status === 422) { + return response.json().then((response) => { + throw ValidationException(response); }); - } + } - const url = uri + "?" + searchParams.toString(); + if (response.status === 403) { + throw AccessException(response); + } - return fetch(url, { - method: "GET", - headers: { - "Content-Type": "application/json;charset=utf-8", - }, + if (response.status >= 500) { + return response.text().then((body) => { + throw ServerException(response.status, body); + }); + } + + throw new Error("other network error"); }) - .then((response) => { - if (response.ok) { - return response.json(); - } - - if (response.status === 404) { - throw NotFoundException(response); - } - - if (response.status === 422) { - return response.json().then((response) => { - throw ValidationException(response); - }); - } - - if (response.status === 403) { - throw AccessException(response); - } - - if (response.status >= 500) { - return response.text().then((body) => { - throw ServerException(response.status, body); - }); - } - - throw new Error("other network error"); - }) - .catch( - ( - reason: - | NotFoundExceptionInterface - | ServerExceptionInterface - | ValidationExceptionInterface - | TransportExceptionInterface, - ) => { - console.error(reason); - throw reason; - }, - ); + .catch( + ( + reason: + | NotFoundExceptionInterface + | ServerExceptionInterface + | ValidationExceptionInterface + | TransportExceptionInterface, + ) => { + console.error(reason); + throw reason; + }, + ); } export const fetchResults = async ( - uri: string, - params?: FetchParams, + uri: string, + params?: FetchParams, ): Promise => { - const promises: Promise[] = []; - let page = 1; - const firstData: PaginationResponse = (await _fetchAction( - page, - uri, - params, - )) as PaginationResponse; + const promises: Promise[] = []; + let page = 1; + const firstData: PaginationResponse = (await _fetchAction( + page, + uri, + params, + )) as PaginationResponse; - promises.push(Promise.resolve(firstData.results)); + promises.push(Promise.resolve(firstData.results)); - if (firstData.pagination.more) { - do { - page = ++page; - promises.push( - _fetchAction(page, uri, params).then((r) => - Promise.resolve(r.results), - ), - ); - } while (page * firstData.pagination.items_per_page < firstData.count); - } + if (firstData.pagination.more) { + do { + page = ++page; + promises.push( + _fetchAction(page, uri, params).then((r) => + Promise.resolve(r.results), + ), + ); + } while (page * firstData.pagination.items_per_page < firstData.count); + } - return Promise.all(promises).then((values) => values.flat()); + return Promise.all(promises).then((values) => values.flat()); }; export const fetchScopes = (): Promise => { - return fetchResults("/api/1.0/main/scope.json"); + return fetchResults("/api/1.0/main/scope.json"); }; /** * Error objects to be thrown */ const ValidationException = ( - response: ValidationErrorResponse, + response: ValidationErrorResponse, ): ValidationExceptionInterface => { - const error = {} as ValidationExceptionInterface; - error.name = "ValidationException"; - error.violations = response.violations.map( - (violation) => `${violation.title}: ${violation.propertyPath}`, - ); - error.titles = response.violations.map((violation) => violation.title); - error.propertyPaths = response.violations.map( - (violation) => violation.propertyPath, - ); - return error; + const error = {} as ValidationExceptionInterface; + error.name = "ValidationException"; + error.violations = response.violations.map( + (violation) => `${violation.title}: ${violation.propertyPath}`, + ); + error.titles = response.violations.map((violation) => violation.title); + error.propertyPaths = response.violations.map( + (violation) => violation.propertyPath, + ); + return error; }; // eslint-disable-next-line @typescript-eslint/no-unused-vars const AccessException = (response: Response): AccessExceptionInterface => { - const error = {} as AccessExceptionInterface; - error.name = "AccessException"; - error.violations = ["You are not allowed to perform this action"]; + const error = {} as AccessExceptionInterface; + error.name = "AccessException"; + error.violations = ["You are not allowed to perform this action"]; - return error; + return error; }; // eslint-disable-next-line @typescript-eslint/no-unused-vars const NotFoundException = (response: Response): NotFoundExceptionInterface => { - const error = {} as NotFoundExceptionInterface; - error.name = "NotFoundException"; + const error = {} as NotFoundExceptionInterface; + error.name = "NotFoundException"; - return error; + return error; }; const ServerException = ( - code: number, - body: string, + code: number, + body: string, ): ServerExceptionInterface => { - const error = {} as ServerExceptionInterface; - error.name = "ServerException"; - error.code = code; - error.body = body; + const error = {} as ServerExceptionInterface; + error.name = "ServerException"; + error.code = code; + error.body = body; - return error; + return error; }; const ConflictHttpException = ( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - response: Response, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + response: Response, ): ConflictHttpExceptionInterface => { - const error = {} as ConflictHttpExceptionInterface; + const error = {} as ConflictHttpExceptionInterface; - error.name = "ConflictHttpException"; - error.violations = [ - "Sorry, but someone else has already changed this entity. Please refresh the page and apply the changes again", - ]; + error.name = "ConflictHttpException"; + error.violations = [ + "Sorry, but someone else has already changed this entity. Please refresh the page and apply the changes again", + ]; - return error; + return error; }; diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/api/export.ts b/src/Bundle/ChillMainBundle/Resources/public/lib/api/export.ts index 7e350b102..6e66122e7 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/api/export.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/api/export.ts @@ -2,17 +2,17 @@ import { makeFetch } from "ChillMainAssets/lib/api/apiMethods"; import { ExportGeneration } from "ChillMainAssets/types"; export const fetchExportGenerationStatus = async ( - exportGenerationId: string, + exportGenerationId: string, ): Promise => - makeFetch( - "GET", - `/api/1.0/main/export-generation/${exportGenerationId}/object`, - ); + makeFetch( + "GET", + `/api/1.0/main/export-generation/${exportGenerationId}/object`, + ); export const generateFromSavedExport = async ( - savedExportUuid: string, + savedExportUuid: string, ): Promise => - makeFetch( - "POST", - `/api/1.0/main/export/export-generation/create-from-saved-export/${savedExportUuid}`, - ); + makeFetch( + "POST", + `/api/1.0/main/export/export-generation/create-from-saved-export/${savedExportUuid}`, + ); diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/api/locations.ts b/src/Bundle/ChillMainBundle/Resources/public/lib/api/locations.ts index 3c326ba78..375881924 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/api/locations.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/api/locations.ts @@ -2,7 +2,7 @@ import { fetchResults } from "./apiMethods"; import { Location, LocationType } from "../../types"; export const getLocations = (): Promise => - fetchResults("/api/1.0/main/location.json"); + fetchResults("/api/1.0/main/location.json"); export const getLocationTypes = (): Promise => - fetchResults("/api/1.0/main/location-type.json"); + fetchResults("/api/1.0/main/location-type.json"); diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/api/return_path.ts b/src/Bundle/ChillMainBundle/Resources/public/lib/api/return_path.ts index e444aa2e5..54a12c030 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/api/return_path.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/api/return_path.ts @@ -1,3 +1,3 @@ export function buildReturnPath(location: Location): string { - return location.pathname + location.search; + return location.pathname + location.search; } diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/api/user.ts b/src/Bundle/ChillMainBundle/Resources/public/lib/api/user.ts index 62703b740..e51d09abb 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/api/user.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/api/user.ts @@ -2,23 +2,23 @@ import { User } from "../../types"; import { makeFetch } from "./apiMethods"; export const whoami = (): Promise => { - const url = `/api/1.0/main/whoami.json`; - return fetch(url).then((response) => { - if (response.ok) { - return response.json(); - } - throw { - msg: "Error while getting whoami.", - sta: response.status, - txt: response.statusText, - err: new Error(), - body: response.body, - }; - }); + const url = `/api/1.0/main/whoami.json`; + return fetch(url).then((response) => { + if (response.ok) { + return response.json(); + } + throw { + msg: "Error while getting whoami.", + sta: response.status, + txt: response.statusText, + err: new Error(), + body: response.body, + }; + }); }; export const whereami = (): Promise => { - const url = `/api/1.0/main/user-current-location.json`; + const url = `/api/1.0/main/user-current-location.json`; - return makeFetch("GET", url); + return makeFetch("GET", url); }; diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/entity-notification/api.ts b/src/Bundle/ChillMainBundle/Resources/public/lib/entity-notification/api.ts index 47cf9b1e9..97ba98d75 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/entity-notification/api.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/entity-notification/api.ts @@ -1,22 +1,22 @@ const buildLinkCreate = function ( - relatedEntityClass: string, - relatedEntityId: number, - to: number | null, - returnPath: string | null, + relatedEntityClass: string, + relatedEntityId: number, + to: number | null, + returnPath: string | null, ): string { - const params = new URLSearchParams(); - params.append("entityClass", relatedEntityClass); - params.append("entityId", relatedEntityId.toString()); + const params = new URLSearchParams(); + params.append("entityClass", relatedEntityClass); + params.append("entityId", relatedEntityId.toString()); - if (null !== to) { - params.append("tos[0]", to.toString()); - } + if (null !== to) { + params.append("tos[0]", to.toString()); + } - if (null !== returnPath) { - params.append("returnPath", returnPath); - } + if (null !== returnPath) { + params.append("returnPath", returnPath); + } - return `/fr/notification/create?${params.toString()}`; + return `/fr/notification/create?${params.toString()}`; }; export { buildLinkCreate }; diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/entity-workflow/api.ts b/src/Bundle/ChillMainBundle/Resources/public/lib/entity-workflow/api.ts index a9955f31b..4f9dea715 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/entity-workflow/api.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/entity-workflow/api.ts @@ -10,17 +10,17 @@ * @throws {Error} If the related entity ID is undefined. */ export const buildLinkCreate = ( - workflowName: string, - relatedEntityClass: string, - relatedEntityId: number | undefined, + workflowName: string, + relatedEntityClass: string, + relatedEntityId: number | undefined, ): string => { - if (typeof relatedEntityId === "undefined") { - throw new Error("the related entity id is not set"); - } - const params = new URLSearchParams(); - params.set("entityClass", relatedEntityClass); - params.set("entityId", relatedEntityId.toString(10)); - params.set("workflow", workflowName); + if (typeof relatedEntityId === "undefined") { + throw new Error("the related entity id is not set"); + } + const params = new URLSearchParams(); + params.set("entityClass", relatedEntityClass); + params.set("entityId", relatedEntityId.toString(10)); + params.set("workflow", workflowName); - return `/fr/main/workflow/create?` + params.toString(); + return `/fr/main/workflow/create?` + params.toString(); }; diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/localizationHelper/localizationHelper.ts b/src/Bundle/ChillMainBundle/Resources/public/lib/localizationHelper/localizationHelper.ts index 9cd1dcb51..b2fa260d2 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/localizationHelper/localizationHelper.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/localizationHelper/localizationHelper.ts @@ -9,33 +9,33 @@ import { TranslatableString } from "ChillMainAssets/types"; * @returns The localized string or null if no translation is available */ export function localizeString( - translatableString: TranslatableString | null | undefined, - locale?: string, + translatableString: TranslatableString | null | undefined, + locale?: string, ): string { - if (!translatableString || Object.keys(translatableString).length === 0) { - return ""; - } - - const currentLocale = locale || navigator.language.split("-")[0] || "fr"; - - if (translatableString[currentLocale]) { - return translatableString[currentLocale]; - } - - // Define fallback locales - const fallbackLocales: string[] = ["fr", "en"]; - - for (const fallbackLocale of fallbackLocales) { - if (translatableString[fallbackLocale]) { - return translatableString[fallbackLocale]; - } - } - - // No fallback translation found, use the first available - const availableLocales = Object.keys(translatableString); - if (availableLocales.length > 0) { - return translatableString[availableLocales[0]]; - } - + if (!translatableString || Object.keys(translatableString).length === 0) { return ""; + } + + const currentLocale = locale || navigator.language.split("-")[0] || "fr"; + + if (translatableString[currentLocale]) { + return translatableString[currentLocale]; + } + + // Define fallback locales + const fallbackLocales: string[] = ["fr", "en"]; + + for (const fallbackLocale of fallbackLocales) { + if (translatableString[fallbackLocale]) { + return translatableString[fallbackLocale]; + } + } + + // No fallback translation found, use the first available + const availableLocales = Object.keys(translatableString); + if (availableLocales.length > 0) { + return translatableString[availableLocales[0]]; + } + + return ""; } diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/workflow/attachments.ts b/src/Bundle/ChillMainBundle/Resources/public/lib/workflow/attachments.ts index 7e2f23f57..05c745099 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/workflow/attachments.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/workflow/attachments.ts @@ -3,20 +3,20 @@ import { GenericDocForAccompanyingPeriod } from "ChillDocStoreAssets/types/gener import { makeFetch } from "ChillMainAssets/lib/api/apiMethods"; export const find_attachments_by_workflow = async ( - workflowId: number, + workflowId: number, ): Promise => - makeFetch("GET", `/api/1.0/main/workflow/${workflowId}/attachment`); + makeFetch("GET", `/api/1.0/main/workflow/${workflowId}/attachment`); export const create_attachment = async ( - workflowId: number, - genericDoc: GenericDocForAccompanyingPeriod, + workflowId: number, + genericDoc: GenericDocForAccompanyingPeriod, ): Promise => - makeFetch("POST", `/api/1.0/main/workflow/${workflowId}/attachment`, { - relatedGenericDocKey: genericDoc.key, - relatedGenericDocIdentifiers: genericDoc.identifiers, - }); + makeFetch("POST", `/api/1.0/main/workflow/${workflowId}/attachment`, { + relatedGenericDocKey: genericDoc.key, + relatedGenericDocIdentifiers: genericDoc.identifiers, + }); export const delete_attachment = async ( - attachment: WorkflowAttachment, + attachment: WorkflowAttachment, ): Promise => - makeFetch("DELETE", `/api/1.0/main/workflow/attachment/${attachment.id}`); + makeFetch("DELETE", `/api/1.0/main/workflow/attachment/${attachment.id}`); diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/address-details/index.ts b/src/Bundle/ChillMainBundle/Resources/public/module/address-details/index.ts index abe516934..d41a70499 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/address-details/index.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/module/address-details/index.ts @@ -7,43 +7,43 @@ import { Address } from "../../types"; const i18n = _createI18n({}); document - .querySelectorAll("span[data-address-details]") - .forEach((el) => { - const dataset = el.dataset as { - addressId: string; - addressRefStatus: string; + .querySelectorAll("span[data-address-details]") + .forEach((el) => { + const dataset = el.dataset as { + addressId: string; + addressRefStatus: string; + }; + + const app = createApp({ + components: { AddressDetailsButton }, + data() { + return { + addressId: Number.parseInt(dataset.addressId), + addressRefStatus: dataset.addressRefStatus, }; - - const app = createApp({ - components: { AddressDetailsButton }, - data() { - return { - addressId: Number.parseInt(dataset.addressId), - addressRefStatus: dataset.addressRefStatus, - }; - }, - template: - '', - methods: { - onUpdateAddress: (address: Address): void => { - if ( - address.refStatus === "to_review" || - address.refStatus === "reviewed" - ) { - // in this two case, the address content do not change - return; - } - if ( - window.confirm( - "L'adresse a été modifiée. Vous pouvez continuer votre travail. Cependant, pour afficher les données immédiatement, veuillez recharger la page. \n\n Voulez-vous recharger la page immédiatement ?", - ) - ) { - window.location.reload(); - } - }, - }, - }); - - app.use(i18n); - app.mount(el); + }, + template: + '', + methods: { + onUpdateAddress: (address: Address): void => { + if ( + address.refStatus === "to_review" || + address.refStatus === "reviewed" + ) { + // in this two case, the address content do not change + return; + } + if ( + window.confirm( + "L'adresse a été modifiée. Vous pouvez continuer votre travail. Cependant, pour afficher les données immédiatement, veuillez recharger la page. \n\n Voulez-vous recharger la page immédiatement ?", + ) + ) { + window.location.reload(); + } + }, + }, }); + + app.use(i18n); + app.mount(el); + }); diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/editor_config.ts b/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/editor_config.ts index a396da295..fbbbb5881 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/editor_config.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/editor_config.ts @@ -1,16 +1,16 @@ import { - Essentials, - Bold, - Italic, - Paragraph, - Markdown, - BlockQuote, - Heading, - Link, - List, - Emoji, - Mention, - Fullscreen, + Essentials, + Bold, + Italic, + Paragraph, + Markdown, + BlockQuote, + Heading, + Link, + List, + Emoji, + Mention, + Fullscreen, } from "ckeditor5"; import coreTranslations from "ckeditor5/translations/fr.js"; @@ -19,41 +19,41 @@ import "ckeditor5/ckeditor5.css"; import "./index.scss"; export default { - plugins: [ - Essentials, - Markdown, - Bold, - Italic, - BlockQuote, - Heading, - Link, - List, - Paragraph, - // both Emoji and Mention are required for Emoji feature - Emoji, - Mention, - // to enable fullscreen - Fullscreen, + plugins: [ + Essentials, + Markdown, + Bold, + Italic, + BlockQuote, + Heading, + Link, + List, + Paragraph, + // both Emoji and Mention are required for Emoji feature + Emoji, + Mention, + // to enable fullscreen + Fullscreen, + ], + toolbar: { + items: [ + "heading", + "|", + "bold", + "italic", + "link", + "bulletedList", + "numberedList", + "blockQuote", + "|", + "emoji", + "|", + "undo", + "redo", + "|", + "fullscreen", ], - toolbar: { - items: [ - "heading", - "|", - "bold", - "italic", - "link", - "bulletedList", - "numberedList", - "blockQuote", - "|", - "emoji", - "|", - "undo", - "redo", - "|", - "fullscreen", - ], - }, - translations: [coreTranslations], - licenseKey: "GPL", + }, + translations: [coreTranslations], + licenseKey: "GPL", }; diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.ts b/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.ts index 783c0acfa..f8e0cb48b 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.ts @@ -2,31 +2,31 @@ import { createApp } from "vue"; import CommentEditor from "ChillMainAssets/vuejs/_components/CommentEditor/CommentEditor.vue"; const ckeditorFields: NodeListOf = - document.querySelectorAll("textarea[ckeditor]"); + document.querySelectorAll("textarea[ckeditor]"); ckeditorFields.forEach((field: HTMLTextAreaElement): void => { - const content = field.value; - const div = document.createElement("div"); + const content = field.value; + const div = document.createElement("div"); - if (field.parentNode !== null) { - field.parentNode.insertBefore(div, field); - } else { - throw "parent is null"; - } + if (field.parentNode !== null) { + field.parentNode.insertBefore(div, field); + } else { + throw "parent is null"; + } - createApp({ - components: { CommentEditor }, - template: ``, - data() { - return { - content, - }; - }, - methods: { - handleInput() { - field.value = this.content; - }, - }, - }).mount(div); + createApp({ + components: { CommentEditor }, + template: ``, + data() { + return { + content, + }; + }, + methods: { + handleInput() { + field.value = this.content; + }, + }, + }).mount(div); - field.style.display = "none"; + field.style.display = "none"; }); diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/collection/index.ts b/src/Bundle/ChillMainBundle/Resources/public/module/collection/index.ts index 77ff044ec..1c45f468d 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/collection/index.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/module/collection/index.ts @@ -31,157 +31,157 @@ import "./collection.scss"; declare global { - interface GlobalEventHandlersEventMap { - "show-hide-show": CustomEvent<{ - id: number; - froms: HTMLElement[]; - container: HTMLElement; - }>; - } + interface GlobalEventHandlersEventMap { + "show-hide-show": CustomEvent<{ + id: number; + froms: HTMLElement[]; + container: HTMLElement; + }>; + } } export class CollectionEventPayload { - collection: HTMLUListElement; - entry: HTMLLIElement; + collection: HTMLUListElement; + entry: HTMLLIElement; - constructor(collection: HTMLUListElement, entry: HTMLLIElement) { - this.collection = collection; - this.entry = entry; - } + constructor(collection: HTMLUListElement, entry: HTMLLIElement) { + this.collection = collection; + this.entry = entry; + } } export const handleAdd = (button: any): void => { - const form_name = button.dataset.collectionAddTarget, - prototype = button.dataset.formPrototype, - collection: HTMLUListElement | null = document.querySelector( - 'ul[data-collection-name="' + form_name + '"]', - ); + const form_name = button.dataset.collectionAddTarget, + prototype = button.dataset.formPrototype, + collection: HTMLUListElement | null = document.querySelector( + 'ul[data-collection-name="' + form_name + '"]', + ); - if (collection === null) { - return; + if (collection === null) { + return; + } + + const empty_explain: HTMLLIElement | null = collection.querySelector( + "li[data-collection-empty-explain]", + ), + entry = document.createElement("li"), + counter = collection.querySelectorAll("li.entry").length, // Updated counter logic + content = prototype.replace(/__name__/g, counter.toString()), + event = new CustomEvent("collection-add-entry", { + detail: new CollectionEventPayload(collection, entry), + }); + + console.log(counter); + console.log(content); + + entry.innerHTML = content; + entry.classList.add("entry"); + + if ("collectionRegular" in collection.dataset) { + initializeRemove(collection, entry); + if (empty_explain !== null) { + empty_explain.remove(); } + } - const empty_explain: HTMLLIElement | null = collection.querySelector( - "li[data-collection-empty-explain]", - ), - entry = document.createElement("li"), - counter = collection.querySelectorAll("li.entry").length, // Updated counter logic - content = prototype.replace(/__name__/g, counter.toString()), - event = new CustomEvent("collection-add-entry", { - detail: new CollectionEventPayload(collection, entry), - }); - - console.log(counter); - console.log(content); - - entry.innerHTML = content; - entry.classList.add("entry"); - - if ("collectionRegular" in collection.dataset) { - initializeRemove(collection, entry); - if (empty_explain !== null) { - empty_explain.remove(); - } - } - - collection.appendChild(entry); - collection.dispatchEvent(event); - window.dispatchEvent(event); + collection.appendChild(entry); + collection.dispatchEvent(event); + window.dispatchEvent(event); }; const initializeRemove = ( - collection: HTMLUListElement, - entry: HTMLLIElement, + collection: HTMLUListElement, + entry: HTMLLIElement, ): void => { - const button = buildRemoveButton(collection, entry); - if (null === button) { - return; - } - entry.appendChild(button); + const button = buildRemoveButton(collection, entry); + if (null === button) { + return; + } + entry.appendChild(button); }; export const buildRemoveButton = ( - collection: HTMLUListElement, - entry: HTMLLIElement, + collection: HTMLUListElement, + entry: HTMLLIElement, ): HTMLButtonElement | null => { - const button = document.createElement("button"), - isPersisted = entry.dataset.collectionIsPersisted || "", - content = collection.dataset.collectionButtonRemoveLabel || "", - allowDelete = collection.dataset.collectionAllowDelete || "", - event = new CustomEvent("collection-remove-entry", { - detail: new CollectionEventPayload(collection, entry), - }); - - if (allowDelete === "0" && isPersisted === "1") { - return null; - } - button.classList.add("btn", "btn-delete", "remove-entry"); - button.textContent = content; - button.addEventListener("click", (e: Event) => { - e.preventDefault(); - entry.remove(); - collection.dispatchEvent(event); - window.dispatchEvent(event); + const button = document.createElement("button"), + isPersisted = entry.dataset.collectionIsPersisted || "", + content = collection.dataset.collectionButtonRemoveLabel || "", + allowDelete = collection.dataset.collectionAllowDelete || "", + event = new CustomEvent("collection-remove-entry", { + detail: new CollectionEventPayload(collection, entry), }); - return button; + if (allowDelete === "0" && isPersisted === "1") { + return null; + } + button.classList.add("btn", "btn-delete", "remove-entry"); + button.textContent = content; + button.addEventListener("click", (e: Event) => { + e.preventDefault(); + entry.remove(); + collection.dispatchEvent(event); + window.dispatchEvent(event); + }); + + return button; }; const collectionsInit = new Set(); const buttonsInit = new Set(); const initialize = function (target: Document | Element): void { - const addButtons: NodeListOf = document.querySelectorAll( - "button[data-collection-add-target]", - ), - collections: NodeListOf = document.querySelectorAll( - "ul[data-collection-regular]", - ); + const addButtons: NodeListOf = document.querySelectorAll( + "button[data-collection-add-target]", + ), + collections: NodeListOf = document.querySelectorAll( + "ul[data-collection-regular]", + ); - for (let i = 0; i < addButtons.length; i++) { - const addButton = addButtons[i]; - const uniqid = addButton.dataset.uniqid as string; - if (buttonsInit.has(uniqid)) { - continue; - } - buttonsInit.add(uniqid); - addButton.addEventListener("click", (e: Event) => { - e.preventDefault(); - handleAdd(e.target); - }); + for (let i = 0; i < addButtons.length; i++) { + const addButton = addButtons[i]; + const uniqid = addButton.dataset.uniqid as string; + if (buttonsInit.has(uniqid)) { + continue; } - for (let i = 0; i < collections.length; i++) { - const collection = collections[i]; - const uniqid = collection.dataset.uniqid as string; - if (collectionsInit.has(uniqid)) { - continue; - } - collectionsInit.add(uniqid); - const entries: NodeListOf = - collection.querySelectorAll(":scope > li"); - for (let j = 0; j < entries.length; j++) { - if (entries[j].dataset.collectionEmptyExplain === "1") { - continue; - } - initializeRemove(collections[i], entries[j]); - } + buttonsInit.add(uniqid); + addButton.addEventListener("click", (e: Event) => { + e.preventDefault(); + handleAdd(e.target); + }); + } + for (let i = 0; i < collections.length; i++) { + const collection = collections[i]; + const uniqid = collection.dataset.uniqid as string; + if (collectionsInit.has(uniqid)) { + continue; } + collectionsInit.add(uniqid); + const entries: NodeListOf = + collection.querySelectorAll(":scope > li"); + for (let j = 0; j < entries.length; j++) { + if (entries[j].dataset.collectionEmptyExplain === "1") { + continue; + } + initializeRemove(collections[i], entries[j]); + } + } }; window.addEventListener("DOMContentLoaded", () => { - initialize(document); + initialize(document); }); window.addEventListener( - "show-hide-show", - ( - event: CustomEvent<{ - id: number; - container: HTMLElement; - froms: HTMLElement[]; - }>, - ) => { - const container = event.detail.container as HTMLElement; - initialize(container); - }, + "show-hide-show", + ( + event: CustomEvent<{ + id: number; + container: HTMLElement; + froms: HTMLElement[]; + }>, + ) => { + const container = event.detail.container as HTMLElement; + initialize(container); + }, ); diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/notification/toggle_read_all.ts b/src/Bundle/ChillMainBundle/Resources/public/module/notification/toggle_read_all.ts index 97697fca5..d07a7e815 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/notification/toggle_read_all.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/module/notification/toggle_read_all.ts @@ -5,39 +5,39 @@ import NotificationReadAllToggle from "../../vuejs/_components/Notification/Noti const i18n = _createI18n({}); document.addEventListener("DOMContentLoaded", function () { - const elements = document.querySelectorAll(".notification_all_read"); + const elements = document.querySelectorAll(".notification_all_read"); - elements.forEach((element) => { - console.log("launch"); - createApp({ - template: ``, - components: { - NotificationReadAllToggle, - }, - methods: { - markAsRead(id: number) { - const el = document.querySelector( - `div.notification-status[data-notification-id="${id}"]`, - ); - if (el === null) { - return; - } - el.classList.add("read"); - el.classList.remove("unread"); - }, - markAsUnread(id: number) { - const el = document.querySelector( - `div.notification-status[data-notification-id="${id}"]`, - ); - if (el === null) { - return; - } - el.classList.remove("read"); - el.classList.add("unread"); - }, - }, - }) - .use(i18n) - .mount(element); - }); + elements.forEach((element) => { + console.log("launch"); + createApp({ + template: ``, + components: { + NotificationReadAllToggle, + }, + methods: { + markAsRead(id: number) { + const el = document.querySelector( + `div.notification-status[data-notification-id="${id}"]`, + ); + if (el === null) { + return; + } + el.classList.add("read"); + el.classList.remove("unread"); + }, + markAsUnread(id: number) { + const el = document.querySelector( + `div.notification-status[data-notification-id="${id}"]`, + ); + if (el === null) { + return; + } + el.classList.remove("read"); + el.classList.add("unread"); + }, + }, + }) + .use(i18n) + .mount(element); + }); }); diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js index 9f6bb753e..8d9484bb1 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js @@ -124,9 +124,10 @@ function loadDynamicPicker(element) { removeEntity({ entity }) { if ( -1 === - this.suggested.findIndex( - (e) => e.type === entity.type && e.id === entity.id, - ) + this.suggested.findIndex( + (e) => e.type === entity.type && e.id === entity.id, + ) && + "me" !== entity ) { this.suggested.push(entity); } diff --git a/src/Bundle/ChillMainBundle/Resources/public/types.ts b/src/Bundle/ChillMainBundle/Resources/public/types.ts index 2cd83bc64..fecb9a578 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/types.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/types.ts @@ -2,216 +2,279 @@ import { GenericDoc } from "ChillDocStoreAssets/types/generic_doc"; import { StoredObject, StoredObjectStatus } from "ChillDocStoreAssets/types"; export interface DateTime { - datetime: string; - datetime8601: string; + datetime: string; + datetime8601: string; } export interface Civility { - id: number; - // TODO + id: number; + // TODO +} + +export interface Household { + type: "household"; + id: number; } export interface Job { - id: number; - type: "user_job"; - label: { - fr: string; // could have other key. How to do that in ts ? - }; + id: number; + type: "user_job"; + label: { + fr: string; // could have other key. How to do that in ts ? + }; } export interface Center { - id: number; - type: "center"; - name: string; + id: number; + type: "center"; + name: string; } export interface Scope { - id: number; - type: "scope"; - name: { - fr: string; - }; + id: number; + type: "scope"; + name: { + fr: string; + }; } export interface ResultItem { - result: T; - relevance: number; + result: T; + relevance: number; } export interface User { - type: "user"; - id: number; - username: string; - text: string; - text_without_absence: string; - email: string; - user_job: Job; - label: string; - // todo: mainCenter; mainJob; etc.. + type: "user"; + id: number; + username: string; + text: string; + text_without_absence: string; + email: string; + user_job: Job; + label: string; + // todo: mainCenter; mainJob; etc.. } export interface UserGroup { - type: "user_group"; - id: number; - label: TranslatableString; - backgroundColor: string; - foregroundColor: string; - excludeKey: string; - text: string; + type: "user_group"; + id: number; + label: TranslatableString; + backgroundColor: string; + foregroundColor: string; + excludeKey: string; + text: string; } export type UserGroupOrUser = User | UserGroup; export interface UserAssociatedInterface { - type: "user"; - id: number; + type: "user"; + id: number; } export type TranslatableString = Record; export interface Postcode { - id: number; - name: string; - code: string; - center: Point; + id: number; + name: string; + code: string; + center: Point; } export interface Point { - type: "Point"; - coordinates: [lat: number, lon: number]; + type: "Point"; + coordinates: [lat: number, lon: number]; } export interface Country { - id: number; - name: TranslatableString; - code: string; + id: number; + name: TranslatableString; + code: string; } export type AddressRefStatus = "match" | "to_review" | "reviewed"; export interface Address { - type: "address"; - address_id: number; - text: string; - street: string; - streetNumber: string; - postcode: Postcode; - country: Country; - floor: string | null; - corridor: string | null; - steps: string | null; - flat: string | null; - buildingName: string | null; - distribution: string | null; - extra: string | null; - confidential: boolean; - lines: string[]; - addressReference: AddressReference | null; - validFrom: DateTime; - validTo: DateTime | null; - point: Point | null; - refStatus: AddressRefStatus; - isNoAddress: boolean; + type: "address"; + address_id: number; + text: string; + street: string; + streetNumber: string; + postcode: Postcode; + country: Country; + floor: string | null; + corridor: string | null; + steps: string | null; + flat: string | null; + buildingName: string | null; + distribution: string | null; + extra: string | null; + confidential: boolean; + lines: string[]; + addressReference: AddressReference | null; + validFrom: DateTime; + validTo: DateTime | null; + point: Point | null; + refStatus: AddressRefStatus; + isNoAddress: boolean; } export interface AddressWithPoint extends Address { - point: Point; + point: Point; } export interface AddressReference { - id: number; - createdAt: DateTime | null; - deletedAt: DateTime | null; - municipalityCode: string; - point: Point; - postcode: Postcode; - refId: string; - source: string; - street: string; - streetNumber: string; - updatedAt: DateTime | null; + id: number; + createdAt: DateTime | null; + deletedAt: DateTime | null; + municipalityCode: string; + point: Point; + postcode: Postcode; + refId: string; + source: string; + street: string; + streetNumber: string; + updatedAt: DateTime | null; } export interface SimpleGeographicalUnit { - id: number; - layerId: number; - unitName: string; - unitRefId: string; + id: number; + layerId: number; + unitName: string; + unitRefId: string; } export interface GeographicalUnitLayer { - id: number; - name: TranslatableString; - refId: string; + id: number; + name: TranslatableString; + refId: string; } export interface Location { - type: "location"; - id: number; - active: boolean; - address: Address | null; - availableForUsers: boolean; - createdAt: DateTime | null; - createdBy: User | null; - updatedAt: DateTime | null; - updatedBy: User | null; - email: string | null; - name: string; - phonenumber1: string | null; - phonenumber2: string | null; - locationType: LocationType; + type: "location"; + id: number; + active: boolean; + address: Address | null; + availableForUsers: boolean; + createdAt: DateTime | null; + createdBy: User | null; + updatedAt: DateTime | null; + updatedBy: User | null; + email: string | null; + name: string; + phonenumber1: string | null; + phonenumber2: string | null; + locationType: LocationType; } export interface LocationAssociated { - type: "location"; - id: number; + type: "location"; + id: number; } export interface LocationType { - type: "location-type"; - id: number; - active: boolean; - addressRequired: "optional" | "required"; - availableForUsers: boolean; - editableByUsers: boolean; - contactData: "optional" | "required"; - title: TranslatableString; + type: "location-type"; + id: number; + active: boolean; + addressRequired: "optional" | "required"; + availableForUsers: boolean; + editableByUsers: boolean; + contactData: "optional" | "required"; + title: TranslatableString; } export interface NewsItemType { - id: number; - title: string; - content: string; - startDate: DateTime; - endDate: DateTime | null; + id: number; + title: string; + content: string; + startDate: DateTime; + endDate: DateTime | null; } export interface WorkflowAvailable { - name: string; - text: string; + name: string; + text: string; } export interface WorkflowAttachment { - id: number; - relatedGenericDocKey: string; - relatedGenericDocIdentifiers: object; - createdAt: DateTime | null; - createdBy: User | null; - updatedAt: DateTime | null; - updatedBy: User | null; - genericDoc: null | GenericDoc; + id: number; + relatedGenericDocKey: string; + relatedGenericDocIdentifiers: object; + createdAt: DateTime | null; + createdBy: User | null; + updatedAt: DateTime | null; + updatedBy: User | null; + genericDoc: null | GenericDoc; } export interface ExportGeneration { - id: string; - type: "export_generation"; - exportAlias: string; - createdBy: User | null; - createdAt: DateTime | null; - status: StoredObjectStatus; - storedObject: StoredObject; + id: string; + type: "export_generation"; + exportAlias: string; + createdBy: User | null; + createdAt: DateTime | null; + status: StoredObjectStatus; + storedObject: StoredObject; } export interface PrivateCommentEmbeddable { - comments: Record; + comments: Record; +} + +// API Exception types +export interface TransportExceptionInterface { + name: string; +} + +export interface ValidationExceptionInterface + extends TransportExceptionInterface { + name: "ValidationException"; + error: object; + violations: string[]; + titles: string[]; + propertyPaths: string[]; +} + +export interface AccessExceptionInterface extends TransportExceptionInterface { + name: "AccessException"; + violations: string[]; +} + +export interface NotFoundExceptionInterface + extends TransportExceptionInterface { + name: "NotFoundException"; +} + +export interface ServerExceptionInterface extends TransportExceptionInterface { + name: "ServerException"; + message: string; + code: number; + body: string; +} + +export interface ConflictHttpExceptionInterface + extends TransportExceptionInterface { + name: "ConflictHttpException"; + violations: string[]; +} + +export type ApiException = + | ValidationExceptionInterface + | AccessExceptionInterface + | NotFoundExceptionInterface + | ServerExceptionInterface + | ConflictHttpExceptionInterface; + +export interface Modal { + showModal: boolean; + modalDialogClass: string; +} + +export interface Selected { + result: UserGroupOrUser; +} + +export interface addNewEntities { + selected: Selected[]; + modal: Modal; } diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue index 075bf6d65..d259d0cae 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue @@ -1,130 +1,130 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue index 5d90bf818..fda84c817 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue @@ -1,32 +1,32 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue index 103849e3a..ede1b3778 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue @@ -1,251 +1,248 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMap.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMap.vue index 167b3b981..4aa44f4a6 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMap.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMap.vue @@ -1,5 +1,5 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue index 4b59efbc6..3e9da5da4 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue @@ -1,149 +1,149 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue index fd1740a40..6ad8965b4 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue @@ -1,227 +1,223 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue index 0d85c69f9..74520310e 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue @@ -1,60 +1,60 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CountrySelection.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CountrySelection.vue index 37decf15e..47feab563 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CountrySelection.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CountrySelection.vue @@ -1,23 +1,23 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/DatePane.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/DatePane.vue index 96e67f952..3e8e1f4bb 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/DatePane.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/DatePane.vue @@ -1,69 +1,66 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue index df5ea56dc..cf808ed2a 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue @@ -1,104 +1,101 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowPane.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowPane.vue index a17ce719d..d0796bc0d 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowPane.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowPane.vue @@ -1,109 +1,98 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/SuggestPane.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/SuggestPane.vue index ddaed6219..2e62b5963 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/SuggestPane.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/SuggestPane.vue @@ -1,67 +1,64 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/DownloadExport/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/DownloadExport/App.vue index 033eb6cac..d1389a748 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/DownloadExport/App.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/DownloadExport/App.vue @@ -1,10 +1,10 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/DownloadExport/index.ts b/src/Bundle/ChillMainBundle/Resources/public/vuejs/DownloadExport/index.ts index e970e51b9..ae77fbb08 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/DownloadExport/index.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/DownloadExport/index.ts @@ -4,8 +4,8 @@ import App from "./App.vue"; const el = document.getElementById("app"); if (null === el) { - console.error("div element app was not found"); - throw new Error("div element app was not found"); + console.error("div element app was not found"); + throw new Error("div element app was not found"); } const exportGenerationId = el?.dataset.exportGenerationId as string; diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue index 8686b59a7..c550d1c0d 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue @@ -1,36 +1,36 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/DashboardWidgets/News.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/DashboardWidgets/News.vue index 5633d3133..4f664d6a5 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/DashboardWidgets/News.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/DashboardWidgets/News.vue @@ -1,13 +1,13 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/DashboardWidgets/NewsItem.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/DashboardWidgets/NewsItem.vue index 997eae58b..5cbd33712 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/DashboardWidgets/NewsItem.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/DashboardWidgets/NewsItem.vue @@ -1,40 +1,38 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyAccompanyingCourses.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyAccompanyingCourses.vue index 9f7edf8e7..bd3b5cdf8 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyAccompanyingCourses.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyAccompanyingCourses.vue @@ -1,76 +1,65 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyCustoms.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyCustoms.vue index 1f76a5a0a..5b10dc89c 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyCustoms.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyCustoms.vue @@ -1,105 +1,103 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/BadgeEntity.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/BadgeEntity.vue index 1c5d2b6da..b74b64054 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/BadgeEntity.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/BadgeEntity.vue @@ -1,66 +1,63 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/CommentEditor/CommentEditor.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/CommentEditor/CommentEditor.vue index d6019fabe..97242ffa2 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/CommentEditor/CommentEditor.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/CommentEditor/CommentEditor.vue @@ -4,9 +4,9 @@ import { Ckeditor } from "@ckeditor/ckeditor5-vue"; import { ClassicEditor } from "ckeditor5"; import classicEditorConfig from "ChillMainAssets/module/ckeditor5/editor_config"; import { - trans, - EDITOR_SWITCH_TO_SIMPLE, - EDITOR_SWITCH_TO_COMPLEX, + trans, + EDITOR_SWITCH_TO_SIMPLE, + EDITOR_SWITCH_TO_COMPLEX, } from "translator"; const EDITOR_MODE_KEY = "editorMode"; @@ -16,107 +16,101 @@ const value = defineModel({ required: true }); const isSimple = computed(() => kind.value === "simple"); const toggleButtonClass = computed(() => { - return { - ["toggle-button"]: true, - onEditor: !isSimple.value, - onSimple: isSimple.value, - }; + return { + ["toggle-button"]: true, + onEditor: !isSimple.value, + onSimple: isSimple.value, + }; }); const toggleEditor = () => { - let newValue; + let newValue; - newValue = kind.value === "simple" ? "rich" : "simple"; - kind.value = "rich"; - window.localStorage.setItem(EDITOR_MODE_KEY, newValue); + newValue = kind.value === "simple" ? "rich" : "simple"; + kind.value = "rich"; + window.localStorage.setItem(EDITOR_MODE_KEY, newValue); - window.dispatchEvent(new Event("toggleEditorKind")); + window.dispatchEvent(new Event("toggleEditorKind")); }; const onKindChange = function (/* event: StorageEvent | Event */) { - const newValue = window.localStorage.getItem(EDITOR_MODE_KEY); + const newValue = window.localStorage.getItem(EDITOR_MODE_KEY); - if (null === newValue || !(newValue === "rich" || newValue === "simple")) { - throw "invalid new value: " + newValue; - } + if (null === newValue || !(newValue === "rich" || newValue === "simple")) { + throw "invalid new value: " + newValue; + } - if (kind.value !== newValue) { - kind.value = newValue; - } + if (kind.value !== newValue) { + kind.value = newValue; + } }; onMounted(function () { - const storage = window.localStorage; - const savedKind = storage.getItem(EDITOR_MODE_KEY); + const storage = window.localStorage; + const savedKind = storage.getItem(EDITOR_MODE_KEY); - if ( - null !== kind.value && - (savedKind === "simple" || savedKind === "rich") - ) { - kind.value = savedKind; - } + if (null !== kind.value && (savedKind === "simple" || savedKind === "rich")) { + kind.value = savedKind; + } - window.addEventListener("storage", onKindChange); - window.addEventListener("toggleEditorKind", onKindChange); + window.addEventListener("storage", onKindChange); + window.addEventListener("toggleEditorKind", onKindChange); }); onUnmounted(function () { - window.removeEventListener("storage", onKindChange); - window.removeEventListener("toggleEditorKind", onKindChange); + window.removeEventListener("storage", onKindChange); + window.removeEventListener("toggleEditorKind", onKindChange); }); diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Confidential.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Confidential.vue index 13459b390..9c010e8d1 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Confidential.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Confidential.vue @@ -1,40 +1,40 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue index 86f4155b6..7085b3b18 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue @@ -1,83 +1,77 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/GenderIconRenderBox.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/GenderIconRenderBox.vue index d47b9b777..794771014 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/GenderIconRenderBox.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/GenderIconRenderBox.vue @@ -1,9 +1,28 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserGroupRenderBox.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserGroupRenderBox.vue index 7c37e98a9..81f836c62 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserGroupRenderBox.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserGroupRenderBox.vue @@ -4,23 +4,23 @@ import { computed } from "vue"; import { localizeString } from "ChillMainAssets/lib/localizationHelper/localizationHelper"; interface UserGroupRenderBoxProps { - userGroup: UserGroup; + userGroup: UserGroup; } const props = defineProps(); const styles = computed<{ color: string; "background-color": string }>(() => { - return { - color: props.userGroup.foregroundColor, - "background-color": props.userGroup.backgroundColor, - }; + return { + color: props.userGroup.foregroundColor, + "background-color": props.userGroup.backgroundColor, + }; }); diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserRenderBoxBadge.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserRenderBoxBadge.vue index 63c43c37f..4bae3b541 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserRenderBoxBadge.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserRenderBoxBadge.vue @@ -1,31 +1,31 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/EntityWorkflowVueSubscriber.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/EntityWorkflowVueSubscriber.vue index 332849ef5..4d817a2f9 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/EntityWorkflowVueSubscriber.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/EntityWorkflowVueSubscriber.vue @@ -1,83 +1,83 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue index 59dcd80f4..658c0f9e9 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue @@ -1,49 +1,45 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Modal.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Modal.vue index 06e1bfa1a..4808e2bda 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Modal.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Modal.vue @@ -1,42 +1,39 @@ @@ -73,17 +79,17 @@ const emits = defineEmits<{ * This is a mask behind the modal. */ .modal-mask { - position: fixed; - z-index: 9998; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: rgba(0, 0, 0, 0.75); - transition: opacity 0.3s ease; + position: fixed; + z-index: 9998; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.75); + transition: opacity 0.3s ease; } .modal-header .close { - border-top-right-radius: 0.3rem; + border-top-right-radius: 0.3rem; } /* * The following styles are auto-applied to elements with @@ -94,23 +100,23 @@ const emits = defineEmits<{ * these styles. */ .modal-enter { - opacity: 0; + opacity: 0; } .modal-leave-active { - opacity: 0; + opacity: 0; } .modal-enter .modal-container, .modal-leave-active .modal-container { - -webkit-transform: scale(1.1); - transform: scale(1.1); + -webkit-transform: scale(1.1); + transform: scale(1.1); } h3.modal-title { - font-size: 1.5rem; - font-weight: bold; + font-size: 1.5rem; + font-weight: bold; } div.modal-footer { - button:first-child { - margin-right: auto; - } + button:first-child { + margin-right: auto; + } } diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadAllToggle.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadAllToggle.vue index 57f7fd7f8..bb7a43c92 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadAllToggle.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadAllToggle.vue @@ -1,17 +1,17 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadToggle.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadToggle.vue index cc64d4835..fb94af80f 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadToggle.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadToggle.vue @@ -1,96 +1,96 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.ts b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.ts index db9a37104..cbee6bf25 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.ts @@ -2,87 +2,86 @@ import { createI18n } from "vue-i18n"; import datetimeFormats from "../i18n/datetimeFormats"; const messages = { - fr: { - action: { - actions: "Actions", - show: "Voir", - edit: "Modifier", - create: "Créer", - remove: "Enlever", - delete: "Supprimer", - save: "Enregistrer", - valid: "Valider", - valid_and_see: "Valider et voir", - add: "Ajouter", - show_modal: "Ouvrir une modale", - ok: "OK", - cancel: "Annuler", - close: "Fermer", - back: "Retour", - check_all: "cocher tout", - reset: "réinitialiser", - redirect: { - person: "Quitter la page et ouvrir la fiche de l'usager", - thirdparty: "Quitter la page et voir le tiers", - }, - refresh: "Rafraîchir", - addContact: "Ajouter un contact", - }, - nav: { - next: "Suivant", - previous: "Précédent", - top: "Haut", - bottom: "Bas", - }, - renderbox: { - person: "Usager", - birthday: { - man: "Né le", - woman: "Née le", - neutral: "Né·e le", - unknown: "Né·e le", - }, - deathdate: "Date de décès", - household_without_address: "Le ménage de l'usager est sans adresse", - no_data: "Aucune information renseignée", - type: { - thirdparty: "Tiers", - person: "Usager", - }, - holder: "Titulaire", - years_old: "1 an | {n} an | {n} ans", - residential_address: "Adresse de résidence", - located_at: "réside chez", - }, + fr: { + action: { + actions: "Actions", + show: "Voir", + edit: "Modifier", + create: "Créer", + remove: "Enlever", + delete: "Supprimer", + save: "Enregistrer", + valid: "Valider", + valid_and_see: "Valider et voir", + add: "Ajouter", + show_modal: "Ouvrir une modale", + ok: "OK", + cancel: "Annuler", + close: "Fermer", + back: "Retour", + check_all: "cocher tout", + reset: "réinitialiser", + redirect: { + person: "Quitter la page et ouvrir la fiche de l'usager", + thirdparty: "Quitter la page et voir le tiers", + }, + refresh: "Rafraîchir", + addContact: "Ajouter un contact", }, + nav: { + next: "Suivant", + previous: "Précédent", + top: "Haut", + bottom: "Bas", + }, + renderbox: { + person: "Usager", + birthday: { + man: "Né le", + woman: "Née le", + neutral: "Né·e le", + unknown: "Né·e le", + }, + deathdate: "Date de décès", + household_without_address: "Le ménage de l'usager est sans adresse", + no_data: "Aucune information renseignée", + type: { + thirdparty: "Tiers", + person: "Usager", + }, + holder: "Titulaire", + years_old: "1 an | {n} an | {n} ans", + residential_address: "Adresse de résidence", + located_at: "réside chez", + }, + }, }; const _createI18n = (appMessages: any, legacy?: boolean) => { - Object.assign(messages.fr, appMessages.fr); - return createI18n({ - legacy: typeof legacy === undefined ? true : legacy, - locale: "fr", - fallbackLocale: "fr", - // @ts-ignore - datetimeFormats, - messages, - }); + Object.assign(messages.fr, appMessages.fr); + return createI18n({ + legacy: typeof legacy === undefined ? true : legacy, + locale: "fr", + fallbackLocale: "fr", + // @ts-ignore + datetimeFormats, + messages, + }); }; export { _createI18n }; export const multiSelectMessages = { - fr: { - multiselect: { - placeholder: "Choisir", - tag_placeholder: "Créer un nouvel élément", - select_label: '"Entrée" ou cliquez pour sélectionner', - deselect_label: '"Entrée" ou cliquez pour désélectionner', - select_group_label: - 'Appuyer sur "Entrée" pour sélectionner ce groupe', - deselect_group_label: - 'Appuyer sur "Entrée" pour désélectionner ce groupe', - selected_label: "Sélectionné", - }, + fr: { + multiselect: { + placeholder: "Choisir", + tag_placeholder: "Créer un nouvel élément", + select_label: '"Entrée" ou cliquez pour sélectionner', + deselect_label: '"Entrée" ou cliquez pour désélectionner', + select_group_label: 'Appuyer sur "Entrée" pour sélectionner ce groupe', + deselect_group_label: + 'Appuyer sur "Entrée" pour désélectionner ce groupe', + selected_label: "Sélectionné", }, + }, }; diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/i18n/datetimeFormats.ts b/src/Bundle/ChillMainBundle/Resources/public/vuejs/i18n/datetimeFormats.ts index fe20cb217..aca1328ac 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/i18n/datetimeFormats.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/i18n/datetimeFormats.ts @@ -1,27 +1,27 @@ export default { - fr: { - short: { - year: "numeric", - month: "numeric", - day: "numeric", - }, - text: { - year: "numeric", - month: "long", - day: "numeric", - }, - long: { - year: "numeric", - month: "numeric", - day: "numeric", - hour: "numeric", - minute: "numeric", - hour12: false, - }, - hoursOnly: { - hour: "numeric", - minute: "numeric", - hour12: false, - }, + fr: { + short: { + year: "numeric", + month: "numeric", + day: "numeric", }, + text: { + year: "numeric", + month: "long", + day: "numeric", + }, + long: { + year: "numeric", + month: "numeric", + day: "numeric", + hour: "numeric", + minute: "numeric", + hour12: false, + }, + hoursOnly: { + hour: "numeric", + minute: "numeric", + hour12: false, + }, + }, }; diff --git a/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig b/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig index 30f84c855..d92f2e260 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig @@ -69,35 +69,37 @@
{% endif %} - {% block content %} - - {# DISABLED {{ chill_widget('homepage', {} ) }} #} + {# DISABLED {{ chill_widget('homepage', {} ) }} #} - {% include '@ChillMain/Homepage/index.html.twig' %} + {% include '@ChillMain/Homepage/index.html.twig' %} + {% endblock %} {% endblock %}

diff --git a/src/Bundle/ChillMainBundle/Tests/Phonenumber/PhonenumberHelperTest.php b/src/Bundle/ChillMainBundle/Tests/Phonenumber/PhonenumberHelperTest.php index 182980dd0..cae0cdd48 100644 --- a/src/Bundle/ChillMainBundle/Tests/Phonenumber/PhonenumberHelperTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Phonenumber/PhonenumberHelperTest.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\MainBundle\Tests\Phonenumber; use Chill\MainBundle\Phonenumber\PhonenumberHelper; +use libphonenumber\PhoneNumber; use libphonenumber\PhoneNumberUtil; use Psr\Log\NullLogger; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; @@ -31,6 +32,7 @@ final class PhonenumberHelperTest extends KernelTestCase public function testFormatPhonenumbers(string $defaultCarrierCode, string $phoneNumber, string $expected) { $util = PhoneNumberUtil::getInstance(); + $subject = new PhonenumberHelper( new ArrayAdapter(), new ParameterBag([ @@ -70,4 +72,47 @@ final class PhonenumberHelperTest extends KernelTestCase '00 33 6 23 12 45 54', ]; } + + /** + * @dataProvider providePhoneNumbersToParse + */ + public function testParsePhonenumbers(string $defaultCarrierCode, string $phoneNumber, PhoneNumber $expected): void + { + $subject = new PhonenumberHelper( + new ArrayAdapter(), + new ParameterBag([ + 'chill_main.phone_helper' => [ + 'default_carrier_code' => $defaultCarrierCode, + ], + ]), + new NullLogger() + ); + + $actual = $subject->parse($phoneNumber); + + self::assertTrue($expected->equals($actual)); + } + + public static function providePhoneNumbersToParse(): iterable + { + $util = PhoneNumberUtil::getInstance(); + + yield [ + 'FR', + '+32486544999', + $util->parse('+32486544999', 'FR'), + ]; + + yield [ + 'FR', + '32486544999', + $util->parse('+32486544999', 'FR'), + ]; + + yield [ + 'FR', + '0228858040', + $util->parse('+33228858040', 'FR'), + ]; + } } diff --git a/src/Bundle/ChillMainBundle/Tests/Validation/Validator/UserGroupDoNotExcludeTest.php b/src/Bundle/ChillMainBundle/Tests/Validation/Validator/UserGroupDoNotExcludeTest.php new file mode 100644 index 000000000..d6d1c9887 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Tests/Validation/Validator/UserGroupDoNotExcludeTest.php @@ -0,0 +1,91 @@ +validator->validate([], new \Chill\MainBundle\Validation\Constraint\UserGroupDoNotExclude()); + + $this->assertNoViolation(); + } + + public function testMixedUserGroupAndUsersIsValid(): void + { + $this->validator->validate( + [new User(), new UserGroup()], + new \Chill\MainBundle\Validation\Constraint\UserGroupDoNotExclude() + ); + + $this->assertNoViolation(); + } + + public function testDifferentExcludeKeysIsValid(): void + { + $this->validator->validate( + [(new UserGroup())->setExcludeKey('A'), (new UserGroup())->setExcludeKey('B')], + new \Chill\MainBundle\Validation\Constraint\UserGroupDoNotExclude() + ); + + $this->assertNoViolation(); + } + + public function testMultipleGroupsWithEmptyExcludeKeyIsValid(): void + { + $this->validator->validate( + [(new UserGroup())->setExcludeKey(''), (new UserGroup())->setExcludeKey('')], + new \Chill\MainBundle\Validation\Constraint\UserGroupDoNotExclude() + ); + + $this->assertNoViolation(); + } + + public function testSameExclusionKeyWillRaiseError(): void + { + $this->validator->validate( + [ + (new UserGroup())->setExcludeKey('A')->setLabel(['fr' => 'Group 1']), + (new UserGroup())->setExcludeKey('A')->setLabel(['fr' => 'Group 2']), + ], + new \Chill\MainBundle\Validation\Constraint\UserGroupDoNotExclude() + ); + + $this->buildViolation('The groups {{ excluded_groups }} do exclude themselves. Please choose one between them') + ->setParameter('excluded_groups', 'Group 1, Group 2') + ->setCode('e16c8226-0090-11ef-8560-f7239594db09') + ->assertRaised(); + } +} diff --git a/src/Bundle/ChillMainBundle/chill.api.specs.yaml b/src/Bundle/ChillMainBundle/chill.api.specs.yaml index d87a0eb71..047f69675 100644 --- a/src/Bundle/ChillMainBundle/chill.api.specs.yaml +++ b/src/Bundle/ChillMainBundle/chill.api.specs.yaml @@ -10,6 +10,31 @@ servers: components: schemas: + Collection: + type: object + properties: + count: + type: number + format: u64 + pagination: + type: object + properties: + first: + type: number + format: u64 + items_per_page: + type: number + format: u64 + next: + type: string + format: uri + nullable: true + previous: + type: string + format: uri + nullable: true + more: + type: boolean EntityWorkflowAttachment: type: object properties: diff --git a/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml index 2982d94db..0d1b30ef8 100644 --- a/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml @@ -130,3 +130,58 @@ filter_order: Search: Chercher dans la liste By date: Filtrer par date search_box: Filtrer par contenu +renderbox: + person: "Usager" + birthday: + man: "Né le" + woman: "Née le" + neutral: "Né·e le" + unknown: "Né·e le" + deathdate: "Date de décès" + household_without_address: "Le ménage de l'usager est sans adresse" + no_data: "Aucune information renseignée" + type: + thirdparty: "Tiers" + person: "Usager" + holder: "Titulaire" + years_old: >- + {n, plural, + =0 {0 an} + one {1 an} + other {# ans} + } + residential_address: "Adresse de résidence" + located_at: "réside chez" + household_number: "Ménage n°{number}" + current_members: "Membres actuels" + no_current_address: "Sans adresse actuellement" + new_household: "Nouveau ménage" + no_members_yet: "Aucun membre actuellement" + +pick_entity: + add: "Ajouter" + modal_title: >- + {count, plural, + one {Indiquer un} + other {Ajouter des} + } + user: >- + {count, plural, + one {Utilisateur} + other {Utilisateurs} + } + user_group: >- + {count, plural, + one {Groupe d'utilisateur} + other {Groupes d'utilisateurs} + } + person: >- + {count, plural, + one {Usager} + other {Usagers} + } + thirdparty: >- + {count, plural, + one {Tiers} + other {Tiers} + } diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index d3498cba9..5e591fba8 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -941,3 +941,34 @@ multiselect: editor: switch_to_simple: Éditeur simple switch_to_complex: Éditeur riche +action: + actions: Actions + show: Voir + edit: Modifier + create: Créer + remove: Enlever + delete: Supprimer + save: Enregistrer + valid: Valider + valid_and_see: Valider et voir + add: Ajouter + show_modal: Ouvrir une modale + ok: OK + cancel: Annuler + close: Fermer + back: Retour + check_all: cocher tout + reset: réinitialiser + redirect: + person: Quitter la page et ouvrir la fiche de l'usager + thirdparty: Quitter la page et voir le tiers + refresh: Rafraîchir + addContact: Ajouter un contact + +nav: + next: "Suivant" + previous: "Précédent" + top: "Haut" + bottom: "Bas" + + diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php index 686022ca3..0d972914d 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php @@ -21,6 +21,8 @@ use Chill\PersonBundle\Security\Authorization\PersonVoter; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\Query; +use libphonenumber\PhoneNumber; +use libphonenumber\PhoneNumberFormat; use Symfony\Component\Security\Core\Security; final readonly class PersonACLAwareRepository implements PersonACLAwareRepositoryInterface @@ -298,4 +300,27 @@ final readonly class PersonACLAwareRepository implements PersonACLAwareRepositor \array_map(static fn (Center $c) => $c->getId(), $authorizedCenters) ); } + + public function findByPhone(PhoneNumber $phoneNumber, int $start = 0, int $limit = 20): array + { + $authorizedCenters = $this->authorizationHelper + ->getReachableCenters($this->security->getUser(), PersonVoter::SEE); + + if ([] === $authorizedCenters) { + return []; + } + + $util = \libphonenumber\PhoneNumberUtil::getInstance(); + + return $this->em->createQuery( + 'SELECT p FROM '.Person::class.' p LEFT JOIN p.otherPhoneNumbers opn JOIN p.centerCurrent pcc '. + 'WHERE (p.phonenumber LIKE :phone OR p.mobilenumber LIKE :phone OR opn.phonenumber LIKE :phone) '. + 'AND pcc.center IN (:centers)' + ) + ->setMaxResults($limit) + ->setFirstResult($start) + ->setParameter('phone', $util->format($phoneNumber, PhoneNumberFormat::E164)) + ->setParameter('centers', $authorizedCenters) + ->getResult(); + } } diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepositoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepositoryInterface.php index 50fdcd4b3..aeaefecd4 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepositoryInterface.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepositoryInterface.php @@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Repository; use Chill\MainBundle\Search\SearchApiQuery; use Chill\PersonBundle\Entity\Person; +use libphonenumber\PhoneNumber; interface PersonACLAwareRepositoryInterface { @@ -60,4 +61,13 @@ interface PersonACLAwareRepositoryInterface ?string $phonenumber = null, ?string $city = null, ): array; + + /** + * @return list + */ + public function findByPhone( + PhoneNumber $phoneNumber, + int $start = 0, + int $limit = 20, + ): array; } diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php index 6d6373999..8d5e244ea 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php @@ -12,10 +12,12 @@ declare(strict_types=1); namespace Chill\PersonBundle\Repository; use Chill\PersonBundle\Entity\Person; +use Chill\PersonBundle\Entity\PersonPhone; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ObjectRepository; +use libphonenumber\PhoneNumber; class PersonRepository implements ObjectRepository { @@ -29,6 +31,8 @@ class PersonRepository implements ObjectRepository /** * @throws \Doctrine\ORM\NoResultException * @throws \Doctrine\ORM\NonUniqueResultException + * + * @deprecated */ public function countByPhone( string $phonenumber, @@ -71,6 +75,8 @@ class PersonRepository implements ObjectRepository /** * @throws \Exception + * + * @deprecated Use @see{self::findByPhoneNumber} or use a dedicated method in PersonACLAwareRepository */ public function findByPhone( string $phonenumber, @@ -91,6 +97,25 @@ class PersonRepository implements ObjectRepository return $qb->getQuery()->getResult(); } + /** + * Find a person which is associated to the given phonenumber, without restrictions + * on any. + * + * @return list + */ + public function findByPhoneNumber(PhoneNumber $phoneNumber, int $firstResult = 0, int $maxResults = 50): array + { + $qb = $this->repository->createQueryBuilder('p'); + $qb->select('p'); + + $this->searchByPhoneNumbers($qb, $phoneNumber); + + $qb->setFirstResult($firstResult) + ->setMaxResults($maxResults); + + return $qb->getQuery()->getResult(); + } + public function findOneBy(array $criteria) { return $this->repository->findOneBy($criteria); @@ -109,6 +134,20 @@ class PersonRepository implements ObjectRepository } } + private function searchByPhoneNumbers(QueryBuilder $qb, PhoneNumber $phoneNumber): void + { + $qb->setParameter('number', $phoneNumber, 'phone_number'); + + $orX = $qb->expr()->orX(); + $orX->add($qb->expr()->eq('p.mobilenumber', ':number')); + $orX->add($qb->expr()->eq('p.phonenumber', ':number')); + $orX->add( + $qb->expr()->exists('SELECT 1 FROM '.PersonPhone::class.' k WHERE k.phonenumber = :number AND k.person = p') + ); + + $qb->andWhere($orX); + } + /** * @throws \Exception */ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/mod/DuplicateSelector/AccompanyingPeriodWorkSelector.ts b/src/Bundle/ChillPersonBundle/Resources/public/mod/DuplicateSelector/AccompanyingPeriodWorkSelector.ts index 8f117d6ef..6ceb64b98 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/mod/DuplicateSelector/AccompanyingPeriodWorkSelector.ts +++ b/src/Bundle/ChillPersonBundle/Resources/public/mod/DuplicateSelector/AccompanyingPeriodWorkSelector.ts @@ -3,49 +3,47 @@ import AccompanyingPeriodWorkSelectorModal from "../../vuejs/_components/Accompa import { AccompanyingPeriodWork } from "../../types"; document.addEventListener("DOMContentLoaded", () => { - const elements = document.querySelectorAll( - 'div[data-pick-entities-type="acpw"]', + const elements = document.querySelectorAll( + 'div[data-pick-entities-type="acpw"]', + ); + elements.forEach((el) => { + const uniqid = el.dataset.inputUniqid; + + if (undefined === uniqid) { + throw "Uniqid not found on this element"; + } + + const input = document.querySelector( + `input[data-input-uniqid="${uniqid}"]`, ); - elements.forEach((el) => { - const uniqid = el.dataset.inputUniqid; - if (undefined === uniqid) { - throw "Uniqid not found on this element"; - } + if (null === input) { + throw "Element with uniqid not found: " + uniqid; + } - const input = document.querySelector( - `input[data-input-uniqid="${uniqid}"]`, - ); + const accompanyingPeriodIdAsString = input.dataset.accompanyingPeriodId; - if (null === input) { - throw "Element with uniqid not found: " + uniqid; - } + if (undefined === accompanyingPeriodIdAsString) { + throw "accompanying period id not found"; + } - const accompanyingPeriodIdAsString = input.dataset.accompanyingPeriodId; + const accompanyingPeriodId = Number.parseInt(accompanyingPeriodIdAsString); - if (undefined === accompanyingPeriodIdAsString) { - throw "accompanying period id not found"; - } - - const accompanyingPeriodId = Number.parseInt( - accompanyingPeriodIdAsString, - ); - - const app = createApp({ - template: - '', - components: { AccompanyingPeriodWorkSelectorModal }, - data() { - return { accompanyingPeriodId }; - }, - methods: { - pickWork: function (payload: { work: AccompanyingPeriodWork }) { - console.log("payload", payload); - input.value = payload.work.id.toString(); - }, - }, - }); - - app.mount(el); + const app = createApp({ + template: + '', + components: { AccompanyingPeriodWorkSelectorModal }, + data() { + return { accompanyingPeriodId }; + }, + methods: { + pickWork: function (payload: { work: AccompanyingPeriodWork }) { + console.log("payload", payload); + input.value = payload.work.id.toString(); + }, + }, }); + + app.mount(el); + }); }); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/types.ts b/src/Bundle/ChillPersonBundle/Resources/public/types.ts index 7d641c859..32dc24f73 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/types.ts +++ b/src/Bundle/ChillPersonBundle/Resources/public/types.ts @@ -1,253 +1,329 @@ import { - Address, - Scope, - Center, - Civility, - DateTime, - User, - WorkflowAvailable, - Job, - PrivateCommentEmbeddable, + Address, + Center, + Civility, + DateTime, + User, + UserGroup, + Household, + WorkflowAvailable, + Scope, + Job, + PrivateCommentEmbeddable, } from "ChillMainAssets/types"; import { StoredObject } from "ChillDocStoreAssets/types"; import { Thirdparty } from "../../../ChillThirdPartyBundle/Resources/public/types"; import { Calendar } from "../../../ChillCalendarBundle/Resources/public/types"; +export interface AltName { + label: string; + key: string; +} + export interface Person { - id: number; - type: "person"; - text: string; - textAge: string; - firstName: string; - lastName: string; - current_household_address: Address | null; - birthdate: DateTime | null; - deathdate: DateTime | null; - age: number; - phonenumber: string; - mobilenumber: string; - email: string; - gender: "woman" | "man" | "other"; - centers: Center[]; - civility: Civility | null; - current_household_id: number; - current_residential_addresses: Address[]; + id: number; + type: "person"; + text: string; + textAge: string; + firstName: string; + lastName: string; + altNames: AltName[]; + suffixText: string; + current_household_address: Address | null; + birthdate: DateTime | null; + deathdate: DateTime | null; + age: number; + phonenumber: string; + mobilenumber: string; + email: string; + gender: "woman" | "man" | "other"; + centers: Center[]; + civility: Civility | null; + current_household_id: number; + current_residential_addresses: Address[]; } export interface AccompanyingPeriod { - id: number; - addressLocation?: Address | null; - administrativeLocation?: Location | null; - calendars: Calendar[]; - closingDate?: Date | null; - closingMotive?: ClosingMotive | null; - comments: Comment[]; - confidential: boolean; - createdAt?: Date | null; - createdBy?: User | null; - emergency: boolean; - intensity?: "occasional" | "regular"; - job?: Job | null; - locationHistories: AccompanyingPeriodLocationHistory[]; - openingDate?: Date | null; - origin?: Origin | null; - participations: AccompanyingPeriodParticipation[]; - personLocation?: Person | null; - pinnedComment?: Comment | null; - preventUserIsChangedNotification: boolean; - remark: string; - requestorAnonymous: boolean; - requestorPerson?: Person | null; - requestorThirdParty?: Thirdparty | null; - resources: AccompanyingPeriodResource[]; - scopes: Scope[]; - socialIssues: SocialIssue[]; - step?: - | "CLOSED" - | "CONFIRMED" - | "CONFIRMED_INACTIVE_SHORT" - | "CONFIRMED_INACTIVE_LONG" - | "DRAFT"; -} - -export interface AccompanyingPeriodWorkEvaluationDocument { - id: number; - type: "accompanying_period_work_evaluation_document"; - storedObject: StoredObject; - title: string; - createdAt: DateTime | null; - createdBy: User | null; - updatedAt: DateTime | null; - updatedBy: User | null; - workflows_availables: WorkflowAvailable[]; - workflows: object[]; + id: number; + addressLocation?: Address | null; + administrativeLocation?: Location | null; + calendars: Calendar[]; + closingDate?: Date | null; + closingMotive?: ClosingMotive | null; + comments: Comment[]; + confidential: boolean; + createdAt?: Date | null; + createdBy?: User | null; + emergency: boolean; + intensity?: "occasional" | "regular"; + job?: Job | null; + locationHistories: AccompanyingPeriodLocationHistory[]; + openingDate?: Date | null; + origin?: Origin | null; + participations: AccompanyingPeriodParticipation[]; + personLocation?: Person | null; + pinnedComment?: Comment | null; + preventUserIsChangedNotification: boolean; + remark: string; + requestorAnonymous: boolean; + requestorPerson?: Person | null; + requestorThirdParty?: Thirdparty | null; + resources: AccompanyingPeriodResource[]; + scopes: Scope[]; + socialIssues: SocialIssue[]; + step?: + | "CLOSED" + | "CONFIRMED" + | "CONFIRMED_INACTIVE_SHORT" + | "CONFIRMED_INACTIVE_LONG" + | "DRAFT"; } export interface AccompanyingPeriodWork { - id: number; - accompanyingPeriod?: AccompanyingPeriod; - accompanyingPeriodWorkEvaluations: AccompanyingPeriodWorkEvaluation[]; - createdAt?: string; - createdAutomatically: boolean; - createdAutomaticallyReason: string; - createdBy: User; - endDate?: string; - goals: AccompanyingPeriodWorkGoal[]; - handlingThierParty?: Thirdparty; - note: string; - persons: Person[]; - privateComment: PrivateCommentEmbeddable; - referrersHistory: AccompanyingPeriodWorkReferrerHistory[]; - results: Result[]; - socialAction?: SocialAction; - startDate?: string; - thirdParties: Thirdparty[]; - updatedAt?: string; - updatedBy: User; - version: number; + id: number; + accompanyingPeriod?: AccompanyingPeriod; + accompanyingPeriodWorkEvaluations: AccompanyingPeriodWorkEvaluation[]; + createdAt?: string; + createdAutomatically: boolean; + createdAutomaticallyReason: string; + createdBy: User; + endDate?: string; + goals: AccompanyingPeriodWorkGoal[]; + handlingThierParty?: Thirdparty; + note: string; + persons: Person[]; + privateComment: PrivateCommentEmbeddable; + referrersHistory: AccompanyingPeriodWorkReferrerHistory[]; + results: Result[]; + socialAction?: SocialAction; + startDate?: string; + thirdParties: Thirdparty[]; + updatedAt?: string; + updatedBy: User; + version: number; } -interface SocialAction { - id: number; - parent?: SocialAction | null; - children: SocialAction[]; - issue?: SocialIssue | null; - ordering: number; - title: { - fr: string; - }; - defaultNotificationDelay?: string | null; - desactivationDate?: string | null; - evaluations: Evaluation[]; - goals: Goal[]; - results: Result[]; +export interface SocialAction { + id: number; + parent?: SocialAction | null; + children: SocialAction[]; + issue?: SocialIssue | null; + ordering: number; + title: { + fr: string; + }; + defaultNotificationDelay?: string | null; + desactivationDate?: string | null; + evaluations: Evaluation[]; + goals: Goal[]; + results: Result[]; } export interface AccompanyingPeriodResource { - id: number; - accompanyingPeriod: AccompanyingPeriod; - comment?: string | null; - person?: Person | null; - thirdParty?: Thirdparty | null; + id: number; + accompanyingPeriod: AccompanyingPeriod; + comment?: string | null; + person?: Person | null; + thirdParty?: Thirdparty | null; } export interface Origin { - id: number; - label: { - fr: string; - }; - noActiveAfter: DateTime; + id: number; + label: { + fr: string; + }; + noActiveAfter: DateTime; } export interface ClosingMotive { - id: number; - active: boolean; - name: { - fr: string; - }; - ordering: number; - isCanceledAccompanyingPeriod: boolean; - parent?: ClosingMotive | null; - children: ClosingMotive[]; + id: number; + active: boolean; + name: { + fr: string; + }; + ordering: number; + isCanceledAccompanyingPeriod: boolean; + parent?: ClosingMotive | null; + children: ClosingMotive[]; } export interface AccompanyingPeriodParticipation { - id: number; - startDate: DateTime; - endDate?: DateTime | null; - accompanyingPeriod: AccompanyingPeriod; - person: Person; + id: number; + startDate: DateTime; + endDate?: DateTime | null; + accompanyingPeriod: AccompanyingPeriod; + person: Person; } export interface AccompanyingPeriodLocationHistory { - id: number; - startDate: DateTime; - endDate?: DateTime | null; - addressLocation?: Address | null; - period: AccompanyingPeriod; - personLocation?: Person | null; + id: number; + startDate: DateTime; + endDate?: DateTime | null; + addressLocation?: Address | null; + period: AccompanyingPeriod; + personLocation?: Person | null; } export interface SocialIssue { - id: number; - parent?: SocialIssue | null; - children: SocialIssue[]; - socialActions?: SocialAction[] | null; - ordering: number; - title: { - fr: string; - }; - desactivationDate?: string | null; + id: number; + parent?: SocialIssue | null; + children: SocialIssue[]; + socialActions?: SocialAction[] | null; + ordering: number; + title: { + fr: string; + }; + desactivationDate?: string | null; } export interface Goal { - id: number; - results: Result[]; - socialActions?: SocialAction[] | null; - title: { - fr: string; - }; + id: number; + results: Result[]; + socialActions?: SocialAction[] | null; + title: { + fr: string; + }; } export interface Result { - id: number; - accompanyingPeriodWorks: AccompanyingPeriodWork[]; - accompanyingPeriodWorkGoals: AccompanyingPeriodWorkGoal[]; - goals: Goal[]; - socialActions: SocialAction[]; - title: { - fr: string; - }; - desactivationDate?: string | null; + id: number; + accompanyingPeriodWorks: AccompanyingPeriodWork[]; + accompanyingPeriodWorkGoals: AccompanyingPeriodWorkGoal[]; + goals: Goal[]; + socialActions: SocialAction[]; + title: { + fr: string; + }; + desactivationDate?: string | null; } export interface AccompanyingPeriodWorkGoal { - id: number; - accompanyingPeriodWork: AccompanyingPeriodWork; - goal: Goal; - note: string; - results: Result[]; + id: number; + accompanyingPeriodWork: AccompanyingPeriodWork; + goal: Goal; + note: string; + results: Result[]; } export interface AccompanyingPeriodWorkEvaluation { - accompanyingPeriodWork: AccompanyingPeriodWork | null; - comment: string; - createdAt: DateTime | null; - createdBy: User | null; - documents: AccompanyingPeriodWorkEvaluationDocument[]; - endDate: DateTime | null; - evaluation: Evaluation | null; - id: number | null; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - key: any; - maxDate: DateTime | null; - startDate: DateTime | null; - updatedAt: DateTime | null; - updatedBy: User | null; - warningInterval: string | null; - timeSpent: number | null; + accompanyingPeriodWork: AccompanyingPeriodWork | null; + comment: string; + createdAt: DateTime | null; + createdBy: User | null; + documents: AccompanyingPeriodWorkEvaluationDocument[]; + endDate: DateTime | null; + evaluation: Evaluation | null; + id: number | null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + key: any; + maxDate: DateTime | null; + startDate: DateTime | null; + updatedAt: DateTime | null; + updatedBy: User | null; + warningInterval: string | null; + timeSpent: number | null; } export interface Evaluation { - id: number; - url: string; - socialActions: SocialAction[]; - title: { - fr: string; - }; - active: boolean; - delay: string; - notificationDelay: string; + id: number; + url: string; + socialActions: SocialAction[]; + title: { + fr: string; + }; + active: boolean; + delay: string; + notificationDelay: string; } export interface AccompanyingPeriodWorkReferrerHistory { - id: number; - accompanyingPeriodWork: AccompanyingPeriodWork; - user: User; - startDate: DateTime; - endDate: DateTime | null; - createdAt: DateTime; - updatedAt: DateTime | null; - createdBy: User; - updatedBy: User | null; + id: number; + accompanyingPeriodWork: AccompanyingPeriodWork; + user: User; + startDate: DateTime; + endDate: DateTime | null; + createdAt: DateTime; + updatedAt: DateTime | null; + createdBy: User; + updatedBy: User | null; +} + +export interface AccompanyingPeriodWorkEvaluationDocument { + id: number; + type: "accompanying_period_work_evaluation_document"; + storedObject: StoredObject; + title: string; + createdAt: DateTime | null; + createdBy: User | null; + updatedAt: DateTime | null; + updatedBy: User | null; + workflows_availables: WorkflowAvailable[]; + workflows: object[]; +} + +export type EntityType = + | "user_group" + | "user" + | "person" + | "thirdparty" + | "household"; + +export type Entities = (UserGroup | User | Person | Thirdparty | Household) & { + address?: Address | null; + kind?: string; + text?: string; + profession?: string; +}; + +export type EntitiesOrMe = "me" | Entities; + +export type AddPersonResult = Entities & { + parent?: Entities | null; +}; + +export interface Suggestion { + key: string; + relevance: number; + result: AddPersonResult; +} + +export interface SearchPagination { + first: number; + items_per_page: number; + next: number | null; + previous: number | null; + more: boolean; +} + +export interface Search { + count: number; + pagination: SearchPagination; + results: Suggestion[]; +} + +export interface SearchOptions { + uniq: boolean; + type: string[]; + priority: number | null; + button: { + size: string; + class: string; + type: string; + display: string; + }; +} + +export class MakeFetchException extends Error { + sta: number; + txt: string; + violations: unknown | null; + + constructor(txt: string, sta: number, violations: unknown | null = null) { + super(txt); + this.name = "ValidationException"; + this.sta = sta; + this.txt = txt; + this.violations = violations; + Object.setPrototypeOf(this, MakeFetchException.prototype); + } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue index 85f031a64..e81949711 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue @@ -1,28 +1,28 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Confirm.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Confirm.vue index 408852711..3ce902daa 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Confirm.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Confirm.vue @@ -1,127 +1,120 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue index f781eca0b..af985e502 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue @@ -1,95 +1,85 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/OriginDemand.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/OriginDemand.vue index 641c9ef37..053eb058f 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/OriginDemand.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/OriginDemand.vue @@ -1,33 +1,33 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue index d6979928b..b4e0e70b8 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue @@ -1,121 +1,106 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue index 61a9d2571..c2dbd6e0c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue @@ -1,98 +1,97 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue index dbb21fa40..963ff65b5 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue @@ -1,116 +1,113 @@ - + + + - +
+ - -
+ -
-
    -
  • - -
  • -
-
+ -
- {{ $t("job.not_valid") }} -
+ + +
+ +
+ +
+ +
+ {{ $t("job.not_valid") }} +
+ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue index c2b9acfc4..5858cdb00 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue @@ -1,263 +1,239 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources.vue index 1ef9bfe45..fa600bfdd 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources.vue @@ -1,57 +1,57 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue index 8a52748d4..87daacf47 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue @@ -1,107 +1,107 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/WriteComment.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/WriteComment.vue index 26b561c5d..416c6085c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/WriteComment.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/WriteComment.vue @@ -1,34 +1,32 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Scopes.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Scopes.vue index 1d05e0bbe..fee6a89ad 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Scopes.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Scopes.vue @@ -1,25 +1,25 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/SocialIssue.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/SocialIssue.vue index 02d3b0c84..21c290f48 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/SocialIssue.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/SocialIssue.vue @@ -1,30 +1,30 @@ @@ -96,20 +91,20 @@ export default { @import "ChillPersonAssets/chill/scss/mixins"; @import "ChillMainAssets/chill/scss/chill_variables"; div#accompanying-course { - span.multiselect__tag { - @include badge_social($social-issue-color); - background: $chill-l-gray; - color: $dark; + span.multiselect__tag { + @include badge_social($social-issue-color); + background: $chill-l-gray; + color: $dark; + } + span.multiselect__option--highlight { + &::after { + background: $green; } - span.multiselect__option--highlight { - &::after { - background: $green; - } - &.multiselect__option--selected { - &::after { - background: $red; - } - } + &.multiselect__option--selected { + &::after { + background: $red; + } } + } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue index 0bfd87b18..d3e9ae97a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue @@ -1,22 +1,22 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue index 890aa5153..3ff18f03a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue @@ -1,207 +1,195 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav/Item.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav/Item.vue index 8e175f72b..ecdf3026c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav/Item.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav/Item.vue @@ -1,26 +1,22 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Test.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Test.vue index 904d4ff42..929b4edd8 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Test.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Test.vue @@ -1,155 +1,146 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue index 745317211..f8b5389f4 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue @@ -1,152 +1,135 @@ @@ -288,46 +267,46 @@ export default { @import "ChillPersonAssets/chill/scss/mixins"; @import "ChillMainAssets/chill/scss/chill_variables"; span.badge { - @include badge_social($social-issue-color); - font-size: 95%; - margin-bottom: 5px; - margin-right: 1em; - margin-left: 1em; + @include badge_social($social-issue-color); + font-size: 95%; + margin-bottom: 5px; + margin-right: 1em; + margin-left: 1em; } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue index f3404e2de..bd87224b2 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue @@ -1,482 +1,453 @@ - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/PersonSuggestion.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/PersonSuggestion.vue index bb90557b7..4499b40c8 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/PersonSuggestion.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/PersonSuggestion.vue @@ -1,136 +1,124 @@ - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeHousehold.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeHousehold.vue index 86a58737a..a1e33c4de 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeHousehold.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeHousehold.vue @@ -1,26 +1,25 @@ - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypePerson.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypePerson.vue index 259029f73..98119bd8e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypePerson.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypePerson.vue @@ -1,43 +1,48 @@ - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeThirdParty.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeThirdParty.vue index 8c97d2e29..28be7c119 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeThirdParty.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeThirdParty.vue @@ -1,126 +1,137 @@ - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUser.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUser.vue index 56b3afe17..74f80c321 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUser.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUser.vue @@ -1,40 +1,40 @@ - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUserGroup.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUserGroup.vue index 1daf921e1..ca3aa2cb8 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUserGroup.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUserGroup.vue @@ -1,32 +1,24 @@ + + - - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/HouseholdRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/HouseholdRenderBox.vue index ad996a375..e6f50708b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/HouseholdRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/HouseholdRenderBox.vue @@ -1,168 +1,161 @@ +
+ + {{ trans(RENDERBOX_HOUSEHOLD_NUMBER, { number: household.id }) }} +
+ +
+
    + +
  • + + + + + +
  • +
  • +

    + {{ trans(RENDERBOX_NO_MEMBERS_YET) }} +

    +
  • - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue index cdc143f76..0d9e3ec5f 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue @@ -1,493 +1,418 @@ - - - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue index f157fac6a..10302ee30 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue @@ -1,75 +1,51 @@ - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue index ff4b312f1..3a93a305d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue @@ -1,530 +1,466 @@ - - - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_js/i18n.ts b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_js/i18n.ts index ba7637544..088ff11ea 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_js/i18n.ts +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_js/i18n.ts @@ -1,64 +1,63 @@ const personMessages = { - fr: { - add_persons: { - title: "Ajouter des usagers", - suggested_counter: - "Pas de résultats | 1 résultat | {count} résultats", - selected_counter: " 1 sélectionné | {count} sélectionnés", - search_some_persons: "Rechercher des personnes..", - }, - item: { - type_person: "Usager", - type_user: "TMS", - type_thirdparty: "Tiers professionnel", - type_household: "Ménage", - }, - person: { - firstname: "Prénom", - lastname: "Nom", - born: (ctx: { gender: "man" | "woman" | "neutral" }) => { - if (ctx.gender === "man") { - return "Né le"; - } else if (ctx.gender === "woman") { - return "Née le"; - } else { - return "Né·e le"; - } - }, - center_id: "Identifiant du centre", - center_type: "Type de centre", - center_name: "Territoire", // vendée - phonenumber: "Téléphone", - mobilenumber: "Mobile", - altnames: "Autres noms", - email: "Courriel", - gender: { - title: "Genre", - placeholder: "Choisissez le genre de l'usager", - woman: "Féminin", - man: "Masculin", - neutral: "Neutre, non binaire", - unknown: "Non renseigné", - undefined: "Non renseigné", - }, - civility: { - title: "Civilité", - placeholder: "Choisissez la civilité", - }, - address: { - create_address: "Ajouter une adresse", - show_address_form: - "Ajouter une adresse pour un usager non suivi et seul dans un ménage", - warning: - "Un nouveau ménage va être créé. L'usager sera membre de ce ménage.", - }, - center: { - placeholder: "Choisissez un centre", - title: "Centre", - }, - }, - error_only_one_person: "Une seule personne peut être sélectionnée !", + fr: { + add_persons: { + title: "Ajouter des usagers", + suggested_counter: "Pas de résultats | 1 résultat | {count} résultats", + selected_counter: " 1 sélectionné | {count} sélectionnés", + search_some_persons: "Rechercher des personnes..", }, + item: { + type_person: "Usager", + type_user: "TMS", + type_thirdparty: "Tiers professionnel", + type_household: "Ménage", + }, + person: { + firstname: "Prénom", + lastname: "Nom", + born: (ctx: { gender: "man" | "woman" | "neutral" }) => { + if (ctx.gender === "man") { + return "Né le"; + } else if (ctx.gender === "woman") { + return "Née le"; + } else { + return "Né·e le"; + } + }, + center_id: "Identifiant du centre", + center_type: "Type de centre", + center_name: "Territoire", // vendée + phonenumber: "Téléphone", + mobilenumber: "Mobile", + altnames: "Autres noms", + email: "Courriel", + gender: { + title: "Genre", + placeholder: "Choisissez le genre de l'usager", + woman: "Féminin", + man: "Masculin", + neutral: "Neutre, non binaire", + unknown: "Non renseigné", + undefined: "Non renseigné", + }, + civility: { + title: "Civilité", + placeholder: "Choisissez la civilité", + }, + address: { + create_address: "Ajouter une adresse", + show_address_form: + "Ajouter une adresse pour un usager non suivi et seul dans un ménage", + warning: + "Un nouveau ménage va être créé. L'usager sera membre de ce ménage.", + }, + center: { + placeholder: "Choisissez un centre", + title: "Centre", + }, + }, + error_only_one_person: "Une seule personne peut être sélectionnée !", + }, }; export { personMessages }; diff --git a/src/Bundle/ChillPersonBundle/Tests/Repository/PersonACLAwareRepositoryTest.php b/src/Bundle/ChillPersonBundle/Tests/Repository/PersonACLAwareRepositoryTest.php index 94df35d88..667242111 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Repository/PersonACLAwareRepositoryTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Repository/PersonACLAwareRepositoryTest.php @@ -11,14 +11,17 @@ declare(strict_types=1); namespace Chill\PersonBundle\Tests\Repository; +use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Repository\CenterRepositoryInterface; use Chill\MainBundle\Repository\CountryRepository; use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface; use Chill\PersonBundle\Entity\Person; +use Chill\PersonBundle\Entity\PersonPhone; use Chill\PersonBundle\Repository\PersonACLAwareRepository; use Chill\PersonBundle\Security\Authorization\PersonVoter; use Doctrine\ORM\EntityManagerInterface; +use PHPUnit\Framework\Attributes\DataProvider; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; @@ -98,4 +101,67 @@ final class PersonACLAwareRepositoryTest extends KernelTestCase $this->assertStringContainsString('diallo', strtolower($person->getFirstName().' '.$person->getLastName())); } } + + /** + * @dataProvider providePersonsWithPhoneNumbers + */ + public function testFindByPhonenumber(\libphonenumber\PhoneNumber $phoneNumber, ?int $expectedId): void + { + $user = new User(); + + $authorizationHelper = $this->prophesize(AuthorizationHelperInterface::class); + $authorizationHelper->getReachableCenters(Argument::exact($user), Argument::exact(PersonVoter::SEE)) + ->willReturn($this->centerRepository->findAll()); + + $security = $this->prophesize(Security::class); + $security->getUser()->willReturn($user); + + $repository = new PersonACLAwareRepository( + $security->reveal(), + $this->entityManager, + $this->countryRepository, + $authorizationHelper->reveal() + ); + + $actual = $repository->findByPhone($phoneNumber, 0, 10); + + if (null === $expectedId) { + self::assertCount(0, $actual); + } else { + $actualIds = array_map(fn (Person $person) => $person->getId(), $actual); + + self::assertContains($expectedId, $actualIds); + } + } + + public static function providePersonsWithPhoneNumbers(): iterable + { + self::bootKernel(); + $em = self::getContainer()->get(EntityManagerInterface::class); + $center = $em->createQuery('SELECT c FROM '.Center::class.' c ')->setMaxResults(1) + ->getSingleResult(); + $util = \libphonenumber\PhoneNumberUtil::getInstance(); + + $mobile = $util->parse('+32486123456'); + $fixed = $util->parse('+3281136917'); + $anotherMobile = $util->parse('+32486123478'); + $person = (new Person())->setFirstName('diallo')->setLastName('diallo')->setCenter($center); + $person->setMobilenumber($mobile)->setPhonenumber($fixed); + $otherPhone = new PersonPhone(); + $otherPhone->setPerson($person); + $otherPhone->setPhonenumber($anotherMobile); + $otherPhone->setType('mobile'); + + $em->persist($person); + $em->persist($otherPhone); + + $em->flush(); + + self::ensureKernelShutdown(); + + yield [$mobile, $person->getId()]; + yield [$anotherMobile, $person->getId()]; + yield [$fixed, $person->getId()]; + yield [$util->parse('+331234567890'), null]; + } } diff --git a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml index 6e42a362b..ae7ac6284 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml @@ -206,3 +206,59 @@ accompanying_course_evaluation_document: accompanying_period_work: title: Action d'accompagnement (n°{id}) - {action_title} + +add_persons: + title: "Ajouter des usagers" + suggested_counter: >- + {count, plural, + =0 {Pas de résultats} + =1 {1 résultat} + other {# résultats} + } + selected_counter: >- + {count, plural, + =1 {1 sélectionné} + other {# sélectionnés} + } + search_some_persons: "Rechercher des personnes.." + + item: + type_person: "Usager" + type_user: "TMS" + type_thirdparty: "Tiers professionnel" + type_household: "Ménage" + + person: + firstname: "Prénom" + lastname: "Nom" + born: + man: "Né le" + woman: "Née le" + neutral: "Né·e le" + center_id: "Identifiant du centre" + center_type: "Type de centre" + center_name: "Territoire" + phonenumber: "Téléphone" + mobilenumber: "Mobile" + altnames: "Autres noms" + email: "Courriel" + gender: + title: "Genre" + placeholder: "Choisissez le genre de l'usager" + woman: "Féminin" + man: "Masculin" + neutral: "Neutre, non binaire" + unknown: "Non renseigné" + undefined: "Non renseigné" + civility: + title: "Civilité" + placeholder: "Choisissez la civilité" + address: + create_address: "Ajouter une adresse" + show_address_form: "Ajouter une adresse pour un usager non suivi et seul dans un ménage" + warning: "Un nouveau ménage va être créé. L'usager sera membre de ce ménage." + center: + placeholder: "Choisissez un centre" + title: "Centre" + + error_only_one_person: "Une seule personne peut être sélectionnée !" diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index c9f1af282..6c271fd80 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1522,3 +1522,48 @@ my_parcours_filters: parcours_intervening: Intervenant is_open: Parcours ouverts is_closed: Parcours clôturés + +person_messages: + add_persons: + title: "Ajouter des usagers" + suggested_counter: "Pas de résultats | 1 résultat | {count} résultats" + selected_counter: " 1 sélectionné | {count} sélectionnés" + search_some_persons: "Rechercher des personnes.." + item: + type_person: "Usager" + type_user: "TMS" + type_thirdparty: "Tiers professionnel" + type_household: "Ménage" + person: + firstname: "Prénom" + lastname: "Nom" + born: + man: "Né le" + woman: "Née le" + neutral: "Né·e le" + center_id: "Identifiant du centre" + center_type: "Type de centre" + center_name: "Territoire" + phonenumber: "Téléphone" + mobilenumber: "Mobile" + altnames: "Autres noms" + email: "Courriel" + gender: + title: "Genre" + placeholder: "Choisissez le genre de l'usager" + woman: "Féminin" + man: "Masculin" + neutral: "Neutre, non binaire" + unknown: "Non renseigné" + undefined: "Non renseigné" + civility: + title: "Civilité" + placeholder: "Choisissez la civilité" + address: + create_address: "Ajouter une adresse" + show_address_form: "Ajouter une adresse pour un usager non suivi et seul dans un ménage" + warning: "Un nouveau ménage va être créé. L'usager sera membre de ce ménage." + center: + placeholder: "Choisissez un centre" + title: "Centre" + error_only_one_person: "Une seule personne peut être sélectionnée !" diff --git a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php index 111be4089..3153713bb 100644 --- a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php +++ b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php @@ -18,12 +18,15 @@ use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ObjectRepository; +use libphonenumber\PhoneNumber; +use libphonenumber\PhoneNumberFormat; +use libphonenumber\PhoneNumberUtil; class ThirdPartyRepository implements ObjectRepository { private readonly EntityRepository $repository; - public function __construct(EntityManagerInterface $em, private readonly Connection $connection) + public function __construct(EntityManagerInterface $em, private readonly Connection $connection, private readonly PhoneNumberUtil $phonenumberUtil) { $this->repository = $em->getRepository(ThirdParty::class); } @@ -122,6 +125,43 @@ class ThirdPartyRepository implements ObjectRepository return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } + /** + * Finds third-party records by phone number. + * + * The search is performed agains every phonenumber field (there are two phonenumber on a thirdParty). + * + * @param string|PhoneNumber $phonenumber The phone number to search for. Can be a string or a PhoneNumber object. + * @param int $firstResult the index of the first result to retrieve (pagination start) + * @param int $maxResults the maximum number of results to retrieve (pagination limit) + * + * @return list the result set containing matching third-party records + */ + public function findByPhonenumber(string|PhoneNumber $phonenumber, int $firstResult = 0, int $maxResults = 20): array + { + if ('' === $phonenumber) { + return []; + } + + $qb = $this->createQueryBuilder('tp'); + $qb->select('tp'); + + $qb->where( + $qb->expr()->orX( + $qb->expr()->eq('tp.telephone', ':phonenumber'), + $qb->expr()->eq('tp.telephone2', ':phonenumber') + ) + ); + + $qb->setParameter( + 'phonenumber', + is_string($phonenumber) ? $phonenumber : $this->phonenumberUtil->format($phonenumber, PhoneNumberFormat::E164) + ); + + $qb->setFirstResult($firstResult)->setMaxResults($maxResults); + + return $qb->getQuery()->getResult(); + } + /** * Search amongst parties associated to $centers, with $terms parameters. * diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/types.ts b/src/Bundle/ChillThirdPartyBundle/Resources/public/types.ts index 20ae3309b..2d2acc42b 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/types.ts +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/types.ts @@ -1,47 +1,49 @@ import { - Address, - Center, - Civility, - DateTime, - User, + Address, + Center, + Civility, + DateTime, + User, } from "ChillMainAssets/types"; export interface Thirdparty { - acronym: string | null; - active: boolean; - address: Address | null; - canonicalized: string | null; - categories: ThirdpartyCategory[]; - centers: Center[]; - children: Thirdparty[]; - civility: Civility | null; - comment: string | null; - contactDataAnonymous: boolean; - createdAt: DateTime; - createdBy: User | null; - email: string | null; - firstname: string | null; - id: number | null; - kind: string; - name: string; - nameCompany: string | null; - parent: Thirdparty | null; - profession: string; - telephone: string | null; - thirdPartyTypes: ThirdpartyType[] | null; - updatedAt: DateTime | null; - updatedBy: User | null; + type: "thirdparty"; + text: string; + acronym: string | null; + active: boolean; + address: Address | null; + canonicalized: string | null; + categories: ThirdpartyCategory[]; + centers: Center[]; + children: Thirdparty[]; + civility: Civility | null; + comment: string | null; + contactDataAnonymous: boolean; + createdAt: DateTime; + createdBy: User | null; + email: string | null; + firstname: string | null; + id: number | null; + kind: string; + name: string; + nameCompany: string | null; + parent: Thirdparty | null; + profession: string; + telephone: string | null; + thirdPartyTypes: ThirdpartyType[] | null; + updatedAt: DateTime | null; + updatedBy: User | null; } interface ThirdpartyType { - key: string; - value: string; + key: string; + value: string; } export interface ThirdpartyCategory { - id: number; - active: boolean; - name: { - fr: string; - }; + id: number; + active: boolean; + name: { + fr: string; + }; } diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue index 0fee3dcdb..3413861ae 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue @@ -1,158 +1,131 @@ diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyText.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyText.vue index 2214605e2..dfd46efd9 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyText.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyText.vue @@ -1,28 +1,28 @@ diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue index 623926807..e3b2338bd 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue @@ -1,449 +1,450 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Confidential.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Confidential.vue index 9c010e8d1..13459b390 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Confidential.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Confidential.vue @@ -1,40 +1,40 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue index 7085b3b18..86f4155b6 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue @@ -1,77 +1,83 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/GenderIconRenderBox.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/GenderIconRenderBox.vue index 794771014..d47b9b777 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/GenderIconRenderBox.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/GenderIconRenderBox.vue @@ -1,28 +1,9 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserGroupRenderBox.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserGroupRenderBox.vue index 81f836c62..7c37e98a9 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserGroupRenderBox.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserGroupRenderBox.vue @@ -4,23 +4,23 @@ import { computed } from "vue"; import { localizeString } from "ChillMainAssets/lib/localizationHelper/localizationHelper"; interface UserGroupRenderBoxProps { - userGroup: UserGroup; + userGroup: UserGroup; } const props = defineProps(); const styles = computed<{ color: string; "background-color": string }>(() => { - return { - color: props.userGroup.foregroundColor, - "background-color": props.userGroup.backgroundColor, - }; + return { + color: props.userGroup.foregroundColor, + "background-color": props.userGroup.backgroundColor, + }; }); diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserRenderBoxBadge.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserRenderBoxBadge.vue index 4bae3b541..63c43c37f 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserRenderBoxBadge.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/UserRenderBoxBadge.vue @@ -1,31 +1,31 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/EntityWorkflowVueSubscriber.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/EntityWorkflowVueSubscriber.vue index 4d817a2f9..332849ef5 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/EntityWorkflowVueSubscriber.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/EntityWorkflowVueSubscriber.vue @@ -1,83 +1,83 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue index 658c0f9e9..59dcd80f4 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue @@ -1,45 +1,49 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Modal.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Modal.vue index 4808e2bda..06e1bfa1a 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Modal.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Modal.vue @@ -1,39 +1,42 @@ @@ -79,17 +73,17 @@ const emits = defineEmits<{ * This is a mask behind the modal. */ .modal-mask { - position: fixed; - z-index: 9998; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: rgba(0, 0, 0, 0.75); - transition: opacity 0.3s ease; + position: fixed; + z-index: 9998; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.75); + transition: opacity 0.3s ease; } .modal-header .close { - border-top-right-radius: 0.3rem; + border-top-right-radius: 0.3rem; } /* * The following styles are auto-applied to elements with @@ -100,23 +94,23 @@ const emits = defineEmits<{ * these styles. */ .modal-enter { - opacity: 0; + opacity: 0; } .modal-leave-active { - opacity: 0; + opacity: 0; } .modal-enter .modal-container, .modal-leave-active .modal-container { - -webkit-transform: scale(1.1); - transform: scale(1.1); + -webkit-transform: scale(1.1); + transform: scale(1.1); } h3.modal-title { - font-size: 1.5rem; - font-weight: bold; + font-size: 1.5rem; + font-weight: bold; } div.modal-footer { - button:first-child { - margin-right: auto; - } + button:first-child { + margin-right: auto; + } } diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadAllToggle.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadAllToggle.vue index bb7a43c92..57f7fd7f8 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadAllToggle.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadAllToggle.vue @@ -1,17 +1,17 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadToggle.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadToggle.vue index fb94af80f..cc64d4835 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadToggle.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Notification/NotificationReadToggle.vue @@ -1,96 +1,96 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.ts b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.ts index cbee6bf25..db9a37104 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.ts @@ -2,86 +2,87 @@ import { createI18n } from "vue-i18n"; import datetimeFormats from "../i18n/datetimeFormats"; const messages = { - fr: { - action: { - actions: "Actions", - show: "Voir", - edit: "Modifier", - create: "Créer", - remove: "Enlever", - delete: "Supprimer", - save: "Enregistrer", - valid: "Valider", - valid_and_see: "Valider et voir", - add: "Ajouter", - show_modal: "Ouvrir une modale", - ok: "OK", - cancel: "Annuler", - close: "Fermer", - back: "Retour", - check_all: "cocher tout", - reset: "réinitialiser", - redirect: { - person: "Quitter la page et ouvrir la fiche de l'usager", - thirdparty: "Quitter la page et voir le tiers", - }, - refresh: "Rafraîchir", - addContact: "Ajouter un contact", + fr: { + action: { + actions: "Actions", + show: "Voir", + edit: "Modifier", + create: "Créer", + remove: "Enlever", + delete: "Supprimer", + save: "Enregistrer", + valid: "Valider", + valid_and_see: "Valider et voir", + add: "Ajouter", + show_modal: "Ouvrir une modale", + ok: "OK", + cancel: "Annuler", + close: "Fermer", + back: "Retour", + check_all: "cocher tout", + reset: "réinitialiser", + redirect: { + person: "Quitter la page et ouvrir la fiche de l'usager", + thirdparty: "Quitter la page et voir le tiers", + }, + refresh: "Rafraîchir", + addContact: "Ajouter un contact", + }, + nav: { + next: "Suivant", + previous: "Précédent", + top: "Haut", + bottom: "Bas", + }, + renderbox: { + person: "Usager", + birthday: { + man: "Né le", + woman: "Née le", + neutral: "Né·e le", + unknown: "Né·e le", + }, + deathdate: "Date de décès", + household_without_address: "Le ménage de l'usager est sans adresse", + no_data: "Aucune information renseignée", + type: { + thirdparty: "Tiers", + person: "Usager", + }, + holder: "Titulaire", + years_old: "1 an | {n} an | {n} ans", + residential_address: "Adresse de résidence", + located_at: "réside chez", + }, }, - nav: { - next: "Suivant", - previous: "Précédent", - top: "Haut", - bottom: "Bas", - }, - renderbox: { - person: "Usager", - birthday: { - man: "Né le", - woman: "Née le", - neutral: "Né·e le", - unknown: "Né·e le", - }, - deathdate: "Date de décès", - household_without_address: "Le ménage de l'usager est sans adresse", - no_data: "Aucune information renseignée", - type: { - thirdparty: "Tiers", - person: "Usager", - }, - holder: "Titulaire", - years_old: "1 an | {n} an | {n} ans", - residential_address: "Adresse de résidence", - located_at: "réside chez", - }, - }, }; const _createI18n = (appMessages: any, legacy?: boolean) => { - Object.assign(messages.fr, appMessages.fr); - return createI18n({ - legacy: typeof legacy === undefined ? true : legacy, - locale: "fr", - fallbackLocale: "fr", - // @ts-ignore - datetimeFormats, - messages, - }); + Object.assign(messages.fr, appMessages.fr); + return createI18n({ + legacy: typeof legacy === undefined ? true : legacy, + locale: "fr", + fallbackLocale: "fr", + // @ts-ignore + datetimeFormats, + messages, + }); }; export { _createI18n }; export const multiSelectMessages = { - fr: { - multiselect: { - placeholder: "Choisir", - tag_placeholder: "Créer un nouvel élément", - select_label: '"Entrée" ou cliquez pour sélectionner', - deselect_label: '"Entrée" ou cliquez pour désélectionner', - select_group_label: 'Appuyer sur "Entrée" pour sélectionner ce groupe', - deselect_group_label: - 'Appuyer sur "Entrée" pour désélectionner ce groupe', - selected_label: "Sélectionné", + fr: { + multiselect: { + placeholder: "Choisir", + tag_placeholder: "Créer un nouvel élément", + select_label: '"Entrée" ou cliquez pour sélectionner', + deselect_label: '"Entrée" ou cliquez pour désélectionner', + select_group_label: + 'Appuyer sur "Entrée" pour sélectionner ce groupe', + deselect_group_label: + 'Appuyer sur "Entrée" pour désélectionner ce groupe', + selected_label: "Sélectionné", + }, }, - }, }; diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/i18n/datetimeFormats.ts b/src/Bundle/ChillMainBundle/Resources/public/vuejs/i18n/datetimeFormats.ts index aca1328ac..fe20cb217 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/i18n/datetimeFormats.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/i18n/datetimeFormats.ts @@ -1,27 +1,27 @@ export default { - fr: { - short: { - year: "numeric", - month: "numeric", - day: "numeric", + fr: { + short: { + year: "numeric", + month: "numeric", + day: "numeric", + }, + text: { + year: "numeric", + month: "long", + day: "numeric", + }, + long: { + year: "numeric", + month: "numeric", + day: "numeric", + hour: "numeric", + minute: "numeric", + hour12: false, + }, + hoursOnly: { + hour: "numeric", + minute: "numeric", + hour12: false, + }, }, - text: { - year: "numeric", - month: "long", - day: "numeric", - }, - long: { - year: "numeric", - month: "numeric", - day: "numeric", - hour: "numeric", - minute: "numeric", - hour12: false, - }, - hoursOnly: { - hour: "numeric", - minute: "numeric", - hour12: false, - }, - }, }; diff --git a/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig b/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig index d92f2e260..30f84c855 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig @@ -69,37 +69,35 @@
{% endif %} - {% block wrapping_content %} - {% block content %} - - {# DISABLED {{ chill_widget('homepage', {} ) }} #} + {# DISABLED {{ chill_widget('homepage', {} ) }} #} - {% include '@ChillMain/Homepage/index.html.twig' %} + {% include '@ChillMain/Homepage/index.html.twig' %} - {% endblock %} {% endblock %} diff --git a/src/Bundle/ChillMainBundle/Tests/Phonenumber/PhonenumberHelperTest.php b/src/Bundle/ChillMainBundle/Tests/Phonenumber/PhonenumberHelperTest.php index cae0cdd48..182980dd0 100644 --- a/src/Bundle/ChillMainBundle/Tests/Phonenumber/PhonenumberHelperTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Phonenumber/PhonenumberHelperTest.php @@ -12,7 +12,6 @@ declare(strict_types=1); namespace Chill\MainBundle\Tests\Phonenumber; use Chill\MainBundle\Phonenumber\PhonenumberHelper; -use libphonenumber\PhoneNumber; use libphonenumber\PhoneNumberUtil; use Psr\Log\NullLogger; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; @@ -32,7 +31,6 @@ final class PhonenumberHelperTest extends KernelTestCase public function testFormatPhonenumbers(string $defaultCarrierCode, string $phoneNumber, string $expected) { $util = PhoneNumberUtil::getInstance(); - $subject = new PhonenumberHelper( new ArrayAdapter(), new ParameterBag([ @@ -72,47 +70,4 @@ final class PhonenumberHelperTest extends KernelTestCase '00 33 6 23 12 45 54', ]; } - - /** - * @dataProvider providePhoneNumbersToParse - */ - public function testParsePhonenumbers(string $defaultCarrierCode, string $phoneNumber, PhoneNumber $expected): void - { - $subject = new PhonenumberHelper( - new ArrayAdapter(), - new ParameterBag([ - 'chill_main.phone_helper' => [ - 'default_carrier_code' => $defaultCarrierCode, - ], - ]), - new NullLogger() - ); - - $actual = $subject->parse($phoneNumber); - - self::assertTrue($expected->equals($actual)); - } - - public static function providePhoneNumbersToParse(): iterable - { - $util = PhoneNumberUtil::getInstance(); - - yield [ - 'FR', - '+32486544999', - $util->parse('+32486544999', 'FR'), - ]; - - yield [ - 'FR', - '32486544999', - $util->parse('+32486544999', 'FR'), - ]; - - yield [ - 'FR', - '0228858040', - $util->parse('+33228858040', 'FR'), - ]; - } } diff --git a/src/Bundle/ChillMainBundle/Tests/Validation/Validator/UserGroupDoNotExcludeTest.php b/src/Bundle/ChillMainBundle/Tests/Validation/Validator/UserGroupDoNotExcludeTest.php deleted file mode 100644 index d6d1c9887..000000000 --- a/src/Bundle/ChillMainBundle/Tests/Validation/Validator/UserGroupDoNotExcludeTest.php +++ /dev/null @@ -1,91 +0,0 @@ -validator->validate([], new \Chill\MainBundle\Validation\Constraint\UserGroupDoNotExclude()); - - $this->assertNoViolation(); - } - - public function testMixedUserGroupAndUsersIsValid(): void - { - $this->validator->validate( - [new User(), new UserGroup()], - new \Chill\MainBundle\Validation\Constraint\UserGroupDoNotExclude() - ); - - $this->assertNoViolation(); - } - - public function testDifferentExcludeKeysIsValid(): void - { - $this->validator->validate( - [(new UserGroup())->setExcludeKey('A'), (new UserGroup())->setExcludeKey('B')], - new \Chill\MainBundle\Validation\Constraint\UserGroupDoNotExclude() - ); - - $this->assertNoViolation(); - } - - public function testMultipleGroupsWithEmptyExcludeKeyIsValid(): void - { - $this->validator->validate( - [(new UserGroup())->setExcludeKey(''), (new UserGroup())->setExcludeKey('')], - new \Chill\MainBundle\Validation\Constraint\UserGroupDoNotExclude() - ); - - $this->assertNoViolation(); - } - - public function testSameExclusionKeyWillRaiseError(): void - { - $this->validator->validate( - [ - (new UserGroup())->setExcludeKey('A')->setLabel(['fr' => 'Group 1']), - (new UserGroup())->setExcludeKey('A')->setLabel(['fr' => 'Group 2']), - ], - new \Chill\MainBundle\Validation\Constraint\UserGroupDoNotExclude() - ); - - $this->buildViolation('The groups {{ excluded_groups }} do exclude themselves. Please choose one between them') - ->setParameter('excluded_groups', 'Group 1, Group 2') - ->setCode('e16c8226-0090-11ef-8560-f7239594db09') - ->assertRaised(); - } -} diff --git a/src/Bundle/ChillMainBundle/chill.api.specs.yaml b/src/Bundle/ChillMainBundle/chill.api.specs.yaml index 047f69675..d87a0eb71 100644 --- a/src/Bundle/ChillMainBundle/chill.api.specs.yaml +++ b/src/Bundle/ChillMainBundle/chill.api.specs.yaml @@ -10,31 +10,6 @@ servers: components: schemas: - Collection: - type: object - properties: - count: - type: number - format: u64 - pagination: - type: object - properties: - first: - type: number - format: u64 - items_per_page: - type: number - format: u64 - next: - type: string - format: uri - nullable: true - previous: - type: string - format: uri - nullable: true - more: - type: boolean EntityWorkflowAttachment: type: object properties: diff --git a/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml index 0d1b30ef8..2982d94db 100644 --- a/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml @@ -130,58 +130,3 @@ filter_order: Search: Chercher dans la liste By date: Filtrer par date search_box: Filtrer par contenu -renderbox: - person: "Usager" - birthday: - man: "Né le" - woman: "Née le" - neutral: "Né·e le" - unknown: "Né·e le" - deathdate: "Date de décès" - household_without_address: "Le ménage de l'usager est sans adresse" - no_data: "Aucune information renseignée" - type: - thirdparty: "Tiers" - person: "Usager" - holder: "Titulaire" - years_old: >- - {n, plural, - =0 {0 an} - one {1 an} - other {# ans} - } - residential_address: "Adresse de résidence" - located_at: "réside chez" - household_number: "Ménage n°{number}" - current_members: "Membres actuels" - no_current_address: "Sans adresse actuellement" - new_household: "Nouveau ménage" - no_members_yet: "Aucun membre actuellement" - -pick_entity: - add: "Ajouter" - modal_title: >- - {count, plural, - one {Indiquer un} - other {Ajouter des} - } - user: >- - {count, plural, - one {Utilisateur} - other {Utilisateurs} - } - user_group: >- - {count, plural, - one {Groupe d'utilisateur} - other {Groupes d'utilisateurs} - } - person: >- - {count, plural, - one {Usager} - other {Usagers} - } - thirdparty: >- - {count, plural, - one {Tiers} - other {Tiers} - } diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index 5e591fba8..d3498cba9 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -941,34 +941,3 @@ multiselect: editor: switch_to_simple: Éditeur simple switch_to_complex: Éditeur riche -action: - actions: Actions - show: Voir - edit: Modifier - create: Créer - remove: Enlever - delete: Supprimer - save: Enregistrer - valid: Valider - valid_and_see: Valider et voir - add: Ajouter - show_modal: Ouvrir une modale - ok: OK - cancel: Annuler - close: Fermer - back: Retour - check_all: cocher tout - reset: réinitialiser - redirect: - person: Quitter la page et ouvrir la fiche de l'usager - thirdparty: Quitter la page et voir le tiers - refresh: Rafraîchir - addContact: Ajouter un contact - -nav: - next: "Suivant" - previous: "Précédent" - top: "Haut" - bottom: "Bas" - - diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php index 0d972914d..686022ca3 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php @@ -21,8 +21,6 @@ use Chill\PersonBundle\Security\Authorization\PersonVoter; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\Query; -use libphonenumber\PhoneNumber; -use libphonenumber\PhoneNumberFormat; use Symfony\Component\Security\Core\Security; final readonly class PersonACLAwareRepository implements PersonACLAwareRepositoryInterface @@ -300,27 +298,4 @@ final readonly class PersonACLAwareRepository implements PersonACLAwareRepositor \array_map(static fn (Center $c) => $c->getId(), $authorizedCenters) ); } - - public function findByPhone(PhoneNumber $phoneNumber, int $start = 0, int $limit = 20): array - { - $authorizedCenters = $this->authorizationHelper - ->getReachableCenters($this->security->getUser(), PersonVoter::SEE); - - if ([] === $authorizedCenters) { - return []; - } - - $util = \libphonenumber\PhoneNumberUtil::getInstance(); - - return $this->em->createQuery( - 'SELECT p FROM '.Person::class.' p LEFT JOIN p.otherPhoneNumbers opn JOIN p.centerCurrent pcc '. - 'WHERE (p.phonenumber LIKE :phone OR p.mobilenumber LIKE :phone OR opn.phonenumber LIKE :phone) '. - 'AND pcc.center IN (:centers)' - ) - ->setMaxResults($limit) - ->setFirstResult($start) - ->setParameter('phone', $util->format($phoneNumber, PhoneNumberFormat::E164)) - ->setParameter('centers', $authorizedCenters) - ->getResult(); - } } diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepositoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepositoryInterface.php index aeaefecd4..50fdcd4b3 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepositoryInterface.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepositoryInterface.php @@ -13,7 +13,6 @@ namespace Chill\PersonBundle\Repository; use Chill\MainBundle\Search\SearchApiQuery; use Chill\PersonBundle\Entity\Person; -use libphonenumber\PhoneNumber; interface PersonACLAwareRepositoryInterface { @@ -61,13 +60,4 @@ interface PersonACLAwareRepositoryInterface ?string $phonenumber = null, ?string $city = null, ): array; - - /** - * @return list - */ - public function findByPhone( - PhoneNumber $phoneNumber, - int $start = 0, - int $limit = 20, - ): array; } diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php index 8d5e244ea..6d6373999 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php @@ -12,12 +12,10 @@ declare(strict_types=1); namespace Chill\PersonBundle\Repository; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Entity\PersonPhone; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ObjectRepository; -use libphonenumber\PhoneNumber; class PersonRepository implements ObjectRepository { @@ -31,8 +29,6 @@ class PersonRepository implements ObjectRepository /** * @throws \Doctrine\ORM\NoResultException * @throws \Doctrine\ORM\NonUniqueResultException - * - * @deprecated */ public function countByPhone( string $phonenumber, @@ -75,8 +71,6 @@ class PersonRepository implements ObjectRepository /** * @throws \Exception - * - * @deprecated Use @see{self::findByPhoneNumber} or use a dedicated method in PersonACLAwareRepository */ public function findByPhone( string $phonenumber, @@ -97,25 +91,6 @@ class PersonRepository implements ObjectRepository return $qb->getQuery()->getResult(); } - /** - * Find a person which is associated to the given phonenumber, without restrictions - * on any. - * - * @return list - */ - public function findByPhoneNumber(PhoneNumber $phoneNumber, int $firstResult = 0, int $maxResults = 50): array - { - $qb = $this->repository->createQueryBuilder('p'); - $qb->select('p'); - - $this->searchByPhoneNumbers($qb, $phoneNumber); - - $qb->setFirstResult($firstResult) - ->setMaxResults($maxResults); - - return $qb->getQuery()->getResult(); - } - public function findOneBy(array $criteria) { return $this->repository->findOneBy($criteria); @@ -134,20 +109,6 @@ class PersonRepository implements ObjectRepository } } - private function searchByPhoneNumbers(QueryBuilder $qb, PhoneNumber $phoneNumber): void - { - $qb->setParameter('number', $phoneNumber, 'phone_number'); - - $orX = $qb->expr()->orX(); - $orX->add($qb->expr()->eq('p.mobilenumber', ':number')); - $orX->add($qb->expr()->eq('p.phonenumber', ':number')); - $orX->add( - $qb->expr()->exists('SELECT 1 FROM '.PersonPhone::class.' k WHERE k.phonenumber = :number AND k.person = p') - ); - - $qb->andWhere($orX); - } - /** * @throws \Exception */ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/mod/DuplicateSelector/AccompanyingPeriodWorkSelector.ts b/src/Bundle/ChillPersonBundle/Resources/public/mod/DuplicateSelector/AccompanyingPeriodWorkSelector.ts index 6ceb64b98..8f117d6ef 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/mod/DuplicateSelector/AccompanyingPeriodWorkSelector.ts +++ b/src/Bundle/ChillPersonBundle/Resources/public/mod/DuplicateSelector/AccompanyingPeriodWorkSelector.ts @@ -3,47 +3,49 @@ import AccompanyingPeriodWorkSelectorModal from "../../vuejs/_components/Accompa import { AccompanyingPeriodWork } from "../../types"; document.addEventListener("DOMContentLoaded", () => { - const elements = document.querySelectorAll( - 'div[data-pick-entities-type="acpw"]', - ); - elements.forEach((el) => { - const uniqid = el.dataset.inputUniqid; - - if (undefined === uniqid) { - throw "Uniqid not found on this element"; - } - - const input = document.querySelector( - `input[data-input-uniqid="${uniqid}"]`, + const elements = document.querySelectorAll( + 'div[data-pick-entities-type="acpw"]', ); + elements.forEach((el) => { + const uniqid = el.dataset.inputUniqid; - if (null === input) { - throw "Element with uniqid not found: " + uniqid; - } + if (undefined === uniqid) { + throw "Uniqid not found on this element"; + } - const accompanyingPeriodIdAsString = input.dataset.accompanyingPeriodId; + const input = document.querySelector( + `input[data-input-uniqid="${uniqid}"]`, + ); - if (undefined === accompanyingPeriodIdAsString) { - throw "accompanying period id not found"; - } + if (null === input) { + throw "Element with uniqid not found: " + uniqid; + } - const accompanyingPeriodId = Number.parseInt(accompanyingPeriodIdAsString); + const accompanyingPeriodIdAsString = input.dataset.accompanyingPeriodId; - const app = createApp({ - template: - '', - components: { AccompanyingPeriodWorkSelectorModal }, - data() { - return { accompanyingPeriodId }; - }, - methods: { - pickWork: function (payload: { work: AccompanyingPeriodWork }) { - console.log("payload", payload); - input.value = payload.work.id.toString(); - }, - }, + if (undefined === accompanyingPeriodIdAsString) { + throw "accompanying period id not found"; + } + + const accompanyingPeriodId = Number.parseInt( + accompanyingPeriodIdAsString, + ); + + const app = createApp({ + template: + '', + components: { AccompanyingPeriodWorkSelectorModal }, + data() { + return { accompanyingPeriodId }; + }, + methods: { + pickWork: function (payload: { work: AccompanyingPeriodWork }) { + console.log("payload", payload); + input.value = payload.work.id.toString(); + }, + }, + }); + + app.mount(el); }); - - app.mount(el); - }); }); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/types.ts b/src/Bundle/ChillPersonBundle/Resources/public/types.ts index 32dc24f73..7d641c859 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/types.ts +++ b/src/Bundle/ChillPersonBundle/Resources/public/types.ts @@ -1,329 +1,253 @@ import { - Address, - Center, - Civility, - DateTime, - User, - UserGroup, - Household, - WorkflowAvailable, - Scope, - Job, - PrivateCommentEmbeddable, + Address, + Scope, + Center, + Civility, + DateTime, + User, + WorkflowAvailable, + Job, + PrivateCommentEmbeddable, } from "ChillMainAssets/types"; import { StoredObject } from "ChillDocStoreAssets/types"; import { Thirdparty } from "../../../ChillThirdPartyBundle/Resources/public/types"; import { Calendar } from "../../../ChillCalendarBundle/Resources/public/types"; -export interface AltName { - label: string; - key: string; -} - export interface Person { - id: number; - type: "person"; - text: string; - textAge: string; - firstName: string; - lastName: string; - altNames: AltName[]; - suffixText: string; - current_household_address: Address | null; - birthdate: DateTime | null; - deathdate: DateTime | null; - age: number; - phonenumber: string; - mobilenumber: string; - email: string; - gender: "woman" | "man" | "other"; - centers: Center[]; - civility: Civility | null; - current_household_id: number; - current_residential_addresses: Address[]; + id: number; + type: "person"; + text: string; + textAge: string; + firstName: string; + lastName: string; + current_household_address: Address | null; + birthdate: DateTime | null; + deathdate: DateTime | null; + age: number; + phonenumber: string; + mobilenumber: string; + email: string; + gender: "woman" | "man" | "other"; + centers: Center[]; + civility: Civility | null; + current_household_id: number; + current_residential_addresses: Address[]; } export interface AccompanyingPeriod { - id: number; - addressLocation?: Address | null; - administrativeLocation?: Location | null; - calendars: Calendar[]; - closingDate?: Date | null; - closingMotive?: ClosingMotive | null; - comments: Comment[]; - confidential: boolean; - createdAt?: Date | null; - createdBy?: User | null; - emergency: boolean; - intensity?: "occasional" | "regular"; - job?: Job | null; - locationHistories: AccompanyingPeriodLocationHistory[]; - openingDate?: Date | null; - origin?: Origin | null; - participations: AccompanyingPeriodParticipation[]; - personLocation?: Person | null; - pinnedComment?: Comment | null; - preventUserIsChangedNotification: boolean; - remark: string; - requestorAnonymous: boolean; - requestorPerson?: Person | null; - requestorThirdParty?: Thirdparty | null; - resources: AccompanyingPeriodResource[]; - scopes: Scope[]; - socialIssues: SocialIssue[]; - step?: - | "CLOSED" - | "CONFIRMED" - | "CONFIRMED_INACTIVE_SHORT" - | "CONFIRMED_INACTIVE_LONG" - | "DRAFT"; -} - -export interface AccompanyingPeriodWork { - id: number; - accompanyingPeriod?: AccompanyingPeriod; - accompanyingPeriodWorkEvaluations: AccompanyingPeriodWorkEvaluation[]; - createdAt?: string; - createdAutomatically: boolean; - createdAutomaticallyReason: string; - createdBy: User; - endDate?: string; - goals: AccompanyingPeriodWorkGoal[]; - handlingThierParty?: Thirdparty; - note: string; - persons: Person[]; - privateComment: PrivateCommentEmbeddable; - referrersHistory: AccompanyingPeriodWorkReferrerHistory[]; - results: Result[]; - socialAction?: SocialAction; - startDate?: string; - thirdParties: Thirdparty[]; - updatedAt?: string; - updatedBy: User; - version: number; -} - -export interface SocialAction { - id: number; - parent?: SocialAction | null; - children: SocialAction[]; - issue?: SocialIssue | null; - ordering: number; - title: { - fr: string; - }; - defaultNotificationDelay?: string | null; - desactivationDate?: string | null; - evaluations: Evaluation[]; - goals: Goal[]; - results: Result[]; -} - -export interface AccompanyingPeriodResource { - id: number; - accompanyingPeriod: AccompanyingPeriod; - comment?: string | null; - person?: Person | null; - thirdParty?: Thirdparty | null; -} - -export interface Origin { - id: number; - label: { - fr: string; - }; - noActiveAfter: DateTime; -} - -export interface ClosingMotive { - id: number; - active: boolean; - name: { - fr: string; - }; - ordering: number; - isCanceledAccompanyingPeriod: boolean; - parent?: ClosingMotive | null; - children: ClosingMotive[]; -} - -export interface AccompanyingPeriodParticipation { - id: number; - startDate: DateTime; - endDate?: DateTime | null; - accompanyingPeriod: AccompanyingPeriod; - person: Person; -} - -export interface AccompanyingPeriodLocationHistory { - id: number; - startDate: DateTime; - endDate?: DateTime | null; - addressLocation?: Address | null; - period: AccompanyingPeriod; - personLocation?: Person | null; -} - -export interface SocialIssue { - id: number; - parent?: SocialIssue | null; - children: SocialIssue[]; - socialActions?: SocialAction[] | null; - ordering: number; - title: { - fr: string; - }; - desactivationDate?: string | null; -} - -export interface Goal { - id: number; - results: Result[]; - socialActions?: SocialAction[] | null; - title: { - fr: string; - }; -} - -export interface Result { - id: number; - accompanyingPeriodWorks: AccompanyingPeriodWork[]; - accompanyingPeriodWorkGoals: AccompanyingPeriodWorkGoal[]; - goals: Goal[]; - socialActions: SocialAction[]; - title: { - fr: string; - }; - desactivationDate?: string | null; -} - -export interface AccompanyingPeriodWorkGoal { - id: number; - accompanyingPeriodWork: AccompanyingPeriodWork; - goal: Goal; - note: string; - results: Result[]; -} - -export interface AccompanyingPeriodWorkEvaluation { - accompanyingPeriodWork: AccompanyingPeriodWork | null; - comment: string; - createdAt: DateTime | null; - createdBy: User | null; - documents: AccompanyingPeriodWorkEvaluationDocument[]; - endDate: DateTime | null; - evaluation: Evaluation | null; - id: number | null; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - key: any; - maxDate: DateTime | null; - startDate: DateTime | null; - updatedAt: DateTime | null; - updatedBy: User | null; - warningInterval: string | null; - timeSpent: number | null; -} - -export interface Evaluation { - id: number; - url: string; - socialActions: SocialAction[]; - title: { - fr: string; - }; - active: boolean; - delay: string; - notificationDelay: string; -} - -export interface AccompanyingPeriodWorkReferrerHistory { - id: number; - accompanyingPeriodWork: AccompanyingPeriodWork; - user: User; - startDate: DateTime; - endDate: DateTime | null; - createdAt: DateTime; - updatedAt: DateTime | null; - createdBy: User; - updatedBy: User | null; + id: number; + addressLocation?: Address | null; + administrativeLocation?: Location | null; + calendars: Calendar[]; + closingDate?: Date | null; + closingMotive?: ClosingMotive | null; + comments: Comment[]; + confidential: boolean; + createdAt?: Date | null; + createdBy?: User | null; + emergency: boolean; + intensity?: "occasional" | "regular"; + job?: Job | null; + locationHistories: AccompanyingPeriodLocationHistory[]; + openingDate?: Date | null; + origin?: Origin | null; + participations: AccompanyingPeriodParticipation[]; + personLocation?: Person | null; + pinnedComment?: Comment | null; + preventUserIsChangedNotification: boolean; + remark: string; + requestorAnonymous: boolean; + requestorPerson?: Person | null; + requestorThirdParty?: Thirdparty | null; + resources: AccompanyingPeriodResource[]; + scopes: Scope[]; + socialIssues: SocialIssue[]; + step?: + | "CLOSED" + | "CONFIRMED" + | "CONFIRMED_INACTIVE_SHORT" + | "CONFIRMED_INACTIVE_LONG" + | "DRAFT"; } export interface AccompanyingPeriodWorkEvaluationDocument { - id: number; - type: "accompanying_period_work_evaluation_document"; - storedObject: StoredObject; - title: string; - createdAt: DateTime | null; - createdBy: User | null; - updatedAt: DateTime | null; - updatedBy: User | null; - workflows_availables: WorkflowAvailable[]; - workflows: object[]; + id: number; + type: "accompanying_period_work_evaluation_document"; + storedObject: StoredObject; + title: string; + createdAt: DateTime | null; + createdBy: User | null; + updatedAt: DateTime | null; + updatedBy: User | null; + workflows_availables: WorkflowAvailable[]; + workflows: object[]; } -export type EntityType = - | "user_group" - | "user" - | "person" - | "thirdparty" - | "household"; - -export type Entities = (UserGroup | User | Person | Thirdparty | Household) & { - address?: Address | null; - kind?: string; - text?: string; - profession?: string; -}; - -export type EntitiesOrMe = "me" | Entities; - -export type AddPersonResult = Entities & { - parent?: Entities | null; -}; - -export interface Suggestion { - key: string; - relevance: number; - result: AddPersonResult; +export interface AccompanyingPeriodWork { + id: number; + accompanyingPeriod?: AccompanyingPeriod; + accompanyingPeriodWorkEvaluations: AccompanyingPeriodWorkEvaluation[]; + createdAt?: string; + createdAutomatically: boolean; + createdAutomaticallyReason: string; + createdBy: User; + endDate?: string; + goals: AccompanyingPeriodWorkGoal[]; + handlingThierParty?: Thirdparty; + note: string; + persons: Person[]; + privateComment: PrivateCommentEmbeddable; + referrersHistory: AccompanyingPeriodWorkReferrerHistory[]; + results: Result[]; + socialAction?: SocialAction; + startDate?: string; + thirdParties: Thirdparty[]; + updatedAt?: string; + updatedBy: User; + version: number; } -export interface SearchPagination { - first: number; - items_per_page: number; - next: number | null; - previous: number | null; - more: boolean; +interface SocialAction { + id: number; + parent?: SocialAction | null; + children: SocialAction[]; + issue?: SocialIssue | null; + ordering: number; + title: { + fr: string; + }; + defaultNotificationDelay?: string | null; + desactivationDate?: string | null; + evaluations: Evaluation[]; + goals: Goal[]; + results: Result[]; } -export interface Search { - count: number; - pagination: SearchPagination; - results: Suggestion[]; +export interface AccompanyingPeriodResource { + id: number; + accompanyingPeriod: AccompanyingPeriod; + comment?: string | null; + person?: Person | null; + thirdParty?: Thirdparty | null; } -export interface SearchOptions { - uniq: boolean; - type: string[]; - priority: number | null; - button: { - size: string; - class: string; - type: string; - display: string; - }; +export interface Origin { + id: number; + label: { + fr: string; + }; + noActiveAfter: DateTime; } -export class MakeFetchException extends Error { - sta: number; - txt: string; - violations: unknown | null; - - constructor(txt: string, sta: number, violations: unknown | null = null) { - super(txt); - this.name = "ValidationException"; - this.sta = sta; - this.txt = txt; - this.violations = violations; - Object.setPrototypeOf(this, MakeFetchException.prototype); - } +export interface ClosingMotive { + id: number; + active: boolean; + name: { + fr: string; + }; + ordering: number; + isCanceledAccompanyingPeriod: boolean; + parent?: ClosingMotive | null; + children: ClosingMotive[]; +} + +export interface AccompanyingPeriodParticipation { + id: number; + startDate: DateTime; + endDate?: DateTime | null; + accompanyingPeriod: AccompanyingPeriod; + person: Person; +} + +export interface AccompanyingPeriodLocationHistory { + id: number; + startDate: DateTime; + endDate?: DateTime | null; + addressLocation?: Address | null; + period: AccompanyingPeriod; + personLocation?: Person | null; +} + +export interface SocialIssue { + id: number; + parent?: SocialIssue | null; + children: SocialIssue[]; + socialActions?: SocialAction[] | null; + ordering: number; + title: { + fr: string; + }; + desactivationDate?: string | null; +} + +export interface Goal { + id: number; + results: Result[]; + socialActions?: SocialAction[] | null; + title: { + fr: string; + }; +} + +export interface Result { + id: number; + accompanyingPeriodWorks: AccompanyingPeriodWork[]; + accompanyingPeriodWorkGoals: AccompanyingPeriodWorkGoal[]; + goals: Goal[]; + socialActions: SocialAction[]; + title: { + fr: string; + }; + desactivationDate?: string | null; +} + +export interface AccompanyingPeriodWorkGoal { + id: number; + accompanyingPeriodWork: AccompanyingPeriodWork; + goal: Goal; + note: string; + results: Result[]; +} + +export interface AccompanyingPeriodWorkEvaluation { + accompanyingPeriodWork: AccompanyingPeriodWork | null; + comment: string; + createdAt: DateTime | null; + createdBy: User | null; + documents: AccompanyingPeriodWorkEvaluationDocument[]; + endDate: DateTime | null; + evaluation: Evaluation | null; + id: number | null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + key: any; + maxDate: DateTime | null; + startDate: DateTime | null; + updatedAt: DateTime | null; + updatedBy: User | null; + warningInterval: string | null; + timeSpent: number | null; +} + +export interface Evaluation { + id: number; + url: string; + socialActions: SocialAction[]; + title: { + fr: string; + }; + active: boolean; + delay: string; + notificationDelay: string; +} + +export interface AccompanyingPeriodWorkReferrerHistory { + id: number; + accompanyingPeriodWork: AccompanyingPeriodWork; + user: User; + startDate: DateTime; + endDate: DateTime | null; + createdAt: DateTime; + updatedAt: DateTime | null; + createdBy: User; + updatedBy: User | null; } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue index e81949711..85f031a64 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue @@ -1,28 +1,28 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Confirm.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Confirm.vue index 3ce902daa..408852711 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Confirm.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Confirm.vue @@ -1,120 +1,127 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue index af985e502..f781eca0b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue @@ -1,85 +1,95 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/OriginDemand.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/OriginDemand.vue index 053eb058f..641c9ef37 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/OriginDemand.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/OriginDemand.vue @@ -1,33 +1,33 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue index b4e0e70b8..d6979928b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue @@ -1,106 +1,121 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue index c2dbd6e0c..61a9d2571 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue @@ -1,97 +1,98 @@ - - + + + + + diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue index 963ff65b5..dbb21fa40 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue @@ -1,113 +1,116 @@ - - - + -
- + - + +
- +
+
    +
  • + +
  • +
+
- - - +
+ {{ $t("job.not_valid") }} +
- -
-
    -
  • - -
  • -
-
- -
- {{ $t("job.not_valid") }} -
- diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue index 5858cdb00..c2b9acfc4 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue @@ -1,239 +1,263 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources.vue index fa600bfdd..1ef9bfe45 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources.vue @@ -1,57 +1,57 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue index 87daacf47..8a52748d4 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue @@ -1,107 +1,107 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/WriteComment.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/WriteComment.vue index 416c6085c..26b561c5d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/WriteComment.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/WriteComment.vue @@ -1,32 +1,34 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Scopes.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Scopes.vue index fee6a89ad..1d05e0bbe 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Scopes.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Scopes.vue @@ -1,25 +1,25 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/SocialIssue.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/SocialIssue.vue index 21c290f48..02d3b0c84 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/SocialIssue.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/SocialIssue.vue @@ -1,30 +1,30 @@ @@ -91,20 +96,20 @@ export default { @import "ChillPersonAssets/chill/scss/mixins"; @import "ChillMainAssets/chill/scss/chill_variables"; div#accompanying-course { - span.multiselect__tag { - @include badge_social($social-issue-color); - background: $chill-l-gray; - color: $dark; - } - span.multiselect__option--highlight { - &::after { - background: $green; + span.multiselect__tag { + @include badge_social($social-issue-color); + background: $chill-l-gray; + color: $dark; } - &.multiselect__option--selected { - &::after { - background: $red; - } + span.multiselect__option--highlight { + &::after { + background: $green; + } + &.multiselect__option--selected { + &::after { + background: $red; + } + } } - } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue index d3e9ae97a..0bfd87b18 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue @@ -1,22 +1,22 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue index 3ff18f03a..890aa5153 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue @@ -1,195 +1,207 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav/Item.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav/Item.vue index ecdf3026c..8e175f72b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav/Item.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav/Item.vue @@ -1,22 +1,26 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Test.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Test.vue index 929b4edd8..904d4ff42 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Test.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Test.vue @@ -1,146 +1,155 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue index f8b5389f4..745317211 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue @@ -1,135 +1,152 @@ @@ -267,46 +288,46 @@ export default { @import "ChillPersonAssets/chill/scss/mixins"; @import "ChillMainAssets/chill/scss/chill_variables"; span.badge { - @include badge_social($social-issue-color); - font-size: 95%; - margin-bottom: 5px; - margin-right: 1em; - margin-left: 1em; + @include badge_social($social-issue-color); + font-size: 95%; + margin-bottom: 5px; + margin-right: 1em; + margin-left: 1em; } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue index bd87224b2..f3404e2de 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue @@ -1,453 +1,482 @@ @@ -806,172 +841,172 @@ export default { @import "~ChillMainAssets/chill/scss/mixins"; div#workEditor { - display: grid; - grid-template-columns: 50%; - column-gap: 0rem; - grid-template-areas: - "title title" - "startDate endDate" - "comment comment" - "privateComment privateComment" - "objectives objectives" - "evaluations evaluations" - "persons persons" - "referrers referrers" - "handling handling" - "tparties tparties" - "errors errors"; + display: grid; + grid-template-columns: 50%; + column-gap: 0rem; + grid-template-areas: + "title title" + "startDate endDate" + "comment comment" + "privateComment privateComment" + "objectives objectives" + "evaluations evaluations" + "persons persons" + "referrers referrers" + "handling handling" + "tparties tparties" + "errors errors"; - #title { - grid-area: title; - } - #startDate { - grid-area: startDate; - } - #endDate { - grid-area: endDate; - } - #comment { - grid-area: comment; - } - #privateComment { - grid-area: privateComment; - } - #objectives { - grid-area: objectives; - } - #evaluations { - grid-area: evaluations; - } - #persons { - grid-area: persons; - } - #handlingThirdParty { - grid-area: handling; - } - #thirdParties { - grid-area: tparties; - } - #referrers { - grid-area: referrers; - } - #errors { - grid-area: errors; - } - - div.action-row { - @include border-collapse; - padding: 1em; - - &#title { - label { - margin-bottom: 0; - } - p { - margin-top: 0; - font-weight: bold; - font-size: 1rem; - } + #title { + grid-area: title; + } + #startDate { + grid-area: startDate; + } + #endDate { + grid-area: endDate; + } + #comment { + grid-area: comment; + } + #privateComment { + grid-area: privateComment; + } + #objectives { + grid-area: objectives; + } + #evaluations { + grid-area: evaluations; + } + #persons { + grid-area: persons; + } + #handlingThirdParty { + grid-area: handling; + } + #thirdParties { + grid-area: tparties; + } + #referrers { + grid-area: referrers; + } + #errors { + grid-area: errors; } - &#objectives { - & > div { - display: grid; - grid-template-columns: 50%; - column-gap: 0rem; - grid-template-areas: "obj res"; - - & > div { - @include border-collapse; - padding: 1em; - - &:nth-child(1) { - grid-area: obj; - } - - &:nth-child(2) { - grid-area: res; - } - } - - & > div.results_without_objective { - background: repeating-linear-gradient( - 45deg, - $gray-200, - $gray-200 10px, - $gray-100 10px, - $gray-100 20px - ); - text-align: center; - font-weight: 700; - padding-top: 1.5rem; - } - } - } - - &#evaluations { - & > div { + div.action-row { @include border-collapse; padding: 1em; - } - } - &#objectives, - &#evaluations { - padding: 0; - - & > div.title { - background-color: $gray-200; - color: $gray-700; - - h3 { - text-align: center; + &#title { + label { + margin-bottom: 0; + } + p { + margin-top: 0; + font-weight: bold; + font-size: 1rem; + } } - } - .item-title { - font-weight: bold; - } - .item-details { - margin: 1em 2em; - font-size: 85%; - } + &#objectives { + & > div { + display: grid; + grid-template-columns: 50%; + column-gap: 0rem; + grid-template-areas: "obj res"; - i.fa { - padding: 0.25rem; - color: $white; + & > div { + @include border-collapse; + padding: 1em; - &.fa-times { - color: $red; + &:nth-child(1) { + grid-area: obj; + } + + &:nth-child(2) { + grid-area: res; + } + } + + & > div.results_without_objective { + background: repeating-linear-gradient( + 45deg, + $gray-200, + $gray-200 10px, + $gray-100 10px, + $gray-100 20px + ); + text-align: center; + font-weight: 700; + padding-top: 1.5rem; + } + } + } + + &#evaluations { + & > div { + @include border-collapse; + padding: 1em; + } + } + + &#objectives, + &#evaluations { + padding: 0; + + & > div.title { + background-color: $gray-200; + color: $gray-700; + + h3 { + text-align: center; + } + } + + .item-title { + font-weight: bold; + } + .item-details { + margin: 1em 2em; + font-size: 85%; + } + + i.fa { + padding: 0.25rem; + color: $white; + + &.fa-times { + color: $red; + } + } + } + + &#persons { + margin-top: 1.5em; + } + + ul.record_actions { + margin-bottom: 0; } - } } - &#persons { - margin-top: 1.5em; + div#errors { + &.alert { + margin-top: 2em; + } } - - ul.record_actions { - margin-bottom: 0; - } - } - - div#errors { - &.alert { - margin-top: 2em; - } - } } .accordion-item:first-of-type, .accordion-item:last-of-type { - border-radius: 0rem; - border: 0px; - .accordion-button { - padding: 0.25rem; - border: 1px solid rgba(17, 17, 17, 0.125); - margin-top: 20px; - margin-bottom: 20px; - } + border-radius: 0rem; + border: 0px; + .accordion-button { + padding: 0.25rem; + border: 1px solid rgba(17, 17, 17, 0.125); + margin-top: 20px; + margin-bottom: 20px; + } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue index ee8cca532..77b6810bb 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue @@ -1,67 +1,70 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddResult.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddResult.vue index f25de72c8..aa8948a4e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddResult.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddResult.vue @@ -1,167 +1,179 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue index 30bb2a2dd..b54baf09a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue @@ -1,11 +1,11 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/App.vue index 7922362ca..29b707842 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/App.vue @@ -1,447 +1,445 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/App.vue index a58b8a98a..b8e8ee8c4 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/App.vue @@ -1,53 +1,53 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue index ae422f150..d4bacd855 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue @@ -1,74 +1,88 @@ @@ -78,61 +92,62 @@ import AddPersons from "ChillPersonAssets/vuejs/_components/AddPersons.vue"; import PersonText from "ChillPersonAssets/vuejs/_components/Entity/PersonText.vue"; export default { - name: "Concerned", - components: { - AddPersons, - PersonText, - }, - computed: { - ...mapState(["concerned", "household"]), - ...mapGetters(["persons"]), - noPerson() { - return this.$store.getters.persons.length === 0; + name: "Concerned", + components: { + AddPersons, + PersonText, }, - concernedPersonsWithHouseholds() { - if (this.$store.state.household) { - return this.$store.state.concerned.filter( - (c) => - c.person.current_household_id !== null && - c.person.current_household_id !== this.$store.state.household.id, - ); - } else { - return []; - } - }, - }, - data() { - return { - addPersons: { - key: "household_members_editor_concerned", - options: { - type: ["person"], - priority: null, - uniq: false, + computed: { + ...mapState(["concerned", "household"]), + ...mapGetters(["persons"]), + noPerson() { + return this.$store.getters.persons.length === 0; + }, + concernedPersonsWithHouseholds() { + if (this.$store.state.household) { + return this.$store.state.concerned.filter( + (c) => + c.person.current_household_id !== null && + c.person.current_household_id !== + this.$store.state.household.id, + ); + } else { + return []; + } }, - }, - }; - }, - methods: { - addNewPersons({ selected, modal }) { - selected.forEach(function (item) { - this.$store.dispatch("addConcerned", item.result); - }, this); - this.$refs.addPersons.resetSearch(); // to cast child method - modal.showModal = false; }, - removeConcerned(concerned) { - console.log("removedconcerned", concerned); + data() { + return { + addPersons: { + key: "household_members_editor_concerned", + options: { + type: ["person"], + priority: null, + uniq: false, + }, + }, + }; + }, + methods: { + addNewPersons({ selected, modal }) { + selected.forEach(function (item) { + this.$store.dispatch("addConcerned", item.result); + }, this); + this.$refs.addPersons.resetSearch(); // to cast child method + modal.showModal = false; + }, + removeConcerned(concerned) { + console.log("removedconcerned", concerned); - if (!concerned.allowRemove) { - return; - } + if (!concerned.allowRemove) { + return; + } - this.$store.dispatch("removePerson", concerned.person); + this.$store.dispatch("removePerson", concerned.person); + }, + makeHouseholdLink(id) { + return `/fr/person/household/${id}/summary`; + }, }, - makeHouseholdLink(id) { - return `/fr/person/household/${id}/summary`; - }, - }, }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Confirmation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Confirmation.vue index 5441bc1af..902e95648 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Confirmation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Confirmation.vue @@ -1,20 +1,20 @@ @@ -23,14 +23,14 @@ import { mapState } from "vuex"; export default { - name: "Confirmation", - computed: { - ...mapState({ - hasWarnings: (state) => - state.warnings.length > 0 || state.errors.length > 0, - warnings: (state) => state.warnings, - errors: (state) => state.errors, - }), - }, + name: "Confirmation", + computed: { + ...mapState({ + hasWarnings: (state) => + state.warnings.length > 0 || state.errors.length > 0, + warnings: (state) => state.warnings, + errors: (state) => state.errors, + }), + }, }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/CurrentHousehold.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/CurrentHousehold.vue index 3ae8c1ab6..34002972c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/CurrentHousehold.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/CurrentHousehold.vue @@ -1,35 +1,37 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Dates.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Dates.vue index 1139d2fe9..8757f23bc 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Dates.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Dates.vue @@ -1,83 +1,83 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue index 56798341a..9773d178e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue @@ -1,116 +1,130 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/HouseholdAddress.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/HouseholdAddress.vue index c7d9d8aac..af6f00d84 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/HouseholdAddress.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/HouseholdAddress.vue @@ -1,26 +1,30 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/MemberDetails.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/MemberDetails.vue index 3bdfb9d03..13515efec 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/MemberDetails.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/MemberDetails.vue @@ -1,102 +1,104 @@ @@ -106,44 +108,44 @@ import PersonRenderBox from "ChillPersonAssets/vuejs/_components/Entity/PersonRe import CommentEditor from "ChillMainAssets/vuejs/_components/CommentEditor/CommentEditor.vue"; export default { - name: "MemberDetails", - components: { - PersonRenderBox, - CommentEditor, - }, - props: ["conc"], - computed: { - ...mapGetters(["concByPersonId"]), - classicEditor: () => ClassicEditor, - editorConfig: () => classicEditorConfig, - isHolder() { - return this.conc.holder; + name: "MemberDetails", + components: { + PersonRenderBox, + CommentEditor, }, - comment: { - get() { - return this.conc.comment; - }, - set(text) { - console.log("set comment"); - console.log("comment", text); + props: ["conc"], + computed: { + ...mapGetters(["concByPersonId"]), + classicEditor: () => ClassicEditor, + editorConfig: () => classicEditorConfig, + isHolder() { + return this.conc.holder; + }, + comment: { + get() { + return this.conc.comment; + }, + set(text) { + console.log("set comment"); + console.log("comment", text); - this.$store.dispatch("setComment", { - conc: this.conc, - comment: text, - }); - }, + this.$store.dispatch("setComment", { + conc: this.conc, + comment: text, + }); + }, + }, }, - }, - methods: { - toggleHolder() { - this.$store.dispatch("toggleHolder", this.conc); + methods: { + toggleHolder() { + this.$store.dispatch("toggleHolder", this.conc); + }, + removePosition() { + this.$store.dispatch("removePosition", this.conc); + }, + removeConcerned() { + this.$store.dispatch("removeConcerned", this.conc); + }, }, - removePosition() { - this.$store.dispatch("removePosition", this.conc); - }, - removeConcerned() { - this.$store.dispatch("removeConcerned", this.conc); - }, - }, }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/PersonComment.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/PersonComment.vue index 99fb3ebfa..6630a72f1 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/PersonComment.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/PersonComment.vue @@ -1,30 +1,30 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Positioning.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Positioning.vue index 26ab0058e..a19d80c7a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Positioning.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Positioning.vue @@ -1,57 +1,57 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue index e9ee85164..401f41be5 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue @@ -1,181 +1,211 @@ + + + + +
    +
  • + - {{ layer.label }} - - - - - - - - - - - - - -
      -
    • - -
    • -
    +
  • +
@@ -645,21 +694,21 @@ export default { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/AddPersons.ts b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/AddPersons.js similarity index 57% rename from src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/AddPersons.ts rename to src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/AddPersons.js index 519a3d3e7..1d0a607ed 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/AddPersons.ts +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/AddPersons.js @@ -1,15 +1,7 @@ -import { Search, SearchOptions } from "ChillPersonAssets/types"; - /* * Build query string with query and options */ -const parametersToString = ({ - query, - options, -}: { - query: string; - options: SearchOptions; -}) => { +const parametersToString = ({ query, options }) => { let types = ""; options.type.forEach(function (type) { types += "&type[]=" + type; @@ -24,13 +16,11 @@ const parametersToString = ({ * @query string - the query to search for * @deprecated */ -export function searchPersons( - { query, options }: { query: string; options: SearchOptions }, - signal: AbortSignal, -): Promise { - const queryStr = parametersToString({ query, options }); - const url = `/fr/search.json?name=person_regular&${queryStr}`; - const fetchOpts = { +const searchPersons = ({ query, options }, signal) => { + console.err("deprecated"); + let queryStr = parametersToString({ query, options }); + let url = `/fr/search.json?name=person_regular&${queryStr}`; + let fetchOpts = { method: "GET", headers: { "Content-Type": "application/json;charset=utf-8", @@ -44,7 +34,7 @@ export function searchPersons( } throw Error("Error with request resource response"); }); -} +}; /* * Endpoint v.2 chill_main_search_global @@ -53,16 +43,15 @@ export function searchPersons( * @param query string - the query to search for * */ -export function searchEntities( - { query, options }: { query: string; options: SearchOptions }, - signal: AbortSignal, -): Promise { - const queryStr = parametersToString({ query, options }); - const url = `/api/1.0/search.json?${queryStr}`; +const searchEntities = ({ query, options }, signal) => { + let queryStr = parametersToString({ query, options }); + let url = `/api/1.0/search.json?${queryStr}`; return fetch(url, { signal }).then((response) => { if (response.ok) { return response.json(); } throw Error("Error with request resource response"); }); -} +}; + +export { searchPersons, searchEntities }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/accompanyingCourseWorkEvaluationDocument.ts b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/accompanyingCourseWorkEvaluationDocument.ts index 577c4b52b..ddb37fab1 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/accompanyingCourseWorkEvaluationDocument.ts +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/accompanyingCourseWorkEvaluationDocument.ts @@ -2,10 +2,10 @@ import { AccompanyingPeriodWorkEvaluationDocument } from "../../types"; import { makeFetch } from "../../../../../ChillMainBundle/Resources/public/lib/api/apiMethods"; export const duplicate = async ( - id: number, + id: number, ): Promise => { - return makeFetch( - "POST", - `/api/1.0/person/accompanying-course-work-evaluation-document/${id}/duplicate`, - ); + return makeFetch( + "POST", + `/api/1.0/person/accompanying-course-work-evaluation-document/${id}/duplicate`, + ); }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriod/SetReferrer.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriod/SetReferrer.vue index 0a8d07f30..8391fbbb6 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriod/SetReferrer.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriod/SetReferrer.vue @@ -1,44 +1,53 @@ - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkItem.vue index 98668a65b..330423a20 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkItem.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkItem.vue @@ -1,45 +1,51 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkList.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkList.vue index c3615c959..b2ebc5f1c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkList.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkList.vue @@ -1,24 +1,24 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkSelectorModal.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkSelectorModal.vue index ee2c7c66c..4b4f3ddba 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkSelectorModal.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkSelectorModal.vue @@ -1,52 +1,62 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue index 24cdca24e..5e81b8241 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue @@ -1,489 +1,517 @@ - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/PersonSuggestion.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/PersonSuggestion.vue index 4499b40c8..bb90557b7 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/PersonSuggestion.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/PersonSuggestion.vue @@ -1,124 +1,136 @@ - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeHousehold.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeHousehold.vue index a1e33c4de..86a58737a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeHousehold.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeHousehold.vue @@ -1,25 +1,26 @@ - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypePerson.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypePerson.vue index 98119bd8e..259029f73 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypePerson.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypePerson.vue @@ -1,48 +1,43 @@ - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeThirdParty.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeThirdParty.vue index 28be7c119..8c97d2e29 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeThirdParty.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeThirdParty.vue @@ -1,137 +1,126 @@ - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUser.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUser.vue index 74f80c321..56b3afe17 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUser.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUser.vue @@ -1,40 +1,40 @@ - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUserGroup.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUserGroup.vue index ca3aa2cb8..1daf921e1 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUserGroup.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUserGroup.vue @@ -1,24 +1,32 @@ - - + + diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/HouseholdRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/HouseholdRenderBox.vue index e6f50708b..ad996a375 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/HouseholdRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/HouseholdRenderBox.vue @@ -1,161 +1,168 @@ - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue index 0d9e3ec5f..cdc143f76 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue @@ -1,418 +1,493 @@ - + + diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue index 10302ee30..f157fac6a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue @@ -1,51 +1,75 @@ - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue index 3a93a305d..ff4b312f1 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue @@ -1,466 +1,530 @@ - + + diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_js/i18n.ts b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_js/i18n.ts index 088ff11ea..ba7637544 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_js/i18n.ts +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_js/i18n.ts @@ -1,63 +1,64 @@ const personMessages = { - fr: { - add_persons: { - title: "Ajouter des usagers", - suggested_counter: "Pas de résultats | 1 résultat | {count} résultats", - selected_counter: " 1 sélectionné | {count} sélectionnés", - search_some_persons: "Rechercher des personnes..", + fr: { + add_persons: { + title: "Ajouter des usagers", + suggested_counter: + "Pas de résultats | 1 résultat | {count} résultats", + selected_counter: " 1 sélectionné | {count} sélectionnés", + search_some_persons: "Rechercher des personnes..", + }, + item: { + type_person: "Usager", + type_user: "TMS", + type_thirdparty: "Tiers professionnel", + type_household: "Ménage", + }, + person: { + firstname: "Prénom", + lastname: "Nom", + born: (ctx: { gender: "man" | "woman" | "neutral" }) => { + if (ctx.gender === "man") { + return "Né le"; + } else if (ctx.gender === "woman") { + return "Née le"; + } else { + return "Né·e le"; + } + }, + center_id: "Identifiant du centre", + center_type: "Type de centre", + center_name: "Territoire", // vendée + phonenumber: "Téléphone", + mobilenumber: "Mobile", + altnames: "Autres noms", + email: "Courriel", + gender: { + title: "Genre", + placeholder: "Choisissez le genre de l'usager", + woman: "Féminin", + man: "Masculin", + neutral: "Neutre, non binaire", + unknown: "Non renseigné", + undefined: "Non renseigné", + }, + civility: { + title: "Civilité", + placeholder: "Choisissez la civilité", + }, + address: { + create_address: "Ajouter une adresse", + show_address_form: + "Ajouter une adresse pour un usager non suivi et seul dans un ménage", + warning: + "Un nouveau ménage va être créé. L'usager sera membre de ce ménage.", + }, + center: { + placeholder: "Choisissez un centre", + title: "Centre", + }, + }, + error_only_one_person: "Une seule personne peut être sélectionnée !", }, - item: { - type_person: "Usager", - type_user: "TMS", - type_thirdparty: "Tiers professionnel", - type_household: "Ménage", - }, - person: { - firstname: "Prénom", - lastname: "Nom", - born: (ctx: { gender: "man" | "woman" | "neutral" }) => { - if (ctx.gender === "man") { - return "Né le"; - } else if (ctx.gender === "woman") { - return "Née le"; - } else { - return "Né·e le"; - } - }, - center_id: "Identifiant du centre", - center_type: "Type de centre", - center_name: "Territoire", // vendée - phonenumber: "Téléphone", - mobilenumber: "Mobile", - altnames: "Autres noms", - email: "Courriel", - gender: { - title: "Genre", - placeholder: "Choisissez le genre de l'usager", - woman: "Féminin", - man: "Masculin", - neutral: "Neutre, non binaire", - unknown: "Non renseigné", - undefined: "Non renseigné", - }, - civility: { - title: "Civilité", - placeholder: "Choisissez la civilité", - }, - address: { - create_address: "Ajouter une adresse", - show_address_form: - "Ajouter une adresse pour un usager non suivi et seul dans un ménage", - warning: - "Un nouveau ménage va être créé. L'usager sera membre de ce ménage.", - }, - center: { - placeholder: "Choisissez un centre", - title: "Centre", - }, - }, - error_only_one_person: "Une seule personne peut être sélectionnée !", - }, }; export { personMessages }; diff --git a/src/Bundle/ChillPersonBundle/Tests/Repository/PersonACLAwareRepositoryTest.php b/src/Bundle/ChillPersonBundle/Tests/Repository/PersonACLAwareRepositoryTest.php index 667242111..94df35d88 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Repository/PersonACLAwareRepositoryTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Repository/PersonACLAwareRepositoryTest.php @@ -11,17 +11,14 @@ declare(strict_types=1); namespace Chill\PersonBundle\Tests\Repository; -use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Repository\CenterRepositoryInterface; use Chill\MainBundle\Repository\CountryRepository; use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Entity\PersonPhone; use Chill\PersonBundle\Repository\PersonACLAwareRepository; use Chill\PersonBundle\Security\Authorization\PersonVoter; use Doctrine\ORM\EntityManagerInterface; -use PHPUnit\Framework\Attributes\DataProvider; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; @@ -101,67 +98,4 @@ final class PersonACLAwareRepositoryTest extends KernelTestCase $this->assertStringContainsString('diallo', strtolower($person->getFirstName().' '.$person->getLastName())); } } - - /** - * @dataProvider providePersonsWithPhoneNumbers - */ - public function testFindByPhonenumber(\libphonenumber\PhoneNumber $phoneNumber, ?int $expectedId): void - { - $user = new User(); - - $authorizationHelper = $this->prophesize(AuthorizationHelperInterface::class); - $authorizationHelper->getReachableCenters(Argument::exact($user), Argument::exact(PersonVoter::SEE)) - ->willReturn($this->centerRepository->findAll()); - - $security = $this->prophesize(Security::class); - $security->getUser()->willReturn($user); - - $repository = new PersonACLAwareRepository( - $security->reveal(), - $this->entityManager, - $this->countryRepository, - $authorizationHelper->reveal() - ); - - $actual = $repository->findByPhone($phoneNumber, 0, 10); - - if (null === $expectedId) { - self::assertCount(0, $actual); - } else { - $actualIds = array_map(fn (Person $person) => $person->getId(), $actual); - - self::assertContains($expectedId, $actualIds); - } - } - - public static function providePersonsWithPhoneNumbers(): iterable - { - self::bootKernel(); - $em = self::getContainer()->get(EntityManagerInterface::class); - $center = $em->createQuery('SELECT c FROM '.Center::class.' c ')->setMaxResults(1) - ->getSingleResult(); - $util = \libphonenumber\PhoneNumberUtil::getInstance(); - - $mobile = $util->parse('+32486123456'); - $fixed = $util->parse('+3281136917'); - $anotherMobile = $util->parse('+32486123478'); - $person = (new Person())->setFirstName('diallo')->setLastName('diallo')->setCenter($center); - $person->setMobilenumber($mobile)->setPhonenumber($fixed); - $otherPhone = new PersonPhone(); - $otherPhone->setPerson($person); - $otherPhone->setPhonenumber($anotherMobile); - $otherPhone->setType('mobile'); - - $em->persist($person); - $em->persist($otherPhone); - - $em->flush(); - - self::ensureKernelShutdown(); - - yield [$mobile, $person->getId()]; - yield [$anotherMobile, $person->getId()]; - yield [$fixed, $person->getId()]; - yield [$util->parse('+331234567890'), null]; - } } diff --git a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml index ae7ac6284..6e42a362b 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml @@ -206,59 +206,3 @@ accompanying_course_evaluation_document: accompanying_period_work: title: Action d'accompagnement (n°{id}) - {action_title} - -add_persons: - title: "Ajouter des usagers" - suggested_counter: >- - {count, plural, - =0 {Pas de résultats} - =1 {1 résultat} - other {# résultats} - } - selected_counter: >- - {count, plural, - =1 {1 sélectionné} - other {# sélectionnés} - } - search_some_persons: "Rechercher des personnes.." - - item: - type_person: "Usager" - type_user: "TMS" - type_thirdparty: "Tiers professionnel" - type_household: "Ménage" - - person: - firstname: "Prénom" - lastname: "Nom" - born: - man: "Né le" - woman: "Née le" - neutral: "Né·e le" - center_id: "Identifiant du centre" - center_type: "Type de centre" - center_name: "Territoire" - phonenumber: "Téléphone" - mobilenumber: "Mobile" - altnames: "Autres noms" - email: "Courriel" - gender: - title: "Genre" - placeholder: "Choisissez le genre de l'usager" - woman: "Féminin" - man: "Masculin" - neutral: "Neutre, non binaire" - unknown: "Non renseigné" - undefined: "Non renseigné" - civility: - title: "Civilité" - placeholder: "Choisissez la civilité" - address: - create_address: "Ajouter une adresse" - show_address_form: "Ajouter une adresse pour un usager non suivi et seul dans un ménage" - warning: "Un nouveau ménage va être créé. L'usager sera membre de ce ménage." - center: - placeholder: "Choisissez un centre" - title: "Centre" - - error_only_one_person: "Une seule personne peut être sélectionnée !" diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 6c271fd80..c9f1af282 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1522,48 +1522,3 @@ my_parcours_filters: parcours_intervening: Intervenant is_open: Parcours ouverts is_closed: Parcours clôturés - -person_messages: - add_persons: - title: "Ajouter des usagers" - suggested_counter: "Pas de résultats | 1 résultat | {count} résultats" - selected_counter: " 1 sélectionné | {count} sélectionnés" - search_some_persons: "Rechercher des personnes.." - item: - type_person: "Usager" - type_user: "TMS" - type_thirdparty: "Tiers professionnel" - type_household: "Ménage" - person: - firstname: "Prénom" - lastname: "Nom" - born: - man: "Né le" - woman: "Née le" - neutral: "Né·e le" - center_id: "Identifiant du centre" - center_type: "Type de centre" - center_name: "Territoire" - phonenumber: "Téléphone" - mobilenumber: "Mobile" - altnames: "Autres noms" - email: "Courriel" - gender: - title: "Genre" - placeholder: "Choisissez le genre de l'usager" - woman: "Féminin" - man: "Masculin" - neutral: "Neutre, non binaire" - unknown: "Non renseigné" - undefined: "Non renseigné" - civility: - title: "Civilité" - placeholder: "Choisissez la civilité" - address: - create_address: "Ajouter une adresse" - show_address_form: "Ajouter une adresse pour un usager non suivi et seul dans un ménage" - warning: "Un nouveau ménage va être créé. L'usager sera membre de ce ménage." - center: - placeholder: "Choisissez un centre" - title: "Centre" - error_only_one_person: "Une seule personne peut être sélectionnée !" diff --git a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php index 3153713bb..111be4089 100644 --- a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php +++ b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php @@ -18,15 +18,12 @@ use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ObjectRepository; -use libphonenumber\PhoneNumber; -use libphonenumber\PhoneNumberFormat; -use libphonenumber\PhoneNumberUtil; class ThirdPartyRepository implements ObjectRepository { private readonly EntityRepository $repository; - public function __construct(EntityManagerInterface $em, private readonly Connection $connection, private readonly PhoneNumberUtil $phonenumberUtil) + public function __construct(EntityManagerInterface $em, private readonly Connection $connection) { $this->repository = $em->getRepository(ThirdParty::class); } @@ -125,43 +122,6 @@ class ThirdPartyRepository implements ObjectRepository return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - /** - * Finds third-party records by phone number. - * - * The search is performed agains every phonenumber field (there are two phonenumber on a thirdParty). - * - * @param string|PhoneNumber $phonenumber The phone number to search for. Can be a string or a PhoneNumber object. - * @param int $firstResult the index of the first result to retrieve (pagination start) - * @param int $maxResults the maximum number of results to retrieve (pagination limit) - * - * @return list the result set containing matching third-party records - */ - public function findByPhonenumber(string|PhoneNumber $phonenumber, int $firstResult = 0, int $maxResults = 20): array - { - if ('' === $phonenumber) { - return []; - } - - $qb = $this->createQueryBuilder('tp'); - $qb->select('tp'); - - $qb->where( - $qb->expr()->orX( - $qb->expr()->eq('tp.telephone', ':phonenumber'), - $qb->expr()->eq('tp.telephone2', ':phonenumber') - ) - ); - - $qb->setParameter( - 'phonenumber', - is_string($phonenumber) ? $phonenumber : $this->phonenumberUtil->format($phonenumber, PhoneNumberFormat::E164) - ); - - $qb->setFirstResult($firstResult)->setMaxResults($maxResults); - - return $qb->getQuery()->getResult(); - } - /** * Search amongst parties associated to $centers, with $terms parameters. * diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/types.ts b/src/Bundle/ChillThirdPartyBundle/Resources/public/types.ts index 2d2acc42b..20ae3309b 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/types.ts +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/types.ts @@ -1,49 +1,47 @@ import { - Address, - Center, - Civility, - DateTime, - User, + Address, + Center, + Civility, + DateTime, + User, } from "ChillMainAssets/types"; export interface Thirdparty { - type: "thirdparty"; - text: string; - acronym: string | null; - active: boolean; - address: Address | null; - canonicalized: string | null; - categories: ThirdpartyCategory[]; - centers: Center[]; - children: Thirdparty[]; - civility: Civility | null; - comment: string | null; - contactDataAnonymous: boolean; - createdAt: DateTime; - createdBy: User | null; - email: string | null; - firstname: string | null; - id: number | null; - kind: string; - name: string; - nameCompany: string | null; - parent: Thirdparty | null; - profession: string; - telephone: string | null; - thirdPartyTypes: ThirdpartyType[] | null; - updatedAt: DateTime | null; - updatedBy: User | null; + acronym: string | null; + active: boolean; + address: Address | null; + canonicalized: string | null; + categories: ThirdpartyCategory[]; + centers: Center[]; + children: Thirdparty[]; + civility: Civility | null; + comment: string | null; + contactDataAnonymous: boolean; + createdAt: DateTime; + createdBy: User | null; + email: string | null; + firstname: string | null; + id: number | null; + kind: string; + name: string; + nameCompany: string | null; + parent: Thirdparty | null; + profession: string; + telephone: string | null; + thirdPartyTypes: ThirdpartyType[] | null; + updatedAt: DateTime | null; + updatedBy: User | null; } interface ThirdpartyType { - key: string; - value: string; + key: string; + value: string; } export interface ThirdpartyCategory { - id: number; - active: boolean; - name: { - fr: string; - }; + id: number; + active: boolean; + name: { + fr: string; + }; } diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue index 3413861ae..0fee3dcdb 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue @@ -1,131 +1,158 @@ diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyText.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyText.vue index dfd46efd9..2214605e2 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyText.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyText.vue @@ -1,28 +1,28 @@ diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue index e3b2338bd..623926807 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue @@ -1,450 +1,449 @@