feat(API): Service 로직 개선
- EstimateService, ItemService 기능 추가 - OrderService 공정 연동 개선 - SalaryService, ReceivablesService 수정 - HandoverReportService, SiteBriefingService 추가 - Pricing 서비스 추가 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -19,12 +19,12 @@ public function index(array $params): LengthAwarePaginator
|
||||
->where('tenant_id', $tenantId)
|
||||
->with([
|
||||
'employee:id,name,user_id,email',
|
||||
'employeeProfile' => fn($q) => $q->where('tenant_id', $tenantId),
|
||||
'employeeProfile' => fn ($q) => $q->where('tenant_id', $tenantId),
|
||||
'employeeProfile.department:id,name',
|
||||
]);
|
||||
|
||||
// 검색 필터 (직원명)
|
||||
if (!empty($params['search'])) {
|
||||
if (! empty($params['search'])) {
|
||||
$search = $params['search'];
|
||||
$query->whereHas('employee', function ($q) use ($search) {
|
||||
$q->where('name', 'like', "%{$search}%");
|
||||
@@ -32,27 +32,27 @@ public function index(array $params): LengthAwarePaginator
|
||||
}
|
||||
|
||||
// 연도 필터
|
||||
if (!empty($params['year'])) {
|
||||
if (! empty($params['year'])) {
|
||||
$query->where('year', $params['year']);
|
||||
}
|
||||
|
||||
// 월 필터
|
||||
if (!empty($params['month'])) {
|
||||
if (! empty($params['month'])) {
|
||||
$query->where('month', $params['month']);
|
||||
}
|
||||
|
||||
// 상태 필터
|
||||
if (!empty($params['status'])) {
|
||||
if (! empty($params['status'])) {
|
||||
$query->where('status', $params['status']);
|
||||
}
|
||||
|
||||
// 기간 필터
|
||||
if (!empty($params['start_date']) && !empty($params['end_date'])) {
|
||||
if (! empty($params['start_date']) && ! empty($params['end_date'])) {
|
||||
$query->whereBetween('payment_date', [$params['start_date'], $params['end_date']]);
|
||||
}
|
||||
|
||||
// 직원 ID 필터
|
||||
if (!empty($params['employee_id'])) {
|
||||
if (! empty($params['employee_id'])) {
|
||||
$query->where('employee_id', $params['employee_id']);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public function show(int $id): Salary
|
||||
->where('tenant_id', $tenantId)
|
||||
->with([
|
||||
'employee:id,name,user_id,email',
|
||||
'employeeProfile' => fn($q) => $q->where('tenant_id', $tenantId),
|
||||
'employeeProfile' => fn ($q) => $q->where('tenant_id', $tenantId),
|
||||
'employeeProfile.department:id,name',
|
||||
])
|
||||
->findOrFail($id);
|
||||
@@ -183,7 +183,7 @@ public function update(int $id, array $data): Salary
|
||||
|
||||
return $salary->fresh()->load([
|
||||
'employee:id,name,user_id,email',
|
||||
'employeeProfile' => fn($q) => $q->where('tenant_id', $tenantId),
|
||||
'employeeProfile' => fn ($q) => $q->where('tenant_id', $tenantId),
|
||||
'employeeProfile.department:id,name',
|
||||
]);
|
||||
});
|
||||
@@ -229,7 +229,7 @@ public function updateStatus(int $id, string $status): Salary
|
||||
|
||||
return $salary->load([
|
||||
'employee:id,name,user_id,email',
|
||||
'employeeProfile' => fn($q) => $q->where('tenant_id', $tenantId),
|
||||
'employeeProfile' => fn ($q) => $q->where('tenant_id', $tenantId),
|
||||
'employeeProfile.department:id,name',
|
||||
]);
|
||||
});
|
||||
@@ -266,15 +266,15 @@ public function getStatistics(array $params): array
|
||||
->where('tenant_id', $tenantId);
|
||||
|
||||
// 연도/월 필터
|
||||
if (!empty($params['year'])) {
|
||||
if (! empty($params['year'])) {
|
||||
$query->where('year', $params['year']);
|
||||
}
|
||||
if (!empty($params['month'])) {
|
||||
if (! empty($params['month'])) {
|
||||
$query->where('month', $params['month']);
|
||||
}
|
||||
|
||||
// 기간 필터
|
||||
if (!empty($params['start_date']) && !empty($params['end_date'])) {
|
||||
if (! empty($params['start_date']) && ! empty($params['end_date'])) {
|
||||
$query->whereBetween('payment_date', [$params['start_date'], $params['end_date']]);
|
||||
}
|
||||
|
||||
@@ -290,4 +290,4 @@ public function getStatistics(array $params): array
|
||||
'scheduled_count' => (clone $query)->where('status', 'scheduled')->count(),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user