upd: tolak nama divisi yg sama
Deskripsi: - akan ditolak jika input nama divisi udah ada - alert konfirmasi custom 1 tombol No Issues
This commit is contained in:
@@ -69,10 +69,9 @@ export default function CreateDivision() {
|
|||||||
if (!response.available) {
|
if (!response.available) {
|
||||||
AlertKonfirmasi({
|
AlertKonfirmasi({
|
||||||
title: 'Peringatan',
|
title: 'Peringatan',
|
||||||
desc: 'Nama divisi sudah ada. Apakah anda yakin ingin membuat divisi dengan nama yang sama?',
|
category: 'warning',
|
||||||
onPress: () => {
|
desc: 'Nama divisi sudah ada. Tidak dapat membuat divisi dengan nama yang sama',
|
||||||
handleSetData()
|
onPress: () => { }
|
||||||
}
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
handleSetData()
|
handleSetData()
|
||||||
|
|||||||
@@ -5,17 +5,27 @@ type Props = {
|
|||||||
title: string,
|
title: string,
|
||||||
desc: string
|
desc: string
|
||||||
onPress: () => void
|
onPress: () => void
|
||||||
|
category?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function AlertKonfirmasi({ title, desc, onPress }: Props) {
|
export default function AlertKonfirmasi({ title, desc, onPress, category }: Props) {
|
||||||
Alert.alert(title, desc, [
|
if (category == "warning") {
|
||||||
{
|
Alert.alert(title, desc, [
|
||||||
text: 'Tidak',
|
{
|
||||||
style: 'cancel',
|
text: 'Oke',
|
||||||
},
|
style: 'cancel',
|
||||||
{
|
},
|
||||||
text: 'Ya',
|
]);
|
||||||
onPress: () => { onPress() }
|
} else {
|
||||||
},
|
Alert.alert(title, desc, [
|
||||||
]);
|
{
|
||||||
|
text: 'Tidak',
|
||||||
|
style: 'cancel',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Ya',
|
||||||
|
onPress: () => { onPress() }
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user