fix:고객 검색을 TenantProspect(명함 등록 고객)에서 조회하도록 수정
- Tenant 대신 TenantProspect(tenant_prospects 테이블) 사용 - 업체명/사업자번호/대표자명/연락처로 검색 - 필드명 매칭: business_number, contact_phone, contact_email Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
use App\Models\ESign\EsignSigner;
|
||||
use App\Models\ESign\EsignSignField;
|
||||
use App\Models\ESign\EsignAuditLog;
|
||||
use App\Models\Tenants\Tenant;
|
||||
use App\Models\Sales\TenantProspect;
|
||||
use App\Models\Tenants\TenantSetting;
|
||||
use App\Services\Barobill\BarobillService;
|
||||
use App\Services\GoogleCloudStorageService;
|
||||
@@ -75,33 +75,33 @@ public function searchPartners(Request $request): JsonResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* 고객(테넌트) 검색
|
||||
* 고객(명함 등록 고객) 검색
|
||||
*/
|
||||
public function searchTenants(Request $request): JsonResponse
|
||||
{
|
||||
$q = trim($request->input('q', ''));
|
||||
|
||||
$query = Tenant::whereNull('deleted_at');
|
||||
$query = TenantProspect::query();
|
||||
|
||||
if ($q !== '') {
|
||||
$query->where(function ($w) use ($q) {
|
||||
$w->where('company_name', 'like', "%{$q}%")
|
||||
->orWhere('business_num', 'like', "%{$q}%")
|
||||
->orWhere('phone', 'like', "%{$q}%")
|
||||
->orWhere('ceo_name', 'like', "%{$q}%");
|
||||
->orWhere('business_number', 'like', "%{$q}%")
|
||||
->orWhere('ceo_name', 'like', "%{$q}%")
|
||||
->orWhere('contact_phone', 'like', "%{$q}%");
|
||||
});
|
||||
}
|
||||
|
||||
$tenants = $query->orderBy('company_name')->limit(20)->get();
|
||||
$prospects = $query->orderBy('company_name')->limit(20)->get();
|
||||
|
||||
$data = $tenants->map(fn($t) => [
|
||||
'id' => $t->id,
|
||||
'company_name' => $t->company_name,
|
||||
'business_num' => $t->business_num,
|
||||
'ceo_name' => $t->ceo_name,
|
||||
'address' => $t->address,
|
||||
'phone' => $t->phone,
|
||||
'email' => $t->email,
|
||||
$data = $prospects->map(fn($p) => [
|
||||
'id' => $p->id,
|
||||
'company_name' => $p->company_name,
|
||||
'business_number' => $p->business_number,
|
||||
'ceo_name' => $p->ceo_name,
|
||||
'address' => $p->address,
|
||||
'phone' => $p->contact_phone,
|
||||
'email' => $p->contact_email,
|
||||
]);
|
||||
|
||||
return response()->json(['success' => true, 'data' => $data]);
|
||||
|
||||
Reference in New Issue
Block a user