From 794b10cc7a402ac34567f1af9e5ef8925c73ac50 Mon Sep 17 00:00:00 2001 From: amel Date: Wed, 23 Oct 2024 14:36:10 +0800 Subject: [PATCH] fix: position Deskripsi: - fix ukuran drawer tambah jabatan - ukuran form tambah grup No Issues --- src/module/_global/layout/layout_drawer.tsx | 2 +- src/module/group/ui/drawer_group.tsx | 12 ++------- .../position/ui/drawer_list_position.tsx | 27 +++++++++---------- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/src/module/_global/layout/layout_drawer.tsx b/src/module/_global/layout/layout_drawer.tsx index 804a922..02fb060 100644 --- a/src/module/_global/layout/layout_drawer.tsx +++ b/src/module/_global/layout/layout_drawer.tsx @@ -8,7 +8,7 @@ export default function LayoutDrawer({ opened, onClose, title, children, size }: const tema = useHookstate(TEMA) return ( - {title}} onClose={onClose} position={"bottom"} size={(size == 'lg') ? '80%' : '40%' } + {title}} onClose={onClose} position={"bottom"} size={(size == 'lg') ? '80%' : (size == 'md') ? '45%' : '40%'} styles={{ content: { backgroundColor: "white", diff --git a/src/module/group/ui/drawer_group.tsx b/src/module/group/ui/drawer_group.tsx index abba7e1..99d70c3 100644 --- a/src/module/group/ui/drawer_group.tsx +++ b/src/module/group/ui/drawer_group.tsx @@ -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 diff --git a/src/module/position/ui/drawer_list_position.tsx b/src/module/position/ui/drawer_list_position.tsx index 82a60ae..390d685 100644 --- a/src/module/position/ui/drawer_list_position.tsx +++ b/src/module/position/ui/drawer_list_position.tsx @@ -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 } - setOpenDrawerGroup(false)} title={'Tambah Jabatan'}> - + setOpenDrawerGroup(false)} title={'Tambah Jabatan'} size="md"> + { roleLogin.get() == "supadmin" &&