feat: 환산계수 모달 구현 전 백업
This commit is contained in:
@@ -277,6 +277,47 @@
|
||||
background: rgba(255,255,255,0.35);
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
/* 키오스크 스타일 전화번호 입력 */
|
||||
.phone-input-kiosk {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
.phone-input-kiosk .phone-prefix {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
color: #4c1d95;
|
||||
background: #f3e8ff;
|
||||
padding: 12px 16px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.phone-input-kiosk .phone-hyphen {
|
||||
font-size: 28px;
|
||||
font-weight: 300;
|
||||
color: #9ca3af;
|
||||
}
|
||||
.phone-input-kiosk input {
|
||||
width: 80px;
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
padding: 12px 8px;
|
||||
border: 2px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.phone-input-kiosk input:focus {
|
||||
border-color: #f59e0b;
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 3px rgba(245,158,11,0.2);
|
||||
}
|
||||
.phone-input-kiosk input::placeholder {
|
||||
color: #d1d5db;
|
||||
font-weight: 400;
|
||||
}
|
||||
.detail-header .cusetc-inline .cusetc-label {
|
||||
font-weight: 600;
|
||||
margin-right: 6px;
|
||||
@@ -1336,17 +1377,22 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 전화번호 모달 -->
|
||||
<!-- 전화번호 모달 (키오스크 스타일) -->
|
||||
<div class="cusetc-modal" id="phoneModal">
|
||||
<div class="cusetc-modal-content">
|
||||
<div class="cusetc-modal-content" style="max-width:360px;">
|
||||
<div class="cusetc-modal-header">
|
||||
<h3>📞 환자 전화번호</h3>
|
||||
<h3>📞 전화번호 입력</h3>
|
||||
<button class="cusetc-modal-close" onclick="closePhoneModal()">×</button>
|
||||
</div>
|
||||
<div class="cusetc-modal-body">
|
||||
<div class="cusetc-patient-info" id="phonePatientInfo"></div>
|
||||
<input type="tel" id="phoneInput" placeholder="010-0000-0000" style="width:100%;padding:12px;border:2px solid #e2e8f0;border-radius:8px;font-size:16px;text-align:center;">
|
||||
<div class="cusetc-hint">💡 하이픈(-) 포함해서 입력하세요</div>
|
||||
<div class="phone-input-kiosk">
|
||||
<span class="phone-prefix">010</span>
|
||||
<span class="phone-hyphen">-</span>
|
||||
<input type="tel" id="phoneMid" maxlength="4" placeholder="0000" inputmode="numeric" pattern="[0-9]*">
|
||||
<span class="phone-hyphen">-</span>
|
||||
<input type="tel" id="phoneLast" maxlength="4" placeholder="0000" inputmode="numeric" pattern="[0-9]*">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cusetc-modal-footer">
|
||||
<button class="cusetc-btn-cancel" onclick="closePhoneModal()">취소</button>
|
||||
@@ -1614,7 +1660,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
${data.medications.map((m, i) => `
|
||||
<tr data-add-info="${escapeHtml(m.add_info || '')}" data-unit="${m.unit || '정'}" data-med-name="${escapeHtml(m.med_name || m.medication_code)}" ${m.is_substituted ? 'class="substituted-row"' : ''}>
|
||||
<tr data-add-info="${escapeHtml(m.add_info || '')}" data-unit="${m.unit || '정'}" data-sung-code="${m.sung_code || ''}" data-med-name="${escapeHtml(m.med_name || m.medication_code)}" ${m.is_substituted ? 'class="substituted-row"' : ''}>
|
||||
<td><input type="checkbox" class="med-check" data-code="${m.medication_code}" ${m.is_auto_print ? 'checked' : ''}></td>
|
||||
<td>
|
||||
<div class="med-name">
|
||||
@@ -1871,7 +1917,7 @@
|
||||
const disabled = m.status === 'removed' ? 'disabled' : '';
|
||||
|
||||
return `
|
||||
<tr class="${rowClass}" data-add-info="${escapeHtml(m.add_info || '')}" data-unit="${m.unit || '정'}">
|
||||
<tr class="${rowClass}" data-add-info="${escapeHtml(m.add_info || '')}" data-unit="${m.unit || '정'}" data-sung-code="${m.sung_code || ''}">
|
||||
<td><input type="checkbox" class="med-check" data-code="${m.medication_code}" ${disabled}></td>
|
||||
<td>
|
||||
<div class="med-name"><span class="med-num">${i+1}</span>${m.med_name || m.medication_code}</div>
|
||||
@@ -1909,7 +1955,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
${currentMedications.map((m, i) => `
|
||||
<tr data-add-info="${escapeHtml(m.add_info || '')}" data-unit="${m.unit || '정'}">
|
||||
<tr data-add-info="${escapeHtml(m.add_info || '')}" data-unit="${m.unit || '정'}" data-sung-code="${m.sung_code || ''}">
|
||||
<td><input type="checkbox" class="med-check" data-code="${m.medication_code}"></td>
|
||||
<td>
|
||||
<div class="med-name"><span class="med-num">${i+1}</span>${m.med_name || m.medication_code}</div>
|
||||
@@ -2120,7 +2166,7 @@
|
||||
// 전화번호 모달 함수들
|
||||
// ─────────────────────────────────────────────────────────────
|
||||
|
||||
function openPhoneModal() {
|
||||
window.openPhoneModal = function() {
|
||||
if (!currentPrescriptionData) {
|
||||
alert('❌ 먼저 환자를 선택하세요.');
|
||||
return;
|
||||
@@ -2128,30 +2174,59 @@
|
||||
|
||||
const modal = document.getElementById('phoneModal');
|
||||
const patientInfo = document.getElementById('phonePatientInfo');
|
||||
const input = document.getElementById('phoneInput');
|
||||
const phoneMid = document.getElementById('phoneMid');
|
||||
const phoneLast = document.getElementById('phoneLast');
|
||||
|
||||
patientInfo.innerHTML = `
|
||||
<strong>${currentPrescriptionData.name || '환자'}</strong>
|
||||
<span style="margin-left: 10px; color: #6b7280;">고객코드: ${currentPrescriptionData.cus_code || '-'}</span>
|
||||
`;
|
||||
|
||||
input.value = currentPrescriptionData.phone || '';
|
||||
// 기존 전화번호 파싱 (010-1234-5678 또는 01012345678)
|
||||
const existingPhone = currentPrescriptionData.phone || '';
|
||||
const digits = existingPhone.replace(/\D/g, '');
|
||||
if (digits.length >= 10) {
|
||||
phoneMid.value = digits.slice(3, 7);
|
||||
phoneLast.value = digits.slice(7, 11);
|
||||
} else {
|
||||
phoneMid.value = '';
|
||||
phoneLast.value = '';
|
||||
}
|
||||
|
||||
modal.style.display = 'flex';
|
||||
input.focus();
|
||||
}
|
||||
phoneMid.focus();
|
||||
|
||||
// 4자리 입력 시 자동 포커스 이동
|
||||
phoneMid.oninput = function() {
|
||||
this.value = this.value.replace(/\D/g, '');
|
||||
if (this.value.length >= 4) phoneLast.focus();
|
||||
};
|
||||
phoneLast.oninput = function() {
|
||||
this.value = this.value.replace(/\D/g, '');
|
||||
};
|
||||
};
|
||||
|
||||
function closePhoneModal() {
|
||||
window.closePhoneModal = function() {
|
||||
document.getElementById('phoneModal').style.display = 'none';
|
||||
}
|
||||
};
|
||||
|
||||
async function savePhone() {
|
||||
window.savePhone = async function() {
|
||||
if (!currentPrescriptionData || !currentPrescriptionData.cus_code) {
|
||||
alert('❌ 환자 정보가 없습니다.');
|
||||
return;
|
||||
}
|
||||
|
||||
const input = document.getElementById('phoneInput');
|
||||
const newPhone = input.value.trim();
|
||||
const phoneMid = document.getElementById('phoneMid').value.trim();
|
||||
const phoneLast = document.getElementById('phoneLast').value.trim();
|
||||
|
||||
// 유효성 검사
|
||||
if (phoneMid.length !== 4 || phoneLast.length !== 4) {
|
||||
alert('❌ 전화번호 8자리를 모두 입력해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
// 010-XXXX-XXXX 형식으로 조합
|
||||
const newPhone = `010-${phoneMid}-${phoneLast}`;
|
||||
const cusCode = currentPrescriptionData.cus_code;
|
||||
|
||||
try {
|
||||
@@ -2174,7 +2249,7 @@
|
||||
} catch (err) {
|
||||
alert('❌ 오류: ' + err.message);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function updatePhoneBadge(phone) {
|
||||
const detailInfo = document.getElementById('detailInfo');
|
||||
@@ -2738,8 +2813,10 @@
|
||||
|
||||
// 단위: data-unit 속성에서 가져오기 (SUNG_CODE 기반 자동 판별)
|
||||
const unit = tr.dataset.unit || '정';
|
||||
// 성분코드: 환산계수 조회용
|
||||
const sungCode = tr.dataset.sungCode || '';
|
||||
|
||||
console.log('Preview data:', { patientName, medName, addInfo, dosage, frequency, duration, unit });
|
||||
console.log('Preview data:', { patientName, medName, addInfo, dosage, frequency, duration, unit, sungCode });
|
||||
|
||||
try {
|
||||
const res = await fetch('/pmr/api/label/preview', {
|
||||
@@ -2752,7 +2829,8 @@
|
||||
dosage: dosage,
|
||||
frequency: frequency,
|
||||
duration: duration,
|
||||
unit: unit
|
||||
unit: unit,
|
||||
sung_code: sungCode
|
||||
})
|
||||
});
|
||||
const data = await res.json();
|
||||
|
||||
Reference in New Issue
Block a user