diff --git a/src/Bundle/ChillTicketBundle/src/Resources/public/types.ts b/src/Bundle/ChillTicketBundle/src/Resources/public/types.ts index 2c347977c..9c0d467f8 100644 --- a/src/Bundle/ChillTicketBundle/src/Resources/public/types.ts +++ b/src/Bundle/ChillTicketBundle/src/Resources/public/types.ts @@ -52,7 +52,7 @@ export interface Comment { updatedAt: DateTime|null, } -interface AddresseeHistory { +export interface AddresseeHistory { type: "ticket_addressee_history", id: number, startDate: DateTime|null, diff --git a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/App.vue b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/App.vue index b993caa2f..cf4eff359 100644 --- a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/App.vue +++ b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/App.vue @@ -37,9 +37,11 @@ export default defineComponent({ const motives = computed(() => store.getters.getMotives as Motive[]) const ticket = computed(() => store.getters.getTicket as Ticket) - onMounted(() => { + onMounted(async () => { try { - store.dispatch('fetchMotives') + await store.dispatch('fetchMotives') + await store.dispatch('fetchUserGroups') + await store.dispatch('fetchUsers') } catch (error) { toast.error(error) }; diff --git a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/ActionToolbarComponent.vue b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/ActionToolbarComponent.vue index 986e466eb..ed38bedae 100644 --- a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/ActionToolbarComponent.vue +++ b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/ActionToolbarComponent.vue @@ -24,19 +24,21 @@
-
- -
+
+ +
+ +
+
- +
diff --git a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/i18n/messages.ts b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/i18n/messages.ts index f1605c4a5..e320b84e7 100644 --- a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/i18n/messages.ts +++ b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/i18n/messages.ts @@ -10,6 +10,7 @@ const messages = { user: "Prise en charge par {username}", motive: "Motif indiqué: {motive}", comment: "Commentaire: {comment}", + user_group: "Transferer au group: {user_group}", }, comment: { title: "Commentaire", diff --git a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/store/modules/motive.ts b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/store/modules/motive.ts index 296301fc2..1c2696106 100644 --- a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/store/modules/motive.ts +++ b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/store/modules/motive.ts @@ -20,12 +20,6 @@ export const moduleMotive: Module = { getMotives(state) { return state.motives; }, - getMotiveOptions(state) { - return state.motives.map((motive) => ({ - value: motive.id, - text: motive.label.fr, - })); - }, }, mutations: { setMotives(state, motives) { @@ -39,8 +33,7 @@ export const moduleMotive: Module = { "/api/1.0/ticket/motive.json" )) as Motive[]; commit("setMotives", results); - } - catch(e: any) { + } catch (e: any) { throw e.name; } }, @@ -54,11 +47,15 @@ export const moduleMotive: Module = { const result = await makeFetch( "POST", `/api/1.0/ticket/${ticketId}/motive/set`, - { motive } + { + motive: { + id: motive.id, + type: motive.type, + }, + } ); commit("setTicket", result); - } - catch(e: any) { + } catch (e: any) { throw e.name; } }, diff --git a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/store/modules/user.ts b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/store/modules/user.ts index 5fa9e8be1..f4441e34b 100644 --- a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/store/modules/user.ts +++ b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/store/modules/user.ts @@ -30,9 +30,16 @@ export const moduleUser: Module = { return state.users; }, }, - mutations: {}, + mutations: { + setUserGroups(state, userGroups) { + state.userGroups = userGroups; + }, + setUsers(state, users) { + state.users = users; + }, + }, actions: { - getUserGroups({ commit }) { + fetchUserGroups({ commit }) { try { fetchResults("/api/1.0/main/user-group.json").then( (results) => { @@ -43,23 +50,30 @@ export const moduleUser: Module = { throw e.name; } }, - getUsers({ commit }) { + fetchUsers({ commit }) { try { - fetchResults("/1.0/main/user.json").then((results) => { - commit("setUserGroups", results); + fetchResults("/api/1.0/main/user.json").then((results) => { + commit("setUsers", results); }); } catch (e: any) { throw e.name; } }, - async setAdressees({ commit }, datas: { ticketId: number; addressees: Array}) { + async setAdressees( + { commit }, + datas: { ticketId: number; addressees: Array } + ) { const { ticketId, addressees } = datas; try { const result = await makeFetch( "POST", `/api/1.0/ticket/${ticketId}/addressees/set`, - addressees + { + addressees: addressees.map((addressee) => { + return { id: addressee.id, type: addressee.type }; + }), + } ); commit("setTicket", result); } catch (e: any) { diff --git a/src/Bundle/ChillTicketBundle/src/Resources/views/Banner/banner.html.twig b/src/Bundle/ChillTicketBundle/src/Resources/views/Banner/banner.html.twig index c8a7ff724..46f02d298 100644 --- a/src/Bundle/ChillTicketBundle/src/Resources/views/Banner/banner.html.twig +++ b/src/Bundle/ChillTicketBundle/src/Resources/views/Banner/banner.html.twig @@ -36,7 +36,7 @@

{{'concerned_patient' | trans}}

{% for person in ticket.getPersons() %} - + {{ person.firstName }} {{ person.lastName }} @@ -51,12 +51,10 @@

{{'speaker' | trans}}

{% for addressee in ticket.getCurrentAddressee() %} - - {% if addressee.type=='chill_main_user_group' %} - {{ addressee.label.fr }} - {% else %} - {{ addressee.username }} - {% endif %} + + + {{ addressee.label.fr }} + {% endfor %}