TAT calculation enhanced
This commit is contained in:
parent
3c9d7cb620
commit
7d5b93ae50
@ -835,6 +835,14 @@ function RequestDetailInner({
|
|||||||
return null;
|
return null;
|
||||||
}, [requestIdentifier, dynamicRequests, apiRequest]);
|
}, [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
|
// Get all existing participants for validation
|
||||||
const existingParticipants = useMemo(() => {
|
const existingParticipants = useMemo(() => {
|
||||||
if (!request) return [];
|
if (!request) return [];
|
||||||
@ -1558,8 +1566,8 @@ function RequestDetailInner({
|
|||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Skip Approver Button - Only show for pending/in-review levels */}
|
{/* Skip Approver Button - Only show for initiator on pending/in-review levels */}
|
||||||
{(isActive || step.status === 'pending') && !isCompleted && !isRejected && step.levelId && (
|
{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">
|
<div className="mt-2 sm:mt-3 pt-2 sm:pt-3 border-t border-gray-200">
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
@ -1860,7 +1868,8 @@ function RequestDetailInner({
|
|||||||
<CardTitle className="text-sm sm:text-base">Quick Actions</CardTitle>
|
<CardTitle className="text-sm sm:text-base">Quick Actions</CardTitle>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="space-y-2">
|
<CardContent className="space-y-2">
|
||||||
{!isSpectator && (
|
{/* Only initiator can add approvers */}
|
||||||
|
{isInitiator && (
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
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"
|
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
|
Add Approver
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
{/* Non-spectators can add spectators */}
|
||||||
{!isSpectator && (
|
{!isSpectator && (
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user