This commit is contained in:
Sabda Yagra 2025-09-30 13:57:54 +07:00
commit 5437b1d186
5 changed files with 393 additions and 26 deletions

View File

@ -63,6 +63,19 @@ export default function SignUp() {
const [certNumber, setCertNumber] = useState(""); const [certNumber, setCertNumber] = useState("");
const [membershipType, setMembershipType] = useState(""); const [membershipType, setMembershipType] = useState("");
const [nrp, setNrp] = useState(""); const [nrp, setNrp] = useState("");
const [firstName, setFirstName] = useState("");
const [lastName, setLastName] = useState("");
const [whatsapp, setWhatsapp] = useState("");
const [namaTenant, setNamaTenant] = useState("");
const [tenantPassword, setTenantPassword] = useState("");
const [confirmTenantPassword, setConfirmTenantPassword] = useState("");
const [firstNameKontributor, setFirstNameKontributor] = useState("");
const [lastNameKontributor, setLastNameKontributor] = useState("");
const [whatsappKontributor, setWhatsappKontributor] = useState("");
const [namaPerusahaan, setNamaPerusahaan] = useState("");
const [kategoriPerusahaan, setKategoriPerusahaan] = useState("");
const [kontributorPassword, setKontributorPassword] = useState("");
const [confirmKontributorPassword, setConfirmKontributorPassword] = useState("");
const handleSendOtp = (e: React.FormEvent) => { const handleSendOtp = (e: React.FormEvent) => {
e.preventDefault(); e.preventDefault();
@ -133,7 +146,7 @@ export default function SignUp() {
{step === "login" ? ( {step === "login" ? (
<form <form
onSubmit={handleSendOtp} onSubmit={handleSendOtp}
className="w-full max-w-sm p-6 ml-0 md:ml-5" className="w-full max-w-lg p-6 ml-0 md:ml-5"
> >
{/* Radio Buttons */} {/* Radio Buttons */}
<RadioGroup <RadioGroup
@ -150,12 +163,12 @@ export default function SignUp() {
<Label htmlFor="jurnalis">Jurnalis</Label> <Label htmlFor="jurnalis">Jurnalis</Label>
</div> </div>
<div className="flex items-center space-x-2"> <div className="flex items-center space-x-2">
<RadioGroupItem value="polri" id="polri" /> <RadioGroupItem value="kontributor" id="kontributor" />
<Label htmlFor="polri">POLRI</Label> <Label htmlFor="kontributor">Kontributor</Label>
</div> </div>
<div className="flex items-center space-x-2"> <div className="flex items-center space-x-2">
<RadioGroupItem value="kpu" id="kpu" /> <RadioGroupItem value="tenant" id="tenant" />
<Label htmlFor="kpu">KPU</Label> <Label htmlFor="tenant">Tenant</Label>
</div> </div>
</RadioGroup> </RadioGroup>
@ -193,28 +206,219 @@ export default function SignUp() {
</div> </div>
)} )}
{/* Polri: NRP */} {/* Kontributor: Form Fields */}
{role === "polri" && ( {role === "kontributor" && (
<div className="mb-4"> <div className="mb-4 space-y-4">
<div className="grid grid-cols-2 gap-4">
<Input
type="text"
required
placeholder="First Name"
value={firstNameKontributor}
onChange={(e) => setFirstNameKontributor(e.target.value)}
/>
<Input
type="text"
required
placeholder="Last Name"
value={lastNameKontributor}
onChange={(e) => setLastNameKontributor(e.target.value)}
/>
</div>
<Input
type="email"
required
placeholder="Email"
value={email}
onChange={(e) => setEmail(e.target.value)}
/>
<Input
type="tel"
required
placeholder="WhatsApp"
value={whatsappKontributor}
onChange={(e) => setWhatsappKontributor(e.target.value)}
/>
<Input <Input
type="text" type="text"
required required
placeholder="NRP (Nomor Registrasi POLRI)" placeholder="Nama Perusahaan"
value={nrp} value={namaPerusahaan}
onChange={(e) => setNrp(e.target.value)} onChange={(e) => setNamaPerusahaan(e.target.value)}
/> />
<select
required
className="w-full border border-gray-300 rounded-md p-2 text-sm"
value={kategoriPerusahaan}
onChange={(e) => setKategoriPerusahaan(e.target.value)}
>
<option value="">Pilih Kategori Perusahaan</option>
<option value="kementerian">Kementerian</option>
<option value="lembaga">Lembaga</option>
<option value="pemerintah-daerah">Pemerintah Daerah</option>
<option value="bumn">BUMN</option>
<option value="lainnya">Lainnya</option>
</select>
<div className="relative">
<Input
type={isVisible ? "text" : "password"}
required
placeholder="Password"
value={kontributorPassword}
onChange={(e) => setKontributorPassword(e.target.value)}
className="pr-10"
/>
<button
type="button"
onClick={toggleVisibility}
className="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 hover:text-gray-700"
>
{isVisible ? (
<EyeSlashFilledIcon className="h-4 w-4" />
) : (
<EyeFilledIcon className="h-4 w-4" />
)}
</button>
</div>
<div className="relative">
<Input
type={isVisibleSetup[1] ? "text" : "password"}
required
placeholder="Konfirmasi Password"
value={confirmKontributorPassword}
onChange={(e) => setConfirmKontributorPassword(e.target.value)}
className="pr-10"
/>
<button
type="button"
onClick={() => {
const newVisibility = [...isVisibleSetup];
newVisibility[1] = !newVisibility[1];
setIsVisibleSetup(newVisibility);
}}
className="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 hover:text-gray-700"
>
{isVisibleSetup[1] ? (
<EyeSlashFilledIcon className="h-4 w-4" />
) : (
<EyeFilledIcon className="h-4 w-4" />
)}
</button>
</div>
</div>
)}
{/* Tenant: Form Fields */}
{role === "tenant" && (
<div className="mb-4 space-y-4">
<div className="grid grid-cols-2 gap-4">
<Input
type="text"
required
placeholder="First Name"
value={firstName}
onChange={(e) => setFirstName(e.target.value)}
/>
<Input
type="text"
required
placeholder="Last Name"
value={lastName}
onChange={(e) => setLastName(e.target.value)}
/>
</div>
<Input
type="email"
required
placeholder="Email"
value={email}
onChange={(e) => setEmail(e.target.value)}
/>
<Input
type="tel"
required
placeholder="WhatsApp"
value={whatsapp}
onChange={(e) => setWhatsapp(e.target.value)}
/>
<Input
type="text"
required
placeholder="Nama Tenant"
value={namaTenant}
onChange={(e) => setNamaTenant(e.target.value)}
/>
<div className="relative">
<Input
type={isVisible ? "text" : "password"}
required
placeholder="Password"
value={tenantPassword}
onChange={(e) => setTenantPassword(e.target.value)}
className="pr-10"
/>
<button
type="button"
onClick={toggleVisibility}
className="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 hover:text-gray-700"
>
{isVisible ? (
<EyeSlashFilledIcon className="h-4 w-4" />
) : (
<EyeFilledIcon className="h-4 w-4" />
)}
</button>
</div>
<div className="relative">
<Input
type={isVisibleSetup[1] ? "text" : "password"}
required
placeholder="Konfirmasi Password"
value={confirmTenantPassword}
onChange={(e) => setConfirmTenantPassword(e.target.value)}
className="pr-10"
/>
<button
type="button"
onClick={() => {
const newVisibility = [...isVisibleSetup];
newVisibility[1] = !newVisibility[1];
setIsVisibleSetup(newVisibility);
}}
className="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 hover:text-gray-700"
>
{isVisibleSetup[1] ? (
<EyeSlashFilledIcon className="h-4 w-4" />
) : (
<EyeFilledIcon className="h-4 w-4" />
)}
</button>
</div>
</div> </div>
)} )}
{/* Email Field (Selalu Ada, tapi posisi bergantung role) */} {/* Email Field (Selalu Ada, tapi posisi bergantung role) */}
<Input {role !== "tenant" && role !== "kontributor" && (
type="email" <Input
required type="email"
placeholder="Email" required
className="mb-4" placeholder="Email"
value={email} className="mb-4"
onChange={(e) => setEmail(e.target.value)} value={email}
/> onChange={(e) => setEmail(e.target.value)}
/>
)}
{/* Note */} {/* Note */}
<p className="text-xs text-gray-500 mb-4"> <p className="text-xs text-gray-500 mb-4">

View File

@ -71,16 +71,10 @@
// export default bundleAnalyzer(withNextIntl(withNextra(nextConfig))); // export default bundleAnalyzer(withNextIntl(withNextra(nextConfig)));
import createNextIntlPlugin from "next-intl/plugin"; import createNextIntlPlugin from "next-intl/plugin";
import nextra from "nextra";
import withBundleAnalyzer from "@next/bundle-analyzer"; import withBundleAnalyzer from "@next/bundle-analyzer";
const withNextIntl = createNextIntlPlugin(); const withNextIntl = createNextIntlPlugin();
const withNextra = nextra({
theme: "nextra-theme-docs",
themeConfig: "./theme.config.tsx", // cukup relative path
});
const bundleAnalyzer = withBundleAnalyzer({ const bundleAnalyzer = withBundleAnalyzer({
enabled: process.env.ANALYZE === "true", enabled: process.env.ANALYZE === "true",
}); });
@ -108,4 +102,4 @@ const nextConfig = {
}, },
}; };
export default bundleAnalyzer(withNextIntl(withNextra(nextConfig))); export default bundleAnalyzer(withNextIntl(nextConfig));

View File

@ -0,0 +1,99 @@
import {
httpDeleteInterceptor,
httpGetInterceptor,
httpPostInterceptor,
} from "../http-config/http-interceptor-service";
export async function getAgendaSettingsById(id: any) {
const url = `agenda-settings?id=${id}`;
return httpGetInterceptor(url);
}
export async function getAgendaSettingsList(year = "", month = "", type = "") {
const url = `agenda-settings/list?year=${year}&month=${month}&type=${type}`;
return httpGetInterceptor(url);
}
export async function saveAgendaSettings(data: any) {
const url = `agenda-settings`;
return httpPostInterceptor(url, data);
}
export async function publishAgendaSettings(id: any) {
const url = `agenda-settings/publish?id=${id}`;
return httpPostInterceptor(url);
}
export async function getPlanningDailyByTypeId(
page: number,
size = 10,
parentId: any,
date: string,
typeId: number
) {
const url = `planning/pagination/daily?enablePage=1&time=1&size=${size}&page=${page}&date=${date}&typeId=${typeId}${
parentId ? `&parentId=${parentId}` : ""
}`;
return httpGetInterceptor(url);
}
export async function getMonthlyPlanList(dates: any, typeId: number) {
const url = `planning/monthly/list?date=${dates}&typeId=${typeId}`;
return httpGetInterceptor(url);
}
export async function getWeeklyPlanList(
dates: number | undefined,
typeId: number,
isMonthly = false
) {
const url = `planning/weekly/list?date=${dates}&typeId=${typeId}&isMonthly=${isMonthly}`;
return httpGetInterceptor(url);
}
export async function getWeeklyPlanListByParentId(id: string, typeId: number) {
const url = `planning/weekly/list?parentId=${id}&typeId=${typeId}`;
return httpGetInterceptor(url);
}
export async function getPlanningPagination(
page: number,
title = "",
size = 10,
typeId: number,
time: number,
parentId = ""
) {
const url = `planning/pagination?enablePage=1&size=${size}&page=${page}&title=${title}&typeId=${typeId}&time=${time}&parentId=${parentId}`;
return httpGetInterceptor(url);
}
export async function savePlanning(data: any) {
const url = "planning";
return httpPostInterceptor(url, data);
}
export async function getPlanningMonthlyPerSocmed(
month = "",
year = "",
typeId: number,
parentId = ""
) {
const url = `planning/socmed/monthly?month=${month}&year=${year}&typeId=${typeId}&parentId=${parentId}`;
return httpGetInterceptor(url);
}
export async function getPlanningDailyMedsosByPlatform(
page: string,
size = 10,
date: string,
platformTypeId: string
) {
const url = `planning/pagination/daily?enablePage=1&size=${size}&page=${page}&date=${date}&typeId=2&platformTypeId=${platformTypeId}`;
return httpGetInterceptor(url);
}
export async function deleteAgendaSettings(id: any) {
const url = `agenda-settings?id=${id}`;
return httpDeleteInterceptor(url);
}

View File

@ -0,0 +1,48 @@
import {
httpGetInterceptor,
httpPostInterceptor,
} from "../http-config/http-interceptor-service";
export async function getMediaTrackingMonitoring(page: number, size: number) {
const url = `cekmedsos/monitoring/pagination?page=${page}&size=${size}`;
return httpGetInterceptor(url);
}
export async function sendMediaUploadToEmail(data: any) {
const url = "media/public/share-to-email";
return httpPostInterceptor(url, data);
}
export async function mediaTrackingSave(data: any) {
const url = `/media/tracking/monitoring`;
return httpPostInterceptor(url, data);
}
export async function getMediaTracking(
page: any,
title: string = "",
size: any
) {
return httpGetInterceptor(
`/media/tracking/monitoring/pagination?enablePagination=1&size=${size}&page=${page}&title=${title}`
);
}
export async function getMediaTrackingResult(data: any) {
const url = `/media/tracking/monitoring/results/pagination?trackingId=${
data.id || ""
}`;
return httpGetInterceptor(url);
}
export async function listDataTracking(size: any, page: any) {
return await httpGetInterceptor(
`media/public/list?enablePage=1&sort=desc&size=${size}&page=${page}`
);
}
export async function listDataAllNonPagination(search: string) {
return await httpGetInterceptor(
`media/public/list?enablePage=0&sort=desc&title=${search || ""}`
);
}

View File

@ -0,0 +1,22 @@
import { httpGetInterceptor, httpPostInterceptor } from "../http-config/http-interceptor-service";
export async function getPlanningSentPagination(
size: number,
page: number,
typeId: number,
title: string = ""
) {
return await httpGetInterceptor(
`planning/pagination/sent?enablePage=1&size=${size}&page=${page}&typeId=${typeId}&title=${title}`
);
}
export async function getPlanningById(id: any) {
const url = `planning?id=${id}`;
return httpGetInterceptor(url);
}
export async function publishPlanning(data: any) {
const url = "planning/publish";
return httpPostInterceptor(url, data);
}