diff options
Diffstat (limited to 'components')
| -rw-r--r-- | components/pq-input/pq-input-tabs.tsx | 94 |
1 files changed, 39 insertions, 55 deletions
diff --git a/components/pq-input/pq-input-tabs.tsx b/components/pq-input/pq-input-tabs.tsx index 8d5aa2ab..f0d44d04 100644 --- a/components/pq-input/pq-input-tabs.tsx +++ b/components/pq-input/pq-input-tabs.tsx @@ -822,18 +822,11 @@ export function PQInputTabs({ if (!shouldShowItem(isSaved)) return null return ( - <Collapsible key={criteriaId} defaultOpen={isReadOnly || !isSaved} className="w-full"> <Card className={`${isSaved ? "border-green-200" : ""} h-fit min-h-[400px]`}> <CardHeader className="pb-1"> <div className="flex justify-between"> <div className="flex-1"> <div className="flex items-center gap-2"> - <CollapsibleTrigger asChild> - <Button variant="ghost" size="sm" className="p-0 h-7 w-7"> - <ChevronsUpDown className="h-4 w-4" /> - <span className="sr-only">Toggle</span> - </Button> - </CollapsibleTrigger> <CardTitle className="text-md"> {code} - {checkPoint} </CardTitle> @@ -882,7 +875,6 @@ export function PQInputTabs({ </div> </CardHeader> - <CollapsibleContent> <CardContent className="pt-3 space-y-3 h-full flex flex-col"> {/* 프로젝트별 추가 필드 (contractInfo, additionalRequirement) */} {projectId && contractInfo && ( @@ -1298,9 +1290,7 @@ export function PQInputTabs({ /> </CardContent> - </CollapsibleContent> </Card> - </Collapsible> ) })} </div> @@ -1323,51 +1313,45 @@ export function PQInputTabs({ </DialogHeader> <div className="space-y-4 max-h-[600px] overflow-y-auto "> - {data.map((group) => ( - <Collapsible key={group.groupName} defaultOpen> - <CollapsibleTrigger asChild> - <div className="flex justify-between items-center p-2 mb-1 cursor-pointer "> - <p className="font-semibold">{group.groupName}</p> - <ChevronsUpDown className="h-4 w-4 ml-2" /> - </div> - </CollapsibleTrigger> - - <CollapsibleContent> - {group.items.map((item) => { - const answerObj = form - .getValues() - .answers.find((a) => a.criteriaId === item.criteriaId) - - if (!answerObj) return null - - return ( - <div key={item.criteriaId} className="mb-2 p-2 ml-2 border rounded-md text-sm"> - {/* code & checkPoint */} - <p className="font-semibold"> - {item.code} - {item.checkPoint} - </p> - - {/* user's typed answer */} - <p className="text-sm font-medium mt-2">Answer:</p> - <p className="whitespace-pre-wrap text-sm"> - {answerObj.answer || "(no answer)"} - </p> - {/* attachments */} - <p>Attachments:</p> - {answerObj.uploadedFiles.length > 0 ? ( - <ul className="list-disc list-inside ml-4 text-xs"> - {answerObj.uploadedFiles.map((file, idx) => ( - <li key={idx}>{file.fileName}</li> - ))} - </ul> - ) : ( - <p className="text-xs text-muted-foreground">(none)</p> - )} - </div> - ) - })} - </CollapsibleContent> - </Collapsible> + {data.map((group, groupIndex) => ( + <div key={groupIndex}> + {group.items.map((item) => { + const answerObj = form + .getValues() + .answers.find((a) => a.criteriaId === item.criteriaId); + + if (!answerObj) return null; + + return ( + <div + key={item.criteriaId} + className="mb-2 p-2 ml-2 border rounded-md text-sm" + > + {/* code & checkPoint */} + <p className="font-semibold"> + {item.code} - {item.checkPoint} + </p> + + {/* user's typed answer */} + <p className="text-sm font-medium mt-2">Answer:</p> + <p className="whitespace-pre-wrap text-sm"> + {answerObj.answer || "(no answer)"} + </p> + {/* attachments */} + <p>Attachments:</p> + {answerObj.uploadedFiles && answerObj.uploadedFiles.length > 0 ? ( + <ul className="list-disc list-inside ml-4 text-xs"> + {answerObj.uploadedFiles.map((file, idx) => ( + <li key={idx}>{file.fileName}</li> + ))} + </ul> + ) : ( + <p className="text-xs text-muted-foreground">(none)</p> + )} + </div> + ); + })} + </div> ))} </div> |
