From 3f0a7810553e6de032c69a88f3185a34caccdaa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Castillo?= Date: Wed, 6 Nov 2024 13:56:40 -0300 Subject: [PATCH] get and update ticket types on ticket list page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Castillo --- src/pages/tickets/ticket-list-page.js | 30 +++++++++++-------- .../summits/current-summit-reducer.js | 12 ++++++++ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/pages/tickets/ticket-list-page.js b/src/pages/tickets/ticket-list-page.js index cdf554c21..ca1fab5d6 100644 --- a/src/pages/tickets/ticket-list-page.js +++ b/src/pages/tickets/ticket-list-page.js @@ -38,7 +38,8 @@ import { clearAllSelectedTicket, setSelectedAll, printTickets, - getTicket + getTicket, + getTicketTypes } from "../../actions/ticket-actions"; import { getSummitById } from "../../actions/summit-actions"; import QrReaderInput from "../../components/inputs/qr-reader-input"; @@ -175,7 +176,8 @@ class TicketListPage extends React.Component { orderDir, filters, extraColumns, - getTickets + getTickets, + getTicketTypes } = this.props; if (currentSummit) { @@ -189,15 +191,18 @@ class TicketListPage extends React.Component { enabledFilters, ticketFilters: { ...ticketFilters, ...filters } })); - getTickets( - term, - DEFAULT_CURRENT_PAGE, - DEFAULT_PER_PAGE, - order, - orderDir, - filters, - extraColumns - ); + if (currentSummit) { + getTicketTypes(currentSummit); + getTickets( + term, + DEFAULT_CURRENT_PAGE, + DEFAULT_PER_PAGE, + order, + orderDir, + filters, + extraColumns + ); + } } } @@ -1450,5 +1455,6 @@ export default connect(mapStateToProps, { getTicket, getBadgeTypes, saveFilterCriteria, - deleteFilterCriteria + deleteFilterCriteria, + getTicketTypes })(TicketListPage); diff --git a/src/reducers/summits/current-summit-reducer.js b/src/reducers/summits/current-summit-reducer.js index 8aa639543..277711adf 100644 --- a/src/reducers/summits/current-summit-reducer.js +++ b/src/reducers/summits/current-summit-reducer.js @@ -64,6 +64,7 @@ import { RECEIVE_USER_ROLES_BY_SUMMIT } from "../../actions/user-chat-roles-acti import { RECEIVE_REFUND_POLICIES, + RECEIVE_TICKET_TYPES, TICKET_TYPES_CURRENCY_UPDATED } from "../../actions/ticket-actions"; import { @@ -758,6 +759,17 @@ const currentSummitReducer = (state = DEFAULT_STATE, action) => { } }; } + case RECEIVE_TICKET_TYPES: { + const ticketTypes = payload.response.data; + + return { + ...state, + currentSummit: { + ...state.currentSummit, + ticket_types: ticketTypes + } + }; + } default: return state; }