Compare commits

...

2 Commits

Author SHA1 Message Date
javamon1174
e4bd3f9ffc .gitignore에 deploy.log 추가
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 15:25:51 +09:00
taekyoungc
71edc1eb20 feat: add designated shop detail and PII masking updates
Rebase current admin changes on top of origin/main and exclude local artifacts from tracking to reduce push payload.

Made-with: Cursor
2026-04-08 15:22:24 +09:00
18 changed files with 935 additions and 360 deletions

4
.gitignore vendored
View File

@@ -42,6 +42,7 @@ $RECYCLE.BIN/
# These should never be under version control,
# as it poses a security risk.
.env
env
.env.local
.env.*.local
.env.production
@@ -56,10 +57,12 @@ Vagrantfile
# Local docs & MCP (저장소에 올리지 않음)
#-------------------------
docs/local/
docs/
mcp-servers/
# Cursor MCP — API 키·로컬 경로 등 포함 가능
.cursor/mcp.json
.cursor/
#-------------------------
# Secrets & credentials (보안)
@@ -102,6 +105,7 @@ writable/debugbar/*
!writable/debugbar/index.html
php_errors.log
deploy.log
#-------------------------
# User Guide Temp Files

View File

@@ -17,6 +17,14 @@ $routes->get('bag/waste-suibal-enterprise', 'Home::wasteSuibalEnterprise');
// 사이트 메뉴 (/bag/*)
$routes->get('bag/basic-info', 'Bag::basicInfo');
$routes->get('bag/prices', 'Bag::prices');
$routes->post('bag/prices', 'Bag::prices');
$routes->get('bag/packaging-units', 'Bag::packagingUnits');
$routes->get('bag/code-kinds', 'Bag::codeKinds');
$routes->get('bag/code-details/(:num)', 'Bag::codeDetails/$1');
// 옛 주소 호환: 세부 목록만 사이트로 이동
$routes->get('admin/code-details/(:num)', 'Admin\CodeDetail::index/$1');
$routes->get('bag/purchase-inbound', 'Bag::purchaseInbound');
$routes->get('bag/issue', 'Bag::issue');
$routes->get('bag/inventory', 'Bag::inventory');
@@ -35,6 +43,7 @@ $routes->post('bag/issue/store', 'Bag::issueStore');
$routes->post('bag/issue/cancel/(:num)', 'Bag::issueCancel/$1');
$routes->get('bag/order/create', 'Bag::orderCreate');
$routes->post('bag/order/store', 'Bag::orderStore');
$routes->post('bag/order/cancel/(:num)', 'Bag::orderCancel/$1');
$routes->get('bag/receiving/create', 'Bag::receivingCreate');
$routes->post('bag/receiving/store', 'Bag::receivingStore');
$routes->get('bag/sale/create', 'Bag::saleCreate');
@@ -42,6 +51,112 @@ $routes->post('bag/sale/store', 'Bag::saleStore');
$routes->get('bag/shop-order/create', 'Bag::shopOrderCreate');
$routes->post('bag/shop-order/store', 'Bag::shopOrderStore');
// 메인 사이트 메뉴용 업무 URL (관리자 권한). 동일 컨트롤러가 URI 가 bag 이면 메인 사이트 레이아웃으로 렌더.
$routes->group('bag', ['filter' => 'adminAuth'], static function ($routes): void {
$routes->get('managers', 'Admin\Manager::index');
$routes->post('managers', 'Admin\Manager::index');
$routes->get('managers/create', 'Admin\Manager::create');
$routes->post('managers/store', 'Admin\Manager::store');
$routes->get('managers/edit/(:num)', 'Admin\Manager::edit/$1');
$routes->post('managers/update/(:num)', 'Admin\Manager::update/$1');
$routes->post('managers/delete/(:num)', 'Admin\Manager::delete/$1');
$routes->get('sales-agencies', 'Admin\SalesAgency::index');
$routes->get('sales-agencies/create', 'Admin\SalesAgency::create');
$routes->post('sales-agencies/store', 'Admin\SalesAgency::store');
$routes->get('sales-agencies/edit/(:num)', 'Admin\SalesAgency::edit/$1');
$routes->post('sales-agencies/update/(:num)', 'Admin\SalesAgency::update/$1');
$routes->post('sales-agencies/delete/(:num)', 'Admin\SalesAgency::delete/$1');
$routes->get('companies', 'Admin\Company::index');
$routes->post('companies', 'Admin\Company::index');
$routes->get('companies/create', 'Admin\Company::create');
$routes->post('companies/store', 'Admin\Company::store');
$routes->get('companies/edit/(:num)', 'Admin\Company::edit/$1');
$routes->post('companies/update/(:num)', 'Admin\Company::update/$1');
$routes->post('companies/delete/(:num)', 'Admin\Company::delete/$1');
$routes->get('free-recipients', 'Admin\FreeRecipient::index');
$routes->post('free-recipients', 'Admin\FreeRecipient::index');
$routes->get('free-recipients/create', 'Admin\FreeRecipient::create');
$routes->post('free-recipients/store', 'Admin\FreeRecipient::store');
$routes->get('free-recipients/edit/(:num)', 'Admin\FreeRecipient::edit/$1');
$routes->post('free-recipients/update/(:num)', 'Admin\FreeRecipient::update/$1');
$routes->post('free-recipients/delete/(:num)', 'Admin\FreeRecipient::delete/$1');
$routes->get('designated-shops/export', 'Admin\DesignatedShop::export');
$routes->get('designated-shops/map', 'Admin\DesignatedShop::map');
$routes->get('designated-shops/status', 'Admin\DesignatedShop::status');
$routes->get('designated-shops/show/(:num)', 'Admin\DesignatedShop::show/$1');
$routes->get('designated-shops', 'Admin\DesignatedShop::index');
$routes->get('designated-shops/create', 'Admin\DesignatedShop::create');
$routes->post('designated-shops/store', 'Admin\DesignatedShop::store');
$routes->get('designated-shops/edit/(:num)', 'Admin\DesignatedShop::edit/$1');
$routes->post('designated-shops/update/(:num)', 'Admin\DesignatedShop::update/$1');
$routes->post('designated-shops/delete/(:num)', 'Admin\DesignatedShop::delete/$1');
$routes->get('bag-prices', 'Admin\BagPrice::index');
$routes->get('bag-prices/create', 'Admin\BagPrice::create');
$routes->post('bag-prices/store', 'Admin\BagPrice::store');
$routes->get('bag-prices/edit/(:num)', 'Admin\BagPrice::edit/$1');
$routes->post('bag-prices/update/(:num)', 'Admin\BagPrice::update/$1');
$routes->post('bag-prices/delete/(:num)', 'Admin\BagPrice::delete/$1');
$routes->get('bag-prices/history/(:num)', 'Admin\BagPrice::history/$1');
$routes->get('bag-orders/export', 'Admin\BagOrder::export');
$routes->get('bag-orders', 'Admin\BagOrder::index');
$routes->get('bag-orders/create', 'Admin\BagOrder::create');
$routes->post('bag-orders/store', 'Admin\BagOrder::store');
$routes->get('bag-orders/detail/(:num)', 'Admin\BagOrder::detail/$1');
$routes->post('bag-orders/cancel/(:num)', 'Admin\BagOrder::cancel/$1');
$routes->post('bag-orders/delete/(:num)', 'Admin\BagOrder::delete/$1');
$routes->get('bag-receivings', 'Admin\BagReceiving::index');
$routes->get('bag-receivings/create', 'Admin\BagReceiving::create');
$routes->post('bag-receivings/store', 'Admin\BagReceiving::store');
$routes->get('bag-inventory/export', 'Admin\BagInventory::export');
$routes->get('bag-inventory', 'Admin\BagInventory::index');
$routes->get('shop-orders', 'Admin\ShopOrder::index');
$routes->get('shop-orders/create', 'Admin\ShopOrder::create');
$routes->post('shop-orders/store', 'Admin\ShopOrder::store');
$routes->post('shop-orders/cancel/(:num)', 'Admin\ShopOrder::cancel/$1');
$routes->get('bag-sales/export', 'Admin\BagSale::export');
$routes->get('bag-sales', 'Admin\BagSale::index');
$routes->get('bag-sales/create', 'Admin\BagSale::create');
$routes->post('bag-sales/store', 'Admin\BagSale::store');
$routes->get('bag-issues', 'Admin\BagIssue::index');
$routes->get('bag-issues/create', 'Admin\BagIssue::create');
$routes->post('bag-issues/store', 'Admin\BagIssue::store');
$routes->post('bag-issues/cancel/(:num)', 'Admin\BagIssue::cancel/$1');
$routes->get('packaging-units/manage', 'Admin\PackagingUnit::index');
$routes->get('packaging-units/manage/create', 'Admin\PackagingUnit::create');
$routes->post('packaging-units/manage/store', 'Admin\PackagingUnit::store');
$routes->get('packaging-units/manage/edit/(:num)', 'Admin\PackagingUnit::edit/$1');
$routes->post('packaging-units/manage/update/(:num)', 'Admin\PackagingUnit::update/$1');
$routes->post('packaging-units/manage/delete/(:num)', 'Admin\PackagingUnit::delete/$1');
$routes->get('packaging-units/manage/history/(:num)', 'Admin\PackagingUnit::history/$1');
$routes->get('reports/sales-ledger', 'Admin\SalesReport::salesLedger');
$routes->get('reports/daily-summary', 'Admin\SalesReport::dailySummary');
$routes->get('reports/period-sales', 'Admin\SalesReport::periodSales');
$routes->get('reports/supply-demand', 'Admin\SalesReport::supplyDemand');
$routes->get('reports/yearly-sales', 'Admin\SalesReport::yearlySales');
$routes->get('reports/shop-sales', 'Admin\SalesReport::shopSales');
$routes->get('reports/hometax-export', 'Admin\SalesReport::hometaxExport');
$routes->get('reports/returns', 'Admin\SalesReport::returns');
$routes->get('reports/lot-flow', 'Admin\SalesReport::lotFlow');
$routes->get('reports/misc-flow', 'Admin\SalesReport::miscFlow');
$routes->post('reports/misc-flow', 'Admin\SalesReport::miscFlowStore');
$routes->get('password-change', 'Admin\PasswordChange::index');
$routes->post('password-change', 'Admin\PasswordChange::update');
});
// Auth
$routes->get('login', 'Auth::showLoginForm');
$routes->post('login', 'Auth::login');
@@ -63,6 +178,7 @@ $routes->group('admin', ['filter' => 'adminAuth'], static function ($routes): vo
$routes->post('users/store', 'Admin\User::store');
$routes->get('users/edit/(:num)', 'Admin\User::edit/$1');
$routes->post('users/update/(:num)', 'Admin\User::update/$1');
$routes->post('users/unlock-login/(:num)', 'Admin\User::unlockLogin/$1');
$routes->post('users/delete/(:num)', 'Admin\User::delete/$1');
$routes->get('access/login-history', 'Admin\Access::loginHistory');
$routes->get('access/approvals', 'Admin\Access::approvals');
@@ -84,12 +200,7 @@ $routes->group('admin', ['filter' => 'adminAuth'], static function ($routes): vo
$routes->post('local-governments/update/(:num)', 'Admin\LocalGovernment::update/$1');
$routes->post('local-governments/delete/(:num)', 'Admin\LocalGovernment::delete/$1');
// 비밀번호 변경 (P2-20)
$routes->get('password-change', 'Admin\PasswordChange::index');
$routes->post('password-change', 'Admin\PasswordChange::update');
// 기본코드 종류 관리 (P2-01)
$routes->get('code-kinds', 'Admin\CodeKind::index');
// 기본코드 종류 관리 (P2-01) — 등록·수정·삭제는 관리자 전용
$routes->get('code-kinds/create', 'Admin\CodeKind::create');
$routes->post('code-kinds/store', 'Admin\CodeKind::store');
$routes->get('code-kinds/edit/(:num)', 'Admin\CodeKind::edit/$1');
@@ -97,119 +208,32 @@ $routes->group('admin', ['filter' => 'adminAuth'], static function ($routes): vo
$routes->post('code-kinds/delete/(:num)', 'Admin\CodeKind::delete/$1');
// 세부코드 관리 (P2-02)
$routes->get('code-details/(:num)', 'Admin\CodeDetail::index/$1');
$routes->get('code-details/(:num)/create', 'Admin\CodeDetail::create/$1');
$routes->post('code-details/store', 'Admin\CodeDetail::store');
$routes->get('code-details/edit/(:num)', 'Admin\CodeDetail::edit/$1');
$routes->post('code-details/update/(:num)', 'Admin\CodeDetail::update/$1');
$routes->post('code-details/delete/(:num)', 'Admin\CodeDetail::delete/$1');
// 봉투 단가 관리 (P2-03/04)
$routes->get('bag-prices', 'Admin\BagPrice::index');
$routes->get('bag-prices/create', 'Admin\BagPrice::create');
$routes->post('bag-prices/store', 'Admin\BagPrice::store');
$routes->get('bag-prices/edit/(:num)', 'Admin\BagPrice::edit/$1');
$routes->post('bag-prices/update/(:num)', 'Admin\BagPrice::update/$1');
$routes->post('bag-prices/delete/(:num)', 'Admin\BagPrice::delete/$1');
$routes->get('bag-prices/history/(:num)', 'Admin\BagPrice::history/$1');
// 발주 관리 (P3-01~05)
$routes->get('bag-orders/export', 'Admin\BagOrder::export');
$routes->get('bag-orders', 'Admin\BagOrder::index');
$routes->get('bag-orders/create', 'Admin\BagOrder::create');
$routes->post('bag-orders/store', 'Admin\BagOrder::store');
$routes->get('bag-orders/detail/(:num)', 'Admin\BagOrder::detail/$1');
$routes->post('bag-orders/cancel/(:num)', 'Admin\BagOrder::cancel/$1');
$routes->post('bag-orders/delete/(:num)', 'Admin\BagOrder::delete/$1');
// 입고 관리 (P3-06~09)
$routes->get('bag-receivings', 'Admin\BagReceiving::index');
$routes->get('bag-receivings/create', 'Admin\BagReceiving::create');
$routes->post('bag-receivings/store', 'Admin\BagReceiving::store');
// 재고 현황 (P3-10)
$routes->get('bag-inventory/export', 'Admin\BagInventory::export');
$routes->get('bag-inventory', 'Admin\BagInventory::index');
// 주문 접수 관리 (P4-01~03)
$routes->get('shop-orders', 'Admin\ShopOrder::index');
$routes->get('shop-orders/create', 'Admin\ShopOrder::create');
$routes->post('shop-orders/store', 'Admin\ShopOrder::store');
$routes->post('shop-orders/cancel/(:num)', 'Admin\ShopOrder::cancel/$1');
// 판매/반품 관리 (P4-04~07)
$routes->get('bag-sales/export', 'Admin\BagSale::export');
$routes->get('bag-sales', 'Admin\BagSale::index');
$routes->get('bag-sales/create', 'Admin\BagSale::create');
$routes->post('bag-sales/store', 'Admin\BagSale::store');
// 무료용 불출 관리 (P4-08~10)
$routes->get('bag-issues', 'Admin\BagIssue::index');
$routes->get('bag-issues/create', 'Admin\BagIssue::create');
$routes->post('bag-issues/store', 'Admin\BagIssue::store');
$routes->post('bag-issues/cancel/(:num)', 'Admin\BagIssue::cancel/$1');
// 포장 단위 관리 (P2-05/06)
$routes->get('packaging-units', 'Admin\PackagingUnit::index');
$routes->get('packaging-units/create', 'Admin\PackagingUnit::create');
$routes->post('packaging-units/store', 'Admin\PackagingUnit::store');
$routes->get('packaging-units/edit/(:num)', 'Admin\PackagingUnit::edit/$1');
$routes->post('packaging-units/update/(:num)', 'Admin\PackagingUnit::update/$1');
$routes->post('packaging-units/delete/(:num)', 'Admin\PackagingUnit::delete/$1');
$routes->get('packaging-units/history/(:num)', 'Admin\PackagingUnit::history/$1');
// 현황/리포트 (Phase 5)
$routes->get('reports/sales-ledger', 'Admin\SalesReport::salesLedger');
$routes->get('reports/daily-summary', 'Admin\SalesReport::dailySummary');
$routes->get('reports/period-sales', 'Admin\SalesReport::periodSales');
$routes->get('reports/supply-demand', 'Admin\SalesReport::supplyDemand');
$routes->get('reports/yearly-sales', 'Admin\SalesReport::yearlySales');
$routes->get('reports/shop-sales', 'Admin\SalesReport::shopSales');
$routes->get('reports/hometax-export', 'Admin\SalesReport::hometaxExport');
$routes->get('reports/returns', 'Admin\SalesReport::returns');
$routes->get('reports/lot-flow', 'Admin\SalesReport::lotFlow');
$routes->get('reports/misc-flow', 'Admin\SalesReport::miscFlow');
$routes->post('reports/misc-flow', 'Admin\SalesReport::miscFlowStore');
// 판매 대행소 관리 (P2-07/08)
$routes->get('sales-agencies', 'Admin\SalesAgency::index');
$routes->get('sales-agencies/create', 'Admin\SalesAgency::create');
$routes->post('sales-agencies/store', 'Admin\SalesAgency::store');
$routes->get('sales-agencies/edit/(:num)', 'Admin\SalesAgency::edit/$1');
$routes->post('sales-agencies/update/(:num)', 'Admin\SalesAgency::update/$1');
$routes->post('sales-agencies/delete/(:num)', 'Admin\SalesAgency::delete/$1');
// 담당자 관리 (P2-09/10)
$routes->get('managers', 'Admin\Manager::index');
$routes->get('managers/create', 'Admin\Manager::create');
$routes->post('managers/store', 'Admin\Manager::store');
$routes->get('managers/edit/(:num)', 'Admin\Manager::edit/$1');
$routes->post('managers/update/(:num)', 'Admin\Manager::update/$1');
$routes->post('managers/delete/(:num)', 'Admin\Manager::delete/$1');
// 업체 관리 (P2-11/12)
$routes->get('companies', 'Admin\Company::index');
$routes->get('companies/create', 'Admin\Company::create');
$routes->post('companies/store', 'Admin\Company::store');
$routes->get('companies/edit/(:num)', 'Admin\Company::edit/$1');
$routes->post('companies/update/(:num)', 'Admin\Company::update/$1');
$routes->post('companies/delete/(:num)', 'Admin\Company::delete/$1');
// 무료용 대상자 관리 (P2-13/14)
$routes->get('free-recipients', 'Admin\FreeRecipient::index');
$routes->get('free-recipients/create', 'Admin\FreeRecipient::create');
$routes->post('free-recipients/store', 'Admin\FreeRecipient::store');
$routes->get('free-recipients/edit/(:num)', 'Admin\FreeRecipient::edit/$1');
$routes->post('free-recipients/update/(:num)', 'Admin\FreeRecipient::update/$1');
$routes->post('free-recipients/delete/(:num)', 'Admin\FreeRecipient::delete/$1');
$routes->get('designated-shops/export', 'Admin\DesignatedShop::export');
$routes->get('designated-shops/map', 'Admin\DesignatedShop::map');
$routes->get('designated-shops/status', 'Admin\DesignatedShop::status');
$routes->get('designated-shops', 'Admin\DesignatedShop::index');
$routes->get('designated-shops/create', 'Admin\DesignatedShop::create');
$routes->post('designated-shops/store', 'Admin\DesignatedShop::store');
$routes->get('designated-shops/edit/(:num)', 'Admin\DesignatedShop::edit/$1');
$routes->post('designated-shops/update/(:num)', 'Admin\DesignatedShop::update/$1');
$routes->post('designated-shops/delete/(:num)', 'Admin\DesignatedShop::delete/$1');
// 구 업무 URL → /bag/* (실제 처리는 bag 그룹). GET 301, POST 307.
$adminToBagPrefixes = [
'managers',
'sales-agencies',
'companies',
'free-recipients',
'designated-shops',
'bag-prices',
'bag-orders',
'bag-receivings',
'bag-inventory',
'shop-orders',
'bag-sales',
'bag-issues',
'packaging-units',
'reports',
'password-change',
];
foreach ($adminToBagPrefixes as $p) {
$routes->match(['get', 'post'], $p, 'Admin\WorkMovedToBag::toBag/' . $p);
$routes->match(['get', 'post'], $p . '/(:any)', 'Admin\WorkMovedToBag::toBag/' . $p . '/$1');
}
});

View File

@@ -18,25 +18,68 @@ class Company extends BaseController
{
helper('admin');
$lgIdx = admin_effective_lg_idx();
if (!$lgIdx) {
return redirect()->to(site_url('admin'))->with('error', '지자체를 선택해 주세요.');
if (! $lgIdx) {
return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.');
}
$list = $this->model->where('cp_lg_idx', $lgIdx)->orderBy('cp_idx', 'DESC')->paginate(20);
$pager = $this->model->pager;
if ($this->request->is('post')) {
$searchField = trim((string) ($this->request->getPost('search_field') ?? ''));
$searchQuery = trim((string) ($this->request->getPost('search_query') ?? ''));
session()->setFlashdata('company_search', [
'search_field' => $searchField,
'search_query' => $searchQuery,
]);
return view('admin/layout', [
'title' => '업체 관리',
'content' => view('admin/company/index', ['list' => $list, 'pager' => $pager]),
return redirect()->to(mgmt_url('companies'));
}
$fromGetField = trim((string) ($this->request->getGet('search_field') ?? ''));
$fromGetQuery = trim((string) ($this->request->getGet('search_query') ?? ''));
$flash = session()->getFlashdata('company_search');
if ($fromGetField !== '' || $fromGetQuery !== '') {
$searchField = $fromGetField;
$searchQuery = $fromGetQuery;
} elseif (is_array($flash)) {
$searchField = trim((string) ($flash['search_field'] ?? ''));
$searchQuery = trim((string) ($flash['search_query'] ?? ''));
} else {
$searchField = '';
$searchQuery = '';
}
$allowedFields = ['cp_idx', 'cp_type', 'cp_name', 'cp_biz_no', 'cp_rep_name', 'cp_tel', 'cp_addr'];
if (! in_array($searchField, $allowedFields, true)) {
$searchField = 'cp_name';
}
$builder = $this->model->where('cp_lg_idx', $lgIdx);
if ($searchQuery !== '') {
if ($searchField === 'cp_idx') {
if (ctype_digit($searchQuery)) {
$builder->where('cp_idx', (int) $searchQuery);
} else {
$builder->where('cp_idx', 0);
}
} else {
$builder->like($searchField, $searchQuery);
}
}
$list = $builder->orderBy('cp_idx', 'DESC')->paginate(20);
$pager = $this->model->pager;
$pager->setPath('bag/companies');
return $this->renderWorkPage('업체 관리', 'admin/company/index', [
'list' => $list,
'pager' => $pager,
'search_field' => $searchField,
'search_query' => $searchQuery,
]);
}
public function create()
{
return view('admin/layout', [
'title' => '업체 등록',
'content' => view('admin/company/create'),
]);
return $this->renderWorkPage('업체 등록', 'admin/company/create');
}
public function store()
@@ -66,29 +109,26 @@ class Company extends BaseController
'cp_regdate' => date('Y-m-d H:i:s'),
]);
return redirect()->to(site_url('admin/companies'))->with('success', '업체가 등록되었습니다.');
return redirect()->to(mgmt_url('companies'))->with('success', '업체가 등록되었습니다.');
}
public function edit(int $id)
{
helper('admin');
$item = $this->model->find($id);
if (!$item || (int) $item->cp_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(site_url('admin/companies'))->with('error', '업체를 찾을 수 없습니다.');
if (! $item || (int) $item->cp_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(mgmt_url('companies'))->with('error', '업체를 찾을 수 없습니다.');
}
return view('admin/layout', [
'title' => '업체 수정',
'content' => view('admin/company/edit', ['item' => $item]),
]);
return $this->renderWorkPage('업체 수정', 'admin/company/edit', ['item' => $item]);
}
public function update(int $id)
{
helper('admin');
$item = $this->model->find($id);
if (!$item || (int) $item->cp_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(site_url('admin/companies'))->with('error', '업체를 찾을 수 없습니다.');
if (! $item || (int) $item->cp_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(mgmt_url('companies'))->with('error', '업체를 찾을 수 없습니다.');
}
$rules = [
@@ -110,18 +150,19 @@ class Company extends BaseController
'cp_state' => (int) $this->request->getPost('cp_state'),
]);
return redirect()->to(site_url('admin/companies'))->with('success', '업체가 수정되었습니다.');
return redirect()->to(mgmt_url('companies'))->with('success', '업체가 수정되었습니다.');
}
public function delete(int $id)
{
helper('admin');
$item = $this->model->find($id);
if (!$item || (int) $item->cp_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(site_url('admin/companies'))->with('error', '업체를 찾을 수 없습니다.');
if (! $item || (int) $item->cp_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(mgmt_url('companies'))->with('error', '업체를 찾을 수 없습니다.');
}
$this->model->delete($id);
return redirect()->to(site_url('admin/companies'))->with('success', '업체가 삭제되었습니다.');
return redirect()->to(mgmt_url('companies'))->with('success', '업체가 삭제되었습니다.');
}
}

View File

@@ -89,7 +89,7 @@ class DesignatedShop extends BaseController
public function export()
{
helper(['admin', 'export']);
helper(['admin', 'export', 'pii_mask']);
$lgIdx = admin_effective_lg_idx();
if (!$lgIdx) {
return redirect()->to(site_url('admin/designated-shops'))->with('error', '지자체를 선택해 주세요.');
@@ -104,7 +104,7 @@ class DesignatedShop extends BaseController
$row->ds_idx,
$row->ds_shop_no,
$row->ds_name,
$row->ds_rep_name,
mask_person_name($row->ds_rep_name ?? null),
$row->ds_biz_no,
$row->ds_va_number,
$row->ds_tel ?? '',
@@ -121,6 +121,41 @@ class DesignatedShop extends BaseController
);
}
/**
* 지정판매소 상세 (읽기 전용, 목록에서 연결)
*/
public function show(int $id)
{
helper('admin');
$lgIdx = admin_effective_lg_idx();
if ($lgIdx === null || $lgIdx <= 0) {
return redirect()->to(work_area_home_url())
->with('error', '작업할 지자체가 선택되지 않았습니다. 지자체를 선택해 주세요.');
}
$shop = $this->shopModel->find($id);
if ($shop === null || (int) $shop->ds_lg_idx !== $lgIdx) {
return redirect()->to(mgmt_url('designated-shops'))
->with('error', '해당 지정판매소를 찾을 수 없습니다.');
}
$currentLg = $this->lgModel->find($lgIdx);
$stateLabel = match ((int) $shop->ds_state) {
1 => '정상',
2 => '폐업',
3 => '직권해지',
default => (string) $shop->ds_state,
};
return $this->renderWorkPage('지정판매소 정보', 'admin/designated_shop/show', [
'shop' => $shop,
'currentLg' => $currentLg,
'stateLabel' => $stateLabel,
'can_edit' => $this->isSuperAdmin() || $this->isLocalAdmin(),
]);
}
/**
* 지정판매소 등록 폼 (효과 지자체 기준)
*/

View File

@@ -18,35 +18,123 @@ class FreeRecipient extends BaseController
private function getCodeOptions(string $ckCode): array
{
helper('admin');
$lgIdx = admin_effective_lg_idx();
$kind = model(CodeKindModel::class)->where('ck_code', $ckCode)->first();
return $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true) : [];
return $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx) : [];
}
public function index()
{
helper('admin');
$lgIdx = admin_effective_lg_idx();
if (!$lgIdx) {
return redirect()->to(site_url('admin'))->with('error', '지자체를 선택해 주세요.');
if (! $lgIdx) {
return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.');
}
$list = $this->model->where('fr_lg_idx', $lgIdx)->orderBy('fr_idx', 'DESC')->paginate(20);
$pager = $this->model->pager;
if ($this->request->is('post')) {
$searchField = trim((string) ($this->request->getPost('search_field') ?? ''));
$searchQuery = trim((string) ($this->request->getPost('search_query') ?? ''));
session()->setFlashdata('free_recipient_search', [
'search_field' => $searchField,
'search_query' => $searchQuery,
]);
return view('admin/layout', [
'title' => '무료용 대상자 관리',
'content' => view('admin/free_recipient/index', ['list' => $list, 'pager' => $pager]),
return redirect()->to(mgmt_url('free-recipients'));
}
$fromGetField = trim((string) ($this->request->getGet('search_field') ?? ''));
$fromGetQuery = trim((string) ($this->request->getGet('search_query') ?? ''));
$flash = session()->getFlashdata('free_recipient_search');
if ($fromGetField !== '' || $fromGetQuery !== '') {
$searchField = $fromGetField;
$searchQuery = $fromGetQuery;
} elseif (is_array($flash)) {
$searchField = trim((string) ($flash['search_field'] ?? ''));
$searchQuery = trim((string) ($flash['search_query'] ?? ''));
} else {
$searchField = '';
$searchQuery = '';
}
$allowedFields = ['fr_idx', 'fr_type_code', 'fr_name', 'fr_phone', 'fr_addr', 'fr_dong_code', 'fr_note'];
if (! in_array($searchField, $allowedFields, true)) {
$searchField = 'fr_name';
}
$typeCodes = $this->getCodeOptions('H');
$typeCodeMap = [];
foreach ($typeCodes as $cd) {
$typeCodeMap[(string) $cd->cd_code] = (string) $cd->cd_name;
}
$dongCodes = $this->getCodeOptions('D');
$dongCodeMap = [];
foreach ($dongCodes as $cd) {
$dongCodeMap[(string) $cd->cd_code] = (string) $cd->cd_name;
}
$builder = $this->model->where('fr_lg_idx', $lgIdx);
if ($searchQuery !== '') {
if ($searchField === 'fr_idx') {
if (ctype_digit($searchQuery)) {
$builder->where('fr_idx', (int) $searchQuery);
} else {
$builder->where('fr_idx', 0);
}
} elseif ($searchField === 'fr_type_code') {
$codes = [];
foreach ($typeCodes as $cd) {
$code = (string) ($cd->cd_code ?? '');
$name = (string) ($cd->cd_name ?? '');
if ($code !== '' && (stripos($code, $searchQuery) !== false || stripos($name, $searchQuery) !== false)) {
$codes[] = $code;
}
}
if ($codes === []) {
$builder->where('fr_idx', 0);
} else {
$builder->whereIn('fr_type_code', array_values(array_unique($codes)));
}
} elseif ($searchField === 'fr_dong_code') {
$codes = [];
foreach ($dongCodes as $cd) {
$code = (string) ($cd->cd_code ?? '');
$name = (string) ($cd->cd_name ?? '');
if ($code !== '' && (stripos($code, $searchQuery) !== false || stripos($name, $searchQuery) !== false)) {
$codes[] = $code;
}
}
if ($codes === []) {
$builder->where('fr_idx', 0);
} else {
$builder->whereIn('fr_dong_code', array_values(array_unique($codes)));
}
} else {
$builder->like($searchField, $searchQuery);
}
}
$list = $builder->orderBy('fr_idx', 'DESC')->paginate(20);
$pager = $this->model->pager;
$pager->setPath('bag/free-recipients');
return $this->renderWorkPage('무료용 대상자 관리', 'admin/free_recipient/index', [
'list' => $list,
'pager' => $pager,
'search_field' => $searchField,
'search_query' => $searchQuery,
'type_code_map' => $typeCodeMap,
'dong_code_map' => $dongCodeMap,
]);
}
public function create()
{
return view('admin/layout', [
'title' => '무료용 대상자 등록',
'content' => view('admin/free_recipient/create', [
return $this->renderWorkPage('무료용 대상자 등록', 'admin/free_recipient/create', [
'typeCodes' => $this->getCodeOptions('H'),
'dongCodes' => $this->getCodeOptions('D'),
]),
]);
}
@@ -75,24 +163,21 @@ class FreeRecipient extends BaseController
'fr_regdate' => date('Y-m-d H:i:s'),
]);
return redirect()->to(site_url('admin/free-recipients'))->with('success', '무료용 대상자가 등록되었습니다.');
return redirect()->to(mgmt_url('free-recipients'))->with('success', '무료용 대상자가 등록되었습니다.');
}
public function edit(int $id)
{
helper('admin');
$item = $this->model->find($id);
if (!$item || (int) $item->fr_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(site_url('admin/free-recipients'))->with('error', '대상자를 찾을 수 없습니다.');
if (! $item || (int) $item->fr_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(mgmt_url('free-recipients'))->with('error', '대상자를 찾을 수 없습니다.');
}
return view('admin/layout', [
'title' => '무료용 대상자 수정',
'content' => view('admin/free_recipient/edit', [
return $this->renderWorkPage('무료용 대상자 수정', 'admin/free_recipient/edit', [
'item' => $item,
'typeCodes' => $this->getCodeOptions('H'),
'dongCodes' => $this->getCodeOptions('D'),
]),
]);
}
@@ -100,8 +185,8 @@ class FreeRecipient extends BaseController
{
helper('admin');
$item = $this->model->find($id);
if (!$item || (int) $item->fr_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(site_url('admin/free-recipients'))->with('error', '대상자를 찾을 수 없습니다.');
if (! $item || (int) $item->fr_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(mgmt_url('free-recipients'))->with('error', '대상자를 찾을 수 없습니다.');
}
$rules = [
@@ -123,18 +208,19 @@ class FreeRecipient extends BaseController
'fr_state' => (int) $this->request->getPost('fr_state'),
]);
return redirect()->to(site_url('admin/free-recipients'))->with('success', '무료용 대상자가 수정되었습니다.');
return redirect()->to(mgmt_url('free-recipients'))->with('success', '무료용 대상자가 수정되었습니다.');
}
public function delete(int $id)
{
helper('admin');
$item = $this->model->find($id);
if (!$item || (int) $item->fr_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(site_url('admin/free-recipients'))->with('error', '대상자를 찾을 수 없습니다.');
if (! $item || (int) $item->fr_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(mgmt_url('free-recipients'))->with('error', '대상자를 찾을 수 없습니다.');
}
$this->model->delete($id);
return redirect()->to(site_url('admin/free-recipients'))->with('success', '무료용 대상자가 삭제되었습니다.');
return redirect()->to(mgmt_url('free-recipients'))->with('success', '무료용 대상자가 삭제되었습니다.');
}
}

View File

@@ -18,8 +18,11 @@ class Manager extends BaseController
private function getCodeOptions(string $ckCode): array
{
helper('admin');
$lgIdx = admin_effective_lg_idx();
$kind = model(CodeKindModel::class)->where('ck_code', $ckCode)->first();
return $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true) : [];
return $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx) : [];
}
public function index()
@@ -27,32 +30,105 @@ class Manager extends BaseController
helper('admin');
$lgIdx = admin_effective_lg_idx();
if (!$lgIdx) {
return redirect()->to(site_url('admin'))->with('error', '지자체를 선택해 주세요.');
helper('admin');
return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.');
}
$list = $this->model->where('mg_lg_idx', $lgIdx)->orderBy('mg_idx', 'DESC')->paginate(20);
$pager = $this->model->pager;
if ($this->request->is('post')) {
$searchField = trim((string) ($this->request->getPost('search_field') ?? ''));
$searchQuery = trim((string) ($this->request->getPost('search_query') ?? ''));
session()->setFlashdata('manager_search', [
'search_field' => $searchField,
'search_query' => $searchQuery,
]);
return view('admin/layout', [
'title' => '담당자 관리',
'content' => view('admin/manager/index', ['list' => $list, 'pager' => $pager]),
return redirect()->to(mgmt_url('managers'));
}
$fromGetField = trim((string) ($this->request->getGet('search_field') ?? ''));
$fromGetQuery = trim((string) ($this->request->getGet('search_query') ?? ''));
$flash = session()->getFlashdata('manager_search');
if ($fromGetField !== '' || $fromGetQuery !== '') {
$searchField = $fromGetField;
$searchQuery = $fromGetQuery;
} elseif (is_array($flash)) {
$searchField = trim((string) ($flash['search_field'] ?? ''));
$searchQuery = trim((string) ($flash['search_query'] ?? ''));
} else {
$searchField = '';
$searchQuery = '';
}
$allowedFields = ['mg_idx', 'mg_name', 'mg_dept_code', 'mg_position_code', 'mg_tel', 'mg_phone', 'mg_email'];
if (! in_array($searchField, $allowedFields, true)) {
$searchField = 'mg_name';
}
$deptCodes = $this->getCodeOptions('S');
$posCodes = $this->getCodeOptions('T');
$deptCodeMap = [];
foreach ($deptCodes as $cd) {
$deptCodeMap[(string) $cd->cd_code] = (string) $cd->cd_name;
}
$posCodeMap = [];
foreach ($posCodes as $cd) {
$posCodeMap[(string) $cd->cd_code] = (string) $cd->cd_name;
}
$builder = $this->model->where('mg_lg_idx', $lgIdx);
if ($searchQuery !== '') {
if ($searchField === 'mg_idx') {
if (ctype_digit($searchQuery)) {
$builder->where('mg_idx', (int) $searchQuery);
} else {
$builder->where('mg_idx', 0);
}
} elseif ($searchField === 'mg_dept_code' || $searchField === 'mg_position_code') {
$sourceList = $searchField === 'mg_dept_code' ? $deptCodes : $posCodes;
$codes = [];
foreach ($sourceList as $cd) {
$code = (string) ($cd->cd_code ?? '');
$name = (string) ($cd->cd_name ?? '');
if ($code !== '' && (stripos($code, $searchQuery) !== false || stripos($name, $searchQuery) !== false)) {
$codes[] = $code;
}
}
if ($codes === []) {
$builder->where('mg_idx', 0);
} else {
$builder->whereIn($searchField, array_values(array_unique($codes)));
}
} else {
$builder->like($searchField, $searchQuery);
}
}
$list = $builder->orderBy('mg_idx', 'DESC')->paginate(20);
$pager = $this->model->pager;
$pager->setPath('bag/managers');
return $this->renderWorkPage('담당자 관리', 'admin/manager/index', [
'list' => $list,
'pager' => $pager,
'search_field' => $searchField,
'search_query' => $searchQuery,
'dept_code_map' => $deptCodeMap,
'pos_code_map' => $posCodeMap,
]);
}
public function create()
{
return view('admin/layout', [
'title' => '담당자 등록',
'content' => view('admin/manager/create', [
return $this->renderWorkPage('담당자 등록', 'admin/manager/create', [
'deptCodes' => $this->getCodeOptions('S'),
'positionCodes' => $this->getCodeOptions('T'),
]),
]);
}
public function store()
{
helper('admin');
helper(['admin', 'url']);
$rules = [
'mg_name' => 'required|max_length[50]',
'mg_tel' => 'permit_empty|max_length[20]',
@@ -75,33 +151,30 @@ class Manager extends BaseController
'mg_regdate' => date('Y-m-d H:i:s'),
]);
return redirect()->to(site_url('admin/managers'))->with('success', '담당자가 등록되었습니다.');
return redirect()->to(mgmt_url('managers'))->with('success', '담당자가 등록되었습니다.');
}
public function edit(int $id)
{
helper('admin');
helper(['admin', 'url']);
$item = $this->model->find($id);
if (!$item || (int) $item->mg_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(site_url('admin/managers'))->with('error', '담당자를 찾을 수 없습니다.');
return redirect()->to(mgmt_url('managers'))->with('error', '담당자를 찾을 수 없습니다.');
}
return view('admin/layout', [
'title' => '담당자 수정',
'content' => view('admin/manager/edit', [
return $this->renderWorkPage('담당자 수정', 'admin/manager/edit', [
'item' => $item,
'deptCodes' => $this->getCodeOptions('S'),
'positionCodes' => $this->getCodeOptions('T'),
]),
]);
}
public function update(int $id)
{
helper('admin');
helper(['admin', 'url']);
$item = $this->model->find($id);
if (!$item || (int) $item->mg_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(site_url('admin/managers'))->with('error', '담당자를 찾을 수 없습니다.');
return redirect()->to(mgmt_url('managers'))->with('error', '담당자를 찾을 수 없습니다.');
}
$rules = [
@@ -122,18 +195,19 @@ class Manager extends BaseController
'mg_state' => (int) $this->request->getPost('mg_state'),
]);
return redirect()->to(site_url('admin/managers'))->with('success', '담당자가 수정되었습니다.');
return redirect()->to(mgmt_url('managers'))->with('success', '담당자가 수정되었습니다.');
}
public function delete(int $id)
{
helper('admin');
helper(['admin', 'url']);
$item = $this->model->find($id);
if (!$item || (int) $item->mg_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(site_url('admin/managers'))->with('error', '담당자를 찾을 수 없습니다.');
return redirect()->to(mgmt_url('managers'))->with('error', '담당자를 찾을 수 없습니다.');
}
$this->model->delete($id);
return redirect()->to(site_url('admin/managers'))->with('success', '담당자가 삭제되었습니다.');
return redirect()->to(mgmt_url('managers'))->with('success', '담당자가 삭제되었습니다.');
}
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Controllers\Admin;
use App\Controllers\BaseController;
@@ -7,6 +9,8 @@ use App\Models\SalesAgencyModel;
class SalesAgency extends BaseController
{
private const SCHEMA_ERROR = '판매 대행소 테이블에 sa_kind·sa_code 컬럼이 없습니다. DB에 writable/database/sales_agency_migrate_to_kind_code_name.sql(또는 신규용 sales_agency_tables.sql)을 적용한 뒤 다시 시도해 주세요.';
private SalesAgencyModel $model;
public function __construct()
@@ -18,106 +22,150 @@ class SalesAgency extends BaseController
{
helper('admin');
$lgIdx = admin_effective_lg_idx();
if (!$lgIdx) {
return redirect()->to(site_url('admin'))->with('error', '지자체를 선택해 주세요.');
if (! $lgIdx) {
return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.');
}
$list = $this->model->where('sa_lg_idx', $lgIdx)->orderBy('sa_idx', 'DESC')->paginate(20);
$pager = $this->model->pager;
$searchField = trim((string) ($this->request->getGet('search_field') ?? ''));
$searchQuery = trim((string) ($this->request->getGet('search_query') ?? ''));
$allowedFields = ['sa_idx', 'sa_kind', 'sa_code', 'sa_name'];
if (! in_array($searchField, $allowedFields, true)) {
$searchField = 'sa_name';
}
return view('admin/layout', [
'title' => '판매 대행소 관리',
'content' => view('admin/sales_agency/index', ['list' => $list, 'pager' => $pager]),
$builder = $this->model->where('sa_lg_idx', $lgIdx);
if ($searchQuery !== '') {
if ($searchField === 'sa_idx') {
if (ctype_digit($searchQuery)) {
$builder->where('sa_idx', (int) $searchQuery);
} else {
// 번호 검색은 숫자만 허용한다.
$builder->where('sa_idx', 0);
}
} else {
$builder->like($searchField, $searchQuery);
}
}
$list = $builder->orderBy('sa_idx', 'DESC')->paginate(20);
$pager = $this->model->pager;
// 전체 URL·쿼리를 setPath에 넣으면 Pager URI 경로가 깨져 404가 난다. 경로만 지정한다(필터는 현재 GET이 병합됨).
$pager->setPath('bag/sales-agencies');
return $this->renderWorkPage('판매 대행소 관리', 'admin/sales_agency/index', [
'list' => $list,
'pager' => $pager,
'search_field' => $searchField,
'search_query' => $searchQuery,
]);
}
public function create()
{
return view('admin/layout', [
'title' => '판매 대행소 등록',
'content' => view('admin/sales_agency/create'),
]);
helper('admin');
if (! admin_effective_lg_idx()) {
return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.');
}
return $this->renderWorkPage('판매 대행소 등록', 'admin/sales_agency/create');
}
public function store()
{
helper('admin');
$lgIdx = admin_effective_lg_idx();
if (! $lgIdx) {
return redirect()->to(mgmt_url('sales-agencies'))->with('error', '지자체를 선택해 주세요.');
}
if (! $this->model->hasKindCodeColumns()) {
return redirect()->back()->withInput()->with('error', self::SCHEMA_ERROR);
}
$rules = [
'sa_kind' => 'required|max_length[50]',
'sa_code' => 'required|max_length[50]',
'sa_name' => 'required|max_length[100]',
'sa_biz_no' => 'permit_empty|max_length[20]',
'sa_rep_name' => 'permit_empty|max_length[50]',
'sa_tel' => 'permit_empty|max_length[20]',
'sa_addr' => 'permit_empty|max_length[255]',
];
if (! $this->validate($rules)) {
return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
}
$code = trim((string) $this->request->getPost('sa_code'));
if ($this->model->where('sa_lg_idx', $lgIdx)->where('sa_code', $code)->first() !== null) {
return redirect()->back()->withInput()->with('error', '동일 지자체에 같은 대행소 코드가 이미 있습니다.');
}
$this->model->insert([
'sa_lg_idx' => admin_effective_lg_idx(),
'sa_name' => $this->request->getPost('sa_name'),
'sa_biz_no' => $this->request->getPost('sa_biz_no') ?? '',
'sa_rep_name' => $this->request->getPost('sa_rep_name') ?? '',
'sa_tel' => $this->request->getPost('sa_tel') ?? '',
'sa_addr' => $this->request->getPost('sa_addr') ?? '',
'sa_state' => 1,
'sa_lg_idx' => $lgIdx,
'sa_kind' => trim((string) $this->request->getPost('sa_kind')),
'sa_code' => $code,
'sa_name' => trim((string) $this->request->getPost('sa_name')),
'sa_regdate' => date('Y-m-d H:i:s'),
]);
return redirect()->to(site_url('admin/sales-agencies'))->with('success', '판매 대행소가 등록되었습니다.');
return redirect()->to(mgmt_url('sales-agencies'))->with('success', '판매 대행소가 등록되었습니다.');
}
public function edit(int $id)
{
helper('admin');
$item = $this->model->find($id);
if (!$item || (int) $item->sa_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(site_url('admin/sales-agencies'))->with('error', '대행소를 찾을 수 없습니다.');
if (! $item || (int) $item->sa_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(mgmt_url('sales-agencies'))->with('error', '대행소를 찾을 수 없습니다.');
}
return view('admin/layout', [
'title' => '판매 대행소 수정',
'content' => view('admin/sales_agency/edit', ['item' => $item]),
]);
return $this->renderWorkPage('판매 대행소 수정', 'admin/sales_agency/edit', ['item' => $item]);
}
public function update(int $id)
{
helper('admin');
$lgIdx = admin_effective_lg_idx();
$item = $this->model->find($id);
if (!$item || (int) $item->sa_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(site_url('admin/sales-agencies'))->with('error', '대행소를 찾을 수 없습니다.');
if (! $item || ! $lgIdx || (int) $item->sa_lg_idx !== $lgIdx) {
return redirect()->to(mgmt_url('sales-agencies'))->with('error', '대행소를 찾을 수 없습니다.');
}
if (! $this->model->hasKindCodeColumns()) {
return redirect()->back()->withInput()->with('error', self::SCHEMA_ERROR);
}
$rules = [
'sa_kind' => 'required|max_length[50]',
'sa_code' => 'required|max_length[50]',
'sa_name' => 'required|max_length[100]',
'sa_state' => 'required|in_list[0,1]',
];
if (! $this->validate($rules)) {
return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
}
$code = trim((string) $this->request->getPost('sa_code'));
$dup = $this->model->where('sa_lg_idx', $lgIdx)->where('sa_code', $code)->where('sa_idx !=', $id)->first();
if ($dup !== null) {
return redirect()->back()->withInput()->with('error', '동일 지자체에 같은 대행소 코드가 이미 있습니다.');
}
$this->model->update($id, [
'sa_name' => $this->request->getPost('sa_name'),
'sa_biz_no' => $this->request->getPost('sa_biz_no') ?? '',
'sa_rep_name' => $this->request->getPost('sa_rep_name') ?? '',
'sa_tel' => $this->request->getPost('sa_tel') ?? '',
'sa_addr' => $this->request->getPost('sa_addr') ?? '',
'sa_state' => (int) $this->request->getPost('sa_state'),
'sa_kind' => trim((string) $this->request->getPost('sa_kind')),
'sa_code' => $code,
'sa_name' => trim((string) $this->request->getPost('sa_name')),
]);
return redirect()->to(site_url('admin/sales-agencies'))->with('success', '판매 대행소가 수정되었습니다.');
return redirect()->to(mgmt_url('sales-agencies'))->with('success', '판매 대행소가 수정되었습니다.');
}
public function delete(int $id)
{
helper('admin');
$lgIdx = admin_effective_lg_idx();
$item = $this->model->find($id);
if (!$item || (int) $item->sa_lg_idx !== admin_effective_lg_idx()) {
return redirect()->to(site_url('admin/sales-agencies'))->with('error', '대행소를 찾을 수 없습니다.');
if (! $item || ! $lgIdx || (int) $item->sa_lg_idx !== $lgIdx) {
return redirect()->to(mgmt_url('sales-agencies'))->with('error', '대행소를 찾을 수 없습니다.');
}
$this->model->delete($id);
return redirect()->to(site_url('admin/sales-agencies'))->with('success', '판매 대행소가 삭제되었습니다.');
return redirect()->to(mgmt_url('sales-agencies'))->with('success', '삭제되었습니다.');
}
}

View File

@@ -0,0 +1,84 @@
<?php
declare(strict_types=1);
/**
* 화면 표시용 개인정보 비식별화 (저장 값은 변경하지 않음).
* ENC: 접두사 값은 pii_decrypt 후 마스킹한다.
*/
helper('pii_encryption');
if (! function_exists('mask_person_name')) {
/**
* 인명 마스킹 (예: 홍길동 → 홍*동, 김철 → 김*, 남궁민수 → 남**수).
*/
function mask_person_name(?string $name): string
{
if ($name === null) {
return '';
}
$plain = pii_decrypt(trim($name));
if ($plain === '') {
return '';
}
$len = mb_strlen($plain, 'UTF-8');
if ($len <= 1) {
return '*';
}
if ($len === 2) {
return mb_substr($plain, 0, 1, 'UTF-8') . '*';
}
$first = mb_substr($plain, 0, 1, 'UTF-8');
$last = mb_substr($plain, -1, 1, 'UTF-8');
if ($len === 3) {
return $first . '*' . $last;
}
return $first . str_repeat('*', $len - 2) . $last;
}
}
if (! function_exists('mask_mobile_phone')) {
/**
* 휴대·개인 전화 표시용 (예: 010-1234-5678 → 010-****-5678).
* 10자리(02 등)·11자리 휴대번호·+82 형태를 단순 정규화 후 처리한다.
*/
function mask_mobile_phone(?string $phone): string
{
if ($phone === null) {
return '';
}
$plain = pii_decrypt(trim($phone));
if ($plain === '') {
return '';
}
$digits = preg_replace('/\D+/', '', $plain) ?? '';
if ($digits === '') {
return '';
}
if (str_starts_with($digits, '82') && strlen($digits) >= 12) {
$digits = '0' . substr($digits, 2);
}
$len = strlen($digits);
if ($len < 7) {
return str_repeat('*', min(11, max(4, $len)));
}
// 7~9자리도 실제 앞자리(통상 010 등)를 노출하고 가운데만 **** (***-****-xxxx 방지)
if ($len < 10) {
return substr($digits, 0, 3) . '-****-' . substr($digits, -4);
}
if ($len === 10) {
if (str_starts_with($digits, '02')) {
return '02-****-' . substr($digits, -4);
}
return substr($digits, 0, 3) . '-****-' . substr($digits, -4);
}
if ($len === 11) {
return substr($digits, 0, 3) . '-****-' . substr($digits, -4);
}
return substr($digits, 0, 3) . '-****-' . substr($digits, -4);
}
}

View File

@@ -8,6 +8,31 @@
</div>
</div>
</section>
<section class="no-print border border-gray-300 bg-white p-2 mt-2">
<form method="POST" action="<?= mgmt_url('companies') ?>" class="flex flex-wrap items-end gap-2" autocomplete="off">
<?= csrf_field() ?>
<div class="flex flex-col gap-0.5">
<label class="text-xs text-gray-500">조회 기준</label>
<select name="search_field" class="border border-gray-300 rounded px-2 py-1.5 text-sm min-w-[10rem]">
<option value="cp_idx" <?= ($search_field ?? 'cp_name') === 'cp_idx' ? 'selected' : '' ?>>번호</option>
<option value="cp_type" <?= ($search_field ?? 'cp_name') === 'cp_type' ? 'selected' : '' ?>>업체유형</option>
<option value="cp_name" <?= ($search_field ?? 'cp_name') === 'cp_name' ? 'selected' : '' ?>>업체명</option>
<option value="cp_biz_no" <?= ($search_field ?? 'cp_name') === 'cp_biz_no' ? 'selected' : '' ?>>사업자번호</option>
<option value="cp_rep_name" <?= ($search_field ?? 'cp_name') === 'cp_rep_name' ? 'selected' : '' ?>>대표자</option>
<option value="cp_tel" <?= ($search_field ?? 'cp_name') === 'cp_tel' ? 'selected' : '' ?>>전화</option>
<option value="cp_addr" <?= ($search_field ?? 'cp_name') === 'cp_addr' ? 'selected' : '' ?>>주소</option>
</select>
</div>
<div class="flex flex-col gap-0.5">
<label class="text-xs text-gray-500">조회어</label>
<input type="text" name="search_query" value="<?= esc($search_query ?? '') ?>" class="border border-gray-300 rounded px-2 py-1.5 text-sm min-w-[18rem]" placeholder="조회어 입력">
</div>
<div class="flex items-center gap-2 pb-0.5">
<button type="submit" class="bg-btn-search text-white px-4 py-1.5 rounded-sm text-sm">조회</button>
<a href="<?= mgmt_url('companies') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
</div>
</form>
</section>
<div class="border border-gray-300 overflow-auto mt-2">
<table class="w-full data-table">
<thead>

View File

@@ -1,17 +1,18 @@
<?php helper('pii_mask'); ?>
<?= view('components/print_header', ['printTitle' => '지정판매소 목록']) ?>
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<div class="flex flex-wrap items-center justify-between gap-y-2">
<span class="text-sm font-bold text-gray-700">지정판매소 목록</span>
<div class="flex items-center gap-2">
<a href="<?= base_url('admin/designated-shops/export') ?>" class="no-print border border-btn-excel-border text-btn-excel-text px-3 py-1 rounded-sm text-sm hover:bg-green-50 transition">엑셀저장</a>
<a href="<?= mgmt_url('designated-shops/export') ?>" class="no-print border border-btn-excel-border text-btn-excel-text px-3 py-1 rounded-sm text-sm hover:bg-green-50 transition">엑셀저장</a>
<button onclick="window.print()" class="no-print border border-btn-print-border text-gray-600 px-3 py-1 rounded-sm text-sm hover:bg-gray-50 transition">인쇄</button>
<a href="<?= base_url('admin/designated-shops/create') ?>" class="bg-btn-search text-white px-4 py-1.5 rounded-sm flex items-center gap-1 text-sm shadow hover:opacity-90 transition border border-transparent">지정판매소 등록</a>
<a href="<?= mgmt_url('designated-shops/create') ?>" class="bg-btn-search text-white px-4 py-1.5 rounded-sm flex items-center gap-1 text-sm shadow hover:opacity-90 transition border border-transparent">지정판매소 등록</a>
</div>
</div>
</section>
<!-- P2-15: 다조건 검색 -->
<section class="p-2 bg-white border-b border-gray-200 no-print">
<form method="GET" action="<?= base_url('admin/designated-shops') ?>" class="flex flex-wrap items-center gap-2">
<form method="GET" action="<?= mgmt_url('designated-shops') ?>" class="flex flex-wrap items-center gap-2">
<label class="text-sm text-gray-600">상호명</label>
<input type="text" name="ds_name" value="<?= esc($dsName ?? '') ?>" placeholder="상호명 검색" class="border border-gray-300 rounded px-2 py-1 text-sm w-40"/>
<label class="text-sm text-gray-600">구군코드</label>
@@ -29,7 +30,7 @@
<option value="3" <?= ($dsState ?? '') === '3' ? 'selected' : '' ?>>직권해지</option>
</select>
<button type="submit" class="bg-btn-search text-white px-4 py-1 rounded-sm text-sm">조회</button>
<a href="<?= base_url('admin/designated-shops') ?>" class="border border-gray-300 text-gray-600 px-3 py-1 rounded-sm text-sm hover:bg-gray-50">초기화</a>
<a href="<?= mgmt_url('designated-shops') ?>" class="border border-gray-300 text-gray-600 px-3 py-1 rounded-sm text-sm hover:bg-gray-50">초기화</a>
</form>
</section>
<div class="border border-gray-300 overflow-auto mt-2">
@@ -50,19 +51,26 @@
</thead>
<tbody class="text-right">
<?php foreach ($list as $row): ?>
<tr>
<td class="text-center"><?= esc($row->ds_idx) ?></td>
<tr class="hover:bg-gray-50">
<td class="text-center">
<a href="<?= mgmt_url('designated-shops/show/' . (int) $row->ds_idx) ?>" class="text-blue-600 hover:underline"><?= esc($row->ds_idx) ?></a>
</td>
<td class="text-left pl-2"><?= esc($lgMap[$row->ds_lg_idx] ?? '') ?></td>
<td class="text-left pl-2"><?= esc($row->ds_shop_no) ?></td>
<td class="text-left pl-2"><?= esc($row->ds_name) ?></td>
<td class="text-left pl-2"><?= esc($row->ds_rep_name) ?></td>
<td class="text-left pl-2">
<a href="<?= mgmt_url('designated-shops/show/' . (int) $row->ds_idx) ?>" class="text-blue-600 hover:underline"><?= esc($row->ds_shop_no) ?></a>
</td>
<td class="text-left pl-2">
<a href="<?= mgmt_url('designated-shops/show/' . (int) $row->ds_idx) ?>" class="text-blue-600 font-medium hover:underline"><?= esc($row->ds_name) ?></a>
</td>
<td class="text-left pl-2"><?= esc(mask_person_name($row->ds_rep_name ?? null)) ?></td>
<td class="text-left pl-2"><?= esc($row->ds_biz_no) ?></td>
<td class="text-left pl-2"><?= esc($row->ds_va_number) ?></td>
<td class="text-center"><?= (int) $row->ds_state === 1 ? '정상' : ((int) $row->ds_state === 2 ? '폐업' : '직권해지') ?></td>
<td class="text-left pl-2"><?= esc($row->ds_regdate ?? '') ?></td>
<td class="text-center">
<a href="<?= base_url('admin/designated-shops/edit/' . (int) $row->ds_idx) ?>" class="text-blue-600 hover:underline text-sm">수정</a>
<form action="<?= base_url('admin/designated-shops/delete/' . (int) $row->ds_idx) ?>" method="POST" class="inline ml-1" onsubmit="return confirm('이 지정판매소를 삭제하시겠습니까?');">
<a href="<?= mgmt_url('designated-shops/show/' . (int) $row->ds_idx) ?>" class="text-gray-700 hover:underline text-sm mr-1">상세</a>
<a href="<?= mgmt_url('designated-shops/edit/' . (int) $row->ds_idx) ?>" class="text-blue-600 hover:underline text-sm">수정</a>
<form action="<?= mgmt_url('designated-shops/delete/' . (int) $row->ds_idx) ?>" method="POST" class="inline ml-1" onsubmit="return confirm('이 지정판매소를 삭제하시겠습니까?');">
<?= csrf_field() ?>
<button type="submit" class="text-red-600 hover:underline text-sm">삭제</button>
</form>

View File

@@ -1,3 +1,6 @@
<?php
helper('pii_mask');
?>
<?= view('components/print_header', ['printTitle' => '지정판매소 지도']) ?>
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<div class="flex flex-wrap items-center justify-between gap-y-2">
@@ -25,7 +28,7 @@ document.addEventListener('DOMContentLoaded', function() {
var geocoder = new kakao.maps.services.Geocoder();
var shops = <?= json_encode(array_map(function($s) {
return ['name' => $s->ds_name, 'addr' => $s->ds_addr ?? '', 'rep' => $s->ds_rep_name ?? '', 'tel' => $s->ds_tel ?? ''];
return ['name' => $s->ds_name, 'addr' => $s->ds_addr ?? '', 'rep' => mask_person_name($s->ds_rep_name ?? null), 'tel' => $s->ds_tel ?? ''];
}, $shops), JSON_UNESCAPED_UNICODE) ?>;
var bounds = new kakao.maps.LatLngBounds();

View File

@@ -0,0 +1,94 @@
<?php
$shop = $shop ?? null;
$currentLg = $currentLg ?? null;
$stateLabel = $stateLabel ?? '';
$can_edit = $can_edit ?? false;
if ($shop === null) {
return;
}
helper('pii_mask');
$val = static fn (?string $s): string => $s !== null && $s !== '' ? $s : '—';
$dispMask = static function (string $masked): string {
return $masked !== '' ? $masked : '—';
};
?>
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<div class="flex flex-wrap items-center justify-between gap-2">
<span class="text-sm font-bold text-gray-700">지정판매소 정보</span>
<div class="flex items-center gap-2">
<a href="<?= mgmt_url('designated-shops') ?>" class="border border-gray-300 text-gray-600 px-3 py-1 rounded-sm text-sm hover:bg-gray-50">목록</a>
<?php if ($can_edit): ?>
<a href="<?= mgmt_url('designated-shops/edit/' . (int) $shop->ds_idx) ?>" class="bg-btn-search text-white px-3 py-1 rounded-sm text-sm hover:opacity-90">수정</a>
<?php endif; ?>
</div>
</div>
</section>
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl space-y-3 text-sm">
<?php if ($currentLg !== null): ?>
<div class="flex flex-wrap gap-2 border-b border-gray-100 pb-2">
<span class="font-bold text-gray-700 w-28 shrink-0">지자체</span>
<span><?= esc($currentLg->lg_name) ?> <span class="text-gray-500">(<?= esc($currentLg->lg_code) ?>)</span></span>
</div>
<?php endif; ?>
<div class="flex flex-wrap gap-2">
<span class="font-bold text-gray-700 w-28 shrink-0">판매소번호</span>
<span class="font-mono"><?= esc($shop->ds_shop_no) ?></span>
</div>
<div class="flex flex-wrap gap-2">
<span class="font-bold text-gray-700 w-28 shrink-0">구코드</span>
<span class="font-mono"><?= esc($val($shop->ds_gugun_code ?? null)) ?></span>
</div>
<div class="flex flex-wrap gap-2">
<span class="font-bold text-gray-700 w-28 shrink-0">상호명</span>
<span class="font-semibold"><?= esc($shop->ds_name) ?></span>
</div>
<div class="flex flex-wrap gap-2">
<span class="font-bold text-gray-700 w-28 shrink-0">사업자번호</span>
<span><?= esc($val($shop->ds_biz_no ?? null)) ?></span>
</div>
<div class="flex flex-wrap gap-2">
<span class="font-bold text-gray-700 w-28 shrink-0">대표자명</span>
<span><?= esc($dispMask(mask_person_name($shop->ds_rep_name ?? null))) ?></span>
</div>
<div class="flex flex-wrap gap-2">
<span class="font-bold text-gray-700 w-28 shrink-0">가상계좌</span>
<span><?= esc($val($shop->ds_va_number ?? null)) ?></span>
</div>
<div class="flex flex-wrap gap-2">
<span class="font-bold text-gray-700 w-28 shrink-0">우편번호</span>
<span><?= esc($val($shop->ds_zip ?? null)) ?></span>
</div>
<div class="flex flex-wrap gap-2">
<span class="font-bold text-gray-700 w-28 shrink-0">도로명주소</span>
<span><?= esc($val($shop->ds_addr ?? null)) ?></span>
</div>
<div class="flex flex-wrap gap-2">
<span class="font-bold text-gray-700 w-28 shrink-0">지번주소</span>
<span><?= esc($val($shop->ds_addr_jibun ?? null)) ?></span>
</div>
<div class="flex flex-wrap gap-2">
<span class="font-bold text-gray-700 w-28 shrink-0">일반전화</span>
<span><?= esc($val($shop->ds_tel ?? null)) ?></span>
</div>
<div class="flex flex-wrap gap-2">
<span class="font-bold text-gray-700 w-28 shrink-0">대표 휴대전화</span>
<span><?= esc($dispMask(mask_mobile_phone($shop->ds_rep_phone ?? null))) ?></span>
</div>
<div class="flex flex-wrap gap-2">
<span class="font-bold text-gray-700 w-28 shrink-0">이메일</span>
<span><?= esc($val($shop->ds_email ?? null)) ?></span>
</div>
<div class="flex flex-wrap gap-2">
<span class="font-bold text-gray-700 w-28 shrink-0">지정일자</span>
<span><?= esc($val($shop->ds_designated_at ?? null)) ?></span>
</div>
<div class="flex flex-wrap gap-2">
<span class="font-bold text-gray-700 w-28 shrink-0">영업상태</span>
<span><?= esc($stateLabel) ?></span>
</div>
<div class="flex flex-wrap gap-2">
<span class="font-bold text-gray-700 w-28 shrink-0">등록일시</span>
<span><?= esc($val($shop->ds_regdate ?? null)) ?></span>
</div>
</div>

View File

@@ -8,6 +8,31 @@
</div>
</div>
</section>
<section class="no-print border border-gray-300 bg-white p-2 mt-2">
<form method="POST" action="<?= mgmt_url('free-recipients') ?>" class="flex flex-wrap items-end gap-2" autocomplete="off">
<?= csrf_field() ?>
<div class="flex flex-col gap-0.5">
<label class="text-xs text-gray-500">조회 기준</label>
<select name="search_field" class="border border-gray-300 rounded px-2 py-1.5 text-sm min-w-[10rem]">
<option value="fr_idx" <?= ($search_field ?? 'fr_name') === 'fr_idx' ? 'selected' : '' ?>>번호</option>
<option value="fr_type_code" <?= ($search_field ?? 'fr_name') === 'fr_type_code' ? 'selected' : '' ?>>구분</option>
<option value="fr_name" <?= ($search_field ?? 'fr_name') === 'fr_name' ? 'selected' : '' ?>>대상자명</option>
<option value="fr_phone" <?= ($search_field ?? 'fr_name') === 'fr_phone' ? 'selected' : '' ?>>연락처</option>
<option value="fr_addr" <?= ($search_field ?? 'fr_name') === 'fr_addr' ? 'selected' : '' ?>>주소</option>
<option value="fr_dong_code" <?= ($search_field ?? 'fr_name') === 'fr_dong_code' ? 'selected' : '' ?>>동</option>
<option value="fr_note" <?= ($search_field ?? 'fr_name') === 'fr_note' ? 'selected' : '' ?>>비고</option>
</select>
</div>
<div class="flex flex-col gap-0.5">
<label class="text-xs text-gray-500">조회어</label>
<input type="text" name="search_query" value="<?= esc($search_query ?? '') ?>" class="border border-gray-300 rounded px-2 py-1.5 text-sm min-w-[18rem]" placeholder="조회어 입력">
</div>
<div class="flex items-center gap-2 pb-0.5">
<button type="submit" class="bg-btn-search text-white px-4 py-1.5 rounded-sm text-sm">조회</button>
<a href="<?= mgmt_url('free-recipients') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
</div>
</form>
</section>
<div class="border border-gray-300 overflow-auto mt-2">
<table class="w-full data-table">
<thead>
@@ -17,7 +42,7 @@
<th>대상자명</th>
<th>연락처</th>
<th>주소</th>
<th>동코드</th>
<th>동</th>
<th>비고</th>
<th>종료일</th>
<th class="w-20">상태</th>
@@ -28,11 +53,11 @@
<?php foreach ($list as $row): ?>
<tr>
<td class="text-center"><?= esc($row->fr_idx) ?></td>
<td class="text-center"><?= esc($row->fr_type_code) ?></td>
<td class="text-center"><?= esc($type_code_map[(string) ($row->fr_type_code ?? '')] ?? ($row->fr_type_code ?? '')) ?></td>
<td class="text-left pl-2"><?= esc($row->fr_name) ?></td>
<td class="text-center"><?= esc($row->fr_phone) ?></td>
<td class="text-left pl-2"><?= esc($row->fr_addr) ?></td>
<td class="text-center"><?= esc($row->fr_dong_code) ?></td>
<td class="text-center"><?= esc($dong_code_map[(string) ($row->fr_dong_code ?? '')] ?? ($row->fr_dong_code ?? '')) ?></td>
<td class="text-left pl-2"><?= esc($row->fr_note) ?></td>
<td class="text-center"><?= esc($row->fr_end_date) ?></td>
<td class="text-center"><?= (int) $row->fr_state === 1 ? '사용' : '미사용' ?></td>

View File

@@ -8,6 +8,31 @@
</div>
</div>
</section>
<section class="no-print border border-gray-300 bg-white p-2 mt-2">
<form method="POST" action="<?= mgmt_url('managers') ?>" class="flex flex-wrap items-end gap-2" autocomplete="off">
<?= csrf_field() ?>
<div class="flex flex-col gap-0.5">
<label class="text-xs text-gray-500">조회 기준</label>
<select name="search_field" class="border border-gray-300 rounded px-2 py-1.5 text-sm min-w-[10rem]">
<option value="mg_idx" <?= ($search_field ?? 'mg_name') === 'mg_idx' ? 'selected' : '' ?>>번호</option>
<option value="mg_name" <?= ($search_field ?? 'mg_name') === 'mg_name' ? 'selected' : '' ?>>담당자명</option>
<option value="mg_dept_code" <?= ($search_field ?? 'mg_name') === 'mg_dept_code' ? 'selected' : '' ?>>소속</option>
<option value="mg_position_code" <?= ($search_field ?? 'mg_name') === 'mg_position_code' ? 'selected' : '' ?>>직위</option>
<option value="mg_tel" <?= ($search_field ?? 'mg_name') === 'mg_tel' ? 'selected' : '' ?>>전화</option>
<option value="mg_phone" <?= ($search_field ?? 'mg_name') === 'mg_phone' ? 'selected' : '' ?>>휴대전화</option>
<option value="mg_email" <?= ($search_field ?? 'mg_name') === 'mg_email' ? 'selected' : '' ?>>이메일</option>
</select>
</div>
<div class="flex flex-col gap-0.5">
<label class="text-xs text-gray-500">조회어</label>
<input type="text" name="search_query" value="<?= esc($search_query ?? '') ?>" class="border border-gray-300 rounded px-2 py-1.5 text-sm min-w-[18rem]" placeholder="조회어 입력">
</div>
<div class="flex items-center gap-2 pb-0.5">
<button type="submit" class="bg-btn-search text-white px-4 py-1.5 rounded-sm text-sm">조회</button>
<a href="<?= mgmt_url('managers') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
</div>
</form>
</section>
<div class="border border-gray-300 overflow-auto mt-2">
<table class="w-full data-table">
<thead>
@@ -28,8 +53,8 @@
<tr>
<td class="text-center"><?= esc($row->mg_idx) ?></td>
<td class="text-center"><?= esc($row->mg_name) ?></td>
<td class="text-center"><?= esc($row->mg_dept_code) ?></td>
<td class="text-center"><?= esc($row->mg_position_code) ?></td>
<td class="text-center"><?= esc($dept_code_map[(string) ($row->mg_dept_code ?? '')] ?? ($row->mg_dept_code ?? '')) ?></td>
<td class="text-center"><?= esc($pos_code_map[(string) ($row->mg_position_code ?? '')] ?? ($row->mg_position_code ?? '')) ?></td>
<td class="text-center"><?= esc($row->mg_tel) ?></td>
<td class="text-center"><?= esc($row->mg_phone) ?></td>
<td class="text-center"><?= esc($row->mg_email) ?></td>

View File

@@ -4,21 +4,39 @@
<span class="text-sm font-bold text-gray-700">판매 대행소 관리</span>
<div class="flex items-center gap-2">
<button onclick="window.print()" class="no-print border border-btn-print-border text-gray-600 px-3 py-1 rounded-sm text-sm hover:bg-gray-50 transition">인쇄</button>
<a href="<?= base_url('admin/sales-agencies/create') ?>" class="bg-btn-search text-white px-4 py-1.5 rounded-sm flex items-center gap-1 text-sm shadow hover:opacity-90 transition border border-transparent">대행소 등록</a>
<a href="<?= mgmt_url('sales-agencies/create') ?>" class="bg-btn-search text-white px-4 py-1.5 rounded-sm flex items-center gap-1 text-sm shadow hover:opacity-90 transition border border-transparent">대행소 등록</a>
</div>
</div>
</section>
<section class="no-print border border-gray-300 bg-white p-2 mt-2">
<form method="GET" action="<?= mgmt_url('sales-agencies') ?>" class="flex flex-wrap items-end gap-2">
<div class="flex flex-col gap-0.5">
<label class="text-xs text-gray-500">조회 기준</label>
<select name="search_field" class="border border-gray-300 rounded px-2 py-1.5 text-sm min-w-[9rem]">
<option value="sa_idx" <?= ($search_field ?? 'sa_name') === 'sa_idx' ? 'selected' : '' ?>>번호</option>
<option value="sa_kind" <?= ($search_field ?? 'sa_name') === 'sa_kind' ? 'selected' : '' ?>>대행소 구분</option>
<option value="sa_code" <?= ($search_field ?? 'sa_name') === 'sa_code' ? 'selected' : '' ?>>대행소 코드</option>
<option value="sa_name" <?= ($search_field ?? 'sa_name') === 'sa_name' ? 'selected' : '' ?>>대행소 명</option>
</select>
</div>
<div class="flex flex-col gap-0.5">
<label class="text-xs text-gray-500">조회어</label>
<input type="text" name="search_query" value="<?= esc($search_query ?? '') ?>" class="border border-gray-300 rounded px-2 py-1.5 text-sm min-w-[16rem]" placeholder="조회어 입력">
</div>
<div class="flex items-center gap-2 pb-0.5">
<button type="submit" class="bg-btn-search text-white px-4 py-1.5 rounded-sm text-sm">조회</button>
<a href="<?= mgmt_url('sales-agencies') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
</div>
</form>
</section>
<div class="border border-gray-300 overflow-auto mt-2">
<table class="w-full data-table">
<thead>
<tr>
<th class="w-16">번호</th>
<th>대행소</th>
<th>사업자번호</th>
<th>대표자</th>
<th>전화</th>
<th>주소</th>
<th class="w-20">상태</th>
<th>대행소 구분</th>
<th>대행소 코드</th>
<th>대행소 명</th>
<th class="w-36">작업</th>
</tr>
</thead>
@@ -26,15 +44,12 @@
<?php foreach ($list as $row): ?>
<tr>
<td class="text-center"><?= esc($row->sa_idx) ?></td>
<td class="text-left pl-2"><?= esc($row->sa_kind ?? '') ?></td>
<td class="text-center"><?= esc($row->sa_code ?? '') ?></td>
<td class="text-left pl-2"><?= esc($row->sa_name) ?></td>
<td class="text-center"><?= esc($row->sa_biz_no) ?></td>
<td class="text-center"><?= esc($row->sa_rep_name) ?></td>
<td class="text-center"><?= esc($row->sa_tel) ?></td>
<td class="text-left pl-2"><?= esc($row->sa_addr) ?></td>
<td class="text-center"><?= (int) $row->sa_state === 1 ? '정상' : '미사용' ?></td>
<td class="text-center">
<a href="<?= base_url('admin/sales-agencies/edit/' . (int) $row->sa_idx) ?>" class="text-blue-600 hover:underline text-sm mr-1">수정</a>
<form action="<?= base_url('admin/sales-agencies/delete/' . (int) $row->sa_idx) ?>" method="POST" class="inline" onsubmit="return confirm('삭제하시겠습니까?');">
<a href="<?= mgmt_url('sales-agencies/edit/' . (int) $row->sa_idx) ?>" class="text-blue-600 hover:underline text-sm mr-1">수정</a>
<form action="<?= mgmt_url('sales-agencies/delete/' . (int) $row->sa_idx) ?>" method="POST" class="inline" onsubmit="return confirm('삭제하시겠습니까?');">
<?= csrf_field() ?>
<button type="submit" class="text-red-600 hover:underline text-sm">삭제</button>
</form>
@@ -42,7 +57,7 @@
</tr>
<?php endforeach; ?>
<?php if (empty($list)): ?>
<tr><td colspan="8" class="text-center text-gray-400 py-4">등록된 데이터가 없습니다.</td></tr>
<tr><td colspan="5" class="text-center text-gray-400 py-4">등록된 데이터가 없습니다.</td></tr>
<?php endif; ?>
</tbody>
</table>

View File

@@ -106,6 +106,26 @@ test.describe('P2-15: 지정판매소 다조건 조회', () => {
});
});
// 지정판매소 목록 → 상세(읽기 전용)
test.describe('지정판매소 상세', () => {
test('목록에서 상호명 클릭 시 상세 정보 표시', async ({ page }) => {
await loginAsLocal(page);
await page.goto('/bag/designated-shops');
const rowCount = await page.locator('table.data-table tbody tr').count();
if (rowCount === 0) {
test.skip();
return;
}
const shopLink = page.locator('table.data-table tbody td a.font-medium').first();
await expect(shopLink).toBeVisible();
await shopLink.click();
await expect(page).toHaveURL(/\/bag\/designated-shops\/show\/\d+/);
await expect(page.getByText('지정판매소 정보').first()).toBeVisible();
await expect(page.getByText('판매소번호').first()).toBeVisible();
await expect(page.getByRole('link', { name: '목록' })).toBeVisible();
});
});
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// P2-17: 지정판매소 지도
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

78
env
View File

@@ -1,78 +0,0 @@
#--------------------------------------------------------------------
# Example Environment Configuration file
#
# This file can be used as a starting point for your own
# custom .env files, and contains most of the possible settings
# available in a default install.
#
# By default, all of the settings are commented out. If you want
# to override the setting, you must un-comment it by removing the '#'
# at the beginning of the line.
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# ENVIRONMENT
#--------------------------------------------------------------------
# CI_ENVIRONMENT = production
#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------
# app.baseURL = ''
# If you have trouble with `.`, you could also use `_`.
# app_baseURL = ''
# app.forceGlobalSecureRequests = false
# app.CSPEnabled = false
#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------
# database.default.hostname = localhost
# database.default.database = ci4
# database.default.username = root
# database.default.password = root
# database.default.DBDriver = MySQLi
# database.default.DBPrefix =
# database.default.port = 3306
# If you use MySQLi as tests, first update the values of Config\Database::$tests.
# database.tests.hostname = localhost
# database.tests.database = ci4_test
# database.tests.username = root
# database.tests.password = root
# database.tests.DBDriver = MySQLi
# database.tests.DBPrefix =
# database.tests.charset = utf8mb4
# database.tests.DBCollat = utf8mb4_general_ci
# database.tests.port = 3306
#--------------------------------------------------------------------
# ENCRYPTION
#--------------------------------------------------------------------
# encryption.key =
#--------------------------------------------------------------------
# AUTH (TOTP 2차 인증) — 관리자(mb_level 3·4·5)만 적용, 로컬은 false 권장
#--------------------------------------------------------------------
# auth.requireTotp = true
# auth.totpIssuer = "쓰레기봉투 물류시스템"
# auth.totpMaxAttempts = 5
# auth.pending2faTtlSeconds = 600
#--------------------------------------------------------------------
# SESSION
#--------------------------------------------------------------------
# session.driver = 'CodeIgniter\Session\Handlers\FileHandler'
# session.savePath = null
#--------------------------------------------------------------------
# LOGGER
#--------------------------------------------------------------------
# logger.threshold = 4

View File

@@ -0,0 +1,42 @@
<?php
declare(strict_types=1);
use CodeIgniter\Test\CIUnitTestCase;
/**
* @internal
*/
final class PiiMaskTest extends CIUnitTestCase
{
protected function setUp(): void
{
parent::setUp();
helper('pii_mask');
}
public function testMaskPersonNameEmpty(): void
{
$this->assertSame('', mask_person_name(null));
$this->assertSame('', mask_person_name(''));
}
public function testMaskPersonNameKorean(): void
{
$this->assertSame('*', mask_person_name('홍'));
$this->assertSame('김*', mask_person_name('김철'));
$this->assertSame('홍*동', mask_person_name('홍길동'));
$this->assertSame('남**수', mask_person_name('남궁민수'));
}
public function testMaskMobilePhone(): void
{
$this->assertSame('', mask_mobile_phone(null));
$this->assertSame('', mask_mobile_phone(''));
$this->assertSame('010-****-5678', mask_mobile_phone('010-1234-5678'));
$this->assertSame('010-****-5678', mask_mobile_phone('01012345678'));
$this->assertSame('010-****-5678', mask_mobile_phone('821012345678'));
$this->assertSame('02-****-7890', mask_mobile_phone('0212347890'));
$this->assertSame('010-****-2312', mask_mobile_phone('0102312'));
}
}