mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 07:45:47 +00:00
feat(FE-170,174): enhance approval and rejection modals to include notes input
This commit is contained in:
@@ -10,6 +10,7 @@ import { useModal } from '@/components/Modal';
|
|||||||
import Modal from '@/components/Modal';
|
import Modal from '@/components/Modal';
|
||||||
import Button from '@/components/Button';
|
import Button from '@/components/Button';
|
||||||
import ConfirmationModal from '@/components/modal/ConfirmationModal';
|
import ConfirmationModal from '@/components/modal/ConfirmationModal';
|
||||||
|
import ConfirmationModalWithNotes from '@/components/modal/ConfirmationModalWithNotes';
|
||||||
import { OptionType } from '@/components/input/SelectInput';
|
import { OptionType } from '@/components/input/SelectInput';
|
||||||
import SelectInput from '@/components/input/SelectInput';
|
import SelectInput from '@/components/input/SelectInput';
|
||||||
import DebouncedTextInput from '@/components/input/DebouncedTextInput';
|
import DebouncedTextInput from '@/components/input/DebouncedTextInput';
|
||||||
@@ -455,7 +456,7 @@ const RecordingTable = () => {
|
|||||||
setIsDeleteLoading(false);
|
setIsDeleteLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const approveHandler = async () => {
|
const approveHandler = async (notes: string) => {
|
||||||
setIsApproveLoading(true);
|
setIsApproveLoading(true);
|
||||||
|
|
||||||
if (eligibleRowIds.length === 0) {
|
if (eligibleRowIds.length === 0) {
|
||||||
@@ -468,7 +469,7 @@ const RecordingTable = () => {
|
|||||||
|
|
||||||
const approveResponse = await RecordingApi.approve(
|
const approveResponse = await RecordingApi.approve(
|
||||||
eligibleRowIds,
|
eligibleRowIds,
|
||||||
approvalNotes
|
notes
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isResponseSuccess(approveResponse)) {
|
if (isResponseSuccess(approveResponse)) {
|
||||||
@@ -488,7 +489,7 @@ const RecordingTable = () => {
|
|||||||
setIsApproveLoading(false);
|
setIsApproveLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const rejectHandler = async () => {
|
const rejectHandler = async (notes: string) => {
|
||||||
setIsRejectLoading(true);
|
setIsRejectLoading(true);
|
||||||
|
|
||||||
if (eligibleRowIds.length === 0) {
|
if (eligibleRowIds.length === 0) {
|
||||||
@@ -501,7 +502,7 @@ const RecordingTable = () => {
|
|||||||
|
|
||||||
const rejectResponse = await RecordingApi.reject(
|
const rejectResponse = await RecordingApi.reject(
|
||||||
eligibleRowIds,
|
eligibleRowIds,
|
||||||
approvalNotes
|
notes
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isResponseSuccess(rejectResponse)) {
|
if (isResponseSuccess(rejectResponse)) {
|
||||||
@@ -964,7 +965,7 @@ const RecordingTable = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ConfirmationModal
|
<ConfirmationModalWithNotes
|
||||||
ref={approveModal.ref}
|
ref={approveModal.ref}
|
||||||
type='success'
|
type='success'
|
||||||
text={`Apakah anda yakin ingin approve data recording ini (${eligibleRowIds.length} data dari ${selectedRowIds.length} yang dipilih)?`}
|
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,
|
isLoading: isApproveLoading,
|
||||||
onClick: approveHandler,
|
onClick: approveHandler,
|
||||||
}}
|
}}
|
||||||
>
|
placeholder='(Opsional) Tambahkan catatan untuk approval ini...'
|
||||||
<TextArea
|
rows={3}
|
||||||
name='approvalNotes'
|
/>
|
||||||
placeholder='(Opsional) Tambahkan catatan untuk approval ini...'
|
|
||||||
value={approvalNotes}
|
|
||||||
onChange={(e) => setApprovalNotes(e.target.value)}
|
|
||||||
rows={3}
|
|
||||||
/>
|
|
||||||
</ConfirmationModal>
|
|
||||||
|
|
||||||
<ConfirmationModal
|
<ConfirmationModalWithNotes
|
||||||
ref={rejectModal.ref}
|
ref={rejectModal.ref}
|
||||||
type='error'
|
type='error'
|
||||||
text={`Apakah anda yakin ingin reject data recording ini (${eligibleRowIds.length} data dari ${selectedRowIds.length} yang dipilih)?`}
|
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,
|
isLoading: isRejectLoading,
|
||||||
onClick: rejectHandler,
|
onClick: rejectHandler,
|
||||||
}}
|
}}
|
||||||
>
|
placeholder='(Opsional) Tambahkan catatan untuk reject ini...'
|
||||||
<TextArea
|
rows={3}
|
||||||
name='rejectNotes'
|
/>
|
||||||
placeholder='(Opsional) Tambahkan catatan untuk reject ini...'
|
|
||||||
value={approvalNotes}
|
|
||||||
onChange={(e) => setApprovalNotes(e.target.value)}
|
|
||||||
rows={3}
|
|
||||||
/>
|
|
||||||
</ConfirmationModal>
|
|
||||||
|
|
||||||
<ApprovalHistoryModal
|
<ApprovalHistoryModal
|
||||||
ref={approvalHistoryModal.ref}
|
ref={approvalHistoryModal.ref}
|
||||||
|
|||||||
Reference in New Issue
Block a user