"use client"; import { RouterJob } from "@/app/lib/router_hipmi/router_job"; import { AspectRatio, Box, Button, Center, FileButton, Flex, Group, Image, Loader, Paper, Stack, Text, TextInput, Textarea, } from "@mantine/core"; import { IconCamera, IconUpload } from "@tabler/icons-react"; import { useAtom } from "jotai"; import _ from "lodash"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { gs_job_hot_menu, gs_job_status } from "../global_state"; import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; import "react-quill/dist/quill.snow.css"; import dynamic from "next/dynamic"; import { useShallowEffect, useToggle } from "@mantine/hooks"; import { Job_funCreate } from "../fun/create/fun_create"; import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal"; import { MODEL_JOB } from "../model/interface"; import toast from "react-simple-toasts"; import ComponentJob_NotedBox from "../component/detail/noted_box"; const ReactQuill = dynamic( () => { return import("react-quill"); }, { ssr: false } ); export default function Job_Create() { const [value, setValue] = useState({ title: "", content: "", deskripsi: "", }); const [reload, setReload] = useState(false); const [file, setFile] = useState(null); const [images, setImages] = useState(); useShallowEffect(() => { if (window && window.document) setReload(true); }, []); if (!reload) return ( <>
); return ( <> {!reload ? (
) : ( {images ? ( ) : ( Upload Gambar )} { try { const buffer = URL.createObjectURL( new Blob([new Uint8Array(await files.arrayBuffer())]) ); if (files.size > 20000) { ComponentGlobal_NotifikasiPeringatan( "Maaf, Ukuran file terlalu besar, maximum 20Mb", 3000 ); } else { setImages(buffer); setFile(files); } } catch (error) { console.log(error); } }} accept="image/png,image/jpeg" > {(props) => ( )} { setValue({ ...value, title: val.currentTarget.value, }); }} /> Syarat & Ketentuan {" "} * Syarat & Ketentuan :

  1. Minimal pendidika SMA / Sederajat
  2. Pasif berbahasa inggris
  3. Dll,.


`} modules={{ toolbar: [ [{ header: [1, 2, 3, 4, 5, 6, false] }], ["bold", "italic", "underline", "link"], // [{ align: [] }], [{ list: "ordered" }, { list: "bullet" }], ["clean"], ], }} theme="snow" onChange={(val) => { setValue({ ...value, content: val, }); }} />
Deskripsi {" "} * Deskripsi :

Jika berminat dapat menghubungi WA berikut

+6281 xxx xxx xx

Kirim CV anda melalui email berikut

test-email@gmail.com

Atau kunjungi website kami:

https://test-hipmi.wibudev.com/

`} modules={{ toolbar: [ [{ header: [1, 2, 3, 4, 5, 6, false] }], ["bold", "italic", "underline", "link"], // [{ align: [] }], [{ list: "ordered" }, { list: "bullet" }], ["clean"], ], }} theme="snow" onChange={(val) => { setValue({ ...value, deskripsi: val, }); }} />
)} ); } function ButtonAction({ value, file }: { value: MODEL_JOB; file: FormData }) { const router = useRouter(); const [hotMenu, setHotMenu] = useAtom(gs_job_hot_menu); const [status, setStatus] = useAtom(gs_job_status); const [preview, setPreview] = useToggle(); async function onAction() { const gambar = new FormData(); gambar.append("file", file as any); // console.log(value) await Job_funCreate(value as any, gambar).then((res) => { if (res.status === 201) { setHotMenu(2); setStatus("Review"); router.replace(RouterJob.status); ComponentGlobal_NotifikasiBerhasil("Tambah Lowongan Berhasil"); } else { ComponentGlobal_NotifikasiGagal(res.message); } }); } return ( <> ); }