feat: [quote] 시뮬레이터 CONTROLLER_TYPE 입력 지원

- CONTROLLER_TYPE select 드롭다운 추가 (매립형/노출형/일체형)
- 문자열 입력값 지원 (isNaN 체크로 숫자/문자열 구분)
This commit is contained in:
2025-12-04 16:23:27 +09:00
parent fe10cae06c
commit 51f898981d

View File

@@ -189,18 +189,47 @@ function renderInputFields() {
vars.forEach(v => {
const defaultValue = v.default_value || '';
html += `
<div>
<label class="block text-sm font-medium text-gray-700 mb-1" title="${v.description || ''}">
${v.variable}
<span class="text-gray-400 font-normal">${v.name ? `(${v.name})` : ''}</span>
</label>
// TYPE이 포함된 변수는 문자열 입력 (select 또는 text)
const isTextInput = v.variable.includes('TYPE') || v.variable.includes('_CODE');
let inputHtml = '';
if (isTextInput && v.variable === 'CONTROLLER_TYPE') {
// 제어기 유형은 select로 표시
inputHtml = `
<select name="${v.variable}"
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="">선택하세요</option>
<option value="매립형">매립형</option>
<option value="노출형">노출형</option>
<option value="일체형">일체형</option>
</select>
`;
} else if (isTextInput) {
inputHtml = `
<input type="text"
name="${v.variable}"
value="${defaultValue}"
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder="${v.variable}">
`;
} else {
inputHtml = `
<input type="number"
name="${v.variable}"
value="${defaultValue}"
step="any"
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder="${v.variable}">
`;
}
html += `
<div>
<label class="block text-sm font-medium text-gray-700 mb-1" title="${v.description || ''}">
${v.variable}
<span class="text-gray-400 font-normal">${v.name ? `(${v.name})` : ''}</span>
</label>
${inputHtml}
</div>
`;
});
@@ -243,7 +272,9 @@ function renderCategoryOrder() {
const inputs = {};
for (const [key, value] of formData.entries()) {
if (value !== '') {
inputs[key] = parseFloat(value);
// 숫자로 변환 가능하면 숫자로, 아니면 문자열로 유지
const numValue = parseFloat(value);
inputs[key] = isNaN(numValue) ? value : numValue;
}
}