chore: adjust secondayButton onClick

This commit is contained in:
ValdiANS
2026-01-26 22:20:19 +07:00
parent 273810804d
commit 97a753133e
@@ -180,6 +180,7 @@ const TransferToLayingConfirmationModalTable = ({
expanded={true} expanded={true}
getSubRows={(row) => row.subRows} getSubRows={(row) => row.subRows}
className={{ className={{
headerRowClassName: 'border-b border-base-content/10',
bodyRowClassName: 'border-none', bodyRowClassName: 'border-none',
bodySubRowClassName: () => 'border-none', bodySubRowClassName: () => 'border-none',
bodySubRowColumnClassName: () => 'first:p-0', bodySubRowColumnClassName: () => 'first:p-0',
@@ -199,6 +200,7 @@ const TransferToLayingConfirmationModal = ({
noteLabel, noteLabel,
placeholder = 'Alasan Transfer', placeholder = 'Alasan Transfer',
primaryButton, primaryButton,
secondaryButton,
...props ...props
}: TransferToLayingConfirmationModalProps) => { }: TransferToLayingConfirmationModalProps) => {
const randomId = useId(); const randomId = useId();
@@ -224,19 +226,35 @@ const TransferToLayingConfirmationModal = ({
text: primaryButton?.text ?? 'Oke', text: primaryButton?.text ?? 'Oke',
color: primaryButton?.color ?? 'primary', color: primaryButton?.color ?? 'primary',
className: 'rounded-lg', className: 'rounded-lg',
onClick: () => { onClick: (e) => {
if (withNote) { if (withNote) {
primaryButton?.onClick?.(notes); primaryButton?.onClick?.(notes);
} else if (primaryButton && primaryButton?.onClick) {
primaryButton?.onClick?.('');
} else { } else {
closeModalHandler(); closeModalHandler();
} }
setNotes('');
}, },
}} }}
secondaryButton={{ secondaryButton={
text: 'Cancel', secondaryButton
color: 'none', ? {
onClick: closeModalHandler, text: secondaryButton?.text ?? 'Cancel',
}} color: secondaryButton?.color ?? 'none',
onClick: (e) => {
if (secondaryButton && secondaryButton?.onClick) {
secondaryButton.onClick?.(e);
} else {
closeModalHandler();
}
setNotes('');
},
}
: undefined
}
className={{ className={{
modalBox: 'max-h-full', modalBox: 'max-h-full',
}} }}