This commit is contained in:
1 parent
2fbfe24283
commit
a332ed0d8e
4 files changed
+23
-22
No files matched your search
+20
-19
@@ -7,12 +7,16 @@
|
||||
const COMMENTS_KEY = 'baron.qa.comments.egbim';
|
||||
const CATEGORY_CODES = { '오류문의': 'ERROR_QNA', '개선문의': 'IMPROVEMENT_QNA', '일반문의': 'GENERAL_QNA' };
|
||||
const STATUS_LABELS = {
|
||||
INIT: "접수",
|
||||
NEW: "신규",
|
||||
INIT: "신규",
|
||||
RECEIVED: "접수",
|
||||
ON_REVIEW: "접수",
|
||||
DETAILED_REVIEW: "진행중",
|
||||
IN_PROGRESS: "진행중",
|
||||
RESOLVED: "완료",
|
||||
PENDING: "보류"
|
||||
COMPLETED: "완료",
|
||||
PENDING: "보류",
|
||||
ON_HOLD: "보류"
|
||||
};
|
||||
let authReady;
|
||||
|
||||
@@ -77,7 +81,7 @@
|
||||
content: value(["contents", "content", "body"]) || "",
|
||||
date: String(createdAt).slice(0, 10),
|
||||
createdAt: createdAt,
|
||||
status: normalizeStatus(value(["feedback_status", "feedbackStatus", "status_code", "status"]), item),
|
||||
status: normalizeStatus(value(["feedback_status", "feedbackStatus", "status_code", "status"])),
|
||||
secret: secret === true || String(secret).toLowerCase() === "true" || String(secret) === "1",
|
||||
attachments: value(["attachments", "images"]) || [],
|
||||
raw: item
|
||||
@@ -117,21 +121,18 @@
|
||||
return Boolean(post.author && [user.name, user.loginId, user.email].filter(Boolean).indexOf(post.author) > -1);
|
||||
}
|
||||
|
||||
function normalizeStatus(value, context) {
|
||||
function normalizeStatus(value) {
|
||||
if (value && typeof value === "object") value = value.code || value.key || value.value || value.name || "";
|
||||
const raw = String(value || "").trim();
|
||||
if (!raw) return "";
|
||||
const upper = raw.toUpperCase();
|
||||
const label = STATUS_LABELS[upper] || ({
|
||||
NEW: "접수", RECEIVED: "접수", 접수: "접수", 문의접수: "접수", 문의검토: "접수", REVIEW: "접수",
|
||||
DEEP: "진행중", 정밀검토: "진행중", PATCH: "진행중", 처리중: "진행중", 진행중: "진행중",
|
||||
DONE: "완료", COMPLETED: "완료", 답변완료: "완료", 완료: "완료",
|
||||
HOLD: "보류", ON_HOLD: "보류", 보류: "보류"
|
||||
return STATUS_LABELS[upper] || ({
|
||||
NEW: "신규", INIT: "신규", 신규: "신규",
|
||||
RECEIVED: "접수", 접수: "접수", 문의접수: "접수", ON_REVIEW: "접수", REVIEW: "접수", 문의검토: "접수",
|
||||
DETAILED_REVIEW: "진행중", DEEP: "진행중", IN_PROGRESS: "진행중", PATCH: "진행중", 처리중: "진행중", 진행중: "진행중", 정밀검토: "진행중",
|
||||
DONE: "완료", COMPLETED: "완료", RESOLVED: "완료", 답변완료: "완료", 완료: "완료",
|
||||
HOLD: "보류", ON_HOLD: "보류", PENDING: "보류", 보류: "보류"
|
||||
}[upper] || raw);
|
||||
const issues = context && Array.isArray(context.issues) ? context.issues : [];
|
||||
const issueLinkStatus = context && (context.issue_link_status || context.issueLinkStatus || context.issue_status || context.issueStatus);
|
||||
const hasLinkedIssue = issues.length > 0 || ["LINKED", "ISSUE_LINKED", "CONNECTED", "이슈접수"].indexOf(String(issueLinkStatus || "").toUpperCase()) > -1;
|
||||
return label === "진행중" && hasLinkedIssue ? "진행중(이슈접수)" : label;
|
||||
}
|
||||
|
||||
function extractFeedbackStatus(payload) {
|
||||
@@ -141,11 +142,11 @@
|
||||
const candidate = candidates[index];
|
||||
if (!candidate || typeof candidate !== 'object') continue;
|
||||
const value = candidate.feedback_status || candidate.feedbackStatus || candidate.status_code || candidate.status;
|
||||
if (value != null && value !== '') return normalizeStatus(value, root);
|
||||
if (value != null && value !== '') return normalizeStatus(value);
|
||||
}
|
||||
const fields = root && (Array.isArray(root.fields) ? root.fields : (root.data && Array.isArray(root.data.fields) ? root.data.fields : []));
|
||||
const statusField = fields.find(function (field) { return field && (field.key === 'feedback_status' || field.fieldKey === 'feedback_status' || field.name === 'feedback_status'); });
|
||||
return statusField ? normalizeStatus(statusField.value || statusField.val || statusField.data, root) : '';
|
||||
return statusField ? normalizeStatus(statusField.value || statusField.val || statusField.data) : '';
|
||||
}
|
||||
|
||||
async function refreshRemoteStatus(post) {
|
||||
@@ -446,7 +447,7 @@
|
||||
tableBody.innerHTML = rows.map(function (post, index) {
|
||||
const isNotice = post.category === "공지사항";
|
||||
const number = isNotice ? "공지" : filtered.length - ((page - 1) * pageSize + index);
|
||||
const status = normalizeStatus(post.status, post.raw);
|
||||
const status = normalizeStatus(post.status);
|
||||
const statusClass = status === "답변완료" ? "done" : (status === "문의검토" || status === "정밀검토" ? "review" : "");
|
||||
const company = getPostCompany(post, user);
|
||||
return "<tr class=\"" + (isNotice ? "notice-row" : "") + "\" data-id=\"" + escapeHtml(post.id) + "\">" +
|
||||
@@ -497,7 +498,7 @@
|
||||
if (!qs('#category').value || !title || !content) { errorBox.textContent = '구분, 제목, 내용을 모두 입력해주세요.'; errorBox.style.display = 'block'; return; }
|
||||
const feedbackId = makeUuid();
|
||||
const createdAt = new Date().toISOString();
|
||||
const post = { id: feedbackId, feedbackId: feedbackId, requesterId: currentUser.requesterId, requesterTenantId: currentUser.requesterTenantId, category: qs('#category').value, company: currentUser.company || currentUser.tenantName || currentUser.familyCompany || '외부 사용자', department: currentUser.department || '-', author: currentUser.name || currentUser.loginId, title: title, date: createdAt.slice(0, 10), createdAt: createdAt, status: '접수', secret: qs('#secret').checked, content: content };
|
||||
const post = { id: feedbackId, feedbackId: feedbackId, requesterId: currentUser.requesterId, requesterTenantId: currentUser.requesterTenantId, category: qs('#category').value, company: currentUser.company || currentUser.tenantName || currentUser.familyCompany || '외부 사용자', department: currentUser.department || '-', author: currentUser.name || currentUser.loginId, title: title, date: createdAt.slice(0, 10), createdAt: createdAt, status: '신규', secret: qs('#secret').checked, content: content };
|
||||
const submitButton = qs('#submitButton');
|
||||
submitButton.disabled = true;
|
||||
submitButton.textContent = '등록 중...';
|
||||
@@ -545,7 +546,7 @@
|
||||
}
|
||||
qs('[data-detail-category]').textContent = post.category;
|
||||
qs('[data-detail-title]').textContent = post.title;
|
||||
qs('[data-detail-status]').textContent = normalizeStatus(post.status, post.raw) || '공지';
|
||||
qs('[data-detail-status]').textContent = normalizeStatus(post.status) || '공지';
|
||||
qs('[data-detail-date]').textContent = post.date;
|
||||
qs('[data-detail-author]').textContent = post.author;
|
||||
const detailUser = getAuthUser();
|
||||
@@ -740,7 +741,7 @@
|
||||
}).join('');
|
||||
});
|
||||
refreshRemoteStatus(post).then(function (changed) {
|
||||
if (changed) qs('[data-detail-status]').textContent = normalizeStatus(post.status, post.raw) || '공지';
|
||||
if (changed) qs('[data-detail-status]').textContent = normalizeStatus(post.status) || '공지';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user