fix(tksafety): 작업별 항목 표시 안 되는 버그 — check_type 'task' vs 'work_type' 불일치 수정
DB에 저장된 check_type='task'를 프론트에서 'work_type'으로 필터링하여 매칭 0건. HTML option value와 JS 필터를 모두 'task'로 통일. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -110,7 +110,7 @@
|
|||||||
<select id="itemType" class="input-field w-full px-3 py-2 rounded-lg text-sm" required>
|
<select id="itemType" class="input-field w-full px-3 py-2 rounded-lg text-sm" required>
|
||||||
<option value="basic">기본</option>
|
<option value="basic">기본</option>
|
||||||
<option value="weather">날씨별</option>
|
<option value="weather">날씨별</option>
|
||||||
<option value="work_type">작업별</option>
|
<option value="task">작업별</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<!-- 날씨 조건 (weather type only) -->
|
<!-- 날씨 조건 (weather type only) -->
|
||||||
@@ -162,7 +162,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/tksafety-core.js?v=3"></script>
|
<script src="/static/js/tksafety-core.js?v=3"></script>
|
||||||
<script src="/static/js/tksafety-checklist.js?v=2"></script>
|
<script src="/static/js/tksafety-checklist.js?v=3"></script>
|
||||||
<script>initChecklistPage();</script>
|
<script>initChecklistPage();</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ function renderWeatherItems() {
|
|||||||
|
|
||||||
/* ===== Render worktype items (2-level: work_type → task) ===== */
|
/* ===== Render worktype items (2-level: work_type → task) ===== */
|
||||||
function renderWorktypeItems() {
|
function renderWorktypeItems() {
|
||||||
const items = checklistItems.filter(i => i.item_type === 'work_type');
|
const items = checklistItems.filter(i => i.item_type === 'task');
|
||||||
const container = document.getElementById('worktypeItemsList');
|
const container = document.getElementById('worktypeItemsList');
|
||||||
if (!items.length) {
|
if (!items.length) {
|
||||||
container.innerHTML = '<div class="text-center text-gray-400 py-8">작업별 항목이 없습니다</div>';
|
container.innerHTML = '<div class="text-center text-gray-400 py-8">작업별 항목이 없습니다</div>';
|
||||||
@@ -208,7 +208,7 @@ function openAddItem(tab) {
|
|||||||
document.getElementById('itemDisplayOrder').value = '0';
|
document.getElementById('itemDisplayOrder').value = '0';
|
||||||
|
|
||||||
// Set type based on tab
|
// Set type based on tab
|
||||||
const typeMap = { basic: 'basic', weather: 'weather', worktype: 'work_type' };
|
const typeMap = { basic: 'basic', weather: 'weather', worktype: 'task' };
|
||||||
document.getElementById('itemType').value = typeMap[tab] || 'basic';
|
document.getElementById('itemType').value = typeMap[tab] || 'basic';
|
||||||
toggleTypeFields();
|
toggleTypeFields();
|
||||||
|
|
||||||
@@ -251,9 +251,9 @@ function closeItemModal() {
|
|||||||
function toggleTypeFields() {
|
function toggleTypeFields() {
|
||||||
const type = document.getElementById('itemType').value;
|
const type = document.getElementById('itemType').value;
|
||||||
document.getElementById('weatherConditionField').classList.toggle('hidden', type !== 'weather');
|
document.getElementById('weatherConditionField').classList.toggle('hidden', type !== 'weather');
|
||||||
document.getElementById('workTypeField').classList.toggle('hidden', type !== 'work_type');
|
document.getElementById('workTypeField').classList.toggle('hidden', type !== 'task');
|
||||||
// Hide task field when type changes away from work_type
|
// Hide task field when type changes away from task
|
||||||
if (type !== 'work_type') {
|
if (type !== 'task') {
|
||||||
document.getElementById('taskField').classList.add('hidden');
|
document.getElementById('taskField').classList.add('hidden');
|
||||||
} else {
|
} else {
|
||||||
// Show task field if work type is already selected
|
// Show task field if work type is already selected
|
||||||
@@ -281,7 +281,7 @@ async function submitItem(e) {
|
|||||||
data.weather_condition_id = parseInt(document.getElementById('itemWeatherCondition').value) || null;
|
data.weather_condition_id = parseInt(document.getElementById('itemWeatherCondition').value) || null;
|
||||||
if (!data.weather_condition_id) { showToast('날씨 조건을 선택해주세요', 'error'); return; }
|
if (!data.weather_condition_id) { showToast('날씨 조건을 선택해주세요', 'error'); return; }
|
||||||
}
|
}
|
||||||
if (data.item_type === 'work_type') {
|
if (data.item_type === 'task') {
|
||||||
const taskId = parseInt(document.getElementById('itemTask').value) || null;
|
const taskId = parseInt(document.getElementById('itemTask').value) || null;
|
||||||
if (!taskId) { showToast('작업을 선택해주세요', 'error'); return; }
|
if (!taskId) { showToast('작업을 선택해주세요', 'error'); return; }
|
||||||
data.task_id = taskId;
|
data.task_id = taskId;
|
||||||
|
|||||||
Reference in New Issue
Block a user