upd: user
Deskripsi: - update validasi tambah anggota - loading buttom save tambah anggota - update validasi edit anggota - loading buttom save edit anggota No Issues
This commit is contained in:
@@ -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