TAT calculation enhanced
This commit is contained in:
parent
3c9d7cb620
commit
7d5b93ae50
@ -835,6 +835,14 @@ function RequestDetailInner({
|
||||
return null;
|
||||
}, [requestIdentifier, dynamicRequests, apiRequest]);
|
||||
|
||||
// Check if current user is the initiator
|
||||
const isInitiator = useMemo(() => {
|
||||
if (!request || !user) return false;
|
||||
const userEmail = (user as any)?.email?.toLowerCase();
|
||||
const initiatorEmail = request.initiator?.email?.toLowerCase();
|
||||
return userEmail === initiatorEmail;
|
||||
}, [request, user]);
|
||||
|
||||
// Get all existing participants for validation
|
||||
const existingParticipants = useMemo(() => {
|
||||
if (!request) return [];
|
||||
@ -1558,8 +1566,8 @@ function RequestDetailInner({
|
||||
</p>
|
||||
)}
|
||||
|
||||
{/* Skip Approver Button - Only show for pending/in-review levels */}
|
||||
{(isActive || step.status === 'pending') && !isCompleted && !isRejected && step.levelId && (
|
||||
{/* Skip Approver Button - Only show for initiator on pending/in-review levels */}
|
||||
{isInitiator && (isActive || step.status === 'pending') && !isCompleted && !isRejected && step.levelId && (
|
||||
<div className="mt-2 sm:mt-3 pt-2 sm:pt-3 border-t border-gray-200">
|
||||
<Button
|
||||
variant="outline"
|
||||
@ -1860,7 +1868,8 @@ function RequestDetailInner({
|
||||
<CardTitle className="text-sm sm:text-base">Quick Actions</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-2">
|
||||
{!isSpectator && (
|
||||
{/* Only initiator can add approvers */}
|
||||
{isInitiator && (
|
||||
<Button
|
||||
variant="outline"
|
||||
className="w-full justify-start gap-2 bg-white text-gray-700 border-gray-300 hover:bg-gray-50 hover:text-gray-900 h-9 sm:h-10 text-xs sm:text-sm"
|
||||
@ -1870,6 +1879,7 @@ function RequestDetailInner({
|
||||
Add Approver
|
||||
</Button>
|
||||
)}
|
||||
{/* Non-spectators can add spectators */}
|
||||
{!isSpectator && (
|
||||
<Button
|
||||
variant="outline"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user