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