diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-09-26 09:57:24 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-09-26 09:57:24 +0000 |
| commit | 8b23b471638a155fd1bfa3a8c853b26d9315b272 (patch) | |
| tree | 47353e9dd342011cb2f1dcd24b09661707a8421b /components/docu-list-rule/docu-list-rule-client.tsx | |
| parent | d62368d2b68d73da895977e60a18f9b1286b0545 (diff) | |
(대표님) 권한관리, 문서업로드, rfq첨부, SWP문서룰 등
(최겸) 입찰
Diffstat (limited to 'components/docu-list-rule/docu-list-rule-client.tsx')
| -rw-r--r-- | components/docu-list-rule/docu-list-rule-client.tsx | 80 |
1 files changed, 11 insertions, 69 deletions
diff --git a/components/docu-list-rule/docu-list-rule-client.tsx b/components/docu-list-rule/docu-list-rule-client.tsx index 7e6c2bb1..ae3cdece 100644 --- a/components/docu-list-rule/docu-list-rule-client.tsx +++ b/components/docu-list-rule/docu-list-rule-client.tsx @@ -1,15 +1,7 @@ "use client" import * as React from "react" import { useRouter, useParams } from "next/navigation" - -import { getProjectLists } from "@/lib/projects/service" -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@/components/ui/select" +import { ProjectSelector } from "../ProjectSelector" interface DocuListRuleClientProps { children: React.ReactNode @@ -38,10 +30,6 @@ export default function DocuListRuleClient({ projectIdFromUrl ) - // 프로젝트 목록 상태 - const [projects, setProjects] = React.useState<Array<{ id: number; code: string; name: string; type: string }>>([]) - const [isLoading, setIsLoading] = React.useState(true) - // Update selectedProjectId when URL changes React.useEffect(() => { if (projectIdFromUrl) { @@ -49,40 +37,6 @@ export default function DocuListRuleClient({ } }, [projectIdFromUrl]) - // 프로젝트 목록 로드 - React.useEffect(() => { - const loadProjects = async () => { - try { - setIsLoading(true) - console.log("Loading projects...") - const result = await getProjectLists({ - page: 1, - perPage: 1000, - search: "", - sort: [], - filters: [], - joinOperator: "and", - flags: [], - code: "", - name: "", - type: "" - }) - console.log("Projects result:", result) - if (result.data) { - // plant 타입의 프로젝트만 필터링 - const plantProjects = result.data.filter(project => project.type === 'plant') - console.log("Plant projects:", plantProjects) - setProjects(plantProjects) - } - } catch (error) { - console.error("Failed to load projects:", error) - } finally { - setIsLoading(false) - } - } - loadProjects() - }, []) - // Handle project selection function handleSelectProject(projectId: number) { console.log("Selecting project:", projectId) @@ -107,28 +61,16 @@ export default function DocuListRuleClient({ </div> {/* 오른쪽: ProjectSwitcher */} - <div className="flex items-center space-x-2"> - <Select - value={selectedProjectId ? String(selectedProjectId) : ""} - onValueChange={(value) => { - const projectId = Number(value) - if (projectId) { - handleSelectProject(projectId) - } + <div className="flex items-center space-x-2 max-w-[400px]"> + <ProjectSelector + selectedProjectId={selectedProjectId} + onProjectSelect={(project) => { + handleSelectProject(project.id) }} - disabled={isLoading} - > - <SelectTrigger className="max-w-[300px] whitespace-nowrap overflow-hidden text-ellipsis"> - <SelectValue placeholder={isLoading ? "프로젝트 로딩 중..." : "프로젝트를 선택하세요"} /> - </SelectTrigger> - <SelectContent> - {projects.map((project) => ( - <SelectItem key={project.id} value={String(project.id)}> - {project.code} - {project.name} - </SelectItem> - ))} - </SelectContent> - </Select> + placeholder="프로젝트를 선택하세요" + filterType="plant" // 명시적으로 plant 타입만 (선택사항, 기본값이 plant) + + /> </div> </div> @@ -138,4 +80,4 @@ export default function DocuListRuleClient({ </section> </> ) -} +}
\ No newline at end of file |
