feat(FE-170,174): enhance approval and rejection modals to include notes input

This commit is contained in:
rstubryan
2025-11-19 20:07:26 +07:00
parent 539b329b6f
commit 42253d123b
@@ -10,6 +10,7 @@ import { useModal } from '@/components/Modal';
import Modal from '@/components/Modal';
import Button from '@/components/Button';
import ConfirmationModal from '@/components/modal/ConfirmationModal';
import ConfirmationModalWithNotes from '@/components/modal/ConfirmationModalWithNotes';
import { OptionType } from '@/components/input/SelectInput';
import SelectInput from '@/components/input/SelectInput';
import DebouncedTextInput from '@/components/input/DebouncedTextInput';
@@ -455,7 +456,7 @@ const RecordingTable = () => {
setIsDeleteLoading(false);
};
const approveHandler = async () => {
const approveHandler = async (notes: string) => {
setIsApproveLoading(true);
if (eligibleRowIds.length === 0) {
@@ -468,7 +469,7 @@ const RecordingTable = () => {
const approveResponse = await RecordingApi.approve(
eligibleRowIds,
approvalNotes
notes
);
if (isResponseSuccess(approveResponse)) {
@@ -488,7 +489,7 @@ const RecordingTable = () => {
setIsApproveLoading(false);
};
const rejectHandler = async () => {
const rejectHandler = async (notes: string) => {
setIsRejectLoading(true);
if (eligibleRowIds.length === 0) {
@@ -501,7 +502,7 @@ const RecordingTable = () => {
const rejectResponse = await RecordingApi.reject(
eligibleRowIds,
approvalNotes
notes
);
if (isResponseSuccess(rejectResponse)) {
@@ -964,7 +965,7 @@ const RecordingTable = () => {
}}
/>
<ConfirmationModal
<ConfirmationModalWithNotes
ref={approveModal.ref}
type='success'
text={`Apakah anda yakin ingin approve data recording ini (${eligibleRowIds.length} data dari ${selectedRowIds.length} yang dipilih)?`}
@@ -978,17 +979,11 @@ const RecordingTable = () => {
isLoading: isApproveLoading,
onClick: approveHandler,
}}
>
<TextArea
name='approvalNotes'
placeholder='(Opsional) Tambahkan catatan untuk approval ini...'
value={approvalNotes}
onChange={(e) => setApprovalNotes(e.target.value)}
rows={3}
/>
</ConfirmationModal>
placeholder='(Opsional) Tambahkan catatan untuk approval ini...'
rows={3}
/>
<ConfirmationModal
<ConfirmationModalWithNotes
ref={rejectModal.ref}
type='error'
text={`Apakah anda yakin ingin reject data recording ini (${eligibleRowIds.length} data dari ${selectedRowIds.length} yang dipilih)?`}
@@ -1002,15 +997,9 @@ const RecordingTable = () => {
isLoading: isRejectLoading,
onClick: rejectHandler,
}}
>
<TextArea
name='rejectNotes'
placeholder='(Opsional) Tambahkan catatan untuk reject ini...'
value={approvalNotes}
onChange={(e) => setApprovalNotes(e.target.value)}
rows={3}
/>
</ConfirmationModal>
placeholder='(Opsional) Tambahkan catatan untuk reject ini...'
rows={3}
/>
<ApprovalHistoryModal
ref={approvalHistoryModal.ref}