mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
Add workflows tab to dashboard
This commit is contained in:
parent
3d38da7b37
commit
2ab7556ac3
@ -0,0 +1,88 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
<div class="alert alert-light">{{ $t('my_workflows.description') }}</div>
|
||||||
|
<span v-if="noResults" class="chill-no-data-statement">{{ $t('no_data') }}</span>
|
||||||
|
<tab-table v-else>
|
||||||
|
<template v-slot:thead>
|
||||||
|
<th scope="col">{{ $t('Document') }}</th>
|
||||||
|
<th scope="col">{{ $t('Step') }}</th>
|
||||||
|
<th scope="col">{{ $t('concerned_users') }}</th>
|
||||||
|
<th scope="col"></th>
|
||||||
|
</template>
|
||||||
|
<template v-slot:tbody>
|
||||||
|
<tr v-for="(w, i) in workflows.results" :key="`workflow-${i}`">
|
||||||
|
<td>{{ w.title }}</td>
|
||||||
|
<td>
|
||||||
|
<div class="workflow">
|
||||||
|
<div class="breadcrumb">
|
||||||
|
<i class="fa fa-circle me-1 text-chill-yellow mx-2"></i>
|
||||||
|
<span class="mx-2">{{ getStep(w) }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td v-if="w.datas.persons !== null">
|
||||||
|
<span v-for="p in w.datas.persons" class="me-1" :key="p.id">
|
||||||
|
<on-the-fly
|
||||||
|
:type="p.type"
|
||||||
|
:id="p.id"
|
||||||
|
:buttonText="p.textAge"
|
||||||
|
:displayBadge="'true' === 'true'"
|
||||||
|
action="show">
|
||||||
|
</on-the-fly>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a class="btn btn-sm btn-show" :href="getUrl(w)">
|
||||||
|
{{ $t('show_entity', { entity: $t('the_workflow') }) }}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</template>
|
||||||
|
</tab-table>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapState, mapGetters } from "vuex";
|
||||||
|
import TabTable from "./TabTable";
|
||||||
|
import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "MyWorkflows",
|
||||||
|
components: {
|
||||||
|
TabTable,
|
||||||
|
OnTheFly
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState([
|
||||||
|
'workflows',
|
||||||
|
]),
|
||||||
|
...mapGetters([
|
||||||
|
'isWorkflowsLoaded',
|
||||||
|
]),
|
||||||
|
noResults() {
|
||||||
|
if (!this.isWorkflowsLoaded) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return this.workflows.count === 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getUrl(w) {
|
||||||
|
return `/fr/main/workflow/${w.id}/show`;
|
||||||
|
},
|
||||||
|
getStep(w) {
|
||||||
|
const lastStep = w.steps.length - 1
|
||||||
|
return w.steps[lastStep].currentStep.text;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
span.outdated {
|
||||||
|
font-weight: bold;
|
||||||
|
color: var(--bs-warning);
|
||||||
|
}
|
||||||
|
</style>
|
@ -22,6 +22,10 @@ const appMessages = {
|
|||||||
tab: "Mes notifications",
|
tab: "Mes notifications",
|
||||||
description: "Liste des notifications reçues et non lues.",
|
description: "Liste des notifications reçues et non lues.",
|
||||||
},
|
},
|
||||||
|
my_workflows: {
|
||||||
|
tab: "Mes workflows",
|
||||||
|
description: "Liste des workflows en attente d'une action."
|
||||||
|
},
|
||||||
opening_date: "Date d'ouverture",
|
opening_date: "Date d'ouverture",
|
||||||
social_issues: "Problématiques sociales",
|
social_issues: "Problématiques sociales",
|
||||||
concerned_persons: "Usagers concernés",
|
concerned_persons: "Usagers concernés",
|
||||||
@ -33,12 +37,16 @@ const appMessages = {
|
|||||||
From: "Expéditeur",
|
From: "Expéditeur",
|
||||||
Subject: "Objet",
|
Subject: "Objet",
|
||||||
Entity: "Associé à",
|
Entity: "Associé à",
|
||||||
|
Step: "Étape",
|
||||||
|
concerned_users: "Usagers concernés",
|
||||||
|
Document: "Document",
|
||||||
show_entity: "Voir {entity}",
|
show_entity: "Voir {entity}",
|
||||||
the_activity: "l'échange",
|
the_activity: "l'échange",
|
||||||
the_course: "le parcours",
|
the_course: "le parcours",
|
||||||
the_action: "l'action",
|
the_action: "l'action",
|
||||||
the_evaluation: "l'évaluation",
|
the_evaluation: "l'évaluation",
|
||||||
the_task: "la tâche",
|
the_task: "la tâche",
|
||||||
|
the_workflow: "le workflow",
|
||||||
StartDate: "Date d'ouverture",
|
StartDate: "Date d'ouverture",
|
||||||
SocialAction: "Action d'accompagnement",
|
SocialAction: "Action d'accompagnement",
|
||||||
no_data: "Aucun résultats",
|
no_data: "Aucun résultats",
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
import 'es6-promise/auto';
|
import 'es6-promise/auto';
|
||||||
import { createStore } from 'vuex';
|
import { createStore } from 'vuex';
|
||||||
import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
||||||
import MyCustoms from "../MyCustoms";
|
|
||||||
import MyWorks from "../MyWorks";
|
|
||||||
import MyEvaluations from "../MyEvaluations";
|
|
||||||
import MyTasks from "../MyTasks";
|
|
||||||
import MyAccompanyingCourses from "../MyAccompanyingCourses";
|
|
||||||
import MyNotifications from "../MyNotifications";
|
|
||||||
|
|
||||||
const debug = process.env.NODE_ENV !== 'production';
|
const debug = process.env.NODE_ENV !== 'production';
|
||||||
|
|
||||||
@ -27,6 +21,7 @@ const store = createStore({
|
|||||||
},
|
},
|
||||||
accompanyingCourses: {},
|
accompanyingCourses: {},
|
||||||
notifications: {},
|
notifications: {},
|
||||||
|
workflows: {},
|
||||||
errorMsg: [],
|
errorMsg: [],
|
||||||
loading: false
|
loading: false
|
||||||
},
|
},
|
||||||
@ -49,6 +44,9 @@ const store = createStore({
|
|||||||
isNotificationsLoaded(state) {
|
isNotificationsLoaded(state) {
|
||||||
return !isEmpty(state.notifications);
|
return !isEmpty(state.notifications);
|
||||||
},
|
},
|
||||||
|
isWorkflowsLoaded(state) {
|
||||||
|
return !isEmpty(state.workflows);
|
||||||
|
},
|
||||||
counter(state) {
|
counter(state) {
|
||||||
return {
|
return {
|
||||||
works: state.works.count,
|
works: state.works.count,
|
||||||
@ -57,6 +55,7 @@ const store = createStore({
|
|||||||
tasksAlert: state.tasks.alert.count,
|
tasksAlert: state.tasks.alert.count,
|
||||||
accompanyingCourses: state.accompanyingCourses.count,
|
accompanyingCourses: state.accompanyingCourses.count,
|
||||||
notifications: state.notifications.count,
|
notifications: state.notifications.count,
|
||||||
|
workflows: state.workflows.count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -85,6 +84,9 @@ const store = createStore({
|
|||||||
//console.log('addNotifications', notifications);
|
//console.log('addNotifications', notifications);
|
||||||
state.notifications = notifications;
|
state.notifications = notifications;
|
||||||
},
|
},
|
||||||
|
addWorkflows(state, workflows) {
|
||||||
|
state.workflows = workflows;
|
||||||
|
},
|
||||||
setLoading(state, bool) {
|
setLoading(state, bool) {
|
||||||
state.loading = bool;
|
state.loading = bool;
|
||||||
},
|
},
|
||||||
@ -180,14 +182,30 @@ const store = createStore({
|
|||||||
const url = `/api/1.0/main/notification/my/unread${'?'+ param}`;
|
const url = `/api/1.0/main/notification/my/unread${'?'+ param}`;
|
||||||
makeFetch('GET', url)
|
makeFetch('GET', url)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
console.log('notifications', response)
|
||||||
commit('addNotifications', response);
|
commit('addNotifications', response);
|
||||||
commit('setLoading', false);
|
commit('setLoading', false);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
commit('catchError', error);
|
commit('catchError', error);
|
||||||
throw error;
|
throw error;
|
||||||
})
|
});
|
||||||
;
|
}
|
||||||
|
break;
|
||||||
|
case 'MyWorkflows':
|
||||||
|
if (!getters.isWorflowsLoaded) {
|
||||||
|
commit('setLoading', true);
|
||||||
|
const url = '/api/1.0/main/workflow/my';
|
||||||
|
makeFetch('GET', url)
|
||||||
|
.then((response) => {
|
||||||
|
console.log('workflows', response)
|
||||||
|
commit('addWorkflows', response);
|
||||||
|
commit('setLoading', false);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
commit('catchError', error);
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user