Add environment variable example and update .gitignore
- Created a new .env.example file to provide a template for environment variables, including database connection details, JWT settings, encryption keys, and external API keys. - Updated .gitignore to include additional test output directories and archive files, ensuring that unnecessary files are not tracked by Git. - Removed outdated approval test reports and scripts that are no longer needed, streamlining the project structure. These changes improve the clarity of environment configuration and maintain a cleaner repository.
This commit is contained in:
@@ -100,6 +100,38 @@ function ItemSearchModal({
|
||||
const [items, setItems] = useState<ItemInfo[]>([]);
|
||||
const [selectedItems, setSelectedItems] = useState<Set<string>>(new Set());
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [catLabels, setCatLabels] = useState<Record<string, Record<string, string>>>({});
|
||||
|
||||
// item_info 카테고리 라벨 로드 (division, unit, type)
|
||||
useEffect(() => {
|
||||
const loadLabels = async () => {
|
||||
for (const col of ["division", "unit", "type"]) {
|
||||
try {
|
||||
const res = await apiClient.get(`/table-categories/item_info/${col}/values?includeInactive=true`);
|
||||
const vals = res.data?.data || [];
|
||||
if (vals.length > 0) {
|
||||
const map: Record<string, string> = {};
|
||||
vals.forEach((v: any) => { const code = v.valueCode || v.value_code; const label = v.valueLabel || v.value_label; if (code) map[code] = label; });
|
||||
setCatLabels((prev) => ({ ...prev, [col]: map }));
|
||||
}
|
||||
} catch { /* 무시 */ }
|
||||
}
|
||||
};
|
||||
loadLabels();
|
||||
}, []);
|
||||
|
||||
const resolveCatLabel = (value: string, ...cols: string[]) => {
|
||||
if (!value) return "-";
|
||||
const resolve = (code: string) => {
|
||||
for (const col of cols) { if (catLabels[col]?.[code]) return catLabels[col][code]; }
|
||||
return code;
|
||||
};
|
||||
if (value.includes(",") || value.includes(";")) {
|
||||
const delim = value.includes(";") ? ";" : ",";
|
||||
return value.split(delim).map(s => resolve(s.trim())).filter(Boolean).join(", ");
|
||||
}
|
||||
return resolve(value);
|
||||
};
|
||||
|
||||
const searchItems = useCallback(
|
||||
async (query: string) => {
|
||||
@@ -244,8 +276,8 @@ function ItemSearchModal({
|
||||
{alreadyAdded && <span className="text-muted-foreground ml-1 text-[10px]">(추가됨)</span>}
|
||||
</td>
|
||||
<td className="px-3 py-2">{item.item_name}</td>
|
||||
<td className="px-3 py-2">{item.type}</td>
|
||||
<td className="px-3 py-2">{item.unit}</td>
|
||||
<td className="px-3 py-2">{resolveCatLabel(item.type || "", "division", "type")}</td>
|
||||
<td className="px-3 py-2">{resolveCatLabel(item.unit || "", "unit")}</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user