feat(거래처): client_type 필터 추가

- ClientService.index()에 client_type 파라미터 필터 추가
- 쉼표 구분 복수 값 지원 (예: PURCHASE,BOTH)
- 매입 가능 거래처만 조회하는 용도

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-29 15:04:55 +09:00
parent e8fc42c14d
commit 847717e631

View File

@@ -21,6 +21,7 @@ public function index(array $params)
$size = (int) ($params['size'] ?? 20);
$q = trim((string) ($params['q'] ?? ''));
$onlyActive = $params['only_active'] ?? null;
$clientType = $params['client_type'] ?? null;
$query = Client::query()->where('tenant_id', $tenantId);
@@ -36,6 +37,12 @@ public function index(array $params)
$query->where('is_active', (bool) $onlyActive);
}
// 거래처 유형 필터 (쉼표 구분 복수 값 지원: PURCHASE,BOTH)
if ($clientType !== null && $clientType !== '') {
$types = array_map('trim', explode(',', $clientType));
$query->whereIn('client_type', $types);
}
$query->orderBy('client_code')->orderBy('id');
$paginator = $query->paginate($size, ['*'], 'page', $page);