fix: 부적합 제출 버그 수정 및 UI 개선

- 부적합 API 호출 형식 수정 (카테고리/아이템 추가 시)
- 부적합 저장 시 내부 플래그 제거 후 백엔드 전송
- 기본 부적합 객체 구조 수정 (category_id, item_id 추가)
- 날씨 API 시간대 수정 (UTC → KST 변환)
- 신고 카테고리 관리 페이지 추가 (/pages/admin/issue-categories.html)
- 부적합 입력 UI 개선 (대분류→소분류 캐스케이딩 선택)
- 저장된 부적합 분리 표시 및 수정/삭제 기능
- 디버깅 로그 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-02-03 09:31:26 +09:00
parent 4b158de1eb
commit c42c9f4fa3
29 changed files with 7042 additions and 809 deletions

View File

@@ -8,6 +8,144 @@
margin-bottom: 1.5rem;
}
/* 날짜 그룹 스타일 (접기/펼치기) */
.date-group {
margin-bottom: 1.5rem;
border: 1px solid #e5e7eb;
border-radius: 12px;
overflow: hidden;
background: white;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.date-group-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1rem 1.25rem;
background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
border-bottom: 1px solid #e5e7eb;
cursor: pointer;
transition: background-color 0.2s;
user-select: none;
}
.date-group-header:hover {
background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}
.date-group-header.has-issues {
background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
border-bottom-color: #fde047;
}
.date-group-header.has-issues:hover {
background: linear-gradient(135deg, #fef9c3 0%, #fef08a 100%);
}
.date-header-left {
display: flex;
align-items: center;
gap: 0.75rem;
}
.date-toggle-icon {
font-size: 0.75rem;
color: #64748b;
width: 1rem;
text-align: center;
}
.date-title {
font-weight: 600;
font-size: 1.1rem;
color: #1e293b;
}
.today-badge {
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
color: white;
padding: 0.2rem 0.6rem;
border-radius: 10px;
font-size: 0.7rem;
font-weight: 600;
}
.date-header-center {
display: flex;
gap: 1rem;
}
.date-stat {
font-size: 0.85rem;
color: #64748b;
}
.date-header-right {
display: flex;
align-items: center;
gap: 0.5rem;
}
.date-issue-summary {
display: flex;
gap: 0.5rem;
}
.issue-badge {
padding: 0.25rem 0.6rem;
border-radius: 12px;
font-size: 0.75rem;
font-weight: 600;
}
.issue-badge.nonconformity {
background: #fef2f2;
color: #dc2626;
border: 1px solid #fecaca;
}
.issue-badge.safety {
background: #fefce8;
color: #ca8a04;
border: 1px solid #fde047;
}
.no-issues {
font-size: 0.8rem;
color: #94a3b8;
}
.date-group-content {
padding: 1rem;
background: #fafafa;
}
.date-group.collapsed .date-group-content {
display: none;
}
/* 부적합 버튼 강조 (관련 이슈 있을 때) */
.btn-defect-toggle.has-related-issue {
background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
border-color: #f87171;
color: #dc2626;
animation: pulse-attention 2s infinite;
}
.btn-defect-toggle.has-related-issue:hover {
background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}
@keyframes pulse-attention {
0%, 100% {
box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.4);
}
50% {
box-shadow: 0 0 0 4px rgba(248, 113, 113, 0);
}
}
/* TBM 세션 그룹 스타일 */
.tbm-session-group {
margin-bottom: 2rem;
@@ -55,6 +193,153 @@
font-size: 0.875rem;
}
/* 당일 신고 리마인더 스타일 */
.issue-reminder-section {
background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
border: 1px solid #f59e0b;
border-top: none;
padding: 1rem 1.5rem;
}
.issue-reminder-header {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.75rem;
}
.issue-reminder-icon {
font-size: 1.25rem;
}
.issue-reminder-title {
font-weight: 600;
color: #92400e;
font-size: 0.9375rem;
}
.issue-reminder-count {
background: #f59e0b;
color: white;
padding: 0.125rem 0.5rem;
border-radius: 10px;
font-size: 0.75rem;
font-weight: 600;
}
.issue-reminder-list {
display: flex;
flex-direction: column;
gap: 0.5rem;
margin-bottom: 0.75rem;
}
.issue-reminder-item {
display: flex;
align-items: center;
gap: 0.75rem;
background: white;
padding: 0.5rem 0.75rem;
border-radius: 6px;
font-size: 0.8125rem;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.issue-reminder-item.nonconformity {
border-left: 3px solid #f59e0b;
}
.issue-reminder-item.safety {
border-left: 3px solid #ef4444;
}
.issue-type-badge {
padding: 0.125rem 0.5rem;
border-radius: 4px;
font-size: 0.6875rem;
font-weight: 600;
flex-shrink: 0;
}
.issue-reminder-item.nonconformity .issue-type-badge {
background: #fef3c7;
color: #92400e;
}
.issue-reminder-item.safety .issue-type-badge {
background: #fee2e2;
color: #b91c1c;
}
.issue-category {
color: #6b7280;
font-size: 0.75rem;
flex-shrink: 0;
}
.issue-item {
flex: 1;
color: #374151;
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.issue-location {
color: #6b7280;
font-size: 0.75rem;
flex-shrink: 0;
}
.issue-status {
padding: 0.125rem 0.375rem;
border-radius: 4px;
font-size: 0.6875rem;
font-weight: 500;
flex-shrink: 0;
}
.issue-status.status-reported {
background: #dbeafe;
color: #1d4ed8;
}
.issue-status.status-received {
background: #fed7aa;
color: #c2410c;
}
.issue-status.status-in_progress {
background: #e9d5ff;
color: #7c3aed;
}
.issue-status.status-completed {
background: #d1fae5;
color: #047857;
}
.issue-status.status-closed {
background: #f3f4f6;
color: #4b5563;
}
.issue-reminder-more {
text-align: center;
color: #92400e;
font-size: 0.75rem;
font-style: italic;
}
.issue-reminder-hint {
background: rgba(255, 255, 255, 0.7);
padding: 0.5rem 0.75rem;
border-radius: 6px;
font-size: 0.8125rem;
color: #78350f;
}
/* TBM 작업 테이블 스타일 */
.tbm-table-container {
overflow-x: auto;
@@ -1183,3 +1468,551 @@
.btn-add-defect-inline:hover {
background: #d97706;
}
/* =================================================================
이슈 기반 부적합 선택 UI
================================================================= */
/* 이슈 섹션 전체 */
.defect-issue-section {
margin-bottom: 0.75rem;
}
.defect-issue-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.5rem 0.75rem;
background: #fef3c7;
border-radius: 6px 6px 0 0;
border: 1px solid #fcd34d;
border-bottom: none;
}
.defect-issue-title {
font-weight: 600;
color: #92400e;
font-size: 0.8125rem;
}
.defect-issue-count {
background: #f59e0b;
color: white;
padding: 0.125rem 0.375rem;
border-radius: 8px;
font-size: 0.6875rem;
font-weight: 600;
}
/* 이슈 목록 */
.defect-issue-list {
border: 1px solid #e5e7eb;
border-top: none;
border-radius: 0 0 6px 6px;
overflow: hidden;
}
/* 개별 이슈 아이템 - 가벼운 인라인 스타일 */
.defect-issue-item {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.5rem 0.75rem;
background: white;
border-bottom: 1px solid #f3f4f6;
transition: all 0.2s ease;
font-size: 0.8125rem;
}
.defect-issue-item:last-child {
border-bottom: none;
}
.defect-issue-item:hover {
background: #f9fafb;
}
.defect-issue-item.selected {
background: #fef2f2;
border-left: 3px solid #ef4444;
}
/* 체크박스 영역 */
.defect-issue-checkbox {
flex-shrink: 0;
}
.defect-issue-checkbox input[type="checkbox"] {
width: 16px;
height: 16px;
cursor: pointer;
accent-color: #ef4444;
}
/* 이슈 정보 영역 - 인라인 */
.defect-issue-info {
flex: 1;
min-width: 0;
display: flex;
align-items: center;
gap: 0.5rem;
}
.defect-issue-category {
font-size: 0.75rem;
color: #6b7280;
flex-shrink: 0;
}
.defect-issue-item-name {
font-weight: 500;
color: #374151;
font-size: 0.8125rem;
flex: 1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.defect-issue-location {
font-size: 0.75rem;
color: #9ca3af;
flex-shrink: 0;
}
/* 시간 입력 영역 */
.defect-issue-time {
flex-shrink: 0;
}
.defect-issue-time .defect-time-input {
background: #f3f4f6;
opacity: 0.5;
cursor: not-allowed;
padding: 0.375rem 0.625rem;
font-size: 0.75rem;
}
.defect-issue-time.active .defect-time-input {
background: #fee2e2;
opacity: 1;
cursor: pointer;
border-color: #ef4444;
}
.defect-issue-time.active .defect-time-input:hover {
background: #fecaca;
}
/* 레거시 부적합 섹션 */
.defect-legacy-section {
margin-top: 1rem;
}
.btn-add-legacy-defect {
display: inline-flex;
align-items: center;
gap: 0.375rem;
padding: 0.5rem 0.875rem;
background: #f3f4f6;
color: #374151;
border: 1px dashed #d1d5db;
border-radius: 6px;
cursor: pointer;
font-size: 0.8rem;
font-weight: 500;
transition: all 0.2s ease;
margin-bottom: 0.5rem;
}
.btn-add-legacy-defect:hover {
background: #e5e7eb;
border-color: #9ca3af;
}
.defect-legacy-list {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
/* =================================================================
순차 입력 부적합 UI (대분류 → 소분류 → 추가내용)
================================================================= */
.defect-cascading-item {
background: #fefce8;
border: 1px solid #fde047;
border-radius: 8px;
padding: 0.75rem;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.defect-cascading-row {
display: flex;
align-items: flex-end;
gap: 0.5rem;
flex-wrap: wrap;
}
.defect-field {
display: flex;
flex-direction: column;
gap: 0.25rem;
min-width: 100px;
}
.defect-field-label {
font-size: 0.7rem;
font-weight: 600;
color: #92400e;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.defect-select-wrapper {
position: relative;
}
.defect-category-select,
.defect-item-select {
width: 100%;
min-width: 120px;
max-width: none;
padding: 0.5rem 0.75rem;
border: 1px solid #fde047;
border-radius: 6px;
font-size: 0.8125rem;
background: white;
cursor: pointer;
}
.defect-category-select:focus,
.defect-item-select:focus {
outline: none;
border-color: #f59e0b;
box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}
.defect-category-select:disabled,
.defect-item-select:disabled {
background: #f3f4f6;
color: #9ca3af;
cursor: not-allowed;
}
.defect-field-time {
min-width: 70px;
flex-shrink: 0;
}
.defect-field-time .defect-time-input {
background: white;
border-color: #fde047;
}
.defect-note-row {
display: flex;
gap: 0.5rem;
}
.defect-note-input {
flex: 1;
padding: 0.5rem 0.75rem;
border: 1px solid #e5e7eb;
border-radius: 6px;
font-size: 0.8125rem;
background: white;
}
.defect-note-input:focus {
outline: none;
border-color: #f59e0b;
box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
}
.defect-note-input::placeholder {
color: #9ca3af;
}
.defect-preview {
padding: 0.375rem 0.625rem;
background: rgba(245, 158, 11, 0.1);
border-radius: 4px;
}
.defect-preview-text {
font-size: 0.75rem;
color: #92400e;
font-weight: 500;
}
/* 부적합 액션 버튼 영역 */
.defect-action-buttons {
display: flex;
gap: 0.5rem;
margin-top: 0.75rem;
align-items: center;
}
.btn-save-defects {
padding: 0.5rem 1.25rem;
background: #16a34a;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 0.875rem;
font-weight: 600;
transition: all 0.2s ease;
}
.btn-save-defects:hover {
background: #15803d;
}
.btn-save-defects.saved {
background: #22c55e;
cursor: default;
}
.btn-save-defects:disabled {
opacity: 0.8;
}
/* 저장 완료 메시지 */
.defect-save-message {
display: flex;
align-items: center;
gap: 0.5rem;
margin-top: 0.5rem;
padding: 0.5rem 0.75rem;
background: #dcfce7;
border: 1px solid #86efac;
border-radius: 6px;
animation: fadeIn 0.3s ease;
}
.save-message-text {
font-size: 0.8125rem;
color: #166534;
font-weight: 500;
}
.save-message-text::before {
content: '✓ ';
}
/* 저장 하이라이트 애니메이션 */
.defect-legacy-list.saved-highlight .defect-cascading-item {
animation: highlightPulse 0.5s ease;
}
@keyframes highlightPulse {
0% { background-color: #fefce8; }
50% { background-color: #dcfce7; }
100% { background-color: #fefce8; }
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(-5px); }
to { opacity: 1; transform: translateY(0); }
}
/* =================================================================
저장된 부적합 섹션
================================================================= */
.defect-saved-section {
background: #f0fdf4;
border: 1px solid #86efac;
border-radius: 8px;
margin-bottom: 1rem;
overflow: hidden;
}
.defect-saved-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.625rem 1rem;
background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
border-bottom: 1px solid #86efac;
}
.defect-saved-title {
font-size: 0.8125rem;
font-weight: 600;
color: #166534;
}
.defect-saved-count {
font-size: 0.75rem;
font-weight: 600;
color: white;
background: #16a34a;
padding: 0.125rem 0.5rem;
border-radius: 10px;
}
.defect-saved-list {
padding: 0.5rem;
}
.defect-saved-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.625rem 0.75rem;
background: white;
border: 1px solid #d1fae5;
border-radius: 6px;
margin-bottom: 0.375rem;
gap: 0.75rem;
}
.defect-saved-item:last-child {
margin-bottom: 0;
}
.defect-saved-info {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 0.125rem;
}
.defect-saved-category {
font-size: 0.75rem;
font-weight: 600;
color: #16a34a;
}
.defect-saved-detail {
font-size: 0.8125rem;
color: #374151;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.defect-saved-actions {
display: flex;
align-items: center;
gap: 0.5rem;
flex-shrink: 0;
}
.defect-saved-hours {
font-size: 0.8125rem;
font-weight: 600;
color: #dc2626;
background: #fee2e2;
padding: 0.25rem 0.625rem;
border-radius: 4px;
white-space: nowrap;
}
.btn-edit-defect {
padding: 0.25rem 0.625rem;
background: #3b82f6;
color: white;
border: none;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 500;
cursor: pointer;
transition: background 0.2s;
}
.btn-edit-defect:hover {
background: #2563eb;
}
.btn-delete-defect {
padding: 0.25rem 0.625rem;
background: #ef4444;
color: white;
border: none;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 500;
cursor: pointer;
transition: background 0.2s;
}
.btn-delete-defect:hover {
background: #dc2626;
}
/* 입력 중 섹션 */
.defect-editing-section {
margin-top: 0.5rem;
}
/* 반응형 - 저장된 부적합 */
@media (max-width: 640px) {
.defect-saved-item {
flex-direction: column;
align-items: flex-start;
gap: 0.5rem;
}
.defect-saved-actions {
width: 100%;
justify-content: flex-end;
}
}
/* 반응형 - 모바일 */
@media (max-width: 640px) {
.defect-cascading-row {
flex-direction: column;
align-items: stretch;
}
.defect-field {
width: 100%;
max-width: none;
}
.defect-category-select,
.defect-item-select {
max-width: none;
}
.defect-field-time {
flex-direction: row;
align-items: center;
gap: 0.5rem;
}
.defect-field-time .defect-field-label {
min-width: 40px;
}
.btn-remove-defect {
align-self: flex-end;
margin-top: 0.5rem;
}
}
/* 이슈 없음 상태 */
.defect-no-issues {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1rem;
background: #f9fafb;
border: 1px dashed #d1d5db;
border-radius: 8px;
margin-bottom: 0.5rem;
}
.no-issues-text {
color: #6b7280;
font-size: 0.875rem;
}