Compare commits
21 Commits
e4bd3f9ffc
...
clean/push
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8753b1aa68 | ||
|
|
aa50eb72ee | ||
|
|
7580c31ab0 | ||
|
|
6fddf15000 | ||
|
|
b99c108aeb | ||
|
|
f68f135446 | ||
|
|
0d512bd21d | ||
|
|
12cd052c40 | ||
|
|
aaf7b4c66e | ||
|
|
d551dfa87e | ||
|
|
84026f8072 | ||
|
|
1a8d4bb9da | ||
|
|
06aa401048 | ||
|
|
06fedc866a | ||
|
|
b5eed31b94 | ||
|
|
c2dc2fd38a | ||
|
|
984ddb403e | ||
|
|
89f80edc5d | ||
|
|
5b0c3fac97 | ||
|
|
c4d30b204b | ||
|
|
ab40a90f69 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -42,7 +42,6 @@ $RECYCLE.BIN/
|
||||
# These should never be under version control,
|
||||
# as it poses a security risk.
|
||||
.env
|
||||
env
|
||||
.env.local
|
||||
.env.*.local
|
||||
.env.production
|
||||
@@ -57,12 +56,10 @@ Vagrantfile
|
||||
# Local docs & MCP (저장소에 올리지 않음)
|
||||
#-------------------------
|
||||
docs/local/
|
||||
docs/
|
||||
mcp-servers/
|
||||
|
||||
# Cursor MCP — API 키·로컬 경로 등 포함 가능
|
||||
.cursor/mcp.json
|
||||
.cursor/
|
||||
|
||||
#-------------------------
|
||||
# Secrets & credentials (보안)
|
||||
@@ -177,3 +174,4 @@ blob-report/
|
||||
|
||||
/results/
|
||||
/phpunit*.xml
|
||||
docs/
|
||||
|
||||
84
README.md
84
README.md
@@ -39,7 +39,7 @@ app/
|
||||
├── Config/ # Routes, Database, Roles, Filters, Session 등 (45개)
|
||||
├── Controllers/ # 28개 컨트롤러
|
||||
│ ├── Auth.php # 로그인/로그아웃/회원가입
|
||||
│ ├── Bag.php # 사이트 메뉴 페이지 (10개 메뉴)
|
||||
│ ├── Bag.php # 사이트 메뉴 페이지 (기본정보·기본코드 목록 등)
|
||||
│ ├── Home.php # 홈/대시보드
|
||||
│ └── Admin/ # 관리자 컨트롤러 24개
|
||||
│ ├── BagOrder.php # 발주 관리
|
||||
@@ -69,7 +69,7 @@ app/
|
||||
│ ├── bag/ # 사이트 메뉴 뷰 (17개 + 레이아웃)
|
||||
│ ├── auth/ # 로그인/회원가입 (2개)
|
||||
│ └── home/ # 대시보드 (1개)
|
||||
├── Filters/ # AdminAuthFilter (관리자 접근 제어)
|
||||
├── Filters/ # AdminAuthFilter, LoginAuthFilter (`/bag/code-kinds` 등)
|
||||
├── Helpers/ # admin_helper, pii_encryption_helper
|
||||
└── Database/ # Migrations, Seeds
|
||||
public/ # 웹 루트
|
||||
@@ -160,6 +160,7 @@ assets/ # 기획 문서 (엑셀)
|
||||
|
||||
- 역할 상수: `Config\Roles` -- `LEVEL_SUPER_ADMIN(4)`, `LEVEL_LOCAL_ADMIN(3)`, `LEVEL_SHOP(2)`, `LEVEL_CITIZEN(1)`
|
||||
- `AdminAuthFilter`가 로그인 + 레벨 3/4 + 지자체 선택 여부 검증
|
||||
- **기본코드 마스터 CRUD**는 `Roles::canManageCodeMaster()`(지자체관리자·Super Admin 등)로 제한. **종류·세부 목록 조회**는 로그인 사용자 전원 (`/bag/code-kinds`, `/bag/code-details/{ck_idx}`, `loginAuth` 필터)
|
||||
|
||||
## 멀티테넌시
|
||||
|
||||
@@ -185,7 +186,9 @@ assets/ # 기획 문서 (엑셀)
|
||||
|
||||
| 경로 | 설명 | 기능 |
|
||||
|------|------|------|
|
||||
| `/bag/basic-info` | 기본정보관리 | 코드/단가/포장단위 조회 + 관리 링크 |
|
||||
| `/bag/basic-info` | 기본정보관리 | 단가·포장단위 등 링크 허브 (`/bag/code-kinds`로 기본코드 조회) |
|
||||
| `/bag/code-kinds` | 기본코드 종류 | 종류 목록·세부코드 링크 (조회; CRUD는 관리자만) |
|
||||
| `/bag/code-details/{ck_idx}` | 기본코드 세부 | 해당 종류의 세부코드 목록 (조회; CRUD는 관리자만) |
|
||||
| `/bag/purchase-inbound` | 발주 입고 관리 | 발주/입고 목록 + 등록 버튼 |
|
||||
| `/bag/issue` | 불출 관리 | 불출 목록 + 처리/취소 |
|
||||
| `/bag/inventory` | 재고 관리 | 봉투별 현재 재고 조회 |
|
||||
@@ -210,46 +213,39 @@ assets/ # 기획 문서 (엑셀)
|
||||
| `/admin/menus/*` | 메뉴 관리 (트리 CRUD) |
|
||||
| `/admin/local-governments/*` | 지자체 관리 (CRUD) |
|
||||
| `/admin/select-local-government` | 작업 지자체 선택 (Super Admin) |
|
||||
| `/admin/password-change` | 비밀번호 변경 |
|
||||
| `/admin/designated-shops/*` | 지정판매소 관리 (CRUD) |
|
||||
|
||||
**기본정보관리 (Phase 2)**
|
||||
**기본코드 CRUD만 관리자 경로 (목록·조회는 `/bag/*`)**
|
||||
|
||||
| 경로 | 기능 |
|
||||
|------|------|
|
||||
| `/admin/code-kinds/*` | 기본코드 종류 (CRUD) |
|
||||
| `/admin/code-details/*` | 세부코드 (CRUD) |
|
||||
| `/admin/bag-prices/*` | 봉투 단가 (CRUD + 이력) |
|
||||
| `/admin/packaging-units/*` | 포장 단위 (CRUD + 이력) |
|
||||
| `/admin/sales-agencies/*` | 판매 대행소 (CRUD) |
|
||||
| `/admin/managers/*` | 담당자 (CRUD) |
|
||||
| `/admin/companies/*` | 업체 (CRUD) |
|
||||
| `/admin/free-recipients/*` | 무료용 대상자 (CRUD) |
|
||||
| `/admin/code-kinds/*` | 기본코드 종류 **CRUD만** (create/edit/store/update/delete; **목록 없음** — 조회는 `/bag/code-kinds`) |
|
||||
| `/admin/code-details/*` | 세부코드 **CRUD만** (**목록 없음** — 조회는 `/bag/code-details/{ck_idx}`) |
|
||||
| (호환) `GET /admin/code-details/{ck_idx}` | `/bag/code-details/{ck_idx}` 로 리다이렉트 |
|
||||
|
||||
**발주/입고/재고 (Phase 3)**
|
||||
### 업무 화면 (`/bag/*`, adminAuth 필터)
|
||||
|
||||
동일 `Admin\*` 컨트롤러·뷰를 쓰며 메인 사이트 레이아웃으로 렌더된다. `GET /admin/managers` 등 옛 업무 URL은 `301`·`POST` 는 `307`로 `/bag/...`에 리다이렉트된다.
|
||||
|
||||
| 경로 | 기능 |
|
||||
|------|------|
|
||||
| `/admin/bag-orders/*` | 발주 관리 (등록/상세/취소/삭제) |
|
||||
| `/admin/bag-receivings/*` | 입고 관리 (등록, 재고 자동 반영) |
|
||||
| `/admin/bag-inventory` | 재고 현황 조회 |
|
||||
|
||||
**판매/주문/불출 (Phase 4)**
|
||||
|
||||
| 경로 | 기능 |
|
||||
|------|------|
|
||||
| `/admin/shop-orders/*` | 주문 접수 (등록/취소) |
|
||||
| `/admin/bag-sales/*` | 판매/반품 (등록) |
|
||||
| `/admin/bag-issues/*` | 무료용 불출 (등록/취소, 재고 연동) |
|
||||
|
||||
**리포트 (Phase 5)**
|
||||
|
||||
| 경로 | 기능 |
|
||||
|------|------|
|
||||
| `/admin/reports/sales-ledger` | 판매 대장 (일자별/기간별) |
|
||||
| `/admin/reports/daily-summary` | 일계표 (일계 + 월간 누계) |
|
||||
| `/admin/reports/period-sales` | 기간별 판매현황 |
|
||||
| `/admin/reports/supply-demand` | 봉투 수불 현황 |
|
||||
| `/bag/password-change` | 비밀번호 변경 |
|
||||
| `/bag/designated-shops/*` | 지정판매소 관리 (CRUD) |
|
||||
| `/bag/bag-prices/*` | 봉투 단가 (CRUD + 이력) |
|
||||
| `/bag/packaging-units/manage/*` | 포장 단위 (CRUD + 이력; 조회 전용은 `/bag/packaging-units`) |
|
||||
| `/bag/sales-agencies/*` | 판매 대행소 (CRUD) |
|
||||
| `/bag/managers/*` | 담당자 (CRUD) |
|
||||
| `/bag/companies/*` | 업체 (CRUD) |
|
||||
| `/bag/free-recipients/*` | 무료용 대상자 (CRUD) |
|
||||
| `/bag/bag-orders/*` | 발주 관리 (등록/상세/취소/삭제) |
|
||||
| `/bag/bag-receivings/*` | 입고 관리 (등록, 재고 자동 반영) |
|
||||
| `/bag/bag-inventory` | 재고 현황 조회 |
|
||||
| `/bag/shop-orders/*` | 주문 접수 (등록/취소) |
|
||||
| `/bag/bag-sales/*` | 판매/반품 (등록) |
|
||||
| `/bag/bag-issues/*` | 무료용 불출 (등록/취소, 재고 연동) |
|
||||
| `/bag/reports/sales-ledger` | 판매 대장 (일자별/기간별) |
|
||||
| `/bag/reports/daily-summary` | 일계표 (일계 + 월간 누계) |
|
||||
| `/bag/reports/period-sales` | 기간별 판매현황 |
|
||||
| `/bag/reports/supply-demand` | 봉투 수불 현황 |
|
||||
|
||||
---
|
||||
|
||||
@@ -289,7 +285,7 @@ assets/ # 기획 문서 (엑셀)
|
||||
|
||||
| 항목 | 구현 |
|
||||
|------|------|
|
||||
| 인증 | 세션 기반 로그인, AdminAuthFilter로 관리자 접근 제어 |
|
||||
| 인증 | 세션 기반 로그인, AdminAuthFilter로 관리자 접근 제어, 기본코드 목록 경로는 LoginAuthFilter(`loginAuth`) |
|
||||
| RBAC | 4단계 역할 (Config\Roles), 메뉴별 역할 노출 |
|
||||
| PII 암호화 | `pii_encryption_helper` (AES, `ENC:` prefix) - 이메일/전화번호 |
|
||||
| 비밀번호 | `password_hash()` + `password_verify()` (bcrypt) |
|
||||
@@ -349,6 +345,8 @@ SQL 스크립트 실행 순서:
|
||||
| 17 | `seed_test_accounts.sql` | 테스터 계정 4개 |
|
||||
| 18 | `seed_realistic_data.sql` | 실제형 시범 데이터 |
|
||||
|
||||
**기본코드 전용 보강 (선택·기존 DB):** `menu_fix_basic_code_link.sql`, `menu_site_add_basic_code_child.sql`, 개발목록 CSV 반영 시 `code_master_sync_from_csv.sql` 또는 `writable/tools/sync_basic_codes_from_csv.py`.
|
||||
|
||||
### 4) 개발 서버 실행
|
||||
|
||||
```bash
|
||||
@@ -384,6 +382,7 @@ npx playwright test -g "로그인 페이지"
|
||||
|
||||
| ID | 역할 | Level |
|
||||
|----|------|-------|
|
||||
| `tester_badmin` | 본부 관리자 | 5 |
|
||||
| `tester_admin` | Super Admin | 4 |
|
||||
| `tester_local` | 지자체관리자 (중구청) | 3 |
|
||||
| `tester_shop` | 지정판매소 | 2 |
|
||||
@@ -397,7 +396,7 @@ npx playwright test -g "로그인 페이지"
|
||||
| admin.spec.js | 10 | 관리자 패널 접근 |
|
||||
| public.spec.js | 4 | 공개 페이지 |
|
||||
| bag-site.spec.js | 11 | 사이트 메뉴 /bag/* |
|
||||
| code-management.spec.js | 7 | 기본코드 CRUD |
|
||||
| code-management.spec.js | 7 | 기본코드 CRUD (`/bag/*` 목록 + `/admin/*` 폼) |
|
||||
| bag-price.spec.js | 6 | 봉투 단가 |
|
||||
| packaging-unit.spec.js | 3 | 포장 단위 |
|
||||
| phase2-entities.spec.js | 8 | 대행소/담당자/업체/무료대상자 |
|
||||
@@ -410,6 +409,14 @@ npx playwright test -g "로그인 페이지"
|
||||
|
||||
## 기본코드 체계
|
||||
|
||||
### 코드 관리 URL·동작
|
||||
|
||||
| 구분 | 경로 | 설명 |
|
||||
|------|------|------|
|
||||
| 목록·조회 | `/bag/code-kinds`, `/bag/code-details/{ck_idx}` | 사이트(`bag`) 레이아웃. 시민·판매소는 열람만; 코드 마스터 관리 권한이 있으면 CRUD용 링크(관리자 화면) 노출 |
|
||||
| 등록·수정·삭제 | `/admin/code-kinds/*`, `/admin/code-details/*` | `adminAuth` + `canManageCodeMaster`. 처리 후 flash 메시지와 함께 위 `bag` 목록으로 되돌아감 |
|
||||
| 데이터 보강 (선택) | `writable/tools/sync_basic_codes_from_csv.py` → 생성 SQL 또는 `code_master_sync_from_csv.sql` | 개발목록 CSV와 DB 종류·세부코드 맞출 때 참고 |
|
||||
|
||||
A~T 총 20종의 코드 체계 (`code_kind` + `code_detail`):
|
||||
|
||||
| 코드 | 코드명 | 코드 | 코드명 |
|
||||
@@ -473,6 +480,9 @@ A~T 총 20종의 코드 체계 (`code_kind` + `code_detail`):
|
||||
| `menu_site_seed_from_csv.sql` | 사이트 네비게이션 시드 |
|
||||
| `local_government_init_daegu.sql` | 대구 8개 구군 지자체 |
|
||||
| `code_master_init_daegu.sql` | 기본코드 20종 + 세부코드 |
|
||||
| `menu_fix_basic_code_link.sql` | 사이트 메뉴에서 기본코드 링크 보정 (기존 DB용, 선택) |
|
||||
| `menu_site_add_basic_code_child.sql` | 사이트 메뉴에 기본코드 하위 항목 (선택) |
|
||||
| `code_master_sync_from_csv.sql` | CSV 기준 기본코드 보강 (선택) |
|
||||
| `bag_price_tables.sql` | bag_price, bag_price_history |
|
||||
| `packaging_unit_tables.sql` | packaging_unit, packaging_unit_history |
|
||||
| `sales_agency_tables.sql` | sales_agency |
|
||||
|
||||
@@ -40,7 +40,7 @@ class App extends BaseConfig
|
||||
* something else. If you have configured your web server to remove this file
|
||||
* from your site URIs, set this variable to an empty string.
|
||||
*/
|
||||
public string $indexPage = 'index.php';
|
||||
public string $indexPage = '';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
|
||||
@@ -7,17 +7,19 @@ use CodeIgniter\Config\BaseConfig;
|
||||
/**
|
||||
* 로그인·2차 인증(TOTP) 관련 설정
|
||||
*
|
||||
* .env 예:
|
||||
* auth.requireTotp = true
|
||||
* auth.totpIssuer = "쓰레기봉투 물류시스템"
|
||||
* .env 의 auth.requireTotp 가 Config 기본값보다 우선합니다. 끄려면 반드시 false 로 두세요.
|
||||
* 예:
|
||||
* auth.requireTotp = false
|
||||
* auth.requireTotp = true # 운영에서 2FA 켤 때
|
||||
* auth.totpIssuer = "종량제 시스템"
|
||||
*/
|
||||
class Auth extends BaseConfig
|
||||
{
|
||||
/** 운영·스테이징 true 권장. 로컬 개발 시 false 로 1단계만 로그인 가능 */
|
||||
public bool $requireTotp = true;
|
||||
/** false 이면 로그인 시 TOTP·등록 유도 없음. 운영에서 켤 때 .env 에 auth.requireTotp = true */
|
||||
public bool $requireTotp = false;
|
||||
|
||||
/** 인증 앱에 표시되는 발급자(issuer) */
|
||||
public string $totpIssuer = '쓰레기봉투 물류시스템';
|
||||
public string $totpIssuer = '종량제 시스템';
|
||||
|
||||
/** TOTP 연속 실패 시 세션 종료 전 허용 횟수 */
|
||||
public int $totpMaxAttempts = 5;
|
||||
|
||||
@@ -27,8 +27,40 @@ class Encryption extends BaseConfig
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$hex = (string) env('encryption.key', '');
|
||||
$hex = trim((string) env('encryption.key', ''));
|
||||
if (
|
||||
(str_starts_with($hex, "'") && str_ends_with($hex, "'"))
|
||||
|| (str_starts_with($hex, '"') && str_ends_with($hex, '"'))
|
||||
) {
|
||||
$hex = substr($hex, 1, -1);
|
||||
}
|
||||
$this->key = (strlen($hex) === 64 && ctype_xdigit($hex)) ? hex2bin($hex) : '';
|
||||
|
||||
$prev = trim((string) env('encryption.previousKeys', ''));
|
||||
if ($prev !== '') {
|
||||
$parsed = [];
|
||||
$parts = array_map('trim', explode(',', $prev));
|
||||
foreach ($parts as $part) {
|
||||
if ($part === '') {
|
||||
continue;
|
||||
}
|
||||
if (str_starts_with($part, 'hex2bin:')) {
|
||||
$part = substr($part, 8);
|
||||
}
|
||||
if (
|
||||
(str_starts_with($part, "'") && str_ends_with($part, "'"))
|
||||
|| (str_starts_with($part, '"') && str_ends_with($part, '"'))
|
||||
) {
|
||||
$part = substr($part, 1, -1);
|
||||
}
|
||||
if (strlen($part) === 64 && ctype_xdigit($part)) {
|
||||
$parsed[] = 'hex2bin:' . $part;
|
||||
}
|
||||
}
|
||||
if (! empty($parsed)) {
|
||||
$this->previousKeys = $parsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,6 +26,7 @@ class Filters extends BaseFilters
|
||||
*/
|
||||
public array $aliases = [
|
||||
'adminAuth' => \App\Filters\AdminAuthFilter::class,
|
||||
'loginAuth' => \App\Filters\LoginAuthFilter::class,
|
||||
'csrf' => CSRF::class,
|
||||
'toolbar' => DebugToolbar::class,
|
||||
'honeypot' => Honeypot::class,
|
||||
|
||||
@@ -42,6 +42,52 @@ class Roles extends BaseConfig
|
||||
return $level === self::LEVEL_SUPER_ADMIN || $level === self::LEVEL_HEADQUARTERS_ADMIN;
|
||||
}
|
||||
|
||||
/**
|
||||
* 기본코드(종류·세부) 등록·수정·삭제 가능 (super admin(4) · 본부 관리자(5)만)
|
||||
*/
|
||||
public static function canManageCodeMaster(int $level): bool
|
||||
{
|
||||
return self::isSuperAdminEquivalent($level);
|
||||
}
|
||||
|
||||
/**
|
||||
* 기본코드 종류(code_kind) CRUD — super·본부만
|
||||
*/
|
||||
public static function canManageCodeKindMaster(int $level): bool
|
||||
{
|
||||
return self::isSuperAdminEquivalent($level);
|
||||
}
|
||||
|
||||
/**
|
||||
* 플랫폼 공통 세부코드(CSV·시드) 수정·삭제 — super·본부만
|
||||
*/
|
||||
public static function canEditPlatformCodeDetail(int $level): bool
|
||||
{
|
||||
return self::isSuperAdminEquivalent($level);
|
||||
}
|
||||
|
||||
/**
|
||||
* 세부코드 행 단위 수정/삭제 가능 여부
|
||||
*
|
||||
* @param object $row code_detail (cd_source, cd_lg_idx)
|
||||
*/
|
||||
public static function canEditCodeDetailRow(int $level, object $row, ?int $adminEffectiveLgIdx): bool
|
||||
{
|
||||
if (! self::canManageCodeMaster($level)) {
|
||||
return false;
|
||||
}
|
||||
$src = $row->cd_source ?? 'platform';
|
||||
$lg = (int) ($row->cd_lg_idx ?? 0);
|
||||
if ($src === 'platform' && $lg === 0) {
|
||||
return self::canEditPlatformCodeDetail($level);
|
||||
}
|
||||
if (self::isSuperAdminEquivalent($level)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $adminEffectiveLgIdx !== null && $adminEffectiveLgIdx > 0 && $lg === $adminEffectiveLgIdx;
|
||||
}
|
||||
|
||||
/**
|
||||
* TOTP 2차 인증 적용 대상 (지자체·super·본부 관리자)
|
||||
*/
|
||||
|
||||
@@ -54,7 +54,6 @@ $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');
|
||||
@@ -69,7 +68,6 @@ $routes->group('bag', ['filter' => 'adminAuth'], static function ($routes): void
|
||||
$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');
|
||||
@@ -77,7 +75,6 @@ $routes->group('bag', ['filter' => 'adminAuth'], static function ($routes): void
|
||||
$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');
|
||||
@@ -87,7 +84,6 @@ $routes->group('bag', ['filter' => 'adminAuth'], static function ($routes): void
|
||||
$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');
|
||||
|
||||
@@ -11,16 +11,15 @@ class BagInventory 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', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$invModel = model(BagInventoryModel::class);
|
||||
$list = $invModel->where('bi_lg_idx', $lgIdx)->orderBy('bi_bag_code', 'ASC')->paginate(20);
|
||||
$pager = $invModel->pager;
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '재고 현황',
|
||||
'content' => view('admin/bag_inventory/index', ['list' => $list, 'pager' => $pager]),
|
||||
]);
|
||||
return $this->renderWorkPage('재고 현황', 'admin/bag_inventory/index', ['list' => $list, 'pager' => $pager]);
|
||||
}
|
||||
|
||||
public function export()
|
||||
@@ -28,7 +27,7 @@ class BagInventory extends BaseController
|
||||
helper(['admin', 'export']);
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if (! $lgIdx) {
|
||||
return redirect()->to(site_url('admin/bag-inventory'))->with('error', '지자체를 선택해 주세요.');
|
||||
return redirect()->to(mgmt_url('bag-inventory'))->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$list = model(BagInventoryModel::class)->where('bi_lg_idx', $lgIdx)->orderBy('bi_bag_code', 'ASC')->findAll();
|
||||
|
||||
@@ -21,33 +21,34 @@ class BagIssue 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', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$builder = $this->issueModel->where('bi2_lg_idx', $lgIdx);
|
||||
$startDate = $this->request->getGet('start_date');
|
||||
$endDate = $this->request->getGet('end_date');
|
||||
if ($startDate) $builder->where('bi2_issue_date >=', $startDate);
|
||||
if ($endDate) $builder->where('bi2_issue_date <=', $endDate);
|
||||
if ($startDate) {
|
||||
$builder->where('bi2_issue_date >=', $startDate);
|
||||
}
|
||||
if ($endDate) {
|
||||
$builder->where('bi2_issue_date <=', $endDate);
|
||||
}
|
||||
|
||||
$list = $builder->orderBy('bi2_issue_date', 'DESC')->orderBy('bi2_idx', 'DESC')->paginate(20);
|
||||
$pager = $this->issueModel->pager;
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '무료용 불출 관리',
|
||||
'content' => view('admin/bag_issue/index', compact('list', 'startDate', 'endDate', 'pager')),
|
||||
]);
|
||||
return $this->renderWorkPage('무료용 불출 관리', 'admin/bag_issue/index', compact('list', 'startDate', 'endDate', 'pager'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
$kind = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true) : [];
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx) : [];
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '무료용 불출 처리',
|
||||
'content' => view('admin/bag_issue/create', compact('bagCodes')),
|
||||
]);
|
||||
return $this->renderWorkPage('무료용 불출 처리', 'admin/bag_issue/create', compact('bagCodes'));
|
||||
}
|
||||
|
||||
public function store()
|
||||
@@ -72,7 +73,7 @@ class BagIssue extends BaseController
|
||||
$qty = (int) $this->request->getPost('bi2_qty');
|
||||
|
||||
$kindO = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$detail = $kindO ? model(CodeDetailModel::class)->where('cd_ck_idx', $kindO->ck_idx)->where('cd_code', $bagCode)->first() : null;
|
||||
$detail = $kindO ? model(CodeDetailModel::class)->findResolvedByKindAndCode((int) $kindO->ck_idx, (string) $bagCode, $lgIdx) : null;
|
||||
$bagName = $detail ? $detail->cd_name : '';
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
@@ -95,16 +96,14 @@ class BagIssue extends BaseController
|
||||
$this->issueModel->insert($issueData);
|
||||
$bi2Idx = (int) $this->issueModel->getInsertID();
|
||||
|
||||
// CT-05: 감사 로그
|
||||
helper('audit');
|
||||
audit_log('create', 'bag_issue', $bi2Idx, null, array_merge($issueData, ['bi2_idx' => $bi2Idx]));
|
||||
|
||||
// 재고 감산
|
||||
model(BagInventoryModel::class)->adjustQty($lgIdx, $bagCode, $bagName, -$qty);
|
||||
|
||||
$db->transComplete();
|
||||
|
||||
return redirect()->to(site_url('admin/bag-issues'))->with('success', '불출 처리되었습니다.');
|
||||
return redirect()->to(mgmt_url('bag-issues'))->with('success', '불출 처리되었습니다.');
|
||||
}
|
||||
|
||||
public function cancel(int $id)
|
||||
@@ -112,7 +111,7 @@ class BagIssue extends BaseController
|
||||
helper('admin');
|
||||
$item = $this->issueModel->find($id);
|
||||
if (! $item || (int) $item->bi2_lg_idx !== admin_effective_lg_idx()) {
|
||||
return redirect()->to(site_url('admin/bag-issues'))->with('error', '불출 내역을 찾을 수 없습니다.');
|
||||
return redirect()->to(mgmt_url('bag-issues'))->with('error', '불출 내역을 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
@@ -120,14 +119,12 @@ class BagIssue extends BaseController
|
||||
|
||||
$before = (array) $item;
|
||||
$this->issueModel->update($id, ['bi2_status' => 'cancelled']);
|
||||
// CT-05: 감사 로그
|
||||
helper('audit');
|
||||
audit_log('update', 'bag_issue', $id, $before, ['bi2_status' => 'cancelled']);
|
||||
// 재고 복원
|
||||
model(BagInventoryModel::class)->adjustQty((int) $item->bi2_lg_idx, $item->bi2_bag_code, $item->bi2_bag_name, (int) $item->bi2_qty);
|
||||
|
||||
$db->transComplete();
|
||||
|
||||
return redirect()->to(site_url('admin/bag-issues'))->with('success', '불출이 취소되었습니다.');
|
||||
return redirect()->to(mgmt_url('bag-issues'))->with('success', '불출이 취소되었습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@ use App\Models\CompanyModel;
|
||||
use App\Models\SalesAgencyModel;
|
||||
use App\Models\CodeKindModel;
|
||||
use App\Models\CodeDetailModel;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
class BagOrder extends BaseController
|
||||
{
|
||||
private BagOrderModel $orderModel;
|
||||
@@ -29,7 +27,7 @@ class BagOrder extends BaseController
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if (! $lgIdx) {
|
||||
return redirect()->to(site_url('admin'))->with('error', '지자체를 선택해 주세요.');
|
||||
return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$builder = $this->orderModel->where('bo_lg_idx', $lgIdx);
|
||||
@@ -57,12 +55,11 @@ class BagOrder extends BaseController
|
||||
// 제작업체/대행소 이름 매핑
|
||||
$companyMap = []; $agencyMap = [];
|
||||
foreach (model(CompanyModel::class)->where('cp_lg_idx', $lgIdx)->findAll() as $c) $companyMap[$c->cp_idx] = $c->cp_name;
|
||||
foreach (model(SalesAgencyModel::class)->where('sa_lg_idx', $lgIdx)->findAll() as $a) $agencyMap[$a->sa_idx] = $a->sa_name;
|
||||
foreach (model(SalesAgencyModel::class)->where('sa_lg_idx', $lgIdx)->orderForDisplay()->findAll() as $a) {
|
||||
$agencyMap[$a->sa_idx] = '[' . ($a->sa_kind ?? '') . '] ' . ($a->sa_code ?? '') . ' — ' . ($a->sa_name ?? '');
|
||||
}
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '발주 현황',
|
||||
'content' => view('admin/bag_order/index', compact('list', 'itemSummary', 'companyMap', 'agencyMap', 'startDate', 'endDate', 'status', 'pager')),
|
||||
]);
|
||||
return $this->renderWorkPage('발주 현황', 'admin/bag_order/index', compact('list', 'itemSummary', 'companyMap', 'agencyMap', 'startDate', 'endDate', 'status', 'pager'));
|
||||
}
|
||||
|
||||
public function export()
|
||||
@@ -70,7 +67,7 @@ class BagOrder extends BaseController
|
||||
helper(['admin', 'export']);
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if (! $lgIdx) {
|
||||
return redirect()->to(site_url('admin/bag-orders'))->with('error', '지자체를 선택해 주세요.');
|
||||
return redirect()->to(mgmt_url('bag-orders'))->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$builder = $this->orderModel->where('bo_lg_idx', $lgIdx);
|
||||
@@ -115,20 +112,19 @@ class BagOrder extends BaseController
|
||||
{
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if (!$lgIdx) return redirect()->to(site_url('admin/bag-orders'))->with('error', '지자체를 선택해 주세요.');
|
||||
if (! $lgIdx) {
|
||||
return redirect()->to(mgmt_url('bag-orders'))->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
// 봉투 종류 + 단가 + 포장단위
|
||||
$kind = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true) : [];
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx) : [];
|
||||
$prices = model(BagPriceModel::class)->where('bp_lg_idx', $lgIdx)->where('bp_state', 1)->findAll();
|
||||
$units = model(PackagingUnitModel::class)->where('pu_lg_idx', $lgIdx)->where('pu_state', 1)->findAll();
|
||||
$companies = model(CompanyModel::class)->where('cp_lg_idx', $lgIdx)->where('cp_type', '제작업체')->where('cp_state', 1)->findAll();
|
||||
$agencies = model(SalesAgencyModel::class)->where('sa_lg_idx', $lgIdx)->where('sa_state', 1)->findAll();
|
||||
$agencies = model(SalesAgencyModel::class)->where('sa_lg_idx', $lgIdx)->orderForDisplay()->findAll();
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '발주 등록',
|
||||
'content' => view('admin/bag_order/create', compact('bagCodes', 'prices', 'units', 'companies', 'agencies')),
|
||||
]);
|
||||
return $this->renderWorkPage('발주 등록', 'admin/bag_order/create', compact('bagCodes', 'prices', 'units', 'companies', 'agencies'));
|
||||
}
|
||||
|
||||
public function store()
|
||||
@@ -201,7 +197,7 @@ class BagOrder extends BaseController
|
||||
|
||||
// 봉투명
|
||||
$kindO = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$detail = $kindO ? model(CodeDetailModel::class)->where('cd_ck_idx', $kindO->ck_idx)->where('cd_code', $code)->first() : null;
|
||||
$detail = $kindO ? model(CodeDetailModel::class)->findResolvedByKindAndCode((int) $kindO->ck_idx, (string) $code, $lgIdx) : null;
|
||||
|
||||
$this->itemModel->insert([
|
||||
'boi_bo_idx' => $boIdx,
|
||||
@@ -216,7 +212,7 @@ class BagOrder extends BaseController
|
||||
|
||||
$db->transComplete();
|
||||
|
||||
return redirect()->to(site_url('admin/bag-orders'))->with('success', '발주가 등록되었습니다. LOT: ' . $lotNo);
|
||||
return redirect()->to(mgmt_url('bag-orders'))->with('success', '발주가 등록되었습니다. LOT: ' . $lotNo);
|
||||
}
|
||||
|
||||
public function detail(int $id)
|
||||
@@ -224,7 +220,7 @@ class BagOrder extends BaseController
|
||||
helper('admin');
|
||||
$order = $this->orderModel->find($id);
|
||||
if (!$order || (int) $order->bo_lg_idx !== admin_effective_lg_idx()) {
|
||||
return redirect()->to(site_url('admin/bag-orders'))->with('error', '발주를 찾을 수 없습니다.');
|
||||
return redirect()->to(mgmt_url('bag-orders'))->with('error', '발주를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$items = $this->itemModel->where('boi_bo_idx', $id)->findAll();
|
||||
@@ -237,13 +233,12 @@ class BagOrder extends BaseController
|
||||
$agencyName = '';
|
||||
if ($order->bo_agency_idx) {
|
||||
$a = model(SalesAgencyModel::class)->find($order->bo_agency_idx);
|
||||
$agencyName = $a ? $a->sa_name : '';
|
||||
if ($a) {
|
||||
$agencyName = '[' . ($a->sa_kind ?? '') . '] ' . ($a->sa_code ?? '') . ' — ' . ($a->sa_name ?? '');
|
||||
}
|
||||
}
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '발주 상세 — ' . $order->bo_lot_no,
|
||||
'content' => view('admin/bag_order/detail', compact('order', 'items', 'companyName', 'agencyName')),
|
||||
]);
|
||||
return $this->renderWorkPage('발주 상세 — ' . $order->bo_lot_no, 'admin/bag_order/detail', compact('order', 'items', 'companyName', 'agencyName'));
|
||||
}
|
||||
|
||||
public function cancel(int $id)
|
||||
@@ -251,14 +246,15 @@ class BagOrder extends BaseController
|
||||
helper('admin');
|
||||
$order = $this->orderModel->find($id);
|
||||
if (!$order || (int) $order->bo_lg_idx !== admin_effective_lg_idx()) {
|
||||
return redirect()->to(site_url('admin/bag-orders'))->with('error', '발주를 찾을 수 없습니다.');
|
||||
return redirect()->to(mgmt_url('bag-orders'))->with('error', '발주를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$before = (array) $order;
|
||||
$this->orderModel->update($id, ['bo_status' => 'cancelled', 'bo_moddate' => date('Y-m-d H:i:s')]);
|
||||
helper('audit');
|
||||
audit_log('update', 'bag_order', $id, $before, ['bo_status' => 'cancelled']);
|
||||
return redirect()->to(site_url('admin/bag-orders'))->with('success', '발주가 취소되었습니다.');
|
||||
|
||||
return redirect()->to(mgmt_url('bag-orders'))->with('success', '발주가 취소되었습니다.');
|
||||
}
|
||||
|
||||
public function delete(int $id)
|
||||
@@ -266,13 +262,14 @@ class BagOrder extends BaseController
|
||||
helper('admin');
|
||||
$order = $this->orderModel->find($id);
|
||||
if (!$order || (int) $order->bo_lg_idx !== admin_effective_lg_idx()) {
|
||||
return redirect()->to(site_url('admin/bag-orders'))->with('error', '발주를 찾을 수 없습니다.');
|
||||
return redirect()->to(mgmt_url('bag-orders'))->with('error', '발주를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$before = (array) $order;
|
||||
$this->orderModel->update($id, ['bo_status' => 'deleted', 'bo_moddate' => date('Y-m-d H:i:s')]);
|
||||
helper('audit');
|
||||
audit_log('delete', 'bag_order', $id, $before, ['bo_status' => 'deleted']);
|
||||
return redirect()->to(site_url('admin/bag-orders'))->with('success', '발주가 삭제 처리되었습니다.');
|
||||
|
||||
return redirect()->to(mgmt_url('bag-orders'))->with('success', '발주가 삭제 처리되었습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\BagPriceModel;
|
||||
use App\Models\BagPriceHistoryModel;
|
||||
use App\Models\CodeKindModel;
|
||||
use App\Models\BagPriceModel;
|
||||
use App\Models\CodeDetailModel;
|
||||
use App\Models\CodeKindModel;
|
||||
|
||||
class BagPrice extends BaseController
|
||||
{
|
||||
@@ -23,36 +23,18 @@ class BagPrice extends BaseController
|
||||
{
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if (!$lgIdx) {
|
||||
return redirect()->to(site_url('admin'))->with('error', '지자체를 선택해 주세요.');
|
||||
if ($lgIdx === null) {
|
||||
return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$builder = $this->priceModel->where('bp_lg_idx', $lgIdx);
|
||||
$list = $this->priceModel->where('bp_lg_idx', $lgIdx)
|
||||
->orderBy('bp_bag_code', 'ASC')
|
||||
->orderBy('bp_start_date', 'DESC')
|
||||
->paginate(20);
|
||||
|
||||
// 기간 필터 (P2-04)
|
||||
$startDate = $this->request->getGet('start_date');
|
||||
$endDate = $this->request->getGet('end_date');
|
||||
if ($startDate) {
|
||||
$builder->where('bp_start_date >=', $startDate);
|
||||
}
|
||||
if ($endDate) {
|
||||
$builder->groupStart()
|
||||
->where('bp_end_date IS NULL')
|
||||
->orWhere('bp_end_date <=', $endDate)
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
$list = $builder->orderBy('bp_bag_code', 'ASC')->orderBy('bp_start_date', 'DESC')->paginate(20);
|
||||
$pager = $this->priceModel->pager;
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '봉투 단가 관리',
|
||||
'content' => view('admin/bag_price/index', [
|
||||
return $this->renderWorkPage('봉투 단가 관리', 'admin/bag_price/index', [
|
||||
'list' => $list,
|
||||
'startDate' => $startDate,
|
||||
'endDate' => $endDate,
|
||||
'pager' => $pager,
|
||||
]),
|
||||
'pager' => $this->priceModel->pager,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -61,21 +43,17 @@ class BagPrice extends BaseController
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if (! $lgIdx) {
|
||||
return redirect()->to(site_url('admin/bag-prices'))->with('error', '지자체를 선택해 주세요.');
|
||||
return redirect()->to(mgmt_url('bag-prices'))->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
// 봉투명 코드(O) 목록
|
||||
$kindModel = model(CodeKindModel::class);
|
||||
$kind = $kindModel->where('ck_code', 'O')->first();
|
||||
$bagCodes = [];
|
||||
if ($kind) {
|
||||
$bagCodes = model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true);
|
||||
$bagCodes = model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx);
|
||||
}
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '봉투 단가 등록',
|
||||
'content' => view('admin/bag_price/create', ['bagCodes' => $bagCodes]),
|
||||
]);
|
||||
return $this->renderWorkPage('봉투 단가 등록', 'admin/bag_price/create', ['bagCodes' => $bagCodes]);
|
||||
}
|
||||
|
||||
public function store()
|
||||
@@ -96,13 +74,12 @@ class BagPrice extends BaseController
|
||||
return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
|
||||
}
|
||||
|
||||
// 봉투명 스냅샷
|
||||
$bagCode = $this->request->getPost('bp_bag_code');
|
||||
$kindModel = model(CodeKindModel::class);
|
||||
$kind = $kindModel->where('ck_code', 'O')->first();
|
||||
$bagName = '';
|
||||
if ($kind) {
|
||||
$detail = model(CodeDetailModel::class)->where('cd_ck_idx', $kind->ck_idx)->where('cd_code', $bagCode)->first();
|
||||
$detail = model(CodeDetailModel::class)->findResolvedByKindAndCode((int) $kind->ck_idx, (string) $bagCode, $lgIdx);
|
||||
$bagName = $detail ? $detail->cd_name : '';
|
||||
}
|
||||
|
||||
@@ -120,28 +97,26 @@ class BagPrice extends BaseController
|
||||
'bp_reg_mb_idx' => session()->get('mb_idx'),
|
||||
]);
|
||||
|
||||
return redirect()->to(site_url('admin/bag-prices'))->with('success', '봉투 단가가 등록되었습니다.');
|
||||
return redirect()->to(mgmt_url('bag-prices'))->with('success', '봉투 단가가 등록되었습니다.');
|
||||
}
|
||||
|
||||
public function edit(int $id)
|
||||
{
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
$item = $this->priceModel->find($id);
|
||||
if (!$item || (int) $item->bp_lg_idx !== admin_effective_lg_idx()) {
|
||||
return redirect()->to(site_url('admin/bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.');
|
||||
if (! $item || (int) $item->bp_lg_idx !== $lgIdx) {
|
||||
return redirect()->to(mgmt_url('bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$kindModel = model(CodeKindModel::class);
|
||||
$kind = $kindModel->where('ck_code', 'O')->first();
|
||||
$bagCodes = [];
|
||||
if ($kind) {
|
||||
$bagCodes = model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true);
|
||||
$bagCodes = model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx);
|
||||
}
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '봉투 단가 수정',
|
||||
'content' => view('admin/bag_price/edit', ['item' => $item, 'bagCodes' => $bagCodes]),
|
||||
]);
|
||||
return $this->renderWorkPage('봉투 단가 수정', 'admin/bag_price/edit', ['item' => $item, 'bagCodes' => $bagCodes]);
|
||||
}
|
||||
|
||||
public function update(int $id)
|
||||
@@ -149,7 +124,7 @@ class BagPrice extends BaseController
|
||||
helper('admin');
|
||||
$item = $this->priceModel->find($id);
|
||||
if (! $item || (int) $item->bp_lg_idx !== admin_effective_lg_idx()) {
|
||||
return redirect()->to(site_url('admin/bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.');
|
||||
return redirect()->to(mgmt_url('bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$rules = [
|
||||
@@ -165,7 +140,6 @@ class BagPrice extends BaseController
|
||||
return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
|
||||
}
|
||||
|
||||
// 이력 기록
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
|
||||
@@ -197,7 +171,7 @@ class BagPrice extends BaseController
|
||||
|
||||
$db->transComplete();
|
||||
|
||||
return redirect()->to(site_url('admin/bag-prices'))->with('success', '봉투 단가가 수정되었습니다.');
|
||||
return redirect()->to(mgmt_url('bag-prices'))->with('success', '봉투 단가가 수정되었습니다.');
|
||||
}
|
||||
|
||||
public function delete(int $id)
|
||||
@@ -205,11 +179,12 @@ class BagPrice extends BaseController
|
||||
helper('admin');
|
||||
$item = $this->priceModel->find($id);
|
||||
if (! $item || (int) $item->bp_lg_idx !== admin_effective_lg_idx()) {
|
||||
return redirect()->to(site_url('admin/bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.');
|
||||
return redirect()->to(mgmt_url('bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$this->priceModel->delete($id);
|
||||
return redirect()->to(site_url('admin/bag-prices'))->with('success', '봉투 단가가 삭제되었습니다.');
|
||||
|
||||
return redirect()->to(mgmt_url('bag-prices'))->with('success', '봉투 단가가 삭제되었습니다.');
|
||||
}
|
||||
|
||||
public function history(int $bpIdx)
|
||||
@@ -217,14 +192,11 @@ class BagPrice extends BaseController
|
||||
helper('admin');
|
||||
$item = $this->priceModel->find($bpIdx);
|
||||
if (! $item || (int) $item->bp_lg_idx !== admin_effective_lg_idx()) {
|
||||
return redirect()->to(site_url('admin/bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.');
|
||||
return redirect()->to(mgmt_url('bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$list = $this->historyModel->where('bph_bp_idx', $bpIdx)->orderBy('bph_changed_at', 'DESC')->findAll();
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '단가 변경 이력 — ' . $item->bp_bag_name,
|
||||
'content' => view('admin/bag_price/history', ['item' => $item, 'list' => $list]),
|
||||
]);
|
||||
return $this->renderWorkPage('단가 변경 이력 — ' . $item->bp_bag_name, 'admin/bag_price/history', ['item' => $item, 'list' => $list]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,36 +22,37 @@ class BagReceiving 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', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$builder = $this->recvModel->where('br_lg_idx', $lgIdx);
|
||||
$startDate = $this->request->getGet('start_date');
|
||||
$endDate = $this->request->getGet('end_date');
|
||||
if ($startDate) $builder->where('br_receive_date >=', $startDate);
|
||||
if ($endDate) $builder->where('br_receive_date <=', $endDate);
|
||||
if ($startDate) {
|
||||
$builder->where('br_receive_date >=', $startDate);
|
||||
}
|
||||
if ($endDate) {
|
||||
$builder->where('br_receive_date <=', $endDate);
|
||||
}
|
||||
|
||||
$list = $builder->orderBy('br_receive_date', 'DESC')->orderBy('br_idx', 'DESC')->paginate(20);
|
||||
$pager = $this->recvModel->pager;
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '입고 현황',
|
||||
'content' => view('admin/bag_receiving/index', compact('list', 'startDate', 'endDate', 'pager')),
|
||||
]);
|
||||
return $this->renderWorkPage('입고 현황', 'admin/bag_receiving/index', compact('list', 'startDate', 'endDate', 'pager'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if (!$lgIdx) return redirect()->to(site_url('admin/bag-receivings'))->with('error', '지자체를 선택해 주세요.');
|
||||
if (! $lgIdx) {
|
||||
return redirect()->to(mgmt_url('bag-receivings'))->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
// 미입고 발주 목록
|
||||
$orders = model(BagOrderModel::class)->where('bo_lg_idx', $lgIdx)->where('bo_status', 'normal')->orderBy('bo_order_date', 'DESC')->findAll();
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '입고 처리',
|
||||
'content' => view('admin/bag_receiving/create', compact('orders')),
|
||||
]);
|
||||
return $this->renderWorkPage('입고 처리', 'admin/bag_receiving/create', compact('orders'));
|
||||
}
|
||||
|
||||
public function store()
|
||||
@@ -73,14 +74,12 @@ class BagReceiving extends BaseController
|
||||
$bagCode = $this->request->getPost('br_bag_code');
|
||||
$qtyBox = (int) $this->request->getPost('br_qty_box');
|
||||
|
||||
// 포장단위로 낱장 환산
|
||||
$unit = model(\App\Models\PackagingUnitModel::class)->where('pu_lg_idx', $lgIdx)->where('pu_bag_code', $bagCode)->where('pu_state', 1)->first();
|
||||
$totalPerBox = $unit ? (int) $unit->pu_total_per_box : 1;
|
||||
$qtySheet = $qtyBox * $totalPerBox;
|
||||
|
||||
// 봉투명
|
||||
$kindO = model(\App\Models\CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$detail = $kindO ? model(\App\Models\CodeDetailModel::class)->where('cd_ck_idx', $kindO->ck_idx)->where('cd_code', $bagCode)->first() : null;
|
||||
$detail = $kindO ? model(\App\Models\CodeDetailModel::class)->findResolvedByKindAndCode((int) $kindO->ck_idx, (string) $bagCode, $lgIdx) : null;
|
||||
$bagName = $detail ? $detail->cd_name : '';
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
@@ -100,11 +99,10 @@ class BagReceiving extends BaseController
|
||||
'br_regdate' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
|
||||
// 재고 가산
|
||||
model(BagInventoryModel::class)->adjustQty($lgIdx, $bagCode, $bagName, $qtySheet);
|
||||
|
||||
$db->transComplete();
|
||||
|
||||
return redirect()->to(site_url('admin/bag-receivings'))->with('success', '입고 처리되었습니다. (' . $bagName . ' ' . $qtyBox . '박스)');
|
||||
return redirect()->to(mgmt_url('bag-receivings'))->with('success', '입고 처리되었습니다. (' . $bagName . ' ' . $qtyBox . '박스)');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,23 +23,28 @@ class BagSale 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', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$builder = $this->saleModel->where('bs_lg_idx', $lgIdx);
|
||||
$startDate = $this->request->getGet('start_date');
|
||||
$endDate = $this->request->getGet('end_date');
|
||||
$type = $this->request->getGet('type');
|
||||
if ($startDate) $builder->where('bs_sale_date >=', $startDate);
|
||||
if ($endDate) $builder->where('bs_sale_date <=', $endDate);
|
||||
if ($type) $builder->where('bs_type', $type);
|
||||
if ($startDate) {
|
||||
$builder->where('bs_sale_date >=', $startDate);
|
||||
}
|
||||
if ($endDate) {
|
||||
$builder->where('bs_sale_date <=', $endDate);
|
||||
}
|
||||
if ($type) {
|
||||
$builder->where('bs_type', $type);
|
||||
}
|
||||
|
||||
$list = $builder->orderBy('bs_sale_date', 'DESC')->orderBy('bs_idx', 'DESC')->paginate(20);
|
||||
$pager = $this->saleModel->pager;
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '판매/반품 관리',
|
||||
'content' => view('admin/bag_sale/index', compact('list', 'startDate', 'endDate', 'type', 'pager')),
|
||||
]);
|
||||
return $this->renderWorkPage('판매/반품 관리', 'admin/bag_sale/index', compact('list', 'startDate', 'endDate', 'type', 'pager'));
|
||||
}
|
||||
|
||||
public function export()
|
||||
@@ -47,16 +52,22 @@ class BagSale extends BaseController
|
||||
helper(['admin', 'export']);
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if (! $lgIdx) {
|
||||
return redirect()->to(site_url('admin/bag-sales'))->with('error', '지자체를 선택해 주세요.');
|
||||
return redirect()->to(mgmt_url('bag-sales'))->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$builder = $this->saleModel->where('bs_lg_idx', $lgIdx);
|
||||
$startDate = $this->request->getGet('start_date');
|
||||
$endDate = $this->request->getGet('end_date');
|
||||
$type = $this->request->getGet('type');
|
||||
if ($startDate) $builder->where('bs_sale_date >=', $startDate);
|
||||
if ($endDate) $builder->where('bs_sale_date <=', $endDate);
|
||||
if ($type) $builder->where('bs_type', $type);
|
||||
if ($startDate) {
|
||||
$builder->where('bs_sale_date >=', $startDate);
|
||||
}
|
||||
if ($endDate) {
|
||||
$builder->where('bs_sale_date <=', $endDate);
|
||||
}
|
||||
if ($type) {
|
||||
$builder->where('bs_type', $type);
|
||||
}
|
||||
|
||||
$list = $builder->orderBy('bs_sale_date', 'DESC')->orderBy('bs_idx', 'DESC')->findAll();
|
||||
|
||||
@@ -87,16 +98,15 @@ class BagSale extends BaseController
|
||||
{
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if (!$lgIdx) return redirect()->to(site_url('admin/bag-sales'))->with('error', '지자체를 선택해 주세요.');
|
||||
if (! $lgIdx) {
|
||||
return redirect()->to(mgmt_url('bag-sales'))->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$shops = model(DesignatedShopModel::class)->where('ds_lg_idx', $lgIdx)->where('ds_state', 1)->findAll();
|
||||
$kind = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true) : [];
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx) : [];
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '판매 등록',
|
||||
'content' => view('admin/bag_sale/create', compact('shops', 'bagCodes')),
|
||||
]);
|
||||
return $this->renderWorkPage('판매 등록', 'admin/bag_sale/create', compact('shops', 'bagCodes'));
|
||||
}
|
||||
|
||||
public function store()
|
||||
@@ -122,7 +132,7 @@ class BagSale extends BaseController
|
||||
|
||||
$shop = model(DesignatedShopModel::class)->find($dsIdx);
|
||||
$kindO = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$detail = $kindO ? model(CodeDetailModel::class)->where('cd_ck_idx', $kindO->ck_idx)->where('cd_code', $bagCode)->first() : null;
|
||||
$detail = $kindO ? model(CodeDetailModel::class)->findResolvedByKindAndCode((int) $kindO->ck_idx, (string) $bagCode, $lgIdx) : null;
|
||||
$price = model(BagPriceModel::class)->where('bp_lg_idx', $lgIdx)->where('bp_bag_code', $bagCode)->where('bp_state', 1)->first();
|
||||
$unitPrice = $price ? (float) $price->bp_consumer : 0;
|
||||
|
||||
@@ -147,16 +157,15 @@ class BagSale extends BaseController
|
||||
$this->saleModel->insert($saleData);
|
||||
$bsIdx = (int) $this->saleModel->getInsertID();
|
||||
|
||||
// CT-05: 감사 로그
|
||||
helper('audit');
|
||||
audit_log('create', 'bag_sale', $bsIdx, null, array_merge($saleData, ['bs_idx' => $bsIdx]));
|
||||
|
||||
// 재고 감산(판매) / 가산(반품)
|
||||
model(BagInventoryModel::class)->adjustQty($lgIdx, $bagCode, $detail ? $detail->cd_name : '', -$actualQty);
|
||||
|
||||
$db->transComplete();
|
||||
|
||||
$msg = ($type === 'sale') ? '판매 처리되었습니다.' : '반품 처리되었습니다.';
|
||||
return redirect()->to(site_url('admin/bag-sales'))->with('success', $msg);
|
||||
|
||||
return redirect()->to(mgmt_url('bag-sales'))->with('success', $msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\CodeKindModel;
|
||||
use App\Models\CodeDetailModel;
|
||||
use App\Models\LocalGovernmentModel;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use Config\Roles;
|
||||
|
||||
class CodeDetail extends BaseController
|
||||
{
|
||||
@@ -17,41 +22,57 @@ class CodeDetail extends BaseController
|
||||
$this->detailModel = model(CodeDetailModel::class);
|
||||
}
|
||||
|
||||
public function index(int $ckIdx)
|
||||
private function redirectIfCannotManageCodeMaster(): ?RedirectResponse
|
||||
{
|
||||
$kind = $this->kindModel->find($ckIdx);
|
||||
if ($kind === null) {
|
||||
return redirect()->to(site_url('admin/code-kinds'))->with('error', '코드 종류를 찾을 수 없습니다.');
|
||||
if (! Roles::canManageCodeMaster((int) session()->get('mb_level'))) {
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('error', '코드 관리 권한이 없습니다.');
|
||||
}
|
||||
|
||||
$list = $this->detailModel->where('cd_ck_idx', $ckIdx)->orderBy('cd_sort', 'ASC')->paginate(20);
|
||||
$pager = $this->detailModel->pager;
|
||||
return null;
|
||||
}
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '세부코드 관리 — ' . $kind->ck_name . ' (' . $kind->ck_code . ')',
|
||||
'content' => view('admin/code_detail/index', [
|
||||
'kind' => $kind,
|
||||
'list' => $list,
|
||||
'pager' => $pager,
|
||||
]),
|
||||
]);
|
||||
/** @deprecated 사이트 URL 유지용 — 세부 목록은 /bag/code-details/{ck_idx} */
|
||||
public function index(int $ckIdx): RedirectResponse
|
||||
{
|
||||
return redirect()->to(site_url('bag/code-details/' . $ckIdx));
|
||||
}
|
||||
|
||||
public function create(int $ckIdx)
|
||||
{
|
||||
if ($r = $this->redirectIfCannotManageCodeMaster()) {
|
||||
return $r;
|
||||
}
|
||||
|
||||
$kind = $this->kindModel->find($ckIdx);
|
||||
if ($kind === null) {
|
||||
return redirect()->to(site_url('admin/code-kinds'))->with('error', '코드 종류를 찾을 수 없습니다.');
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('error', '코드 종류를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$level = (int) session()->get('mb_level');
|
||||
$canPlatformScope = Roles::isSuperAdminEquivalent($level);
|
||||
$govs = $canPlatformScope
|
||||
? model(LocalGovernmentModel::class)->where('lg_state', 1)->orderBy('lg_name', 'ASC')->findAll()
|
||||
: [];
|
||||
|
||||
helper('admin');
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '세부코드 등록 — ' . $kind->ck_name,
|
||||
'content' => view('admin/code_detail/create', ['kind' => $kind]),
|
||||
'content' => view('admin/code_detail/create', [
|
||||
'kind' => $kind,
|
||||
'canPlatformScope' => $canPlatformScope,
|
||||
'localGovernments' => $govs,
|
||||
'effectiveLgIdx' => admin_effective_lg_idx(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
if ($r = $this->redirectIfCannotManageCodeMaster()) {
|
||||
return $r;
|
||||
}
|
||||
|
||||
$rules = [
|
||||
'cd_ck_idx' => 'required|is_natural_no_zero',
|
||||
'cd_code' => 'required|max_length[50]',
|
||||
@@ -64,24 +85,73 @@ class CodeDetail extends BaseController
|
||||
}
|
||||
|
||||
$ckIdx = (int) $this->request->getPost('cd_ck_idx');
|
||||
$kind = $this->kindModel->find($ckIdx);
|
||||
if ($kind === null) {
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('error', '코드 종류를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
helper('admin');
|
||||
$level = (int) session()->get('mb_level');
|
||||
|
||||
if (Roles::isSuperAdminEquivalent($level)) {
|
||||
$scope = $this->request->getPost('cd_scope') === 'local' ? 'local' : 'platform';
|
||||
if ($scope === 'platform') {
|
||||
$cdSource = 'platform';
|
||||
$cdLgIdx = 0;
|
||||
} else {
|
||||
$cdLgIdx = (int) $this->request->getPost('cd_lg_idx');
|
||||
if ($cdLgIdx < 1) {
|
||||
return redirect()->back()->withInput()->with('error', '지자체 전용인 경우 소속 지자체를 선택해 주세요.');
|
||||
}
|
||||
$gov = model(LocalGovernmentModel::class)->find($cdLgIdx);
|
||||
if ($gov === null) {
|
||||
return redirect()->back()->withInput()->with('error', '유효하지 않은 지자체입니다.');
|
||||
}
|
||||
$cdSource = 'local';
|
||||
}
|
||||
} else {
|
||||
$lg = admin_effective_lg_idx();
|
||||
if ($lg === null || (int) $lg < 1) {
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('error', '지자체를 선택한 뒤 등록해 주세요.');
|
||||
}
|
||||
$cdSource = 'local';
|
||||
$cdLgIdx = (int) $lg;
|
||||
}
|
||||
|
||||
$cdCode = (string) $this->request->getPost('cd_code');
|
||||
$dup = $this->detailModel->where('cd_ck_idx', $ckIdx)->where('cd_code', $cdCode)->where('cd_lg_idx', $cdLgIdx)->first();
|
||||
if ($dup !== null) {
|
||||
return redirect()->back()->withInput()->with('error', '같은 종류·코드값·소속 범위에 이미 등록된 행이 있습니다.');
|
||||
}
|
||||
|
||||
$this->detailModel->insert([
|
||||
'cd_ck_idx' => $ckIdx,
|
||||
'cd_code' => $this->request->getPost('cd_code'),
|
||||
'cd_source' => $cdSource,
|
||||
'cd_lg_idx' => $cdLgIdx,
|
||||
'cd_code' => $cdCode,
|
||||
'cd_name' => $this->request->getPost('cd_name'),
|
||||
'cd_sort' => (int) ($this->request->getPost('cd_sort') ?: 0),
|
||||
'cd_state' => 1,
|
||||
'cd_regdate' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
|
||||
return redirect()->to(site_url('admin/code-details/' . $ckIdx))->with('success', '세부코드가 등록되었습니다.');
|
||||
return redirect()->to(site_url('bag/code-details/' . $ckIdx))->with('success', '세부코드가 등록되었습니다.');
|
||||
}
|
||||
|
||||
public function edit(int $id)
|
||||
{
|
||||
if ($r = $this->redirectIfCannotManageCodeMaster()) {
|
||||
return $r;
|
||||
}
|
||||
|
||||
$item = $this->detailModel->find($id);
|
||||
if ($item === null) {
|
||||
return redirect()->to(site_url('admin/code-kinds'))->with('error', '세부코드를 찾을 수 없습니다.');
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('error', '세부코드를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
helper('admin');
|
||||
if (! Roles::canEditCodeDetailRow((int) session()->get('mb_level'), $item, admin_effective_lg_idx())) {
|
||||
return redirect()->to(site_url('bag/code-details/' . $item->cd_ck_idx))->with('error', '이 세부코드를 수정할 권한이 없습니다.');
|
||||
}
|
||||
|
||||
$kind = $this->kindModel->find($item->cd_ck_idx);
|
||||
@@ -97,9 +167,18 @@ class CodeDetail extends BaseController
|
||||
|
||||
public function update(int $id)
|
||||
{
|
||||
if ($r = $this->redirectIfCannotManageCodeMaster()) {
|
||||
return $r;
|
||||
}
|
||||
|
||||
$item = $this->detailModel->find($id);
|
||||
if ($item === null) {
|
||||
return redirect()->to(site_url('admin/code-kinds'))->with('error', '세부코드를 찾을 수 없습니다.');
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('error', '세부코드를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
helper('admin');
|
||||
if (! Roles::canEditCodeDetailRow((int) session()->get('mb_level'), $item, admin_effective_lg_idx())) {
|
||||
return redirect()->to(site_url('bag/code-details/' . $item->cd_ck_idx))->with('error', '이 세부코드를 수정할 권한이 없습니다.');
|
||||
}
|
||||
|
||||
$rules = [
|
||||
@@ -118,19 +197,28 @@ class CodeDetail extends BaseController
|
||||
'cd_state' => (int) $this->request->getPost('cd_state'),
|
||||
]);
|
||||
|
||||
return redirect()->to(site_url('admin/code-details/' . $item->cd_ck_idx))->with('success', '세부코드가 수정되었습니다.');
|
||||
return redirect()->to(site_url('bag/code-details/' . $item->cd_ck_idx))->with('success', '세부코드가 수정되었습니다.');
|
||||
}
|
||||
|
||||
public function delete(int $id)
|
||||
{
|
||||
if ($r = $this->redirectIfCannotManageCodeMaster()) {
|
||||
return $r;
|
||||
}
|
||||
|
||||
$item = $this->detailModel->find($id);
|
||||
if ($item === null) {
|
||||
return redirect()->to(site_url('admin/code-kinds'))->with('error', '세부코드를 찾을 수 없습니다.');
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('error', '세부코드를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
helper('admin');
|
||||
if (! Roles::canEditCodeDetailRow((int) session()->get('mb_level'), $item, admin_effective_lg_idx())) {
|
||||
return redirect()->to(site_url('bag/code-details/' . $item->cd_ck_idx))->with('error', '이 세부코드를 삭제할 권한이 없습니다.');
|
||||
}
|
||||
|
||||
$ckIdx = $item->cd_ck_idx;
|
||||
$this->detailModel->delete($id);
|
||||
|
||||
return redirect()->to(site_url('admin/code-details/' . $ckIdx))->with('success', '세부코드가 삭제되었습니다.');
|
||||
return redirect()->to(site_url('bag/code-details/' . $ckIdx))->with('success', '세부코드가 삭제되었습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\CodeKindModel;
|
||||
use App\Models\CodeDetailModel;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use Config\Roles;
|
||||
|
||||
class CodeKind extends BaseController
|
||||
@@ -16,30 +19,21 @@ class CodeKind extends BaseController
|
||||
$this->kindModel = model(CodeKindModel::class);
|
||||
}
|
||||
|
||||
public function index()
|
||||
private function redirectIfCannotManageCodeKindMaster(): ?RedirectResponse
|
||||
{
|
||||
$list = $this->kindModel->orderBy('ck_code', 'ASC')->paginate(20);
|
||||
$pager = $this->kindModel->pager;
|
||||
|
||||
// 세부코드 수 매핑
|
||||
$detailModel = model(CodeDetailModel::class);
|
||||
$countMap = [];
|
||||
foreach ($list as $row) {
|
||||
$countMap[$row->ck_idx] = $detailModel->where('cd_ck_idx', $row->ck_idx)->countAllResults(false);
|
||||
if (! Roles::canManageCodeKindMaster((int) session()->get('mb_level'))) {
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('error', '코드 종류는 super admin·본부 관리자만 관리할 수 있습니다.');
|
||||
}
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '기본코드 종류 관리',
|
||||
'content' => view('admin/code_kind/index', [
|
||||
'list' => $list,
|
||||
'countMap' => $countMap,
|
||||
'pager' => $pager,
|
||||
]),
|
||||
]);
|
||||
return null;
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
if ($r = $this->redirectIfCannotManageCodeKindMaster()) {
|
||||
return $r;
|
||||
}
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '기본코드 종류 등록',
|
||||
'content' => view('admin/code_kind/create'),
|
||||
@@ -48,6 +42,10 @@ class CodeKind extends BaseController
|
||||
|
||||
public function store()
|
||||
{
|
||||
if ($r = $this->redirectIfCannotManageCodeKindMaster()) {
|
||||
return $r;
|
||||
}
|
||||
|
||||
$rules = [
|
||||
'ck_code' => 'required|max_length[20]|is_unique[code_kind.ck_code]',
|
||||
'ck_name' => 'required|max_length[100]',
|
||||
@@ -64,14 +62,18 @@ class CodeKind extends BaseController
|
||||
'ck_regdate' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
|
||||
return redirect()->to(site_url('admin/code-kinds'))->with('success', '코드 종류가 등록되었습니다.');
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('success', '코드 종류가 등록되었습니다.');
|
||||
}
|
||||
|
||||
public function edit(int $id)
|
||||
{
|
||||
if ($r = $this->redirectIfCannotManageCodeKindMaster()) {
|
||||
return $r;
|
||||
}
|
||||
|
||||
$item = $this->kindModel->find($id);
|
||||
if ($item === null) {
|
||||
return redirect()->to(site_url('admin/code-kinds'))->with('error', '코드 종류를 찾을 수 없습니다.');
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('error', '코드 종류를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
return view('admin/layout', [
|
||||
@@ -82,9 +84,13 @@ class CodeKind extends BaseController
|
||||
|
||||
public function update(int $id)
|
||||
{
|
||||
if ($r = $this->redirectIfCannotManageCodeKindMaster()) {
|
||||
return $r;
|
||||
}
|
||||
|
||||
$item = $this->kindModel->find($id);
|
||||
if ($item === null) {
|
||||
return redirect()->to(site_url('admin/code-kinds'))->with('error', '코드 종류를 찾을 수 없습니다.');
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('error', '코드 종류를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$rules = [
|
||||
@@ -101,24 +107,28 @@ class CodeKind extends BaseController
|
||||
'ck_state' => (int) $this->request->getPost('ck_state'),
|
||||
]);
|
||||
|
||||
return redirect()->to(site_url('admin/code-kinds'))->with('success', '코드 종류가 수정되었습니다.');
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('success', '코드 종류가 수정되었습니다.');
|
||||
}
|
||||
|
||||
public function delete(int $id)
|
||||
{
|
||||
$item = $this->kindModel->find($id);
|
||||
if ($item === null) {
|
||||
return redirect()->to(site_url('admin/code-kinds'))->with('error', '코드 종류를 찾을 수 없습니다.');
|
||||
if ($r = $this->redirectIfCannotManageCodeKindMaster()) {
|
||||
return $r;
|
||||
}
|
||||
|
||||
$item = $this->kindModel->find($id);
|
||||
if ($item === null) {
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('error', '코드 종류를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
// 세부코드가 있으면 삭제 불가
|
||||
$detailCount = model(CodeDetailModel::class)->where('cd_ck_idx', $id)->countAllResults();
|
||||
if ($detailCount > 0) {
|
||||
return redirect()->to(site_url('admin/code-kinds'))
|
||||
return redirect()->to(site_url('bag/code-kinds'))
|
||||
->with('error', '세부코드가 ' . $detailCount . '개 존재하여 삭제할 수 없습니다. 먼저 세부코드를 삭제해 주세요.');
|
||||
}
|
||||
|
||||
$this->kindModel->delete($id);
|
||||
return redirect()->to(site_url('admin/code-kinds'))->with('success', '코드 종류가 삭제되었습니다.');
|
||||
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('success', '코드 종류가 삭제되었습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,59 +22,10 @@ class Company extends BaseController
|
||||
return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
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 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);
|
||||
$list = $this->model->where('cp_lg_idx', $lgIdx)->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,
|
||||
]);
|
||||
return $this->renderWorkPage('업체 관리', 'admin/company/index', ['list' => $list, 'pager' => $pager]);
|
||||
}
|
||||
|
||||
public function create()
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use CodeIgniter\Database\Exceptions\DatabaseException;
|
||||
|
||||
class Dashboard extends BaseController
|
||||
{
|
||||
@@ -22,11 +23,13 @@ class Dashboard extends BaseController
|
||||
'issue_count_month'=> 0,
|
||||
'recent_orders' => [],
|
||||
'recent_sales' => [],
|
||||
'stats_unavailable'=> false,
|
||||
];
|
||||
|
||||
if ($lgIdx) {
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
try {
|
||||
// 총 발주 건수/금액
|
||||
$orderStats = $db->query("
|
||||
SELECT COUNT(*) as cnt,
|
||||
@@ -81,6 +84,10 @@ class Dashboard extends BaseController
|
||||
ORDER BY bs_sale_date DESC, bs_idx DESC
|
||||
LIMIT 5
|
||||
", [$lgIdx])->getResult();
|
||||
} catch (DatabaseException $e) {
|
||||
$stats['stats_unavailable'] = true;
|
||||
log_message('error', '[Dashboard] 통계 조회 실패(테이블 미생성 등): ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return view('admin/layout', [
|
||||
|
||||
@@ -39,7 +39,7 @@ class DesignatedShop extends BaseController
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
|
||||
if ($lgIdx === null || $lgIdx <= 0) {
|
||||
return redirect()->to(site_url('admin'))
|
||||
return redirect()->to(work_area_home_url())
|
||||
->with('error', '작업할 지자체가 선택되지 않았습니다. 지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
@@ -73,9 +73,7 @@ class DesignatedShop extends BaseController
|
||||
$db = \Config\Database::connect();
|
||||
$gugunCodes = $db->query("SELECT DISTINCT ds_gugun_code FROM designated_shop WHERE ds_lg_idx = ? AND ds_gugun_code != '' ORDER BY ds_gugun_code", [$lgIdx])->getResult();
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '지정판매소 관리',
|
||||
'content' => view('admin/designated_shop/index', [
|
||||
return $this->renderWorkPage('지정판매소 관리', 'admin/designated_shop/index', [
|
||||
'list' => $list,
|
||||
'lgMap' => $lgMap,
|
||||
'pager' => $pager,
|
||||
@@ -83,16 +81,15 @@ class DesignatedShop extends BaseController
|
||||
'dsGugunCode' => $dsGugunCode ?? '',
|
||||
'dsState' => $dsState ?? '',
|
||||
'gugunCodes' => $gugunCodes,
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
helper(['admin', 'export', 'pii_mask']);
|
||||
helper(['admin', 'export']);
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if (!$lgIdx) {
|
||||
return redirect()->to(site_url('admin/designated-shops'))->with('error', '지자체를 선택해 주세요.');
|
||||
return redirect()->to(mgmt_url('designated-shops'))->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$list = $this->shopModel->where('ds_lg_idx', $lgIdx)->orderBy('ds_idx', 'DESC')->findAll();
|
||||
@@ -104,7 +101,7 @@ class DesignatedShop extends BaseController
|
||||
$row->ds_idx,
|
||||
$row->ds_shop_no,
|
||||
$row->ds_name,
|
||||
mask_person_name($row->ds_rep_name ?? null),
|
||||
$row->ds_rep_name,
|
||||
$row->ds_biz_no,
|
||||
$row->ds_va_number,
|
||||
$row->ds_tel ?? '',
|
||||
@@ -121,41 +118,6 @@ 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(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 지정판매소 등록 폼 (효과 지자체 기준)
|
||||
*/
|
||||
@@ -164,22 +126,19 @@ class DesignatedShop extends BaseController
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if ($lgIdx === null || $lgIdx <= 0) {
|
||||
return redirect()->to(site_url('admin/designated-shops'))
|
||||
return redirect()->to(mgmt_url('designated-shops'))
|
||||
->with('error', '작업할 지자체가 선택되지 않았습니다. 지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$currentLg = $this->lgModel->find($lgIdx);
|
||||
if ($currentLg === null) {
|
||||
return redirect()->to(site_url('admin/designated-shops'))
|
||||
return redirect()->to(mgmt_url('designated-shops'))
|
||||
->with('error', '선택한 지자체 정보를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '지정판매소 등록',
|
||||
'content' => view('admin/designated_shop/create', [
|
||||
return $this->renderWorkPage('지정판매소 등록', 'admin/designated_shop/create', [
|
||||
'localGovs' => [],
|
||||
'currentLg' => $currentLg,
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -189,7 +148,7 @@ class DesignatedShop extends BaseController
|
||||
public function store()
|
||||
{
|
||||
if (! $this->isSuperAdmin() && ! $this->isLocalAdmin()) {
|
||||
return redirect()->to(site_url('admin/designated-shops'))
|
||||
return redirect()->to(mgmt_url('designated-shops'))
|
||||
->with('error', '지정판매소 등록은 관리자만 가능합니다.');
|
||||
}
|
||||
|
||||
@@ -246,7 +205,7 @@ class DesignatedShop extends BaseController
|
||||
|
||||
$this->shopModel->insert($data);
|
||||
|
||||
return redirect()->to(site_url('admin/designated-shops'))
|
||||
return redirect()->to(mgmt_url('designated-shops'))
|
||||
->with('success', '지정판매소가 등록되었습니다.');
|
||||
}
|
||||
|
||||
@@ -257,31 +216,28 @@ class DesignatedShop extends BaseController
|
||||
public function edit(int $id)
|
||||
{
|
||||
if (! $this->isSuperAdmin() && ! $this->isLocalAdmin()) {
|
||||
return redirect()->to(site_url('admin/designated-shops'))
|
||||
return redirect()->to(mgmt_url('designated-shops'))
|
||||
->with('error', '권한이 없습니다.');
|
||||
}
|
||||
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if ($lgIdx === null || $lgIdx <= 0) {
|
||||
return redirect()->to(site_url('admin/designated-shops'))
|
||||
return redirect()->to(mgmt_url('designated-shops'))
|
||||
->with('error', '작업할 지자체가 선택되지 않았습니다.');
|
||||
}
|
||||
|
||||
$shop = $this->shopModel->find($id);
|
||||
if ($shop === null || (int) $shop->ds_lg_idx !== $lgIdx) {
|
||||
return redirect()->to(site_url('admin/designated-shops'))
|
||||
return redirect()->to(mgmt_url('designated-shops'))
|
||||
->with('error', '해당 지정판매소를 찾을 수 없거나 수정할 수 없습니다.');
|
||||
}
|
||||
|
||||
$currentLg = $this->lgModel->find($lgIdx);
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '지정판매소 수정',
|
||||
'content' => view('admin/designated_shop/edit', [
|
||||
return $this->renderWorkPage('지정판매소 수정', 'admin/designated_shop/edit', [
|
||||
'shop' => $shop,
|
||||
'currentLg' => $currentLg,
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -291,20 +247,20 @@ class DesignatedShop extends BaseController
|
||||
public function update(int $id)
|
||||
{
|
||||
if (! $this->isSuperAdmin() && ! $this->isLocalAdmin()) {
|
||||
return redirect()->to(site_url('admin/designated-shops'))
|
||||
return redirect()->to(mgmt_url('designated-shops'))
|
||||
->with('error', '권한이 없습니다.');
|
||||
}
|
||||
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if ($lgIdx === null || $lgIdx <= 0) {
|
||||
return redirect()->to(site_url('admin/designated-shops'))
|
||||
return redirect()->to(mgmt_url('designated-shops'))
|
||||
->with('error', '작업할 지자체가 선택되지 않았습니다.');
|
||||
}
|
||||
|
||||
$shop = $this->shopModel->find($id);
|
||||
if ($shop === null || (int) $shop->ds_lg_idx !== $lgIdx) {
|
||||
return redirect()->to(site_url('admin/designated-shops'))
|
||||
return redirect()->to(mgmt_url('designated-shops'))
|
||||
->with('error', '해당 지정판매소를 찾을 수 없거나 수정할 수 없습니다.');
|
||||
}
|
||||
|
||||
@@ -340,7 +296,7 @@ class DesignatedShop extends BaseController
|
||||
|
||||
$this->shopModel->update($id, $data);
|
||||
|
||||
return redirect()->to(site_url('admin/designated-shops'))
|
||||
return redirect()->to(mgmt_url('designated-shops'))
|
||||
->with('success', '지정판매소 정보가 수정되었습니다.');
|
||||
}
|
||||
|
||||
@@ -351,26 +307,26 @@ class DesignatedShop extends BaseController
|
||||
public function delete(int $id)
|
||||
{
|
||||
if (! $this->isSuperAdmin() && ! $this->isLocalAdmin()) {
|
||||
return redirect()->to(site_url('admin/designated-shops'))
|
||||
return redirect()->to(mgmt_url('designated-shops'))
|
||||
->with('error', '권한이 없습니다.');
|
||||
}
|
||||
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if ($lgIdx === null || $lgIdx <= 0) {
|
||||
return redirect()->to(site_url('admin/designated-shops'))
|
||||
return redirect()->to(mgmt_url('designated-shops'))
|
||||
->with('error', '작업할 지자체가 선택되지 않았습니다.');
|
||||
}
|
||||
|
||||
$shop = $this->shopModel->find($id);
|
||||
if ($shop === null || (int) $shop->ds_lg_idx !== $lgIdx) {
|
||||
return redirect()->to(site_url('admin/designated-shops'))
|
||||
return redirect()->to(mgmt_url('designated-shops'))
|
||||
->with('error', '해당 지정판매소를 찾을 수 없거나 삭제할 수 없습니다.');
|
||||
}
|
||||
|
||||
$this->shopModel->delete($id);
|
||||
|
||||
return redirect()->to(site_url('admin/designated-shops'))
|
||||
return redirect()->to(mgmt_url('designated-shops'))
|
||||
->with('success', '지정판매소가 삭제되었습니다.');
|
||||
}
|
||||
|
||||
@@ -382,7 +338,7 @@ class DesignatedShop extends BaseController
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if ($lgIdx === null || $lgIdx <= 0) {
|
||||
return redirect()->to(site_url('admin'))
|
||||
return redirect()->to(work_area_home_url())
|
||||
->with('error', '작업할 지자체가 선택되지 않았습니다.');
|
||||
}
|
||||
|
||||
@@ -391,11 +347,8 @@ class DesignatedShop extends BaseController
|
||||
->where('ds_state', 1)
|
||||
->findAll();
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '지정판매소 지도',
|
||||
'content' => view('admin/designated_shop/map', [
|
||||
return $this->renderWorkPage('지정판매소 지도', 'admin/designated_shop/map', [
|
||||
'shops' => $shops,
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -407,7 +360,7 @@ class DesignatedShop extends BaseController
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if ($lgIdx === null || $lgIdx <= 0) {
|
||||
return redirect()->to(site_url('admin'))
|
||||
return redirect()->to(work_area_home_url())
|
||||
->with('error', '작업할 지자체가 선택되지 않았습니다.');
|
||||
}
|
||||
|
||||
@@ -435,14 +388,11 @@ class DesignatedShop extends BaseController
|
||||
$totalActive = $this->shopModel->where('ds_lg_idx', $lgIdx)->where('ds_state', 1)->countAllResults(false);
|
||||
$totalInactive = $this->shopModel->where('ds_lg_idx', $lgIdx)->where('ds_state !=', 1)->countAllResults(false);
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '지정판매소 현황',
|
||||
'content' => view('admin/designated_shop/status', [
|
||||
return $this->renderWorkPage('지정판매소 현황', 'admin/designated_shop/status', [
|
||||
'newByYear' => $newByYear,
|
||||
'cancelByYear' => $cancelByYear,
|
||||
'totalActive' => $totalActive,
|
||||
'totalInactive' => $totalInactive,
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,101 +33,10 @@ class FreeRecipient extends BaseController
|
||||
return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
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 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);
|
||||
$list = $this->model->where('fr_lg_idx', $lgIdx)->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,
|
||||
]);
|
||||
return $this->renderWorkPage('무료용 대상자 관리', 'admin/free_recipient/index', ['list' => $list, 'pager' => $pager]);
|
||||
}
|
||||
|
||||
public function create()
|
||||
|
||||
@@ -35,87 +35,10 @@ class Manager extends BaseController
|
||||
return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
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 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);
|
||||
$list = $this->model->where('mg_lg_idx', $lgIdx)->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,
|
||||
]);
|
||||
return $this->renderWorkPage('담당자 관리', 'admin/manager/index', ['list' => $list, 'pager' => $pager]);
|
||||
}
|
||||
|
||||
public function create()
|
||||
|
||||
@@ -30,18 +30,34 @@ class Menu extends BaseController
|
||||
->with('error', '메뉴를 관리하려면 먼저 지자체를 선택하세요.');
|
||||
}
|
||||
$types = $this->typeModel->orderBy('mt_sort', 'ASC')->findAll();
|
||||
$mtIdx = (int) ($this->request->getGet('mt_idx') ?? 0);
|
||||
if ($mtIdx <= 0 && ! empty($types)) {
|
||||
// 기본 선택: 사이트 메뉴(mt_code=site), 없으면 첫 번째 타입
|
||||
$siteType = $this->typeModel->where('mt_code', 'site')->first();
|
||||
$mtIdx = $siteType ? (int) $siteType->mt_idx : (int) $types[0]->mt_idx;
|
||||
}
|
||||
$list = $mtIdx > 0 ? $this->menuModel->getAllByType($mtIdx, $lgIdx) : [];
|
||||
$requestedMtIdx = (int) ($this->request->getGet('mt_idx') ?? 0);
|
||||
$mtIdx = $this->resolveMtIdx($requestedMtIdx, $types);
|
||||
$effectiveMtIdx = $mtIdx;
|
||||
$debugMode = $this->request->getGet('debug') === '1';
|
||||
$fallbackApplied = false;
|
||||
$list = $effectiveMtIdx > 0 ? $this->menuModel->getAllByType($effectiveMtIdx, $lgIdx) : [];
|
||||
$currentType = $mtIdx > 0 ? $this->typeModel->find($mtIdx) : null;
|
||||
$currentTypeCode = (string) ($currentType->mt_code ?? '');
|
||||
|
||||
// 현재 지자체에 메뉴가 없으면, mt_idx별로 기본 지자체(lg_idx=1)의 메뉴를 한 번 복사한다.
|
||||
if ($mtIdx > 0 && empty($list)) {
|
||||
$this->menuModel->copyDefaultsFromLg($mtIdx, 1, $lgIdx);
|
||||
$list = $this->menuModel->getAllByType($mtIdx, $lgIdx);
|
||||
if ($effectiveMtIdx > 0 && empty($list)) {
|
||||
$this->menuModel->copyDefaultsFromLg($effectiveMtIdx, 1, $lgIdx);
|
||||
$list = $this->menuModel->getAllByType($effectiveMtIdx, $lgIdx);
|
||||
}
|
||||
|
||||
// 운영 DB 불일치 대응: site 타입인데 mt_idx 매핑이 어긋난 경우(예: menu_type=2, menu는 4 사용)
|
||||
if (empty($list) && $currentTypeCode === 'site' && $effectiveMtIdx !== 4) {
|
||||
$fallbackMtIdx = 4;
|
||||
$fallbackList = $this->menuModel->getAllByType($fallbackMtIdx, $lgIdx);
|
||||
if (empty($fallbackList)) {
|
||||
$this->menuModel->copyDefaultsFromLg($fallbackMtIdx, 1, $lgIdx);
|
||||
$fallbackList = $this->menuModel->getAllByType($fallbackMtIdx, $lgIdx);
|
||||
}
|
||||
if (! empty($fallbackList)) {
|
||||
$effectiveMtIdx = $fallbackMtIdx;
|
||||
$list = $fallbackList;
|
||||
$fallbackApplied = true;
|
||||
}
|
||||
}
|
||||
|
||||
// 트리 순서대로 상위 메뉴 바로 아래에 하위 메뉴가 오도록 평탄화
|
||||
@@ -50,16 +66,24 @@ class Menu extends BaseController
|
||||
$list = flatten_menu_tree($tree);
|
||||
}
|
||||
|
||||
$currentType = $mtIdx > 0 ? $this->typeModel->find($mtIdx) : null;
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '메뉴 관리',
|
||||
'content' => view('admin/menu/index', [
|
||||
'types' => $types,
|
||||
'mtIdx' => $mtIdx,
|
||||
'mtCode' => $currentType->mt_code ?? '',
|
||||
'mtCode' => $currentTypeCode,
|
||||
'list' => $list,
|
||||
'levelNames' => config('Roles')->levelNames,
|
||||
'debug_mode' => $debugMode,
|
||||
'debug_info' => [
|
||||
'lg_idx' => $lgIdx,
|
||||
'requested_mt_idx' => $requestedMtIdx,
|
||||
'resolved_mt_idx' => $mtIdx,
|
||||
'effective_mt_idx' => $effectiveMtIdx,
|
||||
'resolved_mt_code' => $currentTypeCode,
|
||||
'list_count' => count($list),
|
||||
'fallback_applied' => $fallbackApplied ? 'Y' : 'N',
|
||||
],
|
||||
]),
|
||||
]);
|
||||
}
|
||||
@@ -73,7 +97,9 @@ class Menu extends BaseController
|
||||
if ($lgIdx === null) {
|
||||
return $this->response->setJSON(['status' => 0, 'msg' => '지자체를 선택하세요.']);
|
||||
}
|
||||
$mtIdx = (int) $this->request->getGet('mt_idx');
|
||||
$types = $this->typeModel->orderBy('mt_sort', 'ASC')->findAll();
|
||||
$requestedMtIdx = (int) $this->request->getGet('mt_idx');
|
||||
$mtIdx = $this->resolveMtIdx($requestedMtIdx, $types);
|
||||
if ($mtIdx <= 0) {
|
||||
return $this->response->setJSON(['status' => 0, 'msg' => 'mt_idx required']);
|
||||
}
|
||||
@@ -210,4 +236,34 @@ class Menu extends BaseController
|
||||
|
||||
return implode(',', array_values($levels));
|
||||
}
|
||||
|
||||
/**
|
||||
* 요청된 mt_idx를 현재 DB 상태에 맞게 보정.
|
||||
* - 유효한 mt_idx면 그대로 사용
|
||||
* - 레거시 site 값(2) 요청 시 site 타입의 실제 mt_idx로 치환
|
||||
* - 그 외 미지정/잘못된 값은 site 우선, 없으면 첫 타입으로 보정
|
||||
*
|
||||
* @param array<int,object> $types
|
||||
*/
|
||||
private function resolveMtIdx(int $requestedMtIdx, array $types): int
|
||||
{
|
||||
if (empty($types)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$validTypeIds = array_map(static fn ($t): int => (int) ($t->mt_idx ?? 0), $types);
|
||||
if ($requestedMtIdx > 0 && in_array($requestedMtIdx, $validTypeIds, true)) {
|
||||
return $requestedMtIdx;
|
||||
}
|
||||
|
||||
$siteType = $this->typeModel->where('mt_code', 'site')->first();
|
||||
if ($siteType !== null) {
|
||||
// 과거 링크(/admin/menus?mt_idx=2) 호환
|
||||
if ($requestedMtIdx === 2 || $requestedMtIdx <= 0 || ! in_array($requestedMtIdx, $validTypeIds, true)) {
|
||||
return (int) $siteType->mt_idx;
|
||||
}
|
||||
}
|
||||
|
||||
return (int) $types[0]->mt_idx;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class PackagingUnit extends BaseController
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if (! $lgIdx) {
|
||||
return redirect()->to(site_url('admin'))->with('error', '지자체를 선택해 주세요.');
|
||||
return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$builder = $this->unitModel->where('pu_lg_idx', $lgIdx);
|
||||
@@ -41,11 +41,8 @@ class PackagingUnit extends BaseController
|
||||
$list = $builder->orderBy('pu_bag_code', 'ASC')->orderBy('pu_start_date', 'DESC')->paginate(20);
|
||||
$pager = $this->unitModel->pager;
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '포장 단위 관리',
|
||||
'content' => view('admin/packaging_unit/index', [
|
||||
return $this->renderWorkPage('포장 단위 관리', 'admin/packaging_unit/index', [
|
||||
'list' => $list, 'startDate' => $startDate, 'endDate' => $endDate, 'pager' => $pager,
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -53,16 +50,14 @@ class PackagingUnit extends BaseController
|
||||
{
|
||||
helper('admin');
|
||||
if (! admin_effective_lg_idx()) {
|
||||
return redirect()->to(site_url('admin/packaging-units'))->with('error', '지자체를 선택해 주세요.');
|
||||
return redirect()->to(mgmt_url('packaging-units'))->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
$kind = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true) : [];
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx) : [];
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '포장 단위 등록',
|
||||
'content' => view('admin/packaging_unit/create', ['bagCodes' => $bagCodes]),
|
||||
]);
|
||||
return $this->renderWorkPage('포장 단위 등록', 'admin/packaging_unit/create', ['bagCodes' => $bagCodes]);
|
||||
}
|
||||
|
||||
public function store()
|
||||
@@ -86,7 +81,7 @@ class PackagingUnit extends BaseController
|
||||
$kind = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$bagName = '';
|
||||
if ($kind) {
|
||||
$detail = model(CodeDetailModel::class)->where('cd_ck_idx', $kind->ck_idx)->where('cd_code', $bagCode)->first();
|
||||
$detail = model(CodeDetailModel::class)->findResolvedByKindAndCode((int) $kind->ck_idx, (string) $bagCode, $lgIdx);
|
||||
$bagName = $detail ? $detail->cd_name : '';
|
||||
}
|
||||
|
||||
@@ -107,7 +102,7 @@ class PackagingUnit extends BaseController
|
||||
'pu_reg_mb_idx' => session()->get('mb_idx'),
|
||||
]);
|
||||
|
||||
return redirect()->to(site_url('admin/packaging-units'))->with('success', '포장 단위가 등록되었습니다.');
|
||||
return redirect()->to(mgmt_url('packaging-units'))->with('success', '포장 단위가 등록되었습니다.');
|
||||
}
|
||||
|
||||
public function edit(int $id)
|
||||
@@ -115,16 +110,14 @@ class PackagingUnit extends BaseController
|
||||
helper('admin');
|
||||
$item = $this->unitModel->find($id);
|
||||
if (! $item || (int) $item->pu_lg_idx !== admin_effective_lg_idx()) {
|
||||
return redirect()->to(site_url('admin/packaging-units'))->with('error', '포장 단위를 찾을 수 없습니다.');
|
||||
return redirect()->to(mgmt_url('packaging-units'))->with('error', '포장 단위를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
$kind = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true) : [];
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx) : [];
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '포장 단위 수정',
|
||||
'content' => view('admin/packaging_unit/edit', ['item' => $item, 'bagCodes' => $bagCodes]),
|
||||
]);
|
||||
return $this->renderWorkPage('포장 단위 수정', 'admin/packaging_unit/edit', ['item' => $item, 'bagCodes' => $bagCodes]);
|
||||
}
|
||||
|
||||
public function update(int $id)
|
||||
@@ -132,7 +125,7 @@ class PackagingUnit extends BaseController
|
||||
helper('admin');
|
||||
$item = $this->unitModel->find($id);
|
||||
if (! $item || (int) $item->pu_lg_idx !== admin_effective_lg_idx()) {
|
||||
return redirect()->to(site_url('admin/packaging-units'))->with('error', '포장 단위를 찾을 수 없습니다.');
|
||||
return redirect()->to(mgmt_url('packaging-units'))->with('error', '포장 단위를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$rules = [
|
||||
@@ -180,7 +173,8 @@ class PackagingUnit extends BaseController
|
||||
]);
|
||||
|
||||
$db->transComplete();
|
||||
return redirect()->to(site_url('admin/packaging-units'))->with('success', '포장 단위가 수정되었습니다.');
|
||||
|
||||
return redirect()->to(mgmt_url('packaging-units'))->with('success', '포장 단위가 수정되었습니다.');
|
||||
}
|
||||
|
||||
public function delete(int $id)
|
||||
@@ -188,11 +182,12 @@ class PackagingUnit extends BaseController
|
||||
helper('admin');
|
||||
$item = $this->unitModel->find($id);
|
||||
if (! $item || (int) $item->pu_lg_idx !== admin_effective_lg_idx()) {
|
||||
return redirect()->to(site_url('admin/packaging-units'))->with('error', '포장 단위를 찾을 수 없습니다.');
|
||||
return redirect()->to(mgmt_url('packaging-units'))->with('error', '포장 단위를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$this->unitModel->delete($id);
|
||||
return redirect()->to(site_url('admin/packaging-units'))->with('success', '포장 단위가 삭제되었습니다.');
|
||||
|
||||
return redirect()->to(mgmt_url('packaging-units'))->with('success', '포장 단위가 삭제되었습니다.');
|
||||
}
|
||||
|
||||
public function history(int $puIdx)
|
||||
@@ -200,14 +195,11 @@ class PackagingUnit extends BaseController
|
||||
helper('admin');
|
||||
$item = $this->unitModel->find($puIdx);
|
||||
if (! $item || (int) $item->pu_lg_idx !== admin_effective_lg_idx()) {
|
||||
return redirect()->to(site_url('admin/packaging-units'))->with('error', '포장 단위를 찾을 수 없습니다.');
|
||||
return redirect()->to(mgmt_url('packaging-units'))->with('error', '포장 단위를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$list = $this->historyModel->where('puh_pu_idx', $puIdx)->orderBy('puh_changed_at', 'DESC')->findAll();
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '포장 단위 변경 이력 — ' . $item->pu_bag_name,
|
||||
'content' => view('admin/packaging_unit/history', ['item' => $item, 'list' => $list]),
|
||||
]);
|
||||
return $this->renderWorkPage('포장 단위 변경 이력 — ' . $item->pu_bag_name, 'admin/packaging_unit/history', ['item' => $item, 'list' => $list]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,14 +9,14 @@ class PasswordChange extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('admin/layout', [
|
||||
'title' => '비밀번호 변경',
|
||||
'content' => view('admin/password_change/index'),
|
||||
]);
|
||||
helper('admin');
|
||||
|
||||
return $this->renderWorkPage('비밀번호 변경', 'admin/password_change/index');
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
helper('admin');
|
||||
$rules = [
|
||||
'current_password' => 'required',
|
||||
'new_password' => 'required|min_length[4]|max_length[255]',
|
||||
@@ -50,6 +50,6 @@ class PasswordChange extends BaseController
|
||||
'mb_passwd' => password_hash($this->request->getPost('new_password'), PASSWORD_DEFAULT),
|
||||
]);
|
||||
|
||||
return redirect()->to(site_url('admin/password-change'))->with('success', '비밀번호가 변경되었습니다.');
|
||||
return redirect()->to(mgmt_url('password-change'))->with('success', '비밀번호가 변경되었습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,37 +26,48 @@ class SalesAgency extends BaseController
|
||||
return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$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';
|
||||
}
|
||||
$saKind = trim((string) ($this->request->getGet('sa_kind') ?? ''));
|
||||
$saCode = trim((string) ($this->request->getGet('sa_code') ?? ''));
|
||||
$saName = trim((string) ($this->request->getGet('sa_name') ?? ''));
|
||||
$saIdx = trim((string) ($this->request->getGet('sa_idx') ?? ''));
|
||||
|
||||
$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);
|
||||
if ($saKind !== '') {
|
||||
$builder->like('sa_kind', $saKind);
|
||||
}
|
||||
} else {
|
||||
$builder->like($searchField, $searchQuery);
|
||||
if ($saCode !== '') {
|
||||
$builder->like('sa_code', $saCode);
|
||||
}
|
||||
if ($saName !== '') {
|
||||
$builder->like('sa_name', $saName);
|
||||
}
|
||||
if ($saIdx !== '' && ctype_digit($saIdx)) {
|
||||
$builder->where('sa_idx', (int) $saIdx);
|
||||
}
|
||||
|
||||
$list = $builder->orderBy('sa_idx', 'DESC')->paginate(20);
|
||||
$list = $builder->orderForDisplay()->paginate(20);
|
||||
$pager = $this->model->pager;
|
||||
// 전체 URL·쿼리를 setPath에 넣으면 Pager URI 경로가 깨져 404가 난다. 경로만 지정한다(필터는 현재 GET이 병합됨).
|
||||
$pager->setPath('bag/sales-agencies');
|
||||
|
||||
$queryForPager = [
|
||||
'sa_kind' => $saKind,
|
||||
'sa_code' => $saCode,
|
||||
'sa_name' => $saName,
|
||||
'sa_idx' => $saIdx,
|
||||
];
|
||||
$queryForPager = array_filter($queryForPager, static fn ($v) => $v !== null && $v !== '');
|
||||
$pagerPath = mgmt_url('sales-agencies');
|
||||
if ($queryForPager !== []) {
|
||||
$pagerPath .= '?' . http_build_query($queryForPager);
|
||||
}
|
||||
$pager->setPath($pagerPath);
|
||||
|
||||
return $this->renderWorkPage('판매 대행소 관리', 'admin/sales_agency/index', [
|
||||
'list' => $list,
|
||||
'pager' => $pager,
|
||||
'search_field' => $searchField,
|
||||
'search_query' => $searchQuery,
|
||||
'sa_kind' => $saKind,
|
||||
'sa_code' => $saCode,
|
||||
'sa_name' => $saName,
|
||||
'sa_idx' => $saIdx,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,9 @@ class SalesReport 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', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$startDate = $this->request->getGet('start_date') ?? date('Y-m-01');
|
||||
$endDate = $this->request->getGet('end_date') ?? date('Y-m-d');
|
||||
@@ -50,10 +52,7 @@ class SalesReport extends BaseController
|
||||
", [$lgIdx, $startDate, $endDate])->getResult();
|
||||
}
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '판매 대장',
|
||||
'content' => view('admin/sales_report/sales_ledger', compact('result', 'startDate', 'endDate', 'mode')),
|
||||
]);
|
||||
return $this->renderWorkPage('판매 대장', 'admin/sales_report/sales_ledger', compact('result', 'startDate', 'endDate', 'mode'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +62,9 @@ class SalesReport 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', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$date = $this->request->getGet('date') ?? date('Y-m-d');
|
||||
$db = \Config\Database::connect();
|
||||
@@ -91,10 +92,7 @@ class SalesReport extends BaseController
|
||||
ORDER BY bs_bag_code
|
||||
", [$lgIdx, $monthStart, $date])->getResult();
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '일계표',
|
||||
'content' => view('admin/sales_report/daily_summary', compact('daily', 'monthly', 'date')),
|
||||
]);
|
||||
return $this->renderWorkPage('일계표', 'admin/sales_report/daily_summary', compact('daily', 'monthly', 'date'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +102,9 @@ class SalesReport 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', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$startDate = $this->request->getGet('start_date') ?? date('Y-m-01');
|
||||
$endDate = $this->request->getGet('end_date') ?? date('Y-m-d');
|
||||
@@ -122,10 +122,7 @@ class SalesReport extends BaseController
|
||||
ORDER BY bs_bag_code
|
||||
", [$lgIdx, $startDate, $endDate])->getResult();
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '기간별 판매현황',
|
||||
'content' => view('admin/sales_report/period_sales', compact('result', 'startDate', 'endDate')),
|
||||
]);
|
||||
return $this->renderWorkPage('기간별 판매현황', 'admin/sales_report/period_sales', compact('result', 'startDate', 'endDate'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,7 +132,9 @@ class SalesReport 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', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$year = $this->request->getGet('year') ?? date('Y');
|
||||
$db = \Config\Database::connect();
|
||||
@@ -161,10 +160,7 @@ class SalesReport extends BaseController
|
||||
ORDER BY bs_bag_code
|
||||
", [$lgIdx, $year])->getResult();
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '년 판매 현황',
|
||||
'content' => view('admin/sales_report/yearly_sales', compact('result', 'year')),
|
||||
]);
|
||||
return $this->renderWorkPage('년 판매 현황', 'admin/sales_report/yearly_sales', compact('result', 'year'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,7 +170,9 @@ class SalesReport 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', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$startDate = $this->request->getGet('start_date') ?? date('Y-m-01');
|
||||
$endDate = $this->request->getGet('end_date') ?? date('Y-m-d');
|
||||
@@ -192,10 +190,7 @@ class SalesReport extends BaseController
|
||||
ORDER BY bs_ds_name
|
||||
", [$lgIdx, $startDate, $endDate])->getResult();
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '지정판매소별 판매현황',
|
||||
'content' => view('admin/sales_report/shop_sales', compact('result', 'startDate', 'endDate')),
|
||||
]);
|
||||
return $this->renderWorkPage('지정판매소별 판매현황', 'admin/sales_report/shop_sales', compact('result', 'startDate', 'endDate'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,7 +200,9 @@ class SalesReport extends BaseController
|
||||
{
|
||||
helper(['admin', 'export']);
|
||||
$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', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$startDate = $this->request->getGet('start_date') ?? date('Y-m-01');
|
||||
$endDate = $this->request->getGet('end_date') ?? date('Y-m-d');
|
||||
@@ -257,7 +254,9 @@ class SalesReport 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', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$startDate = $this->request->getGet('start_date') ?? date('Y-m-01');
|
||||
$endDate = $this->request->getGet('end_date') ?? date('Y-m-d');
|
||||
@@ -271,10 +270,7 @@ class SalesReport extends BaseController
|
||||
ORDER BY bs_sale_date DESC, bs_ds_name
|
||||
", [$lgIdx, $startDate, $endDate])->getResult();
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '반품/파기 현황',
|
||||
'content' => view('admin/sales_report/returns', compact('result', 'startDate', 'endDate')),
|
||||
]);
|
||||
return $this->renderWorkPage('반품/파기 현황', 'admin/sales_report/returns', compact('result', 'startDate', 'endDate'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -284,7 +280,9 @@ class SalesReport 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', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$lotNo = $this->request->getGet('lot_no') ?? '';
|
||||
$order = null;
|
||||
@@ -300,10 +298,7 @@ class SalesReport extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => 'LOT 수불 조회',
|
||||
'content' => view('admin/sales_report/lot_flow', compact('lotNo', 'order', 'items', 'receivings')),
|
||||
]);
|
||||
return $this->renderWorkPage('LOT 수불 조회', 'admin/sales_report/lot_flow', compact('lotNo', 'order', 'items', 'receivings'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -313,7 +308,9 @@ class SalesReport 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', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$startDate = $this->request->getGet('start_date') ?? date('Y-m-01');
|
||||
$endDate = $this->request->getGet('end_date') ?? date('Y-m-d');
|
||||
@@ -332,12 +329,9 @@ class SalesReport extends BaseController
|
||||
|
||||
// 봉투 코드 목록
|
||||
$kindO = model(\App\Models\CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$bagCodes = $kindO ? model(\App\Models\CodeDetailModel::class)->getByKind((int) $kindO->ck_idx, true) : [];
|
||||
$bagCodes = $kindO ? model(\App\Models\CodeDetailModel::class)->getByKind((int) $kindO->ck_idx, true, $lgIdx) : [];
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '기타 입출고',
|
||||
'content' => view('admin/sales_report/misc_flow', compact('result', 'startDate', 'endDate', 'bagCodes', 'tableExists')),
|
||||
]);
|
||||
return $this->renderWorkPage('기타 입출고', 'admin/sales_report/misc_flow', compact('result', 'startDate', 'endDate', 'bagCodes', 'tableExists'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -347,7 +341,7 @@ class SalesReport extends BaseController
|
||||
{
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if (!$lgIdx) return redirect()->to(site_url('admin/reports/misc-flow'))->with('error', '지자체를 선택해 주세요.');
|
||||
if (!$lgIdx) return redirect()->to(mgmt_url('reports/misc-flow'))->with('error', '지자체를 선택해 주세요.');
|
||||
|
||||
$rules = [
|
||||
'bmf_type' => 'required|in_list[in,out]',
|
||||
@@ -366,7 +360,7 @@ class SalesReport extends BaseController
|
||||
|
||||
// 봉투명 조회
|
||||
$kindO = model(\App\Models\CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$detail = $kindO ? model(\App\Models\CodeDetailModel::class)->where('cd_ck_idx', $kindO->ck_idx)->where('cd_code', $bagCode)->first() : null;
|
||||
$detail = $kindO ? model(\App\Models\CodeDetailModel::class)->findResolvedByKindAndCode((int) $kindO->ck_idx, (string) $bagCode, $lgIdx) : null;
|
||||
$bagName = $detail ? $detail->cd_name : '';
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
@@ -383,7 +377,7 @@ class SalesReport extends BaseController
|
||||
|
||||
$db->transComplete();
|
||||
|
||||
return redirect()->to(site_url('admin/reports/misc-flow'))->with('success', '기타 입출고가 등록되었습니다.');
|
||||
return redirect()->to(mgmt_url('reports/misc-flow'))->with('success', '기타 입출고가 등록되었습니다.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -393,7 +387,9 @@ class SalesReport 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', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$startDate = $this->request->getGet('start_date') ?? date('Y-m-01');
|
||||
$endDate = $this->request->getGet('end_date') ?? date('Y-m-d');
|
||||
@@ -430,9 +426,6 @@ class SalesReport extends BaseController
|
||||
// 현재 재고
|
||||
$inventory = model(BagInventoryModel::class)->where('bi_lg_idx', $lgIdx)->findAll();
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '봉투 수불 현황',
|
||||
'content' => view('admin/sales_report/supply_demand', compact('receiving', 'sales', 'issues', 'inventory', 'startDate', 'endDate')),
|
||||
]);
|
||||
return $this->renderWorkPage('봉투 수불 현황', 'admin/sales_report/supply_demand', compact('receiving', 'sales', 'issues', 'inventory', 'startDate', 'endDate'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,37 +26,39 @@ class ShopOrder 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', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$builder = $this->orderModel->where('so_lg_idx', $lgIdx);
|
||||
$startDate = $this->request->getGet('start_date');
|
||||
$endDate = $this->request->getGet('end_date');
|
||||
if ($startDate) $builder->where('so_delivery_date >=', $startDate);
|
||||
if ($endDate) $builder->where('so_delivery_date <=', $endDate);
|
||||
if ($startDate) {
|
||||
$builder->where('so_delivery_date >=', $startDate);
|
||||
}
|
||||
if ($endDate) {
|
||||
$builder->where('so_delivery_date <=', $endDate);
|
||||
}
|
||||
|
||||
$list = $builder->orderBy('so_idx', 'DESC')->paginate(20);
|
||||
$pager = $this->orderModel->pager;
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '주문 접수 관리',
|
||||
'content' => view('admin/shop_order/index', compact('list', 'startDate', 'endDate', 'pager')),
|
||||
]);
|
||||
return $this->renderWorkPage('주문 접수 관리', 'admin/shop_order/index', compact('list', 'startDate', 'endDate', 'pager'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
helper('admin');
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if (!$lgIdx) return redirect()->to(site_url('admin/shop-orders'))->with('error', '지자체를 선택해 주세요.');
|
||||
if (! $lgIdx) {
|
||||
return redirect()->to(mgmt_url('shop-orders'))->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$shops = model(DesignatedShopModel::class)->where('ds_lg_idx', $lgIdx)->where('ds_state', 1)->findAll();
|
||||
$kind = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true) : [];
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx) : [];
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '주문 접수',
|
||||
'content' => view('admin/shop_order/create', compact('shops', 'bagCodes')),
|
||||
]);
|
||||
return $this->renderWorkPage('주문 접수', 'admin/shop_order/create', compact('shops', 'bagCodes'));
|
||||
}
|
||||
|
||||
public function store()
|
||||
@@ -94,10 +96,13 @@ class ShopOrder extends BaseController
|
||||
|
||||
$bagCodes = $this->request->getPost('item_bag_code') ?? [];
|
||||
$qtys = $this->request->getPost('item_qty') ?? [];
|
||||
$totalQty = 0; $totalAmt = 0;
|
||||
$totalQty = 0;
|
||||
$totalAmt = 0;
|
||||
|
||||
foreach ($bagCodes as $i => $code) {
|
||||
if (empty($code) || empty($qtys[$i])) continue;
|
||||
if (empty($code) || empty($qtys[$i])) {
|
||||
continue;
|
||||
}
|
||||
$qty = (int) $qtys[$i];
|
||||
|
||||
$price = model(BagPriceModel::class)->where('bp_lg_idx', $lgIdx)->where('bp_bag_code', $code)->where('bp_state', 1)->first();
|
||||
@@ -105,7 +110,9 @@ class ShopOrder extends BaseController
|
||||
$amount = $unitPrice * $qty;
|
||||
|
||||
$unit = model(PackagingUnitModel::class)->where('pu_lg_idx', $lgIdx)->where('pu_bag_code', $code)->where('pu_state', 1)->first();
|
||||
$boxCount = 0; $packCount = 0; $sheetCount = $qty;
|
||||
$boxCount = 0;
|
||||
$packCount = 0;
|
||||
$sheetCount = $qty;
|
||||
if ($unit && (int) $unit->pu_total_per_box > 0) {
|
||||
$boxCount = intdiv($qty, (int) $unit->pu_total_per_box);
|
||||
$remainder = $qty % (int) $unit->pu_total_per_box;
|
||||
@@ -116,7 +123,7 @@ class ShopOrder extends BaseController
|
||||
}
|
||||
|
||||
$kindO = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$detail = $kindO ? model(CodeDetailModel::class)->where('cd_ck_idx', $kindO->ck_idx)->where('cd_code', $code)->first() : null;
|
||||
$detail = $kindO ? model(CodeDetailModel::class)->findResolvedByKindAndCode((int) $kindO->ck_idx, (string) $code, $lgIdx) : null;
|
||||
|
||||
$this->itemModel->insert([
|
||||
'soi_so_idx' => $soIdx,
|
||||
@@ -137,7 +144,7 @@ class ShopOrder extends BaseController
|
||||
$this->orderModel->update($soIdx, ['so_total_qty' => $totalQty, 'so_total_amount' => $totalAmt]);
|
||||
$db->transComplete();
|
||||
|
||||
return redirect()->to(site_url('admin/shop-orders'))->with('success', '주문이 접수되었습니다.');
|
||||
return redirect()->to(mgmt_url('shop-orders'))->with('success', '주문이 접수되었습니다.');
|
||||
}
|
||||
|
||||
public function cancel(int $id)
|
||||
@@ -145,10 +152,11 @@ class ShopOrder extends BaseController
|
||||
helper('admin');
|
||||
$order = $this->orderModel->find($id);
|
||||
if (! $order || (int) $order->so_lg_idx !== admin_effective_lg_idx()) {
|
||||
return redirect()->to(site_url('admin/shop-orders'))->with('error', '주문을 찾을 수 없습니다.');
|
||||
return redirect()->to(mgmt_url('shop-orders'))->with('error', '주문을 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$this->orderModel->update($id, ['so_status' => 'cancelled']);
|
||||
return redirect()->to(site_url('admin/shop-orders'))->with('success', '주문이 취소되었습니다.');
|
||||
|
||||
return redirect()->to(mgmt_url('shop-orders'))->with('success', '주문이 취소되었습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,8 +121,10 @@ class User extends BaseController
|
||||
if (! $member) {
|
||||
return redirect()->to(site_url('admin/users'))->with('error', '회원을 찾을 수 없습니다.');
|
||||
}
|
||||
$member->mb_email = pii_decrypt($member->mb_email ?? '');
|
||||
$member->mb_phone = pii_decrypt($member->mb_phone ?? '');
|
||||
$email = pii_decrypt($member->mb_email ?? '');
|
||||
$phone = pii_decrypt($member->mb_phone ?? '');
|
||||
$member->mb_email = $email;
|
||||
$member->mb_phone = $phone;
|
||||
return view('admin/layout', [
|
||||
'title' => '회원 수정',
|
||||
'content' => view('admin/user/edit', [
|
||||
@@ -177,6 +179,23 @@ class User extends BaseController
|
||||
return redirect()->to(site_url('admin/users'))->with('success', '회원 정보가 수정되었습니다.');
|
||||
}
|
||||
|
||||
/**
|
||||
* 로그인 실패 누적 잠금(mb_locked_until) 해제 — 비밀번호는 그대로 두고 재시도만 가능하게 함
|
||||
*/
|
||||
public function unlockLogin(int $id)
|
||||
{
|
||||
$member = $this->memberModel->find($id);
|
||||
if (! $member) {
|
||||
return redirect()->to(site_url('admin/users'))->with('error', '회원을 찾을 수 없습니다.');
|
||||
}
|
||||
$this->memberModel->update($id, [
|
||||
'mb_login_fail_count' => 0,
|
||||
'mb_locked_until' => null,
|
||||
]);
|
||||
|
||||
return redirect()->back()->with('success', '로그인 잠금이 해제되었습니다.');
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재 로그인한 관리자가 부여 가능한 역할 목록.
|
||||
* super/본부만 4·5 부여 가능, 지자체 관리자는 1~3만.
|
||||
|
||||
41
app/Controllers/Admin/WorkMovedToBag.php
Normal file
41
app/Controllers/Admin/WorkMovedToBag.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
/**
|
||||
* 구 관리자 업무 URL(admin/…) → 메인 사이트 업무 URL(bag/…) 영구 이전.
|
||||
* POST 폼은 307로 메서드·본문 유지를 시도하고, GET 은 301.
|
||||
*/
|
||||
class WorkMovedToBag extends BaseController
|
||||
{
|
||||
public function toBag(string $prefix, string $rest = ''): \CodeIgniter\HTTP\RedirectResponse
|
||||
{
|
||||
$rest = trim($rest, '/');
|
||||
|
||||
if ($prefix === 'packaging-units') {
|
||||
$path = 'packaging-units/manage';
|
||||
if ($rest !== '') {
|
||||
$path .= '/' . $rest;
|
||||
}
|
||||
} else {
|
||||
$path = $prefix;
|
||||
if ($rest !== '') {
|
||||
$path .= '/' . $rest;
|
||||
}
|
||||
}
|
||||
|
||||
$target = site_url('bag/' . $path);
|
||||
$query = $this->request->getUri()->getQuery();
|
||||
if ($query !== '') {
|
||||
$target .= '?' . $query;
|
||||
}
|
||||
|
||||
$code = $this->request->getMethod() === 'post' ? 307 : 301;
|
||||
|
||||
return redirect()->to($target)->setStatusCode($code);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\Database\Exceptions\DatabaseException;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use App\Models\BagInventoryModel;
|
||||
use App\Models\BagIssueModel;
|
||||
use App\Models\BagOrderModel;
|
||||
@@ -18,6 +20,8 @@ use App\Models\PackagingUnitModel;
|
||||
use App\Models\SalesAgencyModel;
|
||||
use App\Models\ShopOrderModel;
|
||||
use App\Models\DesignatedShopModel;
|
||||
use App\Models\LocalGovernmentModel;
|
||||
use Config\Roles;
|
||||
|
||||
class Bag extends BaseController
|
||||
{
|
||||
@@ -39,20 +43,438 @@ class Bag extends BaseController
|
||||
}
|
||||
|
||||
// ──────────────────────────────────────────────
|
||||
// 기본정보관리
|
||||
// 기본정보관리 (단가·포장 단위 진입 허브)
|
||||
// ──────────────────────────────────────────────
|
||||
public function basicInfo(): string
|
||||
{
|
||||
$lgIdx = $this->lgIdx();
|
||||
$data = [];
|
||||
|
||||
if ($lgIdx) {
|
||||
$data['codeKinds'] = model(CodeKindModel::class)->orderBy('ck_code', 'ASC')->findAll();
|
||||
$data['bagPrices'] = model(BagPriceModel::class)->where('bp_lg_idx', $lgIdx)->orderBy('bp_bag_code', 'ASC')->findAll();
|
||||
$data['packagingUnits'] = model(PackagingUnitModel::class)->where('pu_lg_idx', $lgIdx)->orderBy('pu_bag_code', 'ASC')->findAll();
|
||||
return $this->render('기본정보관리', 'bag/basic_info', []);
|
||||
}
|
||||
|
||||
return $this->render('기본정보관리', 'bag/basic_info', $data);
|
||||
/** 봉투 단가 조회 (사이트) — 기간·봉투구분·봉투코드 필터, 적용기간 겹침, 페이징·인쇄 */
|
||||
public function prices(): string|RedirectResponse
|
||||
{
|
||||
helper('admin');
|
||||
if ($this->request->is('post')) {
|
||||
$post = $this->request->getPost();
|
||||
$pick = static function (array $src, string $key): ?string {
|
||||
if (! array_key_exists($key, $src)) {
|
||||
return null;
|
||||
}
|
||||
$v = $src[$key];
|
||||
if ($v === null || is_array($v)) {
|
||||
return null;
|
||||
}
|
||||
$s = trim((string) $v);
|
||||
|
||||
return $s === '' ? null : $s;
|
||||
};
|
||||
session()->setFlashdata('bag_prices_filter', [
|
||||
'start_y' => $pick($post, 'start_y'),
|
||||
'start_m' => $pick($post, 'start_m'),
|
||||
'start_d' => $pick($post, 'start_d'),
|
||||
'end_y' => $pick($post, 'end_y'),
|
||||
'end_m' => $pick($post, 'end_m'),
|
||||
'end_d' => $pick($post, 'end_d'),
|
||||
'bag_kind_e' => $pick($post, 'bag_kind_e'),
|
||||
'bag_code' => $pick($post, 'bag_code'),
|
||||
]);
|
||||
|
||||
return redirect()->to(site_url('bag/prices'));
|
||||
}
|
||||
|
||||
$lgIdx = $this->lgIdx();
|
||||
$bagPrices = [];
|
||||
|
||||
$get = $this->request->getGet();
|
||||
$flash = session()->getFlashdata('bag_prices_filter');
|
||||
|
||||
$readSrc = static function (array $src, string $key): ?string {
|
||||
if (! array_key_exists($key, $src)) {
|
||||
return null;
|
||||
}
|
||||
$v = $src[$key];
|
||||
if ($v === null || is_array($v)) {
|
||||
return null;
|
||||
}
|
||||
$s = trim((string) $v);
|
||||
|
||||
return $s === '' ? null : $s;
|
||||
};
|
||||
|
||||
$filterKeys = [
|
||||
'start_y', 'start_m', 'start_d',
|
||||
'end_y', 'end_m', 'end_d',
|
||||
'bag_kind_e', 'bag_code',
|
||||
'start_date', 'end_date',
|
||||
];
|
||||
$hasExplicitGetFilter = false;
|
||||
foreach ($filterKeys as $fk) {
|
||||
$v = $get[$fk] ?? null;
|
||||
if ($v !== null && ! is_array($v) && trim((string) $v) !== '') {
|
||||
$hasExplicitGetFilter = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$src = [];
|
||||
if ($hasExplicitGetFilter) {
|
||||
$src = $get;
|
||||
} elseif (is_array($flash)) {
|
||||
$src = $flash;
|
||||
}
|
||||
|
||||
$sy = $readSrc($src, 'start_y');
|
||||
$sm = $readSrc($src, 'start_m');
|
||||
$sd = $readSrc($src, 'start_d');
|
||||
$ey = $readSrc($src, 'end_y');
|
||||
$em = $readSrc($src, 'end_m');
|
||||
$ed = $readSrc($src, 'end_d');
|
||||
|
||||
$startDate = null;
|
||||
if ($sy !== null && $sy !== '' && $sm !== null && $sm !== '' && $sd !== null && $sd !== '') {
|
||||
$startDate = parse_ymd_from_triple($sy, $sm, $sd);
|
||||
}
|
||||
if ($startDate === null) {
|
||||
$g = $readSrc($src, 'start_date');
|
||||
$startDate = ($g !== null && $g !== '') ? $g : null;
|
||||
}
|
||||
|
||||
$endDate = null;
|
||||
if ($ey !== null && $ey !== '' && $em !== null && $em !== '' && $ed !== null && $ed !== '') {
|
||||
$endDate = parse_ymd_from_triple($ey, $em, $ed);
|
||||
}
|
||||
if ($endDate === null) {
|
||||
$g = $readSrc($src, 'end_date');
|
||||
$endDate = ($g !== null && $g !== '') ? $g : null;
|
||||
}
|
||||
|
||||
$startParts = ['y' => '', 'm' => '', 'd' => ''];
|
||||
$endParts = ['y' => '', 'm' => '', 'd' => ''];
|
||||
if ($startDate !== null && preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', $startDate, $m)) {
|
||||
$startParts = ['y' => $m[1], 'm' => (int) $m[2], 'd' => (int) $m[3]];
|
||||
} elseif ($sy !== null && $sm !== null && $sd !== null && $sy !== '' && $sm !== '' && $sd !== '') {
|
||||
$iy = (int) $sy;
|
||||
$im = (int) $sm;
|
||||
$id = (int) $sd;
|
||||
if ($iy >= 1000 && $iy <= 9999 && $im >= 1 && $im <= 12 && $id >= 1 && $id <= 31) {
|
||||
$startParts = ['y' => (string) $iy, 'm' => $im, 'd' => $id];
|
||||
}
|
||||
}
|
||||
if ($endDate !== null && preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', $endDate, $m)) {
|
||||
$endParts = ['y' => $m[1], 'm' => (int) $m[2], 'd' => (int) $m[3]];
|
||||
} elseif ($ey !== null && $em !== null && $ed !== null && $ey !== '' && $em !== '' && $ed !== '') {
|
||||
$iy = (int) $ey;
|
||||
$im = (int) $em;
|
||||
$id = (int) $ed;
|
||||
if ($iy >= 1000 && $iy <= 9999 && $im >= 1 && $im <= 12 && $id >= 1 && $id <= 31) {
|
||||
$endParts = ['y' => (string) $iy, 'm' => $im, 'd' => $id];
|
||||
}
|
||||
}
|
||||
|
||||
$dateYearMin = (int) date('Y') - 12;
|
||||
$dateYearMax = (int) date('Y') + 2;
|
||||
|
||||
$bagKindE = $readSrc($src, 'bag_kind_e');
|
||||
$bagCode = $readSrc($src, 'bag_code');
|
||||
$pager = null;
|
||||
$bagCodes = [];
|
||||
$bagKindOpts = [];
|
||||
$printLines = [];
|
||||
$printLgName = '';
|
||||
|
||||
if ($lgIdx !== null) {
|
||||
try {
|
||||
$priceModel = model(BagPriceModel::class);
|
||||
$builder = $priceModel->where('bp_lg_idx', $lgIdx);
|
||||
|
||||
if (($startDate !== null && $startDate !== '') || ($endDate !== null && $endDate !== '')) {
|
||||
$qStart = ($startDate !== null && $startDate !== '') ? $startDate : $endDate;
|
||||
$qEnd = ($endDate !== null && $endDate !== '') ? $endDate : $startDate;
|
||||
if (strcmp((string) $qStart, (string) $qEnd) > 0) {
|
||||
[$qStart, $qEnd] = [$qEnd, $qStart];
|
||||
}
|
||||
$builder->where('bp_start_date <=', $qEnd);
|
||||
$builder->groupStart()
|
||||
->where('bp_end_date IS NULL')
|
||||
->orWhere('bp_end_date >=', $qStart)
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
if ($bagKindE !== null && $bagKindE !== '') {
|
||||
$ek = model(CodeKindModel::class)->where('ck_code', 'E')->first();
|
||||
if ($ek) {
|
||||
$eDetail = model(CodeDetailModel::class)
|
||||
->where('cd_ck_idx', (int) $ek->ck_idx)
|
||||
->where('cd_code', $bagKindE)
|
||||
->where('cd_state', 1)
|
||||
->first();
|
||||
if ($eDetail !== null) {
|
||||
$builder->like('bp_bag_code', (string) $bagKindE, 'after');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($bagCode !== null && $bagCode !== '') {
|
||||
$ok = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
if ($ok) {
|
||||
$oDetail = model(CodeDetailModel::class)->findResolvedByKindAndCode((int) $ok->ck_idx, (string) $bagCode, $lgIdx);
|
||||
if ($oDetail !== null) {
|
||||
$builder->where('bp_bag_code', $bagCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$bagPrices = $builder->orderBy('bp_bag_code', 'ASC')->orderBy('bp_start_date', 'DESC')->paginate(20);
|
||||
|
||||
$queryForPager = [];
|
||||
$tripleS = $sy !== null && $sy !== '' && $sm !== null && $sm !== '' && $sd !== null && $sd !== '';
|
||||
$tripleE = $ey !== null && $ey !== '' && $em !== null && $em !== '' && $ed !== null && $ed !== '';
|
||||
if ($tripleS) {
|
||||
$queryForPager['start_y'] = $sy;
|
||||
$queryForPager['start_m'] = $sm;
|
||||
$queryForPager['start_d'] = $sd;
|
||||
} else {
|
||||
$legacyS = $readSrc($src, 'start_date');
|
||||
if ($legacyS !== null) {
|
||||
$queryForPager['start_date'] = $legacyS;
|
||||
}
|
||||
}
|
||||
if ($tripleE) {
|
||||
$queryForPager['end_y'] = $ey;
|
||||
$queryForPager['end_m'] = $em;
|
||||
$queryForPager['end_d'] = $ed;
|
||||
} else {
|
||||
$legacyE = $readSrc($src, 'end_date');
|
||||
if ($legacyE !== null) {
|
||||
$queryForPager['end_date'] = $legacyE;
|
||||
}
|
||||
}
|
||||
if ($bagKindE !== null && $bagKindE !== '') {
|
||||
$queryForPager['bag_kind_e'] = $bagKindE;
|
||||
}
|
||||
if ($bagCode !== null && $bagCode !== '') {
|
||||
$queryForPager['bag_code'] = $bagCode;
|
||||
}
|
||||
$queryForPager = array_filter(
|
||||
$queryForPager,
|
||||
static fn ($v) => $v !== null && $v !== ''
|
||||
);
|
||||
$pagerPath = site_url('bag/prices');
|
||||
if ($queryForPager !== []) {
|
||||
$pagerPath .= '?' . http_build_query($queryForPager);
|
||||
}
|
||||
$priceModel->pager->setPath($pagerPath);
|
||||
$pager = $priceModel->pager;
|
||||
|
||||
$kindO = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$bagCodes = $kindO
|
||||
? model(CodeDetailModel::class)->getByKind((int) $kindO->ck_idx, true, $lgIdx)
|
||||
: [];
|
||||
|
||||
$kindE = model(CodeKindModel::class)->where('ck_code', 'E')->first();
|
||||
$bagKindOpts = $kindE
|
||||
? model(CodeDetailModel::class)->getByKind((int) $kindE->ck_idx, true, null)
|
||||
: [];
|
||||
|
||||
$lgRow = model(LocalGovernmentModel::class)->find($lgIdx);
|
||||
$printLgName = $lgRow !== null ? $lgRow->lg_name : '';
|
||||
} catch (DatabaseException $e) {
|
||||
log_message('error', '[prices] bag_price 조회 실패: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if (($startDate !== null && $startDate !== '') || ($endDate !== null && $endDate !== '')) {
|
||||
$qs = ($startDate !== null && $startDate !== '') ? $startDate : $endDate;
|
||||
$qe = ($endDate !== null && $endDate !== '') ? $endDate : $startDate;
|
||||
if (strcmp((string) $qs, (string) $qe) > 0) {
|
||||
[$qs, $qe] = [$qe, $qs];
|
||||
}
|
||||
$printLines[] = '조회기간(적용기간 겹침): ' . format_ymd_korean($qs) . ' ~ ' . format_ymd_korean($qe);
|
||||
}
|
||||
if ($bagKindE !== null && $bagKindE !== '') {
|
||||
foreach ($bagKindOpts as $cd) {
|
||||
if ((string) $cd->cd_code === (string) $bagKindE) {
|
||||
$printLines[] = '봉투구분: ' . $cd->cd_name . ' (' . $bagKindE . ')';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($bagCode !== null && $bagCode !== '') {
|
||||
$printLines[] = '봉투코드: ' . $bagCode;
|
||||
}
|
||||
|
||||
$viewData = [
|
||||
'lgIdx' => $lgIdx,
|
||||
'bagPrices' => $bagPrices,
|
||||
'pager' => $pager,
|
||||
'startDate' => $startDate,
|
||||
'endDate' => $endDate,
|
||||
'startParts' => $startParts,
|
||||
'endParts' => $endParts,
|
||||
'dateYearMin' => $dateYearMin,
|
||||
'dateYearMax' => $dateYearMax,
|
||||
'bag_kind_e' => $bagKindE,
|
||||
'bag_code' => $bagCode,
|
||||
'bag_codes' => $bagCodes,
|
||||
'bag_kind_options' => $bagKindOpts,
|
||||
'printExtraLines' => $printLines,
|
||||
];
|
||||
if ($printLgName !== '') {
|
||||
$viewData['printLgName'] = $printLgName;
|
||||
}
|
||||
|
||||
return $this->render('봉투 단가', 'bag/prices', $viewData);
|
||||
}
|
||||
|
||||
/** 포장 단위 조회 (사이트) */
|
||||
public function packagingUnits(): string
|
||||
{
|
||||
$lgIdx = $this->lgIdx();
|
||||
$packagingUnits = [];
|
||||
$dbDiag = null;
|
||||
if ($lgIdx) {
|
||||
try {
|
||||
$packagingUnits = model(PackagingUnitModel::class)->where('pu_lg_idx', $lgIdx)->orderBy('pu_bag_code', 'ASC')->findAll();
|
||||
} catch (DatabaseException $e) {
|
||||
log_message('error', '[packagingUnits] packaging_unit 조회 실패: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->request->getGet('db_diag') === '1') {
|
||||
$dbDiag = [
|
||||
'lg_idx' => $lgIdx,
|
||||
'db_name' => null,
|
||||
'packaging_unit' => null,
|
||||
'code_kind' => null,
|
||||
'code_detail' => null,
|
||||
'error' => null,
|
||||
];
|
||||
try {
|
||||
$db = db_connect();
|
||||
$dbDiag['db_name'] = $db->database;
|
||||
$dbDiag['packaging_unit'] = (int) $db->table('packaging_unit')->where('pu_lg_idx', (int) $lgIdx)->countAllResults();
|
||||
$dbDiag['code_kind'] = (int) $db->table('code_kind')->countAllResults();
|
||||
$dbDiag['code_detail'] = (int) $db->table('code_detail')->countAllResults();
|
||||
} catch (\Throwable $e) {
|
||||
$dbDiag['error'] = $e->getMessage();
|
||||
log_message('error', '[packagingUnits][db_diag] {type}: {message}', [
|
||||
'type' => $e::class,
|
||||
'message' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('포장 단위', 'bag/packaging_units', [
|
||||
'packagingUnits' => $packagingUnits,
|
||||
'dbDiag' => $dbDiag,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 기본코드 종류·세부코드 조회 전용 (사이트 메뉴 기본코드관리)
|
||||
*/
|
||||
public function codeKinds(): string
|
||||
{
|
||||
$kindModel = model(CodeKindModel::class);
|
||||
$detailModel = model(CodeDetailModel::class);
|
||||
$kinds = [];
|
||||
$countMap = [];
|
||||
$lgIdx = $this->lgIdx();
|
||||
try {
|
||||
$kinds = $kindModel->orderBy('ck_code', 'ASC')->findAll();
|
||||
foreach ($kinds as $row) {
|
||||
$countMap[$row->ck_idx] = (int) $detailModel->where('cd_ck_idx', $row->ck_idx)
|
||||
->filterByTenantScope($lgIdx)
|
||||
->countAllResults();
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
log_message('error', '[codeKinds] 실패: {type} {message} @ {file}:{line} / lg={lg}, user={user}, level={level}', [
|
||||
'type' => $e::class,
|
||||
'message' => $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine(),
|
||||
'lg' => $lgIdx !== null ? (string) $lgIdx : 'null',
|
||||
'user' => (string) (session()->get('mb_id') ?? ''),
|
||||
'level' => (string) (session()->get('mb_level') ?? ''),
|
||||
]);
|
||||
session()->setFlashdata('error', '기본코드 조회 중 오류가 발생했습니다. 관리자에게 로그 확인을 요청해 주세요.');
|
||||
}
|
||||
|
||||
$level = (int) session()->get('mb_level');
|
||||
|
||||
return $this->render('기본코드관리', 'bag/code_kinds', [
|
||||
'codeKinds' => $kinds,
|
||||
'countMap' => $countMap,
|
||||
'canManageKinds' => Roles::canManageCodeKindMaster($level),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 기본코드 세부 목록 (사이트 레이아웃). 등록·수정·삭제 폼은 /admin/code-details/* 유지.
|
||||
*/
|
||||
public function codeDetails(int $ckIdx)
|
||||
{
|
||||
$kindModel = model(CodeKindModel::class);
|
||||
$detailModel = model(CodeDetailModel::class);
|
||||
$kind = null;
|
||||
try {
|
||||
$kind = $kindModel->find($ckIdx);
|
||||
} catch (\Throwable $e) {
|
||||
log_message('error', '[codeDetails] kind 조회 실패: {type} {message} @ {file}:{line} / ck={ck}, user={user}, level={level}', [
|
||||
'type' => $e::class,
|
||||
'message' => $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine(),
|
||||
'ck' => (string) $ckIdx,
|
||||
'user' => (string) (session()->get('mb_id') ?? ''),
|
||||
'level' => (string) (session()->get('mb_level') ?? ''),
|
||||
]);
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('error', '세부코드 조회 중 오류가 발생했습니다. 관리자에게 로그 확인을 요청해 주세요.');
|
||||
}
|
||||
if ($kind === null) {
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('error', '코드 종류를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$lgIdx = $this->lgIdx();
|
||||
try {
|
||||
$list = $detailModel->where('cd_ck_idx', $ckIdx)
|
||||
->filterByTenantScope($lgIdx)
|
||||
->orderBy('cd_sort', 'ASC')
|
||||
->orderBy('cd_idx', 'ASC')
|
||||
->paginate(20);
|
||||
$pager = $detailModel->pager;
|
||||
} catch (\Throwable $e) {
|
||||
log_message('error', '[codeDetails] list 조회 실패: {type} {message} @ {file}:{line} / ck={ck}, lg={lg}, user={user}, level={level}', [
|
||||
'type' => $e::class,
|
||||
'message' => $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine(),
|
||||
'ck' => (string) $ckIdx,
|
||||
'lg' => $lgIdx !== null ? (string) $lgIdx : 'null',
|
||||
'user' => (string) (session()->get('mb_id') ?? ''),
|
||||
'level' => (string) (session()->get('mb_level') ?? ''),
|
||||
]);
|
||||
return redirect()->to(site_url('bag/code-kinds'))->with('error', '세부코드 조회 중 오류가 발생했습니다. 관리자에게 로그 확인을 요청해 주세요.');
|
||||
}
|
||||
|
||||
helper('admin');
|
||||
$level = (int) session()->get('mb_level');
|
||||
$adminLg = admin_effective_lg_idx();
|
||||
$canManage = Roles::canManageCodeMaster($level);
|
||||
$rowCanEdit = [];
|
||||
foreach ($list as $row) {
|
||||
$rowCanEdit[$row->cd_idx] = Roles::canEditCodeDetailRow($level, $row, $adminLg);
|
||||
}
|
||||
|
||||
$title = ($canManage ? '세부코드 관리' : '세부코드 조회') . ' — ' . $kind->ck_name . ' (' . $kind->ck_code . ')';
|
||||
|
||||
return $this->render($title, 'bag/code_details', [
|
||||
'kind' => $kind,
|
||||
'list' => $list,
|
||||
'pager' => $pager,
|
||||
'canManage' => $canManage,
|
||||
'rowCanEdit' => $rowCanEdit,
|
||||
]);
|
||||
}
|
||||
|
||||
// ──────────────────────────────────────────────
|
||||
@@ -314,7 +736,7 @@ class Bag extends BaseController
|
||||
public function issueCreate(): string
|
||||
{
|
||||
$kind = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->where('cd_ck_idx', $kind->ck_idx)->where('cd_state', 1)->orderBy('cd_sort')->findAll() : [];
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $this->lgIdx()) : [];
|
||||
return $this->render('불출 처리', 'bag/create_bag_issue', compact('bagCodes'));
|
||||
}
|
||||
|
||||
@@ -344,8 +766,10 @@ class Bag extends BaseController
|
||||
{
|
||||
helper('admin');
|
||||
$lgIdx = $this->lgIdx();
|
||||
$companies = $lgIdx ? model(CompanyModel::class)->where('cp_lg_idx', $lgIdx)->where('cp_type', 'manufacturer')->where('cp_state', 1)->findAll() : [];
|
||||
$agencies = $lgIdx ? model(SalesAgencyModel::class)->where('sa_lg_idx', $lgIdx)->where('sa_state', 1)->findAll() : [];
|
||||
$companies = $lgIdx
|
||||
? model(CompanyModel::class)->where('cp_lg_idx', $lgIdx)->whereIn('cp_type', ['제작업체', 'manufacturer'])->where('cp_state', 1)->findAll()
|
||||
: [];
|
||||
$agencies = $lgIdx ? model(SalesAgencyModel::class)->where('sa_lg_idx', $lgIdx)->orderForDisplay()->findAll() : [];
|
||||
$kind = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->where('cd_ck_idx', $kind->ck_idx)->where('cd_state', 1)->orderBy('cd_sort')->findAll() : [];
|
||||
return $this->render('발주 등록', 'bag/create_bag_order', compact('companies', 'agencies', 'bagCodes'));
|
||||
@@ -362,6 +786,26 @@ class Bag extends BaseController
|
||||
return redirect()->to(site_url('bag/purchase-inbound'))->with('success', '발주 등록되었습니다.');
|
||||
}
|
||||
|
||||
public function orderCancel(int $id)
|
||||
{
|
||||
helper('admin');
|
||||
$lgIdx = $this->lgIdx();
|
||||
if (!$lgIdx) {
|
||||
return redirect()->to(site_url('bag/purchase-inbound'))->with('error', '지자체를 확인할 수 없습니다.');
|
||||
}
|
||||
$orderModel = model(BagOrderModel::class);
|
||||
$order = $orderModel->find($id);
|
||||
if (!$order || (int) $order->bo_lg_idx !== $lgIdx) {
|
||||
return redirect()->to(site_url('bag/purchase-inbound'))->with('error', '발주를 찾을 수 없습니다.');
|
||||
}
|
||||
$before = (array) $order;
|
||||
$orderModel->update($id, ['bo_status' => 'cancelled', 'bo_moddate' => date('Y-m-d H:i:s')]);
|
||||
helper('audit');
|
||||
audit_log('update', 'bag_order', $id, $before, ['bo_status' => 'cancelled']);
|
||||
|
||||
return redirect()->to(site_url('bag/purchase-inbound'))->with('success', '발주가 취소되었습니다.');
|
||||
}
|
||||
|
||||
// --- 입고 처리 ---
|
||||
public function receivingCreate(): string
|
||||
{
|
||||
@@ -389,7 +833,7 @@ class Bag extends BaseController
|
||||
$lgIdx = $this->lgIdx();
|
||||
$shops = $lgIdx ? model(DesignatedShopModel::class)->where('ds_lg_idx', $lgIdx)->where('ds_state', 1)->findAll() : [];
|
||||
$kind = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->where('cd_ck_idx', $kind->ck_idx)->where('cd_state', 1)->orderBy('cd_sort')->findAll() : [];
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx) : [];
|
||||
return $this->render('판매 등록', 'bag/create_bag_sale', compact('shops', 'bagCodes'));
|
||||
}
|
||||
|
||||
@@ -411,7 +855,7 @@ class Bag extends BaseController
|
||||
$lgIdx = $this->lgIdx();
|
||||
$shops = $lgIdx ? model(DesignatedShopModel::class)->where('ds_lg_idx', $lgIdx)->where('ds_state', 1)->findAll() : [];
|
||||
$kind = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->where('cd_ck_idx', $kind->ck_idx)->where('cd_state', 1)->orderBy('cd_sort')->findAll() : [];
|
||||
$bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx) : [];
|
||||
return $this->render('주문 접수', 'bag/create_shop_order', compact('shops', 'bagCodes'));
|
||||
}
|
||||
|
||||
|
||||
@@ -42,4 +42,31 @@ abstract class BaseController extends Controller
|
||||
// Preload any models, libraries, etc, here.
|
||||
// $this->session = service('session');
|
||||
}
|
||||
|
||||
/**
|
||||
* /admin/* 또는 /bag/* 업무 화면 공통: 요청이 bag 이면 메인 사이트 레이아웃, 아니면 관리자 레이아웃.
|
||||
*
|
||||
* @param array<string, mixed> $contentData
|
||||
*/
|
||||
protected function renderWorkPage(string $title, string $contentView, array $contentData = []): string
|
||||
{
|
||||
$content = view($contentView, $contentData);
|
||||
$uri = service('request')->getUri();
|
||||
$seg1 = $uri->getSegment(1);
|
||||
$seg2 = $uri->getSegment(2);
|
||||
|
||||
// 지정판매소 관리는 관리자 전용 기능으로, /bag 경로여도 관리자 레이아웃을 유지한다.
|
||||
$forceAdminLayoutOnBag = ($seg1 === 'bag' && $seg2 === 'designated-shops');
|
||||
if ($seg1 === 'bag' && ! $forceAdminLayoutOnBag) {
|
||||
return view('bag/layout/main', [
|
||||
'title' => $title,
|
||||
'content' => $content,
|
||||
]);
|
||||
}
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => $title,
|
||||
'content' => $content,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,16 @@ class Home extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* 로그인 후 원래 메인 화면 (admin 유사 레이아웃 + site 메뉴 호버 드롭다운)
|
||||
* 로그인 후 메인 — site 메뉴 레이아웃 + 종합·그래프(blend) 본문
|
||||
*/
|
||||
public function dashboard()
|
||||
{
|
||||
return view('bag/daily_inventory');
|
||||
return view('bag/layout/main', [
|
||||
'title' => '업무 현황 · 종합·그래프',
|
||||
'content' => view('bag/dashboard_blend_inner', [
|
||||
'lgLabel' => $this->resolveLgLabel(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,13 +67,11 @@ class Home extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* dense(표·KPI) + charts(Chart.js) 혼합. URL: /dashboard/blend
|
||||
* /dashboard 와 동일 본문(호환 URL)
|
||||
*/
|
||||
public function dashboardBlend()
|
||||
{
|
||||
return view('bag/lg_dashboard_blend', [
|
||||
'lgLabel' => $this->resolveLgLabel(),
|
||||
]);
|
||||
return $this->dashboard();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,4 +117,5 @@ class Home extends BaseController
|
||||
|
||||
return '북구 (데모)';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
29
app/Filters/LoginAuthFilter.php
Normal file
29
app/Filters/LoginAuthFilter.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filters;
|
||||
|
||||
use CodeIgniter\Filters\FilterInterface;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 로그인만 필요 (mb_level 무관). 기본코드 조회 등 시민·판매소도 접근 가능한 /admin/* 하위용.
|
||||
*/
|
||||
class LoginAuthFilter implements FilterInterface
|
||||
{
|
||||
public function before(RequestInterface $request, $arguments = null)
|
||||
{
|
||||
if (! session()->get('logged_in')) {
|
||||
return redirect()->to(site_url('login'))->with('error', '로그인이 필요합니다.');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
|
||||
{
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,9 @@ use Config\Roles;
|
||||
|
||||
if (! function_exists('admin_effective_lg_idx')) {
|
||||
/**
|
||||
* 현재 로그인한 관리자가 작업 대상으로 사용하는 지자체 PK.
|
||||
* Super/본부 관리자 → admin_selected_lg_idx, 지자체 관리자 → mb_lg_idx, 그 외 null.
|
||||
* 관리자 화면·사이트 메뉴·Bag 등에서 쓰는 작업 지자체 PK.
|
||||
* Super/본부 → admin_selected_lg_idx(미선택 시 null).
|
||||
* 지자체관리자·지정판매소·일반 사용자 → mb_lg_idx(없으면 null).
|
||||
*/
|
||||
function admin_effective_lg_idx(): ?int
|
||||
{
|
||||
@@ -16,7 +17,9 @@ if (! function_exists('admin_effective_lg_idx')) {
|
||||
$idx = session()->get('admin_selected_lg_idx');
|
||||
return $idx !== null && $idx !== '' ? (int) $idx : null;
|
||||
}
|
||||
if ($level === Roles::LEVEL_LOCAL_ADMIN) {
|
||||
if ($level === Roles::LEVEL_LOCAL_ADMIN
|
||||
|| $level === Roles::LEVEL_SHOP
|
||||
|| $level === Roles::LEVEL_CITIZEN) {
|
||||
$idx = session()->get('mb_lg_idx');
|
||||
return $idx !== null && $idx !== '' ? (int) $idx : null;
|
||||
}
|
||||
@@ -24,6 +27,23 @@ if (! function_exists('admin_effective_lg_idx')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('resolve_site_menu_lg_idx')) {
|
||||
/**
|
||||
* site 상단 메뉴(menu 테이블) 조회용 지자체 PK.
|
||||
* admin_effective_lg_idx() 우선(메뉴 관리·Bag과 동일), 없으면 mb_lg_idx, 그다음 기본 1.
|
||||
*/
|
||||
function resolve_site_menu_lg_idx(): int
|
||||
{
|
||||
$lgIdx = admin_effective_lg_idx();
|
||||
if ($lgIdx !== null) {
|
||||
return $lgIdx;
|
||||
}
|
||||
$raw = session()->get('mb_lg_idx');
|
||||
|
||||
return ($raw !== null && $raw !== '') ? (int) $raw : 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('get_admin_nav_items')) {
|
||||
/**
|
||||
* 관리자 상단 메뉴 항목 (DB menu 테이블, admin 타입, 현재 지자체·mb_level 기준, 평면 배열).
|
||||
@@ -130,22 +150,31 @@ if (! function_exists('get_site_nav_tree')) {
|
||||
function get_site_nav_tree(): array
|
||||
{
|
||||
try {
|
||||
$lgIdx = session()->get('mb_lg_idx');
|
||||
// 시민 등 지자체 정보가 세션에 없으면 기본 지자체(1) 기준으로 메뉴를 보여 준다.
|
||||
if ($lgIdx === null || $lgIdx === '') {
|
||||
$lgIdx = 1;
|
||||
}
|
||||
$typeRow = model(\App\Models\MenuTypeModel::class)->getByCode('site');
|
||||
if (! $typeRow) {
|
||||
return [];
|
||||
}
|
||||
$lgIdx = resolve_site_menu_lg_idx();
|
||||
$mbLevel = (int) session()->get('mb_level');
|
||||
$menuModel = model(\App\Models\MenuModel::class);
|
||||
$flat = $menuModel->getVisibleByLevel((int) $typeRow->mt_idx, $mbLevel, (int) $lgIdx);
|
||||
$typeRow = model(\App\Models\MenuTypeModel::class)->getByCode('site');
|
||||
$siteMtIdx = $typeRow ? (int) $typeRow->mt_idx : 0;
|
||||
if ($siteMtIdx <= 0) {
|
||||
// 운영 DB 불일치 대비: menu_type 누락 시 legacy site mt_idx(4)로 시도
|
||||
$siteMtIdx = 4;
|
||||
}
|
||||
|
||||
$flat = $menuModel->getVisibleByLevel($siteMtIdx, $mbLevel, (int) $lgIdx);
|
||||
// 현재 지자체에 site 메뉴가 없으면, 기본 지자체(1)의 메뉴를 한 번 복사한 뒤 다시 시도
|
||||
if (empty($flat)) {
|
||||
$menuModel->copyDefaultsFromLg((int) $typeRow->mt_idx, 1, (int) $lgIdx);
|
||||
$flat = $menuModel->getVisibleByLevel((int) $typeRow->mt_idx, $mbLevel, (int) $lgIdx);
|
||||
$menuModel->copyDefaultsFromLg($siteMtIdx, 1, (int) $lgIdx);
|
||||
$flat = $menuModel->getVisibleByLevel($siteMtIdx, $mbLevel, (int) $lgIdx);
|
||||
}
|
||||
|
||||
// site 타입 매핑 불일치(예: menu_type=2, menu 데이터=4) 보정
|
||||
if (empty($flat) && $siteMtIdx !== 4) {
|
||||
$legacyMtIdx = 4;
|
||||
$flat = $menuModel->getVisibleByLevel($legacyMtIdx, $mbLevel, (int) $lgIdx);
|
||||
if (empty($flat)) {
|
||||
$menuModel->copyDefaultsFromLg($legacyMtIdx, 1, (int) $lgIdx);
|
||||
$flat = $menuModel->getVisibleByLevel($legacyMtIdx, $mbLevel, (int) $lgIdx);
|
||||
}
|
||||
}
|
||||
if (empty($flat)) {
|
||||
return [];
|
||||
@@ -156,3 +185,319 @@ if (! function_exists('get_site_nav_tree')) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('current_nav_request_path')) {
|
||||
/**
|
||||
* 메뉴 활성·mm_link 비교용 현재 경로 (라우트 기준, base_url 뒤 세그먼트).
|
||||
* request->getPath() · uri_string() · SiteURI::getRoutePath() 중 비어 있지 않은 값을 사용.
|
||||
*/
|
||||
function current_nav_request_path(): string
|
||||
{
|
||||
helper('url');
|
||||
|
||||
$request = service('request');
|
||||
// 프레임워크 권장: uri_string() = baseURL 기준 경로 (우선)
|
||||
$candidates = [trim(uri_string(), '/')];
|
||||
if ($request instanceof \CodeIgniter\HTTP\IncomingRequest) {
|
||||
$candidates[] = trim((string) $request->getPath(), '/');
|
||||
}
|
||||
$uri = $request->getUri();
|
||||
if ($uri instanceof \CodeIgniter\HTTP\SiteURI) {
|
||||
$candidates[] = trim($uri->getRoutePath(), '/');
|
||||
}
|
||||
|
||||
$path = '';
|
||||
foreach ($candidates as $c) {
|
||||
if ($c !== '') {
|
||||
$path = $c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while (str_starts_with($path, 'index.php/')) {
|
||||
$path = substr($path, strlen('index.php/'));
|
||||
}
|
||||
|
||||
// baseURL 에 경로가 있으면(서브폴더 설치) URI 앞에 붙은 동일 접두 제거
|
||||
$basePath = parse_url(config(\Config\App::class)->baseURL, PHP_URL_PATH);
|
||||
$basePath = is_string($basePath) ? trim($basePath, '/') : '';
|
||||
if ($basePath !== '' && $path !== '' && ($path === $basePath || str_starts_with($path, $basePath . '/'))) {
|
||||
$path = $path === $basePath ? '' : substr($path, strlen($basePath) + 1);
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('normalize_menu_link_for_url')) {
|
||||
/**
|
||||
* menu.mm_link 를 base_url() 인자로 쓸 수 있는 상대 경로로 정규화합니다.
|
||||
* http(s)://... 전체 URL이면 path 만 사용하고, 앞뒤 공백·슬래시를 정리합니다.
|
||||
*/
|
||||
function normalize_menu_link_for_url(?string $mmLink): string
|
||||
{
|
||||
$s = trim((string) $mmLink);
|
||||
if ($s === '') {
|
||||
return '';
|
||||
}
|
||||
if (str_contains($s, '://')) {
|
||||
$path = parse_url($s, PHP_URL_PATH);
|
||||
$s = is_string($path) ? trim($path, '/') : '';
|
||||
} else {
|
||||
$s = trim($s, '/');
|
||||
}
|
||||
|
||||
while (str_starts_with($s, 'index.php/')) {
|
||||
$s = substr($s, strlen('index.php/'));
|
||||
}
|
||||
if (str_starts_with($s, 'public/')) {
|
||||
$s = substr($s, strlen('public/'));
|
||||
}
|
||||
|
||||
$basePath = parse_url(config(\Config\App::class)->baseURL, PHP_URL_PATH);
|
||||
$basePath = is_string($basePath) ? trim($basePath, '/') : '';
|
||||
if ($basePath !== '' && $s !== '' && ($s === $basePath || str_starts_with($s, $basePath . '/'))) {
|
||||
$s = $s === $basePath ? '' : substr($s, strlen($basePath) + 1);
|
||||
}
|
||||
|
||||
return $s;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('mgmt_url')) {
|
||||
/**
|
||||
* 업무 화면 링크: 정식 URL 은 /bag/* (adminAuth). 포장 단위 CRUD 는 packaging-units/manage 로 치환.
|
||||
*/
|
||||
function mgmt_url(string $path): string
|
||||
{
|
||||
helper('url');
|
||||
$path = trim($path, '/');
|
||||
// bag/packaging-units 는 조회 전용(Bag) — CRUD 는 /bag/packaging-units/manage/* 로 분리
|
||||
if ($path === 'packaging-units') {
|
||||
$path = 'packaging-units/manage';
|
||||
} elseif (str_starts_with($path, 'packaging-units/')) {
|
||||
$path = 'packaging-units/manage/' . substr($path, strlen('packaging-units/'));
|
||||
}
|
||||
|
||||
return site_url('bag/' . $path);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('work_area_home_url')) {
|
||||
/**
|
||||
* 지자체 미선택 등으로 돌아갈 때: bag 업무 중이면 대시보드, 관리자면 admin 홈.
|
||||
*/
|
||||
function work_area_home_url(): string
|
||||
{
|
||||
helper('url');
|
||||
$seg1 = service('request')->getUri()->getSegment(1);
|
||||
|
||||
return ($seg1 === 'bag') ? site_url('dashboard') : site_url('admin');
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('format_ymd_korean')) {
|
||||
/**
|
||||
* Y-m-d 날짜를 '2026년 1월 5일' 형식으로 (월·일은 숫자, 월명은 한글 '월').
|
||||
*/
|
||||
function format_ymd_korean(?string $ymd): string
|
||||
{
|
||||
if ($ymd === null || trim($ymd) === '') {
|
||||
return '—';
|
||||
}
|
||||
$t = \DateTimeImmutable::createFromFormat('Y-m-d', trim($ymd));
|
||||
if ($t === false) {
|
||||
return $ymd;
|
||||
}
|
||||
|
||||
return $t->format('Y') . '년 ' . (int) $t->format('n') . '월 ' . (int) $t->format('j') . '일';
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('parse_ymd_from_triple')) {
|
||||
/**
|
||||
* 연·월·일 GET 값으로 Y-m-d 생성 (유효하지 않은 날짜는 null).
|
||||
*/
|
||||
function parse_ymd_from_triple(?string $y, ?string $m, ?string $d): ?string
|
||||
{
|
||||
if ($y === null || $y === '' || $m === null || $m === '' || $d === null || $d === '') {
|
||||
return null;
|
||||
}
|
||||
$yi = (int) $y;
|
||||
$mi = (int) $m;
|
||||
$di = (int) $d;
|
||||
if ($yi < 1000 || $yi > 9999 || ! checkdate($mi, $di, $yi)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return sprintf('%04d-%02d-%02d', $yi, $mi, $di);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('site_nav_resolved_link_path')) {
|
||||
/**
|
||||
* 사이트 상단 메뉴 URL 세그먼트. mm_link(DB)만 사용 (비어 있으면 빈 문자열).
|
||||
*
|
||||
* @param string|null $mmName 호환용(미사용).
|
||||
*
|
||||
* @return string base_url() 인자 세그먼트(앞뒤 슬래시 없음)
|
||||
*/
|
||||
function site_nav_resolved_link_path(?string $mmLink, ?string $mmName = null): string
|
||||
{
|
||||
return normalize_menu_link_for_url($mmLink);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('menu_link_candidate_paths')) {
|
||||
/**
|
||||
* 활성 비교용 경로 후보. DB에 "menus" 처럼 짧게 넣은 경우 실제 URI가 admin/menus·bag/… 일 수 있어,
|
||||
* 현재 요청 경로에 맞게 admin/·bag/ 접두를 붙인 후보도 만든다. (슬래시 포함·admin 단독은 그대로 1개만)
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
function menu_link_candidate_paths(?string $mmLink, string $currentPath): array
|
||||
{
|
||||
$p = normalize_menu_link_for_url($mmLink);
|
||||
if ($p === '') {
|
||||
return [];
|
||||
}
|
||||
if (str_contains($p, '/') || $p === 'admin') {
|
||||
$cands = [$p];
|
||||
if (preg_match('#^bag/packaging-units/manage(/.*)?$#', $p, $m)) {
|
||||
$cands[] = 'admin/packaging-units' . ($m[1] ?? '');
|
||||
} elseif (preg_match('#^admin/packaging-units(/.*)?$#', $p, $m)) {
|
||||
$cands[] = 'bag/packaging-units/manage' . ($m[1] ?? '');
|
||||
} elseif (str_starts_with($p, 'admin/')) {
|
||||
$cands[] = 'bag/' . substr($p, strlen('admin/'));
|
||||
} elseif (str_starts_with($p, 'bag/')) {
|
||||
$cands[] = 'admin/' . substr($p, strlen('bag/'));
|
||||
}
|
||||
|
||||
return array_values(array_unique($cands));
|
||||
}
|
||||
$out = [$p];
|
||||
if (str_starts_with($currentPath, 'admin/') || $currentPath === 'admin') {
|
||||
$out[] = 'admin/' . $p;
|
||||
}
|
||||
if (str_starts_with($currentPath, 'bag/') || $currentPath === 'bag') {
|
||||
$out[] = 'bag/' . $p;
|
||||
}
|
||||
|
||||
return array_values(array_unique($out));
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('menu_link_preferred_href_path')) {
|
||||
/**
|
||||
* base_url() 용 경로: 짧게 저장된 mm_link 는 현재 요청 기준 admin/·bag/ 후보 중 가장 알맞은 것 사용.
|
||||
*/
|
||||
function menu_link_preferred_href_path(?string $mmLink, string $currentPath): string
|
||||
{
|
||||
$cands = menu_link_candidate_paths($mmLink, $currentPath);
|
||||
if ($cands === []) {
|
||||
return '';
|
||||
}
|
||||
foreach ($cands as $c) {
|
||||
$cl = strtolower($currentPath);
|
||||
$cc = strtolower($c);
|
||||
if ($cl === $cc || str_starts_with($cl, $cc . '/')) {
|
||||
return $c;
|
||||
}
|
||||
}
|
||||
foreach ($cands as $c) {
|
||||
if (str_contains($c, '/')) {
|
||||
return $c;
|
||||
}
|
||||
}
|
||||
|
||||
return $cands[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('menu_single_path_matches_request')) {
|
||||
/**
|
||||
* 단일 정규 경로가 현재 요청 path 와 일치하는지.
|
||||
*
|
||||
* @param list<string> $dashboardPathAliases
|
||||
*/
|
||||
function menu_single_path_matches_request(string $path, string $currentPath, array $dashboardPathAliases = []): bool
|
||||
{
|
||||
if ($path === '') {
|
||||
return false;
|
||||
}
|
||||
$pathLower = strtolower($path);
|
||||
$currentLower = strtolower($currentPath);
|
||||
$aliasesLower = array_map(strtolower(...), $dashboardPathAliases);
|
||||
|
||||
if ($dashboardPathAliases !== []
|
||||
&& in_array($pathLower, $aliasesLower, true)
|
||||
&& in_array($currentLower, $aliasesLower, true)) {
|
||||
return true;
|
||||
}
|
||||
if ($currentLower === $pathLower) {
|
||||
return true;
|
||||
}
|
||||
if ($pathLower === 'admin') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return str_starts_with($currentLower, $pathLower . '/');
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('menu_link_matches_request')) {
|
||||
/**
|
||||
* 메뉴 mm_link(DB)가 현재 요청과 같은 메뉴인지. 비어 있으면 false.
|
||||
*
|
||||
* @param list<string> $dashboardPathAliases
|
||||
*/
|
||||
function menu_link_matches_request(?string $mmLink, string $currentPath, array $dashboardPathAliases = []): bool
|
||||
{
|
||||
foreach (menu_link_candidate_paths($mmLink, $currentPath) as $cand) {
|
||||
if (menu_single_path_matches_request($cand, $currentPath, $dashboardPathAliases)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('site_nav_link_matches_current')) {
|
||||
/**
|
||||
* 사이트 상단 메뉴 활성 여부 (경로 후보·대시보드 별칭은 menu_link_matches_request 와 동일).
|
||||
*
|
||||
* @param list<string> $dashboardPathAliases
|
||||
*/
|
||||
function site_nav_link_matches_current(?string $mmLink, string $currentPath, array $dashboardPathAliases = []): bool
|
||||
{
|
||||
return menu_link_matches_request($mmLink, $currentPath, $dashboardPathAliases);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('session_user_nav_display')) {
|
||||
/**
|
||||
* 상단 메뉴바용: 로그인 사용자 이름·역할 표시
|
||||
*
|
||||
* @return array{name: string, role_label: string}|null
|
||||
*/
|
||||
function session_user_nav_display(): ?array
|
||||
{
|
||||
if (! session()->get('logged_in')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$name = trim((string) session()->get('mb_name'));
|
||||
if ($name === '') {
|
||||
$name = (string) session()->get('mb_id');
|
||||
}
|
||||
|
||||
$level = (int) session()->get('mb_level');
|
||||
$roleLabel = config('Roles')->getLevelName($level);
|
||||
|
||||
return [
|
||||
'name' => $name,
|
||||
'role_label' => $roleLabel,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
*
|
||||
* 저장 형식: 암호화된 값은 "ENC:" + base64(암호문) 으로 저장. "ENC:" 없으면 평문(기존)으로 간주.
|
||||
*/
|
||||
|
||||
if (! function_exists('pii_encrypt')) {
|
||||
function pii_encrypt(?string $value): string
|
||||
{
|
||||
@@ -21,9 +22,8 @@ if (! function_exists('pii_encrypt')) {
|
||||
}
|
||||
$encrypter = service('encrypter');
|
||||
$encrypted = $encrypter->encrypt($value);
|
||||
|
||||
return 'ENC:' . base64_encode($encrypted);
|
||||
} catch (Throwable) {
|
||||
} catch (Throwable $e) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -44,13 +44,23 @@ if (! function_exists('pii_decrypt')) {
|
||||
return $value;
|
||||
}
|
||||
$encrypter = service('encrypter');
|
||||
$raw = base64_decode(substr($value, 4), true);
|
||||
if ($raw === false) {
|
||||
return $value;
|
||||
$payload = substr($value, 4);
|
||||
|
||||
// 현재 포맷: ENC: + base64(raw ciphertext)
|
||||
$raw = base64_decode($payload, true);
|
||||
if ($raw !== false) {
|
||||
try {
|
||||
return $encrypter->decrypt($raw);
|
||||
} catch (Throwable $e) {
|
||||
// legacy 포맷 재시도
|
||||
}
|
||||
}
|
||||
|
||||
return $encrypter->decrypt($raw);
|
||||
} catch (Throwable) {
|
||||
// 레거시 포맷 호환:
|
||||
// - ENC: + encrypter 반환값(rawData=false 환경 등) 또는
|
||||
// - ENC: + 기타 문자열 포맷
|
||||
return $encrypter->decrypt($payload);
|
||||
} catch (Throwable $e) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
@@ -12,6 +14,8 @@ class CodeDetailModel extends Model
|
||||
protected $useTimestamps = false;
|
||||
protected $allowedFields = [
|
||||
'cd_ck_idx',
|
||||
'cd_source',
|
||||
'cd_lg_idx',
|
||||
'cd_code',
|
||||
'cd_name',
|
||||
'cd_sort',
|
||||
@@ -20,14 +24,50 @@ class CodeDetailModel extends Model
|
||||
];
|
||||
|
||||
/**
|
||||
* 특정 코드 종류의 세부코드 목록
|
||||
* 목록 조회: 플랫폼(0) + (선택) 해당 지자체 행
|
||||
*
|
||||
* @param int|null $effectiveLgIdx null 또는 1 미만이면 플랫폼 공통만
|
||||
*/
|
||||
public function getByKind(int $ckIdx, bool $activeOnly = false): array
|
||||
public function filterByTenantScope(?int $effectiveLgIdx): self
|
||||
{
|
||||
$builder = $this->where('cd_ck_idx', $ckIdx);
|
||||
if ($effectiveLgIdx === null || $effectiveLgIdx < 1) {
|
||||
return $this->where('cd_lg_idx', 0);
|
||||
}
|
||||
|
||||
return $this->groupStart()
|
||||
->where('cd_lg_idx', 0)
|
||||
->orWhere('cd_lg_idx', $effectiveLgIdx)
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 코드 종류의 세부코드 목록
|
||||
*
|
||||
* @param int|null $effectiveLgIdx 테넌트 범위 (null=플랫폼만)
|
||||
*/
|
||||
public function getByKind(int $ckIdx, bool $activeOnly = false, ?int $effectiveLgIdx = null): array
|
||||
{
|
||||
$this->where('cd_ck_idx', $ckIdx);
|
||||
$this->filterByTenantScope($effectiveLgIdx);
|
||||
if ($activeOnly) {
|
||||
$builder->where('cd_state', 1);
|
||||
$this->where('cd_state', 1);
|
||||
}
|
||||
return $builder->orderBy('cd_sort', 'ASC')->findAll();
|
||||
|
||||
return $this->orderBy('cd_sort', 'ASC')->orderBy('cd_idx', 'ASC')->findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 동일 세부코드값: 지자체 전용이 있으면 우선, 없으면 플랫폼
|
||||
*/
|
||||
public function findResolvedByKindAndCode(int $ckIdx, string $code, ?int $effectiveLgIdx): ?object
|
||||
{
|
||||
if ($effectiveLgIdx !== null && $effectiveLgIdx > 0) {
|
||||
$local = $this->where('cd_ck_idx', $ckIdx)->where('cd_code', $code)->where('cd_lg_idx', $effectiveLgIdx)->first();
|
||||
if ($local !== null) {
|
||||
return $local;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->where('cd_ck_idx', $ckIdx)->where('cd_code', $code)->where('cd_lg_idx', 0)->first();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
@@ -11,7 +13,34 @@ class SalesAgencyModel extends Model
|
||||
protected $returnType = 'object';
|
||||
protected $useTimestamps = false;
|
||||
protected $allowedFields = [
|
||||
'sa_lg_idx', 'sa_name', 'sa_biz_no', 'sa_rep_name',
|
||||
'sa_tel', 'sa_addr', 'sa_state', 'sa_regdate',
|
||||
'sa_lg_idx',
|
||||
'sa_kind',
|
||||
'sa_code',
|
||||
'sa_name',
|
||||
'sa_regdate',
|
||||
];
|
||||
|
||||
/** sales_agency 테이블에 sa_kind, sa_code 컬럼이 있는지(마이그레이션 적용 여부). */
|
||||
public function hasKindCodeColumns(): bool
|
||||
{
|
||||
static $cache = null;
|
||||
if ($cache === null) {
|
||||
$cols = db_connect()->getFieldNames($this->table);
|
||||
$cache = in_array('sa_kind', $cols, true) && in_array('sa_code', $cols, true);
|
||||
}
|
||||
|
||||
return $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* 신규 스키마면 구분·코드 순, 아니면 명·PK 순(옛 DB 호환).
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function orderForDisplay()
|
||||
{
|
||||
return $this->hasKindCodeColumns()
|
||||
? $this->orderBy('sa_kind', 'ASC')->orderBy('sa_code', 'ASC')
|
||||
: $this->orderBy('sa_name', 'ASC')->orderBy('sa_idx', 'ASC');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<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/bag-inventory/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('bag-inventory/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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">무료용 불출 처리</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/bag-issues/store') ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('bag-issues/store') ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
|
||||
<a href="<?= base_url('admin/bag-issues') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('bag-issues') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
<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/bag-issues/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('bag-issues/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="p-2 bg-white border-b border-gray-200">
|
||||
<form method="GET" action="<?= base_url('admin/bag-issues') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="GET" action="<?= mgmt_url('bag-issues') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<label class="text-sm text-gray-600">불출일</label>
|
||||
<input type="date" name="start_date" value="<?= esc($startDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<label class="text-sm text-gray-600">~</label>
|
||||
<input type="date" name="end_date" value="<?= esc($endDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<button type="submit" class="bg-btn-search text-white px-4 py-1 rounded-sm text-sm">조회</button>
|
||||
<a href="<?= base_url('admin/bag-issues') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
|
||||
<a href="<?= mgmt_url('bag-issues') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
|
||||
</form>
|
||||
</section>
|
||||
<div class="border border-gray-300 overflow-auto mt-2">
|
||||
@@ -49,7 +49,7 @@
|
||||
<td><?= number_format((int) $row->bi2_qty) ?></td>
|
||||
<td class="text-center"><?= esc($row->bi2_status) ?></td>
|
||||
<td class="text-center">
|
||||
<form action="<?= base_url('admin/bag-issues/cancel/' . (int) $row->bi2_idx) ?>" method="POST" class="inline" onsubmit="return confirm('취소하시겠습니까?');">
|
||||
<form action="<?= mgmt_url('bag-issues/cancel/' . (int) $row->bi2_idx) ?>" method="POST" class="inline" onsubmit="return confirm('취소하시겠습니까?');">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="text-orange-600 hover:underline text-sm">취소</button>
|
||||
</form>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">발주 등록</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-4xl">
|
||||
<form action="<?= base_url('admin/bag-orders/store') ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('bag-orders/store') ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -34,7 +34,7 @@
|
||||
<option value="">선택</option>
|
||||
<?php foreach ($agencies as $ag): ?>
|
||||
<option value="<?= esc($ag->sa_idx) ?>" <?= (int) old('bo_agency_idx') === (int) $ag->sa_idx ? 'selected' : '' ?>>
|
||||
<?= esc($ag->sa_name) ?>
|
||||
[<?= esc($ag->sa_kind ?? '') ?>] <?= esc($ag->sa_code ?? '') ?> — <?= esc($ag->sa_name) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
|
||||
<a href="<?= base_url('admin/bag-orders') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('bag-orders') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="<?= base_url('admin/bag-orders') ?>" class="text-blue-600 hover:underline text-sm">← 발주 목록</a>
|
||||
<a href="<?= mgmt_url('bag-orders') ?>" class="text-blue-600 hover:underline text-sm">← 발주 목록</a>
|
||||
<span class="text-gray-400">|</span>
|
||||
<span class="text-sm font-bold text-gray-700">발주 상세 — <?= esc($order->bo_lot_no) ?></span>
|
||||
</div>
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
<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/bag-orders/export') . '?' . http_build_query(array_filter(['start_date' => $startDate ?? '', 'end_date' => $endDate ?? '', 'status' => $status ?? ''])) ?>" 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('bag-orders/export') . '?' . http_build_query(array_filter(['start_date' => $startDate ?? '', 'end_date' => $endDate ?? '', 'status' => $status ?? ''])) ?>" 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/bag-orders/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('bag-orders/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="p-2 bg-white border-b border-gray-200">
|
||||
<form method="GET" action="<?= base_url('admin/bag-orders') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="GET" action="<?= mgmt_url('bag-orders') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<label class="text-sm text-gray-600">발주일</label>
|
||||
<input type="date" name="start_date" value="<?= esc($startDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<label class="text-sm text-gray-600">~</label>
|
||||
@@ -23,7 +23,7 @@
|
||||
<option value="deleted" <?= ($status ?? '') === 'deleted' ? '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/bag-orders') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
|
||||
<a href="<?= mgmt_url('bag-orders') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
|
||||
</form>
|
||||
</section>
|
||||
<div class="border border-gray-300 overflow-auto mt-2">
|
||||
@@ -60,12 +60,12 @@
|
||||
?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<a href="<?= base_url('admin/bag-orders/detail/' . (int) $row->bo_idx) ?>" class="text-blue-600 hover:underline text-sm mr-1">상세</a>
|
||||
<form action="<?= base_url('admin/bag-orders/cancel/' . (int) $row->bo_idx) ?>" method="POST" class="inline" onsubmit="return confirm('취소하시겠습니까?');">
|
||||
<a href="<?= mgmt_url('bag-orders/detail/' . (int) $row->bo_idx) ?>" class="text-blue-600 hover:underline text-sm mr-1">상세</a>
|
||||
<form action="<?= mgmt_url('bag-orders/cancel/' . (int) $row->bo_idx) ?>" method="POST" class="inline" onsubmit="return confirm('취소하시겠습니까?');">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="text-orange-600 hover:underline text-sm mr-1">취소</button>
|
||||
</form>
|
||||
<form action="<?= base_url('admin/bag-orders/delete/' . (int) $row->bo_idx) ?>" method="POST" class="inline" onsubmit="return confirm('삭제하시겠습니까?');">
|
||||
<form action="<?= mgmt_url('bag-orders/delete/' . (int) $row->bo_idx) ?>" method="POST" class="inline" onsubmit="return confirm('삭제하시겠습니까?');">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="text-red-600 hover:underline text-sm">삭제</button>
|
||||
</form>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">봉투 단가 등록</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/bag-prices/store') ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('bag-prices/store') ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
|
||||
<a href="<?= base_url('admin/bag-prices') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('bag-prices') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">봉투 단가 수정</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/bag-prices/update/' . (int) $item->bp_idx) ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('bag-prices/update/' . (int) $item->bp_idx) ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">수정</button>
|
||||
<a href="<?= base_url('admin/bag-prices') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('bag-prices') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="<?= base_url('admin/bag-prices') ?>" class="text-blue-600 hover:underline text-sm">← 단가 목록</a>
|
||||
<a href="<?= mgmt_url('bag-prices') ?>" class="text-blue-600 hover:underline text-sm">← 단가 목록</a>
|
||||
<span class="text-gray-400">|</span>
|
||||
<span class="text-sm font-bold text-gray-700">단가 변경 이력 — <?= esc($item->bp_bag_name) ?> (<?= esc($item->bp_bag_code) ?>)</span>
|
||||
</div>
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
<?= view('components/print_header', ['printTitle' => '봉투 단가 관리']) ?>
|
||||
<style>
|
||||
@media print {
|
||||
.no-print { display: none !important; }
|
||||
}
|
||||
</style>
|
||||
<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">
|
||||
<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/bag-prices/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 class="flex items-center gap-2 no-print">
|
||||
<button onclick="window.print()" class="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('bag/prices') ?>" class="text-blue-600 hover:underline text-sm">단가 조회·검색</a>
|
||||
<a href="<?= mgmt_url('bag-prices/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="p-2 bg-white border-b border-gray-200">
|
||||
<form method="GET" action="<?= base_url('admin/bag-prices') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<label class="text-sm text-gray-600">적용시작일</label>
|
||||
<input type="date" name="start_date" value="<?= esc($startDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<label class="text-sm text-gray-600">~</label>
|
||||
<input type="date" name="end_date" value="<?= esc($endDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<button type="submit" class="bg-btn-search text-white px-4 py-1 rounded-sm text-sm">조회</button>
|
||||
<a href="<?= base_url('admin/bag-prices') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
|
||||
</form>
|
||||
</section>
|
||||
<p class="text-xs text-gray-500 mt-2 no-print">목록·등록·수정·삭제는 이 화면에서, <strong>기간·봉투별 조회·인쇄</strong>는 <a href="<?= base_url('bag/prices') ?>" class="text-blue-600 hover:underline">봉투 단가(조회)</a>에서 이용하세요.</p>
|
||||
<div class="border border-gray-300 overflow-auto mt-2">
|
||||
<table class="w-full data-table">
|
||||
<thead>
|
||||
@@ -31,7 +28,7 @@
|
||||
<th>적용시작</th>
|
||||
<th>적용종료</th>
|
||||
<th class="w-20">상태</th>
|
||||
<th class="w-36">작업</th>
|
||||
<th class="w-36 no-print">작업</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-right">
|
||||
@@ -46,10 +43,10 @@
|
||||
<td class="text-center"><?= esc($row->bp_start_date) ?></td>
|
||||
<td class="text-center"><?= esc($row->bp_end_date ?? '현재') ?></td>
|
||||
<td class="text-center"><?= (int) $row->bp_state === 1 ? '사용' : '미사용' ?></td>
|
||||
<td class="text-center">
|
||||
<a href="<?= base_url('admin/bag-prices/history/' . (int) $row->bp_idx) ?>" class="text-green-600 hover:underline text-sm mr-1">이력</a>
|
||||
<a href="<?= base_url('admin/bag-prices/edit/' . (int) $row->bp_idx) ?>" class="text-blue-600 hover:underline text-sm mr-1">수정</a>
|
||||
<form action="<?= base_url('admin/bag-prices/delete/' . (int) $row->bp_idx) ?>" method="POST" class="inline" onsubmit="return confirm('삭제하시겠습니까?');">
|
||||
<td class="text-center no-print">
|
||||
<a href="<?= mgmt_url('bag-prices/history/' . (int) $row->bp_idx) ?>" class="text-green-600 hover:underline text-sm mr-1">이력</a>
|
||||
<a href="<?= mgmt_url('bag-prices/edit/' . (int) $row->bp_idx) ?>" class="text-blue-600 hover:underline text-sm mr-1">수정</a>
|
||||
<form action="<?= mgmt_url('bag-prices/delete/' . (int) $row->bp_idx) ?>" method="POST" class="inline" onsubmit="return confirm('삭제하시겠습니까?');">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="text-red-600 hover:underline text-sm">삭제</button>
|
||||
</form>
|
||||
@@ -62,4 +59,4 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php if (isset($pager)): ?><div class="mt-3"><?= $pager->links() ?></div><?php endif; ?>
|
||||
<?php if (isset($pager)): ?><div class="mt-3 no-print"><?= $pager->links() ?></div><?php endif; ?>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">입고 처리</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/bag-receivings/store') ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('bag-receivings/store') ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
|
||||
<a href="<?= base_url('admin/bag-receivings') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('bag-receivings') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
<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/bag-receivings/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('bag-receivings/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="p-2 bg-white border-b border-gray-200">
|
||||
<form method="GET" action="<?= base_url('admin/bag-receivings') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="GET" action="<?= mgmt_url('bag-receivings') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<label class="text-sm text-gray-600">입고일</label>
|
||||
<input type="date" name="start_date" value="<?= esc($startDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<label class="text-sm text-gray-600">~</label>
|
||||
<input type="date" name="end_date" value="<?= esc($endDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<button type="submit" class="bg-btn-search text-white px-4 py-1 rounded-sm text-sm">조회</button>
|
||||
<a href="<?= base_url('admin/bag-receivings') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
|
||||
<a href="<?= mgmt_url('bag-receivings') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
|
||||
</form>
|
||||
</section>
|
||||
<div class="border border-gray-300 overflow-auto mt-2">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">판매 등록</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/bag-sales/store') ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('bag-sales/store') ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
|
||||
<a href="<?= base_url('admin/bag-sales') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('bag-sales') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
<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/bag-sales/export') . '?' . http_build_query(array_filter(['start_date' => $startDate ?? '', 'end_date' => $endDate ?? '', 'type' => $type ?? ''])) ?>" 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('bag-sales/export') . '?' . http_build_query(array_filter(['start_date' => $startDate ?? '', 'end_date' => $endDate ?? '', 'type' => $type ?? ''])) ?>" 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/bag-sales/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('bag-sales/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="p-2 bg-white border-b border-gray-200">
|
||||
<form method="GET" action="<?= base_url('admin/bag-sales') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="GET" action="<?= mgmt_url('bag-sales') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<label class="text-sm text-gray-600">판매일</label>
|
||||
<input type="date" name="start_date" value="<?= esc($startDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<label class="text-sm text-gray-600">~</label>
|
||||
@@ -23,7 +23,7 @@
|
||||
<option value="cancel" <?= ($type ?? '') === 'cancel' ? '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/bag-sales') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
|
||||
<a href="<?= mgmt_url('bag-sales') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
|
||||
</form>
|
||||
</section>
|
||||
<div class="border border-gray-300 overflow-auto mt-2">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="<?= base_url('admin/code-details/' . (int) $kind->ck_idx) ?>" class="text-blue-600 hover:underline text-sm">← <?= esc($kind->ck_name) ?></a>
|
||||
<a href="<?= base_url('bag/code-details/' . (int) $kind->ck_idx) ?>" class="text-blue-600 hover:underline text-sm">← <?= esc($kind->ck_name) ?></a>
|
||||
<span class="text-gray-400">|</span>
|
||||
<span class="text-sm font-bold text-gray-700">세부코드 등록</span>
|
||||
</div>
|
||||
@@ -30,9 +30,42 @@
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-24" name="cd_sort" type="number" value="<?= esc(old('cd_sort', '0')) ?>" min="0"/>
|
||||
</div>
|
||||
|
||||
<?php if (! empty($canPlatformScope)): ?>
|
||||
<div class="space-y-2 border-t border-gray-200 pt-3">
|
||||
<p class="text-sm font-bold text-gray-700">등록 범위</p>
|
||||
<label class="flex items-center gap-2 text-sm">
|
||||
<input type="radio" name="cd_scope" value="platform" <?= old('cd_scope', 'platform') === 'platform' ? 'checked' : '' ?> class="cd-scope-radio"/>
|
||||
플랫폼 공통 (CSV·시드와 동일 — 전 지자체, super/본부만 이후 수정)
|
||||
</label>
|
||||
<label class="flex items-center gap-2 text-sm">
|
||||
<input type="radio" name="cd_scope" value="local" <?= old('cd_scope') === 'local' ? 'checked' : '' ?> class="cd-scope-radio"/>
|
||||
지자체 전용 (해당 지자체 관리자가 수정·삭제)
|
||||
</label>
|
||||
<div id="cd-lg-wrap" class="<?= old('cd_scope') === 'local' ? '' : 'hidden' ?> flex flex-wrap items-center gap-2">
|
||||
<label class="block text-sm font-bold text-gray-700 w-28">소속 지자체</label>
|
||||
<select name="cd_lg_idx" class="border border-gray-300 rounded px-3 py-1.5 text-sm min-w-[14rem]">
|
||||
<option value="">선택</option>
|
||||
<?php foreach ($localGovernments as $gov): ?>
|
||||
<option value="<?= (int) $gov->lg_idx ?>" <?= (string) old('cd_lg_idx') === (string) $gov->lg_idx ? 'selected' : '' ?>><?= esc($gov->lg_name) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function () {
|
||||
document.querySelectorAll('.cd-scope-radio').forEach(function (r) {
|
||||
r.addEventListener('change', function () {
|
||||
var w = document.getElementById('cd-lg-wrap');
|
||||
if (w) w.classList.toggle('hidden', document.querySelector('input[name="cd_scope"][value="local"]:checked') === null);
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
|
||||
<a href="<?= base_url('admin/code-details/' . (int) $kind->ck_idx) ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= base_url('bag/code-details/' . (int) $kind->ck_idx) ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="<?= base_url('admin/code-details/' . (int) $kind->ck_idx) ?>" class="text-blue-600 hover:underline text-sm">← <?= esc($kind->ck_name) ?></a>
|
||||
<a href="<?= base_url('bag/code-details/' . (int) $kind->ck_idx) ?>" class="text-blue-600 hover:underline text-sm">← <?= esc($kind->ck_name) ?></a>
|
||||
<span class="text-gray-400">|</span>
|
||||
<span class="text-sm font-bold text-gray-700">세부코드 수정</span>
|
||||
</div>
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">수정</button>
|
||||
<a href="<?= base_url('admin/code-details/' . (int) $kind->ck_idx) ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= base_url('bag/code-details/' . (int) $kind->ck_idx) ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
<?= view('components/print_header', ['printTitle' => '세부코드 관리 - ' . esc($kind->ck_name)]) ?>
|
||||
<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">
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="<?= base_url('admin/code-kinds') ?>" class="text-blue-600 hover:underline text-sm">← 코드 종류</a>
|
||||
<span class="text-gray-400">|</span>
|
||||
<span class="text-sm font-bold text-gray-700">세부코드 — <?= esc($kind->ck_name) ?> (<?= esc($kind->ck_code) ?>)</span>
|
||||
</div>
|
||||
<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/code-details/' . (int) $kind->ck_idx . '/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>
|
||||
<div class="border border-gray-300 overflow-auto mt-2">
|
||||
<table class="w-full data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="w-16">번호</th>
|
||||
<th class="w-24">코드</th>
|
||||
<th>코드명</th>
|
||||
<th class="w-20">정렬순서</th>
|
||||
<th class="w-20">상태</th>
|
||||
<th>등록일</th>
|
||||
<th class="w-28">작업</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-right">
|
||||
<?php foreach ($list as $row): ?>
|
||||
<tr>
|
||||
<td class="text-center"><?= esc($row->cd_idx) ?></td>
|
||||
<td class="text-center font-mono"><?= esc($row->cd_code) ?></td>
|
||||
<td class="text-left pl-2"><?= esc($row->cd_name) ?></td>
|
||||
<td class="text-center"><?= (int) $row->cd_sort ?></td>
|
||||
<td class="text-center"><?= (int) $row->cd_state === 1 ? '사용' : '미사용' ?></td>
|
||||
<td class="text-left pl-2"><?= esc($row->cd_regdate ?? '') ?></td>
|
||||
<td class="text-center">
|
||||
<a href="<?= base_url('admin/code-details/edit/' . (int) $row->cd_idx) ?>" class="text-blue-600 hover:underline text-sm">수정</a>
|
||||
<form action="<?= base_url('admin/code-details/delete/' . (int) $row->cd_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>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php if (isset($pager)): ?><div class="mt-3"><?= $pager->links() ?></div><?php endif; ?>
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
|
||||
<a href="<?= base_url('admin/code-kinds') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= base_url('bag/code-kinds') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">수정</button>
|
||||
<a href="<?= base_url('admin/code-kinds') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= base_url('bag/code-kinds') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
<?= 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">
|
||||
<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/code-kinds/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>
|
||||
<div class="border border-gray-300 overflow-auto mt-2">
|
||||
<table class="w-full data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="w-16">번호</th>
|
||||
<th class="w-20">코드</th>
|
||||
<th>코드명</th>
|
||||
<th class="w-24">세부코드 수</th>
|
||||
<th class="w-20">상태</th>
|
||||
<th>등록일</th>
|
||||
<th class="w-40">작업</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-right">
|
||||
<?php foreach ($list as $row): ?>
|
||||
<tr>
|
||||
<td class="text-center"><?= esc($row->ck_idx) ?></td>
|
||||
<td class="text-center font-mono font-bold"><?= esc($row->ck_code) ?></td>
|
||||
<td class="text-left pl-2"><?= esc($row->ck_name) ?></td>
|
||||
<td class="text-center">
|
||||
<a href="<?= base_url('admin/code-details/' . (int) $row->ck_idx) ?>" class="text-blue-600 hover:underline"><?= (int) ($countMap[$row->ck_idx] ?? 0) ?>개</a>
|
||||
</td>
|
||||
<td class="text-center"><?= (int) $row->ck_state === 1 ? '사용' : '미사용' ?></td>
|
||||
<td class="text-left pl-2"><?= esc($row->ck_regdate ?? '') ?></td>
|
||||
<td class="text-center">
|
||||
<a href="<?= base_url('admin/code-details/' . (int) $row->ck_idx) ?>" class="text-green-600 hover:underline text-sm mr-1">세부코드</a>
|
||||
<a href="<?= base_url('admin/code-kinds/edit/' . (int) $row->ck_idx) ?>" class="text-blue-600 hover:underline text-sm mr-1">수정</a>
|
||||
<form action="<?= base_url('admin/code-kinds/delete/' . (int) $row->ck_idx) ?>" method="POST" class="inline" onsubmit="return confirm('이 코드 종류를 삭제하시겠습니까?');">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="text-red-600 hover:underline text-sm">삭제</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php if (isset($pager)): ?><div class="mt-3"><?= $pager->links() ?></div><?php endif; ?>
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">업체 등록</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/companies/store') ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('companies/store') ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
|
||||
<a href="<?= base_url('admin/companies') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('companies') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">업체 수정</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/companies/update/' . (int) $item->cp_idx) ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('companies/update/' . (int) $item->cp_idx) ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">수정</button>
|
||||
<a href="<?= base_url('admin/companies') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('companies') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -4,35 +4,10 @@
|
||||
<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/companies/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('companies/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="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>
|
||||
@@ -60,8 +35,8 @@
|
||||
<td class="text-left pl-2"><?= esc($row->cp_addr) ?></td>
|
||||
<td class="text-center"><?= (int) $row->cp_state === 1 ? '사용' : '미사용' ?></td>
|
||||
<td class="text-center">
|
||||
<a href="<?= base_url('admin/companies/edit/' . (int) $row->cp_idx) ?>" class="text-blue-600 hover:underline text-sm mr-1">수정</a>
|
||||
<form action="<?= base_url('admin/companies/delete/' . (int) $row->cp_idx) ?>" method="POST" class="inline" onsubmit="return confirm('삭제하시겠습니까?');">
|
||||
<a href="<?= mgmt_url('companies/edit/' . (int) $row->cp_idx) ?>" class="text-blue-600 hover:underline text-sm mr-1">수정</a>
|
||||
<form action="<?= mgmt_url('companies/delete/' . (int) $row->cp_idx) ?>" method="POST" class="inline" onsubmit="return confirm('삭제하시겠습니까?');">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="text-red-600 hover:underline text-sm">삭제</button>
|
||||
</form>
|
||||
|
||||
@@ -6,6 +6,15 @@
|
||||
</div>
|
||||
<?php else: ?>
|
||||
|
||||
<?php if (! empty($s['stats_unavailable'])): ?>
|
||||
<div class="border border-amber-300 bg-amber-50 p-4 text-sm text-amber-900 mb-4">
|
||||
발주·판매·재고·불출 통계 테이블이 아직 없거나 조회에 실패했습니다. MySQL에서
|
||||
<code class="text-xs bg-white px-1 rounded">writable/database/order_tables.sql</code>과
|
||||
<code class="text-xs bg-white px-1 rounded">writable/database/sales_tables.sql</code>을
|
||||
<code class="text-xs bg-white px-1 rounded">jongryangje_dev</code> DB에 실행해 주세요.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- 통계 카드 -->
|
||||
<div class="grid grid-cols-2 md:grid-cols-4 gap-3 mb-4">
|
||||
<div class="border border-gray-300 p-4 bg-white">
|
||||
@@ -36,7 +45,7 @@
|
||||
<div>
|
||||
<div class="flex items-center justify-between mb-1">
|
||||
<h3 class="text-sm font-bold text-gray-700">최근 발주 5건</h3>
|
||||
<a href="<?= base_url('admin/bag-orders') ?>" class="text-xs text-blue-600 hover:underline">전체보기</a>
|
||||
<a href="<?= base_url('bag/bag-orders') ?>" class="text-xs text-blue-600 hover:underline">전체보기</a>
|
||||
</div>
|
||||
<div class="border border-gray-300 overflow-auto">
|
||||
<table class="w-full data-table">
|
||||
@@ -54,7 +63,7 @@
|
||||
?>
|
||||
<tr>
|
||||
<td class="font-mono text-sm">
|
||||
<a href="<?= base_url('admin/bag-orders/detail/' . (int) $order->bo_idx) ?>" class="text-blue-600 hover:underline"><?= esc($order->bo_lot_no) ?></a>
|
||||
<a href="<?= base_url('bag/bag-orders/detail/' . (int) $order->bo_idx) ?>" class="text-blue-600 hover:underline"><?= esc($order->bo_lot_no) ?></a>
|
||||
</td>
|
||||
<td><?= esc($order->bo_order_date) ?></td>
|
||||
<td>
|
||||
@@ -81,7 +90,7 @@
|
||||
<div>
|
||||
<div class="flex items-center justify-between mb-1">
|
||||
<h3 class="text-sm font-bold text-gray-700">최근 판매 5건</h3>
|
||||
<a href="<?= base_url('admin/bag-sales') ?>" class="text-xs text-blue-600 hover:underline">전체보기</a>
|
||||
<a href="<?= base_url('bag/bag-sales') ?>" class="text-xs text-blue-600 hover:underline">전체보기</a>
|
||||
</div>
|
||||
<div class="border border-gray-300 overflow-auto">
|
||||
<table class="w-full data-table">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">지정판매소 등록</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/designated-shops/store') ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('designated-shops/store') ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<?php if (! empty($localGovs)): ?>
|
||||
@@ -95,7 +95,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-4 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
|
||||
<a href="<?= base_url('admin/designated-shops') ?>" class="bg-white text-black border border-btn-print-border px-4 py-1.5 rounded-sm text-sm shadow hover:bg-gray-50 transition">목록</a>
|
||||
<a href="<?= mgmt_url('designated-shops') ?>" class="bg-white text-black border border-btn-print-border px-4 py-1.5 rounded-sm text-sm shadow hover:bg-gray-50 transition">목록</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -10,7 +10,7 @@ $v = fn ($key, $default = '') => old($key) !== null && old($key) !== '' ? old($k
|
||||
<span class="text-sm font-bold text-gray-700">지정판매소 수정</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/designated-shops/update/' . (int) $shop->ds_idx) ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('designated-shops/update/' . (int) $shop->ds_idx) ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<?php if ($currentLg !== null): ?>
|
||||
@@ -99,7 +99,7 @@ $v = fn ($key, $default = '') => old($key) !== null && old($key) !== '' ? old($k
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-4 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">수정</button>
|
||||
<a href="<?= base_url('admin/designated-shops') ?>" class="bg-white text-black border border-btn-print-border px-4 py-1.5 rounded-sm text-sm shadow hover:bg-gray-50 transition">목록</a>
|
||||
<a href="<?= mgmt_url('designated-shops') ?>" class="bg-white text-black border border-btn-print-border px-4 py-1.5 rounded-sm text-sm shadow hover:bg-gray-50 transition">목록</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<?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">
|
||||
@@ -51,24 +50,17 @@
|
||||
</thead>
|
||||
<tbody class="text-right">
|
||||
<?php foreach ($list as $row): ?>
|
||||
<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>
|
||||
<tr>
|
||||
<td class="text-center"><?= esc($row->ds_idx) ?></td>
|
||||
<td class="text-left pl-2"><?= esc($lgMap[$row->ds_lg_idx] ?? '') ?></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_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"><?= 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="<?= 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() ?>
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
<?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>
|
||||
<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>
|
||||
</div>
|
||||
</section>
|
||||
<div id="kakao-map" class="w-full border border-gray-300 mt-2" style="height:600px;"></div>
|
||||
@@ -28,7 +25,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' => mask_person_name($s->ds_rep_name ?? null), 'tel' => $s->ds_tel ?? ''];
|
||||
return ['name' => $s->ds_name, 'addr' => $s->ds_addr ?? '', 'rep' => $s->ds_rep_name ?? '', 'tel' => $s->ds_tel ?? ''];
|
||||
}, $shops), JSON_UNESCAPED_UNICODE) ?>;
|
||||
|
||||
var bounds = new kakao.maps.LatLngBounds();
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
<?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>
|
||||
@@ -4,7 +4,7 @@
|
||||
<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/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>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">대상자 등록</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/free-recipients/store') ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('free-recipients/store') ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
|
||||
<a href="<?= base_url('admin/free-recipients') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('free-recipients') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">대상자 수정</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/free-recipients/update/' . (int) $item->fr_idx) ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('free-recipients/update/' . (int) $item->fr_idx) ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">수정</button>
|
||||
<a href="<?= base_url('admin/free-recipients') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('free-recipients') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -4,35 +4,10 @@
|
||||
<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/free-recipients/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('free-recipients/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="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>
|
||||
@@ -42,7 +17,7 @@
|
||||
<th>대상자명</th>
|
||||
<th>연락처</th>
|
||||
<th>주소</th>
|
||||
<th>동</th>
|
||||
<th>동코드</th>
|
||||
<th>비고</th>
|
||||
<th>종료일</th>
|
||||
<th class="w-20">상태</th>
|
||||
@@ -53,17 +28,17 @@
|
||||
<?php foreach ($list as $row): ?>
|
||||
<tr>
|
||||
<td class="text-center"><?= esc($row->fr_idx) ?></td>
|
||||
<td class="text-center"><?= esc($type_code_map[(string) ($row->fr_type_code ?? '')] ?? ($row->fr_type_code ?? '')) ?></td>
|
||||
<td class="text-center"><?= esc($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($dong_code_map[(string) ($row->fr_dong_code ?? '')] ?? ($row->fr_dong_code ?? '')) ?></td>
|
||||
<td class="text-center"><?= esc($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>
|
||||
<td class="text-center">
|
||||
<a href="<?= base_url('admin/free-recipients/edit/' . (int) $row->fr_idx) ?>" class="text-blue-600 hover:underline text-sm mr-1">수정</a>
|
||||
<form action="<?= base_url('admin/free-recipients/delete/' . (int) $row->fr_idx) ?>" method="POST" class="inline" onsubmit="return confirm('삭제하시겠습니까?');">
|
||||
<a href="<?= mgmt_url('free-recipients/edit/' . (int) $row->fr_idx) ?>" class="text-blue-600 hover:underline text-sm mr-1">수정</a>
|
||||
<form action="<?= mgmt_url('free-recipients/delete/' . (int) $row->fr_idx) ?>" method="POST" class="inline" onsubmit="return confirm('삭제하시겠습니까?');">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="text-red-600 hover:underline text-sm">삭제</button>
|
||||
</form>
|
||||
@@ -71,7 +46,12 @@
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php if (empty($list)): ?>
|
||||
<tr><td colspan="10" class="text-center text-gray-400 py-4">등록된 데이터가 없습니다.</td></tr>
|
||||
<tr>
|
||||
<td colspan="10" class="text-center text-gray-500 py-4 text-sm space-y-1">
|
||||
<p>등록된 데이터가 없습니다.</p>
|
||||
<p class="text-gray-400">다른 지자체를 선택 중이면 해당 지자체 기준으로만 조회됩니다. Super Admin 은 상단에서 작업 지자체를 바꿔 보세요.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -12,15 +12,17 @@ if ($effectiveLgIdx) {
|
||||
$lgRow = model(\App\Models\LocalGovernmentModel::class)->find($effectiveLgIdx);
|
||||
$effectiveLgName = $lgRow ? $lgRow->lg_name : null;
|
||||
}
|
||||
$currentPath = trim((string) $uriObj->getPath(), '/');
|
||||
if (str_starts_with($currentPath, 'index.php/')) {
|
||||
$currentPath = substr($currentPath, strlen('index.php/'));
|
||||
}
|
||||
$userNav = session_user_nav_display();
|
||||
$currentPath = current_nav_request_path();
|
||||
$adminNavTree = get_admin_nav_tree();
|
||||
$isActive = static function (string $path) use ($uri, $seg3, $currentPath, $adminNavTree) {
|
||||
if (! empty($adminNavTree)) {
|
||||
return $currentPath === trim($path, '/');
|
||||
}
|
||||
|
||||
/** DB 링크(mm_link)만 사용. 짧게 적은 항목(menus 등)은 실제 URI(admin/menus)와 맞춰 후보 비교 */
|
||||
$adminNavItemIsCurrent = static function (?string $mmLink) use ($currentPath): bool {
|
||||
return menu_link_matches_request($mmLink, $currentPath, []);
|
||||
};
|
||||
|
||||
/** 메뉴가 DB에서 안 쓰일 때만(폴백 상단바) 세그먼트 기반 활성 */
|
||||
$isActive = static function (string $path) use ($uri, $seg3) {
|
||||
if ($path === 'admin' || $path === '') return $uri === '';
|
||||
if ($path === 'users') return $uri === 'users';
|
||||
if ($path === 'login-history') return $uri === 'access' && $seg3 === 'login-history';
|
||||
@@ -38,7 +40,7 @@ $isActive = static function (string $path) use ($uri, $seg3, $currentPath, $admi
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||
<title><?= esc($title ?? '관리자') ?> - 쓰레기봉투 물류시스템</title>
|
||||
<title><?= esc($title ?? '관리자') ?> - 종량제 시스템</title>
|
||||
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap" rel="stylesheet"/>
|
||||
<script>
|
||||
@@ -81,34 +83,53 @@ body { overflow: hidden; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="bg-gray-100 text-gray-800 flex flex-col h-screen font-sans antialiased select-none">
|
||||
<header class="bg-white border-b border-gray-300 h-12 flex items-center justify-between px-4 shrink-0 z-20">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="w-6 h-6 flex items-center justify-center shrink-0">
|
||||
<svg class="h-5 w-5" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="16" height="16" fill="#2563eb"/><rect x="2" y="2" width="7" height="7" fill="white"/><rect x="5" y="5" width="9" height="9" fill="white"/>
|
||||
</svg>
|
||||
</div>
|
||||
<a href="<?= base_url('admin') ?>" class="text-base font-semibold text-gray-800 tracking-tight hover:text-blue-600">쓰레기봉투 물류시스템</a>
|
||||
<header class="relative bg-white border-b border-gray-300 h-12 flex items-center justify-between px-4 shrink-0 z-50">
|
||||
<div class="flex items-center gap-2 shrink-0">
|
||||
<?= view('components/header_brand', ['href' => base_url('admin')]) ?>
|
||||
</div>
|
||||
<nav class="hidden md:flex gap-5 text-sm font-medium text-gray-600">
|
||||
<?php if (! empty($adminNavTree)): ?>
|
||||
<?php foreach ($adminNavTree as $navItem): ?>
|
||||
<?php $hasChildren = ! empty($navItem->children); ?>
|
||||
<?php
|
||||
$hasChildren = ! empty($navItem->children);
|
||||
$parentLink = menu_link_preferred_href_path($navItem->mm_link ?? null, $currentPath);
|
||||
$parentIsCurrent = $adminNavItemIsCurrent($navItem->mm_link ?? null);
|
||||
if (! $parentIsCurrent && $hasChildren) {
|
||||
foreach ($navItem->children as $ch) {
|
||||
if ($adminNavItemIsCurrent($ch->mm_link ?? null)) {
|
||||
$parentIsCurrent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="relative group">
|
||||
<a class="<?= $isActive($navItem->mm_link) ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>"
|
||||
href="<?= base_url($navItem->mm_link) ?>">
|
||||
<a class="<?= $parentIsCurrent ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>"
|
||||
href="<?= $parentLink !== '' ? base_url($parentLink) : '#' ?>">
|
||||
<?= esc($navItem->mm_name) ?>
|
||||
</a>
|
||||
<?php if ($hasChildren): ?>
|
||||
<div class="absolute left-0 top-full hidden group-hover:block bg-white border border-gray-200 rounded shadow-lg min-w-[10rem] z-30">
|
||||
<?php /* 사이트 메뉴와 동일: 호버 끊김 방지 pt-1, 키보드 포커스, z-index */ ?>
|
||||
<div class="absolute left-0 top-full z-50 hidden pt-1 min-w-[12rem] group-hover:block group-focus-within:block">
|
||||
<div class="bg-white border border-gray-200 rounded shadow-lg py-1">
|
||||
<?php foreach ($navItem->children as $child): ?>
|
||||
<a href="<?= base_url($child->mm_link) ?>"
|
||||
class="block px-3 py-1.5 text-sm text-gray-700 hover:bg-blue-50 whitespace-nowrap">
|
||||
<?php
|
||||
$childLink = menu_link_preferred_href_path($child->mm_link ?? null, $currentPath);
|
||||
$childIsCurrent = $adminNavItemIsCurrent($child->mm_link ?? null);
|
||||
?>
|
||||
<?php if ($childLink !== ''): ?>
|
||||
<a href="<?= base_url($childLink) ?>"
|
||||
class="block px-3 py-1.5 text-sm hover:bg-blue-50 whitespace-nowrap <?= $childIsCurrent ? 'text-blue-700 font-semibold bg-blue-50' : 'text-gray-700' ?>">
|
||||
<?= esc($child->mm_name) ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<span class="block px-3 py-1.5 text-sm text-gray-400 cursor-default whitespace-nowrap" title="메뉴 관리에서 링크를 설정해 주세요">
|
||||
<?= esc($child->mm_name) ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
@@ -123,19 +144,15 @@ body { overflow: hidden; }
|
||||
<a class="<?= $isActive('select-local-government') ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>" href="<?= base_url('admin/select-local-government') ?>">지자체 전환</a>
|
||||
<a class="<?= $isActive('local-governments') ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>" href="<?= base_url('admin/local-governments') ?>">지자체</a>
|
||||
<?php endif; ?>
|
||||
<a class="<?= $isActive('designated-shops') ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>" href="<?= base_url('admin/designated-shops') ?>">지정판매소</a>
|
||||
<a class="<?= $isActive('designated-shops') ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>" href="<?= base_url('bag/designated-shops') ?>">지정판매소</a>
|
||||
<?php endif; ?>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
<?php if ($effectiveLgName !== null): ?>
|
||||
<span class="text-sm text-gray-600" title="현재 작업 지자체"><?= esc($effectiveLgName) ?></span>
|
||||
<?php endif; ?>
|
||||
<a href="<?= base_url('/') ?>" class="text-gray-500 hover:text-blue-600 text-sm">사이트</a>
|
||||
<a href="<?= base_url('logout') ?>" class="text-gray-500 hover:text-red-600 transition-colors inline-block p-1 rounded hover:bg-red-50" title="로그아웃">
|
||||
<svg class="h-5 w-5 inline" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M6 18L18 6M6 6l12 12" stroke-linecap="round" stroke-linejoin="round"/></svg> 종료
|
||||
</a>
|
||||
</div>
|
||||
<?= view('components/header_user_tools', [
|
||||
'userNav' => $userNav,
|
||||
'effectiveLgName' => $effectiveLgName,
|
||||
'showSiteLink' => true,
|
||||
'showAdminLink' => false,
|
||||
]) ?>
|
||||
</header>
|
||||
<div class="bg-title-bar text-white px-4 py-2 text-sm font-medium shrink-0">
|
||||
<?= esc($title ?? '관리자') ?>
|
||||
@@ -155,7 +172,7 @@ body { overflow: hidden; }
|
||||
<?= $content ?>
|
||||
</main>
|
||||
<footer class="bg-gray-200 border-t border-gray-300 px-4 py-1 text-xs text-gray-600 flex items-center justify-between shrink-0">
|
||||
<span>쓰레기봉투 물류시스템 관리자</span>
|
||||
<span>종량제 시스템 관리자</span>
|
||||
<span><?= date('Y.m.d (D) g:i:sA') ?></span>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">담당자 등록</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/managers/store') ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('managers/store') ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
|
||||
<a href="<?= base_url('admin/managers') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('managers') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">담당자 수정</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/managers/update/' . (int) $item->mg_idx) ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('managers/update/' . (int) $item->mg_idx) ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">수정</button>
|
||||
<a href="<?= base_url('admin/managers') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('managers') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -4,35 +4,10 @@
|
||||
<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/managers/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('managers/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="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>
|
||||
@@ -53,15 +28,15 @@
|
||||
<tr>
|
||||
<td class="text-center"><?= esc($row->mg_idx) ?></td>
|
||||
<td class="text-center"><?= esc($row->mg_name) ?></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_dept_code) ?></td>
|
||||
<td class="text-center"><?= esc($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>
|
||||
<td class="text-center"><?= (int) $row->mg_state === 1 ? '사용' : '미사용' ?></td>
|
||||
<td class="text-center">
|
||||
<a href="<?= base_url('admin/managers/edit/' . (int) $row->mg_idx) ?>" class="text-blue-600 hover:underline text-sm mr-1">수정</a>
|
||||
<form action="<?= base_url('admin/managers/delete/' . (int) $row->mg_idx) ?>" method="POST" class="inline" onsubmit="return confirm('삭제하시겠습니까?');">
|
||||
<a href="<?= mgmt_url('managers/edit/' . (int) $row->mg_idx) ?>" class="text-blue-600 hover:underline text-sm mr-1">수정</a>
|
||||
<form action="<?= mgmt_url('managers/delete/' . (int) $row->mg_idx) ?>" method="POST" class="inline" onsubmit="return confirm('삭제하시겠습니까?');">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="text-red-600 hover:underline text-sm">삭제</button>
|
||||
</form>
|
||||
|
||||
@@ -4,6 +4,29 @@ $list = $list ?? [];
|
||||
$mtIdx = (int) ($mtIdx ?? 0);
|
||||
$mtCode = (string) ($mtCode ?? '');
|
||||
$levelNames = $levelNames ?? [];
|
||||
$debugMode = (bool) ($debug_mode ?? false);
|
||||
$debugInfo = is_array($debug_info ?? null) ? $debug_info : [];
|
||||
helper('admin');
|
||||
$adminMenusNavPath = current_nav_request_path();
|
||||
|
||||
/**
|
||||
* 메뉴 관리 목록용: 저장된 mm_link → 실제 href (외부 http(s) 또는 base_url).
|
||||
*/
|
||||
$adminMenuListResolveHref = static function (string $rawLink) use ($adminMenusNavPath): string {
|
||||
$rawLink = trim($rawLink);
|
||||
if ($rawLink === '') {
|
||||
return '';
|
||||
}
|
||||
if (preg_match('#^https?://#i', $rawLink)) {
|
||||
return $rawLink;
|
||||
}
|
||||
$pathSeg = menu_link_preferred_href_path($rawLink, $adminMenusNavPath);
|
||||
if ($pathSeg === '') {
|
||||
$pathSeg = normalize_menu_link_for_url($rawLink);
|
||||
}
|
||||
|
||||
return $pathSeg !== '' ? base_url($pathSeg) : '';
|
||||
};
|
||||
?>
|
||||
<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">
|
||||
@@ -23,6 +46,19 @@ $levelNames = $levelNames ?? [];
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php if ($debugMode): ?>
|
||||
<section class="mt-2 border border-amber-300 bg-amber-50 text-amber-900 rounded p-2 text-xs">
|
||||
<strong>[DEBUG]</strong>
|
||||
lg_idx=<?= esc((string) ($debugInfo['lg_idx'] ?? '')) ?>,
|
||||
requested_mt_idx=<?= esc((string) ($debugInfo['requested_mt_idx'] ?? '')) ?>,
|
||||
resolved_mt_idx=<?= esc((string) ($debugInfo['resolved_mt_idx'] ?? '')) ?>,
|
||||
effective_mt_idx=<?= esc((string) ($debugInfo['effective_mt_idx'] ?? '')) ?>,
|
||||
resolved_mt_code=<?= esc((string) ($debugInfo['resolved_mt_code'] ?? '')) ?>,
|
||||
list_count=<?= esc((string) ($debugInfo['list_count'] ?? '')) ?>,
|
||||
fallback_applied=<?= esc((string) ($debugInfo['fallback_applied'] ?? 'N')) ?>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="flex gap-4 mt-2 flex-wrap">
|
||||
<div class="border border-gray-300 bg-white rounded p-4 flex-1 min-w-0" style="min-width: 320px;">
|
||||
<h3 class="text-sm font-bold text-gray-700 mb-2">메뉴 목록</h3>
|
||||
@@ -48,6 +84,10 @@ $levelNames = $levelNames ?? [];
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($list as $i => $row): ?>
|
||||
<?php
|
||||
$rawLink = trim((string) $row->mm_link);
|
||||
$listItemHref = $rawLink !== '' ? $adminMenuListResolveHref($rawLink) : '';
|
||||
?>
|
||||
<tr class="menu-row" data-mm-idx="<?= (int) $row->mm_idx ?>" data-mm-pidx="<?= (int) $row->mm_pidx ?>" data-mm-dep="<?= (int) $row->mm_dep ?>">
|
||||
<td class="text-center align-middle">
|
||||
<span class="menu-drag-handle cursor-move text-gray-400 select-none" title="드래그해서 순서를 변경하세요">↕</span>
|
||||
@@ -67,9 +107,21 @@ $levelNames = $levelNames ?? [];
|
||||
└─
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
<?php if ($listItemHref !== ''): ?>
|
||||
<a href="<?= esc($listItemHref) ?>" class="ml-1 text-gray-900 hover:text-blue-700 hover:underline font-medium" target="_blank" rel="noopener noreferrer"><?= esc($row->mm_name) ?></a>
|
||||
<?php else: ?>
|
||||
<span class="ml-1"><?= esc($row->mm_name) ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="text-left pl-2 text-xs">
|
||||
<?php if ($rawLink === ''): ?>
|
||||
<span class="text-gray-400">—</span>
|
||||
<?php elseif ($listItemHref !== ''): ?>
|
||||
<a href="<?= esc($listItemHref) ?>" class="text-blue-600 hover:underline font-medium break-all" target="_blank" rel="noopener noreferrer"><?= esc($rawLink) ?></a>
|
||||
<?php else: ?>
|
||||
<span class="text-amber-700" title="URL로 해석되지 않는 링크입니다"><?= esc($rawLink) ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="text-left pl-2 text-xs"><?= esc($row->mm_link) ?></td>
|
||||
<td class="text-left pl-2 text-xs">
|
||||
<?php
|
||||
if ((string) $row->mm_level === '') {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">포장 단위 등록</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/packaging-units/store') ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('packaging-units/store') ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
|
||||
<a href="<?= base_url('admin/packaging-units') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('packaging-units') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">포장 단위 수정</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/packaging-units/update/' . (int) $item->pu_idx) ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('packaging-units/update/' . (int) $item->pu_idx) ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">수정</button>
|
||||
<a href="<?= base_url('admin/packaging-units') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('packaging-units') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="<?= base_url('admin/packaging-units') ?>" class="text-blue-600 hover:underline text-sm">← 포장 단위 목록</a>
|
||||
<a href="<?= mgmt_url('packaging-units') ?>" class="text-blue-600 hover:underline text-sm">← 포장 단위 목록</a>
|
||||
<span class="text-gray-400">|</span>
|
||||
<span class="text-sm font-bold text-gray-700">변경 이력 — <?= esc($item->pu_bag_name) ?> (<?= esc($item->pu_bag_code) ?>)</span>
|
||||
</div>
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
<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/packaging-units/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('packaging-units/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="p-2 bg-white border-b border-gray-200">
|
||||
<form method="GET" action="<?= base_url('admin/packaging-units') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="GET" action="<?= mgmt_url('packaging-units') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<label class="text-sm text-gray-600">적용시작일</label>
|
||||
<input type="date" name="start_date" value="<?= esc($startDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<label class="text-sm text-gray-600">~</label>
|
||||
<input type="date" name="end_date" value="<?= esc($endDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<button type="submit" class="bg-btn-search text-white px-4 py-1 rounded-sm text-sm">조회</button>
|
||||
<a href="<?= base_url('admin/packaging-units') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
|
||||
<a href="<?= mgmt_url('packaging-units') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
|
||||
</form>
|
||||
</section>
|
||||
<div class="border border-gray-300 overflow-auto mt-2">
|
||||
@@ -47,9 +47,9 @@
|
||||
<td class="text-center"><?= esc($row->pu_end_date ?? '현재') ?></td>
|
||||
<td class="text-center"><?= (int) $row->pu_state === 1 ? '사용' : '미사용' ?></td>
|
||||
<td class="text-center">
|
||||
<a href="<?= base_url('admin/packaging-units/history/' . (int) $row->pu_idx) ?>" class="text-green-600 hover:underline text-sm mr-1">이력</a>
|
||||
<a href="<?= base_url('admin/packaging-units/edit/' . (int) $row->pu_idx) ?>" class="text-blue-600 hover:underline text-sm mr-1">수정</a>
|
||||
<form action="<?= base_url('admin/packaging-units/delete/' . (int) $row->pu_idx) ?>" method="POST" class="inline" onsubmit="return confirm('삭제하시겠습니까?');">
|
||||
<a href="<?= mgmt_url('packaging-units/history/' . (int) $row->pu_idx) ?>" class="text-green-600 hover:underline text-sm mr-1">이력</a>
|
||||
<a href="<?= mgmt_url('packaging-units/edit/' . (int) $row->pu_idx) ?>" class="text-blue-600 hover:underline text-sm mr-1">수정</a>
|
||||
<form action="<?= mgmt_url('packaging-units/delete/' . (int) $row->pu_idx) ?>" method="POST" class="inline" onsubmit="return confirm('삭제하시겠습니까?');">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="text-red-600 hover:underline text-sm">삭제</button>
|
||||
</form>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">비밀번호 변경</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-md">
|
||||
<form action="<?= base_url('admin/password-change') ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('password-change') ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
|
||||
@@ -2,37 +2,27 @@
|
||||
<span class="text-sm font-bold text-gray-700">대행소 등록</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/sales-agencies/store') ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('sales-agencies/store') ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<label class="block text-sm font-bold text-gray-700 w-28">대행소 구분 <span class="text-red-500">*</span></label>
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="sa_kind" type="text" value="<?= esc(old('sa_kind')) ?>" required maxlength="50"/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<label class="block text-sm font-bold text-gray-700 w-28">대행소 코드 <span class="text-red-500">*</span></label>
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="sa_code" type="text" value="<?= esc(old('sa_code')) ?>" required maxlength="50"/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<label class="block text-sm font-bold text-gray-700 w-28">대행소 명 <span class="text-red-500">*</span></label>
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="sa_name" type="text" value="<?= esc(old('sa_name')) ?>" required/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<label class="block text-sm font-bold text-gray-700 w-28">사업자번호</label>
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="sa_biz_no" type="text" value="<?= esc(old('sa_biz_no')) ?>"/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<label class="block text-sm font-bold text-gray-700 w-28">대표자</label>
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="sa_rep_name" type="text" value="<?= esc(old('sa_rep_name')) ?>"/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<label class="block text-sm font-bold text-gray-700 w-28">전화</label>
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="sa_tel" type="text" value="<?= esc(old('sa_tel')) ?>"/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<label class="block text-sm font-bold text-gray-700 w-28">주소</label>
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-96" name="sa_addr" type="text" value="<?= esc(old('sa_addr')) ?>"/>
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="sa_name" type="text" value="<?= esc(old('sa_name')) ?>" required maxlength="100"/>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
|
||||
<a href="<?= base_url('admin/sales-agencies') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('sales-agencies') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -2,45 +2,27 @@
|
||||
<span class="text-sm font-bold text-gray-700">대행소 수정</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
||||
<form action="<?= base_url('admin/sales-agencies/update/' . (int) $item->sa_idx) ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('sales-agencies/update/' . (int) $item->sa_idx) ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<label class="block text-sm font-bold text-gray-700 w-28">대행소 구분 <span class="text-red-500">*</span></label>
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="sa_kind" type="text" value="<?= esc(old('sa_kind', $item->sa_kind ?? '')) ?>" required maxlength="50"/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<label class="block text-sm font-bold text-gray-700 w-28">대행소 코드 <span class="text-red-500">*</span></label>
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="sa_code" type="text" value="<?= esc(old('sa_code', $item->sa_code ?? '')) ?>" required maxlength="50"/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<label class="block text-sm font-bold text-gray-700 w-28">대행소 명 <span class="text-red-500">*</span></label>
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="sa_name" type="text" value="<?= esc(old('sa_name', $item->sa_name)) ?>" required/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<label class="block text-sm font-bold text-gray-700 w-28">사업자번호</label>
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="sa_biz_no" type="text" value="<?= esc(old('sa_biz_no', $item->sa_biz_no)) ?>"/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<label class="block text-sm font-bold text-gray-700 w-28">대표자</label>
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="sa_rep_name" type="text" value="<?= esc(old('sa_rep_name', $item->sa_rep_name)) ?>"/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<label class="block text-sm font-bold text-gray-700 w-28">전화</label>
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="sa_tel" type="text" value="<?= esc(old('sa_tel', $item->sa_tel)) ?>"/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<label class="block text-sm font-bold text-gray-700 w-28">주소</label>
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-96" name="sa_addr" type="text" value="<?= esc(old('sa_addr', $item->sa_addr)) ?>"/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<label class="block text-sm font-bold text-gray-700 w-28">상태 <span class="text-red-500">*</span></label>
|
||||
<select class="border border-gray-300 rounded px-3 py-1.5 text-sm w-32" name="sa_state" required>
|
||||
<option value="1" <?= (int) old('sa_state', $item->sa_state) === 1 ? 'selected' : '' ?>>사용</option>
|
||||
<option value="0" <?= (int) old('sa_state', $item->sa_state) === 0 ? 'selected' : '' ?>>미사용</option>
|
||||
</select>
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="sa_name" type="text" value="<?= esc(old('sa_name', $item->sa_name)) ?>" required maxlength="100"/>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">수정</button>
|
||||
<a href="<?= base_url('admin/sales-agencies') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('sales-agencies') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -11,17 +11,20 @@
|
||||
<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>
|
||||
<label class="text-xs text-gray-500">번호</label>
|
||||
<input type="text" name="sa_idx" value="<?= esc($sa_idx ?? '') ?>" class="border border-gray-300 rounded px-2 py-1.5 text-sm w-24" placeholder="예: 12">
|
||||
</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="조회어 입력">
|
||||
<label class="text-xs text-gray-500">대행소 구분</label>
|
||||
<input type="text" name="sa_kind" value="<?= esc($sa_kind ?? '') ?>" class="border border-gray-300 rounded px-2 py-1.5 text-sm min-w-[10rem]" placeholder="구분 입력">
|
||||
</div>
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<label class="text-xs text-gray-500">대행소 코드</label>
|
||||
<input type="text" name="sa_code" value="<?= esc($sa_code ?? '') ?>" class="border border-gray-300 rounded px-2 py-1.5 text-sm min-w-[10rem]" placeholder="코드 입력">
|
||||
</div>
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<label class="text-xs text-gray-500">대행소 명</label>
|
||||
<input type="text" name="sa_name" value="<?= esc($sa_name ?? '') ?>" class="border border-gray-300 rounded px-2 py-1.5 text-sm min-w-[14rem]" 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>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</div>
|
||||
</section>
|
||||
<section class="p-2 bg-white border-b border-gray-200">
|
||||
<form method="GET" action="<?= base_url('admin/reports/daily-summary') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="GET" action="<?= mgmt_url('reports/daily-summary') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<label class="text-sm text-gray-600">조회일</label>
|
||||
<input type="date" name="date" value="<?= esc($date ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<button type="submit" class="bg-btn-search text-white px-4 py-1 rounded-sm text-sm">조회</button>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</div>
|
||||
</section>
|
||||
<section class="p-2 bg-white border-b border-gray-200">
|
||||
<form method="GET" action="<?= base_url('admin/reports/lot-flow') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="GET" action="<?= mgmt_url('reports/lot-flow') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<label class="text-sm text-gray-600">LOT 번호</label>
|
||||
<input type="text" name="lot_no" value="<?= esc($lotNo ?? '') ?>" placeholder="LOT-YYYYMMDD-XXXXXX" class="border border-gray-300 rounded px-2 py-1 text-sm w-64"/>
|
||||
<button type="submit" class="bg-btn-search text-white px-4 py-1 rounded-sm text-sm">조회</button>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<!-- 등록 폼 -->
|
||||
<section class="p-2 bg-white border-b border-gray-200 no-print">
|
||||
<form method="POST" action="<?= base_url('admin/reports/misc-flow') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="POST" action="<?= mgmt_url('reports/misc-flow') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<?= csrf_field() ?>
|
||||
<label class="text-sm text-gray-600">구분</label>
|
||||
<select name="bmf_type" class="border border-gray-300 rounded px-2 py-1 text-sm" required>
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
<!-- 조회 필터 -->
|
||||
<section class="p-2 bg-white border-b border-gray-200 no-print">
|
||||
<form method="GET" action="<?= base_url('admin/reports/misc-flow') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="GET" action="<?= mgmt_url('reports/misc-flow') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<label class="text-sm text-gray-600">시작일</label>
|
||||
<input type="date" name="start_date" value="<?= esc($startDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<label class="text-sm text-gray-600">~</label>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</div>
|
||||
</section>
|
||||
<section class="p-2 bg-white border-b border-gray-200">
|
||||
<form method="GET" action="<?= base_url('admin/reports/period-sales') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="GET" action="<?= mgmt_url('reports/period-sales') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<label class="text-sm text-gray-600">시작일</label>
|
||||
<input type="date" name="start_date" value="<?= esc($startDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<label class="text-sm text-gray-600">~</label>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</div>
|
||||
</section>
|
||||
<section class="p-2 bg-white border-b border-gray-200">
|
||||
<form method="GET" action="<?= base_url('admin/reports/returns') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="GET" action="<?= mgmt_url('reports/returns') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<label class="text-sm text-gray-600">시작일</label>
|
||||
<input type="date" name="start_date" value="<?= esc($startDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<label class="text-sm text-gray-600">~</label>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</div>
|
||||
</section>
|
||||
<section class="p-2 bg-white border-b border-gray-200">
|
||||
<form method="GET" action="<?= base_url('admin/reports/sales-ledger') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="GET" action="<?= mgmt_url('reports/sales-ledger') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<label class="text-sm text-gray-600">시작일</label>
|
||||
<input type="date" name="start_date" value="<?= esc($startDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<label class="text-sm text-gray-600">~</label>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</div>
|
||||
</section>
|
||||
<section class="p-2 bg-white border-b border-gray-200">
|
||||
<form method="GET" action="<?= base_url('admin/reports/shop-sales') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="GET" action="<?= mgmt_url('reports/shop-sales') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<label class="text-sm text-gray-600">시작일</label>
|
||||
<input type="date" name="start_date" value="<?= esc($startDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<label class="text-sm text-gray-600">~</label>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</div>
|
||||
</section>
|
||||
<section class="p-2 bg-white border-b border-gray-200">
|
||||
<form method="GET" action="<?= base_url('admin/reports/supply-demand') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="GET" action="<?= mgmt_url('reports/supply-demand') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<label class="text-sm text-gray-600">시작일</label>
|
||||
<input type="date" name="start_date" value="<?= esc($startDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<label class="text-sm text-gray-600">~</label>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</div>
|
||||
</section>
|
||||
<section class="p-2 bg-white border-b border-gray-200">
|
||||
<form method="GET" action="<?= base_url('admin/reports/yearly-sales') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="GET" action="<?= mgmt_url('reports/yearly-sales') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<label class="text-sm text-gray-600">연도</label>
|
||||
<select name="year" class="border border-gray-300 rounded px-2 py-1 text-sm">
|
||||
<?php for ($y = (int) date('Y'); $y >= 2020; $y--): ?>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span class="text-sm font-bold text-gray-700">주문 접수</span>
|
||||
</section>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-4xl">
|
||||
<form action="<?= base_url('admin/shop-orders/store') ?>" method="POST" class="space-y-4">
|
||||
<form action="<?= mgmt_url('shop-orders/store') ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -68,7 +68,7 @@
|
||||
|
||||
<div class="flex gap-2 pt-2">
|
||||
<button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
|
||||
<a href="<?= base_url('admin/shop-orders') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
<a href="<?= mgmt_url('shop-orders') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
<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/shop-orders/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('shop-orders/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="p-2 bg-white border-b border-gray-200">
|
||||
<form method="GET" action="<?= base_url('admin/shop-orders') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="GET" action="<?= mgmt_url('shop-orders') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<label class="text-sm text-gray-600">배달일</label>
|
||||
<input type="date" name="start_date" value="<?= esc($startDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<label class="text-sm text-gray-600">~</label>
|
||||
<input type="date" name="end_date" value="<?= esc($endDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
||||
<button type="submit" class="bg-btn-search text-white px-4 py-1 rounded-sm text-sm">조회</button>
|
||||
<a href="<?= base_url('admin/shop-orders') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
|
||||
<a href="<?= mgmt_url('shop-orders') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
|
||||
</form>
|
||||
</section>
|
||||
<div class="border border-gray-300 overflow-auto mt-2">
|
||||
@@ -64,7 +64,7 @@
|
||||
?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<form action="<?= base_url('admin/shop-orders/cancel/' . (int) $row->so_idx) ?>" method="POST" class="inline" onsubmit="return confirm('취소하시겠습니까?');">
|
||||
<form action="<?= mgmt_url('shop-orders/cancel/' . (int) $row->so_idx) ?>" method="POST" class="inline" onsubmit="return confirm('취소하시겠습니까?');">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="text-orange-600 hover:underline text-sm">취소</button>
|
||||
</form>
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
|
||||
<span class="text-sm font-bold text-gray-700">회원 수정</span>
|
||||
</section>
|
||||
<?php
|
||||
$editLockUntil = $member->mb_locked_until ?? null;
|
||||
$editLoginLocked = $editLockUntil !== null && $editLockUntil !== '' && strtotime((string) $editLockUntil) > time();
|
||||
?>
|
||||
<?php if ($editLoginLocked): ?>
|
||||
<div class="mt-2 p-3 bg-amber-50 border border-amber-200 text-sm text-amber-900 flex flex-wrap items-center gap-3">
|
||||
<span>비밀번호 오류로 로그인이 잠겨 있습니다. (~ <?= esc(date('Y-m-d H:i', strtotime((string) $editLockUntil))) ?>)</span>
|
||||
<form action="<?= base_url('admin/users/unlock-login/' . $member->mb_idx) ?>" method="POST" class="inline" onsubmit="return confirm('로그인 잠금을 해제할까요?');">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="bg-amber-700 text-white px-3 py-1 rounded-sm text-sm hover:opacity-90">잠금 해제</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-xl">
|
||||
<form action="<?= base_url('admin/users/update/' . $member->mb_idx) ?>" method="POST" class="space-y-4">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<th>이메일</th>
|
||||
<th>역할</th>
|
||||
<th>상태</th>
|
||||
<th>로그인 잠금</th>
|
||||
<th>가입일</th>
|
||||
<th>관리</th>
|
||||
</tr>
|
||||
@@ -42,9 +43,27 @@
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="text-left pl-2 text-sm">
|
||||
<?php
|
||||
$until = $row->mb_locked_until ?? null;
|
||||
$loginLocked = $until !== null && $until !== '' && strtotime((string) $until) > time();
|
||||
if ($loginLocked) {
|
||||
echo '잠금~' . esc(date('Y-m-d H:i', strtotime((string) $until)));
|
||||
} else {
|
||||
$fail = (int) ($row->mb_login_fail_count ?? 0);
|
||||
echo $fail > 0 ? '실패 ' . $fail . '회' : '—';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="text-left pl-2"><?= esc($row->mb_regdate ?? '') ?></td>
|
||||
<td class="text-center">
|
||||
<?php if ((int) $row->mb_state !== 0): ?>
|
||||
<?php if ($loginLocked): ?>
|
||||
<form action="<?= base_url('admin/users/unlock-login/' . $row->mb_idx) ?>" method="POST" class="inline mr-1" onsubmit="return confirm('로그인 잠금을 해제할까요?');">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="text-amber-700 hover:underline">잠금해제</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<a href="<?= base_url('admin/users/edit/' . $row->mb_idx) ?>" class="text-blue-600 hover:underline">수정</a>
|
||||
<form action="<?= base_url('admin/users/delete/' . $row->mb_idx) ?>" method="POST" class="inline ml-1" onsubmit="return confirm('탈퇴 처리하시겠습니까?');">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||
<title>로그인 - 쓰레기봉투 물류시스템</title>
|
||||
<title>로그인 - 종량제 시스템</title>
|
||||
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap" rel="stylesheet"/>
|
||||
<script>
|
||||
@@ -26,14 +26,12 @@ tailwind.config = {
|
||||
</head>
|
||||
<body class="bg-gray-100 text-gray-800 flex flex-col h-screen font-sans antialiased">
|
||||
<header class="bg-white border-b border-gray-300 h-12 flex items-center justify-between px-4 shrink-0">
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="w-6 h-6 flex items-center justify-center shrink-0">
|
||||
<svg class="h-5 w-5" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="16" height="16" fill="#2563eb"/><rect x="2" y="2" width="7" height="7" fill="white"/><rect x="5" y="5" width="9" height="9" fill="white"/>
|
||||
<a href="<?= base_url() ?>" class="flex items-center gap-2 shrink-0 text-base font-semibold text-gray-800 tracking-tight hover:text-blue-600" title="종량제 시스템">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="h-6 w-6 text-blue-900 translate-y-[1px]" aria-hidden="true" focusable="false">
|
||||
<path fill="currentColor" d="M9 3a1 1 0 00-1 1v1H5.75a.75.75 0 000 1.5h12.5a.75.75 0 000-1.5H16V4a1 1 0 00-1-1H9zm9 4H6v11a2 2 0 002 2h8a2 2 0 002-2V7zM10 9a.75.75 0 01.75.75v6a.75.75 0 01-1.5 0v-6A.75.75 0 0110 9zm4 0a.75.75 0 01.75.75v6a.75.75 0 01-1.5 0v-6A.75.75 0 0114 9z"/>
|
||||
</svg>
|
||||
</div>
|
||||
<a href="<?= base_url() ?>" class="text-base font-semibold text-gray-800 tracking-tight hover:text-blue-600">쓰레기봉투 물류시스템</a>
|
||||
</div>
|
||||
<span class="whitespace-nowrap">종량제 시스템</span>
|
||||
</a>
|
||||
</header>
|
||||
<div class="bg-title-bar text-white px-4 py-2 text-sm font-medium shrink-0">
|
||||
로그인
|
||||
@@ -68,6 +66,6 @@ tailwind.config = {
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
<footer class="bg-gray-200 border-t border-gray-300 px-4 py-1 text-xs text-gray-600 shrink-0">쓰레기봉투 물류시스템</footer>
|
||||
<footer class="bg-gray-200 border-t border-gray-300 px-4 py-1 text-xs text-gray-600 shrink-0">종량제 시스템</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||
<title>2차 인증 - 쓰레기봉투 물류시스템</title>
|
||||
<title>2차 인증 - 종량제 시스템</title>
|
||||
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap" rel="stylesheet"/>
|
||||
<script>
|
||||
@@ -25,9 +25,7 @@ tailwind.config = {
|
||||
</head>
|
||||
<body class="bg-gray-100 text-gray-800 flex flex-col min-h-screen font-sans antialiased">
|
||||
<header class="bg-white border-b border-gray-300 h-12 flex items-center justify-between px-4 shrink-0">
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="<?= base_url() ?>" class="text-base font-semibold text-gray-800 tracking-tight hover:text-blue-600">쓰레기봉투 물류시스템</a>
|
||||
</div>
|
||||
<?= view('components/header_brand') ?>
|
||||
</header>
|
||||
<div class="bg-title-bar text-white px-4 py-2 text-sm font-medium shrink-0">
|
||||
2차 인증 (TOTP)
|
||||
@@ -56,6 +54,6 @@ tailwind.config = {
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
<footer class="bg-gray-200 border-t border-gray-300 px-4 py-1 text-xs text-gray-600 shrink-0">쓰레기봉투 물류시스템</footer>
|
||||
<footer class="bg-gray-200 border-t border-gray-300 px-4 py-1 text-xs text-gray-600 shrink-0">종량제 시스템</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||
<title>회원가입 - 쓰레기봉투 물류시스템</title>
|
||||
<title>회원가입 - 종량제 시스템</title>
|
||||
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap" rel="stylesheet"/>
|
||||
<script>
|
||||
@@ -26,14 +26,7 @@ tailwind.config = {
|
||||
</head>
|
||||
<body class="bg-gray-100 text-gray-800 flex flex-col h-screen font-sans antialiased">
|
||||
<header class="bg-white border-b border-gray-300 h-12 flex items-center justify-between px-4 shrink-0">
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="w-6 h-6 flex items-center justify-center shrink-0">
|
||||
<svg class="h-5 w-5" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="16" height="16" fill="#2563eb"/><rect x="2" y="2" width="7" height="7" fill="white"/><rect x="5" y="5" width="9" height="9" fill="white"/>
|
||||
</svg>
|
||||
</div>
|
||||
<a href="<?= base_url() ?>" class="text-base font-semibold text-gray-800 tracking-tight hover:text-blue-600">쓰레기봉투 물류시스템</a>
|
||||
</div>
|
||||
<?= view('components/header_brand') ?>
|
||||
</header>
|
||||
<div class="bg-title-bar text-white px-4 py-2 text-sm font-medium shrink-0">
|
||||
회원가입
|
||||
@@ -102,6 +95,6 @@ tailwind.config = {
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
<footer class="bg-gray-200 border-t border-gray-300 px-4 py-1 text-xs text-gray-600 shrink-0">쓰레기봉투 물류시스템</footer>
|
||||
<footer class="bg-gray-200 border-t border-gray-300 px-4 py-1 text-xs text-gray-600 shrink-0">종량제 시스템</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user