vasuzex 2.1.19 → 2.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -42,7 +42,10 @@ export function RowActionsCell({
|
|
|
42
42
|
}) {
|
|
43
43
|
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
44
44
|
const menuRef = useRef(null);
|
|
45
|
-
|
|
45
|
+
|
|
46
|
+
// Determine which approval actions to show based on current status
|
|
47
|
+
const showApprove = hasApproval && (row.approval_status === 'pending' || row.approval_status === 'rejected');
|
|
48
|
+
const showReject = hasApproval && (row.approval_status === 'pending' || row.approval_status === 'approved');
|
|
46
49
|
|
|
47
50
|
// Close menu when clicking outside
|
|
48
51
|
useEffect(() => {
|
|
@@ -106,10 +109,10 @@ export function RowActionsCell({
|
|
|
106
109
|
|
|
107
110
|
{isMenuOpen && (
|
|
108
111
|
<div className="absolute right-0 mt-1 w-48 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 z-50 py-1">
|
|
109
|
-
{/* Approval Actions -
|
|
110
|
-
{
|
|
112
|
+
{/* Approval Actions - Show based on current status */}
|
|
113
|
+
{(showApprove || showReject) && (
|
|
111
114
|
<>
|
|
112
|
-
{onApprove && (
|
|
115
|
+
{showApprove && onApprove && (
|
|
113
116
|
<button
|
|
114
117
|
onClick={() => {
|
|
115
118
|
onApprove(row);
|
|
@@ -118,10 +121,10 @@ export function RowActionsCell({
|
|
|
118
121
|
className="w-full flex items-center gap-3 px-4 py-2 text-sm text-emerald-700 hover:bg-emerald-50 dark:text-emerald-400 dark:hover:bg-emerald-950/30"
|
|
119
122
|
>
|
|
120
123
|
<CheckCircle className="h-4 w-4" />
|
|
121
|
-
<span>Approve</span>
|
|
124
|
+
<span>{row.approval_status === 'rejected' ? 'Re-approve' : 'Approve'}</span>
|
|
122
125
|
</button>
|
|
123
126
|
)}
|
|
124
|
-
{onReject && (
|
|
127
|
+
{showReject && onReject && (
|
|
125
128
|
<button
|
|
126
129
|
onClick={() => {
|
|
127
130
|
onReject(row);
|
|
@@ -130,7 +133,7 @@ export function RowActionsCell({
|
|
|
130
133
|
className="w-full flex items-center gap-3 px-4 py-2 text-sm text-rose-700 hover:bg-rose-50 dark:text-rose-400 dark:hover:bg-rose-950/30"
|
|
131
134
|
>
|
|
132
135
|
<XCircle className="h-4 w-4" />
|
|
133
|
-
<span>Reject</span>
|
|
136
|
+
<span>{row.approval_status === 'approved' ? 'Revoke/Reject' : 'Reject'}</span>
|
|
134
137
|
</button>
|
|
135
138
|
)}
|
|
136
139
|
<div className="border-t border-gray-200 dark:border-gray-700 my-1" />
|