This commit is contained in:
Julie Lenaerts 2025-05-14 13:57:22 +02:00
commit 6d13d184d5
15 changed files with 118 additions and 22 deletions

View File

@ -0,0 +1,7 @@
kind: Feature
body: Add the document file name to the document title when a user upload a document,
unless there is already a document title.
time: 2025-04-24T14:22:11.800975422+02:00
custom:
Issue: "377"
SchemaChange: No schema change

View File

@ -0,0 +1,7 @@
kind: Fixed
body: trying to prevent bug of typeerror in doc-history + improved display of document
history
time: 2025-04-24T13:39:43.878468232+02:00
custom:
Issue: "376"
SchemaChange: No schema change

View File

@ -0,0 +1,7 @@
kind: Fixed
body: Display previous participation in acc course work even if the person has left
the acc course
time: 2025-04-24T16:37:46.970203594+02:00
custom:
Issue: "381"
SchemaChange: No schema change

View File

@ -0,0 +1,6 @@
kind: UX
body: Remove default filter in_progress for the page 'my tasks'; Allows for new tasks to be displayed upon opening of the page
time: 2025-04-23T17:26:24.45777387+02:00
custom:
Issue: "374"
SchemaChange: No schema change

View File

@ -10,6 +10,9 @@ const startApp = (
collectionEntry: null | HTMLLIElement, collectionEntry: null | HTMLLIElement,
): void => { ): void => {
console.log("app started", divElement); console.log("app started", divElement);
const inputTitle = collectionEntry?.querySelector("input[type='text']");
const input_stored_object: HTMLInputElement | null = const input_stored_object: HTMLInputElement | null =
divElement.querySelector("input[data-stored-object]"); divElement.querySelector("input[data-stored-object]");
if (null === input_stored_object) { if (null === input_stored_object) {
@ -26,9 +29,10 @@ const startApp = (
const app = createApp({ const app = createApp({
template: template:
'<drop-file-widget :existingDoc="this.$data.existingDoc" :allowRemove="true" @addDocument="this.addDocument" @removeDocument="removeDocument"></drop-file-widget>', '<drop-file-widget :existingDoc="this.$data.existingDoc" :allowRemove="true" @addDocument="this.addDocument" @removeDocument="removeDocument"></drop-file-widget>',
data(vm) { data() {
return { return {
existingDoc: existingDoc, existingDoc: existingDoc,
inputTitle: inputTitle,
}; };
}, },
components: { components: {
@ -38,10 +42,13 @@ const startApp = (
addDocument: function ({ addDocument: function ({
stored_object, stored_object,
stored_object_version, stored_object_version,
file_name,
}: { }: {
stored_object: StoredObject; stored_object: StoredObject;
stored_object_version: StoredObjectVersion; stored_object_version: StoredObjectVersion;
file_name: string;
}): void { }): void {
stored_object.title = file_name;
console.log("object added", stored_object); console.log("object added", stored_object);
console.log("version added", stored_object_version); console.log("version added", stored_object_version);
this.$data.existingDoc = stored_object; this.$data.existingDoc = stored_object;
@ -49,6 +56,11 @@ const startApp = (
input_stored_object.value = JSON.stringify( input_stored_object.value = JSON.stringify(
this.$data.existingDoc, this.$data.existingDoc,
); );
if (this.$data.inputTitle) {
if (!this.$data.inputTitle?.value) {
this.$data.inputTitle.value = file_name;
}
}
}, },
removeDocument: function (object: StoredObject): void { removeDocument: function (object: StoredObject): void {
console.log("catch remove document", object); console.log("catch remove document", object);

View File

@ -23,6 +23,7 @@ const emit =
{ {
stored_object_version: StoredObjectVersionCreated, stored_object_version: StoredObjectVersionCreated,
stored_object: StoredObject, stored_object: StoredObject,
file_name: string,
}, },
) => void ) => void
>(); >();
@ -114,7 +115,21 @@ const handleFile = async (file: File): Promise<void> => {
persisted: false, persisted: false,
}; };
emit("addDocument", { stored_object, stored_object_version }); const fileName = file.name;
let file_name = "Nouveau document";
const file_name_split = fileName.split(".");
if (file_name_split.length > 1) {
const extension = file_name_split
? file_name_split[file_name_split.length - 1]
: "";
file_name = fileName.replace(extension, "").slice(0, -1);
}
emit("addDocument", {
stored_object,
stored_object_version,
file_name: file_name,
});
uploading.value = false; uploading.value = false;
}; };
</script> </script>

View File

@ -20,6 +20,7 @@ const emit = defineEmits<{
{ {
stored_object: StoredObject, stored_object: StoredObject,
stored_object_version: StoredObjectVersion, stored_object_version: StoredObjectVersion,
file_name: string,
}, },
): void; ): void;
(e: "removeDocument"): void; (e: "removeDocument"): void;
@ -42,14 +43,16 @@ const buttonState = computed<"add" | "replace">(() => {
function onAddDocument({ function onAddDocument({
stored_object, stored_object,
stored_object_version, stored_object_version,
file_name,
}: { }: {
stored_object: StoredObject; stored_object: StoredObject;
stored_object_version: StoredObjectVersion; stored_object_version: StoredObjectVersion;
file_name: string;
}): void { }): void {
const message = const message =
buttonState.value === "add" ? "Document ajouté" : "Document remplacé"; buttonState.value === "add" ? "Document ajouté" : "Document remplacé";
$toast.success(message); $toast.success(message);
emit("addDocument", { stored_object_version, stored_object }); emit("addDocument", { stored_object_version, stored_object, file_name });
state.showModal = false; state.showModal = false;
} }

View File

@ -19,6 +19,7 @@ const emit = defineEmits<{
{ {
stored_object: StoredObject, stored_object: StoredObject,
stored_object_version: StoredObjectVersion, stored_object_version: StoredObjectVersion,
file_name: string,
}, },
): void; ): void;
(e: "removeDocument"): void; (e: "removeDocument"): void;
@ -53,11 +54,13 @@ const dav_link_href = computed<string | undefined>(() => {
const onAddDocument = ({ const onAddDocument = ({
stored_object, stored_object,
stored_object_version, stored_object_version,
file_name,
}: { }: {
stored_object: StoredObject; stored_object: StoredObject;
stored_object_version: StoredObjectVersion; stored_object_version: StoredObjectVersion;
file_name: string;
}): void => { }): void => {
emit("addDocument", { stored_object, stored_object_version }); emit("addDocument", { stored_object, stored_object_version, file_name });
}; };
const onRemoveDocument = (e: Event): void => { const onRemoveDocument = (e: Event): void => {

View File

@ -53,7 +53,7 @@ const onRestored = ({
<template> <template>
<template v-if="props.versions.length > 0"> <template v-if="props.versions.length > 0">
<div class="container"> <div class="container">
<template v-for="v in props.versions"> <template v-for="v in props.versions" :key="v.id">
<history-button-list-item <history-button-list-item
:version="v" :version="v"
:can-edit="canEdit" :can-edit="canEdit"

View File

@ -32,13 +32,17 @@ const onRestore = ({
emit("restoreVersion", { newVersion }); emit("restoreVersion", { newVersion });
}; };
const isKeptBeforeConversion = computed<boolean>(() => const isKeptBeforeConversion = computed<boolean>(() => {
props.version["point-in-times"].reduce( if ("point-in-times" in props.version) {
return props.version["point-in-times"].reduce(
(accumulator: boolean, pit: StoredObjectPointInTime) => (accumulator: boolean, pit: StoredObjectPointInTime) =>
accumulator || "keep-before-conversion" === pit.reason, accumulator || "keep-before-conversion" === pit.reason,
false, false,
), );
); } else {
return false;
}
});
const isRestored = computed<boolean>( const isRestored = computed<boolean>(
() => props.version.version > 0 && null !== props.version["from-restored"], () => props.version.version > 0 && null !== props.version["from-restored"],
@ -90,11 +94,11 @@ const classes = computed<{
<div class="col-12"> <div class="col-12">
<file-icon :type="version.type"></file-icon> <file-icon :type="version.type"></file-icon>
<span <span
><strong>#{{ version.version + 1 }}</strong></span ><strong>&nbsp;#{{ version.version + 1 }}&nbsp;</strong></span
> >
<template <template
v-if="version.createdBy !== null && version.createdAt !== null" v-if="version.createdBy !== null && version.createdAt !== null"
><strong v-if="version.version == 0">Créé par</strong ><strong v-if="version.version == 0">créé par</strong
><strong v-else>modifié par</strong> ><strong v-else>modifié par</strong>
<span class="badge-user" <span class="badge-user"
><UserRenderBoxBadge ><UserRenderBoxBadge

View File

@ -20,9 +20,11 @@
{{ mm.mimeIcon(document.object.type) }} {{ mm.mimeIcon(document.object.type) }}
</div> </div>
{% endif %} {% endif %}
{% if document.category %}
<div> <div>
<p>{{ document.category.name|localize_translatable_string }}</p> <p>{{ document.category.name|localize_translatable_string }}</p>
</div> </div>
{% endif %}
{% if document.object.hasTemplate %} {% if document.object.hasTemplate %}
<div> <div>
<p>{{ document.object.template.name|localize_translatable_string }}</p> <p>{{ document.object.template.name|localize_translatable_string }}</p>

View File

@ -208,6 +208,29 @@
</label> </label>
</div> </div>
</li> </li>
<li
v-for="p in getPreviousPersons"
:key="p.id"
class="alert alert-danger"
>
<div class="form-check">
<input
v-model="personsPicked"
:value="p.id"
type="checkbox"
class="me-2 form-check-input"
:id="'person_check' + p.id"
/>
<label :for="'person_check' + p.id" class="form-check-label">
<person-text :person="p"></person-text>
</label>
</div>
<span
><i class="fa fa-warning"></i>&nbsp;{{
$t("warning_previous_persons")
}}</span
>
</li>
</ul> </ul>
</div> </div>
@ -497,6 +520,8 @@ const i18n = {
notification_notify_referrer: "Notifier le référent", notification_notify_referrer: "Notifier le référent",
notification_notify_any: "Notifier d'autres utilisateurs", notification_notify_any: "Notifier d'autres utilisateurs",
notification_send: "Envoyer une notification", notification_send: "Envoyer une notification",
warning_previous_persons:
"Cet usager n'est désormais plus concerné par le parcours, bien qu'il ait été associé à l'action par le passé.",
}, },
}, },
}; };
@ -583,6 +608,7 @@ export default {
"hasHandlingThirdParty", "hasHandlingThirdParty",
"hasThirdParties", "hasThirdParties",
"hasReferrers", "hasReferrers",
"getPreviousPersons",
]), ]),
classicEditor: () => ClassicEditor, classicEditor: () => ClassicEditor,
editorConfig: () => classicEditorConfig, editorConfig: () => classicEditorConfig,

View File

@ -535,11 +535,11 @@ export default {
title: title, title: title,
}); });
}, },
addDocument({ stored_object, stored_object_version }) { addDocument({ stored_object, stored_object_version, file_name }) {
let document = { let document = {
type: "accompanying_period_work_evaluation_document", type: "accompanying_period_work_evaluation_document",
storedObject: stored_object, storedObject: stored_object,
title: "Nouveau document", title: file_name,
}; };
this.$store.commit("addDocument", { this.$store.commit("addDocument", {
key: this.evaluation.key, key: this.evaluation.key,

View File

@ -87,6 +87,11 @@ const store = createStore({
return []; return [];
}, },
getPreviousPersons(state) {
return state.personsPicked.filter(
(p) => !state.personsReachables.map((pr) => pr.id).includes(p.id),
);
},
buildPayload(state) { buildPayload(state) {
return { return {
type: "accompanying_period_work", type: "accompanying_period_work",
@ -607,8 +612,7 @@ const store = createStore({
submit({ getters, state, commit }, callback) { submit({ getters, state, commit }, callback) {
let payload = getters.buildPayload, let payload = getters.buildPayload,
params = new URLSearchParams({ entity_version: state.version }), params = new URLSearchParams({ entity_version: state.version }),
url = `/api/1.0/person/accompanying-course/work/${state.work.id}.json?${params}`, url = `/api/1.0/person/accompanying-course/work/${state.work.id}.json?${params}`;
errors = [];
commit("setIsPosting", true); commit("setIsPosting", true);
// console.log('the social action', payload); // console.log('the social action', payload);

View File

@ -624,7 +624,7 @@ final class SingleTaskController extends AbstractController
->addCheckbox('status', $statuses, $statuses, $statusTrans); ->addCheckbox('status', $statuses, $statuses, $statusTrans);
$states = $this->singleTaskStateRepository->findAllExistingStates(); $states = $this->singleTaskStateRepository->findAllExistingStates();
$checked = array_values(array_filter($states, fn (string $state) => !in_array($state, ['closed', 'canceled', 'validated'], true))); $checked = array_values(array_filter($states, fn (string $state) => !in_array($state, ['in_progress', 'closed', 'canceled', 'validated'], true)));
if ([] !== $states) { if ([] !== $states) {
$filterBuilder $filterBuilder