updd: announcement
Deskripsi: - edit pengumuman - delete pengumuman No Issues
This commit is contained in:
@@ -14,6 +14,7 @@ type Props = {
|
||||
category: 'share-division' | 'choose-division'
|
||||
choose: string
|
||||
onSelect: (value: any[]) => void
|
||||
value?: any
|
||||
}
|
||||
|
||||
type CheckedState = {
|
||||
@@ -29,7 +30,7 @@ type GroupData = {
|
||||
}[];
|
||||
}
|
||||
|
||||
export default function ModalSelectMultiple({ open, close, title, category, choose, onSelect }: Props) {
|
||||
export default function ModalSelectMultiple({ open, close, title, category, choose, onSelect, value }: Props) {
|
||||
const [isChoose, setChoose] = useState(choose)
|
||||
const { token, decryptToken } = useAuthSession()
|
||||
const [data, setData] = useState<any>([])
|
||||
@@ -40,6 +41,14 @@ export default function ModalSelectMultiple({ open, close, title, category, choo
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetDivisionGroup({ user: hasil })
|
||||
setData(response.data)
|
||||
|
||||
if (value.length > 0) {
|
||||
const formatArray = value.reduce((result: any, obj: any) => {
|
||||
result[obj.id] = obj.Division.map((item: any) => item.id);
|
||||
return result;
|
||||
}, {})
|
||||
setChecked(formatArray)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
@@ -112,7 +121,7 @@ export default function ModalSelectMultiple({ open, close, title, category, choo
|
||||
<Text style={[Styles.textDefaultSemiBold]}>Sosial Kemasyarakatan</Text>
|
||||
<AntDesign name="check" size={20} />
|
||||
</Pressable>
|
||||
<Pressable style={[Styles.itemSelectModal]}>
|
||||
{/* <Pressable style={[Styles.itemSelectModal]}>
|
||||
<Text>Kaur Pemerintahan</Text>
|
||||
</Pressable>
|
||||
<Pressable style={[Styles.itemSelectModal]}>
|
||||
@@ -120,7 +129,7 @@ export default function ModalSelectMultiple({ open, close, title, category, choo
|
||||
</Pressable>
|
||||
<Pressable style={[Styles.itemSelectModal]}>
|
||||
<Text>PKK</Text>
|
||||
</Pressable>
|
||||
</Pressable> */}
|
||||
</>
|
||||
:
|
||||
data.map((item: any, index: number) => {
|
||||
|
||||
Reference in New Issue
Block a user