fix: [hr] 연봉 입력 필드 콤마 표시 적용
- type=number → type=text(inputmode=numeric) 변경 - 입력 시 실시간 콤마 포맷 적용 - 저장 시 숫자만 추출하여 전송
This commit is contained in:
@@ -53,11 +53,13 @@ class="inline-flex items-center gap-1 px-3 py-1.5 text-sm font-medium rounded-lg
|
||||
<div x-show="editing" class="p-6 space-y-4" x-cloak>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">연봉 (원)</label>
|
||||
<input type="number" x-model="form.annual_salary" min="0" step="10000"
|
||||
placeholder="예: 50000000"
|
||||
<input type="text" inputmode="numeric"
|
||||
:value="formatNumber(form.annual_salary)"
|
||||
@input="form.annual_salary = parseNumber($event.target.value); $event.target.value = formatNumber(form.annual_salary)"
|
||||
placeholder="예: 50,000,000"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
||||
<p class="text-xs text-gray-400 mt-1" x-show="form.annual_salary > 0"
|
||||
x-text="'= ' + Number(form.annual_salary).toLocaleString() + '원 (월 약 ' + Math.round(form.annual_salary / 12).toLocaleString() + '원)'"></p>
|
||||
x-text="'월 약 ' + Math.round(form.annual_salary / 12).toLocaleString() + '원'"></p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">적용일</label>
|
||||
@@ -132,6 +134,15 @@ function salaryManager() {
|
||||
notes: initialData.notes || '',
|
||||
},
|
||||
|
||||
formatNumber(val) {
|
||||
if (!val && val !== 0) return '';
|
||||
return Number(val).toLocaleString();
|
||||
},
|
||||
parseNumber(str) {
|
||||
const num = parseInt(String(str).replace(/[^0-9]/g, ''), 10);
|
||||
return isNaN(num) ? '' : num;
|
||||
},
|
||||
|
||||
async saveSalary() {
|
||||
this.saving = true;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user