- tambah komponen ModalRiwayatApproval dan ModalTolakApproval - update itemSectionTanggalTugas untuk mendukung status menunggu persetujuan - update sectionTanggalTugas (project) dan sectionTanggalTugasTask (divisi) dengan alur approval lengkap - tambah API approval project task dan division task di lib/api.ts - tambah toggle approver di headerMemberDetail dan tampilkan badge approver di detail member - update carouselHome untuk dispatch isApprover ke Redux - update drawerBottom untuk mendukung scroll pada modal - ganti label 'Belum dimulai' menjadi 'Belum ada tugas yang diselesaikan'
79 lines
2.1 KiB
TypeScript
79 lines
2.1 KiB
TypeScript
import Styles from "@/constants/Styles"
|
|
import { useTheme } from "@/providers/ThemeProvider"
|
|
import { useState } from "react"
|
|
import { TouchableOpacity, View } from "react-native"
|
|
import DrawerBottom from "./drawerBottom"
|
|
import { InputForm } from "./inputForm"
|
|
import Text from "./Text"
|
|
|
|
type Props = {
|
|
isVisible: boolean
|
|
setVisible: (value: boolean) => void
|
|
onTolak: (note: string) => void
|
|
loading?: boolean
|
|
}
|
|
|
|
export default function ModalTolakApproval({ isVisible, setVisible, onTolak, loading }: Props) {
|
|
const { colors } = useTheme()
|
|
const [note, setNote] = useState('')
|
|
const [error, setError] = useState(false)
|
|
|
|
function handleClose(value: boolean) {
|
|
setNote('')
|
|
setError(false)
|
|
setVisible(value)
|
|
}
|
|
|
|
function handleSubmit() {
|
|
if (!note.trim()) {
|
|
setError(true)
|
|
return
|
|
}
|
|
onTolak(note.trim())
|
|
setNote('')
|
|
setError(false)
|
|
}
|
|
|
|
return (
|
|
<DrawerBottom
|
|
isVisible={isVisible}
|
|
setVisible={handleClose}
|
|
title="Tolak Tugas"
|
|
animation="slide"
|
|
height={45}
|
|
keyboard
|
|
>
|
|
<View style={{ flex: 1 }}>
|
|
<InputForm
|
|
label="Alasan Penolakan"
|
|
placeholder="Tuliskan alasan penolakan..."
|
|
type="default"
|
|
multiline
|
|
bg="transparent"
|
|
value={note}
|
|
onChange={setNote}
|
|
error={error}
|
|
errorText="Alasan penolakan wajib diisi"
|
|
required
|
|
/>
|
|
</View>
|
|
|
|
<TouchableOpacity
|
|
onPress={handleSubmit}
|
|
disabled={loading}
|
|
style={{
|
|
backgroundColor: loading ? colors.error + '60' : colors.error,
|
|
borderRadius: 30,
|
|
paddingVertical: 10,
|
|
alignItems: 'center',
|
|
marginTop: 8,
|
|
}}
|
|
>
|
|
<Text style={[Styles.textDefaultSemiBold, Styles.cWhite]}>
|
|
{loading ? 'Memproses...' : 'Tolak Tugas'}
|
|
</Text>
|
|
</TouchableOpacity>
|
|
</DrawerBottom>
|
|
)
|
|
}
|