feat:update tambah Ta,Spit,fix routing
This commit is contained in:
parent
f574d97523
commit
d5f697ddfa
|
|
@ -230,11 +230,13 @@ export default function AddExpertForm() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAddRow = () => {
|
const handleAddRow = () => {
|
||||||
setPlacementRows((prevRows: any) => [
|
if (placementRows.length < 2) {
|
||||||
...prevRows,
|
setPlacementRows((prevRows) => [
|
||||||
{ index: incrementId, roleId: "", userLevelId: 0 },
|
...prevRows,
|
||||||
]);
|
{ index: incrementId, roleId: "", userLevelId: 0 },
|
||||||
setIncrementId((prevId) => prevId + 1);
|
]);
|
||||||
|
setIncrementId((prevId) => prevId + 1);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -424,7 +426,7 @@ export default function AddExpertForm() {
|
||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
<Select
|
{/* <Select
|
||||||
onValueChange={(e) =>
|
onValueChange={(e) =>
|
||||||
handleSelectionChange(row.index, "userLevelId", e)
|
handleSelectionChange(row.index, "userLevelId", e)
|
||||||
}
|
}
|
||||||
|
|
@ -441,6 +443,20 @@ export default function AddExpertForm() {
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
|
</Select> */}
|
||||||
|
<Select
|
||||||
|
onValueChange={(e) =>
|
||||||
|
handleSelectionChange(row.index, "userLevelId", e)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<FormControl>
|
||||||
|
<SelectTrigger>
|
||||||
|
<SelectValue placeholder="Pilih User Level" />
|
||||||
|
</SelectTrigger>
|
||||||
|
</FormControl>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="216">MABES POLRI</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
{placementRows.length > 1 && (
|
{placementRows.length > 1 && (
|
||||||
<Button
|
<Button
|
||||||
|
|
@ -454,7 +470,12 @@ export default function AddExpertForm() {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
<Button type="button" size="md" onClick={() => handleAddRow()}>
|
<Button
|
||||||
|
type="button"
|
||||||
|
size="md"
|
||||||
|
onClick={handleAddRow}
|
||||||
|
disabled={placementRows.length >= 2} // optional: disable button if already 1 row added
|
||||||
|
>
|
||||||
Tambah
|
Tambah
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -25,7 +25,6 @@ import DatePicker from "react-datepicker";
|
||||||
import { id } from "date-fns/locale";
|
import { id } from "date-fns/locale";
|
||||||
import "react-datepicker/dist/react-datepicker.css";
|
import "react-datepicker/dist/react-datepicker.css";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import router from "next/router";
|
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { date, z } from "zod";
|
import { date, z } from "zod";
|
||||||
import { error, loading } from "@/lib/swal";
|
import { error, loading } from "@/lib/swal";
|
||||||
|
|
@ -51,6 +50,7 @@ import Image from "next/image";
|
||||||
import FileUploader from "../shared/file-uploader";
|
import FileUploader from "../shared/file-uploader";
|
||||||
import { getCsrfToken } from "@/service/auth";
|
import { getCsrfToken } from "@/service/auth";
|
||||||
import { Upload } from "tus-js-client";
|
import { Upload } from "tus-js-client";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
const calendarSchema = z.object({
|
const calendarSchema = z.object({
|
||||||
title: z.string().min(1, { message: "Judul diperlukan" }),
|
title: z.string().min(1, { message: "Judul diperlukan" }),
|
||||||
|
|
@ -68,6 +68,7 @@ interface FileUploaded {
|
||||||
|
|
||||||
export function CalendarPolriAdd() {
|
export function CalendarPolriAdd() {
|
||||||
const MySwal = withReactContent(Swal);
|
const MySwal = withReactContent(Swal);
|
||||||
|
const router = useRouter();
|
||||||
const [open, setOpen] = React.useState(false);
|
const [open, setOpen] = React.useState(false);
|
||||||
const t = useTranslations("Schedule");
|
const t = useTranslations("Schedule");
|
||||||
type CalendarSchema = z.infer<typeof calendarSchema>;
|
type CalendarSchema = z.infer<typeof calendarSchema>;
|
||||||
|
|
@ -212,9 +213,7 @@ export function CalendarPolriAdd() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cookies.set("scheduleId", response?.data?.data.id, {
|
const id = response?.data?.data?.id;
|
||||||
expires: 1,
|
|
||||||
});
|
|
||||||
|
|
||||||
loading();
|
loading();
|
||||||
if (imageFiles?.length === 0) {
|
if (imageFiles?.length === 0) {
|
||||||
|
|
@ -242,7 +241,7 @@ export function CalendarPolriAdd() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const upload = new Upload(file, {
|
const upload = new Upload(file, {
|
||||||
endpoint: `${process.env.NEXT_PUBLIC_API}/agenda-settings/file/upload`,
|
endpoint: `${process.env.NEXT_PUBLIC_API}/calendars/file/upload`,
|
||||||
headers: headers,
|
headers: headers,
|
||||||
retryDelays: [0, 3000, 6000, 12_000, 24_000],
|
retryDelays: [0, 3000, 6000, 12_000, 24_000],
|
||||||
chunkSize: 20_000,
|
chunkSize: 20_000,
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ export function TambahIklanModal() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePoldaPolresChange = () => {
|
const handlePoldaPolresChange = () => {
|
||||||
return Array.from(checkedLevels).join(","); // Mengonversi Set ke string
|
return Array.from(checkedLevels).join(",");
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUnitChange = (
|
const handleUnitChange = (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue