diff --git a/components/admin/ticket.tsx b/components/admin/ticket.tsx index f87f5f6f..6e47d8ba 100644 --- a/components/admin/ticket.tsx +++ b/components/admin/ticket.tsx @@ -1,7 +1,6 @@ 'use client' import useSWR, {mutate} from "swr"; import { useState } from "react"; -import { initialSelectedOptions } from "../ticketing/pricingDefaults"; import { format, fromUnixTime } from "date-fns"; import Link from "next/link"; import NameChangeModal from './modals/nameChangeModal'; @@ -9,16 +8,9 @@ import TicketTransferModal from './modals/ticketTransferModal'; import { fetcher } from "@lib/fetchers"; import { guaranteeTimestampFromDate } from "@lib/useful"; -const accessToThings = (access:number[],) => { - let products = [] - let index = 0 - Object.keys(initialSelectedOptions).forEach((day) => { - Object.keys(initialSelectedOptions[day]).forEach((pass) => { - if (access[index] === 1) { products.push(`${day} ${pass}`) } - index += 1 - }) - }) - return products +const mapAccessArrayToItems = (accessArray: number[]) => { + const accessOrder = ["Friday Party", "Saturday Classes", "Saturday Dinner", "Saturday Party", "Sunday Classes", "Sunday Party"]; + return accessOrder.map((item, index) => (accessArray[index] === 1 ? item : null)).filter(item => item !== null) } type infoOptions = { @@ -95,8 +87,8 @@ export default function TicketView({ticket_number, email}: {ticket_number: strin
- -
{JSON.stringify(ticket.access)}
+ + {/*
{JSON.stringify(ticket.access)}
*/}
{ticket.ticket_number} @@ -115,30 +107,44 @@ export default function TicketView({ticket_number, email}: {ticket_number: strin
- {ticket.history || ticket.transferred ?
-

History

+ {ticket.transferred ?
+

Transferred

- { ticket.transferred ?
+
- + -
: null} - - { ticket.history && ticket.history.map((record) => { - const transferred_at = record.date ? typeof record.date == 'string' ? Date.parse(record.date) : fromUnixTime(record.date) : false - console.log("TD:",record.date) - return ( -
- - - - - -
- ) - })} +
+
+
: null} + + {ticket.history ?
+

History

+
+ {ticket.history.map((record) => ( + (!record?.action && record?.ticket_number) ? ( + // transfered in record +
+ + + + + + + +
+ ) : ( + // normal history record +
+ + + + +
+ ) + ))}
: null }