feat: 담당자에 소속·상호 필드 추가(#23)
- manager 테이블에 mg_affiliation(소속)·mg_company_name(상호) 컬럼 추가 (공유 DB 반영 완료 + writable/database에 마이그레이션 SQL 기록) - ManagerModel allowedFields, 등록/수정 폼(담당자명 아래), store/update 저장, 목록에 소속·상호 열 추가
This commit is contained in:
@@ -77,6 +77,8 @@ class Manager extends BaseController
|
||||
$rules = [
|
||||
'mg_name' => 'required|max_length[50]',
|
||||
'mg_category' => 'required|in_list[company,district,agency]',
|
||||
'mg_affiliation' => 'permit_empty|max_length[100]',
|
||||
'mg_company_name' => 'permit_empty|max_length[100]',
|
||||
'mg_tel' => 'permit_empty|max_length[20]',
|
||||
'mg_phone' => 'permit_empty|max_length[20]',
|
||||
'mg_email' => 'permit_empty|valid_email|max_length[100]',
|
||||
@@ -88,6 +90,8 @@ class Manager extends BaseController
|
||||
$this->model->insert([
|
||||
'mg_lg_idx' => admin_effective_lg_idx(),
|
||||
'mg_name' => $this->request->getPost('mg_name'),
|
||||
'mg_affiliation' => $this->request->getPost('mg_affiliation') ?? '',
|
||||
'mg_company_name' => $this->request->getPost('mg_company_name') ?? '',
|
||||
'mg_dept_code' => (string) ($this->request->getPost('mg_category') ?? ''),
|
||||
'mg_position_code' => $this->request->getPost('mg_position_code') ?? '',
|
||||
'mg_tel' => $this->request->getPost('mg_tel') ?? '',
|
||||
@@ -126,6 +130,8 @@ class Manager extends BaseController
|
||||
$rules = [
|
||||
'mg_name' => 'required|max_length[50]',
|
||||
'mg_category' => 'required|in_list[company,district,agency]',
|
||||
'mg_affiliation' => 'permit_empty|max_length[100]',
|
||||
'mg_company_name' => 'permit_empty|max_length[100]',
|
||||
'mg_state' => 'required|in_list[0,1]',
|
||||
];
|
||||
if (! $this->validate($rules)) {
|
||||
@@ -134,6 +140,8 @@ class Manager extends BaseController
|
||||
|
||||
$this->model->update($id, [
|
||||
'mg_name' => $this->request->getPost('mg_name'),
|
||||
'mg_affiliation' => $this->request->getPost('mg_affiliation') ?? '',
|
||||
'mg_company_name' => $this->request->getPost('mg_company_name') ?? '',
|
||||
'mg_dept_code' => (string) ($this->request->getPost('mg_category') ?? ''),
|
||||
'mg_position_code' => $this->request->getPost('mg_position_code') ?? '',
|
||||
'mg_tel' => $this->request->getPost('mg_tel') ?? '',
|
||||
|
||||
@@ -13,7 +13,8 @@ class ManagerModel extends Model
|
||||
protected $returnType = 'object';
|
||||
protected $useTimestamps = false;
|
||||
protected $allowedFields = [
|
||||
'mg_lg_idx', 'mg_name', 'mg_dept_code', 'mg_position_code',
|
||||
'mg_lg_idx', 'mg_name', 'mg_affiliation', 'mg_company_name',
|
||||
'mg_dept_code', 'mg_position_code',
|
||||
'mg_tel', 'mg_phone', 'mg_email', 'mg_state', 'mg_regdate',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -10,6 +10,16 @@
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="mg_name" type="text" value="<?= esc(old('mg_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="mg_affiliation" type="text" value="<?= esc(old('mg_affiliation')) ?>"/>
|
||||
</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="mg_company_name" type="text" value="<?= esc(old('mg_company_name')) ?>"/>
|
||||
</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-60" name="mg_category" required>
|
||||
|
||||
@@ -10,6 +10,16 @@
|
||||
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="mg_name" type="text" value="<?= esc(old('mg_name', $item->mg_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="mg_affiliation" type="text" value="<?= esc(old('mg_affiliation', $item->mg_affiliation ?? '')) ?>"/>
|
||||
</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="mg_company_name" type="text" value="<?= esc(old('mg_company_name', $item->mg_company_name ?? '')) ?>"/>
|
||||
</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-60" name="mg_category" required>
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
<tr class="text-left text-[11px] font-semibold text-gray-500 border-b border-gray-200">
|
||||
<th class="py-2.5 px-2 w-16 text-left">번호</th>
|
||||
<th class="py-2.5 px-2">담당자명</th>
|
||||
<th class="py-2.5 px-2">소속</th>
|
||||
<th class="py-2.5 px-2">상호</th>
|
||||
<th class="py-2.5 px-2">카테고리</th>
|
||||
<th class="py-2.5 px-2">전화</th>
|
||||
<th class="py-2.5 px-2">휴대전화</th>
|
||||
@@ -40,6 +42,8 @@
|
||||
<tr class="border-b border-gray-200 last:border-0 hover:bg-gray-50">
|
||||
<td class="py-2.5 px-2 text-left font-mono text-gray-700"><?= esc($row->mg_idx) ?></td>
|
||||
<td class="py-2.5 px-2 font-medium text-gray-900"><?= esc($row->mg_name) ?></td>
|
||||
<td class="py-2.5 px-2 text-gray-600"><?= esc($row->mg_affiliation ?? '') ?></td>
|
||||
<td class="py-2.5 px-2 text-gray-600"><?= esc($row->mg_company_name ?? '') ?></td>
|
||||
<td class="py-2.5 px-2">
|
||||
<?php
|
||||
$cat = (string) ($row->mg_dept_code ?? '');
|
||||
@@ -67,7 +71,7 @@
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php if (empty($list)): ?>
|
||||
<tr><td colspan="8" class="text-center text-gray-400 py-6">등록된 데이터가 없습니다.</td></tr>
|
||||
<tr><td colspan="10" class="text-center text-gray-400 py-6">등록된 데이터가 없습니다.</td></tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
5
writable/database/manager_affiliation_company_add.sql
Normal file
5
writable/database/manager_affiliation_company_add.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
-- 담당자(manager)에 소속·상호 컬럼 추가 (피드백 #23)
|
||||
-- MySQL 8.0은 ADD COLUMN IF NOT EXISTS 미지원 → 최초 1회만 실행.
|
||||
ALTER TABLE `manager`
|
||||
ADD COLUMN `mg_affiliation` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '소속' AFTER `mg_name`,
|
||||
ADD COLUMN `mg_company_name` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '상호' AFTER `mg_affiliation`;
|
||||
Reference in New Issue
Block a user