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)
return (
<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={{
content: {
backgroundColor: "white",

View File

@@ -1,14 +1,6 @@
import { LayoutDrawer, TEMA } from "@/module/_global";
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 { useState } from "react";
import toast from "react-hot-toast";
import { IoAddCircle } from "react-icons/io5";
@@ -102,7 +94,7 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
borderColor: tema.get().utama,
},
}}
size="lg"
size="md"
radius={10}
label="Grup"
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 { 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 { useRouter, useSearchParams } from "next/navigation";
import { useEffect, useState } from "react";
import { useState } from "react";
import toast from "react-hot-toast";
import { IoAddCircle } from "react-icons/io5";
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 { funCreatePosition } from "../lib/api_position";
import { globalRefreshPosition } from "../lib/val_posisition";
export default function DrawerListPosition({ onCreated }: { onCreated: (val: boolean) => void }) {
@@ -99,7 +99,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
nilai = false
}
if (roleLogin.get() == "supadmin" && listData.idGroup == "") {
if (roleLogin.get() == "supadmin" && (listData.idGroup == "" || String(listData.idGroup) == "null")) {
setTouched(touched => ({ ...touched, idGroup: true }))
nilai = false
}
@@ -117,7 +117,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
}
} else if (kategori == 'idGroup') {
setListData({ ...listData, idGroup: val })
if (val == "") {
if (val == "" || String(val) == "null") {
setTouched({ ...touched, idGroup: true })
} else {
setTouched({ ...touched, idGroup: false })
@@ -152,8 +152,8 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
}
</SimpleGrid>
</Stack>
<LayoutDrawer opened={openDrawerGroup} onClose={() => setOpenDrawerGroup(false)} title={'Tambah Jabatan'}>
<Box pt={10} pos={"relative"} h={"28.5vh"}>
<LayoutDrawer opened={openDrawerGroup} onClose={() => setOpenDrawerGroup(false)} title={'Tambah Jabatan'} size="md">
<Box pos={"relative"} h={"35vh"}>
{
roleLogin.get() == "supadmin" &&
<Select
@@ -171,8 +171,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
radius={10}
mb={5}
withAsterisk
onChange={(e: any) => { onValidation('idGroup', e) }
}
onChange={(e: any) => { onValidation('idGroup', e) }}
styles={{
input: {
color: tema.get().utama,
@@ -182,7 +181,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
}}
error={
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
/>
<Box pos={"absolute"} bottom={10} left={0} right={0}>
<Box pos={"absolute"} bottom={0} left={0} right={0}>
<Button
c={"white"}
bg={tema.get().utama}