style: Pint 포맷팅 적용
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
namespace App\Http\Controllers\Api\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Finance\BankAccount;
|
||||
use App\Services\BankAccountService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -86,7 +85,7 @@ public function store(Request $request): JsonResponse
|
||||
|
||||
// 기본값 설정
|
||||
$validated['status'] = $validated['status'] ?? 'active';
|
||||
$validated['account_name'] = $validated['account_name'] ?? $validated['bank_name'] . ' 계좌';
|
||||
$validated['account_name'] = $validated['account_name'] ?? $validated['bank_name'].' 계좌';
|
||||
|
||||
$account = $this->bankAccountService->createAccount($validated);
|
||||
|
||||
@@ -156,6 +155,7 @@ public function destroy(Request $request, int $id): JsonResponse|Response
|
||||
// HTMX 요청인 경우 갱신된 테이블 반환
|
||||
if ($request->header('HX-Request')) {
|
||||
$accounts = $this->bankAccountService->getAccounts($request->all(), $request->integer('per_page', 15));
|
||||
|
||||
return response(view('finance.accounts.partials.table', compact('accounts')));
|
||||
}
|
||||
|
||||
@@ -184,6 +184,7 @@ public function restore(Request $request, int $id): JsonResponse|Response
|
||||
// HTMX 요청인 경우 갱신된 테이블 반환
|
||||
if ($request->header('HX-Request')) {
|
||||
$accounts = $this->bankAccountService->getAccounts($request->all(), $request->integer('per_page', 15));
|
||||
|
||||
return response(view('finance.accounts.partials.table', compact('accounts')));
|
||||
}
|
||||
|
||||
@@ -212,6 +213,7 @@ public function forceDelete(Request $request, int $id): JsonResponse|Response
|
||||
// HTMX 요청인 경우 갱신된 테이블 반환
|
||||
if ($request->header('HX-Request')) {
|
||||
$accounts = $this->bankAccountService->getAccounts($request->all(), $request->integer('per_page', 15));
|
||||
|
||||
return response(view('finance.accounts.partials.table', compact('accounts')));
|
||||
}
|
||||
|
||||
@@ -240,6 +242,7 @@ public function toggleActive(Request $request, int $id): JsonResponse|Response
|
||||
// HTMX 요청인 경우 갱신된 테이블 반환
|
||||
if ($request->header('HX-Request')) {
|
||||
$accounts = $this->bankAccountService->getAccounts($request->all(), $request->integer('per_page', 15));
|
||||
|
||||
return response(view('finance.accounts.partials.table', compact('accounts')));
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public function subscriptions(Request $request): JsonResponse|Response
|
||||
->orderBy('service_type');
|
||||
|
||||
// 테넌트 필터링
|
||||
if (!$isHeadquarters && !$allTenants) {
|
||||
if (! $isHeadquarters && ! $allTenants) {
|
||||
$query->whereHas('member', function ($q) use ($tenantId) {
|
||||
$q->where('tenant_id', $tenantId);
|
||||
});
|
||||
@@ -102,7 +102,7 @@ public function cancelSubscription(int $id): JsonResponse
|
||||
{
|
||||
$result = $this->billingService->cancelSubscription($id);
|
||||
|
||||
if (!$result) {
|
||||
if (! $result) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '구독을 찾을 수 없습니다.',
|
||||
@@ -121,7 +121,7 @@ public function cancelSubscription(int $id): JsonResponse
|
||||
public function memberSubscriptions(int $memberId): JsonResponse|Response
|
||||
{
|
||||
$member = BarobillMember::with('tenant')->find($memberId);
|
||||
if (!$member) {
|
||||
if (! $member) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '회원사를 찾을 수 없습니다.',
|
||||
@@ -157,7 +157,7 @@ public function billingList(Request $request): JsonResponse|Response
|
||||
$billingMonth = $request->input('billing_month', now()->format('Y-m'));
|
||||
|
||||
// 테넌트 필터링
|
||||
$filterTenantId = (!$isHeadquarters && !$allTenants) ? $tenantId : null;
|
||||
$filterTenantId = (! $isHeadquarters && ! $allTenants) ? $tenantId : null;
|
||||
|
||||
$summaries = BarobillMonthlySummary::with(['member.tenant'])
|
||||
->where('billing_month', $billingMonth)
|
||||
@@ -202,7 +202,7 @@ public function billingStats(Request $request): JsonResponse|Response
|
||||
|
||||
$billingMonth = $request->input('billing_month', now()->format('Y-m'));
|
||||
|
||||
$filterTenantId = (!$isHeadquarters && !$allTenants) ? $tenantId : null;
|
||||
$filterTenantId = (! $isHeadquarters && ! $allTenants) ? $tenantId : null;
|
||||
$stats = $this->billingService->getMonthlyTotal($billingMonth, $filterTenantId);
|
||||
|
||||
if ($request->header('HX-Request')) {
|
||||
@@ -225,7 +225,7 @@ public function billingStats(Request $request): JsonResponse|Response
|
||||
public function memberBilling(Request $request, int $memberId): JsonResponse|Response
|
||||
{
|
||||
$member = BarobillMember::with('tenant')->find($memberId);
|
||||
if (!$member) {
|
||||
if (! $member) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '회원사를 찾을 수 없습니다.',
|
||||
@@ -293,7 +293,7 @@ public function yearlyTrend(Request $request): JsonResponse
|
||||
|
||||
$year = $request->input('year', now()->year);
|
||||
|
||||
$filterTenantId = (!$isHeadquarters && !$allTenants) ? $tenantId : null;
|
||||
$filterTenantId = (! $isHeadquarters && ! $allTenants) ? $tenantId : null;
|
||||
$trend = $this->billingService->getYearlyTrend($year, $filterTenantId);
|
||||
|
||||
return response()->json([
|
||||
@@ -313,7 +313,7 @@ public function export(Request $request)
|
||||
|
||||
$billingMonth = $request->input('billing_month', now()->format('Y-m'));
|
||||
|
||||
$filterTenantId = (!$isHeadquarters && !$allTenants) ? $tenantId : null;
|
||||
$filterTenantId = (! $isHeadquarters && ! $allTenants) ? $tenantId : null;
|
||||
|
||||
$summaries = BarobillMonthlySummary::with(['member.tenant'])
|
||||
->where('billing_month', $billingMonth)
|
||||
@@ -336,7 +336,7 @@ public function export(Request $request)
|
||||
|
||||
$callback = function () use ($summaries, $total, $isHeadquarters, $allTenants) {
|
||||
$file = fopen('php://output', 'w');
|
||||
fprintf($file, chr(0xEF) . chr(0xBB) . chr(0xBF));
|
||||
fprintf($file, chr(0xEF).chr(0xBB).chr(0xBF));
|
||||
|
||||
// 헤더
|
||||
$headerRow = ['사업자번호', '상호', '계좌조회', '카드내역', '홈텍스', '월정액합계', '세금계산서(건)', '세금계산서(원)', '건별합계', '총합계'];
|
||||
@@ -411,7 +411,7 @@ public function pricingPolicies(Request $request): JsonResponse|Response
|
||||
public function updatePricingPolicy(Request $request, int $id): JsonResponse
|
||||
{
|
||||
$policy = BarobillPricingPolicy::find($id);
|
||||
if (!$policy) {
|
||||
if (! $policy) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '정책을 찾을 수 없습니다.',
|
||||
@@ -444,7 +444,7 @@ public function updatePricingPolicy(Request $request, int $id): JsonResponse
|
||||
public function getPricingPolicy(int $id): JsonResponse
|
||||
{
|
||||
$policy = BarobillPricingPolicy::find($id);
|
||||
if (!$policy) {
|
||||
if (! $policy) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '정책을 찾을 수 없습니다.',
|
||||
|
||||
@@ -94,7 +94,7 @@ public function show(int $id): JsonResponse
|
||||
{
|
||||
$config = BarobillConfig::find($id);
|
||||
|
||||
if (!$config) {
|
||||
if (! $config) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '설정을 찾을 수 없습니다.',
|
||||
@@ -114,7 +114,7 @@ public function update(Request $request, int $id): JsonResponse
|
||||
{
|
||||
$config = BarobillConfig::find($id);
|
||||
|
||||
if (!$config) {
|
||||
if (! $config) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '설정을 찾을 수 없습니다.',
|
||||
@@ -167,7 +167,7 @@ public function destroy(int $id): JsonResponse
|
||||
{
|
||||
$config = BarobillConfig::find($id);
|
||||
|
||||
if (!$config) {
|
||||
if (! $config) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '설정을 찾을 수 없습니다.',
|
||||
@@ -196,7 +196,7 @@ public function toggleActive(int $id): JsonResponse
|
||||
{
|
||||
$config = BarobillConfig::find($id);
|
||||
|
||||
if (!$config) {
|
||||
if (! $config) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '설정을 찾을 수 없습니다.',
|
||||
@@ -205,14 +205,14 @@ public function toggleActive(int $id): JsonResponse
|
||||
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
if (!$config->is_active) {
|
||||
if (! $config->is_active) {
|
||||
// 활성화하려면 같은 환경의 다른 설정들 비활성화
|
||||
BarobillConfig::where('environment', $config->environment)
|
||||
->where('id', '!=', $id)
|
||||
->update(['is_active' => false]);
|
||||
}
|
||||
|
||||
$config->update(['is_active' => !$config->is_active]);
|
||||
$config->update(['is_active' => ! $config->is_active]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
@@ -231,5 +231,4 @@ public function toggleActive(int $id): JsonResponse
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public function show(): JsonResponse
|
||||
// 바로빌 회원사 정보 조회 (담당자 정보 기본값용)
|
||||
$barobillMember = BarobillMember::where('tenant_id', $tenantId)->first();
|
||||
|
||||
if (!$setting) {
|
||||
if (! $setting) {
|
||||
// 설정이 없으면 바로빌 회원사 정보를 기본값으로 사용
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
@@ -158,7 +158,7 @@ public function checkService(string $service): JsonResponse
|
||||
|
||||
$setting = BarobillSetting::where('tenant_id', $tenantId)->first();
|
||||
|
||||
if (!$setting) {
|
||||
if (! $setting) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'enabled' => false,
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* 바로빌 사용량조회 API 컨트롤러
|
||||
@@ -44,7 +43,7 @@ public function index(Request $request): JsonResponse|Response
|
||||
$apiEndDate = str_replace('-', '', $endDate);
|
||||
|
||||
// 테넌트 필터링
|
||||
$filterTenantId = (!$isHeadquarters && !$allTenants && $tenantId) ? $tenantId : null;
|
||||
$filterTenantId = (! $isHeadquarters && ! $allTenants && $tenantId) ? $tenantId : null;
|
||||
|
||||
// 사용량 목록 조회
|
||||
$usageList = $this->usageService->getUsageList($apiStartDate, $apiEndDate, $filterTenantId);
|
||||
@@ -117,7 +116,7 @@ public function stats(Request $request): JsonResponse|Response
|
||||
$apiEndDate = str_replace('-', '', $endDate);
|
||||
|
||||
// 테넌트 필터링
|
||||
$filterTenantId = (!$isHeadquarters && !$allTenants && $tenantId) ? $tenantId : null;
|
||||
$filterTenantId = (! $isHeadquarters && ! $allTenants && $tenantId) ? $tenantId : null;
|
||||
|
||||
// 사용량 목록 조회 및 통계 집계
|
||||
$usageList = $this->usageService->getUsageList($apiStartDate, $apiEndDate, $filterTenantId);
|
||||
@@ -145,7 +144,7 @@ public function show(Request $request, int $memberId): JsonResponse|Response
|
||||
{
|
||||
$member = BarobillMember::with('tenant:id,company_name')->find($memberId);
|
||||
|
||||
if (!$member) {
|
||||
if (! $member) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '회원사를 찾을 수 없습니다.',
|
||||
@@ -209,7 +208,7 @@ public function export(Request $request)
|
||||
$apiEndDate = str_replace('-', '', $endDate);
|
||||
|
||||
// 테넌트 필터링
|
||||
$filterTenantId = (!$isHeadquarters && !$allTenants && $tenantId) ? $tenantId : null;
|
||||
$filterTenantId = (! $isHeadquarters && ! $allTenants && $tenantId) ? $tenantId : null;
|
||||
|
||||
// 사용량 목록 조회
|
||||
$usageList = $this->usageService->getUsageList($apiStartDate, $apiEndDate, $filterTenantId);
|
||||
@@ -227,7 +226,7 @@ public function export(Request $request)
|
||||
$file = fopen('php://output', 'w');
|
||||
|
||||
// BOM for Excel UTF-8
|
||||
fprintf($file, chr(0xEF) . chr(0xBB) . chr(0xBF));
|
||||
fprintf($file, chr(0xEF).chr(0xBB).chr(0xBF));
|
||||
|
||||
// 헤더
|
||||
$headerRow = ['사업자번호', '상호', '바로빌ID', '세금계산서(건)', '계좌조회(건)', '카드내역(건)', '홈텍스(건)', '과금액(원)'];
|
||||
|
||||
@@ -335,4 +335,4 @@ public function reorder(Request $request): JsonResponse
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ public function destroy(int $id): JsonResponse
|
||||
*/
|
||||
public function forceDestroy(int $id): JsonResponse
|
||||
{
|
||||
if (!auth()->user()?->is_super_admin) {
|
||||
if (! auth()->user()?->is_super_admin) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '슈퍼관리자만 영구 삭제할 수 있습니다.',
|
||||
@@ -263,7 +263,7 @@ public function forceDestroy(int $id): JsonResponse
|
||||
*/
|
||||
public function restore(int $id): JsonResponse
|
||||
{
|
||||
if (!auth()->user()?->is_super_admin) {
|
||||
if (! auth()->user()?->is_super_admin) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '슈퍼관리자만 복원할 수 있습니다.',
|
||||
|
||||
@@ -66,7 +66,7 @@ public function index(Request $request): View
|
||||
}
|
||||
|
||||
// 활성 상태 필터
|
||||
if ($request->filled('is_active') && !$showTrashed) {
|
||||
if ($request->filled('is_active') && ! $showTrashed) {
|
||||
$query->where('is_active', $request->boolean('is_active'));
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ public function destroy(int $id): JsonResponse
|
||||
*/
|
||||
public function forceDestroy(int $id): JsonResponse
|
||||
{
|
||||
if (!auth()->user()?->is_super_admin) {
|
||||
if (! auth()->user()?->is_super_admin) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '슈퍼관리자만 영구 삭제할 수 있습니다.',
|
||||
@@ -337,7 +337,7 @@ public function forceDestroy(int $id): JsonResponse
|
||||
*/
|
||||
public function restore(int $id): JsonResponse
|
||||
{
|
||||
if (!auth()->user()?->is_super_admin) {
|
||||
if (! auth()->user()?->is_super_admin) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '슈퍼관리자만 복원할 수 있습니다.',
|
||||
@@ -535,7 +535,7 @@ public function uploadImage(Request $request): JsonResponse
|
||||
}
|
||||
|
||||
// API 토큰 교환
|
||||
$tokenService = new \App\Services\ApiTokenService();
|
||||
$tokenService = new \App\Services\ApiTokenService;
|
||||
$userId = auth()->id();
|
||||
$tenantId = session('selected_tenant_id', 1);
|
||||
|
||||
|
||||
@@ -182,6 +182,7 @@ public function destroy(Request $request, int $id): JsonResponse|Response
|
||||
$month = $request->integer('month', now()->month);
|
||||
$calendarData = $this->fundScheduleService->getCalendarData($year, $month);
|
||||
$summary = $this->fundScheduleService->getMonthlySummary($year, $month);
|
||||
|
||||
return response(view('finance.fund-schedules.partials.calendar', compact('year', 'month', 'calendarData', 'summary')));
|
||||
}
|
||||
|
||||
@@ -229,6 +230,7 @@ public function updateStatus(Request $request, int $id): JsonResponse|Response
|
||||
$month = $request->integer('month', now()->month);
|
||||
$calendarData = $this->fundScheduleService->getCalendarData($year, $month);
|
||||
$summary = $this->fundScheduleService->getMonthlySummary($year, $month);
|
||||
|
||||
return response(view('finance.fund-schedules.partials.calendar', compact('year', 'month', 'calendarData', 'summary')));
|
||||
}
|
||||
|
||||
|
||||
@@ -266,6 +266,7 @@ public function bulkCopyToTenant(Request $request): JsonResponse
|
||||
|
||||
if ($exists) {
|
||||
$skipped++;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -288,6 +289,7 @@ public function bulkCopyToTenant(Request $request): JsonResponse
|
||||
]);
|
||||
$idMap[$gc->id] = $trashed->id;
|
||||
$copied++;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -336,4 +338,4 @@ public function bulkCopyToTenant(Request $request): JsonResponse
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public function search(Request $request): JsonResponse
|
||||
->where('user_tenants.tenant_id', $tenantId)
|
||||
->where('user_tenants.is_active', true);
|
||||
})
|
||||
->leftJoin('departments', function ($join) use ($tenantId) {
|
||||
->leftJoin('departments', function ($join) {
|
||||
$join->on('departments.id', '=', DB::raw('(
|
||||
SELECT du.department_id FROM department_user du
|
||||
WHERE du.user_id = users.id AND du.is_primary = 1
|
||||
|
||||
Reference in New Issue
Block a user