80 lines
2.4 KiB
PHP
80 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Sales;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\View\View;
|
|
|
|
/**
|
|
* 영업관리 대시보드 컨트롤러
|
|
*/
|
|
class SalesDashboardController extends Controller
|
|
{
|
|
/**
|
|
* 대시보드 화면
|
|
*/
|
|
public function index(Request $request): View
|
|
{
|
|
// 기간 설정
|
|
$period = $request->input('period', 'month'); // month or custom
|
|
$year = $request->input('year', now()->year);
|
|
$month = $request->input('month', now()->month);
|
|
|
|
// 기간 설정 모드일 경우
|
|
if ($period === 'custom') {
|
|
$startDate = $request->input('start_date', now()->startOfMonth()->format('Y-m-d'));
|
|
$endDate = $request->input('end_date', now()->format('Y-m-d'));
|
|
} else {
|
|
$startDate = now()->startOfMonth()->format('Y-m-d');
|
|
$endDate = now()->endOfMonth()->format('Y-m-d');
|
|
}
|
|
|
|
// 통계 데이터 (임시 데이터 - 추후 실제 데이터로 교체)
|
|
$stats = [
|
|
'total_membership_fee' => 0, // 총 가입비
|
|
'total_commission' => 0, // 총 수당
|
|
'commission_rate' => 0, // 지급 승인 완료 비율
|
|
'total_contracts' => 0, // 전체 건수
|
|
'pending_membership_approval' => 0, // 가입 승인 대기
|
|
'pending_payment_approval' => 0, // 지급 승인 대기
|
|
];
|
|
|
|
// 역할별 수당 상세
|
|
$commissionByRole = [
|
|
[
|
|
'name' => '판매자',
|
|
'rate' => 20,
|
|
'amount' => 0,
|
|
'color' => 'green',
|
|
],
|
|
[
|
|
'name' => '관리자',
|
|
'rate' => 5,
|
|
'amount' => 0,
|
|
'color' => 'blue',
|
|
],
|
|
[
|
|
'name' => '매뉴제작 협업수당',
|
|
'rate' => null, // 별도
|
|
'amount' => null, // 운영팀 산정
|
|
'color' => 'red',
|
|
],
|
|
];
|
|
|
|
// 총 가입비 대비 수당
|
|
$totalCommissionRatio = 0;
|
|
|
|
return view('sales.dashboard.index', compact(
|
|
'stats',
|
|
'commissionByRole',
|
|
'totalCommissionRatio',
|
|
'period',
|
|
'year',
|
|
'month',
|
|
'startDate',
|
|
'endDate'
|
|
));
|
|
}
|
|
}
|