Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: added bedpress to lavterskelkalender along with some footer ref… #81

Merged
merged 1 commit into from
Sep 10, 2024
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
4 changes: 4 additions & 0 deletions frontend/src/app/for_studenten/arrangement/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ const ForStudentenPage = () => {
<div className="w-full flex flex-col items-center">
<div className="flex justify-start ">
<div className="flex gap-x-2 items-center px-4">
<div className="w-2 h-2 bg-green-500 rounded-full"></div>
<span className="text-sm lg:text-base">Bedpress</span>
<div className="w-2 h-2 bg-yellow-500 rounded-full"></div>
<span className="text-sm lg:text-base">
Offentlige arrangementer
Expand Down Expand Up @@ -409,6 +411,8 @@ const ForStudentenPage = () => {
return "bg-blue-500";
} else if (arrangement.type === "Eksternt arrangement") {
return "bg-red-500";
} else if (arrangement.type === "Bedpress") {
return "bg-green-500";
}
}
return "bg-yellow-500";
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/event/eventCalendarview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ const EventCalendarView: React.FC<EventCalendarViewProps> = ({
arrangementColor = "bg-blue-500";
} else if (arrangement.type === "Eksternt arrangement") {
arrangementColor = "bg-red-500";
} else if (arrangement.type === "Bedpress") {
arrangementColor = "bg-green-500";
}
}
if ("id" in arrangement) {
Expand Down
49 changes: 42 additions & 7 deletions frontend/src/components/footer/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ import { Hovedstyret } from "@/schemas/hovedstyret";
import Link from "next/link";
import { FC, useEffect, useState } from "react";
import { Clover } from "lucide-react";
import Modal from "../ui/modal";
import { Button } from "../ui/button";

interface dataProps {
message: string;
data: Samarbeidspartner[];
}

const Footer: FC = () => {
const [openModal, setOpenModal] = useState<boolean>(false);
const [logos, setLogos] = useState<Samarbeidspartner[]>([]);
const { data, loading, error } = useFetch<dataProps | null>(
"/api/samarbeidspartner",
Expand Down Expand Up @@ -50,6 +53,36 @@ const Footer: FC = () => {
setLeder(foundLeder);
}, [styret]);

const toggleModal = () => {
setOpenModal((prevState) => !prevState);
};

const firkloever = (
<>
<div className="w-full flex flex-col items-center justify-center gap-y-4 p-4 rounded-md border-2">
{/* Heading with centered text */}
<p className="w-[90%] text-center text-lg sm:text-base">
Til Emil med kjærlighet:
</p>
{/* Responsive list of names with flex-wrap for smaller screens */}
<p className="border-b-2 border-primary w-[90%] text-center"></p>
<p className="flex flex-wrap w-full justify-center gap-2 sm:gap-x-4 text-center">
<span>Nicolai Faye</span>
<span>|</span>
<span>Maria Wembstad</span>
<span>|</span>
<span>Emil Lunde Bakke</span>
<span>|</span>
<span>Mauritz Skogøy</span>
</p>
{/* Button with margin for spacing */}
<div className="mt-4">
<Button onClick={toggleModal}>Lukk</Button>
</div>
</div>
</>
);

return (
<footer>
<div className="flex flex-col md:flex-row lg:flex-row justify-between bg-[#001D21] text-white px-10 font-bold py-5">
Expand All @@ -65,6 +98,9 @@ const Footer: FC = () => {
2, 7034 Trondheim. Org.nr. 991 212 736
</p>
<p className="mt-4">Foreningen for Studentene ved Emil © 2024</p>
<p className="text-[11px]">
Ved bugs ta kontakt med: [email protected]
</p>
</div>
</div>

Expand Down Expand Up @@ -197,13 +233,12 @@ const Footer: FC = () => {
</div>
</div>

<div className="flex max-w-screen items-center justify-center bg-[#001D21] py-2">
<Clover className="text-white clover-hover" />
{/* <img
src="/svg/Three clover.svg"
alt="Trekløver"
className="h-4 w-4 icon-hover"
/> */}
<div className="flex max-w-screen items-center justify-center bg-[#001D21] p-2">
<Clover
onClick={toggleModal}
className="text-white clover-hover w-4 h-4 cursor-pointer"
/>
{openModal ? <Modal isOpen={openModal} children={firkloever} /> : null}
</div>
</footer>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ const LavterskelArrangementForm = ({
<option value="Eksternt arrangement">
Eksternt arrangement
</option>
<option value="Bedpress">Bedpress</option>
</select>
</div>

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/ui/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Modal = ({ isOpen, children }: ModalProps) => {

return (
<div className="fixed inset-0 bg-opacity-30 flex items-center h-full w-full z-50 justify-center">
<div className="bg-white text-primary rounded-lg shadow-lg px-3 py-6 w-full max-w-[90%] lg:max-w-[60%] max-h-[80vh] overflow-y-auto">
<div className="bg-white text-primary rounded-lg shadow-lg px-3 py-3 w-full max-w-[90%] lg:max-w-[60%] max-h-[80vh] overflow-y-auto">
<div className="break-words">{children}</div>
</div>
</div>
Expand Down
71 changes: 42 additions & 29 deletions frontend/src/components/user/kontigent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use client';
"use client";

import { getUserByEmail } from "@/data/user";
import { useCurrentUser } from "@/hooks/use-current-user";
Expand All @@ -12,17 +12,16 @@ import { getKontigent } from "@/utils/actions/getkontigent";
import { kontigentPris } from "@/schemas/kontigentPris";

enum kontigenStatus {
AVVENTER_BEKREFTELSE = 'AVVENTER_BEKREFTELSE',
UBETALT = 'UBETALT',
BETALT = 'BETALT',
AVVENTER_BEKREFTELSE = "AVVENTER_BEKREFTELSE",
UBETALT = "UBETALT",
BETALT = "BETALT",
}


const KontigentView = () => {
const user = useCurrentUser();
const [status, setStatus] = useState<string | null>(null);
const [newStatus, setNewStatus] = useState<kontigenStatus | null>(null);
const [kontigentpris,setKontigentpris] = useState<kontigentPris>()
const [kontigentpris, setKontigentpris] = useState<kontigentPris>();

useEffect(() => {
const fetchAndSetUser = async () => {
Expand All @@ -32,7 +31,7 @@ const KontigentView = () => {
const fetchedKontigentPris = await getKontigent();
console.log(fetchedKontigentPris);
if (fetchedKontigentPris.success && fetchedKontigentPris.data) {
setKontigentpris(fetchedKontigentPris.data[0]);
setKontigentpris(fetchedKontigentPris.data[0]);
}
if (fetchedUser) {
setStatus(fetchedUser.kontigent);
Expand All @@ -57,7 +56,7 @@ const KontigentView = () => {
if (newStatus && user?.email && status === kontigenStatus.UBETALT) {
try {
const result = await updateKontigent(user.email, {
kontigent:newStatus,
kontigent: newStatus,
});
if (result.success) {
setStatus(newStatus);
Expand All @@ -74,54 +73,68 @@ const KontigentView = () => {
<div className="w-full flex items-center justify-center">
<div className="w-full rounded-md bg-[#225654] px-4 py-8">
<p>
I hendhold til vedtektene skal alle som ønsker å være medlem i emil betale en medlemskontigent.
<br />
<br />
Denne kontigenten kan i følge vedtektene vedtatt på generalforsamling variere avhengig av økonomien til linjeforeningen.
Kontigenten er et engangsbeløp og har historisk ligget på mellom 25,- og 50,- NOK, og må betales for å kunne delta i linjeforeningen.
For <span className="underline">{kontigentpris?.aar}</span > ligger beløpet på <span className="underline">{kontigentpris?.pris}</span>,- NOK.
I hendhold til vedtektene skal alle som ønsker å være medlem i emil
betale en medlemskontigent.
<br />
<br />
Denne kontigenten kan i følge vedtektene vedtatt på
generalforsamling variere avhengig av økonomien til linjeforeningen.
Kontigenten er et engangsbeløp, og må betales for å kunne delta i
linjeforeningen. For{" "}
<span className="underline">{kontigentpris?.aar}</span> ligger
beløpet på <span className="underline">{kontigentpris?.pris}</span>
,- NOK.
</p>
<br />
<p>
Beløpet kan vippses til <span className="text-[#9DDBAD] underline">11101</span> eller så kan man kontakte fut for alternative betalingsmetoder.
Etter du har betalt kontigent kan status under settes til AVVENTER_BEKREFTELSE før styret vil bekrefte at kontigent har blitt betalt og status blir BETALT.
Beløpet kan vippses til{" "}
<span className="text-[#9DDBAD] underline">11101</span> eller så kan
man kontakte fut for alternative betalingsmetoder. Etter du har
betalt kontigent kan status under settes til AVVENTER_BEKREFTELSE
før styret vil bekrefte at kontigent har blitt betalt og status blir
BETALT.
</p>
</div>
</div>

{/* Display status */}
<div className="w-full mt-6 text-center">
<p>Din nåværende kontigentstatus: <strong>{status===Kontigent.BETALT?(
<span className="text-[#9DDBAD]">{status}</span>
):(
<span>{status}</span>
)}</strong></p>
<p>
Din nåværende kontigentstatus:{" "}
<strong>
{status === Kontigent.BETALT ? (
<span className="text-[#9DDBAD]">{status}</span>
) : (
<span>{status}</span>
)}
</strong>
</p>
</div>

{/* Conditionally render the form if status is UBETALT */}
{status === kontigenStatus.UBETALT && (
<div className="w-full mt-4 flex flex-col items-center justify-center">
<form onSubmit={handleSubmit} className="flex flex-col justify-center gap-y-4 lg:flex-row lg:space-x-4">
<form
onSubmit={handleSubmit}
className="flex flex-col justify-center gap-y-4 lg:flex-row lg:space-x-4"
>
<select
id="status"
name="status"
value={newStatus || ''}
value={newStatus || ""}
onChange={(e) => setNewStatus(e.target.value as kontigenStatus)}
className="border-gray-300 text-primary rounded-md shadow-sm"
>
<option value="">Status</option>
<option value={kontigenStatus.AVVENTER_BEKREFTELSE}>
{kontigenStatus.AVVENTER_BEKREFTELSE}
{kontigenStatus.AVVENTER_BEKREFTELSE}
</option>
<option value={kontigenStatus.UBETALT}>
{kontigenStatus.UBETALT}
{kontigenStatus.UBETALT}
</option>
</select>

<Button
type="submit">
Oppdater status
</Button>
<Button type="submit">Oppdater status</Button>
</form>
</div>
)}
Expand Down