diff options
| author | joonhoekim <26rote@gmail.com> | 2025-11-25 22:04:56 +0900 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-11-25 22:04:56 +0900 |
| commit | 2b59582194fc5c23140f52c42c793c324856a35e (patch) | |
| tree | 0db8ef0e913b3a44dfd6e3e20fe92b8e4984aeba /components/common | |
| parent | 835df8ddc115ffa74414db2a4fab7efc0d0056a9 (diff) | |
(김준회) 벤더풀&AVL 구매 추가요청사항 반영
Diffstat (limited to 'components/common')
6 files changed, 86 insertions, 18 deletions
diff --git a/components/common/discipline-hardcoded/discipline-data.ts b/components/common/discipline-hardcoded/discipline-data.ts new file mode 100644 index 00000000..4910e272 --- /dev/null +++ b/components/common/discipline-hardcoded/discipline-data.ts @@ -0,0 +1,14 @@ +export const HARDCODED_DISCIPLINES = [ + 'ARCHITECTURE', + 'CCS', + 'ELECTRICAL', + 'INSTRUMENT', + 'INSULATION', + 'MACHINERY', + 'MECHANICAL', + 'PIPING', + 'STRUCTURE', + 'SURFACE PROTECTION', +] as const + +export type HardcodedDiscipline = typeof HARDCODED_DISCIPLINES[number] diff --git a/components/common/discipline-hardcoded/discipline-hardcoded-selector.tsx b/components/common/discipline-hardcoded/discipline-hardcoded-selector.tsx new file mode 100644 index 00000000..6de0a285 --- /dev/null +++ b/components/common/discipline-hardcoded/discipline-hardcoded-selector.tsx @@ -0,0 +1,48 @@ +'use client' + +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from '@/components/ui/select' +import { HARDCODED_DISCIPLINES, HardcodedDiscipline } from './discipline-data' + +export interface DisciplineHardcodedSelectorProps { + selectedDiscipline?: string + onDisciplineSelect: (discipline: string) => void + disabled?: boolean + placeholder?: string + className?: string +} + +export function DisciplineHardcodedSelector({ + selectedDiscipline, + onDisciplineSelect, + disabled, + placeholder = "설계공종 선택", + className +}: DisciplineHardcodedSelectorProps) { + + return ( + <Select + value={selectedDiscipline} + onValueChange={onDisciplineSelect} + disabled={disabled} + > + <SelectTrigger className={`w-full ${className || ''}`}> + <SelectValue placeholder={placeholder}> + {selectedDiscipline || <span className="text-muted-foreground">{placeholder}</span>} + </SelectValue> + </SelectTrigger> + <SelectContent> + {HARDCODED_DISCIPLINES.map((discipline) => ( + <SelectItem key={discipline} value={discipline}> + {discipline} + </SelectItem> + ))} + </SelectContent> + </Select> + ) +} diff --git a/components/common/discipline-hardcoded/index.ts b/components/common/discipline-hardcoded/index.ts new file mode 100644 index 00000000..bd55175f --- /dev/null +++ b/components/common/discipline-hardcoded/index.ts @@ -0,0 +1,3 @@ +export * from './discipline-data' +export * from './discipline-hardcoded-selector' + diff --git a/components/common/material/material-group-selector-dialog-single.tsx b/components/common/material/material-group-selector-dialog-single.tsx index bb039d0a..1aeaec33 100644 --- a/components/common/material/material-group-selector-dialog-single.tsx +++ b/components/common/material/material-group-selector-dialog-single.tsx @@ -130,9 +130,9 @@ export function MaterialGroupSelectorDialogSingle({ return ( <Dialog open={open} onOpenChange={handleOpenChange}> <DialogTrigger asChild> - <Button variant={triggerVariant} disabled={disabled}> + <Button variant={triggerVariant} disabled={disabled} className="h-auto whitespace-normal"> {selectedMaterial ? ( - <span className="truncate"> + <span className="whitespace-normal text-left break-words"> {selectedMaterial.displayText} </span> ) : ( diff --git a/components/common/selectors/place-of-shipping/place-of-shipping-selector.tsx b/components/common/selectors/place-of-shipping/place-of-shipping-selector.tsx index 2e9756a0..1d1aaa5e 100644 --- a/components/common/selectors/place-of-shipping/place-of-shipping-selector.tsx +++ b/components/common/selectors/place-of-shipping/place-of-shipping-selector.tsx @@ -236,27 +236,30 @@ export function PlaceOfShippingSelectorDialogSingle({ }, []) useEffect(() => { - const loadData = async () => { - try { - const data = await getPlaceOfShippingForSelection() - setPlaceOfShippingData(data) - } catch (error) { - console.error('선적지/하역지 데이터 로드 실패:', error) - setPlaceOfShippingData([]) - } finally { - setIsLoading(false) + if (open && placeOfShippingData.length === 0) { + const loadData = async () => { + setIsLoading(true) + try { + const data = await getPlaceOfShippingForSelection() + setPlaceOfShippingData(data) + } catch (error) { + console.error('선적지/하역지 데이터 로드 실패:', error) + setPlaceOfShippingData([]) + } finally { + setIsLoading(false) + } } - } - loadData() - }, []) + loadData() + } + }, [open, placeOfShippingData.length]) return ( <Dialog open={open} onOpenChange={handleOpenChange}> <DialogTrigger asChild> - <Button variant={triggerVariant} disabled={disabled}> + <Button variant={triggerVariant} disabled={disabled} className="h-auto whitespace-normal"> {selectedPlace ? ( - <span className="truncate"> + <span className="whitespace-normal text-left break-words"> {selectedPlace.code} - {selectedPlace.description} </span> ) : ( diff --git a/components/common/vendor/vendor-selector-dialog-single.tsx b/components/common/vendor/vendor-selector-dialog-single.tsx index 7bb4b14c..ba4243cf 100644 --- a/components/common/vendor/vendor-selector-dialog-single.tsx +++ b/components/common/vendor/vendor-selector-dialog-single.tsx @@ -135,9 +135,9 @@ export function VendorSelectorDialogSingle({ return ( <Dialog open={open} onOpenChange={handleOpenChange}> <DialogTrigger asChild> - <Button variant={triggerVariant} disabled={disabled}> + <Button variant={triggerVariant} disabled={disabled} className="h-auto whitespace-normal"> {selectedVendor ? ( - <span className="truncate"> + <span className="whitespace-normal text-left break-words"> {selectedVendor.displayText} </span> ) : ( |
