fix:edit category polda satker
This commit is contained in:
parent
f620638c26
commit
350c061263
|
|
@ -38,6 +38,9 @@ import { UnitMapping } from "./unit-mapping";
|
||||||
import { useDropzone } from "react-dropzone";
|
import { useDropzone } from "react-dropzone";
|
||||||
import { CloudUpload } from "lucide-react";
|
import { CloudUpload } from "lucide-react";
|
||||||
import { useToast } from "@/components/ui/use-toast";
|
import { useToast } from "@/components/ui/use-toast";
|
||||||
|
import Cookies from "js-cookie";
|
||||||
|
import { getCookiesDecrypt } from "@/lib/utils";
|
||||||
|
|
||||||
const FormSchema = z.object({
|
const FormSchema = z.object({
|
||||||
title: z.string({
|
title: z.string({
|
||||||
required_error: "Required",
|
required_error: "Required",
|
||||||
|
|
@ -112,7 +115,10 @@ export default function EditCategoryModal(props: {
|
||||||
const [files, setFiles] = useState<File[]>([]);
|
const [files, setFiles] = useState<File[]>([]);
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
|
const roleId = getCookiesDecrypt("urie");
|
||||||
|
const levelNumber = getCookiesDecrypt("ulne");
|
||||||
|
const userLevelId = getCookiesDecrypt("ulie");
|
||||||
|
const poldaState = Cookies.get("state");
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [satkerData, setSatkerData] = useState<string[]>([]);
|
const [satkerData, setSatkerData] = useState<string[]>([]);
|
||||||
const [unitData, setUnitData] = useState<string[]>([]);
|
const [unitData, setUnitData] = useState<string[]>([]);
|
||||||
|
|
@ -344,7 +350,7 @@ export default function EditCategoryModal(props: {
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
{Number(levelNumber) === 1 ? (
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="selectedUser"
|
name="selectedUser"
|
||||||
|
|
@ -417,6 +423,28 @@ export default function EditCategoryModal(props: {
|
||||||
</FormItem>
|
</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
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="publishTo"
|
name="publishTo"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue