feat: [finance] vendors 및 supplier-settings API 추가
- GET /api/v1/vendors: 거래처 간단 목록 (id, name) 반환 - GET /api/v1/tax-invoices/supplier-settings: 공급자 설정 조회 - PUT /api/v1/tax-invoices/supplier-settings: 공급자 설정 저장
This commit is contained in:
@@ -20,6 +20,16 @@ public function index(Request $request)
|
||||
}, __('message.client.fetched'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 거래처 간단 목록 (id, name만 반환) - vendors 엔드포인트용
|
||||
*/
|
||||
public function vendors(Request $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
return $this->service->vendors($request->all());
|
||||
}, __('message.client.fetched'));
|
||||
}
|
||||
|
||||
public function show(int $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($id) {
|
||||
|
||||
@@ -13,14 +13,30 @@
|
||||
use App\Models\Tenants\JournalEntry;
|
||||
use App\Services\JournalSyncService;
|
||||
use App\Services\TaxInvoiceService;
|
||||
use App\Services\TenantSettingService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TaxInvoiceController extends Controller
|
||||
{
|
||||
private const SUPPLIER_GROUP = 'supplier';
|
||||
|
||||
private const SUPPLIER_KEYS = [
|
||||
'business_number',
|
||||
'company_name',
|
||||
'representative_name',
|
||||
'address',
|
||||
'business_type',
|
||||
'business_item',
|
||||
'contact_name',
|
||||
'contact_phone',
|
||||
'contact_email',
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
private TaxInvoiceService $taxInvoiceService,
|
||||
private JournalSyncService $journalSyncService,
|
||||
private TenantSettingService $tenantSettingService,
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -125,6 +141,48 @@ public function summary(TaxInvoiceSummaryRequest $request)
|
||||
}, __('message.fetched'));
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// 공급자 설정 (Supplier Settings)
|
||||
// =========================================================================
|
||||
|
||||
/**
|
||||
* 공급자 설정 조회
|
||||
*/
|
||||
public function getSupplierSettings(): JsonResponse
|
||||
{
|
||||
return ApiResponse::handle(function () {
|
||||
$settings = $this->tenantSettingService->getByGroup(self::SUPPLIER_GROUP);
|
||||
|
||||
$result = [];
|
||||
foreach (self::SUPPLIER_KEYS as $key) {
|
||||
$result[$key] = $settings[$key] ?? null;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}, __('message.fetched'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 공급자 설정 저장
|
||||
*/
|
||||
public function saveSupplierSettings(Request $request): JsonResponse
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
$data = $request->only(self::SUPPLIER_KEYS);
|
||||
|
||||
$settings = [];
|
||||
foreach ($data as $key => $value) {
|
||||
if (in_array($key, self::SUPPLIER_KEYS)) {
|
||||
$settings[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$this->tenantSettingService->setMany(self::SUPPLIER_GROUP, $settings);
|
||||
|
||||
return $settings;
|
||||
}, __('message.updated'));
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// 분개 (Journal Entries)
|
||||
// =========================================================================
|
||||
|
||||
Reference in New Issue
Block a user