fix: update
Deskripsi: - update jarak button grup - update jarak form edit jabatan No Issues
This commit is contained in:
@@ -12,6 +12,7 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
|
|||||||
const [namaGroup, setNamaGroup] = useState("");
|
const [namaGroup, setNamaGroup] = useState("");
|
||||||
const tema = useHookstate(TEMA)
|
const tema = useHookstate(TEMA)
|
||||||
const refresh = useHookstate(globalRefreshGroup)
|
const refresh = useHookstate(globalRefreshGroup)
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
const [touched, setTouched] = useState({
|
const [touched, setTouched] = useState({
|
||||||
name: false,
|
name: false,
|
||||||
});
|
});
|
||||||
@@ -19,8 +20,8 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
|
|||||||
|
|
||||||
async function createData() {
|
async function createData() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const response = await funCreateGroup({ name: namaGroup })
|
const response = await funCreateGroup({ name: namaGroup })
|
||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
toast.success(response.message);
|
toast.success(response.message);
|
||||||
refresh.set(!refresh.get())
|
refresh.set(!refresh.get())
|
||||||
@@ -33,6 +34,8 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
toast.error("Gagal menambahkan grup, coba lagi nanti");
|
toast.error("Gagal menambahkan grup, coba lagi nanti");
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +88,7 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
|
|||||||
onClose={() => setOpenDrawerGroup(false)}
|
onClose={() => setOpenDrawerGroup(false)}
|
||||||
title={"Tambah Grup"}
|
title={"Tambah Grup"}
|
||||||
>
|
>
|
||||||
<Box pt={10}>
|
<Box pos={"relative"} h={"28.5vh"}>
|
||||||
<TextInput
|
<TextInput
|
||||||
styles={{
|
styles={{
|
||||||
input: {
|
input: {
|
||||||
@@ -109,7 +112,7 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Box mt={"xl"}>
|
<Box pos={"absolute"} bottom={10} left={0} right={0}>
|
||||||
<Button
|
<Button
|
||||||
c={"white"}
|
c={"white"}
|
||||||
bg={tema.get().utama}
|
bg={tema.get().utama}
|
||||||
@@ -117,6 +120,7 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
|
|||||||
radius={30}
|
radius={30}
|
||||||
fullWidth
|
fullWidth
|
||||||
onClick={() => { onCheck() }}
|
onClick={() => { onCheck() }}
|
||||||
|
loading={loading}
|
||||||
>
|
>
|
||||||
Simpan
|
Simpan
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -2,15 +2,7 @@
|
|||||||
import { LayoutDrawer, TEMA } from "@/module/_global";
|
import { LayoutDrawer, TEMA } from "@/module/_global";
|
||||||
import LayoutModal from "@/module/_global/layout/layout_modal";
|
import LayoutModal from "@/module/_global/layout/layout_modal";
|
||||||
import { useHookstate } from "@hookstate/core";
|
import { useHookstate } from "@hookstate/core";
|
||||||
import {
|
import { Box, Button, Flex, SimpleGrid, Stack, Text, TextInput } from "@mantine/core";
|
||||||
Box,
|
|
||||||
Button,
|
|
||||||
Flex,
|
|
||||||
SimpleGrid,
|
|
||||||
Stack,
|
|
||||||
Text,
|
|
||||||
TextInput
|
|
||||||
} from "@mantine/core";
|
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
@@ -23,6 +15,7 @@ export default function EditDrawerGroup({ onUpdated, id, isActive, }: { onUpdate
|
|||||||
const [isModal, setModal] = useState(false);
|
const [isModal, setModal] = useState(false);
|
||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [loadingModal, setLoadingModal] = useState(false)
|
||||||
const refresh = useHookstate(globalRefreshGroup)
|
const refresh = useHookstate(globalRefreshGroup)
|
||||||
const tema = useHookstate(TEMA)
|
const tema = useHookstate(TEMA)
|
||||||
const [touched, setTouched] = useState({
|
const [touched, setTouched] = useState({
|
||||||
@@ -90,6 +83,7 @@ export default function EditDrawerGroup({ onUpdated, id, isActive, }: { onUpdate
|
|||||||
async function nonActive(val: boolean) {
|
async function nonActive(val: boolean) {
|
||||||
try {
|
try {
|
||||||
if (val) {
|
if (val) {
|
||||||
|
setLoadingModal(true)
|
||||||
const res = await funEditStatusGroup(id, { isActive: isActive });
|
const res = await funEditStatusGroup(id, { isActive: isActive });
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
toast.success(res.message);
|
toast.success(res.message);
|
||||||
@@ -99,11 +93,12 @@ export default function EditDrawerGroup({ onUpdated, id, isActive, }: { onUpdate
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setModal(false);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setModal(false);
|
|
||||||
console.error(error);
|
console.error(error);
|
||||||
toast.error("Edit grup gagal, coba lagi nanti");
|
toast.error("Edit grup gagal, coba lagi nanti");
|
||||||
|
} finally {
|
||||||
|
setLoadingModal(false)
|
||||||
|
setModal(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +141,7 @@ export default function EditDrawerGroup({ onUpdated, id, isActive, }: { onUpdate
|
|||||||
onClose={() => setOpenDrawerGroup(false)}
|
onClose={() => setOpenDrawerGroup(false)}
|
||||||
title={"Edit Grup"}
|
title={"Edit Grup"}
|
||||||
>
|
>
|
||||||
<Box pt={10}>
|
<Box pos={"relative"} h={"28.5vh"}>
|
||||||
<TextInput
|
<TextInput
|
||||||
styles={{
|
styles={{
|
||||||
input: {
|
input: {
|
||||||
@@ -155,7 +150,7 @@ export default function EditDrawerGroup({ onUpdated, id, isActive, }: { onUpdate
|
|||||||
borderColor: tema.get().utama,
|
borderColor: tema.get().utama,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
size="lg"
|
size="md"
|
||||||
value={name}
|
value={name}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
onValidation('name', e.target.value)
|
onValidation('name', e.target.value)
|
||||||
@@ -171,7 +166,7 @@ export default function EditDrawerGroup({ onUpdated, id, isActive, }: { onUpdate
|
|||||||
label="Grup"
|
label="Grup"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<Box mt={"xl"}>
|
<Box pos={"absolute"} bottom={10} left={0} right={0}>
|
||||||
<Button
|
<Button
|
||||||
c={"white"}
|
c={"white"}
|
||||||
bg={tema.get().utama}
|
bg={tema.get().utama}
|
||||||
@@ -188,6 +183,7 @@ export default function EditDrawerGroup({ onUpdated, id, isActive, }: { onUpdate
|
|||||||
</LayoutDrawer>
|
</LayoutDrawer>
|
||||||
|
|
||||||
<LayoutModal
|
<LayoutModal
|
||||||
|
loading={loadingModal}
|
||||||
opened={isModal}
|
opened={isModal}
|
||||||
onClose={() => setModal(false)}
|
onClose={() => setModal(false)}
|
||||||
description="Apakah Anda yakin ingin mangubah status aktifasi data?"
|
description="Apakah Anda yakin ingin mangubah status aktifasi data?"
|
||||||
|
|||||||
@@ -1,26 +1,17 @@
|
|||||||
import { LayoutDrawer, SkeletonSingle, TEMA, WARNA } from "@/module/_global";
|
import { LayoutDrawer, SkeletonSingle, TEMA } from "@/module/_global";
|
||||||
import {
|
import { useHookstate } from "@hookstate/core";
|
||||||
ActionIcon,
|
import { ActionIcon, Box, Flex, Grid, Group, Text, TextInput } from "@mantine/core";
|
||||||
Box,
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
Flex,
|
import _ from "lodash";
|
||||||
Grid,
|
import { useSearchParams } from "next/navigation";
|
||||||
Group,
|
import { useState } from "react";
|
||||||
Skeleton,
|
import toast from "react-hot-toast";
|
||||||
Text,
|
|
||||||
TextInput,
|
|
||||||
} from "@mantine/core";
|
|
||||||
import React, { useEffect, useState } from "react";
|
|
||||||
import { HiOutlineOfficeBuilding } from "react-icons/hi";
|
import { HiOutlineOfficeBuilding } from "react-icons/hi";
|
||||||
import { HiMagnifyingGlass } from "react-icons/hi2";
|
import { HiMagnifyingGlass } from "react-icons/hi2";
|
||||||
import EditDrawerGroup from "./edit_drawer_group";
|
|
||||||
import toast from "react-hot-toast";
|
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
|
||||||
import { funGetAllGroup } from "../lib/api_group";
|
import { funGetAllGroup } from "../lib/api_group";
|
||||||
import { IDataGroup } from "../lib/type_group";
|
import { IDataGroup } from "../lib/type_group";
|
||||||
import { useSearchParams } from "next/navigation";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { useHookstate } from "@hookstate/core";
|
|
||||||
import { globalRefreshGroup } from "../lib/val_group";
|
import { globalRefreshGroup } from "../lib/val_group";
|
||||||
|
import EditDrawerGroup from "./edit_drawer_group";
|
||||||
|
|
||||||
|
|
||||||
export default function ListGroupActive() {
|
export default function ListGroupActive() {
|
||||||
@@ -117,7 +108,7 @@ export default function ListGroupActive() {
|
|||||||
base: 3,
|
base: 3,
|
||||||
xl: 2
|
xl: 2
|
||||||
}}>
|
}}>
|
||||||
<Flex justify={{base: "center", xl: "flex-start"}}>
|
<Flex justify={{ base: "center", xl: "flex-start" }}>
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
variant="light"
|
variant="light"
|
||||||
bg={tema.get().bgTotalKegiatan}
|
bg={tema.get().bgTotalKegiatan}
|
||||||
@@ -143,8 +134,8 @@ export default function ListGroupActive() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text fw={"bold"} c={tema.get().utama} lineClamp={1}>
|
<Text fw={"bold"} c={tema.get().utama} lineClamp={1}>
|
||||||
{v.name}
|
{v.name}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ export default function DrawerDetailPosition({ onUpdated, id, isActive }: { onUp
|
|||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<LayoutDrawer opened={openDrawerGroup} onClose={() => setOpenDrawerGroup(false)} title={'Edit Jabatan'} >
|
<LayoutDrawer opened={openDrawerGroup} onClose={() => setOpenDrawerGroup(false)} title={'Edit Jabatan'} >
|
||||||
<Box pt={10} pos={"relative"} h={"28.5vh"}>
|
<Box pos={"relative"} h={"28.5vh"}>
|
||||||
{loading ?
|
{loading ?
|
||||||
<Box>
|
<Box>
|
||||||
<Skeleton height={40} mt={6} radius={10} />
|
<Skeleton height={40} mt={6} radius={10} />
|
||||||
|
|||||||
Reference in New Issue
Block a user