diff --git a/src/components/pages/production/transfer-to-laying/TransferToLayingConfirmationModal.tsx b/src/components/pages/production/transfer-to-laying/TransferToLayingConfirmationModal.tsx index 3cedf839..40c08b01 100644 --- a/src/components/pages/production/transfer-to-laying/TransferToLayingConfirmationModal.tsx +++ b/src/components/pages/production/transfer-to-laying/TransferToLayingConfirmationModal.tsx @@ -180,6 +180,7 @@ const TransferToLayingConfirmationModalTable = ({ expanded={true} getSubRows={(row) => row.subRows} className={{ + headerRowClassName: 'border-b border-base-content/10', bodyRowClassName: 'border-none', bodySubRowClassName: () => 'border-none', bodySubRowColumnClassName: () => 'first:p-0', @@ -199,6 +200,7 @@ const TransferToLayingConfirmationModal = ({ noteLabel, placeholder = 'Alasan Transfer', primaryButton, + secondaryButton, ...props }: TransferToLayingConfirmationModalProps) => { const randomId = useId(); @@ -224,19 +226,35 @@ const TransferToLayingConfirmationModal = ({ text: primaryButton?.text ?? 'Oke', color: primaryButton?.color ?? 'primary', className: 'rounded-lg', - onClick: () => { + onClick: (e) => { if (withNote) { primaryButton?.onClick?.(notes); + } else if (primaryButton && primaryButton?.onClick) { + primaryButton?.onClick?.(''); } else { closeModalHandler(); } + + setNotes(''); }, }} - secondaryButton={{ - text: 'Cancel', - color: 'none', - onClick: closeModalHandler, - }} + secondaryButton={ + secondaryButton + ? { + text: secondaryButton?.text ?? 'Cancel', + color: secondaryButton?.color ?? 'none', + onClick: (e) => { + if (secondaryButton && secondaryButton?.onClick) { + secondaryButton.onClick?.(e); + } else { + closeModalHandler(); + } + + setNotes(''); + }, + } + : undefined + } className={{ modalBox: 'max-h-full', }}