mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-10 08:44:58 +00:00
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:
@@ -78,7 +78,7 @@ function closeModal(): void {
|
||||
>
|
||||
{{ trans(DOCUMENT_ADD) }}
|
||||
</button>
|
||||
<button v-else @click="openModal" class="btn btn-edit">
|
||||
<button v-else @click="openModal" class="dropdown-item">
|
||||
{{ trans(DOCUMENT_REPLACE) }}
|
||||
</button>
|
||||
<modal
|
||||
|
@@ -6,11 +6,15 @@
|
||||
class="item-bloc"
|
||||
v-for="(d, i) in documents"
|
||||
: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 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">
|
||||
<input
|
||||
class="form-control document-title"
|
||||
@@ -27,7 +31,10 @@
|
||||
<div class="item-col item-meta">
|
||||
<p v-if="d.createdBy" class="createdBy">
|
||||
Créé par {{ d.createdBy.text }}<br />
|
||||
Le {{ $d(ISOToDatetime(d.createdAt.datetime), "long") }}
|
||||
Le
|
||||
{{
|
||||
$d(ISOToDatetime(d.createdAt.datetime), "long")
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -36,7 +43,8 @@
|
||||
<ul class="record_actions">
|
||||
<li
|
||||
v-if="
|
||||
d.workflows_availables.length > 0 || d.workflows.length > 0
|
||||
d.workflows_availables.length > 0 ||
|
||||
d.workflows.length > 0
|
||||
"
|
||||
>
|
||||
<list-workflow-modal
|
||||
@@ -44,7 +52,9 @@
|
||||
:allowCreate="true"
|
||||
relatedEntityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument"
|
||||
:relatedEntityId="d.id"
|
||||
:workflowsAvailables="d.workflows_availables"
|
||||
:workflowsAvailables="
|
||||
d.workflows_availables
|
||||
"
|
||||
:preventDefaultMoveToGenerate="true"
|
||||
:goToGenerateWorkflowPayload="{ doc: d }"
|
||||
@go-to-generate-workflow="
|
||||
@@ -56,14 +66,22 @@
|
||||
<button
|
||||
v-if="AmIRefferer"
|
||||
class="btn btn-notify"
|
||||
@click="$emit('goToGenerateNotification', d, false)"
|
||||
@click="
|
||||
$emit(
|
||||
'goToGenerateNotification',
|
||||
d,
|
||||
false,
|
||||
)
|
||||
"
|
||||
></button>
|
||||
<template v-else>
|
||||
<button
|
||||
id="btnGroupNotifyButtons"
|
||||
type="button"
|
||||
class="btn btn-notify dropdown-toggle"
|
||||
:title="trans(EVALUATION_NOTIFICATION_SEND)"
|
||||
:title="
|
||||
trans(EVALUATION_NOTIFICATION_SEND)
|
||||
"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
>
|
||||
@@ -76,17 +94,37 @@
|
||||
<li>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
@click="$emit('goToGenerateNotification', d, true)"
|
||||
@click="
|
||||
$emit(
|
||||
'goToGenerateNotification',
|
||||
d,
|
||||
true,
|
||||
)
|
||||
"
|
||||
>
|
||||
{{ trans(EVALUATION_NOTIFICATION_NOTIFY_REFERRER) }}
|
||||
{{
|
||||
trans(
|
||||
EVALUATION_NOTIFICATION_NOTIFY_REFERRER,
|
||||
)
|
||||
}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
@click="$emit('goToGenerateNotification', d, false)"
|
||||
@click="
|
||||
$emit(
|
||||
'goToGenerateNotification',
|
||||
d,
|
||||
false,
|
||||
)
|
||||
"
|
||||
>
|
||||
{{ trans(EVALUATION_NOTIFICATION_NOTIFY_ANY) }}
|
||||
{{
|
||||
trans(
|
||||
EVALUATION_NOTIFICATION_NOTIFY_ANY,
|
||||
)
|
||||
}}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -97,10 +135,15 @@
|
||||
:stored-object="d.storedObject"
|
||||
:filename="d.title"
|
||||
:can-edit="true"
|
||||
:execute-before-leave="submitBeforeLeaveToEditor"
|
||||
:davLink="d.storedObject._links?.dav_link.href"
|
||||
:execute-before-leave="
|
||||
submitBeforeLeaveToEditor
|
||||
"
|
||||
:davLink="
|
||||
d.storedObject._links?.dav_link.href
|
||||
"
|
||||
:davLinkExpiration="
|
||||
d.storedObject._links?.dav_link.expiration
|
||||
d.storedObject._links?.dav_link
|
||||
.expiration
|
||||
"
|
||||
@on-stored-object-status-change="
|
||||
$emit('statusDocumentChanged', $event)
|
||||
@@ -110,43 +153,36 @@
|
||||
<li v-if="Number.isInteger(d.id)">
|
||||
<div class="duplicate-dropdown">
|
||||
<button
|
||||
class="btn btn-duplicate dropdown-toggle"
|
||||
class="btn btn-edit dropdown-toggle"
|
||||
type="button"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
>
|
||||
{{ trans(EVALUATION_DOCUMENT_DUPLICATE) }}
|
||||
{{ trans(EVALUATION_DOCUMENT_EDIT) }}
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<!--delete-->
|
||||
<li v-if="d.workflows.length === 0">
|
||||
<a
|
||||
class="dropdown-item"
|
||||
@click="$emit('duplicateDocument', d)"
|
||||
>{{ trans(EVALUATION_DOCUMENT_DUPLICATE_HERE) }}</a
|
||||
@click="
|
||||
$emit('removeDocument', d)
|
||||
"
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
@click="prepareDocumentDuplicationToWork(d)"
|
||||
>{{
|
||||
{{
|
||||
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
|
||||
:existing-doc="d.storedObject"
|
||||
:allow-remove="false"
|
||||
@@ -161,9 +197,59 @@
|
||||
"
|
||||
></drop-file-modal>
|
||||
</li>
|
||||
<li v-if="d.workflows.length === 0">
|
||||
<a class="btn btn-delete" @click="$emit('removeDocument', d)">
|
||||
</a>
|
||||
<!--duplicate document-->
|
||||
<li>
|
||||
<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>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -193,7 +279,8 @@ import {
|
||||
EVALUATION_NOTIFICATION_SEND,
|
||||
EVALUATION_DOCUMENTS,
|
||||
EVALUATION_DOCUMENT_MOVE,
|
||||
EVALUATION_DOCUMENT_DUPLICATE,
|
||||
EVALUATION_DOCUMENT_DELETE,
|
||||
EVALUATION_DOCUMENT_EDIT,
|
||||
EVALUATION_DOCUMENT_DUPLICATE_HERE,
|
||||
EVALUATION_DOCUMENT_DUPLICATE_TO_OTHER_EVALUATION,
|
||||
trans,
|
||||
|
@@ -28,7 +28,9 @@
|
||||
@inputDocumentTitle="onInputDocumentTitle"
|
||||
@removeDocument="removeDocument"
|
||||
@duplicateDocument="duplicateDocument"
|
||||
@duplicate-document-to-evaluation="duplicateDocumentToEvaluation"
|
||||
@duplicate-document-to-evaluation="
|
||||
duplicateDocumentToEvaluation
|
||||
"
|
||||
@move-document-to-evaluation="moveDocumentToEvaluation"
|
||||
@statusDocumentChanged="onStatusDocumentChanged"
|
||||
@goToGenerateWorkflow="goToGenerateWorkflowEvaluationDocument"
|
||||
@@ -53,7 +55,11 @@ import TimeSpentInput from "./TimeSpentInput.vue";
|
||||
import CommentInput from "./CommentInput.vue";
|
||||
import DocumentsList from "./DocumentsList.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";
|
||||
|
||||
const props = defineProps(["evaluation", "docAnchorId"]);
|
||||
@@ -260,7 +266,8 @@ function duplicateDocumentToEvaluation({ evaluation, document }) {
|
||||
|
||||
function moveDocumentToEvaluation({ evaluationDest, document }) {
|
||||
console.log("dest eval in formEvaluation", evaluationDest);
|
||||
store.dispatch("moveDocumentToEvaluation", {
|
||||
store
|
||||
.dispatch("moveDocumentToEvaluation", {
|
||||
evaluationInitial: props.evaluation,
|
||||
evaluationDest: evaluationDest,
|
||||
document: document,
|
||||
|
@@ -656,7 +656,10 @@ const store = createStore({
|
||||
{ evaluationInitial, evaluationDest, document },
|
||||
) {
|
||||
try {
|
||||
const response = await moveDocumentToEvaluation(document.id, evaluationDest.id);
|
||||
const response = await moveDocumentToEvaluation(
|
||||
document.id,
|
||||
evaluationDest.id,
|
||||
);
|
||||
commit("moveDocumentToEvaluation", {
|
||||
evaluationInitial,
|
||||
evaluationDest,
|
||||
|
@@ -777,6 +777,8 @@ evaluation:
|
||||
notification_notify_any: Notifier d'autres utilisateurs
|
||||
notification_send: Envoyer une notification
|
||||
document:
|
||||
edit: Modifier
|
||||
delete: Supprimer
|
||||
move: Déplacer
|
||||
duplicate: Dupliquer
|
||||
duplicate_here: Dupliquer ici
|
||||
|
Reference in New Issue
Block a user