feat: 바로빌 회원사관리 CRUD 기능 구현

레거시(sam/sales/barobill/registration)를 Laravel 스타일로 마이그레이션

- Migration: barobill_members 테이블 생성
- Model: BarobillMember (상태 라벨, 사업자번호 포맷팅 등)
- API Controller: CRUD + 통계 조회 (HTMX HTML 반환 지원)
- API Routes: /api/admin/barobill/members/*
- Views:
  - index.blade.php (통계 카드, 필터, 테이블, 모달)
  - partials/table.blade.php (HTMX 테이블)
  - partials/stats.blade.php (통계 카드)
  - partials/modal-form.blade.php (등록/수정 폼, 자동완성)

기능:
- 회원사 목록 조회 (검색, 상태 필터)
- 회원사 등록 (사업자번호 중복 체크)
- 회원사 수정 (모달)
- 회원사 삭제 (확인 후)
- 테스트 데이터 자동완성

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
pro
2026-01-22 08:49:25 +09:00
parent 154b65b4d2
commit f60f84670a
10 changed files with 926 additions and 103 deletions

View File

@@ -0,0 +1,230 @@
<?php
namespace App\Http\Controllers\Api\Admin\Barobill;
use App\Http\Controllers\Controller;
use App\Models\Barobill\BarobillMember;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rule;
class BarobillMemberController extends Controller
{
/**
* 회원사 목록 조회
*/
public function index(Request $request): JsonResponse|Response
{
$tenantId = session('selected_tenant_id');
$query = BarobillMember::query()
->when($tenantId, fn($q) => $q->where('tenant_id', $tenantId))
->when($request->search, function ($q, $search) {
$q->where(function ($q) use ($search) {
$q->where('corp_name', 'like', "%{$search}%")
->orWhere('biz_no', 'like', "%{$search}%")
->orWhere('barobill_id', 'like', "%{$search}%")
->orWhere('manager_name', 'like', "%{$search}%");
});
})
->when($request->status, fn($q, $status) => $q->where('status', $status))
->with('tenant:id,company_name')
->orderBy('created_at', 'desc');
$members = $query->paginate($request->integer('per_page', 15));
// HTMX 요청 시 HTML 반환
if ($request->header('HX-Request')) {
return response(
view('barobill.members.partials.table', compact('members'))->render(),
200,
['Content-Type' => 'text/html']
);
}
return response()->json([
'success' => true,
'data' => $members->items(),
'meta' => [
'current_page' => $members->currentPage(),
'last_page' => $members->lastPage(),
'per_page' => $members->perPage(),
'total' => $members->total(),
],
]);
}
/**
* 회원사 등록
*/
public function store(Request $request): JsonResponse
{
$tenantId = session('selected_tenant_id');
if (!$tenantId) {
return response()->json([
'success' => false,
'message' => '테넌트를 선택해주세요.',
], 400);
}
$validated = $request->validate([
'biz_no' => [
'required',
'string',
'max:20',
Rule::unique('barobill_members')->where(function ($query) use ($tenantId) {
return $query->where('tenant_id', $tenantId);
}),
],
'corp_name' => 'required|string|max:100',
'ceo_name' => 'required|string|max:50',
'addr' => 'nullable|string|max:255',
'biz_type' => 'nullable|string|max:50',
'biz_class' => 'nullable|string|max:50',
'barobill_id' => 'required|string|max:50',
'barobill_pwd' => 'required|string|max:255',
'manager_name' => 'nullable|string|max:50',
'manager_email' => 'nullable|email|max:100',
'manager_hp' => 'nullable|string|max:20',
'status' => 'nullable|in:active,inactive,pending',
], [
'biz_no.required' => '사업자번호를 입력해주세요.',
'biz_no.unique' => '이미 등록된 사업자번호입니다.',
'corp_name.required' => '상호명을 입력해주세요.',
'ceo_name.required' => '대표자명을 입력해주세요.',
'barobill_id.required' => '바로빌 아이디를 입력해주세요.',
'barobill_pwd.required' => '비밀번호를 입력해주세요.',
]);
$validated['tenant_id'] = $tenantId;
$validated['barobill_pwd'] = Hash::make($validated['barobill_pwd']);
$validated['status'] = $validated['status'] ?? 'active';
$member = BarobillMember::create($validated);
return response()->json([
'success' => true,
'message' => '회원사가 등록되었습니다.',
'data' => $member,
], 201);
}
/**
* 회원사 상세 조회
*/
public function show(Request $request, int $id): JsonResponse
{
$member = BarobillMember::with('tenant:id,company_name')->find($id);
if (!$member) {
return response()->json([
'success' => false,
'message' => '회원사를 찾을 수 없습니다.',
], 404);
}
// HTMX 요청 시 HTML 반환
if ($request->header('HX-Request')) {
return response()->json([
'html' => view('barobill.members.partials.detail', compact('member'))->render(),
]);
}
return response()->json([
'success' => true,
'data' => $member,
]);
}
/**
* 회원사 수정
*/
public function update(Request $request, int $id): JsonResponse
{
$member = BarobillMember::find($id);
if (!$member) {
return response()->json([
'success' => false,
'message' => '회원사를 찾을 수 없습니다.',
], 404);
}
$validated = $request->validate([
'corp_name' => 'required|string|max:100',
'ceo_name' => 'required|string|max:50',
'addr' => 'nullable|string|max:255',
'biz_type' => 'nullable|string|max:50',
'biz_class' => 'nullable|string|max:50',
'manager_name' => 'nullable|string|max:50',
'manager_email' => 'nullable|email|max:100',
'manager_hp' => 'nullable|string|max:20',
'status' => 'nullable|in:active,inactive,pending',
]);
$member->update($validated);
return response()->json([
'success' => true,
'message' => '회원사 정보가 수정되었습니다.',
'data' => $member->fresh(),
]);
}
/**
* 회원사 삭제
*/
public function destroy(int $id): JsonResponse
{
$member = BarobillMember::find($id);
if (!$member) {
return response()->json([
'success' => false,
'message' => '회원사를 찾을 수 없습니다.',
], 404);
}
$member->delete();
return response()->json([
'success' => true,
'message' => '회원사가 삭제되었습니다.',
]);
}
/**
* 통계 조회
*/
public function stats(Request $request): JsonResponse|Response
{
$tenantId = session('selected_tenant_id');
$query = BarobillMember::query()
->when($tenantId, fn($q) => $q->where('tenant_id', $tenantId));
$stats = [
'total' => (clone $query)->count(),
'active' => (clone $query)->where('status', 'active')->count(),
'inactive' => (clone $query)->where('status', 'inactive')->count(),
'pending' => (clone $query)->where('status', 'pending')->count(),
];
// HTMX 요청 시 HTML 반환
if ($request->header('HX-Request')) {
return response(
view('barobill.members.partials.stats', compact('stats'))->render(),
200,
['Content-Type' => 'text/html']
);
}
return response()->json([
'success' => true,
'data' => $stats,
]);
}
}

View File

@@ -3,6 +3,8 @@
namespace App\Http\Controllers\Barobill;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\View\View;
/**
@@ -12,9 +14,14 @@ class BarobillController extends Controller
{
/**
* 회원사관리 페이지
* HTMX 요청 시 전체 페이지 리로드 (스크립트 로딩을 위해)
*/
public function members(): View
public function members(Request $request): View|Response
{
if ($request->header('HX-Request')) {
return response('', 200)->header('HX-Redirect', route('barobill.members.index'));
}
return view('barobill.members.index');
}
}

View File

@@ -0,0 +1,87 @@
<?php
namespace App\Models\Barobill;
use App\Models\Tenants\Tenant;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class BarobillMember extends Model
{
use SoftDeletes;
protected $table = 'barobill_members';
protected $fillable = [
'tenant_id',
'biz_no',
'corp_name',
'ceo_name',
'addr',
'biz_type',
'biz_class',
'barobill_id',
'barobill_pwd',
'manager_name',
'manager_email',
'manager_hp',
'status',
];
protected $casts = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
];
protected $hidden = [
'barobill_pwd',
];
/**
* 테넌트 관계
*/
public function tenant(): BelongsTo
{
return $this->belongsTo(Tenant::class);
}
/**
* 사업자번호 포맷팅 (XXX-XX-XXXXX)
*/
public function getFormattedBizNoAttribute(): string
{
$bizNo = preg_replace('/[^0-9]/', '', $this->biz_no);
if (strlen($bizNo) === 10) {
return substr($bizNo, 0, 3) . '-' . substr($bizNo, 3, 2) . '-' . substr($bizNo, 5);
}
return $this->biz_no;
}
/**
* 상태 라벨
*/
public function getStatusLabelAttribute(): string
{
return match ($this->status) {
'active' => '활성',
'inactive' => '비활성',
'pending' => '대기중',
default => $this->status,
};
}
/**
* 상태별 색상 클래스
*/
public function getStatusColorAttribute(): string
{
return match ($this->status) {
'active' => 'bg-green-100 text-green-800',
'inactive' => 'bg-gray-100 text-gray-800',
'pending' => 'bg-yellow-100 text-yellow-800',
default => 'bg-gray-100 text-gray-800',
};
}
}

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('barobill_members', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->constrained()->cascadeOnDelete();
$table->string('biz_no', 20)->comment('사업자번호');
$table->string('corp_name', 100)->comment('상호명');
$table->string('ceo_name', 50)->comment('대표자명');
$table->string('addr', 255)->nullable()->comment('주소');
$table->string('biz_type', 50)->nullable()->comment('업태');
$table->string('biz_class', 50)->nullable()->comment('종목');
$table->string('barobill_id', 50)->comment('바로빌 아이디');
$table->string('barobill_pwd', 255)->comment('바로빌 비밀번호 (해시)');
$table->string('manager_name', 50)->nullable()->comment('담당자명');
$table->string('manager_email', 100)->nullable()->comment('담당자 이메일');
$table->string('manager_hp', 20)->nullable()->comment('담당자 전화번호');
$table->enum('status', ['active', 'inactive', 'pending'])->default('active')->comment('상태');
$table->timestamps();
$table->softDeletes();
$table->unique(['tenant_id', 'biz_no'], 'unique_tenant_biz_no');
$table->index('status');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('barobill_members');
}
};

View File

@@ -5,12 +5,31 @@
@section('content')
<!-- 페이지 헤더 -->
<div class="flex flex-col sm:flex-row sm:justify-between sm:items-center gap-4 mb-6">
<h1 class="text-2xl font-bold text-gray-800">회원사관리</h1>
<button type="button" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg transition text-center w-full sm:w-auto">
+ 회원사 등록
<div>
<h1 class="text-2xl font-bold text-gray-800">회원사관리</h1>
<p class="text-sm text-gray-500 mt-1">바로빌 연동 회원사 관리합니다</p>
</div>
<button
type="button"
onclick="MemberModal.openCreate()"
class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg transition text-center w-full sm:w-auto flex items-center justify-center gap-2"
>
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
회원사 등록
</button>
</div>
<!-- 통계 카드 -->
<div id="stats-container"
hx-get="/api/admin/barobill/members/stats"
hx-trigger="load, memberUpdated from:body"
hx-headers='{"X-CSRF-TOKEN": "{{ csrf_token() }}"}'
class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-6">
@include('barobill.members.partials.stats-skeleton')
</div>
<!-- 필터 영역 -->
<x-filter-collapsible id="memberFilterForm">
<form id="memberFilterForm" class="flex flex-wrap gap-2 sm:gap-4">
@@ -18,12 +37,12 @@
<div class="flex-1 min-w-0 w-full sm:w-auto">
<input type="text"
name="search"
placeholder="회원사명, 사업자번호로 검색..."
placeholder="상호명, 사업자번호, 바로빌ID로 검색..."
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<!-- 상태 필터 -->
<div class="w-full sm:w-48">
<div class="w-full sm:w-40">
<select name="status" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="">전체 상태</option>
<option value="active">활성</option>
@@ -39,103 +58,191 @@ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none foc
</form>
</x-filter-collapsible>
<!-- 테이블 영역 -->
<div class="bg-white rounded-lg shadow-sm overflow-hidden">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
회원사명
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
사업자번호
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
대표자
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
연락처
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
상태
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
등록일
</th>
<th scope="col" class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">
관리
</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<!-- 샘플 데이터 -->
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm font-medium text-gray-900">()코드브릿지</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-500">123-45-67890</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">홍길동</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-500">02-1234-5678</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
활성
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
2024-01-15
</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<button type="button" class="text-blue-600 hover:text-blue-900 mr-3">상세</button>
<button type="button" class="text-gray-600 hover:text-gray-900">수정</button>
</td>
</tr>
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm font-medium text-gray-900">()테스트컴퍼니</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-500">987-65-43210</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">김철수</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-500">031-987-6543</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">
대기중
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
2024-01-20
</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<button type="button" class="text-blue-600 hover:text-blue-900 mr-3">상세</button>
<button type="button" class="text-gray-600 hover:text-gray-900">수정</button>
</td>
</tr>
</tbody>
</table>
</div>
<!-- 안내 메시지 -->
<div class="px-6 py-4 bg-blue-50 border-t border-blue-100">
<div class="flex items-center">
<svg class="w-5 h-5 text-blue-500 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<span class="text-sm text-blue-700">
바로빌 API와 연동하여 회원사 정보를 관리합니다. 실제 데이터는 API 연동 표시됩니다.
</span>
</div>
<!-- 테이블 영역 (HTMX로 로드) -->
<div id="member-table"
hx-get="/api/admin/barobill/members"
hx-trigger="load, filterSubmit from:body, memberUpdated from:body"
hx-include="#memberFilterForm"
hx-headers='{"X-CSRF-TOKEN": "{{ csrf_token() }}"}'
class="bg-white rounded-lg shadow-sm overflow-hidden">
<!-- 로딩 스피너 -->
<div class="flex justify-center items-center p-12">
<div class="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"></div>
</div>
</div>
<!-- 등록/수정 모달 -->
@include('barobill.members.partials.modal-form')
@endsection
@push('scripts')
<script>
// 폼 제출 시 HTMX 이벤트 트리거
document.getElementById('memberFilterForm').addEventListener('submit', function(e) {
e.preventDefault();
htmx.trigger('#member-table', 'filterSubmit');
});
// 회원사 모달 관리
const MemberModal = {
modal: null,
form: null,
isEditing: false,
currentId: null,
init() {
this.modal = document.getElementById('memberModal');
this.form = document.getElementById('memberForm');
},
openCreate() {
this.isEditing = false;
this.currentId = null;
this.resetForm();
document.getElementById('modalTitle').textContent = '회원사 등록';
document.getElementById('submitBtn').textContent = '등록하기';
document.getElementById('passwordFields').classList.remove('hidden');
this.modal.classList.remove('hidden');
},
openEdit(id) {
this.isEditing = true;
this.currentId = id;
this.resetForm();
document.getElementById('modalTitle').textContent = '회원사 수정';
document.getElementById('submitBtn').textContent = '수정하기';
document.getElementById('passwordFields').classList.add('hidden');
// 데이터 로드
fetch(`/api/admin/barobill/members/${id}`, {
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}',
'Accept': 'application/json'
}
})
.then(res => res.json())
.then(data => {
if (data.success) {
const m = data.data;
this.form.biz_no.value = m.biz_no || '';
this.form.biz_no.disabled = true;
this.form.corp_name.value = m.corp_name || '';
this.form.ceo_name.value = m.ceo_name || '';
this.form.addr.value = m.addr || '';
this.form.biz_type.value = m.biz_type || '';
this.form.biz_class.value = m.biz_class || '';
this.form.barobill_id.value = m.barobill_id || '';
this.form.barobill_id.disabled = true;
this.form.manager_name.value = m.manager_name || '';
this.form.manager_email.value = m.manager_email || '';
this.form.manager_hp.value = m.manager_hp || '';
this.form.status.value = m.status || 'active';
}
});
this.modal.classList.remove('hidden');
},
close() {
this.modal.classList.add('hidden');
this.resetForm();
},
resetForm() {
this.form.reset();
this.form.biz_no.disabled = false;
this.form.barobill_id.disabled = false;
},
async submit(e) {
e.preventDefault();
const formData = new FormData(this.form);
const data = Object.fromEntries(formData.entries());
// 수정 시 disabled 필드 제외
if (this.isEditing) {
delete data.biz_no;
delete data.barobill_id;
delete data.barobill_pwd;
}
const url = this.isEditing
? `/api/admin/barobill/members/${this.currentId}`
: '/api/admin/barobill/members';
const method = this.isEditing ? 'PUT' : 'POST';
try {
const res = await fetch(url, {
method: method,
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': '{{ csrf_token() }}',
'Accept': 'application/json'
},
body: JSON.stringify(data)
});
const result = await res.json();
if (result.success) {
showToast(result.message, 'success');
this.close();
htmx.trigger(document.body, 'memberUpdated');
} else {
showToast(result.message || '오류가 발생했습니다.', 'error');
}
} catch (error) {
showToast('통신 오류가 발생했습니다.', 'error');
}
},
fillTestData() {
const randomId = Math.random().toString(36).substring(2, 8);
const randomBiz = `123-45-${Math.floor(10000 + Math.random() * 90000)}`;
this.form.biz_no.value = randomBiz;
this.form.corp_name.value = `테스트기업_${randomId}`;
this.form.ceo_name.value = '홍길동';
this.form.addr.value = '서울특별시 강남구 테헤란로 123';
this.form.biz_type.value = '서비스';
this.form.biz_class.value = '소프트웨어';
this.form.barobill_id.value = `test_${randomId}`;
this.form.barobill_pwd.value = 'password123!';
this.form.manager_name.value = '김철수';
this.form.manager_hp.value = '010-1234-5678';
this.form.manager_email.value = `test_${randomId}@example.com`;
}
};
// 삭제 확인
window.confirmDeleteMember = function(id, name) {
showDeleteConfirm(name, async () => {
try {
const res = await fetch(`/api/admin/barobill/members/${id}`, {
method: 'DELETE',
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}',
'Accept': 'application/json'
}
});
const result = await res.json();
if (result.success) {
showToast(result.message, 'success');
htmx.trigger(document.body, 'memberUpdated');
} else {
showToast(result.message || '삭제 실패', 'error');
}
} catch (error) {
showToast('통신 오류가 발생했습니다.', 'error');
}
});
};
// 초기화
document.addEventListener('DOMContentLoaded', function() {
MemberModal.init();
});
</script>
@endpush

View File

@@ -0,0 +1,143 @@
<!-- 회원사 등록/수정 모달 -->
<div id="memberModal" class="hidden fixed inset-0 z-50 overflow-y-auto">
<div class="flex items-center justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:p-0">
<!-- 배경 오버레이 -->
<div class="fixed inset-0 bg-black/40 backdrop-blur-sm transition-opacity" onclick="MemberModal.close()"></div>
<!-- 모달 컨텐츠 -->
<div class="relative inline-block w-full max-w-2xl bg-white rounded-2xl text-left overflow-hidden shadow-xl transform transition-all sm:my-8">
<!-- 헤더 -->
<div class="px-6 py-4 border-b border-gray-100 flex justify-between items-center bg-gray-50/50">
<h3 id="modalTitle" class="font-bold text-gray-800 flex items-center gap-2">
<span class="w-1.5 h-6 bg-blue-500 rounded-full"></span>
회원사 등록
</h3>
<div class="flex items-center gap-2">
<!-- 자동완성 버튼 -->
<button
type="button"
onclick="MemberModal.fillTestData()"
class="flex items-center gap-1 px-3 py-1.5 bg-amber-100 text-amber-700 rounded-lg hover:bg-amber-200 transition-all text-xs font-bold"
title="테스트 데이터 자동 입력"
>
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
</svg>
자동완성
</button>
<button
type="button"
onclick="MemberModal.close()"
class="w-10 h-10 flex items-center justify-center rounded-full text-gray-600 hover:text-gray-900 hover:bg-gray-200 transition-all bg-white/50 shadow-sm border border-gray-200"
>
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
<!-- -->
<form id="memberForm" onsubmit="MemberModal.submit(event)" class="p-6">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<!-- 사업자번호 -->
<div>
<label class="block text-xs font-bold text-gray-400 uppercase mb-1">사업자번호 <span class="text-red-500">*</span></label>
<input type="text" name="biz_no" class="w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 disabled:opacity-50" required placeholder="123-45-67890">
</div>
<!-- 상호명 -->
<div>
<label class="block text-xs font-bold text-gray-400 uppercase mb-1">상호명 <span class="text-red-500">*</span></label>
<input type="text" name="corp_name" class="w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500" required placeholder="(주)회사명">
</div>
<!-- 대표자명 -->
<div>
<label class="block text-xs font-bold text-gray-400 uppercase mb-1">대표자명 <span class="text-red-500">*</span></label>
<input type="text" name="ceo_name" class="w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500" required placeholder="홍길동">
</div>
<!-- 업태/종목 -->
<div class="grid grid-cols-2 gap-2">
<div>
<label class="block text-xs font-bold text-gray-400 uppercase mb-1">업태</label>
<input type="text" name="biz_type" class="w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="서비스">
</div>
<div>
<label class="block text-xs font-bold text-gray-400 uppercase mb-1">종목</label>
<input type="text" name="biz_class" class="w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="소프트웨어">
</div>
</div>
<!-- 주소 -->
<div class="col-span-2">
<label class="block text-xs font-bold text-gray-400 uppercase mb-1">주소</label>
<input type="text" name="addr" class="w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="서울특별시 강남구...">
</div>
<!-- 바로빌 계정 (등록 시만) -->
<div id="passwordFields" class="col-span-2 grid grid-cols-2 gap-4">
<div>
<label class="block text-xs font-bold text-gray-400 uppercase mb-1">바로빌 아이디 <span class="text-red-500">*</span></label>
<input type="text" name="barobill_id" class="w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 disabled:opacity-50" placeholder="barobill_id">
</div>
<div>
<label class="block text-xs font-bold text-gray-400 uppercase mb-1">비밀번호 <span class="text-red-500">*</span></label>
<input type="password" name="barobill_pwd" class="w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="********">
</div>
</div>
<!-- 구분선 -->
<div class="col-span-2 border-t border-gray-100 my-2"></div>
<!-- 담당자명 -->
<div>
<label class="block text-xs font-bold text-gray-400 uppercase mb-1">담당자명</label>
<input type="text" name="manager_name" class="w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="김철수">
</div>
<!-- 담당자 HP -->
<div>
<label class="block text-xs font-bold text-gray-400 uppercase mb-1">담당자 연락처</label>
<input type="text" name="manager_hp" class="w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="010-1234-5678">
</div>
<!-- 담당자 이메일 -->
<div>
<label class="block text-xs font-bold text-gray-400 uppercase mb-1">담당자 이메일</label>
<input type="email" name="manager_email" class="w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="manager@example.com">
</div>
<!-- 상태 -->
<div>
<label class="block text-xs font-bold text-gray-400 uppercase mb-1">상태</label>
<select name="status" class="w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
<option value="active">활성</option>
<option value="inactive">비활성</option>
<option value="pending">대기중</option>
</select>
</div>
</div>
<!-- 버튼 -->
<div class="flex gap-2 pt-6 mt-4 border-t border-gray-100">
<button
type="submit"
id="submitBtn"
class="flex-1 py-3 bg-blue-600 text-white rounded-lg font-bold hover:bg-blue-700 transition-colors"
>
등록하기
</button>
<button
type="button"
onclick="MemberModal.close()"
class="px-6 py-3 bg-gray-100 text-gray-600 rounded-lg font-bold hover:bg-gray-200 transition-colors"
>
취소
</button>
</div>
</form>
</div>
</div>
</div>

View File

@@ -0,0 +1,33 @@
<!-- 통계 카드 스켈레톤 -->
<div class="bg-white rounded-lg p-6 shadow-sm border border-gray-100 animate-pulse">
<div class="flex items-start justify-between mb-2">
<div class="h-3 bg-gray-200 rounded w-20"></div>
<div class="w-8 h-8 bg-gray-200 rounded-lg"></div>
</div>
<div class="h-8 bg-gray-200 rounded w-16 mb-1"></div>
<div class="h-2 bg-gray-100 rounded w-24"></div>
</div>
<div class="bg-white rounded-lg p-6 shadow-sm border border-gray-100 animate-pulse">
<div class="flex items-start justify-between mb-2">
<div class="h-3 bg-gray-200 rounded w-20"></div>
<div class="w-8 h-8 bg-gray-200 rounded-lg"></div>
</div>
<div class="h-8 bg-gray-200 rounded w-16 mb-1"></div>
<div class="h-2 bg-gray-100 rounded w-24"></div>
</div>
<div class="bg-white rounded-lg p-6 shadow-sm border border-gray-100 animate-pulse">
<div class="flex items-start justify-between mb-2">
<div class="h-3 bg-gray-200 rounded w-20"></div>
<div class="w-8 h-8 bg-gray-200 rounded-lg"></div>
</div>
<div class="h-8 bg-gray-200 rounded w-16 mb-1"></div>
<div class="h-2 bg-gray-100 rounded w-24"></div>
</div>
<div class="bg-white rounded-lg p-6 shadow-sm border border-gray-100 animate-pulse">
<div class="flex items-start justify-between mb-2">
<div class="h-3 bg-gray-200 rounded w-20"></div>
<div class="w-8 h-8 bg-gray-200 rounded-lg"></div>
</div>
<div class="h-8 bg-gray-200 rounded w-16 mb-1"></div>
<div class="h-2 bg-gray-100 rounded w-24"></div>
</div>

View File

@@ -0,0 +1,55 @@
<!-- 연동 회원사 -->
<div class="bg-white rounded-lg p-6 shadow-sm border border-gray-100">
<div class="flex items-start justify-between mb-2">
<h3 class="text-xs font-semibold text-gray-400 uppercase">연동 회원사</h3>
<div class="p-1.5 rounded-lg bg-blue-50 text-blue-600">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" />
</svg>
</div>
</div>
<div class="text-2xl font-bold text-gray-900">{{ number_format($stats['total']) }}</div>
<div class="text-xs text-gray-400 mt-1">DB 실시간 합계</div>
</div>
<!-- 활성 회원사 -->
<div class="bg-white rounded-lg p-6 shadow-sm border border-gray-100">
<div class="flex items-start justify-between mb-2">
<h3 class="text-xs font-semibold text-gray-400 uppercase">활성 회원사</h3>
<div class="p-1.5 rounded-lg bg-green-50 text-green-600">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
</div>
<div class="text-2xl font-bold text-gray-900">{{ number_format($stats['active']) }}</div>
<div class="text-xs text-gray-400 mt-1">정상 운영 </div>
</div>
<!-- 비활성 회원사 -->
<div class="bg-white rounded-lg p-6 shadow-sm border border-gray-100">
<div class="flex items-start justify-between mb-2">
<h3 class="text-xs font-semibold text-gray-400 uppercase">비활성</h3>
<div class="p-1.5 rounded-lg bg-gray-100 text-gray-600">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636" />
</svg>
</div>
</div>
<div class="text-2xl font-bold text-gray-900">{{ number_format($stats['inactive']) }}</div>
<div class="text-xs text-gray-400 mt-1">일시 중지</div>
</div>
<!-- 대기중 -->
<div class="bg-white rounded-lg p-6 shadow-sm border border-gray-100">
<div class="flex items-start justify-between mb-2">
<h3 class="text-xs font-semibold text-gray-400 uppercase">대기중</h3>
<div class="p-1.5 rounded-lg bg-yellow-50 text-yellow-600">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
</div>
<div class="text-2xl font-bold text-gray-900">{{ number_format($stats['pending']) }}</div>
<div class="text-xs text-gray-400 mt-1">승인 대기</div>
</div>

View File

@@ -0,0 +1,104 @@
@if($members->isEmpty())
<div class="p-12 text-center">
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" />
</svg>
<h3 class="mt-2 text-sm font-medium text-gray-900">등록된 회원사가 없습니다</h3>
<p class="mt-1 text-sm text-gray-500"> 회원사를 등록해보세요.</p>
<div class="mt-6">
<button
type="button"
onclick="MemberModal.openCreate()"
class="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700"
>
<svg class="-ml-1 mr-2 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
회원사 등록
</button>
</div>
</div>
@else
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
사업자번호
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
상호 / 대표자
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
바로빌 ID
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
담당자 정보
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
상태
</th>
<th scope="col" class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">
관리
</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@foreach($members as $member)
<tr class="hover:bg-gray-50 transition-colors group">
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm font-mono text-gray-500">{{ $member->formatted_biz_no }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm font-medium text-gray-900">{{ $member->corp_name }}</div>
<div class="text-xs text-gray-400">{{ $member->ceo_name }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-600 font-medium">{{ $member->barobill_id }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-700">{{ $member->manager_name ?: '-' }}</div>
<div class="text-xs text-gray-400">{{ $member->manager_email ?: '' }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full {{ $member->status_color }}">
{{ $member->status_label }}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<div class="flex justify-end gap-1 opacity-30 group-hover:opacity-100 transition-opacity">
<button
type="button"
onclick="MemberModal.openEdit({{ $member->id }})"
class="p-2 text-blue-600 hover:bg-blue-50 rounded-lg"
title="수정"
>
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" />
</svg>
</button>
<button
type="button"
onclick="confirmDeleteMember({{ $member->id }}, '{{ addslashes($member->corp_name) }}')"
class="p-2 text-red-600 hover:bg-red-50 rounded-lg"
title="삭제"
>
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
</svg>
</button>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<!-- 페이지네이션 -->
@if($members->hasPages())
<div class="px-6 py-4 border-t border-gray-200">
{{ $members->links() }}
</div>
@endif
@endif

View File

@@ -84,6 +84,19 @@
Route::patch('/{id}/status', [\App\Http\Controllers\Api\Admin\FundScheduleController::class, 'updateStatus'])->name('status');
});
// 바로빌 회원사 관리 API
Route::prefix('barobill/members')->name('barobill.members.')->group(function () {
// 통계
Route::get('/stats', [\App\Http\Controllers\Api\Admin\Barobill\BarobillMemberController::class, 'stats'])->name('stats');
// 기본 CRUD
Route::get('/', [\App\Http\Controllers\Api\Admin\Barobill\BarobillMemberController::class, 'index'])->name('index');
Route::post('/', [\App\Http\Controllers\Api\Admin\Barobill\BarobillMemberController::class, 'store'])->name('store');
Route::get('/{id}', [\App\Http\Controllers\Api\Admin\Barobill\BarobillMemberController::class, 'show'])->name('show');
Route::put('/{id}', [\App\Http\Controllers\Api\Admin\Barobill\BarobillMemberController::class, 'update'])->name('update');
Route::delete('/{id}', [\App\Http\Controllers\Api\Admin\Barobill\BarobillMemberController::class, 'destroy'])->name('destroy');
});
// 테넌트 관리 API
Route::prefix('tenants')->name('tenants.')->group(function () {
// 고정 경로는 먼저 정의