feat: [approvals] 비용정산품의서 지급방법을 각 행별 선택으로 변경
- 하단 일괄 radio 제거, 각 내역행에 지급방법 select 추가 - tfoot에 법인카드/개인선지출 합계표 추가 - 조회 화면에도 지급방법 컬럼 및 합계표 반영
This commit is contained in:
@@ -449,7 +449,8 @@ class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-
|
||||
<th class="px-2 py-2 text-left text-xs font-medium text-gray-600" style="min-width: 110px;">사용일자</th>
|
||||
<th class="px-2 py-2 text-left text-xs font-medium text-gray-600" style="min-width: 180px;">항목</th>
|
||||
<th class="px-2 py-2 text-right text-xs font-medium text-gray-600" style="min-width: 120px;">금액</th>
|
||||
<th class="px-2 py-2 text-left text-xs font-medium text-gray-600" style="min-width: 120px;">비고</th>
|
||||
<th class="px-2 py-2 text-center text-xs font-medium text-gray-600" style="min-width: 130px;">지급방법</th>
|
||||
<th class="px-2 py-2 text-left text-xs font-medium text-gray-600" style="min-width: 100px;">비고</th>
|
||||
<th class="px-2 py-2" style="width: 40px;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -472,6 +473,14 @@ class="w-full px-2 py-1.5 border border-gray-200 rounded text-xs focus:outline-n
|
||||
@blur="if($event.target.value.trim() === '') { item.amount = 0; $event.target.value = '0'; }"
|
||||
class="w-full px-2 py-1.5 border border-gray-200 rounded text-xs text-right focus:outline-none focus:ring-1 focus:ring-blue-500">
|
||||
</td>
|
||||
<td class="px-1 py-1">
|
||||
<select x-model="item.payment_method"
|
||||
class="w-full px-2 py-1.5 border border-gray-200 rounded text-xs focus:outline-none focus:ring-1 focus:ring-blue-500">
|
||||
<option value="">선택</option>
|
||||
<option value="corporate_card">법인카드</option>
|
||||
<option value="personal_advance">개인선지출</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="px-1 py-1">
|
||||
<input type="text" x-model="item.remark" placeholder="비고"
|
||||
class="w-full px-2 py-1.5 border border-gray-200 rounded text-xs focus:outline-none focus:ring-1 focus:ring-blue-500">
|
||||
@@ -488,31 +497,24 @@ class="w-full px-2 py-1.5 border border-gray-200 rounded text-xs focus:outline-n
|
||||
<tr>
|
||||
<td class="px-2 py-2 text-xs font-semibold text-gray-700 text-right" colspan="2">합계</td>
|
||||
<td class="px-2 py-2 text-xs font-bold text-blue-700 text-right" x-text="formatMoney(totalAmount)"></td>
|
||||
<td colspan="2" class="px-2 py-2">
|
||||
<td colspan="3" class="px-2 py-2">
|
||||
<button type="button" @click="addItem()" class="text-xs text-blue-600 hover:text-blue-800 font-medium">+ 행 추가</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-t border-gray-200">
|
||||
<td colspan="2" class="px-2 py-2 text-xs font-semibold text-gray-700 text-right">법인카드</td>
|
||||
<td class="px-2 py-2 text-xs font-medium text-gray-700 text-right" x-text="formatMoney(corporateCardTotal)"></td>
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
<tr class="border-t border-gray-100">
|
||||
<td colspan="2" class="px-2 py-2 text-xs font-semibold text-gray-700 text-right">개인선지출</td>
|
||||
<td class="px-2 py-2 text-xs font-medium text-gray-700 text-right" x-text="formatMoney(personalAdvanceTotal)"></td>
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 지급방법 --}}
|
||||
<div class="mb-4">
|
||||
<label class="block text-xs font-medium text-gray-600 mb-2">지급방법</label>
|
||||
<div class="flex gap-4">
|
||||
<label class="inline-flex items-center gap-2 cursor-pointer">
|
||||
<input type="radio" x-model="formData.payment_method" value="corporate_card"
|
||||
class="rounded-full border-gray-300 text-blue-600 focus:ring-blue-500">
|
||||
<span class="text-sm text-gray-700">법인카드 사용</span>
|
||||
</label>
|
||||
<label class="inline-flex items-center gap-2 cursor-pointer">
|
||||
<input type="radio" x-model="formData.payment_method" value="personal_advance"
|
||||
class="rounded-full border-gray-300 text-blue-600 focus:ring-blue-500">
|
||||
<span class="text-sm text-gray-700">개인 선지출 후 정산</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -583,6 +585,7 @@ function makeItem(data) {
|
||||
unit_price: parseInt(data?.unit_price) || 0,
|
||||
amount: parseInt(data?.amount) || 0,
|
||||
remark: data?.remark || '',
|
||||
payment_method: data?.payment_method || '',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -660,9 +663,6 @@ function makeSchedule(data) {
|
||||
other: parseInt(initialData?.trip_expenses?.other) || 0,
|
||||
},
|
||||
|
||||
// pr_settlement
|
||||
payment_method: initialData?.payment_method || '',
|
||||
|
||||
// shared items
|
||||
items: items,
|
||||
},
|
||||
@@ -677,6 +677,14 @@ function makeSchedule(data) {
|
||||
return this.formData.items.reduce((sum, item) => sum + (parseInt(item.amount) || 0), 0);
|
||||
},
|
||||
|
||||
get corporateCardTotal() {
|
||||
return this.formData.items.filter(i => i.payment_method === 'corporate_card').reduce((sum, i) => sum + (parseInt(i.amount) || 0), 0);
|
||||
},
|
||||
|
||||
get personalAdvanceTotal() {
|
||||
return this.formData.items.filter(i => i.payment_method === 'personal_advance').reduce((sum, i) => sum + (parseInt(i.amount) || 0), 0);
|
||||
},
|
||||
|
||||
get tripExpenseTotal() {
|
||||
const e = this.formData.trip_expenses;
|
||||
return (parseInt(e.transport) || 0) + (parseInt(e.accommodation) || 0) + (parseInt(e.meal) || 0) + (parseInt(e.other) || 0);
|
||||
@@ -836,7 +844,14 @@ function makeSchedule(data) {
|
||||
return { ...base, traveler: this.formData.traveler, destination: this.formData.destination, trip_start: this.formData.trip_start, trip_end: this.formData.trip_end, schedules: this.formData.schedules.map(s => ({ date: s.date, destination: s.destination, task: s.task })), trip_expenses: { ...this.formData.trip_expenses }, trip_expense_total: this.tripExpenseTotal };
|
||||
}
|
||||
if (this.prType === 'pr_settlement') {
|
||||
return { ...base, items: cleanItems(), total_amount: this.totalAmount, payment_method: this.formData.payment_method };
|
||||
const settlementItems = this.formData.items.map(item => ({
|
||||
date: item.date,
|
||||
description: item.description,
|
||||
amount: parseInt(item.amount) || 0,
|
||||
payment_method: item.payment_method,
|
||||
remark: item.remark,
|
||||
}));
|
||||
return { ...base, items: settlementItems, total_amount: this.totalAmount, corporate_card_total: this.corporateCardTotal, personal_advance_total: this.personalAdvanceTotal };
|
||||
}
|
||||
return base;
|
||||
},
|
||||
|
||||
@@ -295,6 +295,12 @@
|
||||
@endif
|
||||
|
||||
@if(!empty($content['items']))
|
||||
@php
|
||||
$paymentLabels = [
|
||||
'corporate_card' => '법인카드',
|
||||
'personal_advance' => '개인선지출',
|
||||
];
|
||||
@endphp
|
||||
<div class="overflow-x-auto border border-gray-200 rounded-lg">
|
||||
<table class="w-full text-sm">
|
||||
<thead class="bg-gray-50">
|
||||
@@ -302,6 +308,7 @@
|
||||
<th class="px-3 py-2 text-left text-xs font-medium text-gray-600">사용일자</th>
|
||||
<th class="px-3 py-2 text-left text-xs font-medium text-gray-600">항목</th>
|
||||
<th class="px-3 py-2 text-right text-xs font-medium text-gray-600">금액</th>
|
||||
<th class="px-3 py-2 text-center text-xs font-medium text-gray-600">지급방법</th>
|
||||
<th class="px-3 py-2 text-left text-xs font-medium text-gray-600">비고</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -311,6 +318,7 @@
|
||||
<td class="px-3 py-2 text-xs text-gray-700 whitespace-nowrap">{{ $item['date'] ?? '' }}</td>
|
||||
<td class="px-3 py-2 text-xs text-gray-700">{{ $item['description'] ?? '' }}</td>
|
||||
<td class="px-3 py-2 text-xs text-gray-700 text-right font-medium whitespace-nowrap">{{ number_format($item['amount'] ?? 0) }}</td>
|
||||
<td class="px-3 py-2 text-xs text-gray-700 text-center">{{ $paymentLabels[$item['payment_method'] ?? ''] ?? ($item['payment_method'] ?? '-') }}</td>
|
||||
<td class="px-3 py-2 text-xs text-gray-700">{{ $item['remark'] ?? '' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@@ -319,27 +327,24 @@
|
||||
<tr>
|
||||
<td class="px-3 py-2 text-xs font-semibold text-gray-700 text-right" colspan="2">합계</td>
|
||||
<td class="px-3 py-2 text-xs font-bold text-blue-700 text-right whitespace-nowrap">{{ number_format($content['total_amount'] ?? 0) }}</td>
|
||||
<td></td>
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
@if(($content['corporate_card_total'] ?? 0) > 0 || ($content['personal_advance_total'] ?? 0) > 0)
|
||||
<tr class="border-t border-gray-200">
|
||||
<td class="px-3 py-2 text-xs font-semibold text-gray-700 text-right" colspan="2">법인카드</td>
|
||||
<td class="px-3 py-2 text-xs font-medium text-gray-700 text-right whitespace-nowrap">{{ number_format($content['corporate_card_total'] ?? 0) }}</td>
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
<tr class="border-t border-gray-100">
|
||||
<td class="px-3 py-2 text-xs font-semibold text-gray-700 text-right" colspan="2">개인선지출</td>
|
||||
<td class="px-3 py-2 text-xs font-medium text-gray-700 text-right whitespace-nowrap">{{ number_format($content['personal_advance_total'] ?? 0) }}</td>
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
@endif
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(!empty($content['payment_method']))
|
||||
<div>
|
||||
<span class="text-xs text-gray-500">지급방법</span>
|
||||
<div class="text-sm font-medium mt-0.5">
|
||||
@if($content['payment_method'] === 'corporate_card')
|
||||
법인카드 사용
|
||||
@elseif($content['payment_method'] === 'personal_advance')
|
||||
개인 선지출 후 정산
|
||||
@else
|
||||
{{ $content['payment_method'] }}
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
{{-- 공통: 첨부서류 메모 --}}
|
||||
|
||||
Reference in New Issue
Block a user