Deskripsi:
- Upload ke stroage untuk job
## Np Issuee
This commit is contained in:
2024-09-19 15:59:21 +08:00
parent 128dc98839
commit f96d80d55d
153 changed files with 1369 additions and 1200 deletions

View File

@@ -0,0 +1,49 @@
import { AccentColor } from "@/app_modules/_global/color";
import { job_getAllListPublish } from "@/app_modules/job/fun/get/get_all_publish";
import { Center, Button, Affix, rem } from "@mantine/core";
import { useWindowScroll } from "@mantine/hooks";
import { useState } from "react";
export function Job_ComponentButtonUpdateBeranda({
onSetData,
onSetIsNewPost,
}: {
onSetData: (val: any) => void;
onSetIsNewPost: (val: any) => void;
}) {
const [scroll, scrollTo] = useWindowScroll();
const [isLoading, setIsLoading] = useState(false);
async function onLoadData() {
const loadData = await job_getAllListPublish({ page: 1 });
if (loadData) {
onSetData(loadData);
onSetIsNewPost(false);
setIsLoading(false);
}
}
return (
<>
<Affix position={{ top: rem(100) }} w={"100%"}>
<Center>
<Button
style={{
transition: "0.5s",
border: `1px solid ${AccentColor.skyblue}`,
}}
bg={AccentColor.blue}
loaderPosition="center"
loading={isLoading ? true : false}
radius={"xl"}
opacity={scroll.y > 0 ? 0.5 : 0.8}
onClick={() => onLoadData()}
>
Update beranda
</Button>
</Center>
</Affix>
</>
);
}

View File

@@ -15,7 +15,7 @@ import { MODEL_JOB } from "../../model/interface";
import { funGlobal_UploadToStorage } from "@/app_modules/_global/fun";
import { DIRECTORY_ID } from "@/app/lib";
export function Job_ComponentButtonUpdate({
export function Job_ComponentButtonUpdateData({
value,
file,
}: {
@@ -48,6 +48,7 @@ export function Job_ComponentButtonUpdate({
const updateWithFile = await job_EditById({
data: value,
fileId: uploadFile.data.id,
});
if (updateWithFile.status !== 200)
return ComponentGlobal_NotifikasiGagal(updateWithFile.message);

View File

@@ -1,66 +0,0 @@
"use client";
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
import { Affix, rem, ActionIcon, Loader, Box } from "@mantine/core";
import { IconPencilPlus } from "@tabler/icons-react";
import { useRouter } from "next/navigation";
import { useState } from "react";
export default function ComponentJob_CreateButton() {
const router = useRouter();
const [isLoading, setLoading] = useState(false);
return (
<>
<ActionIcon
variant="transparent"
radius={"xl"}
size={"xl"}
style={{
position: "absolute",
zIndex: 1,
bottom: 100,
right: 30,
transition: "0.5s",
border: `1px solid ${AccentColor.skyblue}`,
backgroundColor: AccentColor.blue,
padding: 3,
}}
onClick={() => {
setLoading(true);
router.push(RouterJob.create);
}}
>
{isLoading ? (
<Loader color={AccentColor.yellow} size={25} />
) : (
<IconPencilPlus color="white" />
)}
</ActionIcon>
{/* <Affix withinPortal position={{ bottom: 150, right: 30 }}>
<ActionIcon
style={{
transition: "0.5s",
border: `1px solid ${AccentColor.skyblue}`,
}}
bg={AccentColor.blue}
size={"xl"}
radius={"xl"}
variant="transparent"
onClick={() => {
setLoading(true);
router.push(RouterJob.create);
}}
>
{isLoading ? (
<Loader color={AccentColor.yellow} size={25} />
) : (
<IconPencilPlus color="white" />
)}
</ActionIcon>
</Affix> */}
</>
);
}

View File

@@ -1,7 +1,9 @@
import Job_ComponentButtonSaveCreate from "./button/comp_button_save_create";
import { Job_ComponentButtonUpdate } from "./button/comp_button_update";
import { Job_ComponentButtonUpdateBeranda } from "./button/comp_button_update_beranda";
import { Job_ComponentButtonUpdateData } from "./button/comp_button_update_data";
import { Job_ComponentBoxUploadImage } from "./detail/comp_box_upload_image";
export { Job_ComponentButtonSaveCreate };
export { Job_ComponentBoxUploadImage };
export { Job_ComponentButtonUpdate };
export { Job_ComponentButtonUpdateData as Job_ComponentButtonUpdate };
export { Job_ComponentButtonUpdateBeranda };