diff options
Diffstat (limited to 'lib/vendor-document-list/table/send-to-shi-button.tsx')
| -rw-r--r-- | lib/vendor-document-list/table/send-to-shi-button.tsx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/vendor-document-list/table/send-to-shi-button.tsx b/lib/vendor-document-list/table/send-to-shi-button.tsx index e0360144..1a27a794 100644 --- a/lib/vendor-document-list/table/send-to-shi-button.tsx +++ b/lib/vendor-document-list/table/send-to-shi-button.tsx @@ -28,22 +28,26 @@ interface SendToSHIButtonProps { contractId: number documents?: EnhancedDocument[] onSyncComplete?: () => void + projectType: "ship" | "plant" } export function SendToSHIButton({ contractId, documents = [], - onSyncComplete + onSyncComplete, + projectType }: SendToSHIButtonProps) { const [isDialogOpen, setIsDialogOpen] = React.useState(false) const [syncProgress, setSyncProgress] = React.useState(0) + + const targetSystem = projectType === 'ship'?"DOLCE":"SWP" const { syncStatus, isLoading: statusLoading, error: statusError, refetch: refetchStatus - } = useSyncStatus(contractId, 'SHI') + } = useSyncStatus(contractId, targetSystem) const { triggerSync, @@ -71,7 +75,7 @@ export function SendToSHIButton({ const result = await triggerSync({ contractId, - targetSystem: 'SHI' + targetSystem }) clearInterval(progressInterval) @@ -152,10 +156,11 @@ export function SendToSHIButton({ <> <Popover> <PopoverTrigger asChild> + <div className="flex items-center gap-3"> <Button variant="default" size="sm" - className="gap-2 relative bg-blue-600 hover:bg-blue-700" + className="flex items-center bg-blue-600 hover:bg-blue-700" disabled={isSyncing || statusLoading} > {isSyncing ? ( @@ -167,12 +172,13 @@ export function SendToSHIButton({ {syncStatus?.pendingChanges > 0 && ( <Badge variant="destructive" - className="absolute -top-2 -right-2 h-5 w-5 p-0 text-xs flex items-center justify-center" + className="h-5 w-5 p-0 text-xs flex items-center justify-center" > {syncStatus.pendingChanges} </Badge> )} </Button> + </div> </PopoverTrigger> <PopoverContent className="w-80"> |
