fix : group

Deskripsi:
- validasi tambah group
- validasi edit group
- load refresh modal

No Issues
This commit is contained in:
2025-08-05 15:34:40 +08:00
parent 308fda6920
commit 7470e8a9c2
3 changed files with 32 additions and 19 deletions

View File

@@ -48,9 +48,9 @@ export default function HeaderRightGroupList() {
if (cat === 'title') {
setTitle(val)
if (val == "" || val.length < 3) {
setError({ ...error, title: true })
setError((prev) => ({ ...prev, title: true }))
} else {
setError({ ...error, title: false })
setError((prev) => ({ ...prev, title: false }))
}
}
}
@@ -91,7 +91,7 @@ export default function HeaderRightGroupList() {
/>
</View>
<View>
<ButtonForm text="SIMPAN" onPress={() => { onCheck() }} />
<ButtonForm text="SIMPAN" disabled={Object.values(error).some((v) => v == true) || title == ""} onPress={() => { onCheck() }} />
</View>
</View>
</DrawerBottom>

View File

@@ -9,13 +9,13 @@ import { useAuthSession } from "@/providers/AuthProvider"
import { AntDesign } from "@expo/vector-icons"
import { useEffect, useState } from "react"
import { Pressable, ScrollView, View } from "react-native"
import Text from "./Text";
import { useDispatch, useSelector } from "react-redux"
import { ButtonForm } from "./buttonForm"
import DrawerBottom from "./drawerBottom"
import ImageUser from "./imageNew"
import ImageWithLabel from "./imageWithLabel"
import InputSearch from "./inputSearch"
import Text from "./Text"
type Props = {
open: boolean
@@ -89,8 +89,7 @@ export default function ModalSelect({ open, close, title, category, idParent, on
useEffect(() => {
if (category == 'group') {
if (entitiesGroup.length == 0)
handleLoadGroup()
handleLoadGroup()
setData(entitiesGroup)
} else if (category == 'position') {
handleLoadPosition()
@@ -174,9 +173,9 @@ export default function ModalSelect({ open, close, title, category, idParent, on
{
(category == 'member')
?
selectMember.some((i: any) => i.idUser == item.id) && <AntDesign name="check" size={20} color={'black'}/>
selectMember.some((i: any) => i.idUser == item.id) && <AntDesign name="check" size={20} color={'black'} />
:
chooseValue.val == item.id && <AntDesign name="check" size={20} color={'black'}/>
chooseValue.val == item.id && <AntDesign name="check" size={20} color={'black'} />
}
</Pressable>
))
@@ -192,7 +191,7 @@ export default function ModalSelect({ open, close, title, category, idParent, on
}}>
<Text style={[chooseValue.val == item.val ? Styles.textDefaultSemiBold : Styles.textDefault]}>{item.label}</Text>
{
valChoose == item.val && <AntDesign name="check" size={20} color={'black'}/>
valChoose == item.val && <AntDesign name="check" size={20} color={'black'} />
}
</Pressable>
))