feat: improve bag price and packaging unit management
This commit is contained in:
@@ -3,10 +3,10 @@
|
|||||||
namespace App\Controllers\Admin;
|
namespace App\Controllers\Admin;
|
||||||
|
|
||||||
use App\Controllers\BaseController;
|
use App\Controllers\BaseController;
|
||||||
use App\Models\BagPriceModel;
|
|
||||||
use App\Models\BagPriceHistoryModel;
|
use App\Models\BagPriceHistoryModel;
|
||||||
use App\Models\CodeKindModel;
|
use App\Models\BagPriceModel;
|
||||||
use App\Models\CodeDetailModel;
|
use App\Models\CodeDetailModel;
|
||||||
|
use App\Models\CodeKindModel;
|
||||||
|
|
||||||
class BagPrice extends BaseController
|
class BagPrice extends BaseController
|
||||||
{
|
{
|
||||||
@@ -23,36 +23,18 @@ class BagPrice extends BaseController
|
|||||||
{
|
{
|
||||||
helper('admin');
|
helper('admin');
|
||||||
$lgIdx = admin_effective_lg_idx();
|
$lgIdx = admin_effective_lg_idx();
|
||||||
if (!$lgIdx) {
|
if ($lgIdx === null) {
|
||||||
return redirect()->to(site_url('admin'))->with('error', '지자체를 선택해 주세요.');
|
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)
|
return $this->renderWorkPage('봉투 단가 관리', 'admin/bag_price/index', [
|
||||||
$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', [
|
|
||||||
'list' => $list,
|
'list' => $list,
|
||||||
'startDate' => $startDate,
|
'pager' => $this->priceModel->pager,
|
||||||
'endDate' => $endDate,
|
|
||||||
'pager' => $pager,
|
|
||||||
]),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,22 +42,18 @@ class BagPrice extends BaseController
|
|||||||
{
|
{
|
||||||
helper('admin');
|
helper('admin');
|
||||||
$lgIdx = admin_effective_lg_idx();
|
$lgIdx = admin_effective_lg_idx();
|
||||||
if (!$lgIdx) {
|
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);
|
$kindModel = model(CodeKindModel::class);
|
||||||
$kind = $kindModel->where('ck_code', 'O')->first();
|
$kind = $kindModel->where('ck_code', 'O')->first();
|
||||||
$bagCodes = [];
|
$bagCodes = [];
|
||||||
if ($kind) {
|
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', [
|
return $this->renderWorkPage('봉투 단가 등록', 'admin/bag_price/create', ['bagCodes' => $bagCodes]);
|
||||||
'title' => '봉투 단가 등록',
|
|
||||||
'content' => view('admin/bag_price/create', ['bagCodes' => $bagCodes]),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store()
|
public function store()
|
||||||
@@ -96,13 +74,12 @@ class BagPrice extends BaseController
|
|||||||
return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
|
return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 봉투명 스냅샷
|
|
||||||
$bagCode = $this->request->getPost('bp_bag_code');
|
$bagCode = $this->request->getPost('bp_bag_code');
|
||||||
$kindModel = model(CodeKindModel::class);
|
$kindModel = model(CodeKindModel::class);
|
||||||
$kind = $kindModel->where('ck_code', 'O')->first();
|
$kind = $kindModel->where('ck_code', 'O')->first();
|
||||||
$bagName = '';
|
$bagName = '';
|
||||||
if ($kind) {
|
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 : '';
|
$bagName = $detail ? $detail->cd_name : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,36 +97,34 @@ class BagPrice extends BaseController
|
|||||||
'bp_reg_mb_idx' => session()->get('mb_idx'),
|
'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)
|
public function edit(int $id)
|
||||||
{
|
{
|
||||||
helper('admin');
|
helper('admin');
|
||||||
|
$lgIdx = admin_effective_lg_idx();
|
||||||
$item = $this->priceModel->find($id);
|
$item = $this->priceModel->find($id);
|
||||||
if (!$item || (int) $item->bp_lg_idx !== admin_effective_lg_idx()) {
|
if (! $item || (int) $item->bp_lg_idx !== $lgIdx) {
|
||||||
return redirect()->to(site_url('admin/bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.');
|
return redirect()->to(mgmt_url('bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$kindModel = model(CodeKindModel::class);
|
$kindModel = model(CodeKindModel::class);
|
||||||
$kind = $kindModel->where('ck_code', 'O')->first();
|
$kind = $kindModel->where('ck_code', 'O')->first();
|
||||||
$bagCodes = [];
|
$bagCodes = [];
|
||||||
if ($kind) {
|
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', [
|
return $this->renderWorkPage('봉투 단가 수정', 'admin/bag_price/edit', ['item' => $item, 'bagCodes' => $bagCodes]);
|
||||||
'title' => '봉투 단가 수정',
|
|
||||||
'content' => view('admin/bag_price/edit', ['item' => $item, 'bagCodes' => $bagCodes]),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(int $id)
|
public function update(int $id)
|
||||||
{
|
{
|
||||||
helper('admin');
|
helper('admin');
|
||||||
$item = $this->priceModel->find($id);
|
$item = $this->priceModel->find($id);
|
||||||
if (!$item || (int) $item->bp_lg_idx !== admin_effective_lg_idx()) {
|
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 = [
|
$rules = [
|
||||||
@@ -165,7 +140,6 @@ class BagPrice extends BaseController
|
|||||||
return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
|
return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 이력 기록
|
|
||||||
$db = \Config\Database::connect();
|
$db = \Config\Database::connect();
|
||||||
$db->transStart();
|
$db->transStart();
|
||||||
|
|
||||||
@@ -179,8 +153,8 @@ class BagPrice extends BaseController
|
|||||||
'bph_field' => $field,
|
'bph_field' => $field,
|
||||||
'bph_old_value' => $oldVal,
|
'bph_old_value' => $oldVal,
|
||||||
'bph_new_value' => $newVal,
|
'bph_new_value' => $newVal,
|
||||||
'bph_changed_at'=> date('Y-m-d H:i:s'),
|
'bph_changed_at' => date('Y-m-d H:i:s'),
|
||||||
'bph_changed_by'=> session()->get('mb_idx'),
|
'bph_changed_by' => session()->get('mb_idx'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,34 +171,32 @@ class BagPrice extends BaseController
|
|||||||
|
|
||||||
$db->transComplete();
|
$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)
|
public function delete(int $id)
|
||||||
{
|
{
|
||||||
helper('admin');
|
helper('admin');
|
||||||
$item = $this->priceModel->find($id);
|
$item = $this->priceModel->find($id);
|
||||||
if (!$item || (int) $item->bp_lg_idx !== admin_effective_lg_idx()) {
|
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);
|
$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)
|
public function history(int $bpIdx)
|
||||||
{
|
{
|
||||||
helper('admin');
|
helper('admin');
|
||||||
$item = $this->priceModel->find($bpIdx);
|
$item = $this->priceModel->find($bpIdx);
|
||||||
if (!$item || (int) $item->bp_lg_idx !== admin_effective_lg_idx()) {
|
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();
|
$list = $this->historyModel->where('bph_bp_idx', $bpIdx)->orderBy('bph_changed_at', 'DESC')->findAll();
|
||||||
|
|
||||||
return view('admin/layout', [
|
return $this->renderWorkPage('단가 변경 이력 — ' . $item->bp_bag_name, 'admin/bag_price/history', ['item' => $item, 'list' => $list]);
|
||||||
'title' => '단가 변경 이력 — ' . $item->bp_bag_name,
|
|
||||||
'content' => view('admin/bag_price/history', ['item' => $item, 'list' => $list]),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ class PackagingUnit extends BaseController
|
|||||||
{
|
{
|
||||||
helper('admin');
|
helper('admin');
|
||||||
$lgIdx = admin_effective_lg_idx();
|
$lgIdx = admin_effective_lg_idx();
|
||||||
if (!$lgIdx) {
|
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);
|
$builder = $this->unitModel->where('pu_lg_idx', $lgIdx);
|
||||||
@@ -41,28 +41,23 @@ class PackagingUnit extends BaseController
|
|||||||
$list = $builder->orderBy('pu_bag_code', 'ASC')->orderBy('pu_start_date', 'DESC')->paginate(20);
|
$list = $builder->orderBy('pu_bag_code', 'ASC')->orderBy('pu_start_date', 'DESC')->paginate(20);
|
||||||
$pager = $this->unitModel->pager;
|
$pager = $this->unitModel->pager;
|
||||||
|
|
||||||
return view('admin/layout', [
|
return $this->renderWorkPage('포장 단위 관리', 'admin/packaging_unit/index', [
|
||||||
'title' => '포장 단위 관리',
|
|
||||||
'content' => view('admin/packaging_unit/index', [
|
|
||||||
'list' => $list, 'startDate' => $startDate, 'endDate' => $endDate, 'pager' => $pager,
|
'list' => $list, 'startDate' => $startDate, 'endDate' => $endDate, 'pager' => $pager,
|
||||||
]),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
helper('admin');
|
helper('admin');
|
||||||
if (!admin_effective_lg_idx()) {
|
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();
|
$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', [
|
return $this->renderWorkPage('포장 단위 등록', 'admin/packaging_unit/create', ['bagCodes' => $bagCodes]);
|
||||||
'title' => '포장 단위 등록',
|
|
||||||
'content' => view('admin/packaging_unit/create', ['bagCodes' => $bagCodes]),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store()
|
public function store()
|
||||||
@@ -86,7 +81,7 @@ class PackagingUnit extends BaseController
|
|||||||
$kind = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
$kind = model(CodeKindModel::class)->where('ck_code', 'O')->first();
|
||||||
$bagName = '';
|
$bagName = '';
|
||||||
if ($kind) {
|
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 : '';
|
$bagName = $detail ? $detail->cd_name : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,32 +102,30 @@ class PackagingUnit extends BaseController
|
|||||||
'pu_reg_mb_idx' => session()->get('mb_idx'),
|
'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)
|
public function edit(int $id)
|
||||||
{
|
{
|
||||||
helper('admin');
|
helper('admin');
|
||||||
$item = $this->unitModel->find($id);
|
$item = $this->unitModel->find($id);
|
||||||
if (!$item || (int) $item->pu_lg_idx !== admin_effective_lg_idx()) {
|
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();
|
$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', [
|
return $this->renderWorkPage('포장 단위 수정', 'admin/packaging_unit/edit', ['item' => $item, 'bagCodes' => $bagCodes]);
|
||||||
'title' => '포장 단위 수정',
|
|
||||||
'content' => view('admin/packaging_unit/edit', ['item' => $item, 'bagCodes' => $bagCodes]),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(int $id)
|
public function update(int $id)
|
||||||
{
|
{
|
||||||
helper('admin');
|
helper('admin');
|
||||||
$item = $this->unitModel->find($id);
|
$item = $this->unitModel->find($id);
|
||||||
if (!$item || (int) $item->pu_lg_idx !== admin_effective_lg_idx()) {
|
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 = [
|
$rules = [
|
||||||
@@ -160,8 +153,8 @@ class PackagingUnit extends BaseController
|
|||||||
'puh_field' => $field,
|
'puh_field' => $field,
|
||||||
'puh_old_value' => $oldVal,
|
'puh_old_value' => $oldVal,
|
||||||
'puh_new_value' => $newVal,
|
'puh_new_value' => $newVal,
|
||||||
'puh_changed_at'=> date('Y-m-d H:i:s'),
|
'puh_changed_at' => date('Y-m-d H:i:s'),
|
||||||
'puh_changed_by'=> session()->get('mb_idx'),
|
'puh_changed_by' => session()->get('mb_idx'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,34 +173,33 @@ class PackagingUnit extends BaseController
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$db->transComplete();
|
$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)
|
public function delete(int $id)
|
||||||
{
|
{
|
||||||
helper('admin');
|
helper('admin');
|
||||||
$item = $this->unitModel->find($id);
|
$item = $this->unitModel->find($id);
|
||||||
if (!$item || (int) $item->pu_lg_idx !== admin_effective_lg_idx()) {
|
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);
|
$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)
|
public function history(int $puIdx)
|
||||||
{
|
{
|
||||||
helper('admin');
|
helper('admin');
|
||||||
$item = $this->unitModel->find($puIdx);
|
$item = $this->unitModel->find($puIdx);
|
||||||
if (!$item || (int) $item->pu_lg_idx !== admin_effective_lg_idx()) {
|
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();
|
$list = $this->historyModel->where('puh_pu_idx', $puIdx)->orderBy('puh_changed_at', 'DESC')->findAll();
|
||||||
|
|
||||||
return view('admin/layout', [
|
return $this->renderWorkPage('포장 단위 변경 이력 — ' . $item->pu_bag_name, 'admin/packaging_unit/history', ['item' => $item, 'list' => $list]);
|
||||||
'title' => '포장 단위 변경 이력 — ' . $item->pu_bag_name,
|
|
||||||
'content' => view('admin/packaging_unit/history', ['item' => $item, 'list' => $list]),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ class PasswordChange extends BaseController
|
|||||||
{
|
{
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return view('admin/layout', [
|
helper('admin');
|
||||||
'title' => '비밀번호 변경',
|
|
||||||
'content' => view('admin/password_change/index'),
|
return $this->renderWorkPage('비밀번호 변경', 'admin/password_change/index');
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update()
|
public function update()
|
||||||
{
|
{
|
||||||
|
helper('admin');
|
||||||
$rules = [
|
$rules = [
|
||||||
'current_password' => 'required',
|
'current_password' => 'required',
|
||||||
'new_password' => 'required|min_length[4]|max_length[255]',
|
'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),
|
'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', '비밀번호가 변경되었습니다.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<span class="text-sm font-bold text-gray-700">봉투 단가 등록</span>
|
<span class="text-sm font-bold text-gray-700">봉투 단가 등록</span>
|
||||||
</section>
|
</section>
|
||||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
<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() ?>
|
<?= csrf_field() ?>
|
||||||
|
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
<div class="flex gap-2 pt-2">
|
<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>
|
<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>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<span class="text-sm font-bold text-gray-700">봉투 단가 수정</span>
|
<span class="text-sm font-bold text-gray-700">봉투 단가 수정</span>
|
||||||
</section>
|
</section>
|
||||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
<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() ?>
|
<?= csrf_field() ?>
|
||||||
|
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
<div class="flex gap-2 pt-2">
|
<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>
|
<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>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
|
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
|
||||||
<div class="flex items-center gap-2">
|
<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-gray-400">|</span>
|
||||||
<span class="text-sm font-bold text-gray-700">단가 변경 이력 — <?= esc($item->bp_bag_name) ?> (<?= esc($item->bp_bag_code) ?>)</span>
|
<span class="text-sm font-bold text-gray-700">단가 변경 이력 — <?= esc($item->bp_bag_name) ?> (<?= esc($item->bp_bag_code) ?>)</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,23 +1,20 @@
|
|||||||
<?= view('components/print_header', ['printTitle' => '봉투 단가 관리']) ?>
|
<?= 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">
|
<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 flex-wrap items-center justify-between gap-y-2">
|
||||||
<span class="text-sm font-bold text-gray-700">봉투 단가 관리</span>
|
<span class="text-sm font-bold text-gray-700">봉투 단가 관리</span>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2 no-print">
|
||||||
<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>
|
<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('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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section class="p-2 bg-white border-b border-gray-200">
|
<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>
|
||||||
<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>
|
|
||||||
<div class="border border-gray-300 overflow-auto mt-2">
|
<div class="border border-gray-300 overflow-auto mt-2">
|
||||||
<table class="w-full data-table">
|
<table class="w-full data-table">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -31,7 +28,7 @@
|
|||||||
<th>적용시작</th>
|
<th>적용시작</th>
|
||||||
<th>적용종료</th>
|
<th>적용종료</th>
|
||||||
<th class="w-20">상태</th>
|
<th class="w-20">상태</th>
|
||||||
<th class="w-36">작업</th>
|
<th class="w-36 no-print">작업</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="text-right">
|
<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_start_date) ?></td>
|
||||||
<td class="text-center"><?= esc($row->bp_end_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"><?= (int) $row->bp_state === 1 ? '사용' : '미사용' ?></td>
|
||||||
<td class="text-center">
|
<td class="text-center no-print">
|
||||||
<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="<?= mgmt_url('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>
|
<a href="<?= mgmt_url('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('삭제하시겠습니까?');">
|
<form action="<?= mgmt_url('bag-prices/delete/' . (int) $row->bp_idx) ?>" method="POST" class="inline" onsubmit="return confirm('삭제하시겠습니까?');">
|
||||||
<?= csrf_field() ?>
|
<?= csrf_field() ?>
|
||||||
<button type="submit" class="text-red-600 hover:underline text-sm">삭제</button>
|
<button type="submit" class="text-red-600 hover:underline text-sm">삭제</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -62,4 +59,4 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</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>
|
<span class="text-sm font-bold text-gray-700">포장 단위 등록</span>
|
||||||
</section>
|
</section>
|
||||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
<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() ?>
|
<?= csrf_field() ?>
|
||||||
|
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
<div class="flex gap-2 pt-2">
|
<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>
|
<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>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<span class="text-sm font-bold text-gray-700">포장 단위 수정</span>
|
<span class="text-sm font-bold text-gray-700">포장 단위 수정</span>
|
||||||
</section>
|
</section>
|
||||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
|
<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() ?>
|
<?= csrf_field() ?>
|
||||||
|
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
<div class="flex gap-2 pt-2">
|
<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>
|
<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>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
|
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
|
||||||
<div class="flex items-center gap-2">
|
<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-gray-400">|</span>
|
||||||
<span class="text-sm font-bold text-gray-700">변경 이력 — <?= esc($item->pu_bag_name) ?> (<?= esc($item->pu_bag_code) ?>)</span>
|
<span class="text-sm font-bold text-gray-700">변경 이력 — <?= esc($item->pu_bag_name) ?> (<?= esc($item->pu_bag_code) ?>)</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,18 +4,18 @@
|
|||||||
<span class="text-sm font-bold text-gray-700">포장 단위 관리</span>
|
<span class="text-sm font-bold text-gray-700">포장 단위 관리</span>
|
||||||
<div class="flex items-center gap-2">
|
<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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section class="p-2 bg-white border-b border-gray-200">
|
<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>
|
<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"/>
|
<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>
|
<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"/>
|
<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>
|
<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>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
<div class="border border-gray-300 overflow-auto mt-2">
|
<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"><?= esc($row->pu_end_date ?? '현재') ?></td>
|
||||||
<td class="text-center"><?= (int) $row->pu_state === 1 ? '사용' : '미사용' ?></td>
|
<td class="text-center"><?= (int) $row->pu_state === 1 ? '사용' : '미사용' ?></td>
|
||||||
<td class="text-center">
|
<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="<?= mgmt_url('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>
|
<a href="<?= mgmt_url('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('삭제하시겠습니까?');">
|
<form action="<?= mgmt_url('packaging-units/delete/' . (int) $row->pu_idx) ?>" method="POST" class="inline" onsubmit="return confirm('삭제하시겠습니까?');">
|
||||||
<?= csrf_field() ?>
|
<?= csrf_field() ?>
|
||||||
<button type="submit" class="text-red-600 hover:underline text-sm">삭제</button>
|
<button type="submit" class="text-red-600 hover:underline text-sm">삭제</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<span class="text-sm font-bold text-gray-700">비밀번호 변경</span>
|
<span class="text-sm font-bold text-gray-700">비밀번호 변경</span>
|
||||||
</section>
|
</section>
|
||||||
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-md">
|
<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() ?>
|
<?= csrf_field() ?>
|
||||||
|
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
|
|||||||
37
app/Views/bag/packaging_units.php
Normal file
37
app/Views/bag/packaging_units.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<div class="space-y-4">
|
||||||
|
<p class="text-sm text-gray-600">
|
||||||
|
<a href="<?= base_url('bag/basic-info') ?>" class="text-blue-600 hover:underline">← 기본정보관리</a>
|
||||||
|
<span class="mx-2 text-gray-300">|</span>
|
||||||
|
<a href="<?= base_url('bag/prices') ?>" class="text-blue-600 hover:underline">봉투 단가</a>
|
||||||
|
</p>
|
||||||
|
<section>
|
||||||
|
<div class="flex items-center justify-between mb-2 border-b pb-1">
|
||||||
|
<h3 class="text-base font-bold text-gray-700">포장 단위</h3>
|
||||||
|
<a href="<?= base_url('bag/packaging-units/manage') ?>" class="text-blue-600 hover:underline text-sm">관리 →</a>
|
||||||
|
</div>
|
||||||
|
<table class="data-table">
|
||||||
|
<thead><tr>
|
||||||
|
<th class="w-16">번호</th><th>봉투코드</th><th>봉투명</th><th>박스당 팩 수</th><th>팩당 낱장 수</th><th>1박스 총 낱장</th><th>적용시작</th><th>적용종료</th><th>상태</th>
|
||||||
|
</tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<?php if (! empty($packagingUnits)): ?>
|
||||||
|
<?php foreach ($packagingUnits as $i => $row): ?>
|
||||||
|
<tr>
|
||||||
|
<td class="text-center"><?= $i + 1 ?></td>
|
||||||
|
<td class="text-center"><?= esc($row->pu_bag_code) ?></td>
|
||||||
|
<td><?= esc($row->pu_bag_name ?? '') ?></td>
|
||||||
|
<td class="text-right"><?= number_format((int) ($row->pu_box_per_pack ?? 0)) ?></td>
|
||||||
|
<td class="text-right"><?= number_format((int) ($row->pu_pack_per_sheet ?? 0)) ?></td>
|
||||||
|
<td class="text-right"><?= number_format((int) ($row->pu_total_per_box ?? 0)) ?></td>
|
||||||
|
<td class="text-center"><?= esc($row->pu_start_date ?? '') ?></td>
|
||||||
|
<td class="text-center"><?= ($row->pu_end_date ?? '') !== '' && $row->pu_end_date !== null ? esc((string) $row->pu_end_date) : '현재' ?></td>
|
||||||
|
<td class="text-center"><?= (int) ($row->pu_state ?? 1) === 1 ? '사용' : '만료' ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<tr><td colspan="9" class="text-center text-gray-400 py-4">등록된 포장 단위가 없습니다.</td></tr>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
144
app/Views/bag/prices.php
Normal file
144
app/Views/bag/prices.php
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
<?php
|
||||||
|
$_ph = ['printTitle' => '봉투 단가 조회', 'printExtraLines' => $printExtraLines ?? []];
|
||||||
|
if (($printLgName ?? '') !== '') {
|
||||||
|
$_ph['printLgName'] = $printLgName;
|
||||||
|
}
|
||||||
|
echo view('components/print_header', $_ph);
|
||||||
|
unset($_ph);
|
||||||
|
?>
|
||||||
|
<style>
|
||||||
|
@media print {
|
||||||
|
.no-print { display: none !important; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="space-y-4">
|
||||||
|
<p class="text-sm text-gray-600 no-print">
|
||||||
|
<a href="<?= base_url('bag/basic-info') ?>" class="text-blue-600 hover:underline">← 기본정보관리</a>
|
||||||
|
<span class="mx-2 text-gray-300">|</span>
|
||||||
|
<a href="<?= base_url('bag/packaging-units') ?>" class="text-blue-600 hover:underline">포장 단위</a>
|
||||||
|
<span class="mx-2 text-gray-300">|</span>
|
||||||
|
<a href="<?= base_url('bag/bag-prices') ?>" class="text-blue-600 hover:underline">단가 관리(CRUD)</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?php if (($lgIdx ?? null) === null): ?>
|
||||||
|
<p class="text-sm text-amber-800 bg-amber-50 border border-amber-200 rounded p-3">작업 지자체가 선택되지 않았습니다. 관리자는 지자체 선택 후 단가를 조회할 수 있습니다.</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<section class="no-print border border-gray-200 rounded-lg bg-white p-3">
|
||||||
|
<form method="post" action="<?= site_url('bag/prices') ?>" class="flex flex-wrap items-end gap-3" autocomplete="off">
|
||||||
|
<?= csrf_field() ?>
|
||||||
|
<div class="flex flex-col gap-0.5">
|
||||||
|
<label class="text-xs text-gray-500">봉투구분</label>
|
||||||
|
<select name="bag_kind_e" class="border border-gray-300 rounded px-2 py-1.5 text-sm min-w-[9rem]">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<?php foreach ($bag_kind_options ?? [] as $cd): ?>
|
||||||
|
<option value="<?= esc($cd->cd_code) ?>" <?= (string) ($cd->cd_code ?? '') === (string) ($bag_kind_e ?? '') ? 'selected' : '' ?>>
|
||||||
|
<?= esc($cd->cd_name) ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col gap-0.5">
|
||||||
|
<label class="text-xs text-gray-500">봉투코드</label>
|
||||||
|
<select name="bag_code" class="border border-gray-300 rounded px-2 py-1.5 text-sm min-w-[11rem]">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<?php foreach ($bag_codes ?? [] as $cd): ?>
|
||||||
|
<option value="<?= esc($cd->cd_code) ?>" <?= (string) ($cd->cd_code ?? '') === (string) ($bag_code ?? '') ? 'selected' : '' ?>>
|
||||||
|
<?= esc($cd->cd_code) ?> — <?= esc($cd->cd_name) ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col gap-0.5">
|
||||||
|
<label class="text-xs text-gray-500">조회 기간 (적용기간 겹침)</label>
|
||||||
|
<?php
|
||||||
|
$sp = $startParts ?? ['y' => '', 'm' => '', 'd' => ''];
|
||||||
|
$ep = $endParts ?? ['y' => '', 'm' => '', 'd' => ''];
|
||||||
|
$ymin = (int) ($dateYearMin ?? ((int) date('Y') - 12));
|
||||||
|
$ymax = (int) ($dateYearMax ?? ((int) date('Y') + 2));
|
||||||
|
?>
|
||||||
|
<div class="flex flex-wrap items-center gap-1">
|
||||||
|
<span class="text-xs text-gray-500 mr-0.5">시작</span>
|
||||||
|
<select name="start_y" class="border border-gray-300 rounded px-1.5 py-1.5 text-sm min-w-[4.5rem]" title="시작 연도">
|
||||||
|
<option value="">연도</option>
|
||||||
|
<?php for ($yy = $ymin; $yy <= $ymax; $yy++): ?>
|
||||||
|
<option value="<?= $yy ?>" <?= (string) ($sp['y'] ?? '') === (string) $yy ? 'selected' : '' ?>><?= $yy ?></option>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</select>
|
||||||
|
<select name="start_m" class="border border-gray-300 rounded px-1.5 py-1.5 text-sm min-w-[3.75rem]" title="시작 월">
|
||||||
|
<option value="">월</option>
|
||||||
|
<?php for ($mi = 1; $mi <= 12; $mi++): ?>
|
||||||
|
<option value="<?= $mi ?>" <?= isset($sp['m']) && (int) $sp['m'] === $mi ? 'selected' : '' ?>><?= $mi ?>월</option>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</select>
|
||||||
|
<select name="start_d" class="border border-gray-300 rounded px-1.5 py-1.5 text-sm min-w-[3.75rem]" title="시작 일">
|
||||||
|
<option value="">일</option>
|
||||||
|
<?php for ($di = 1; $di <= 31; $di++): ?>
|
||||||
|
<option value="<?= $di ?>" <?= isset($sp['d']) && (int) $sp['d'] === $di ? 'selected' : '' ?>><?= $di ?>일</option>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</select>
|
||||||
|
<span class="text-sm text-gray-500 mx-0.5">~</span>
|
||||||
|
<span class="text-xs text-gray-500 mr-0.5">종료</span>
|
||||||
|
<select name="end_y" class="border border-gray-300 rounded px-1.5 py-1.5 text-sm min-w-[4.5rem]" title="종료 연도">
|
||||||
|
<option value="">연도</option>
|
||||||
|
<?php for ($yy = $ymin; $yy <= $ymax; $yy++): ?>
|
||||||
|
<option value="<?= $yy ?>" <?= (string) ($ep['y'] ?? '') === (string) $yy ? 'selected' : '' ?>><?= $yy ?></option>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</select>
|
||||||
|
<select name="end_m" class="border border-gray-300 rounded px-1.5 py-1.5 text-sm min-w-[3.75rem]" title="종료 월">
|
||||||
|
<option value="">월</option>
|
||||||
|
<?php for ($mi = 1; $mi <= 12; $mi++): ?>
|
||||||
|
<option value="<?= $mi ?>" <?= isset($ep['m']) && (int) $ep['m'] === $mi ? 'selected' : '' ?>><?= $mi ?>월</option>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</select>
|
||||||
|
<select name="end_d" class="border border-gray-300 rounded px-1.5 py-1.5 text-sm min-w-[3.75rem]" title="종료 일">
|
||||||
|
<option value="">일</option>
|
||||||
|
<?php for ($di = 1; $di <= 31; $di++): ?>
|
||||||
|
<option value="<?= $di ?>" <?= isset($ep['d']) && (int) $ep['d'] === $di ? 'selected' : '' ?>><?= $di ?>일</option>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</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="<?= base_url('bag/prices') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
|
||||||
|
<button type="button" onclick="window.print()" class="border border-gray-300 text-gray-700 px-3 py-1.5 rounded-sm text-sm hover:bg-gray-50">인쇄</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<div class="flex items-center justify-between mb-2 border-b pb-1">
|
||||||
|
<h3 class="text-base font-bold text-gray-700">봉투 단가</h3>
|
||||||
|
</div>
|
||||||
|
<div class="overflow-auto border border-gray-200">
|
||||||
|
<table class="data-table w-full">
|
||||||
|
<thead><tr>
|
||||||
|
<th class="w-16">번호</th><th>봉투코드</th><th>봉투명</th><th>발주단가</th><th>도매가</th><th>소비자가</th><th>적용시작</th><th>적용종료</th><th>상태</th>
|
||||||
|
</tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<?php if (! empty($bagPrices)): ?>
|
||||||
|
<?php foreach ($bagPrices as $row): ?>
|
||||||
|
<tr>
|
||||||
|
<td class="text-center"><?= esc($row->bp_idx) ?></td>
|
||||||
|
<td class="text-center font-mono"><?= esc($row->bp_bag_code) ?></td>
|
||||||
|
<td class="text-left"><?= esc($row->bp_bag_name ?? '') ?></td>
|
||||||
|
<td class="text-right"><?= number_format((float) ($row->bp_order_price ?? 0)) ?></td>
|
||||||
|
<td class="text-right"><?= number_format((float) ($row->bp_wholesale ?? 0)) ?></td>
|
||||||
|
<td class="text-right"><?= number_format((float) ($row->bp_consumer ?? 0)) ?></td>
|
||||||
|
<td class="text-center"><?= esc($row->bp_start_date ?? '') ?></td>
|
||||||
|
<td class="text-center"><?= ($row->bp_end_date ?? '') !== '' && $row->bp_end_date !== null ? esc((string) $row->bp_end_date) : '현재' ?></td>
|
||||||
|
<td class="text-center"><?= (int) ($row->bp_state ?? 1) === 1 ? '사용' : '만료' ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<tr><td colspan="9" class="text-center text-gray-400 py-4">등록된 단가 정보가 없습니다.</td></tr>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php if (! empty($pager)): ?>
|
||||||
|
<div class="mt-3 no-print"><?= $pager->links() ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
49
writable/database/bag_price_test_seed.sql
Normal file
49
writable/database/bag_price_test_seed.sql
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
-- 봉투 단가 테스트 데이터 (/bag/bag-prices — 적용 시작·종료 다양)
|
||||||
|
-- 전제: bag_price 테이블 존재, code_master O종 봉투코드와 맞춤(화면에서 선택 가능한 코드)
|
||||||
|
-- 대상 지자체: 활성 지자체 중 최소 lg_idx + lg_code 110204(남구), UNION 중복 제거
|
||||||
|
-- 재실행: 동일 (지자체, 봉투코드, 적용시작일) 이 이미 있으면 삽입 안 함
|
||||||
|
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
INSERT INTO `bag_price` (`bp_lg_idx`, `bp_bag_code`, `bp_bag_name`, `bp_order_price`, `bp_wholesale`, `bp_consumer`, `bp_start_date`, `bp_end_date`, `bp_state`, `bp_regdate`)
|
||||||
|
WITH `target_lg` AS (
|
||||||
|
(SELECT `lg_idx` FROM `local_government` WHERE `lg_state` = 1 ORDER BY `lg_idx` ASC LIMIT 1)
|
||||||
|
UNION
|
||||||
|
(SELECT `lg_idx` FROM `local_government` WHERE `lg_code` = '110204' LIMIT 1)
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
t.`lg_idx`,
|
||||||
|
v.`c`,
|
||||||
|
v.`n`,
|
||||||
|
v.`o`,
|
||||||
|
v.`w`,
|
||||||
|
v.`co`,
|
||||||
|
v.`s`,
|
||||||
|
v.`e`,
|
||||||
|
v.`st`,
|
||||||
|
NOW()
|
||||||
|
FROM `target_lg` t
|
||||||
|
CROSS JOIN (
|
||||||
|
SELECT '10112' AS c, '일반용 3L' AS n, 22.00 AS o, 58.00 AS w, 78.00 AS co, DATE '2023-01-01' AS s, DATE '2023-12-31' AS e, 0 AS st
|
||||||
|
UNION ALL SELECT '10112', '일반용 3L', 24.00, 59.00, 79.00, '2024-07-01', '2024-12-31', 0
|
||||||
|
UNION ALL SELECT '10122', '일반용 5L', 33.00, 98.00, 128.00, '2024-01-01', '2024-08-31', 0
|
||||||
|
UNION ALL SELECT '10122', '일반용 5L', 36.00, 102.00, 132.00, '2025-09-01', NULL, 1
|
||||||
|
UNION ALL SELECT '10132', '일반용 10L', 55.00, 180.00, 240.00, '2025-11-01', '2025-12-31', 1
|
||||||
|
UNION ALL SELECT '10132', '일반용 10L', 62.00, 192.00, 252.00, '2026-01-15', NULL, 1
|
||||||
|
UNION ALL SELECT '10152', '일반용 20L', 88.00, 340.00, 450.00, '2022-05-01', '2022-12-31', 0
|
||||||
|
UNION ALL SELECT '10152', '일반용 20L', 102.00, 375.00, 495.00, '2026-04-01', NULL, 1
|
||||||
|
UNION ALL SELECT '60102', '음식물 2L', 17.00, 48.00, 58.00, '2025-01-01', NULL, 1
|
||||||
|
UNION ALL SELECT '60132', '음식물 10L', 68.00, 205.00, 275.00, '2025-06-01', '2025-12-31', 0
|
||||||
|
UNION ALL SELECT '60132', '음식물 10L', 72.00, 212.00, 282.00, '2026-03-01', NULL, 1
|
||||||
|
UNION ALL SELECT '20172', '공공용 50L', 175.00, 680.00, 0.00, '2020-01-01', '2020-12-31', 0
|
||||||
|
UNION ALL SELECT '40152', '공동주택용 20L', 85.00, 330.00, 440.00, '2025-12-01', '2026-02-28', 1
|
||||||
|
UNION ALL SELECT '10172', '일반용 50L', 205.00, 850.00, 1120.00, '2026-06-01', NULL, 1
|
||||||
|
UNION ALL SELECT '10192', '일반용 75L', 295.00, 1260.00, 1660.00, '2026-12-01', NULL, 1
|
||||||
|
) v
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT 1 FROM `bag_price` b
|
||||||
|
WHERE b.`bp_lg_idx` = t.`lg_idx` AND b.`bp_bag_code` = v.`c` AND b.`bp_start_date` = v.`s`
|
||||||
|
);
|
||||||
|
|
||||||
|
-- bp_state: 0=미사용(과거 단가 등), 1=사용
|
||||||
|
-- bp_end_date NULL = 현재 적용 중(또는 종료일 미정)
|
||||||
11
writable/database/menu_site_fix_unit_price_mgmt_link.sql
Normal file
11
writable/database/menu_site_fix_unit_price_mgmt_link.sql
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
-- site 메뉴: "단가 관리" 가 조회 전용(bag/prices)으로 잘못 연결된 경우 → CRUD(bag/bag-prices)로 수정
|
||||||
|
-- UTF-8:
|
||||||
|
-- mysql --default-character-set=utf8mb4 -u ... -p DBNAME < writable/database/menu_site_fix_unit_price_mgmt_link.sql
|
||||||
|
|
||||||
|
SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
UPDATE `menu` m
|
||||||
|
INNER JOIN `menu_type` t ON t.mt_idx = m.mt_idx AND t.mt_code = 'site'
|
||||||
|
SET m.mm_link = 'bag/bag-prices'
|
||||||
|
WHERE m.mm_name = '단가 관리'
|
||||||
|
AND m.mm_link = 'bag/prices';
|
||||||
Reference in New Issue
Block a user