mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 23:05:24 +02:00
feat: add Business Central CPNP sync and expand history access
- Add bc-proxy and bc-export serverless API handlers - Add businessCentral service with updateCpnpNoInBC and downloadBusinessCentralItemsExcel - Sync cpnpNo to BC on save (CosmeticItemsView and handleSaveAll) - Parallelize handleSaveAll with Promise.all - Fix array index key, a11y click/keyboard handlers, autoFocus - Grant Change History and Pending Validation access to jingying.shi@craze-group.com Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
co-authored by
claude-flow
parent
2961d3f86a
commit
9b5932920e
@@ -1,11 +1,12 @@
|
||||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { Download, LogOut, Undo2, CloudUpload, Loader2, ChevronDown, RotateCcw, Maximize2, X } from 'lucide-react';
|
||||
import { Download, LogOut, Undo2, CloudUpload, Loader2, ChevronDown, RotateCcw, Maximize2, X, CloudDownload } from 'lucide-react';
|
||||
import { cn } from '../lib/utils';
|
||||
|
||||
interface TopBarProps {
|
||||
stats: any;
|
||||
activeModule?: string;
|
||||
onExport: () => void;
|
||||
onDownloadBCExcel: () => void;
|
||||
onRefresh?: () => void;
|
||||
hasData: boolean;
|
||||
hasUnsavedChanges: boolean;
|
||||
@@ -20,11 +21,12 @@ interface TopBarProps {
|
||||
onSaveAll: () => Promise<void>;
|
||||
onRevertRow: (articleNo: string) => void;
|
||||
isSavingAll: boolean;
|
||||
isDownloadingBCExcel: boolean;
|
||||
isMaximized: boolean;
|
||||
onToggleMaximize: () => void;
|
||||
}
|
||||
|
||||
export function TopBar({ stats, activeModule, onExport, onRefresh, hasData, hasUnsavedChanges, userEmail, onSignOut, canUndo, onUndo, undoMessage, undoSteps, pendingCount, pendingChanges, onSaveAll, onRevertRow, isSavingAll, isMaximized, onToggleMaximize }: TopBarProps) {
|
||||
export function TopBar({ stats, activeModule, onExport, onDownloadBCExcel, onRefresh, hasData, hasUnsavedChanges, userEmail, onSignOut, canUndo, onUndo, undoMessage, undoSteps, pendingCount, pendingChanges, onSaveAll, onRevertRow, isSavingAll, isDownloadingBCExcel, isMaximized, onToggleMaximize }: TopBarProps) {
|
||||
const [showPending, setShowPending] = useState(false);
|
||||
const dropdownRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
@@ -170,6 +172,21 @@ export function TopBar({ stats, activeModule, onExport, onRefresh, hasData, hasU
|
||||
</button>
|
||||
)}
|
||||
|
||||
<button
|
||||
onClick={onDownloadBCExcel}
|
||||
disabled={isDownloadingBCExcel}
|
||||
className={cn(
|
||||
'flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors',
|
||||
isDownloadingBCExcel
|
||||
? 'bg-slate-700 text-slate-400 cursor-wait'
|
||||
: 'bg-slate-700 hover:bg-slate-600 text-slate-200'
|
||||
)}
|
||||
title="Download the latest table directly from Business Central"
|
||||
>
|
||||
{isDownloadingBCExcel ? <Loader2 className="w-4 h-4 animate-spin" /> : <CloudDownload className="w-4 h-4" />}
|
||||
Download BC Excel
|
||||
</button>
|
||||
|
||||
{onRefresh && (
|
||||
<button
|
||||
onClick={onRefresh}
|
||||
|
||||
Reference in New Issue
Block a user