fix: fixed registration section

This commit is contained in:
sabdayagra 2025-01-13 22:12:28 +07:00
commit 43a1c59f71
12 changed files with 433 additions and 312 deletions

View File

@ -37,6 +37,8 @@ import { useDropzone } from "react-dropzone";
import { CloudUpload } from "lucide-react";
import Image from "next/image";
import { Upload } from "tus-js-client";
import { getCookiesDecrypt } from "@/lib/utils";
import Cookies from "js-cookie";
const FormSchema = z.object({
title: z.string({
@ -103,6 +105,10 @@ const publishToList = [
export default function CreateCategoryModal() {
const router = useRouter();
const { toast } = useToast();
const roleId = getCookiesDecrypt("urie");
const levelNumber = getCookiesDecrypt("ulne");
const userLevelId = getCookiesDecrypt("ulie");
const poldaState = Cookies.get("state");
const [files, setFiles] = useState<File[]>([]);
const [isOpen, setIsOpen] = useState(false);
@ -139,6 +145,14 @@ export default function CreateCategoryModal() {
useEffect(() => {
getRoles();
if (Number(levelNumber) === 2) {
form.setValue("publishTo", ["polda"]);
setUnitData([String(userLevelId)]);
}
if (Number(levelNumber) === 3) {
form.setValue("publishTo", ["satker"]);
setSatkerData([String(userLevelId)]);
}
}, []);
async function getRoles() {
@ -196,6 +210,10 @@ export default function CreateCategoryModal() {
formMedia.append("file", files[0]);
formMedia.append("publishedLocation", data.publishTo.sort().join(","));
formMedia.append("publishedLocationLevel", join);
formMedia.append(
"isInt",
data.publishTo.includes("internasional") ? "true" : "false"
);
const response = await postCategory(formMedia);
close();
@ -374,94 +392,117 @@ export default function CreateCategoryModal() {
</FormItem>
)}
/>
<FormField
control={form.control}
name="publishTo"
render={() => (
<FormItem>
<FormLabel>Wilayah Publish</FormLabel>
{Number(levelNumber) === 1 ? (
<FormField
control={form.control}
name="publishTo"
render={() => (
<FormItem>
<FormLabel>Wilayah Publish</FormLabel>
<div className="flex flex-row items-center gap-2">
<div className="flex gap-3 items-center">
<Checkbox
id="all"
checked={isAllTargetChecked}
onCheckedChange={(checked) => {
if (checked) {
form.setValue(
"publishTo",
publishToList.map((item) => item.id)
);
} else {
form.setValue("publishTo", []);
}
}}
/>
<label htmlFor="all" className="text-sm">
Semua
</label>
</div>
{publishToList.map((item) => (
<>
<FormField
key={item.id}
control={form.control}
name="publishTo"
render={({ field }) => {
return (
<FormItem
key={item.id}
className="flex flex-row items-start "
>
<div className="flex items-center gap-3">
<FormControl>
<Checkbox
checked={field.value?.includes(item.id)}
onCheckedChange={(checked) => {
return checked
? field.onChange([
...field.value,
item.id,
])
: field.onChange(
field.value?.filter(
(value) => value !== item.id
)
);
}}
/>
</FormControl>
<FormLabel className="font-normal">
{item.name}{" "}
</FormLabel>
</div>
</FormItem>
);
<div className="flex flex-row items-center gap-2">
<div className="flex gap-3 items-center">
<Checkbox
id="all"
checked={isAllTargetChecked}
onCheckedChange={(checked) => {
if (checked) {
form.setValue(
"publishTo",
publishToList.map((item) => item.id)
);
} else {
form.setValue("publishTo", []);
}
}}
/>
{item.id === "polda" &&
form.getValues("publishTo")?.includes(item.id) && (
<UnitMapping
unit="Polda"
isDetail={false}
sendDataToParent={(data) => setUnitData(data)}
/>
)}
{item.id === "satker" &&
form.getValues("publishTo")?.includes(item.id) && (
<UnitMapping
isDetail={false}
unit="Satker"
sendDataToParent={(data) => setSatkerData(data)}
/>
)}
</>
))}
</div>
<FormMessage />
</FormItem>
)}
/>
<label htmlFor="all" className="text-sm">
Semua
</label>
</div>
{publishToList.map((item) => (
<>
<FormField
key={item.id}
control={form.control}
name="publishTo"
render={({ field }) => {
return (
<FormItem
key={item.id}
className="flex flex-row items-start "
>
<div className="flex items-center gap-3">
<FormControl>
<Checkbox
checked={field.value?.includes(item.id)}
onCheckedChange={(checked) => {
return checked
? field.onChange([
...field.value,
item.id,
])
: field.onChange(
field.value?.filter(
(value) => value !== item.id
)
);
}}
/>
</FormControl>
<FormLabel className="font-normal">
{item.name}{" "}
</FormLabel>
</div>
</FormItem>
);
}}
/>
{item.id === "polda" &&
form.getValues("publishTo")?.includes(item.id) && (
<UnitMapping
unit="Polda"
isDetail={false}
sendDataToParent={(data) => setUnitData(data)}
/>
)}
{item.id === "satker" &&
form.getValues("publishTo")?.includes(item.id) && (
<UnitMapping
isDetail={false}
unit="Satker"
sendDataToParent={(data) => setSatkerData(data)}
/>
)}
</>
))}
</div>
<FormMessage />
</FormItem>
)}
/>
) : (
<FormField
control={form.control}
name="publishTo"
render={() => (
<FormItem>
<FormLabel>Wilayah Publish</FormLabel>
<div className="flex flex-row items-center gap-2">
<div className="flex gap-3 items-center">
<Checkbox disabled checked />
<label htmlFor="all" className="text-sm">
{poldaState}
</label>
</div>
</div>
<FormMessage />
</FormItem>
)}
/>
)}
<FormField
control={form.control}
name="title"

View File

@ -38,6 +38,9 @@ import { UnitMapping } from "./unit-mapping";
import { useDropzone } from "react-dropzone";
import { CloudUpload } from "lucide-react";
import { useToast } from "@/components/ui/use-toast";
import Cookies from "js-cookie";
import { getCookiesDecrypt } from "@/lib/utils";
const FormSchema = z.object({
title: z.string({
required_error: "Required",
@ -112,7 +115,10 @@ export default function EditCategoryModal(props: {
const [files, setFiles] = useState<File[]>([]);
const [isOpen, setIsOpen] = useState(false);
const { toast } = useToast();
const roleId = getCookiesDecrypt("urie");
const levelNumber = getCookiesDecrypt("ulne");
const userLevelId = getCookiesDecrypt("ulie");
const poldaState = Cookies.get("state");
const router = useRouter();
const [satkerData, setSatkerData] = useState<string[]>([]);
const [unitData, setUnitData] = useState<string[]>([]);
@ -344,7 +350,6 @@ export default function EditCategoryModal(props: {
</FormItem>
)}
/>
<FormField
control={form.control}
name="selectedUser"
@ -417,98 +422,122 @@ export default function EditCategoryModal(props: {
</FormItem>
)}
/>
<FormField
control={form.control}
name="publishTo"
render={() => (
<FormItem>
<FormLabel>Wilayah Publish</FormLabel>
<div className="flex flex-row items-center gap-2">
<div className="flex gap-3 items-center">
<Checkbox
id="all"
checked={isAllTargetChecked}
disabled={isDetail}
onCheckedChange={(checked) => {
if (checked) {
form.setValue(
"publishTo",
publishToList.map((item) => item.id)
);
} else {
form.setValue("publishTo", []);
}
}}
/>
<label htmlFor="all" className="text-sm">
Semua
</label>
</div>
{publishToList.map((item) => (
<>
<FormField
key={item.id}
control={form.control}
name="publishTo"
render={({ field }) => {
return (
<FormItem
key={item.id}
className="flex flex-row items-start "
>
<div className="flex items-center gap-3">
<FormControl>
<Checkbox
disabled={isDetail}
checked={field.value?.includes(item.id)}
onCheckedChange={(checked) => {
return checked
? field.onChange([
...field.value,
item.id,
])
: field.onChange(
field.value?.filter(
(value) => value !== item.id
)
);
}}
/>
</FormControl>
<FormLabel className="font-normal">
{item.name}{" "}
</FormLabel>
</div>
</FormItem>
);
{Number(levelNumber) === 1 ? (
<FormField
control={form.control}
name="publishTo"
render={() => (
<FormItem>
<FormLabel>Wilayah Publish</FormLabel>
<div className="flex flex-row items-center gap-2">
<div className="flex gap-3 items-center">
<Checkbox
id="all"
checked={isAllTargetChecked}
disabled={isDetail}
onCheckedChange={(checked) => {
if (checked) {
form.setValue(
"publishTo",
publishToList.map((item) => item.id)
);
} else {
form.setValue("publishTo", []);
}
}}
/>
{item.id === "polda" &&
form.getValues("publishTo")?.includes(item.id) && (
<UnitMapping
unit="Polda"
sendDataToParent={(data) => setUnitData(data)}
isDetail={isDetail ? true : false}
initData={unitData}
/>
)}
{item.id === "satker" &&
form.getValues("publishTo")?.includes(item.id) && (
<UnitMapping
unit="Satker"
sendDataToParent={(data) => setSatkerData(data)}
isDetail={isDetail ? true : false}
initData={satkerData}
/>
)}
</>
))}
</div>
<FormMessage />
</FormItem>
)}
/>
<label htmlFor="all" className="text-sm">
Semua
</label>
</div>
{publishToList.map((item) => (
<>
<FormField
key={item.id}
control={form.control}
name="publishTo"
render={({ field }) => {
return (
<FormItem
key={item.id}
className="flex flex-row items-start "
>
<div className="flex items-center gap-3">
<FormControl>
<Checkbox
disabled={isDetail}
checked={field.value?.includes(item.id)}
onCheckedChange={(checked) => {
return checked
? field.onChange([
...field.value,
item.id,
])
: field.onChange(
field.value?.filter(
(value) => value !== item.id
)
);
}}
/>
</FormControl>
<FormLabel className="font-normal">
{item.name}{" "}
</FormLabel>
</div>
</FormItem>
);
}}
/>
{item.id === "polda" &&
form.getValues("publishTo")?.includes(item.id) && (
<UnitMapping
unit="Polda"
sendDataToParent={(data) => setUnitData(data)}
isDetail={isDetail ? true : false}
initData={unitData}
/>
)}
{item.id === "satker" &&
form.getValues("publishTo")?.includes(item.id) && (
<UnitMapping
unit="Satker"
sendDataToParent={(data) => setSatkerData(data)}
isDetail={isDetail ? true : false}
initData={satkerData}
/>
)}
</>
))}
</div>
<FormMessage />
</FormItem>
)}
/>
) : (
<FormField
control={form.control}
name="publishTo"
render={() => (
<FormItem>
<FormLabel>Wilayah Publish</FormLabel>
<div className="flex flex-row items-center gap-2">
<div className="flex gap-3 items-center">
<Checkbox disabled checked />
<label htmlFor="all" className="text-sm">
{poldaState}
</label>
</div>
</div>
<FormMessage />
</FormItem>
)}
/>
)}
<FormField
control={form.control}
name="title"

View File

@ -514,7 +514,7 @@ const Schedule = (props: any) => {
{/* komponen Kanan */}
<div className="w-1/4 flex flex-col gap-6">
<div className="relative text-gray-600 dark:text-white">
<input type="text" placeholder={t("")} className="pl-8 pr-4 py-1 w-full border rounded-full text-sm focus:outline-none" />
<input type="text" placeholder={t("titleSchedule")} className="pl-8 pr-4 py-1 w-full border rounded-full text-sm focus:outline-none" />
<span className="absolute left-2 top-1/2 transform -translate-y-1/2">
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
<g fill="none" fill-rule="evenodd">
@ -557,6 +557,7 @@ const Schedule = (props: any) => {
</CollapsibleContent>
))}
</Collapsible> */}
<Accordion type="single" collapsible className="w-full">
<AccordionItem value="item-1">
<AccordionTrigger>Jadwal Hari ini</AccordionTrigger>

View File

@ -16,7 +16,6 @@ import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover
import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button";
const DetailVideo = () => {
const [selectedSize, setSelectedSize] = useState<string>("L");
const [selectedTab, setSelectedTab] = useState("video");

View File

@ -22,6 +22,7 @@ import { Textarea } from "@/components/ui/textarea";
import { Icon } from "@/components/ui/icon";
import dynamic from "next/dynamic";
import ReactPasswordChecklist from "react-password-checklist";
import { Select } from "@/components/ui/select";
type Inputs = {
example: string;
@ -34,7 +35,7 @@ const PasswordChecklist = dynamic(() => import("react-password-checklist"), {
const page = () => {
const params = useParams();
const [stepOneActive] = useState(true);
const [stepOneActive, setStepOneActive] = useState(true);
const [stepTwoActive, setStepTwoActive] = useState(false);
const [stepThreeActive, setStepThreeActive] = useState(false);
const [typePass, setTypePass] = useState("password");
@ -66,6 +67,7 @@ const page = () => {
const [districts, setDistricts] = useState([]);
const [, setAssociation] = useState<any>();
const [warningPassConf] = useState();
const [otpValue, setOtpValue] = useState("");
const [otp1, setOtp1] = useState();
const [otp2, setOtp2] = useState();
@ -450,23 +452,27 @@ const page = () => {
const handleVerifyOTP = async () => {
const otp = `${otp1}${otp2}${otp3}${otp4}${otp5}${otp6}`;
if (email != "" && otp.length == 6) {
const dummyOtp = "123456";
if (email != "" && otpValue.length == 6) {
console.log("verify otp");
loading();
// const response = {
// message: "success",
// };
const response = {
message: otpValue == dummyOtp ? "success" : "failed",
};
const response = await verifyOTP(email, otp);
if (response?.error) {
error(response?.message);
return false;
}
// const response = await verifyOTP(email, otp);
// if (response?.error) {
// error(response?.message);
// return false;
// }
close();
// console.log(response);
if (response?.message == "success") {
console.log("success");
setStepTwoActive(false);
setStepThreeActive(true);
setFormProfile(true);
setOtpValidate("");
@ -548,26 +554,20 @@ const page = () => {
<div className="flex flex-row justify-center py-10">
<ul className="flex flex-row items-center text-center">
<li>
<div className={`text-center text-black bg-[#f32d2d] h-[40px] w-[40px] border rounded-full ${stepOneActive ? "active bg-white border border-[#f32d2d] rounded-full text-[#f32d2d]" : ""}`}>
<span>
<b className="items-center">1</b>
</span>
<div className={`flex justify-center items-center text-center text-black bg-[#f32d2d] h-[40px] w-[40px] border rounded-full ${stepOneActive ? "active bg-white border border-[#f32d2d] rounded-full text-[#f32d2d]" : ""}`}>
<b>1</b>
</div>
</li>
<div className="w-16 h-1 z-[1] bg-[#f32d2d] "></div>
<li>
<div className={`text-center text-white bg-[#f32d2d] h-[40px] w-[40px] border rounded-full ${stepTwoActive ? "active bg-white border border-[#f32d2d] rounded-full text-[#f32d2d]" : ""}`}>
<span>
<b>2</b>
</span>
<div className={`flex justify-center items-center text-center text-black bg-[#f32d2d] h-[40px] w-[40px] border rounded-full ${stepTwoActive ? "active bg-white border border-[#f32d2d] rounded-full text-[#f32d2d]" : ""}`}>
<b>2</b>
</div>
</li>
<div className="w-16 h-1 bg-[#f32d2d]"></div>
<li>
<div className={`text-center text-white bg-[#f32d2d] h-[40px] w-[40px] borde rounded-full ${stepThreeActive ? "active bg-white border border-[#f32d2d] rounded-full text-[#f32d2d]" : ""}`}>
<span>
<b>3</b>
</span>
<div className={`flex justify-center items-center text-center text-black bg-[#f32d2d] h-[40px] w-[40px] borde rounded-full ${stepThreeActive ? "active bg-white border border-[#f32d2d] rounded-full text-[#f32d2d]" : ""}`}>
<b>3</b>
</div>
</li>
</ul>
@ -585,7 +585,7 @@ const page = () => {
}
>
<p className="text-4xl px-12 font-bold ">{stepThreeActive ? "Silahkan lengkapi data pengguna" : "Silahkan registrasi terlebih dahulu"}</p>
<p className="px-12">
<p className="px-12 mt-2">
Sudah memiliki akun?{" "}
<Link href="/auth" className="text-red-500">
<b>Masuk</b>
@ -593,6 +593,7 @@ const page = () => {
</p>
</div>
<div
className="px-20 mb-6"
style={
!stepTwoActive || (stepOneActive && stepThreeActive)
? {
@ -601,10 +602,8 @@ const page = () => {
: {}
}
>
<h2 className="text-black px-12">
<b>Masukkan Kode OTP</b>
</h2>
<p className="text-red-500 px-12">Silahkan cek inbox atau kotak spam pada email Anda.</p>
<p className="text-black text-2xl px-20 font-semibold">Masukkan Kode OTP</p>
<p className="text-red-500 text-sm px-20">Silahkan cek inbox atau kotak spam pada email Anda.</p>
</div>
</div>
@ -684,9 +683,9 @@ const page = () => {
</div>
</div>
<div className={`flex flex-row mt-4 px-12 ${!stepTwoActive || stepThreeActive ? "hidden" : ""}`}>
<div className="flex justify-center">
<InputOTP maxLength={6}>
<div className={`flex flex-col mt-4 px-12 ${!stepTwoActive || stepThreeActive ? "hidden" : ""}`}>
<div className="flex justify-center mb-6">
<InputOTP maxLength={6} onChange={(e) => setOtpValue(e)}>
<InputOTPGroup>
<InputOTPSlot index={0} onChange={(e: any) => setOtp1(e.target.value)} onKeyUp={handleTypeOTP} />
<InputOTPSlot index={1} onChange={(e: any) => setOtp2(e.target.value)} onKeyUp={handleTypeOTP} />
@ -706,17 +705,17 @@ const page = () => {
<p className="text-red-500">
<b>{otpValidate}</b>
</p>
<div className="flex justify-between mt-4">
<a className="mr-1 w-full text-base cursor-pointer" onClick={() => handleResendOTP()}>
<div className="flex flex-row px-28 justify-between items-center my-4">
<a className="bg-slate-300 text-center rounded-lg mr-1 w-[200px] py-2 text-base cursor-pointer" onClick={() => handleResendOTP()}>
Kirim Ulang ({convertMilisecondsToHour(timerCount)})
</a>
<a className="text-red-500 ml-1 w-[75%] cursor-pointer" onClick={() => handleVerifyOTP()}>
<a className="bg-red-700 w-[200px] py-2 text-center text-white rounded-lg ml-1 cursor-pointer" onClick={() => handleVerifyOTP()}>
Lanjut
</a>
</div>
</div>
<div className={`flex flex-row my-4 px-12 ${formProfile == false ? "hidden" : ""}`}>
<div className={`flex flex-col gap-3 my-4 px-12 ${formProfile == false ? "hidden" : ""}`}>
<div>
{Number(category) == 6 || Number(category) == 7 ? (
<div className="">
@ -737,15 +736,15 @@ const page = () => {
) : (
""
)}
<div className="">
<label className="">
<div className="mb-4">
<label className="mb-2">
<b>Nama Lengkap</b> <span className="text-red-500">*</span>
</label>
<Input type="text" autoComplete="off" className={` ${errors.firstName ? "block" : ""}`} {...register("firstName")} placeholder="Masukan Nama Lengkap Anda" />
<div className="text-red-500">{errors.firstName?.message}</div>
</div>
<div className="">
<label className="">
<div className="mb-4">
<label className="mb-2">
<b>Username</b> <span className="text-red-500">*</span>
</label>
<Input
@ -766,30 +765,30 @@ const page = () => {
/>
<div className="text-red-500">{errors.username?.message}</div>
</div>
<div className="">
<label className="">
<div className="mb-4">
<label className="mb-2">
<b>Email</b> <span className="text-red-500">*</span>
</label>
<Input type="email" autoComplete="off" className={` ${errors.email ? "block" : ""}`} {...register("email")} placeholder="Masukan Email Anda" disabled />
<div className="text-red-500">{errors.email?.message}</div>
</div>
</div>
<div className="">
<label className="form-label">
<div className="flex flex-col">
<label className="mb-2">
<b>No. HP</b> <span className="text-red-500">*</span>
</label>
<input type="number" autoComplete="off" className={` ${errors.phoneNumber ? "block" : ""}`} {...register("phoneNumber")} placeholder="Masukan Nomor Telepon Anda" />
<Input type="number" autoComplete="off" className={` ${errors.phoneNumber ? "block" : ""}`} {...register("phoneNumber")} placeholder="Masukan Nomor Telepon Anda" />
<div className="text-red-500">{errors.phoneNumber?.message}</div>
</div>
<div className="">
<label htmlFor="address" className="">
<div className="mb-4">
<label htmlFor="address" className="mb-2">
<b>Alamat</b> <span className="text-red-500">*</span>
</label>
<Textarea className={`form-control ${errors.address ? "block" : ""}`} {...register("address")} placeholder="Masukan Alamat Lengkap Anda" rows={3} />
<div className="text-red-500">{errors.address?.message}</div>
</div>
{Number(category) == 6 ? (
<div>
<div className="flex flex-col gap-3">
<div className="">
<label htmlFor="provinsi">
<b>Pilih Institusi</b> <span className="text-red-500">*</span>
@ -818,10 +817,10 @@ const page = () => {
: {}
}
>
<label htmlFor="alamat" className="">
<label htmlFor="alamat" className="mb-2">
<b>Nama Institusi</b> <span className="text-red-500">*</span>
</label>
<input className="" autoComplete="off" placeholder="Masukan Nama Lengkap Institusi Anda" type="text" onChange={(event) => setCustomInstituteName(event.target.value)} />
<Input className="" autoComplete="off" placeholder="Masukan Nama Lengkap Institusi Anda" type="text" onChange={(event) => setCustomInstituteName(event.target.value)} />
</div>
<div className="">
<label htmlFor="alamat" className="">
@ -833,8 +832,8 @@ const page = () => {
) : (
""
)}
<div className="">
<label htmlFor="provinsi">
<div className="flex flex-col">
<label htmlFor="provinsi" className="mb-2">
<b>Provinsi</b> <span className="text-red-500">*</span>
</label>
<select className={` ${errors.provinsi ? "block" : ""}`} {...register("provinsi")} id="provinsi" name="provinsi" onChange={(event) => getCity(event.target.value)}>
@ -849,8 +848,8 @@ const page = () => {
</select>
<div className="text-red-500">{errors.provinsi?.message}</div>
</div>
<div className="">
<label htmlFor="kota">
<div className="flex flex-col">
<label htmlFor="kota" className="mb-2">
<b>Kota/Kabupaten</b> <span className="text-red-500">*</span>
</label>
<select className={` ${errors.kota ? "block" : ""}`} {...register("kota")} id="kota" onChange={(event) => getDistricts(event.target.value)}>
@ -865,8 +864,8 @@ const page = () => {
</select>
<div className="text-red-500">{errors.kota?.message}</div>
</div>
<div className="">
<label htmlFor="kecamatan">
<div className="flex flex-col">
<label htmlFor="kecamatan" className="mb-2">
<b>Kecamatan</b> <span className="text-red-500">*</span>
</label>
<select className={` ${errors.kecamatan ? "block" : ""}`} {...register("kecamatan")} id="kecamatan">
@ -881,8 +880,8 @@ const page = () => {
</select>
<div className="text-red-500">{errors.kecamatan?.message}</div>
</div>
<div className="">
<label htmlFor="password" className="">
<div className="flex flex-col">
<label htmlFor="password" className="mb-2">
<b>Kata Sandi</b> <span className="text-red-500">*</span>
</label>
<Input
@ -910,11 +909,11 @@ const page = () => {
<Icon icon="fa:eye-slash" />
</a>
</div>
<div className="">
<label htmlFor="password" className="">
<div className="flex flex-col">
<label htmlFor="password" className="mb-2">
<b>Konfirmasi Kata Sandi</b> <span className="text-red-500">*</span>
</label>
<input
<Input
type={typePassConf}
autoComplete="off"
className={` ${errors.passwordConf ? "block" : ""}`}
@ -982,7 +981,14 @@ const page = () => {
</p>
</div>
<div className={`mb-5 mt-7 w-full text-center flex justify-center ${formProfile == true || stepTwoActive ? "hidden" : ""}`}>
<a className="border cursor-pointer border-red-500 px-4 py-3 rounded-lg text-white bg-[#dc3545] w-full" onClick={() => handleSendOTP()}>
{/* <a className="border cursor-pointer border-red-500 px-4 py-3 rounded-lg text-white bg-[#dc3545] w-full" onClick={() => handleSendOTP()}> */}
<a
className="border cursor-pointer border-red-500 px-4 py-3 rounded-lg text-white bg-[#dc3545] w-[400px]"
onClick={() => {
setStepOneActive(false);
setStepTwoActive(true);
}}
>
Kirim OTP
</a>
</div>

View File

@ -11,7 +11,7 @@ import { Link } from "@/i18n/routing";
import { Reveal } from "./Reveal";
import { useTranslations } from "next-intl";
const NewContent = (props: { group: string, type: string }) => {
const NewContent = (props: { group: string; type: string }) => {
const [newContent, setNewContent] = useState<any>();
const [selectedTab, setSelectedTab] = useState("image");
const router = useRouter();
@ -33,10 +33,8 @@ const NewContent = (props: { group: string, type: string }) => {
size: 5,
sortBy: props.type == "popular" ? "clickCount" : "createdAt",
contentTypeId: selectedTab == "image" ? "1" : selectedTab == "video" ? "2" : selectedTab == "text" ? "3" : selectedTab == "audio" ? "4" : "",
group: props.group == "mabes" ? "" :
props.group == "polda" && poldaName && String(poldaName)?.length > 1 ? poldaName :
props.group == "satker" && satkerName && String(satkerName)?.length > 1 ? "satker-"+satkerName : "",
isInt: locale == "en" ? true : false
group: props.group == "mabes" ? "" : props.group == "polda" && poldaName && String(poldaName)?.length > 1 ? poldaName : props.group == "satker" && satkerName && String(satkerName)?.length > 1 ? "satker-" + satkerName : "",
isInt: locale == "en" ? true : false,
};
const response = await getListContent(request);
console.log("category", response);

View File

@ -2547,7 +2547,7 @@ export function getMenuList(pathname: string, t: any): Group[] {
},
],
},
{
groupLabel: "",
id: "media-tracking",
@ -2712,7 +2712,7 @@ export function getMenuList(pathname: string, t: any): Group[] {
],
},
];
} else {
} else if (Number(levelNumber) == 2) {
menusSelected = [
{
groupLabel: t("apps"),
@ -2724,53 +2724,11 @@ export function getMenuList(pathname: string, t: any): Group[] {
label: t("dashboard"),
active: pathname.includes("/dashboard"),
icon: "material-symbols:dashboard",
submenus: [
{
href: "/dashboard",
label: "Breakdown",
active: pathname === "/dashboard",
icon: "heroicons:arrow-trending-up",
children: [],
},
{
href: "/dashboard/executive",
label: "Executive",
active: pathname === "/dashboard/executive",
icon: "heroicons:arrow-trending-up",
children: [],
},
],
},
],
},
{
groupLabel: "",
id: "agenda-setting",
menus: [
{
id: "agenda-setting",
href: "/contributor/agenda-setting",
label: t("agenda-setting"),
active: pathname.includes("/agenda-setting"),
icon: "iconoir:journal-page",
submenus: [],
},
],
},
{
groupLabel: "",
id: "management-user",
menus: [
{
id: "management-user-menu",
href: "/admin/management-user",
label: "Management User",
active: pathname.includes("/management-user"),
icon: "clarity:users-solid",
submenus: [],
},
],
},
{
groupLabel: "",
id: "content-production",
@ -2801,13 +2759,13 @@ export function getMenuList(pathname: string, t: any): Group[] {
},
{
groupLabel: "",
id: "performance-polda",
id: "performance-polres",
menus: [
{
id: "performance-polda",
href: "/admin/performance-polda",
label: t("performance-polda"),
active: pathname.includes("/admin/performance-polda"),
id: "performance-polres",
href: "/admin/performance-polres",
label: t("performance-polres"),
active: pathname.includes("/admin/performance-polres"),
icon: "ant-design:signal-filled",
submenus: [],
},
@ -2851,7 +2809,96 @@ export function getMenuList(pathname: string, t: any): Group[] {
active: pathname === "/admin/settings/tag",
icon: "heroicons:arrow-trending-up",
children: [],
}
},
],
},
],
},
];
} else {
menusSelected = [
{
groupLabel: t("apps"),
id: "dashboard",
menus: [
{
id: "dashboard",
href: "/dashboard",
label: t("dashboard"),
active: pathname.includes("/dashboard"),
icon: "material-symbols:dashboard",
submenus: [],
},
],
},
{
groupLabel: "",
id: "content-production",
menus: [
{
id: "content-production",
href: "/curator/content-production",
label: t("content-production"),
active: pathname.includes("/content-production"),
icon: "fluent:content-view-gallery-16-regular",
submenus: [],
},
],
},
{
groupLabel: "",
id: "pattern-relation",
menus: [
{
id: "pattern-relation",
href: "/curator/pattern-relation",
label: t("pattern-relation"),
active: pathname.includes("/pattern-relation"),
icon: "oui:app-index-pattern",
submenus: [],
},
],
},
{
groupLabel: "",
id: "communication",
menus: [
{
id: "communication",
href: "/shared/communication",
label: t("communication"),
active: pathname.includes("/communication"),
icon: "token:chat",
submenus: [],
},
],
},
{
groupLabel: "",
id: "settings",
menus: [
{
id: "settings",
href: "/admin/settings",
label: t("settings"),
active: pathname.includes("/settinng"),
icon: "material-symbols:settings",
submenus: [
{
href: "/admin/settings/category",
label: t("category"),
active: pathname === "/admin/settings/category",
icon: "heroicons:arrow-trending-up",
children: [],
},
{
href: "/admin/settings/tag",
label: "Tag",
active: pathname === "/admin/settings/tag",
icon: "heroicons:arrow-trending-up",
children: [],
},
],
},
],

View File

@ -296,6 +296,7 @@
"typography": "Typography",
"colors": "Colors",
"performance-polda": "Performance Polda",
"performance-polres": "Performance Polres",
"analysis": "Analysis",
"management-content": "Content Management ",
"add-experts": "Add Experts",
@ -344,7 +345,8 @@
"contentManagement": "Content Management",
"live": "Live",
"notFound": "Not Found",
"titleSchedule": "Enter schedule title"
"titleSchedule": "Input schedule title",
"scheduleToday": ""
},
"FilterPage": {
"image": "Image",

View File

@ -296,6 +296,7 @@
"typography": "Typography",
"colors": "Colors",
"performance-polda": "Performa Polda",
"performance-polres": "Performa Polres",
"analysis": "Analisa",
"management-content": "Manajemen Konten",
"add-experts": "Tambah Tenaga Ahli",
@ -343,7 +344,8 @@
"live": "Live",
"seeLess": "Lihat Lebih Sedikit",
"notFound": "Tidak Ditemukan",
"division": "Satker"
"division": "Satker",
"titleSchedule": "Masukkan judul Jadwal"
},
"FilterPage": {
"image": "Foto",

View File

@ -1,17 +1,13 @@
import qs from "qs";
import { getAPIDummy } from "./http-config/axiosCustom";
import { httpGet, httpPost } from "./http-config/http-base-service";
import {
httpGetInterceptor,
httpGetInterceptorWithToken,
httpPostInterceptor,
} from "./http-config/http-interceptor-service";
import { httpGetInterceptor, httpGetInterceptorWithToken, httpPostInterceptor } from "./http-config/http-interceptor-service";
export async function login(data: any) {
const pathUrl = "signin";
const headers = {
'accept': 'application/json',
'content-type': 'application/json',
accept: "application/json",
"content-type": "application/json",
};
return httpPost(pathUrl, headers, data);
}
@ -27,7 +23,7 @@ export async function login(data: any) {
// 'X-XSRF-TOKEN': csrfToken || ''
// }
// });
// if (!response.ok) {
// throw new Error(`HTTP error! status: ${response.status}`);
// }
@ -38,18 +34,18 @@ export async function login(data: any) {
// }
export async function getCsrfToken() {
const pathUrl = "csrf";
const headers = {
'content-type': 'application/json',
};
return httpGet(pathUrl, headers);
const pathUrl = "csrf";
const headers = {
"content-type": "application/json",
};
return httpGet(pathUrl, headers);
// const url = 'https://netidhub.com/api/csrf';
// try {
// const response = await fetch(url, {
// method: 'GET',
// credentials: 'include'
// });
// if (!response.ok) {
// throw new Error(`HTTP error! status: ${response.status}`);
// }
@ -122,10 +118,10 @@ export async function getDataByNRP(reqid: any, nrp: any) {
export async function getDataJournalist(cert: any) {
const url = `public/users/search-journalist?cert=${cert}`;
return httpGetInterceptor({ url });
return httpGetInterceptor(url);
}
export async function getDataPersonil(nrp: any) {
const url = `public/users/search-personil?nrp=${nrp}`;
return httpGetInterceptor({ url });
return httpGetInterceptor(url);
}

View File

@ -168,7 +168,7 @@ export async function uploadThumbnail(id: any, data: any) {
const headers = {
"Content-Type": "multipart/form-data",
};
return httpPostInterceptor(url, data, { headers });
return httpPostInterceptor(url, data, headers);
}
export async function detailSPIT(id: any) {

View File

@ -39,7 +39,7 @@ export async function postCategory(data: any) {
const headers = {
"Content-Type": "multipart/form-data",
};
return httpPostInterceptor(url, data, { headers });
return httpPostInterceptor(url, data, headers);
}
export async function getPrivacy(id: string) {