Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/img/historia/pg2026.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 24 additions & 6 deletions src/components/Company/Admin/ExtraOrderPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export function ExtraOrderPanel({
const [extras, setExtras] = useState<[ExhibitorExtras, ExhibitorExtras]>();
const router = useRouter();
const login = api.admin.login.useMutation();
const activeExhibitorIds = new Set(exhibitors.map((exhibitor) => exhibitor.id));
const visiblePendingExtraOrders = pendingExtraOrders.filter((request) =>
activeExhibitorIds.has(request.exhibitor_id)
);

useEffect(() => {
let exhibitorPackage = {
Expand Down Expand Up @@ -113,10 +117,24 @@ export function ExtraOrderPanel({
extras.banquetTicket += extraBanquetPreferences.length;
});

extras.tables = acceptedExtraOrders.tables;
extras.chairs = acceptedExtraOrders.chairs;
extras.drinkCoupons += acceptedExtraOrders.drinkCoupons * 3;
extras.alcFreeTicket += acceptedExtraOrders.alcFreeTicket * 3;
const activeAcceptedExtraOrders = exhibitors.reduce(
(totals, exhibitor) => {
const accepted = acceptedExtraOrders.byExhibitor?.[exhibitor.id];
if (!accepted) return totals;

totals.tables += accepted.tables;
totals.chairs += accepted.chairs;
totals.drinkCoupons += accepted.drinkCoupons;
totals.alcFreeTicket += accepted.alcFreeTicket;
return totals;
},
{ tables: 0, chairs: 0, drinkCoupons: 0, alcFreeTicket: 0 }
);

extras.tables = activeAcceptedExtraOrders.tables;
extras.chairs = activeAcceptedExtraOrders.chairs;
extras.drinkCoupons += activeAcceptedExtraOrders.drinkCoupons * 3;
extras.alcFreeTicket += activeAcceptedExtraOrders.alcFreeTicket * 3;

setExtras([exhibitorPackage, extras]);
}, [acceptedExtraOrders, exhibitors, preferences, t]);
Expand Down Expand Up @@ -260,11 +278,11 @@ export function ExtraOrderPanel({
</tr>
</thead>
<tbody className="[&>tr>td]:border-2 [&>tr>td]:border-t-2 [&>tr>td]:border-solid [&>tr>td]:border-cerise [&>tr>td]:p-4">
{pendingExtraOrders.length === 0 ? (
{visiblePendingExtraOrders.length === 0 ? (
<tr>
<td colSpan={7} className="text-center">{t.admin.extraOrders.sections.pending.empty}</td>
</tr>
) : pendingExtraOrders.map((request) => {
) : visiblePendingExtraOrders.map((request) => {
const itemName = t.admin.extraOrders.itemNames[request.item.type as keyof typeof t.admin.extraOrders.itemNames];
const details = [
request.item.ticket_name,
Expand Down
24 changes: 13 additions & 11 deletions src/shared/exhibitorLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,19 @@ export default function ExhibitorLayout({
</h1>
</div>
<div className="flex flex-row items-center gap-4 mb-2">
<Link href="/admin/sales">
<button
className={cn(
"bg-transparent border-[1px] border-white rounded-full text-center hover:scale-105 transition-transform text-white uppercase",
"py-1.5 px-3 text-sm",
"sm:py-2.5 sm:px-4 sm:text-base"
)}
>
Admin
</button>
</Link>
{isAdmin &&
<Link href="/admin/sales">
<button
className={cn(
"bg-transparent border-[1px] border-white rounded-full text-center hover:scale-105 transition-transform text-white uppercase",
"py-1.5 px-3 text-sm",
"sm:py-2.5 sm:px-4 sm:text-base"
)}
>
Admin
</button>
</Link>
}
<button
className={cn(
"bg-transparent border-[1px] border-white rounded-full text-center hover:scale-105 transition-transform text-white uppercase",
Expand Down
11 changes: 8 additions & 3 deletions src/utils/openid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,20 @@ let oidcConfig: Awaited<ReturnType<typeof client.discovery>> | null = null;

async function getOidcConfig() {
if (!oidcConfig) {
console.log(process.env.OIDC_PROVIDER);
console.log(process.env.OIDC_ID);
console.log(process.env.OIDC_SECRET);

oidcConfig = await client.discovery(
new URL(process.env.OIDC_PROVIDER || "localhost:7003"),
process.env.OIDC_ID || "client-id",
process.env.OIDC_SECRET || "client-secret", // metadata
undefined, // clientAuthentication
// {
// execute: [client.allowInsecureRequests], // TODO: DON'T FORGET TO REMOVE THIS
// }
{
execute: [client.allowInsecureRequests], // TODO: DON'T FORGET TO REMOVE THIS
}
)

}

return oidcConfig;
Expand Down
Loading