diff options
Diffstat (limited to 'lib/swp/table/swp-table-toolbar.tsx')
| -rw-r--r-- | lib/swp/table/swp-table-toolbar.tsx | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/lib/swp/table/swp-table-toolbar.tsx b/lib/swp/table/swp-table-toolbar.tsx index 594bdd77..08eda3ef 100644 --- a/lib/swp/table/swp-table-toolbar.tsx +++ b/lib/swp/table/swp-table-toolbar.tsx @@ -18,7 +18,7 @@ import { SwpUploadValidationDialog, validateFileName } from "./swp-upload-validation-dialog"; -import { SwpUploadedFilesDialog } from "./swp-uploaded-files-dialog"; +// import { SwpUploadedFilesDialog } from "./swp-uploaded-files-dialog"; import { getDocumentClassInfoByProjectCode } from "@/lib/swp/swp-upload-server-actions"; import type { DocumentListItem } from "@/lib/swp/document-service"; @@ -36,6 +36,7 @@ interface SwpTableToolbarProps { onProjNoChange: (projNo: string) => void; onFiltersChange: (filters: SwpTableFilters) => void; onRefresh: () => void; + onUploadComplete?: () => void; // 업로드 완료 시 콜백 (탭 전환용) isRefreshing: boolean; projects?: Array<{ PROJ_NO: string; PROJ_NM: string | null }>; vendorCode?: string; @@ -51,6 +52,7 @@ export function SwpTableToolbar({ onProjNoChange, onFiltersChange, onRefresh, + onUploadComplete, isRefreshing, projects = [], vendorCode, @@ -322,6 +324,26 @@ export function SwpTableToolbar({ title: result.success ? "업로드 완료" : "일부 업로드 실패", description: result.message, }); + + // 업로드 성공 시 자동 새로고침 (외부 시스템 처리 시간 고려) + if (result.success && result.successCount > 0) { + // 업로드 완료 시 Inbox 탭으로 전환 + onUploadComplete?.(); + + toast({ + title: "문서 목록 갱신 중", + description: "외부 시스템 처리를 기다리는 중입니다...", + }); + + // 2초 딜레이 후 새로고침 + setTimeout(() => { + onRefresh(); + toast({ + title: "갱신 완료", + description: "업로드된 파일이 문서 목록에 반영되었습니다.", + }); + }, 2000); + } } catch (error) { console.error("파일 업로드 실패:", error); @@ -442,6 +464,7 @@ export function SwpTableToolbar({ size="sm" onClick={handleReset} className="h-8" + disabled={isRefreshing} > <X className="h-4 w-4 mr-1" /> 초기화 @@ -460,6 +483,7 @@ export function SwpTableToolbar({ role="combobox" aria-expanded={projectSearchOpen} className="w-full justify-between" + disabled={isRefreshing} > {projNo ? ( <span> @@ -538,6 +562,7 @@ export function SwpTableToolbar({ onChange={(e) => setLocalFilters({ ...localFilters, docNo: e.target.value }) } + disabled={isRefreshing} /> </div> @@ -551,6 +576,7 @@ export function SwpTableToolbar({ onChange={(e) => setLocalFilters({ ...localFilters, docTitle: e.target.value }) } + disabled={isRefreshing} /> </div> @@ -564,6 +590,7 @@ export function SwpTableToolbar({ onChange={(e) => setLocalFilters({ ...localFilters, pkgNo: e.target.value }) } + disabled={isRefreshing} /> </div> @@ -577,6 +604,7 @@ export function SwpTableToolbar({ onChange={(e) => setLocalFilters({ ...localFilters, stage: e.target.value }) } + disabled={isRefreshing} /> </div> @@ -590,14 +618,19 @@ export function SwpTableToolbar({ onChange={(e) => setLocalFilters({ ...localFilters, status: e.target.value }) } + disabled={isRefreshing} /> </div> </div> <div className="flex justify-end"> - <Button onClick={handleSearch} size="sm"> - <Search className="h-4 w-4 mr-2" /> - 검색 + <Button + onClick={handleSearch} + size="sm" + disabled={isRefreshing} + > + <Search className={`h-4 w-4 mr-2 ${isRefreshing ? "animate-spin" : ""}`} /> + {isRefreshing ? "로딩 중..." : "검색"} </Button> </div> </div> |
