Skip to content

Commit

Permalink
Merge pull request #112 from mokletdev/staging
Browse files Browse the repository at this point in the history
fix: Move mascot input to main dasboard
  • Loading branch information
teguhbayu committed Jun 14, 2024
2 parents e2bb724 + 8e97724 commit 8cd7e17
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 27 deletions.
Binary file added public/image/juri4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions src/actions/registrationForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,22 @@ export default async function submitFormRegistrasi(
const nama_rek = data.get("namarek") as string;
const tipe_pembayaran = data.get("tipe-pembayaran") as string;
const no_pelatih = data.get("no-pelatih") as string;
const maskot = data.get("no-maskot") as File;

const timCount = (await findTims({ jenjang: jenjang })).length;

if (timCount >= 30)
return { success: false, message: `Kuota jenjang ${jenjang} telah penuh!` };

try {
let maskotPic;
const tryUploadImage = await imageUploader(
Buffer.from(await bukti.arrayBuffer())
);
if (jenjang === "SMA")
maskotPic = await imageUploader(Buffer.from(await maskot.arrayBuffer()));
await createTim({
nama_tim,
asal_sekolah,
jenjang,
pelatih,
tipe_tim,
foto_mascot: maskotPic?.data?.url,
no_pelatih,
user: { connect: { id: userId } },
pembayaran: {
Expand Down
28 changes: 25 additions & 3 deletions src/app/(main)/components/Juri.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ const juris = [
name: "Peltu Herman Nurcahya",
title: "Juri",
},
{
image: "/image/juri4.png",
name: "Sersan Mayor Suroto",
title: "Juri",
},
];

interface JuriCardProps {
Expand Down Expand Up @@ -66,9 +71,26 @@ export default function Juri() {
</div>
<div className="relative flex justify-center items-center gap-28 lg:gap-4 flex-col lg:flex-row">
<div className="absolute w-full rounded-[30px] bg-white min-h-[293px] -top-14 hidden lg:block"></div>
<JuriCard image={juris[0].image} name={juris[0].name} title={juris[0].title} />
<JuriCard image={juris[1].image} name={juris[1].name} title={juris[1].title} />
<JuriCard image={juris[2].image} name={juris[2].name} title={juris[2].title} />
<JuriCard
image={juris[0].image}
name={juris[0].name}
title={juris[0].title}
/>
<JuriCard
image={juris[1].image}
name={juris[1].name}
title={juris[1].title}
/>
<JuriCard
image={juris[2].image}
name={juris[2].name}
title={juris[2].title}
/>
<JuriCard
image={juris[3].image}
name={juris[3].name}
title={juris[3].title}
/>
</div>
</div>
</SectionWrapper>
Expand Down
19 changes: 0 additions & 19 deletions src/app/(main)/form/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const paymentType = [

export default function FormComponent({ id }: { id: string }) {
const [isDP, setIsDP] = useState(false);
const [jenjangStatus, setJenjang] = useState("SMA" || "SMP");
const router = useRouter();

async function submitForm(data: FormData) {
Expand Down Expand Up @@ -91,7 +90,6 @@ export default function FormComponent({ id }: { id: string }) {
required
options={jenjang}
id="jenjang"
onChange={(e) => setJenjang(e?.value!)}
placeholder="Pilih Jenjang"
classNames={{
placeholder: () => "text-[#C8C8C8]",
Expand Down Expand Up @@ -136,23 +134,6 @@ export default function FormComponent({ id }: { id: string }) {
}}
/>
</div>
{jenjangStatus === "SMA" && (
<div className="flex flex-col gap-2">
<label htmlFor="maskot" className="text-[16px]">
Foto Maskot
</label>
<input
id="maskot"
type="file"
className="border border-neutral-200 py-4 px-3 rounded-xl file:bg-primary-500 file:text-white file:rounded-md file:border-none file:py-1 file:hover:bg-opacity-85 file:transition-all file:duration-300 hover:cursor-pointer file:hover:cursor-pointer"
title="Pilih foto maskot"
accept="image/*"
name="maskot"
placeholder="Pilih foto maskot"
required
/>
</div>
)}
<div className="flex flex-col gap-2">
<label htmlFor={"tipe"} className="text-[16px]">
Tipe Pembayaran
Expand Down

0 comments on commit 8cd7e17

Please sign in to comment.