-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-Authored-By: Bloxs <[email protected]>
- Loading branch information
1 parent
a080d7a
commit 7ef69c1
Showing
8 changed files
with
175 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Field, Ticket } from "@/utils/db/kv.types.ts"; | ||
|
||
export default function ExportTicketData({ | ||
tickets, | ||
fields, | ||
}: { | ||
tickets: [string, Ticket][]; | ||
fields: Field[]; | ||
}) { | ||
const exportTickets = (showtime?: string) => { | ||
const filteredTickets = tickets.filter(([showtimeID]) => | ||
showtime == undefined || showtimeID === showtime | ||
); | ||
|
||
// Use “ in replacement for " to avoid breaking csv | ||
|
||
const data = [ | ||
`"Showtime ID","Ticket ID","Email","Last Name","First Name","Acquired Tickets","Ticket Uses"${ | ||
fields.length > 0 | ||
? `,"${fields.map((f) => `"${f.name.replace(/"/g, "“")}"`).join(",")}` | ||
: "" | ||
}`, | ||
]; | ||
}; | ||
|
||
return ( | ||
<> | ||
<button type="button">Exeporte zee tix</button> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import Dropdown from "@/islands/components/pickers/dropdown.tsx"; | ||
import DotsVertical from "$tabler/dots-vertical.tsx"; | ||
import { Ticket, Field } from "@/utils/db/kv.types.ts"; | ||
|
||
export default function TicketDropdown({ | ||
ticketID, | ||
key, | ||
value, | ||
fields, | ||
}: { | ||
ticketID: string; | ||
key: string; | ||
value: Ticket; | ||
fields: Field[]; | ||
}) { | ||
return ( | ||
<Dropdown | ||
options={[ | ||
{ | ||
content: "See Ticket", | ||
link: `./tickets/${ticketID}?s=${key}`, | ||
}, | ||
{ | ||
content: "Delete Ticket", | ||
}, | ||
{ | ||
content: "View Additional Responses", | ||
onClick: () => { | ||
const formattedObject: { | ||
type: string; | ||
prompt: string; | ||
value: unknown; | ||
}[] = []; | ||
|
||
for (const field of fields) { | ||
const object: { | ||
type: string; | ||
prompt: string; | ||
value: unknown; | ||
} = { | ||
type: field.type, | ||
prompt: field.name, | ||
value: undefined, | ||
}; | ||
|
||
for (const response of value.fieldData) { | ||
if (response.id === field.id) { | ||
object.value = response.value; | ||
break; | ||
} | ||
} | ||
|
||
formattedObject.push(object); | ||
} | ||
|
||
console.log(formattedObject); | ||
}, | ||
}, | ||
]} | ||
> | ||
<div | ||
className={`w-8 grid place-items-center border h-8 rounded-md hover:bg-gray-200 transition`} | ||
> | ||
<DotsVertical class="h-5 w-5" /> | ||
</div> | ||
</Dropdown> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters