add quantity to combobox

This commit is contained in:
2026-01-27 11:08:12 -03:00
parent 70ee7cf4f1
commit 1cc97576c8
3 changed files with 25 additions and 12 deletions

View File

@@ -90,15 +90,23 @@ export default function Route({ loaderData: { seats } }: Route.ComponentProps) {
() =>
Promise.resolve({
hits: Array.from(
new Map(
seats.map(({ course }) => [
course.id,
{
...course,
metadata__unit_price: 1
seats
.reduce((map, { course }) => {
const existing = map.get(course.id)
if (existing) {
existing.quantity += 1
} else {
map.set(course.id, {
...course,
metadata__unit_price: 1,
quantity: 1
})
}
]) ?? []
).values()
return map
}, new Map())
.values()
)
}),
[seats]