mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Feature: show my workflows in Cc in homepage vue widget
This commit is contained in:
parent
a992c45720
commit
7580565e08
@ -1,88 +1,25 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<div class="alert alert-light">{{ $t('my_workflows.description') }}</div>
|
||||||
|
<my-workflows-table :workflows="workflows" />
|
||||||
|
|
||||||
<div class="alert alert-light">{{ $t('my_workflows.description') }}</div>
|
<div class="alert alert-light">{{ $t('my_workflows.description_cc') }}</div>
|
||||||
<span v-if="noResults" class="chill-no-data-statement">{{ $t('no_data') }}</span>
|
<my-workflows-table :workflows="workflowsCc" />
|
||||||
<tab-table v-else>
|
|
||||||
<template v-slot:thead>
|
|
||||||
<th scope="col">{{ $t('Object_workflow') }}</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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState, mapGetters } from "vuex";
|
import { mapState } from "vuex";
|
||||||
import TabTable from "./TabTable";
|
import MyWorkflowsTable from './MyWorkflowsTable.vue';
|
||||||
import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MyWorkflows",
|
name: "MyWorkflows",
|
||||||
components: {
|
components: {
|
||||||
TabTable,
|
MyWorkflowsTable
|
||||||
OnTheFly
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState([
|
...mapState([
|
||||||
'workflows',
|
'workflows',
|
||||||
|
'workflowsCc',
|
||||||
]),
|
]),
|
||||||
...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>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
span.outdated {
|
|
||||||
font-weight: bold;
|
|
||||||
color: var(--bs-warning);
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -0,0 +1,83 @@
|
|||||||
|
<template>
|
||||||
|
<span v-if="hasNoResults(workflows)" class="chill-no-data-statement">{{ $t('no_data') }}</span>
|
||||||
|
<tab-table v-else>
|
||||||
|
<template v-slot:thead>
|
||||||
|
<th scope="col">{{ $t('Object_workflow') }}</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 { mapGetters } from "vuex";
|
||||||
|
import TabTable from "./TabTable";
|
||||||
|
import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "MyWorkflows",
|
||||||
|
components: {
|
||||||
|
TabTable,
|
||||||
|
OnTheFly
|
||||||
|
},
|
||||||
|
props: ['workflows'],
|
||||||
|
computed: {
|
||||||
|
...mapGetters([
|
||||||
|
'isWorkflowsLoaded',
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
hasNoResults(workflows) {
|
||||||
|
if (!this.isWorkflowsLoaded) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return workflows.count === 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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>
|
@ -24,7 +24,8 @@ const appMessages = {
|
|||||||
},
|
},
|
||||||
my_workflows: {
|
my_workflows: {
|
||||||
tab: "Mes workflows",
|
tab: "Mes workflows",
|
||||||
description: "Liste des workflows en attente d'une action."
|
description: "Liste des workflows en attente d'une action.",
|
||||||
|
description_cc: "Liste des workflows dont je suis en copie."
|
||||||
},
|
},
|
||||||
opening_date: "Date d'ouverture",
|
opening_date: "Date d'ouverture",
|
||||||
social_issues: "Problématiques sociales",
|
social_issues: "Problématiques sociales",
|
||||||
|
@ -22,6 +22,7 @@ const store = createStore({
|
|||||||
accompanyingCourses: {},
|
accompanyingCourses: {},
|
||||||
notifications: {},
|
notifications: {},
|
||||||
workflows: {},
|
workflows: {},
|
||||||
|
workflowsCc: {},
|
||||||
errorMsg: [],
|
errorMsg: [],
|
||||||
loading: false
|
loading: false
|
||||||
},
|
},
|
||||||
@ -87,6 +88,9 @@ const store = createStore({
|
|||||||
addWorkflows(state, workflows) {
|
addWorkflows(state, workflows) {
|
||||||
state.workflows = workflows;
|
state.workflows = workflows;
|
||||||
},
|
},
|
||||||
|
addWorkflowsCc(state, workflows) {
|
||||||
|
state.workflowsCc = workflows;
|
||||||
|
},
|
||||||
setLoading(state, bool) {
|
setLoading(state, bool) {
|
||||||
state.loading = bool;
|
state.loading = bool;
|
||||||
},
|
},
|
||||||
@ -195,17 +199,23 @@ const store = createStore({
|
|||||||
case 'MyWorkflows':
|
case 'MyWorkflows':
|
||||||
if (!getters.isWorflowsLoaded) {
|
if (!getters.isWorflowsLoaded) {
|
||||||
commit('setLoading', true);
|
commit('setLoading', true);
|
||||||
const url = '/api/1.0/main/workflow/my';
|
makeFetch('GET', '/api/1.0/main/workflow/my')
|
||||||
makeFetch('GET', url)
|
.then((response) => {
|
||||||
.then((response) => {
|
commit('addWorkflows', response);
|
||||||
console.log('workflows', response)
|
makeFetch('GET', '/api/1.0/main/workflow/my-cc')
|
||||||
commit('addWorkflows', response);
|
.then((response) => {
|
||||||
commit('setLoading', false);
|
commit('addWorkflowsCc', response);
|
||||||
})
|
commit('setLoading', false);
|
||||||
.catch((error) => {
|
})
|
||||||
commit('catchError', error);
|
.catch((error) => {
|
||||||
throw error;
|
commit('catchError', error);
|
||||||
});
|
throw error;
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
commit('catchError', error);
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user