122 lines
3.0 KiB
PHP
122 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
use App\Models\LocalGovernmentModel;
|
|
|
|
class Home extends BaseController
|
|
{
|
|
public function index()
|
|
{
|
|
if (session()->get('logged_in')) {
|
|
return $this->dashboard();
|
|
}
|
|
|
|
return view('welcome_message');
|
|
}
|
|
|
|
/**
|
|
* 로그인 후 메인 — site 메뉴 레이아웃 + 종합·그래프(blend) 본문
|
|
*/
|
|
public function dashboard()
|
|
{
|
|
return view('bag/layout/main', [
|
|
'title' => '업무 현황 · 종합·그래프',
|
|
'content' => view('bag/dashboard_blend_inner', [
|
|
'lgLabel' => $this->resolveLgLabel(),
|
|
]),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 디자인 시안(기존 /dashboard 연결 화면)
|
|
*/
|
|
public function dashboardClassicMock()
|
|
{
|
|
return $this->renderDashboard();
|
|
}
|
|
|
|
/**
|
|
* 로그인 후 메인 — 모던형(세로 사이드바) 레이아웃. URL: /dashboard/modern
|
|
*/
|
|
public function dashboardModern()
|
|
{
|
|
return view('bag/lg_dashboard_modern', [
|
|
'lgLabel' => $this->resolveLgLabel(),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 로그인 후 메인 — 정보 집약형 종합 현황. URL: /dashboard/dense
|
|
*/
|
|
public function dashboardDense()
|
|
{
|
|
return view('bag/lg_dashboard_dense', [
|
|
'lgLabel' => $this->resolveLgLabel(),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 로그인 후 메인 — 그래프 중심(Chart.js). URL: /dashboard/charts
|
|
*/
|
|
public function dashboardCharts()
|
|
{
|
|
return view('bag/lg_dashboard_charts', [
|
|
'lgLabel' => $this->resolveLgLabel(),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* /dashboard 와 동일 본문(호환 URL)
|
|
*/
|
|
public function dashboardBlend()
|
|
{
|
|
return $this->dashboard();
|
|
}
|
|
|
|
/**
|
|
* 재고 조회(수불) 화면 (목업)
|
|
*/
|
|
public function inventoryInquiry()
|
|
{
|
|
return view('bag/inventory_inquiry');
|
|
}
|
|
|
|
/**
|
|
* 종량제 수불 그리드 (엔터프라이즈형 목업, 상단 가로 메뉴 + 병합 헤더 표)
|
|
*/
|
|
public function wasteSuibalEnterprise()
|
|
{
|
|
return view('bag/waste_suibal_enterprise');
|
|
}
|
|
|
|
protected function renderDashboard()
|
|
{
|
|
return view('bag/lg_dashboard', [
|
|
'lgLabel' => $this->resolveLgLabel(),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 세션 mb_lg_idx 기준 지자체명 (DB 없거나 실패 시 데모용 문구)
|
|
*/
|
|
protected function resolveLgLabel(): string
|
|
{
|
|
try {
|
|
$idx = session()->get('mb_lg_idx');
|
|
if ($idx === null || $idx === '') {
|
|
return '로그인 지자체 (미지정)';
|
|
}
|
|
$row = model(LocalGovernmentModel::class)->find((int) $idx);
|
|
if ($row && isset($row->lg_name) && $row->lg_name !== '') {
|
|
return (string) $row->lg_name;
|
|
}
|
|
} catch (\Throwable $e) {
|
|
// 테이블 미생성 등
|
|
}
|
|
|
|
return '북구 (데모)';
|
|
}
|
|
|
|
}
|