Merge pull request #288 from bipproduction/amalia/04-okt-24
Amalia/04 okt 24
This commit is contained in:
@@ -1,13 +1,12 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { LayoutNavbarNew, TEMA } from '@/module/_global';
|
import { LayoutNavbarNew, TEMA } from '@/module/_global';
|
||||||
import { useHookstate } from '@hookstate/core';
|
|
||||||
import { Badge, Box, Button, Center, ColorInput, Flex, Pill, rem, SimpleGrid, Stack, Text, TextInput } from '@mantine/core';
|
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { funCreateTheme } from '../lib/api_theme';
|
|
||||||
import toast from 'react-hot-toast';
|
|
||||||
import { useRouter } from 'next/navigation';
|
|
||||||
import LayoutModal from '@/module/_global/layout/layout_modal';
|
import LayoutModal from '@/module/_global/layout/layout_modal';
|
||||||
import _ from 'lodash';
|
import { useHookstate } from '@hookstate/core';
|
||||||
|
import { Box, Button, Center, ColorInput, Flex, Pill, rem, SimpleGrid, Stack, TextInput } from '@mantine/core';
|
||||||
|
import { useRouter } from 'next/navigation';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import toast from 'react-hot-toast';
|
||||||
|
import { funCreateTheme } from '../lib/api_theme';
|
||||||
|
|
||||||
export default function CreatePaletteColor() {
|
export default function CreatePaletteColor() {
|
||||||
const [isValModal, setValModal] = useState(false);
|
const [isValModal, setValModal] = useState(false);
|
||||||
@@ -56,11 +55,46 @@ export default function CreatePaletteColor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onCheck() {
|
function onCheck() {
|
||||||
if (Object.values(touched).some((v) => v == true))
|
const cek = checkAll()
|
||||||
|
if (!cek)
|
||||||
return false
|
return false
|
||||||
setValModal(true)
|
setValModal(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkAll() {
|
||||||
|
let nilai = true
|
||||||
|
if (isWarna.name === "") {
|
||||||
|
setTouched(touched => ({ ...touched, name: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
if (isWarna.utama === "" || isWarna.utama.substring(0, 1) !== '#') {
|
||||||
|
setTouched(touched => ({ ...touched, utama: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
if (isWarna.bgUtama === "" || isWarna.bgUtama.substring(0, 1) !== '#') {
|
||||||
|
setTouched(touched => ({ ...touched, bgUtama: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
if (isWarna.bgIcon === "" || isWarna.bgIcon.substring(0, 1) !== '#') {
|
||||||
|
setTouched(touched => ({ ...touched, bgIcon: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
if (isWarna.bgFiturHome === "" || isWarna.bgFiturHome.substring(0, 1) !== '#') {
|
||||||
|
setTouched(touched => ({ ...touched, bgFiturHome: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
if (isWarna.bgFiturDivision === "" || isWarna.bgFiturDivision.substring(0, 1) !== '#') {
|
||||||
|
setTouched(touched => ({ ...touched, bgFiturDivision: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
if (isWarna.bgTotalKegiatan === "" || isWarna.bgTotalKegiatan.substring(0, 1) !== '#') {
|
||||||
|
setTouched(touched => ({ ...touched, bgTotalKegiatan: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
|
||||||
|
return nilai
|
||||||
|
}
|
||||||
|
|
||||||
function onValidation(kategori: string, val: string) {
|
function onValidation(kategori: string, val: string) {
|
||||||
if (kategori == 'name') {
|
if (kategori == 'name') {
|
||||||
setWarna({ ...isWarna, name: val })
|
setWarna({ ...isWarna, name: val })
|
||||||
@@ -239,8 +273,8 @@ export default function CreatePaletteColor() {
|
|||||||
}
|
}
|
||||||
error={
|
error={
|
||||||
touched.bgTotalKegiatan && (
|
touched.bgTotalKegiatan && (
|
||||||
isWarna.bgTotalKegiatan == "" ? "Background Total Kegiatan Tidak Boleh Kosong" :
|
isWarna.bgTotalKegiatan == "" ? "Background Total Kegiatan Tidak Boleh Kosong" :
|
||||||
isWarna.bgTotalKegiatan.substring(0, 1) != "#" ? "Kode Warna Tidak Valid" : null
|
isWarna.bgTotalKegiatan.substring(0, 1) != "#" ? "Kode Warna Tidak Valid" : null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { LayoutNavbarNew, TEMA } from '@/module/_global';
|
import { LayoutNavbarNew, TEMA } from '@/module/_global';
|
||||||
|
import LayoutModal from "@/module/_global/layout/layout_modal";
|
||||||
import { useHookstate } from '@hookstate/core';
|
import { useHookstate } from '@hookstate/core';
|
||||||
import { Badge, Box, Button, Center, ColorInput, Flex, Pill, rem, SimpleGrid, Skeleton, Stack, Text, TextInput } from '@mantine/core';
|
import { Box, Button, Center, ColorInput, Flex, Pill, rem, SimpleGrid, Skeleton, Stack, TextInput } from '@mantine/core';
|
||||||
import React, { useState } from 'react';
|
import { useShallowEffect } from '@mantine/hooks';
|
||||||
import { IEditTheme } from '../lib/type_theme';
|
import { useParams, useRouter } from 'next/navigation';
|
||||||
|
import { useState } from 'react';
|
||||||
import toast from 'react-hot-toast';
|
import toast from 'react-hot-toast';
|
||||||
import { funEditTheme, funGetThemeById } from '../lib/api_theme';
|
import { funEditTheme, funGetThemeById } from '../lib/api_theme';
|
||||||
import { useParams, useRouter } from 'next/navigation';
|
import { IEditTheme } from '../lib/type_theme';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
|
||||||
import LayoutModal from "@/module/_global/layout/layout_modal";
|
|
||||||
|
|
||||||
export default function EditPaletteColor() {
|
export default function EditPaletteColor() {
|
||||||
const tema = useHookstate(TEMA)
|
const tema = useHookstate(TEMA)
|
||||||
@@ -16,6 +16,7 @@ export default function EditPaletteColor() {
|
|||||||
const [isModal, setModal] = useState(false)
|
const [isModal, setModal] = useState(false)
|
||||||
const param = useParams<{ id: string }>()
|
const param = useParams<{ id: string }>()
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
|
const [loadingKonfirmasi, setLoadingKonfirmasi] = useState(false);
|
||||||
const [touched, setTouched] = useState({
|
const [touched, setTouched] = useState({
|
||||||
name: false,
|
name: false,
|
||||||
utama: false,
|
utama: false,
|
||||||
@@ -62,6 +63,7 @@ export default function EditPaletteColor() {
|
|||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
try {
|
try {
|
||||||
|
setLoadingKonfirmasi(true)
|
||||||
const res = await funEditTheme(param.id, isWarna)
|
const res = await funEditTheme(param.id, isWarna)
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
toast.success(res.message);
|
toast.success(res.message);
|
||||||
@@ -72,6 +74,9 @@ export default function EditPaletteColor() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
toast.error("Gagal mengedit tema, coba lagi nanti");
|
toast.error("Gagal mengedit tema, coba lagi nanti");
|
||||||
|
} finally {
|
||||||
|
setLoadingKonfirmasi(false)
|
||||||
|
setModal(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,11 +386,13 @@ export default function EditPaletteColor() {
|
|||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
|
||||||
<LayoutModal opened={isModal} onClose={() => setModal(false)} description="Apakah Anda yakin ingin mengubah data?"
|
<LayoutModal loading={loadingKonfirmasi} opened={isModal} onClose={() => setModal(false)} description="Apakah Anda yakin ingin mengubah data?"
|
||||||
onYes={(val) => {
|
onYes={(val) => {
|
||||||
if (val)
|
if (val) {
|
||||||
onSubmit()
|
onSubmit()
|
||||||
setModal(false)
|
} else {
|
||||||
|
setModal(false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} />
|
} />
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -45,8 +45,10 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onCheck() {
|
function onCheck() {
|
||||||
if (Object.values(touched).some((v) => v == true))
|
const cek = checkAll()
|
||||||
|
if (!cek) {
|
||||||
return false
|
return false
|
||||||
|
}
|
||||||
createData()
|
createData()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +60,15 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
|
|||||||
} else {
|
} else {
|
||||||
setTouched({ ...touched, name: false })
|
setTouched({ ...touched, name: false })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkAll() {
|
||||||
|
if (namaGroup == "" || namaGroup.length < 3) {
|
||||||
|
setTouched({ ...touched, name: true })
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -102,7 +112,7 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
|
|||||||
}}
|
}}
|
||||||
error={
|
error={
|
||||||
touched.name &&
|
touched.name &&
|
||||||
(namaGroup == "" ? "Error! harus memasukkan grup" :
|
(namaGroup == "" ? "Grup Tidak Boleh Kosong" :
|
||||||
namaGroup.length < 3 ? "Masukkan Minimal 3 karakter" : ""
|
namaGroup.length < 3 ? "Masukkan Minimal 3 karakter" : ""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ export default function EditDrawerGroup({ onUpdated, id, isActive, }: { onUpdate
|
|||||||
}}
|
}}
|
||||||
error={
|
error={
|
||||||
touched.name &&
|
touched.name &&
|
||||||
(name == "" ? "Error! harus memasukkan grup" :
|
(name == "" ? "Grup Tidak Boleh Kosong" :
|
||||||
name.length < 3 ? "Masukkan Minimal 3 karakter" : ""
|
name.length < 3 ? "Masukkan Minimal 3 karakter" : ""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export default function DrawerDetailPosition({ onUpdated, id, isActive }: {
|
|||||||
const [isModal, setModal] = useState(false)
|
const [isModal, setModal] = useState(false)
|
||||||
const refresh = useHookstate(globalRefreshPosition)
|
const refresh = useHookstate(globalRefreshPosition)
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
|
const [loadingEdit, setLoadingEdit] = useState(false)
|
||||||
const tema = useHookstate(TEMA)
|
const tema = useHookstate(TEMA)
|
||||||
const [data, setData] = useState<any>({
|
const [data, setData] = useState<any>({
|
||||||
id: id,
|
id: id,
|
||||||
@@ -27,7 +28,6 @@ export default function DrawerDetailPosition({ onUpdated, id, isActive }: {
|
|||||||
const [listGroup, setListGorup] = useState<IDataPosition[]>([])
|
const [listGroup, setListGorup] = useState<IDataPosition[]>([])
|
||||||
const [touched, setTouched] = useState({
|
const [touched, setTouched] = useState({
|
||||||
name: false,
|
name: false,
|
||||||
idGroup: false
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function onCLose() {
|
function onCLose() {
|
||||||
@@ -70,6 +70,7 @@ export default function DrawerDetailPosition({ onUpdated, id, isActive }: {
|
|||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
try {
|
try {
|
||||||
|
setLoadingEdit(true)
|
||||||
const res = await funEditPosition(id, {
|
const res = await funEditPosition(id, {
|
||||||
name: data.name,
|
name: data.name,
|
||||||
idGroup: data.idGroup
|
idGroup: data.idGroup
|
||||||
@@ -88,6 +89,8 @@ export default function DrawerDetailPosition({ onUpdated, id, isActive }: {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error('Error');
|
toast.error('Error');
|
||||||
toast.error("Edit jabatan gagal, coba lagi nanti");
|
toast.error("Edit jabatan gagal, coba lagi nanti");
|
||||||
|
} finally {
|
||||||
|
setLoadingEdit(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,20 +101,20 @@ export default function DrawerDetailPosition({ onUpdated, id, isActive }: {
|
|||||||
|
|
||||||
function onCheck() {
|
function onCheck() {
|
||||||
if (Object.values(touched).some((v) => v == true))
|
if (Object.values(touched).some((v) => v == true))
|
||||||
return false
|
return false
|
||||||
onSubmit()
|
onSubmit()
|
||||||
}
|
}
|
||||||
|
|
||||||
function onValidation(kategori: string, val: string) {
|
function onValidation(kategori: string, val: string) {
|
||||||
if (kategori == 'name') {
|
if (kategori == 'name') {
|
||||||
setData({...data, name: val})
|
setData({ ...data, name: val })
|
||||||
if (val == "" || val.length < 3) {
|
if (val == "" || val.length < 3) {
|
||||||
setTouched({ ...touched, name: true })
|
setTouched({ ...touched, name: true })
|
||||||
} else {
|
} else {
|
||||||
setTouched({ ...touched, name: false })
|
setTouched({ ...touched, name: false })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function nonActive(val: boolean) {
|
async function nonActive(val: boolean) {
|
||||||
try {
|
try {
|
||||||
@@ -189,13 +192,12 @@ export default function DrawerDetailPosition({ onUpdated, id, isActive }: {
|
|||||||
size="md"
|
size="md"
|
||||||
value={String(data.name)}
|
value={String(data.name)}
|
||||||
onChange={(e) => { onValidation('name', e.target.value) }}
|
onChange={(e) => { onValidation('name', e.target.value) }}
|
||||||
onBlur={() => setTouched({ ...touched, name: true })}
|
|
||||||
error={
|
error={
|
||||||
touched.name &&
|
touched.name &&
|
||||||
(data.name == "" ? "Error! harus memasukkan Nama Jabatan" :
|
(data.name == "" ? "Error! harus memasukkan Nama Jabatan" :
|
||||||
data.name.length < 3 ? "Masukkan Minimal 3 karakter" : ""
|
data.name.length < 3 ? "Masukkan Minimal 3 karakter" : ""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
radius={10}
|
radius={10}
|
||||||
placeholder="Nama Jabatan"
|
placeholder="Nama Jabatan"
|
||||||
/>
|
/>
|
||||||
@@ -208,7 +210,8 @@ export default function DrawerDetailPosition({ onUpdated, id, isActive }: {
|
|||||||
size="lg"
|
size="lg"
|
||||||
radius={30}
|
radius={30}
|
||||||
fullWidth
|
fullWidth
|
||||||
onClick={onSubmit}
|
onClick={() => { onCheck() }}
|
||||||
|
loading={loadingEdit}
|
||||||
>
|
>
|
||||||
EDIT
|
EDIT
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { globalRefreshPosition } from "../lib/val_posisition";
|
|||||||
export default function DrawerListPosition({ onCreated }: { onCreated: (val: boolean) => void }) {
|
export default function DrawerListPosition({ onCreated }: { onCreated: (val: boolean) => void }) {
|
||||||
const roleLogin = useHookstate(globalRole)
|
const roleLogin = useHookstate(globalRole)
|
||||||
const [openDrawerGroup, setOpenDrawerGroup] = useState(false)
|
const [openDrawerGroup, setOpenDrawerGroup] = useState(false)
|
||||||
|
const [loadingSave, setLoadingSave] = useState(false)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [listGroup, setListGorup] = useState<IDataGroup[]>([])
|
const [listGroup, setListGorup] = useState<IDataGroup[]>([])
|
||||||
const refresh = useHookstate(globalRefreshPosition)
|
const refresh = useHookstate(globalRefreshPosition)
|
||||||
@@ -52,6 +53,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
|
|||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
try {
|
try {
|
||||||
|
setLoadingSave(true)
|
||||||
const res = await funCreatePosition({
|
const res = await funCreatePosition({
|
||||||
name: listData.name,
|
name: listData.name,
|
||||||
idGroup: listData.idGroup
|
idGroup: listData.idGroup
|
||||||
@@ -70,23 +72,41 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
|
|||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error('Error')
|
toast.error('Error')
|
||||||
|
} finally {
|
||||||
|
setLoadingSave(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onCheck() {
|
function onCheck() {
|
||||||
if (Object.values(touched).some((v) => v == true))
|
const check = checkAll()
|
||||||
return false
|
if (!check)
|
||||||
|
return false
|
||||||
onSubmit()
|
onSubmit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkAll() {
|
||||||
|
let nilai = true
|
||||||
|
if (listData.name == "" || listData.name.length < 3) {
|
||||||
|
setTouched(touched => ({ ...touched, name: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (roleLogin.get() == "supadmin" && listData.idGroup == "") {
|
||||||
|
setTouched(touched => ({ ...touched, idGroup: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
|
||||||
|
return nilai
|
||||||
|
}
|
||||||
|
|
||||||
function onValidation(kategori: string, val: string) {
|
function onValidation(kategori: string, val: string) {
|
||||||
if (kategori == 'name') {
|
if (kategori == 'name') {
|
||||||
setListData({...listData, name: val})
|
setListData({ ...listData, name: val })
|
||||||
if (val == "" || val.length < 3) {
|
if (val == "" || val.length < 3) {
|
||||||
setTouched({ ...touched, name: true })
|
setTouched({ ...touched, name: true })
|
||||||
} else {
|
} else {
|
||||||
setTouched({ ...touched, name: false })
|
setTouched({ ...touched, name: false })
|
||||||
}
|
}
|
||||||
} else if (kategori == 'idGroup') {
|
} else if (kategori == 'idGroup') {
|
||||||
setListData({ ...listData, idGroup: val })
|
setListData({ ...listData, idGroup: val })
|
||||||
if (val == "") {
|
if (val == "") {
|
||||||
@@ -95,7 +115,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
|
|||||||
setTouched({ ...touched, idGroup: false })
|
setTouched({ ...touched, idGroup: false })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
@@ -130,7 +150,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
|
|||||||
sm: "67vh",
|
sm: "67vh",
|
||||||
lg: "67vh",
|
lg: "67vh",
|
||||||
xl: "70vh"
|
xl: "70vh"
|
||||||
|
|
||||||
}}>
|
}}>
|
||||||
{
|
{
|
||||||
roleLogin.get() == "supadmin" &&
|
roleLogin.get() == "supadmin" &&
|
||||||
@@ -149,8 +169,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
|
|||||||
radius={10}
|
radius={10}
|
||||||
mb={5}
|
mb={5}
|
||||||
withAsterisk
|
withAsterisk
|
||||||
onChange={(e: any) =>
|
onChange={(e: any) => { onValidation('idGroup', e) }
|
||||||
{ onValidation('idGroup', e) }
|
|
||||||
}
|
}
|
||||||
styles={{
|
styles={{
|
||||||
input: {
|
input: {
|
||||||
@@ -185,7 +204,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
|
|||||||
(listData.name == "" ? "Error! harus memasukkan Nama Jabatan" :
|
(listData.name == "" ? "Error! harus memasukkan Nama Jabatan" :
|
||||||
listData.name.length < 3 ? "Masukkan Minimal 3 karakter" : ""
|
listData.name.length < 3 ? "Masukkan Minimal 3 karakter" : ""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<Box pos={"absolute"} bottom={10} left={0} right={0}>
|
<Box pos={"absolute"} bottom={10} left={0} right={0}>
|
||||||
@@ -196,6 +215,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
|
|||||||
radius={30}
|
radius={30}
|
||||||
fullWidth
|
fullWidth
|
||||||
onClick={() => { onCheck() }}
|
onClick={() => { onCheck() }}
|
||||||
|
loading={loadingSave}
|
||||||
>
|
>
|
||||||
SIMPAN
|
SIMPAN
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,25 +1,26 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { globalRole, TEMA, WARNA } from "@/module/_global";
|
import { globalRole, TEMA } from "@/module/_global";
|
||||||
import LayoutModal from "@/module/_global/layout/layout_modal";
|
import LayoutModal from "@/module/_global/layout/layout_modal";
|
||||||
|
import { funGetUserByCookies } from "@/module/auth";
|
||||||
import { funGetAllGroup, IDataGroup } from "@/module/group";
|
import { funGetAllGroup, IDataGroup } from "@/module/group";
|
||||||
|
import { funGetAllPosition } from "@/module/position/lib/api_position";
|
||||||
|
import { useHookstate } from "@hookstate/core";
|
||||||
import { Avatar, Box, Button, Indicator, rem, Select, Stack, Text, TextInput } from "@mantine/core";
|
import { Avatar, Box, Button, Indicator, rem, Select, Stack, Text, TextInput } from "@mantine/core";
|
||||||
|
import { Dropzone } from "@mantine/dropzone";
|
||||||
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
import _ from "lodash";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useRef, useState } from "react";
|
import { useRef, useState } from "react";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { IDataPositionMember, IDataROleMember } from "../lib/type_member";
|
|
||||||
import { funGetAllPosition } from "@/module/position/lib/api_position";
|
|
||||||
import { funCreateMember } from "../lib/api_member";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { useHookstate } from "@hookstate/core";
|
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
|
||||||
import { funGetUserByCookies } from "@/module/auth";
|
|
||||||
import { valueRoleUser } from "../../lib/val_user";
|
|
||||||
import { FaCamera } from "react-icons/fa6";
|
import { FaCamera } from "react-icons/fa6";
|
||||||
import { Dropzone } from "@mantine/dropzone";
|
import { valueRoleUser } from "../../lib/val_user";
|
||||||
|
import { funCreateMember } from "../lib/api_member";
|
||||||
|
import { IDataPositionMember, IDataROleMember } from "../lib/type_member";
|
||||||
|
|
||||||
export default function CreateMember() {
|
export default function CreateMember() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [isModal, setModal] = useState(false);
|
const [isModal, setModal] = useState(false);
|
||||||
|
const [loadingKonfirmasi, setLoadingKonfirmasi] = useState(false);
|
||||||
const [listGroup, setListGorup] = useState<IDataGroup[]>([]);
|
const [listGroup, setListGorup] = useState<IDataGroup[]>([]);
|
||||||
const [listPosition, setListPosition] = useState<IDataPositionMember[]>([]);
|
const [listPosition, setListPosition] = useState<IDataPositionMember[]>([]);
|
||||||
const [listUserRole, setListUserRole] = useState<IDataROleMember[]>([]);
|
const [listUserRole, setListUserRole] = useState<IDataROleMember[]>([]);
|
||||||
@@ -100,37 +101,33 @@ export default function CreateMember() {
|
|||||||
|
|
||||||
async function onSubmit(val: boolean) {
|
async function onSubmit(val: boolean) {
|
||||||
try {
|
try {
|
||||||
if (_.isEmpty(listData)) {
|
setLoadingKonfirmasi(true)
|
||||||
return;
|
const fd = new FormData()
|
||||||
}
|
fd.append("file", imgForm)
|
||||||
if (val) {
|
fd.append("data", JSON.stringify(
|
||||||
const fd = new FormData()
|
{
|
||||||
fd.append("file", imgForm)
|
nik: listData.nik,
|
||||||
fd.append("data", JSON.stringify(
|
name: listData.name,
|
||||||
{
|
phone: listData.phone,
|
||||||
nik: listData.nik,
|
email: listData.email,
|
||||||
name: listData.name,
|
gender: listData.gender,
|
||||||
phone: listData.phone,
|
idGroup: listData.idGroup,
|
||||||
email: listData.email,
|
idPosition: listData.idPosition,
|
||||||
gender: listData.gender,
|
idUserRole: listData.idUserRole,
|
||||||
idGroup: listData.idGroup,
|
|
||||||
idPosition: listData.idPosition,
|
|
||||||
idUserRole: listData.idUserRole,
|
|
||||||
}
|
|
||||||
))
|
|
||||||
const res = await funCreateMember(fd);
|
|
||||||
if (res.success) {
|
|
||||||
toast.success(res.message);
|
|
||||||
setModal(false);
|
|
||||||
router.push("/member?active=true");
|
|
||||||
} else {
|
|
||||||
toast.error(res.message);
|
|
||||||
}
|
}
|
||||||
|
))
|
||||||
|
const res = await funCreateMember(fd);
|
||||||
|
if (res.success) {
|
||||||
|
toast.success(res.message);
|
||||||
|
router.push("/member?active=true");
|
||||||
|
} else {
|
||||||
|
toast.error(res.message);
|
||||||
}
|
}
|
||||||
setModal(false);
|
setModal(false);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error("Error");
|
toast.error("Error");
|
||||||
} finally {
|
} finally {
|
||||||
|
setLoadingKonfirmasi(false)
|
||||||
setModal(false);
|
setModal(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -142,12 +139,61 @@ export default function CreateMember() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
function onCheck() {
|
function onCheck() {
|
||||||
if (Object.values(touched).some((v) => v == true))
|
const cek = checkAll()
|
||||||
|
if (!cek)
|
||||||
return false
|
return false
|
||||||
setModal(true)
|
setModal(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
function onValidation(kategori: string, val: string) {
|
function checkAll() {
|
||||||
|
let nilai = true
|
||||||
|
|
||||||
|
if (listData.nik === "" || listData.nik.length !== 16) {
|
||||||
|
setTouched(touched => ({ ...touched, nik: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listData.name === "") {
|
||||||
|
setTouched(touched => ({ ...touched, name: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listData.phone == "" || !(listData.phone.length >= 10 && listData.phone.length <= 15)) {
|
||||||
|
setTouched(touched => ({ ...touched, phone: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listData.email == "" || !/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(listData.email)) {
|
||||||
|
setTouched(touched => ({ ...touched, email: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listData.gender == "" || String(listData.gender) == "null") {
|
||||||
|
setTouched(touched => ({ ...touched, gender: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (roleLogin.get() == "supadmin" && (listData.idGroup == "" || String(listData.idGroup) == "null")) {
|
||||||
|
setTouched(touched => ({ ...touched, idGroup: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listData.idPosition === "" || String(listData.idPosition) == "null") {
|
||||||
|
setTouched(touched => ({ ...touched, idPosition: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listData.idUserRole === "" || String(listData.idUserRole) == "null") {
|
||||||
|
setTouched(touched => ({ ...touched, idUserRole: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
|
||||||
|
return nilai
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function onValidation(kategori: string, val: any) {
|
||||||
if (kategori == 'nik') {
|
if (kategori == 'nik') {
|
||||||
setListData({ ...listData, nik: val })
|
setListData({ ...listData, nik: val })
|
||||||
if (val === "" || val.length !== 16) {
|
if (val === "" || val.length !== 16) {
|
||||||
@@ -178,28 +224,28 @@ export default function CreateMember() {
|
|||||||
}
|
}
|
||||||
} else if (kategori == 'gender') {
|
} else if (kategori == 'gender') {
|
||||||
setListData({ ...listData, gender: val })
|
setListData({ ...listData, gender: val })
|
||||||
if (val == "" || val == "null") {
|
if (val == "" || String(val) == "null") {
|
||||||
setTouched({ ...touched, gender: true })
|
setTouched({ ...touched, gender: true })
|
||||||
} else {
|
} else {
|
||||||
setTouched({ ...touched, gender: false })
|
setTouched({ ...touched, gender: false })
|
||||||
}
|
}
|
||||||
} else if (kategori == 'idGroup') {
|
} else if (kategori == 'idGroup') {
|
||||||
setListData({ ...listData, idGroup: val, idPosition: "", })
|
setListData(listData => ({ ...listData, idGroup: val, }))
|
||||||
if (val === "") {
|
if (val === "" || String(val) == "null") {
|
||||||
setTouched({ ...touched, idGroup: true })
|
setTouched(touched => ({ ...touched, idGroup: true }))
|
||||||
} else {
|
} else {
|
||||||
setTouched({ ...touched, idGroup: false })
|
setTouched({ ...touched, idGroup: false })
|
||||||
}
|
}
|
||||||
} else if (kategori == 'idPosition') {
|
} else if (kategori == 'idPosition') {
|
||||||
setListData({ ...listData, idPosition: val })
|
setListData(listData => ({ ...listData, idPosition: val }))
|
||||||
if (val === "") {
|
if (val === "" || String(val) == "null") {
|
||||||
setTouched({ ...touched, idPosition: true })
|
setTouched(touched => ({ ...touched, idPosition: true }))
|
||||||
} else {
|
} else {
|
||||||
setTouched({ ...touched, idPosition: false })
|
setTouched({ ...touched, idPosition: false })
|
||||||
}
|
}
|
||||||
} else if (kategori == 'idUserRole') {
|
} else if (kategori == 'idUserRole') {
|
||||||
setListData({ ...listData, idUserRole: val })
|
setListData({ ...listData, idUserRole: val })
|
||||||
if (val === "") {
|
if (val === "" || String(val) == "null") {
|
||||||
setTouched({ ...touched, idUserRole: true })
|
setTouched({ ...touched, idUserRole: true })
|
||||||
} else {
|
} else {
|
||||||
setTouched({ ...touched, idUserRole: false })
|
setTouched({ ...touched, idUserRole: false })
|
||||||
@@ -210,6 +256,7 @@ export default function CreateMember() {
|
|||||||
async function changeGrup(val: any) {
|
async function changeGrup(val: any) {
|
||||||
setListPosition([]);
|
setListPosition([]);
|
||||||
onValidation('idGroup', val)
|
onValidation('idGroup', val)
|
||||||
|
onValidation('idPosition', '')
|
||||||
getAllPosition(val);
|
getAllPosition(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,7 +316,7 @@ export default function CreateMember() {
|
|||||||
onChange={(val: any) => { changeGrup(val) }}
|
onChange={(val: any) => { changeGrup(val) }}
|
||||||
error={
|
error={
|
||||||
touched.idGroup && (
|
touched.idGroup && (
|
||||||
listData.idGroup == "" ? "Grup Tidak Boleh Kosong" : null
|
listData.idGroup == "" || String(listData.idGroup) == "null" ? "Grup Tidak Boleh Kosong" : null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -301,7 +348,7 @@ export default function CreateMember() {
|
|||||||
value={listData.idPosition == "" ? null : listData.idPosition}
|
value={listData.idPosition == "" ? null : listData.idPosition}
|
||||||
error={
|
error={
|
||||||
touched.idPosition && (
|
touched.idPosition && (
|
||||||
listData.idPosition == "" ? "Jabatan Tidak Boleh Kosong" : null
|
listData.idPosition == "" || String(listData.idPosition) == "null" ? "Jabatan Tidak Boleh Kosong" : null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -331,7 +378,7 @@ export default function CreateMember() {
|
|||||||
onChange={(val: any) => { onValidation('idUserRole', val) }}
|
onChange={(val: any) => { onValidation('idUserRole', val) }}
|
||||||
error={
|
error={
|
||||||
touched.idUserRole && (
|
touched.idUserRole && (
|
||||||
listData.idUserRole == "" ? "Role Tidak Boleh Kosong" : null
|
listData.idUserRole == "" || String(listData.idUserRole) == "null" ? "Role Tidak Boleh Kosong" : null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -449,7 +496,7 @@ export default function CreateMember() {
|
|||||||
onChange={(val: any) => { onValidation('gender', val) }}
|
onChange={(val: any) => { onValidation('gender', val) }}
|
||||||
error={
|
error={
|
||||||
touched.gender && (
|
touched.gender && (
|
||||||
listData.gender == "" ? "Jenis Kelamin Tidak Boleh Kosong" : null
|
listData.gender == "" || String(listData.gender == "null") ? "Jenis Kelamin Tidak Boleh Kosong" : null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -471,11 +518,16 @@ export default function CreateMember() {
|
|||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
<LayoutModal
|
<LayoutModal
|
||||||
|
loading={loadingKonfirmasi}
|
||||||
opened={isModal}
|
opened={isModal}
|
||||||
onClose={() => setModal(false)}
|
onClose={() => setModal(false)}
|
||||||
description="Apakah Anda yakin ingin menambahkan data?"
|
description="Apakah Anda yakin ingin menambahkan data?"
|
||||||
onYes={(val) => {
|
onYes={(val) => {
|
||||||
onSubmit(val);
|
if (val) {
|
||||||
|
onSubmit(val);
|
||||||
|
} else {
|
||||||
|
setModal(false);
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { globalRole, TEMA, WARNA } from "@/module/_global";
|
import { globalRole, TEMA } from "@/module/_global";
|
||||||
import LayoutModal from "@/module/_global/layout/layout_modal";
|
import LayoutModal from "@/module/_global/layout/layout_modal";
|
||||||
import { funGetAllGroup, IDataGroup } from "@/module/group";
|
import { funGetAllGroup, IDataGroup } from "@/module/group";
|
||||||
import { funGetAllPosition } from "@/module/position/lib/api_position";
|
import { funGetAllPosition } from "@/module/position/lib/api_position";
|
||||||
|
import { useHookstate } from "@hookstate/core";
|
||||||
import { Avatar, Box, Button, Indicator, rem, Select, Skeleton, Stack, Text, TextInput } from "@mantine/core";
|
import { Avatar, Box, Button, Indicator, rem, Select, Skeleton, Stack, Text, TextInput } from "@mantine/core";
|
||||||
|
import { Dropzone } from "@mantine/dropzone";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
import _ from "lodash";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useRef, useState } from "react";
|
import { useRef, useState } from "react";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { HiUser } from "react-icons/hi2";
|
|
||||||
import { IDataPositionMember, IDataROleMember, IEditDataMember, IFormMember } from "../lib/type_member";
|
|
||||||
import { funEditMember, funGetOneMember, funGetRoleUser } from "../lib/api_member";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { Dropzone } from "@mantine/dropzone";
|
|
||||||
import { FaCamera } from "react-icons/fa6";
|
import { FaCamera } from "react-icons/fa6";
|
||||||
import { useHookstate } from "@hookstate/core";
|
|
||||||
import { valueRoleUser } from "../../lib/val_user";
|
import { valueRoleUser } from "../../lib/val_user";
|
||||||
|
import { funEditMember, funGetOneMember } from "../lib/api_member";
|
||||||
|
import { IDataPositionMember, IDataROleMember, IEditDataMember } from "../lib/type_member";
|
||||||
|
|
||||||
|
|
||||||
export default function EditMember({ id }: { id: string }) {
|
export default function EditMember({ id }: { id: string }) {
|
||||||
const [isModal, setModal] = useState(false)
|
const [isModal, setModal] = useState(false)
|
||||||
|
const [loadingKonfirmasi, setLoadingKonfirmasi] = useState(false)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [listGroup, setListGorup] = useState<IDataGroup[]>([])
|
const [listGroup, setListGorup] = useState<IDataGroup[]>([])
|
||||||
const [listPosition, setListPosition] = useState<IDataPositionMember[]>([])
|
const [listPosition, setListPosition] = useState<IDataPositionMember[]>([])
|
||||||
@@ -111,26 +111,24 @@ export default function EditMember({ id }: { id: string }) {
|
|||||||
|
|
||||||
async function onSubmit(val: boolean) {
|
async function onSubmit(val: boolean) {
|
||||||
try {
|
try {
|
||||||
if (_.isEmpty(data)) {
|
setLoadingKonfirmasi(true)
|
||||||
return
|
const fd = new FormData()
|
||||||
|
fd.append("file", imgForm)
|
||||||
|
fd.append("data", JSON.stringify(data))
|
||||||
|
|
||||||
|
const res = await funEditMember(id, fd)
|
||||||
|
|
||||||
|
if (res.success) {
|
||||||
|
toast.success(res.message)
|
||||||
|
router.push(`/member?active=true`)
|
||||||
|
} else {
|
||||||
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
if (val) {
|
|
||||||
const fd = new FormData()
|
|
||||||
fd.append("file", imgForm)
|
|
||||||
fd.append("data", JSON.stringify(data))
|
|
||||||
|
|
||||||
const res = await funEditMember(id, fd)
|
|
||||||
|
|
||||||
if (res.success) {
|
|
||||||
toast.success(res.message)
|
|
||||||
router.push(`/member?active=true`)
|
|
||||||
} else {
|
|
||||||
toast.error(res.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error('Error');
|
toast.error('Error');
|
||||||
|
} finally {
|
||||||
|
setLoadingKonfirmasi(false)
|
||||||
|
setModal(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,21 +169,21 @@ export default function EditMember({ id }: { id: string }) {
|
|||||||
}
|
}
|
||||||
} else if (kategori == 'gender') {
|
} else if (kategori == 'gender') {
|
||||||
setData({ ...data, gender: val })
|
setData({ ...data, gender: val })
|
||||||
if (val == "" || val == "null") {
|
if (val == "" || String(val) == "null") {
|
||||||
setTouched({ ...touched, gender: true })
|
setTouched({ ...touched, gender: true })
|
||||||
} else {
|
} else {
|
||||||
setTouched({ ...touched, gender: false })
|
setTouched({ ...touched, gender: false })
|
||||||
}
|
}
|
||||||
} else if (kategori == 'idPosition') {
|
} else if (kategori == 'idPosition') {
|
||||||
setData({ ...data, idPosition: val })
|
setData({ ...data, idPosition: val })
|
||||||
if (val === "") {
|
if (val === "" || String(val) == "null") {
|
||||||
setTouched({ ...touched, idPosition: true })
|
setTouched({ ...touched, idPosition: true })
|
||||||
} else {
|
} else {
|
||||||
setTouched({ ...touched, idPosition: false })
|
setTouched({ ...touched, idPosition: false })
|
||||||
}
|
}
|
||||||
} else if (kategori == 'idUserRole') {
|
} else if (kategori == 'idUserRole') {
|
||||||
setData({ ...data, idUserRole: val })
|
setData({ ...data, idUserRole: val })
|
||||||
if (val === "") {
|
if (val === "" || String(val) == "null") {
|
||||||
setTouched({ ...touched, idUserRole: true })
|
setTouched({ ...touched, idUserRole: true })
|
||||||
} else {
|
} else {
|
||||||
setTouched({ ...touched, idUserRole: false })
|
setTouched({ ...touched, idUserRole: false })
|
||||||
@@ -267,7 +265,7 @@ export default function EditMember({ id }: { id: string }) {
|
|||||||
value={(data?.idPosition == "") ? null : data.idPosition}
|
value={(data?.idPosition == "") ? null : data.idPosition}
|
||||||
error={
|
error={
|
||||||
touched.idPosition && (
|
touched.idPosition && (
|
||||||
data.idPosition == "" ? "Jabatan Tidak Boleh Kosong" : null
|
data.idPosition == "" || String(data.idPosition) == "null" ? "Jabatan Tidak Boleh Kosong" : null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -292,7 +290,7 @@ export default function EditMember({ id }: { id: string }) {
|
|||||||
value={data?.idUserRole}
|
value={data?.idUserRole}
|
||||||
error={
|
error={
|
||||||
touched.idUserRole && (
|
touched.idUserRole && (
|
||||||
data.idUserRole == "" ? "Role Tidak Boleh Kosong" : null
|
data.idUserRole == "" || String(data.idUserRole) == "null" ? "Role Tidak Boleh Kosong" : null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -325,7 +323,6 @@ export default function EditMember({ id }: { id: string }) {
|
|||||||
}}
|
}}
|
||||||
onChange={(e) => { onValidation('name', e.target.value) }}
|
onChange={(e) => { onValidation('name', e.target.value) }}
|
||||||
value={data.name}
|
value={data.name}
|
||||||
onBlur={() => setTouched({ ...touched, name: true })}
|
|
||||||
error={
|
error={
|
||||||
touched.name && (
|
touched.name && (
|
||||||
data.name == "" ? "Nama Tidak Boleh Kosong" : null
|
data.name == "" ? "Nama Tidak Boleh Kosong" : null
|
||||||
@@ -366,7 +363,7 @@ export default function EditMember({ id }: { id: string }) {
|
|||||||
error={
|
error={
|
||||||
touched.phone && (
|
touched.phone && (
|
||||||
data.phone == "" ? "Nomor Telepon Tidak Boleh Kosong" :
|
data.phone == "" ? "Nomor Telepon Tidak Boleh Kosong" :
|
||||||
data.phone.length < 10 ? "Nomor Telepon harus 10 digit" : null
|
data.phone.length < 10 ? "Nomor Telepon Tidak Valid" : null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -395,7 +392,7 @@ export default function EditMember({ id }: { id: string }) {
|
|||||||
value={data.gender}
|
value={data.gender}
|
||||||
error={
|
error={
|
||||||
touched.gender && (
|
touched.gender && (
|
||||||
data.gender == "" ? "Gender Tidak Boleh Kosong" : null
|
data.gender == "" || String(data.gender) == "null" ? "Gender Tidak Boleh Kosong" : null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -422,12 +419,14 @@ export default function EditMember({ id }: { id: string }) {
|
|||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
</Box>
|
</Box>
|
||||||
<LayoutModal opened={isModal} onClose={() => setModal(false)}
|
<LayoutModal loading={loadingKonfirmasi} opened={isModal} onClose={() => setModal(false)}
|
||||||
description="Apakah Anda yakin ingin mengubah data?"
|
description="Apakah Anda yakin ingin mengubah data?"
|
||||||
onYes={(val) => {
|
onYes={(val) => {
|
||||||
if (val)
|
if (val) {
|
||||||
onSubmit(val)
|
onSubmit(val)
|
||||||
setModal(false)
|
} else {
|
||||||
|
setModal(false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} />
|
} />
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Reference in New Issue
Block a user