fix: position

Deskripsi:
- fix ukuran drawer tambah jabatan
- ukuran form tambah grup

No Issues
This commit is contained in:
amel
2024-10-23 14:36:10 +08:00
parent f5cc008775
commit 794b10cc7a
3 changed files with 16 additions and 25 deletions

View File

@@ -8,7 +8,7 @@ export default function LayoutDrawer({ opened, onClose, title, children, size }:
const tema = useHookstate(TEMA) const tema = useHookstate(TEMA)
return ( return (
<Box> <Box>
<Drawer opened={opened} title={<Text c={tema.get().utama} fw={'bold'}>{title}</Text>} onClose={onClose} position={"bottom"} size={(size == 'lg') ? '80%' : '40%' } <Drawer opened={opened} title={<Text c={tema.get().utama} fw={'bold'}>{title}</Text>} onClose={onClose} position={"bottom"} size={(size == 'lg') ? '80%' : (size == 'md') ? '45%' : '40%'}
styles={{ styles={{
content: { content: {
backgroundColor: "white", backgroundColor: "white",

View File

@@ -1,14 +1,6 @@
import { LayoutDrawer, TEMA } from "@/module/_global"; import { LayoutDrawer, TEMA } from "@/module/_global";
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 { useState } from "react"; import { useState } from "react";
import toast from "react-hot-toast"; import toast from "react-hot-toast";
import { IoAddCircle } from "react-icons/io5"; import { IoAddCircle } from "react-icons/io5";
@@ -102,7 +94,7 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
borderColor: tema.get().utama, borderColor: tema.get().utama,
}, },
}} }}
size="lg" size="md"
radius={10} radius={10}
label="Grup" label="Grup"
required required

View File

@@ -1,16 +1,16 @@
import { WARNA, LayoutDrawer, globalRole, TEMA, keyWibu } from "@/module/_global"; import { globalRole, keyWibu, LayoutDrawer, TEMA } from "@/module/_global";
import { funGetAllGroup, IDataGroup } from "@/module/group"; import { funGetAllGroup, IDataGroup } from "@/module/group";
import { Box, Stack, SimpleGrid, Flex, TextInput, Button, Text, Select } from "@mantine/core"; import { useHookstate } from "@hookstate/core";
import { Box, Button, Flex, Select, SimpleGrid, Stack, Text, TextInput } from "@mantine/core";
import { useShallowEffect } from "@mantine/hooks"; import { useShallowEffect } from "@mantine/hooks";
import { useRouter, useSearchParams } from "next/navigation"; import { useRouter, useSearchParams } from "next/navigation";
import { useEffect, useState } from "react"; import { useState } from "react";
import toast from "react-hot-toast"; import toast from "react-hot-toast";
import { IoAddCircle } from "react-icons/io5"; import { IoAddCircle } from "react-icons/io5";
import { RiFilter2Line } from "react-icons/ri"; import { RiFilter2Line } from "react-icons/ri";
import { funCreatePosition } from "../lib/api_position";
import { useHookstate } from "@hookstate/core";
import { globalRefreshPosition } from "../lib/val_posisition";
import { useWibuRealtime } from "wibu-realtime"; import { useWibuRealtime } from "wibu-realtime";
import { funCreatePosition } from "../lib/api_position";
import { globalRefreshPosition } from "../lib/val_posisition";
export default function DrawerListPosition({ onCreated }: { onCreated: (val: boolean) => void }) { export default function DrawerListPosition({ onCreated }: { onCreated: (val: boolean) => void }) {
@@ -99,7 +99,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
nilai = false nilai = false
} }
if (roleLogin.get() == "supadmin" && listData.idGroup == "") { if (roleLogin.get() == "supadmin" && (listData.idGroup == "" || String(listData.idGroup) == "null")) {
setTouched(touched => ({ ...touched, idGroup: true })) setTouched(touched => ({ ...touched, idGroup: true }))
nilai = false nilai = false
} }
@@ -117,7 +117,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
} }
} else if (kategori == 'idGroup') { } else if (kategori == 'idGroup') {
setListData({ ...listData, idGroup: val }) setListData({ ...listData, idGroup: val })
if (val == "") { if (val == "" || String(val) == "null") {
setTouched({ ...touched, idGroup: true }) setTouched({ ...touched, idGroup: true })
} else { } else {
setTouched({ ...touched, idGroup: false }) setTouched({ ...touched, idGroup: false })
@@ -152,8 +152,8 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
} }
</SimpleGrid> </SimpleGrid>
</Stack> </Stack>
<LayoutDrawer opened={openDrawerGroup} onClose={() => setOpenDrawerGroup(false)} title={'Tambah Jabatan'}> <LayoutDrawer opened={openDrawerGroup} onClose={() => setOpenDrawerGroup(false)} title={'Tambah Jabatan'} size="md">
<Box pt={10} pos={"relative"} h={"28.5vh"}> <Box pos={"relative"} h={"35vh"}>
{ {
roleLogin.get() == "supadmin" && roleLogin.get() == "supadmin" &&
<Select <Select
@@ -171,8 +171,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
radius={10} radius={10}
mb={5} mb={5}
withAsterisk withAsterisk
onChange={(e: any) => { onValidation('idGroup', e) } onChange={(e: any) => { onValidation('idGroup', e) }}
}
styles={{ styles={{
input: { input: {
color: tema.get().utama, color: tema.get().utama,
@@ -182,7 +181,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
}} }}
error={ error={
touched.idGroup && ( touched.idGroup && (
listData.idGroup == "" ? "Grup Tidak Boleh Kosong" : null listData.idGroup == "" || String(listData.idGroup) == "null" ? "Grup Tidak Boleh Kosong" : null
) )
} }
/> />
@@ -209,7 +208,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
} }
required required
/> />
<Box pos={"absolute"} bottom={10} left={0} right={0}> <Box pos={"absolute"} bottom={0} left={0} right={0}>
<Button <Button
c={"white"} c={"white"}
bg={tema.get().utama} bg={tema.get().utama}