From 6255ecfee3f8698fe94df1203739a424e7223154 Mon Sep 17 00:00:00 2001 From: Bastien Seree Date: Tue, 17 Dec 2024 17:26:57 +0100 Subject: [PATCH] EDF: [#128] define generate_order action with one param --- studio-test/src/dependencies/utils/actions.js | 13 ++++++++++++- studio/src/dependencies/utils/actions.js | 13 ++++++++++++- studio/src/utils/actions.ts | 7 +++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/studio-test/src/dependencies/utils/actions.js b/studio-test/src/dependencies/utils/actions.js index 284f0d5ae..45459c54b 100644 --- a/studio-test/src/dependencies/utils/actions.js +++ b/studio-test/src/dependencies/utils/actions.js @@ -1200,5 +1200,16 @@ return Promise.allSettled(imagePromises) nb_tables } return axios.post(url, body) - } + }, + + generate_order: ({value, props, level, getComponentValue}) => { + const nb_tickets = getComponentValue(props.nb_tickets, level) + let url = `${API_ROOT}/action` + const body = { + action: 'generate_order', + value: value?._id, + nb_tickets + } + return axios.post(url, body) + }, } diff --git a/studio/src/dependencies/utils/actions.js b/studio/src/dependencies/utils/actions.js index 284f0d5ae..45459c54b 100644 --- a/studio/src/dependencies/utils/actions.js +++ b/studio/src/dependencies/utils/actions.js @@ -1200,5 +1200,16 @@ return Promise.allSettled(imagePromises) nb_tables } return axios.post(url, body) - } + }, + + generate_order: ({value, props, level, getComponentValue}) => { + const nb_tickets = getComponentValue(props.nb_tickets, level) + let url = `${API_ROOT}/action` + const body = { + action: 'generate_order', + value: value?._id, + nb_tickets + } + return axios.post(url, body) + }, } diff --git a/studio/src/utils/actions.ts b/studio/src/utils/actions.ts index 57b6cdd7a..ac7923a63 100644 --- a/studio/src/utils/actions.ts +++ b/studio/src/utils/actions.ts @@ -780,6 +780,13 @@ export const ACTIONS: IActions = { }, next: [], }, + generate_order: { + label: 'generate order', + options: { + nb_tickets: ({components}) => components.map(p => ({key: p.id, label: p.id})), + }, + next: [], + }, toggle_full_screen: { label: 'Toggle full screen', options: {},