mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-07 13:59:43 +00:00
Clean skeleton (and add Junie guidelines)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,67 +1,70 @@
|
||||
<template>
|
||||
<div>
|
||||
<a id="evaluations"></a>
|
||||
<div class="item-title" :title="evaluation.id || 'no id yet'">
|
||||
<span>{{ localizeString(evaluation.evaluation.title) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="item-url mt-3 mb-4" v-if="evaluation.evaluation.url">
|
||||
<i class="fa fa-link fa-lg"></i>
|
||||
<a :href="evaluation.evaluation.url" target="_blank">{{
|
||||
evaluation.evaluation.url
|
||||
}}</a>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<form-evaluation
|
||||
ref="FormEvaluation"
|
||||
:key="evaluation.key"
|
||||
:evaluation="evaluation"
|
||||
:docAnchorId="docAnchorId"
|
||||
></form-evaluation>
|
||||
<a id="evaluations"></a>
|
||||
<div class="item-title" :title="evaluation.id || 'no id yet'">
|
||||
<span>{{ localizeString(evaluation.evaluation.title) }}</span>
|
||||
</div>
|
||||
|
||||
<ul class="record_actions">
|
||||
<li v-if="evaluation.workflows_availables.length > 0">
|
||||
<list-workflow-modal
|
||||
:workflows="evaluation.workflows"
|
||||
:allowCreate="true"
|
||||
relatedEntityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation"
|
||||
:relatedEntityId="evaluation.id"
|
||||
:workflowsAvailables="evaluation.workflows_availables"
|
||||
@go-to-generate-workflow="goToGenerateWorkflow"
|
||||
></list-workflow-modal>
|
||||
</li>
|
||||
<li v-if="canDelete">
|
||||
<a
|
||||
class="btn btn-delete"
|
||||
@click="modal.showModal = true"
|
||||
:title="$t('action.delete')"
|
||||
>{{ $t("delete_evaluation") }}</a
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="item-url mt-3 mb-4" v-if="evaluation.evaluation.url">
|
||||
<i class="fa fa-link fa-lg"></i>
|
||||
<a :href="evaluation.evaluation.url" target="_blank">{{
|
||||
evaluation.evaluation.url
|
||||
}}</a>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<form-evaluation
|
||||
ref="FormEvaluation"
|
||||
:key="evaluation.key"
|
||||
:evaluation="evaluation"
|
||||
:docAnchorId="docAnchorId"
|
||||
></form-evaluation>
|
||||
|
||||
<ul class="record_actions">
|
||||
<li v-if="evaluation.workflows_availables.length > 0">
|
||||
<list-workflow-modal
|
||||
:workflows="evaluation.workflows"
|
||||
:allowCreate="true"
|
||||
relatedEntityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation"
|
||||
:relatedEntityId="evaluation.id"
|
||||
:workflowsAvailables="evaluation.workflows_availables"
|
||||
@go-to-generate-workflow="goToGenerateWorkflow"
|
||||
></list-workflow-modal>
|
||||
</li>
|
||||
<li v-if="canDelete">
|
||||
<a
|
||||
class="btn btn-delete"
|
||||
@click="modal.showModal = true"
|
||||
:title="$t('action.delete')"
|
||||
>{{ $t("delete_evaluation") }}</a
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<teleport to="body">
|
||||
<modal
|
||||
v-if="modal.showModal"
|
||||
:modalDialogClass="modal.modalDialogClass"
|
||||
@close="modal.showModal = false"
|
||||
>
|
||||
<template v-slot:header>
|
||||
<h2 class="modal-title">{{ $t("delete.sure") }}</h2>
|
||||
</template>
|
||||
<template v-slot:body>
|
||||
<p>{{ $t("delete.sure_description") }}</p>
|
||||
</template>
|
||||
<template v-slot:footer>
|
||||
<button
|
||||
class="btn btn-danger"
|
||||
@click="removeEvaluation(evaluation)"
|
||||
>
|
||||
{{ $t("delete.ok") }}
|
||||
</button>
|
||||
</template>
|
||||
</modal>
|
||||
</teleport>
|
||||
</div>
|
||||
|
||||
<teleport to="body">
|
||||
<modal
|
||||
v-if="modal.showModal"
|
||||
:modalDialogClass="modal.modalDialogClass"
|
||||
@close="modal.showModal = false"
|
||||
>
|
||||
<template v-slot:header>
|
||||
<h2 class="modal-title">{{ $t("delete.sure") }}</h2>
|
||||
</template>
|
||||
<template v-slot:body>
|
||||
<p>{{ $t("delete.sure_description") }}</p>
|
||||
</template>
|
||||
<template v-slot:footer>
|
||||
<button class="btn btn-danger" @click="removeEvaluation(evaluation)">
|
||||
{{ $t("delete.ok") }}
|
||||
</button>
|
||||
</template>
|
||||
</modal>
|
||||
</teleport>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -72,112 +75,114 @@ import { buildLinkCreate } from "ChillMainAssets/lib/entity-workflow/api";
|
||||
import { localizeString } from "ChillMainAssets/lib/localizationHelper/localizationHelper";
|
||||
|
||||
const i18n = {
|
||||
messages: {
|
||||
fr: {
|
||||
no_evaluation_associated: "Aucune évaluation associée",
|
||||
add_an_evaluation: "Évaluations disponibles",
|
||||
evaluation_has_no_evaluation: "Aucune évaluation disponible",
|
||||
startDate: "Date d'ouverture",
|
||||
endDate: "Date de fin",
|
||||
maxDate: "Date d'échéance",
|
||||
warningInterval: "Rappel (jours)",
|
||||
comment: "Note publique",
|
||||
documents: "Documents",
|
||||
delete: {
|
||||
sure: "Êtes-vous sûr?",
|
||||
sure_description:
|
||||
"Cette évaluation sera supprimée de cette action d'accompagnement",
|
||||
ok: "Supprimer",
|
||||
},
|
||||
delete_evaluation: "Supprimer l'évaluation",
|
||||
messages: {
|
||||
fr: {
|
||||
no_evaluation_associated: "Aucune évaluation associée",
|
||||
add_an_evaluation: "Évaluations disponibles",
|
||||
evaluation_has_no_evaluation: "Aucune évaluation disponible",
|
||||
startDate: "Date d'ouverture",
|
||||
endDate: "Date de fin",
|
||||
maxDate: "Date d'échéance",
|
||||
warningInterval: "Rappel (jours)",
|
||||
comment: "Note publique",
|
||||
documents: "Documents",
|
||||
delete: {
|
||||
sure: "Êtes-vous sûr?",
|
||||
sure_description:
|
||||
"Cette évaluation sera supprimée de cette action d'accompagnement",
|
||||
ok: "Supprimer",
|
||||
},
|
||||
delete_evaluation: "Supprimer l'évaluation",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default {
|
||||
name: "AddEvaluation",
|
||||
components: {
|
||||
FormEvaluation,
|
||||
Modal,
|
||||
ListWorkflowModal,
|
||||
},
|
||||
props: ["evaluation", "docAnchorId"],
|
||||
i18n,
|
||||
data() {
|
||||
return {
|
||||
modal: {
|
||||
showModal: false,
|
||||
modalDialogClass: "modal-dialog-centered modal-md",
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
pickedEvaluations() {
|
||||
return this.$store.state.evaluationsPicked;
|
||||
name: "AddEvaluation",
|
||||
components: {
|
||||
FormEvaluation,
|
||||
Modal,
|
||||
ListWorkflowModal,
|
||||
},
|
||||
canDelete() {
|
||||
if (this.evaluation.workflows.length > 0) {
|
||||
return false;
|
||||
}
|
||||
props: ["evaluation", "docAnchorId"],
|
||||
i18n,
|
||||
data() {
|
||||
return {
|
||||
modal: {
|
||||
showModal: false,
|
||||
modalDialogClass: "modal-dialog-centered modal-md",
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
pickedEvaluations() {
|
||||
return this.$store.state.evaluationsPicked;
|
||||
},
|
||||
canDelete() {
|
||||
if (this.evaluation.workflows.length > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let doc of this.evaluation.documents) {
|
||||
if (doc.workflows.length > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (let doc of this.evaluation.documents) {
|
||||
if (doc.workflows.length > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
localizeString,
|
||||
removeEvaluation(e) {
|
||||
this.$store.commit("removeEvaluation", e);
|
||||
return;
|
||||
},
|
||||
toggleEditEvaluation() {
|
||||
this.$store.commit("toggleEvaluationEdit", { key: this.evaluation.key });
|
||||
},
|
||||
submitForm() {
|
||||
this.toggleEditEvaluation();
|
||||
},
|
||||
goToGenerateWorkflow({ workflowName }) {
|
||||
const callback = (data) => {
|
||||
let evaluationId = data.accompanyingPeriodWorkEvaluations.find(
|
||||
(e) => e.key === this.evaluation.key,
|
||||
).id;
|
||||
window.location.assign(
|
||||
buildLinkCreate(
|
||||
workflowName,
|
||||
"Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluation",
|
||||
evaluationId,
|
||||
),
|
||||
);
|
||||
};
|
||||
methods: {
|
||||
localizeString,
|
||||
removeEvaluation(e) {
|
||||
this.$store.commit("removeEvaluation", e);
|
||||
return;
|
||||
},
|
||||
toggleEditEvaluation() {
|
||||
this.$store.commit("toggleEvaluationEdit", {
|
||||
key: this.evaluation.key,
|
||||
});
|
||||
},
|
||||
submitForm() {
|
||||
this.toggleEditEvaluation();
|
||||
},
|
||||
goToGenerateWorkflow({ workflowName }) {
|
||||
const callback = (data) => {
|
||||
let evaluationId = data.accompanyingPeriodWorkEvaluations.find(
|
||||
(e) => e.key === this.evaluation.key,
|
||||
).id;
|
||||
window.location.assign(
|
||||
buildLinkCreate(
|
||||
workflowName,
|
||||
"Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluation",
|
||||
evaluationId,
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
return this.$store.dispatch("submit", callback).catch((e) => {
|
||||
console.log(e);
|
||||
throw e;
|
||||
});
|
||||
return this.$store.dispatch("submit", callback).catch((e) => {
|
||||
console.log(e);
|
||||
throw e;
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
div.item-title {
|
||||
.evaluation-title {
|
||||
cursor: default;
|
||||
&::before {
|
||||
content: "";
|
||||
.evaluation-title {
|
||||
cursor: default;
|
||||
&::before {
|
||||
content: "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
div.item-url {
|
||||
i {
|
||||
color: unset !important;
|
||||
margin-left: 1rem;
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
i {
|
||||
color: unset !important;
|
||||
margin-left: 1rem;
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@@ -1,167 +1,179 @@
|
||||
<template>
|
||||
<div v-if="hasResult" class="addResult">
|
||||
<p v-if="pickedResults.length === 0" class="chill-no-data-statement">
|
||||
Aucun résultat associé
|
||||
</p>
|
||||
<div v-if="hasResult" class="addResult">
|
||||
<p v-if="pickedResults.length === 0" class="chill-no-data-statement">
|
||||
Aucun résultat associé
|
||||
</p>
|
||||
|
||||
<ul class="list-suggest remove-items">
|
||||
<li v-for="r in pickedResults" @click="removeResult(r)" :key="r.id">
|
||||
<span>
|
||||
{{ localizeString(r.title) }}
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-suggest remove-items">
|
||||
<li v-for="r in pickedResults" @click="removeResult(r)" :key="r.id">
|
||||
<span>
|
||||
{{ localizeString(r.title) }}
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="accordion" id="expandedSuggestions">
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="heading_expanded_suggestions">
|
||||
<button
|
||||
v-if="isExpanded"
|
||||
class="accordion-button"
|
||||
type="button"
|
||||
data-bs-toggle="collapse"
|
||||
aria-expanded="true"
|
||||
@click="toggleSelect"
|
||||
>
|
||||
Masquer
|
||||
</button>
|
||||
<div class="accordion" id="expandedSuggestions">
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="heading_expanded_suggestions">
|
||||
<button
|
||||
v-if="isExpanded"
|
||||
class="accordion-button"
|
||||
type="button"
|
||||
data-bs-toggle="collapse"
|
||||
aria-expanded="true"
|
||||
@click="toggleSelect"
|
||||
>
|
||||
Masquer
|
||||
</button>
|
||||
|
||||
<button
|
||||
v-else
|
||||
class="accordion-button collapsed"
|
||||
type="button"
|
||||
data-bs-toggle="collapse"
|
||||
aria-expanded="false"
|
||||
@click="toggleSelect"
|
||||
>
|
||||
Résultats et orientations disponibles
|
||||
</button>
|
||||
</h2>
|
||||
<div
|
||||
class="accordion-collapse"
|
||||
id="collapse_expanded_suggestions"
|
||||
aria-labelledby="heading_expanded_suggestions"
|
||||
data-bs-parent="#expandedSuggestions"
|
||||
>
|
||||
<template v-if="isExpanded">
|
||||
<ul class="list-suggest add-items">
|
||||
<li
|
||||
v-for="r in availableForCheckResults"
|
||||
@click="addResult(r)"
|
||||
:key="r.id"
|
||||
>
|
||||
<span>{{ localizeString(r.title) }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
<button
|
||||
v-else
|
||||
class="accordion-button collapsed"
|
||||
type="button"
|
||||
data-bs-toggle="collapse"
|
||||
aria-expanded="false"
|
||||
@click="toggleSelect"
|
||||
>
|
||||
Résultats et orientations disponibles
|
||||
</button>
|
||||
</h2>
|
||||
<div
|
||||
class="accordion-collapse"
|
||||
id="collapse_expanded_suggestions"
|
||||
aria-labelledby="heading_expanded_suggestions"
|
||||
data-bs-parent="#expandedSuggestions"
|
||||
>
|
||||
<template v-if="isExpanded">
|
||||
<ul class="list-suggest add-items">
|
||||
<li
|
||||
v-for="r in availableForCheckResults"
|
||||
@click="addResult(r)"
|
||||
:key="r.id"
|
||||
>
|
||||
<span>{{ localizeString(r.title) }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!hasResult" class="noResult">
|
||||
<div class="chill-no-data-statement">
|
||||
{{ $t("goal_has_no_result") }}
|
||||
<div v-if="!hasResult" class="noResult">
|
||||
<div class="chill-no-data-statement">
|
||||
{{ $t("goal_has_no_result") }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { localizeString } from "ChillMainAssets/lib/localizationHelper/localizationHelper";
|
||||
|
||||
const i18n = {
|
||||
messages: {
|
||||
fr: {
|
||||
add_a_result: "Résultat - orientation disponibles",
|
||||
goal_has_no_result: "Aucun résultat - orientation disponible",
|
||||
messages: {
|
||||
fr: {
|
||||
add_a_result: "Résultat - orientation disponibles",
|
||||
goal_has_no_result: "Aucun résultat - orientation disponible",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default {
|
||||
name: "AddResult",
|
||||
props: ["destination", "goal", "availableResults"],
|
||||
i18n,
|
||||
data() {
|
||||
return {
|
||||
isExpanded: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
hasResult() {
|
||||
if (this.destination === "action") {
|
||||
return this.$store.state.resultsForAction.length > 0;
|
||||
} else if (this.destination === "goal") {
|
||||
return this.$store.getters.resultsForGoal(this.goal).length > 0;
|
||||
}
|
||||
name: "AddResult",
|
||||
props: ["destination", "goal", "availableResults"],
|
||||
i18n,
|
||||
data() {
|
||||
return {
|
||||
isExpanded: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
hasResult() {
|
||||
if (this.destination === "action") {
|
||||
return this.$store.state.resultsForAction.length > 0;
|
||||
} else if (this.destination === "goal") {
|
||||
return this.$store.getters.resultsForGoal(this.goal).length > 0;
|
||||
}
|
||||
|
||||
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||
},
|
||||
pickedResults() {
|
||||
if (this.destination === "action") {
|
||||
return this.$store.state.resultsPicked;
|
||||
} else if (this.destination === "goal") {
|
||||
return this.$store.getters.resultsPickedForGoal(this.goal);
|
||||
}
|
||||
throw Error(
|
||||
`this.destination is not implemented: ${this.destination}`,
|
||||
);
|
||||
},
|
||||
pickedResults() {
|
||||
if (this.destination === "action") {
|
||||
return this.$store.state.resultsPicked;
|
||||
} else if (this.destination === "goal") {
|
||||
return this.$store.getters.resultsPickedForGoal(this.goal);
|
||||
}
|
||||
|
||||
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||
},
|
||||
availableForCheckResults() {
|
||||
if (this.destination === "action") {
|
||||
let pickedIds = this.$store.state.resultsPicked.map((r) => r.id);
|
||||
throw Error(
|
||||
`this.destination is not implemented: ${this.destination}`,
|
||||
);
|
||||
},
|
||||
availableForCheckResults() {
|
||||
if (this.destination === "action") {
|
||||
let pickedIds = this.$store.state.resultsPicked.map(
|
||||
(r) => r.id,
|
||||
);
|
||||
|
||||
return this.$store.state.resultsForAction.filter(
|
||||
(r) => !pickedIds.includes(r.id),
|
||||
);
|
||||
} else if (this.destination === "goal") {
|
||||
let pickedIds = this.$store.getters
|
||||
.resultsPickedForGoal(this.goal)
|
||||
.map((r) => r.id);
|
||||
return this.$store.state.resultsForAction.filter(
|
||||
(r) => !pickedIds.includes(r.id),
|
||||
);
|
||||
} else if (this.destination === "goal") {
|
||||
let pickedIds = this.$store.getters
|
||||
.resultsPickedForGoal(this.goal)
|
||||
.map((r) => r.id);
|
||||
|
||||
return this.$store.getters
|
||||
.resultsForGoal(this.goal)
|
||||
.filter((r) => !pickedIds.includes(r.id));
|
||||
}
|
||||
return this.$store.getters
|
||||
.resultsForGoal(this.goal)
|
||||
.filter((r) => !pickedIds.includes(r.id));
|
||||
}
|
||||
|
||||
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||
throw Error(
|
||||
`this.destination is not implemented: ${this.destination}`,
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
localizeString,
|
||||
toggleSelect() {
|
||||
this.isExpanded = !this.isExpanded;
|
||||
methods: {
|
||||
localizeString,
|
||||
toggleSelect() {
|
||||
this.isExpanded = !this.isExpanded;
|
||||
},
|
||||
addResult(r) {
|
||||
if (this.destination === "action") {
|
||||
this.$store.commit("addResultPicked", r);
|
||||
return;
|
||||
} else if (this.destination === "goal") {
|
||||
this.$store.commit("addResultForGoalPicked", {
|
||||
goal: this.goal,
|
||||
result: r,
|
||||
});
|
||||
return;
|
||||
}
|
||||
throw Error(
|
||||
`this.destination is not implemented: ${this.destination}`,
|
||||
);
|
||||
},
|
||||
removeResult(r) {
|
||||
if (this.destination === "action") {
|
||||
this.$store.commit("removeResultPicked", r);
|
||||
return;
|
||||
} else if (this.destination === "goal") {
|
||||
this.$store.commit("removeResultForGoalPicked", {
|
||||
goal: this.goal,
|
||||
result: r,
|
||||
});
|
||||
return;
|
||||
}
|
||||
throw Error(
|
||||
`this.destination is not implemented: ${this.destination}`,
|
||||
);
|
||||
},
|
||||
},
|
||||
addResult(r) {
|
||||
if (this.destination === "action") {
|
||||
this.$store.commit("addResultPicked", r);
|
||||
return;
|
||||
} else if (this.destination === "goal") {
|
||||
this.$store.commit("addResultForGoalPicked", {
|
||||
goal: this.goal,
|
||||
result: r,
|
||||
});
|
||||
return;
|
||||
}
|
||||
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||
},
|
||||
removeResult(r) {
|
||||
if (this.destination === "action") {
|
||||
this.$store.commit("removeResultPicked", r);
|
||||
return;
|
||||
} else if (this.destination === "goal") {
|
||||
this.$store.commit("removeResultForGoalPicked", {
|
||||
goal: this.goal,
|
||||
result: r,
|
||||
});
|
||||
return;
|
||||
}
|
||||
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.accordion-button {
|
||||
padding: 0.25rem;
|
||||
padding: 0.25rem;
|
||||
}
|
||||
</style>
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user