diff --git a/resources/views/approvals/partials/_expense-form.blade.php b/resources/views/approvals/partials/_expense-form.blade.php
index 20ccb98c..9258308c 100644
--- a/resources/views/approvals/partials/_expense-form.blade.php
+++ b/resources/views/approvals/partials/_expense-form.blade.php
@@ -183,8 +183,29 @@ class="w-full px-2 py-1.5 border border-gray-200 rounded text-xs focus:outline-n
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">
-
+
|
{{-- 법인카드: 선택된 카드 표시 --}}
@@ -347,6 +368,8 @@ function makeItem(data) {
description: data?.description || '',
amount: parseInt(data?.amount) || 0,
vendor: data?.vendor || '',
+ vendor_id: data?.vendor_id || null,
+ vendor_biz_no: data?.vendor_biz_no || '',
bank: data?.bank || '',
account_no: data?.account_no || '',
depositor: data?.depositor || '',
@@ -562,6 +585,8 @@ function makeItem(data) {
description: item.description,
amount: parseInt(item.amount) || 0,
vendor: item.vendor,
+ vendor_id: item.vendor_id || null,
+ vendor_biz_no: item.vendor_biz_no || '',
bank: isTransfer && acct ? acct.bank_name : (isCard ? (card?.card_company || '') : item.bank),
account_no: isTransfer && acct ? acct.account_number : (isCard ? ('**** ' + (card?.card_number_last4 || '')) : item.account_no),
depositor: isTransfer && acct ? acct.account_holder : (isCard ? (card?.card_holder_name || '') : item.depositor),
@@ -579,4 +604,65 @@ function makeItem(data) {
},
};
}
+
+function vendorSearch(item) {
+ let debounceTimer = null;
+ return {
+ open: false,
+ query: '',
+ results: [],
+ loading: false,
+ highlighted: -1,
+
+ onInput(value) {
+ item.vendor = value;
+ this.query = value;
+ this.highlighted = -1;
+ clearTimeout(debounceTimer);
+ if (value.length < 1) { this.results = []; this.open = false; return; }
+ debounceTimer = setTimeout(() => this.search(value), 250);
+ },
+
+ onFocus() {
+ if (item.vendor && item.vendor.length >= 1) {
+ this.query = item.vendor;
+ this.search(item.vendor);
+ }
+ },
+
+ async search(keyword) {
+ this.loading = true;
+ try {
+ const res = await fetch(`/barobill/tax-invoice/search-partners?keyword=${encodeURIComponent(keyword)}`);
+ this.results = await res.json();
+ this.open = true;
+ } catch (e) { this.results = []; }
+ this.loading = false;
+ },
+
+ selectPartner(p) {
+ item.vendor = p.name;
+ item.vendor_id = p.id;
+ item.vendor_biz_no = p.biz_no || '';
+ this.query = p.name;
+ this.close();
+ },
+
+ close() { this.open = false; this.highlighted = -1; },
+
+ moveDown() {
+ if (!this.open || this.results.length === 0) return;
+ this.highlighted = (this.highlighted + 1) % this.results.length;
+ },
+ moveUp() {
+ if (!this.open || this.results.length === 0) return;
+ this.highlighted = this.highlighted <= 0 ? this.results.length - 1 : this.highlighted - 1;
+ },
+ selectHighlighted() {
+ if (this.highlighted >= 0 && this.highlighted < this.results.length) {
+ this.selectPartner(this.results[this.highlighted]);
+ }
+ },
+ };
+}
|