feat: enhance document actions in UI

- Add edit and delete options in translation files
- Refactor `DocumentsList.vue` to group replace, delete, move, and duplicate actions in a dropdown menu
This commit is contained in:
2025-08-25 11:26:05 +02:00
parent 2a1762ea8d
commit ab6ab19499
6 changed files with 333 additions and 234 deletions

View File

@@ -78,7 +78,7 @@ function closeModal(): void {
> >
{{ trans(DOCUMENT_ADD) }} {{ trans(DOCUMENT_ADD) }}
</button> </button>
<button v-else @click="openModal" class="btn btn-edit"> <button v-else @click="openModal" class="dropdown-item">
{{ trans(DOCUMENT_REPLACE) }} {{ trans(DOCUMENT_REPLACE) }}
</button> </button>
<modal <modal

View File

@@ -6,11 +6,15 @@
class="item-bloc" class="item-bloc"
v-for="(d, i) in documents" v-for="(d, i) in documents"
:key="d.id" :key="d.id"
:class="[parseInt(docAnchorId) === d.id ? 'bg-blink' : 'nothing']" :class="[
parseInt(docAnchorId) === d.id ? 'bg-blink' : 'nothing',
]"
> >
<div :id="'document_' + d.id" class="item-row"> <div :id="'document_' + d.id" class="item-row">
<div class="input-group input-group-lg mb-3 row"> <div class="input-group input-group-lg mb-3 row">
<label class="col-sm-3 col-form-label">Titre du document:</label> <label class="col-sm-3 col-form-label"
>Titre du document:</label
>
<div class="col-sm-9"> <div class="col-sm-9">
<input <input
class="form-control document-title" class="form-control document-title"
@@ -27,7 +31,10 @@
<div class="item-col item-meta"> <div class="item-col item-meta">
<p v-if="d.createdBy" class="createdBy"> <p v-if="d.createdBy" class="createdBy">
Créé par {{ d.createdBy.text }}<br /> Créé par {{ d.createdBy.text }}<br />
Le {{ $d(ISOToDatetime(d.createdAt.datetime), "long") }} Le
{{
$d(ISOToDatetime(d.createdAt.datetime), "long")
}}
</p> </p>
</div> </div>
</div> </div>
@@ -36,7 +43,8 @@
<ul class="record_actions"> <ul class="record_actions">
<li <li
v-if=" v-if="
d.workflows_availables.length > 0 || d.workflows.length > 0 d.workflows_availables.length > 0 ||
d.workflows.length > 0
" "
> >
<list-workflow-modal <list-workflow-modal
@@ -44,7 +52,9 @@
:allowCreate="true" :allowCreate="true"
relatedEntityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument" relatedEntityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument"
:relatedEntityId="d.id" :relatedEntityId="d.id"
:workflowsAvailables="d.workflows_availables" :workflowsAvailables="
d.workflows_availables
"
:preventDefaultMoveToGenerate="true" :preventDefaultMoveToGenerate="true"
:goToGenerateWorkflowPayload="{ doc: d }" :goToGenerateWorkflowPayload="{ doc: d }"
@go-to-generate-workflow=" @go-to-generate-workflow="
@@ -56,14 +66,22 @@
<button <button
v-if="AmIRefferer" v-if="AmIRefferer"
class="btn btn-notify" class="btn btn-notify"
@click="$emit('goToGenerateNotification', d, false)" @click="
$emit(
'goToGenerateNotification',
d,
false,
)
"
></button> ></button>
<template v-else> <template v-else>
<button <button
id="btnGroupNotifyButtons" id="btnGroupNotifyButtons"
type="button" type="button"
class="btn btn-notify dropdown-toggle" class="btn btn-notify dropdown-toggle"
:title="trans(EVALUATION_NOTIFICATION_SEND)" :title="
trans(EVALUATION_NOTIFICATION_SEND)
"
data-bs-toggle="dropdown" data-bs-toggle="dropdown"
aria-expanded="false" aria-expanded="false"
> >
@@ -76,17 +94,37 @@
<li> <li>
<a <a
class="dropdown-item" class="dropdown-item"
@click="$emit('goToGenerateNotification', d, true)" @click="
$emit(
'goToGenerateNotification',
d,
true,
)
"
> >
{{ trans(EVALUATION_NOTIFICATION_NOTIFY_REFERRER) }} {{
trans(
EVALUATION_NOTIFICATION_NOTIFY_REFERRER,
)
}}
</a> </a>
</li> </li>
<li> <li>
<a <a
class="dropdown-item" class="dropdown-item"
@click="$emit('goToGenerateNotification', d, false)" @click="
$emit(
'goToGenerateNotification',
d,
false,
)
"
> >
{{ trans(EVALUATION_NOTIFICATION_NOTIFY_ANY) }} {{
trans(
EVALUATION_NOTIFICATION_NOTIFY_ANY,
)
}}
</a> </a>
</li> </li>
</ul> </ul>
@@ -97,10 +135,15 @@
:stored-object="d.storedObject" :stored-object="d.storedObject"
:filename="d.title" :filename="d.title"
:can-edit="true" :can-edit="true"
:execute-before-leave="submitBeforeLeaveToEditor" :execute-before-leave="
:davLink="d.storedObject._links?.dav_link.href" submitBeforeLeaveToEditor
"
:davLink="
d.storedObject._links?.dav_link.href
"
:davLinkExpiration=" :davLinkExpiration="
d.storedObject._links?.dav_link.expiration d.storedObject._links?.dav_link
.expiration
" "
@on-stored-object-status-change=" @on-stored-object-status-change="
$emit('statusDocumentChanged', $event) $emit('statusDocumentChanged', $event)
@@ -110,43 +153,36 @@
<li v-if="Number.isInteger(d.id)"> <li v-if="Number.isInteger(d.id)">
<div class="duplicate-dropdown"> <div class="duplicate-dropdown">
<button <button
class="btn btn-duplicate dropdown-toggle" class="btn btn-edit dropdown-toggle"
type="button" type="button"
data-bs-toggle="dropdown" data-bs-toggle="dropdown"
aria-expanded="false" aria-expanded="false"
> >
{{ trans(EVALUATION_DOCUMENT_DUPLICATE) }} {{ trans(EVALUATION_DOCUMENT_EDIT) }}
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <!--delete-->
<li v-if="d.workflows.length === 0">
<a <a
class="dropdown-item" class="dropdown-item"
@click="$emit('duplicateDocument', d)" @click="
>{{ trans(EVALUATION_DOCUMENT_DUPLICATE_HERE) }}</a $emit('removeDocument', d)
"
> >
</li> {{
<li>
<a
class="dropdown-item"
@click="prepareDocumentDuplicationToWork(d)"
>{{
trans( trans(
EVALUATION_DOCUMENT_DUPLICATE_TO_OTHER_EVALUATION, EVALUATION_DOCUMENT_DELETE,
) )
}}</a }}
</a>
</li>
<!--replace document-->
<li
v-if="
d.storedObject._permissions
.canEdit
"
> >
</li>
</ul>
</div>
</li>
<li v-if="d.storedObject._permissions.canEdit">
<a
class="btn btn-choose"
@click="prepareDocumentMoveToWork(d)"
>{{ trans(EVALUATION_DOCUMENT_MOVE) }}</a
>
</li>
<li v-if="d.storedObject._permissions.canEdit">
<drop-file-modal <drop-file-modal
:existing-doc="d.storedObject" :existing-doc="d.storedObject"
:allow-remove="false" :allow-remove="false"
@@ -161,9 +197,59 @@
" "
></drop-file-modal> ></drop-file-modal>
</li> </li>
<li v-if="d.workflows.length === 0"> <!--duplicate document-->
<a class="btn btn-delete" @click="$emit('removeDocument', d)"> <li>
</a> <a
class="dropdown-item"
@click="
$emit(
'duplicateDocument',
d,
)
"
>{{
trans(
EVALUATION_DOCUMENT_DUPLICATE_HERE,
)
}}</a
>
</li>
<li>
<a
class="dropdown-item"
@click="
prepareDocumentDuplicationToWork(
d,
)
"
>{{
trans(
EVALUATION_DOCUMENT_DUPLICATE_TO_OTHER_EVALUATION,
)
}}</a
>
</li>
<!--move document-->
<li
v-if="
d.storedObject._permissions
.canEdit
"
>
<a
class="dropdown-item"
@click="
prepareDocumentMoveToWork(d)
"
>{{
trans(
EVALUATION_DOCUMENT_MOVE,
)
}}</a
>
</li>
</ul>
</div>
</li> </li>
</ul> </ul>
</div> </div>
@@ -193,7 +279,8 @@ import {
EVALUATION_NOTIFICATION_SEND, EVALUATION_NOTIFICATION_SEND,
EVALUATION_DOCUMENTS, EVALUATION_DOCUMENTS,
EVALUATION_DOCUMENT_MOVE, EVALUATION_DOCUMENT_MOVE,
EVALUATION_DOCUMENT_DUPLICATE, EVALUATION_DOCUMENT_DELETE,
EVALUATION_DOCUMENT_EDIT,
EVALUATION_DOCUMENT_DUPLICATE_HERE, EVALUATION_DOCUMENT_DUPLICATE_HERE,
EVALUATION_DOCUMENT_DUPLICATE_TO_OTHER_EVALUATION, EVALUATION_DOCUMENT_DUPLICATE_TO_OTHER_EVALUATION,
trans, trans,

View File

@@ -28,7 +28,9 @@
@inputDocumentTitle="onInputDocumentTitle" @inputDocumentTitle="onInputDocumentTitle"
@removeDocument="removeDocument" @removeDocument="removeDocument"
@duplicateDocument="duplicateDocument" @duplicateDocument="duplicateDocument"
@duplicate-document-to-evaluation="duplicateDocumentToEvaluation" @duplicate-document-to-evaluation="
duplicateDocumentToEvaluation
"
@move-document-to-evaluation="moveDocumentToEvaluation" @move-document-to-evaluation="moveDocumentToEvaluation"
@statusDocumentChanged="onStatusDocumentChanged" @statusDocumentChanged="onStatusDocumentChanged"
@goToGenerateWorkflow="goToGenerateWorkflowEvaluationDocument" @goToGenerateWorkflow="goToGenerateWorkflowEvaluationDocument"
@@ -53,7 +55,11 @@ import TimeSpentInput from "./TimeSpentInput.vue";
import CommentInput from "./CommentInput.vue"; import CommentInput from "./CommentInput.vue";
import DocumentsList from "./DocumentsList.vue"; import DocumentsList from "./DocumentsList.vue";
import DocumentActions from "./DocumentActions.vue"; import DocumentActions from "./DocumentActions.vue";
import { trans, EVALUATION_DOCUMENT_DUPLICATE_SUCCESS, EVALUATION_DOCUMENT_MOVE_SUCCESS } from "translator"; import {
trans,
EVALUATION_DOCUMENT_DUPLICATE_SUCCESS,
EVALUATION_DOCUMENT_MOVE_SUCCESS,
} from "translator";
import { useToast } from "vue-toast-notification"; import { useToast } from "vue-toast-notification";
const props = defineProps(["evaluation", "docAnchorId"]); const props = defineProps(["evaluation", "docAnchorId"]);
@@ -260,7 +266,8 @@ function duplicateDocumentToEvaluation({ evaluation, document }) {
function moveDocumentToEvaluation({ evaluationDest, document }) { function moveDocumentToEvaluation({ evaluationDest, document }) {
console.log("dest eval in formEvaluation", evaluationDest); console.log("dest eval in formEvaluation", evaluationDest);
store.dispatch("moveDocumentToEvaluation", { store
.dispatch("moveDocumentToEvaluation", {
evaluationInitial: props.evaluation, evaluationInitial: props.evaluation,
evaluationDest: evaluationDest, evaluationDest: evaluationDest,
document: document, document: document,

View File

@@ -656,7 +656,10 @@ const store = createStore({
{ evaluationInitial, evaluationDest, document }, { evaluationInitial, evaluationDest, document },
) { ) {
try { try {
const response = await moveDocumentToEvaluation(document.id, evaluationDest.id); const response = await moveDocumentToEvaluation(
document.id,
evaluationDest.id,
);
commit("moveDocumentToEvaluation", { commit("moveDocumentToEvaluation", {
evaluationInitial, evaluationInitial,
evaluationDest, evaluationDest,

View File

@@ -777,6 +777,8 @@ evaluation:
notification_notify_any: Notifier d'autres utilisateurs notification_notify_any: Notifier d'autres utilisateurs
notification_send: Envoyer une notification notification_send: Envoyer une notification
document: document:
edit: Modifier
delete: Supprimer
move: Déplacer move: Déplacer
duplicate: Dupliquer duplicate: Dupliquer
duplicate_here: Dupliquer ici duplicate_here: Dupliquer ici