From 2ab7556ac3ea5c0785cd5456f718e4d6459d3a0f Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 16 Feb 2022 10:26:00 +0100 Subject: [PATCH] Add workflows tab to dashboard --- .../vuejs/HomepageWidget/MyWorkflows.vue | 88 +++++++++++++++++++ .../public/vuejs/HomepageWidget/js/i18n.js | 8 ++ .../public/vuejs/HomepageWidget/js/store.js | 34 +++++-- 3 files changed, 122 insertions(+), 8 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyWorkflows.vue diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyWorkflows.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyWorkflows.vue new file mode 100644 index 000000000..779cd35c0 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyWorkflows.vue @@ -0,0 +1,88 @@ + + + + + \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js index 0845d0f02..b3576116e 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js @@ -22,6 +22,10 @@ const appMessages = { tab: "Mes notifications", 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", social_issues: "Problématiques sociales", concerned_persons: "Usagers concernés", @@ -33,12 +37,16 @@ const appMessages = { From: "Expéditeur", Subject: "Objet", Entity: "Associé à", + Step: "Étape", + concerned_users: "Usagers concernés", + Document: "Document", show_entity: "Voir {entity}", the_activity: "l'échange", the_course: "le parcours", the_action: "l'action", the_evaluation: "l'évaluation", the_task: "la tâche", + the_workflow: "le workflow", StartDate: "Date d'ouverture", SocialAction: "Action d'accompagnement", no_data: "Aucun résultats", diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/store.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/store.js index 9507d5085..c33ec2123 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/store.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/store.js @@ -1,12 +1,6 @@ import 'es6-promise/auto'; import { createStore } from 'vuex'; 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'; @@ -27,6 +21,7 @@ const store = createStore({ }, accompanyingCourses: {}, notifications: {}, + workflows: {}, errorMsg: [], loading: false }, @@ -49,6 +44,9 @@ const store = createStore({ isNotificationsLoaded(state) { return !isEmpty(state.notifications); }, + isWorkflowsLoaded(state) { + return !isEmpty(state.workflows); + }, counter(state) { return { works: state.works.count, @@ -57,6 +55,7 @@ const store = createStore({ tasksAlert: state.tasks.alert.count, accompanyingCourses: state.accompanyingCourses.count, notifications: state.notifications.count, + workflows: state.workflows.count } } }, @@ -85,6 +84,9 @@ const store = createStore({ //console.log('addNotifications', notifications); state.notifications = notifications; }, + addWorkflows(state, workflows) { + state.workflows = workflows; + }, setLoading(state, bool) { state.loading = bool; }, @@ -180,14 +182,30 @@ const store = createStore({ const url = `/api/1.0/main/notification/my/unread${'?'+ param}`; makeFetch('GET', url) .then((response) => { + console.log('notifications', response) commit('addNotifications', response); commit('setLoading', false); }) .catch((error) => { commit('catchError', 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; default: