dbms_init...1
This commit is contained in:
parent
0cc866ce80
commit
af3ff49682
@ -331,8 +331,6 @@ define('LAYOUTS', [
|
||||
'<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">',
|
||||
'<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">',
|
||||
'<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">',
|
||||
'<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css">',
|
||||
'<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/select2-bootstrap-5-theme@1.3.0/dist/select2-bootstrap-5-theme.min.css" />',
|
||||
'<link rel="stylesheet" href="/css/common/style.css" />',
|
||||
],
|
||||
'javascripts' => [
|
||||
@ -363,6 +361,7 @@ define('LAYOUTS', [
|
||||
'<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">',
|
||||
'<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css">',
|
||||
'<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/select2-bootstrap-5-theme@1.3.0/dist/select2-bootstrap-5-theme.min.css" />',
|
||||
'<link rel="stylesheet" href="/assets/tagify/dist/tagify.css">',
|
||||
'<link rel="stylesheet" href="/css/common/style.css" />',
|
||||
],
|
||||
'javascripts' => [
|
||||
@ -370,6 +369,8 @@ define('LAYOUTS', [
|
||||
'<script src="//code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>',
|
||||
'<script src="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>',
|
||||
'<script src="//cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>',
|
||||
'<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>',
|
||||
'<script src="/assets/tagify/dist/tagify.js"></script>'
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
@ -299,6 +299,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->post('batchjob', 'DomainController::batchjob');
|
||||
$routes->post('batchjob_delete', 'DomainController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'DomainController::download/$1');
|
||||
$routes->post('confirm', 'DomainController::confirm');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -16,8 +16,6 @@ abstract class AdminController extends CommonController
|
||||
$this->uri_path = "admin/";
|
||||
$this->view_path = "admin" . DIRECTORY_SEPARATOR;
|
||||
$this->content_title = "관리자";
|
||||
$this->individualStylesheets = [];
|
||||
$this->individualScripts = [];
|
||||
$this->helper = $this->getHelper();
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,33 +68,38 @@ class ServiceController extends CustomerController
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
//추가관련
|
||||
protected function create_process(array $formDatas): mixed
|
||||
protected function create_process(array $formDatas): void
|
||||
{
|
||||
//수정자 정보 자동추가용
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::create_process($formDatas);
|
||||
//부모처리
|
||||
parent::create_process($formDatas);
|
||||
}
|
||||
//수정관련
|
||||
protected function modify_process(mixed $entity, array $formDatas): mixed
|
||||
protected function modify_process(mixed $entity, array $formDatas): void
|
||||
{
|
||||
//수정자 정보 자동추가용
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
//부모처리
|
||||
parent::modify_process($entity, $formDatas);
|
||||
}
|
||||
//View 관련
|
||||
protected function view_process(mixed $entity): mixed
|
||||
protected function view_process(mixed $entity): void
|
||||
{
|
||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||
$this->setFilterOptionsByItemType();
|
||||
//각각의 Item항목 정의
|
||||
return $this->getService()->setItemEntitiesByService($entity);
|
||||
$this->getService()->setItemEntitiesByService($entity);
|
||||
//부모처리
|
||||
parent::view_process($entity);
|
||||
}
|
||||
//Delete 관련
|
||||
protected function delete_process(mixed $entity): mixed
|
||||
protected function delete_process(mixed $entity): void
|
||||
{
|
||||
//각각의 Item항목 정의
|
||||
$entity = $this->getService()->setItemEntitiesByService($entity);
|
||||
return parent::delete_process($entity);
|
||||
//부모처리
|
||||
parent::delete_process($entity);
|
||||
}
|
||||
//List 관련
|
||||
protected function setWordConditionForList(): void
|
||||
@ -108,17 +113,20 @@ class ServiceController extends CustomerController
|
||||
}
|
||||
}
|
||||
}
|
||||
protected function index_process(): array
|
||||
protected function index_process(): void
|
||||
{
|
||||
//서비스별 미납 Count
|
||||
$this->unPaids = $this->getServicePaymentService()->getUnPaidCountByService();
|
||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||
$this->setFilterOptionsByItemType();
|
||||
//부모함수처리
|
||||
parent::index_process();
|
||||
//추가처리
|
||||
$entities = [];
|
||||
foreach (parent::index_process() as $entity) {
|
||||
foreach ($this->entities as $entity) {
|
||||
//각각의 Item항목 정의
|
||||
$entities[$entity->getPK()] = $this->getService()->setItemEntitiesByService($entity);
|
||||
}
|
||||
return $entities;
|
||||
$this->$entities = $entities;
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,12 +88,13 @@ class ServiceItemController extends CustomerController
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
protected function create_process(array $formDatas): ServiceItemEntity
|
||||
protected function create_process(array $formDatas): void
|
||||
{
|
||||
$serviceEntity = $this->getServiceService()->getEntity($formDatas['serviceinfo_uid']);
|
||||
if (!$serviceEntity) {
|
||||
throw new \Exception("{$formDatas['serviceinfo_uid']}에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
return parent::create_process($formDatas);
|
||||
//부모처리
|
||||
parent::create_process($formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,25 +82,28 @@ class ServicePaymentController extends CustomerController
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
//추가관련
|
||||
protected function create_process(array $formDatas): mixed
|
||||
protected function create_process(array $formDatas): void
|
||||
{
|
||||
//수정자 정보 자동추가용
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::create_process($formDatas);
|
||||
//부모처리
|
||||
parent::create_process($formDatas);
|
||||
}
|
||||
//수정관련
|
||||
protected function modify_process(mixed $entity, array $formDatas): mixed
|
||||
protected function modify_process(mixed $entity, array $formDatas): void
|
||||
{
|
||||
//수정자 정보 자동추가용
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
//부모처리
|
||||
parent::modify_process($entity, $formDatas);
|
||||
}
|
||||
//View 관련
|
||||
protected function view_process(mixed $entity): mixed
|
||||
protected function view_process(mixed $entity): void
|
||||
{
|
||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||
$this->setFilterOptionsByItemType();
|
||||
return parent::view_process($entity);
|
||||
//부모처리
|
||||
parent::view_process($entity);
|
||||
}
|
||||
//List 관련
|
||||
protected function setOrderByForList(): void
|
||||
@ -109,11 +112,12 @@ class ServicePaymentController extends CustomerController
|
||||
$this->getService()->getModel()->orderBy('billing_at', 'ASC', false);
|
||||
parent::setOrderByForList();
|
||||
}
|
||||
protected function index_process(): array
|
||||
protected function index_process(): void
|
||||
{
|
||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||
$this->setFilterOptionsByItemType();
|
||||
return parent::index_process();
|
||||
//부모처리
|
||||
parent::index_process();
|
||||
}
|
||||
//Invoice 관련
|
||||
private function getOwnersForInvoice(ClientEntity $ownerEntity): array
|
||||
@ -145,7 +149,7 @@ class ServicePaymentController extends CustomerController
|
||||
];
|
||||
return $temps;
|
||||
}
|
||||
private function invoice_process(): array
|
||||
private function invoice_process(): void
|
||||
{
|
||||
//변경할 UIDS
|
||||
$uids = $this->request->getPost('batchjob_uids[]');
|
||||
@ -187,7 +191,7 @@ class ServicePaymentController extends CustomerController
|
||||
$entities[$ownerEntity->getPK()]['total_amount'] += $entity->getAmount();
|
||||
}
|
||||
// dd($entities);
|
||||
return $entities;
|
||||
$this->entities = $entities;
|
||||
}
|
||||
public function invoice(): RedirectResponse|string
|
||||
{
|
||||
@ -198,7 +202,7 @@ class ServicePaymentController extends CustomerController
|
||||
$options = $this->getService()->getServiceItemLinkService($item_type)->getEntities();
|
||||
$this->setFilterFieldOption($item_type, $options);
|
||||
}
|
||||
$this->entities = $this->invoice_process();
|
||||
$this->invoice_process();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail($e->getMessage());
|
||||
|
||||
@ -5,6 +5,7 @@ namespace App\Controllers\Admin\Equipment\Part;
|
||||
use App\Helpers\Equipment\Part\DomainHelper;
|
||||
use App\Services\Equipment\Part\DomainService;
|
||||
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
@ -34,8 +35,58 @@ class DomainController extends PartController
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
helper(['form']);
|
||||
switch ($this->getAction()) {
|
||||
case 'create':
|
||||
$this->control = $this->getControlDatas();
|
||||
$this->getHelper()->setViewDatas($this->getViewDatas());
|
||||
$view_file = $this->view_path . 'domain' . DIRECTORY_SEPARATOR . 'view';
|
||||
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
protected function create_process(array $formDatas): void
|
||||
{
|
||||
$entities = [];
|
||||
//formDatas는 Json 값으로 넘어온다.
|
||||
foreach (json_decode($formDatas['domain'], true) as $domain) {
|
||||
//데이터 검증
|
||||
$validDatas = $this->doValidate(
|
||||
$this->getFieldRules(),
|
||||
['domain' => $domain['value'], 'status' => $formDatas['status']]
|
||||
);
|
||||
$entities[] = $this->getService()->create($validDatas);
|
||||
}
|
||||
$this->entities = $entities;
|
||||
}
|
||||
//도메인 존재여부 검증용
|
||||
final public function confirm(string $field = "domain"): ResponseInterface
|
||||
{
|
||||
try {
|
||||
//각 Field 초기화:조건항목 Field는 한개만 존재하므로 Field와 Rule을 정의
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->setFormFields([$field]);
|
||||
$this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field));
|
||||
//입력값정의
|
||||
$domain = $this->request->getVar($field);
|
||||
//기존 존재하는 Domain인지 확인용 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity([$field => $domain], "");
|
||||
return $this->response
|
||||
->setContentType('application/json')
|
||||
->setBody(json_encode(['exists' => true, 'message' => "[{$entity->getTitle()}] 이미 존재하는 도메인입니다."]));
|
||||
} catch (\Exception $e) {
|
||||
return $this->response
|
||||
->setContentType('application/json')
|
||||
->setBody(json_encode(['exists' => false, 'message' => $e->getMessage()]));
|
||||
}
|
||||
}
|
||||
protected function setOrderByForList(): void
|
||||
{
|
||||
//OrderBy 처리
|
||||
|
||||
@ -48,17 +48,17 @@ class LineController extends PartController
|
||||
//Index,FieldForm관련
|
||||
|
||||
//생성
|
||||
protected function create_process(array $formDatas): LineEntity
|
||||
protected function create_process(array $formDatas): void
|
||||
{
|
||||
//Line 등록
|
||||
if (!$this->getHelper()->isValidCIDR($formDatas['bandwith'])) {
|
||||
throw new \Exception("{$formDatas['bandwith']}는 CIDR 형식에 부합되지 않습니다.");
|
||||
}
|
||||
$entity = parent::create_process($formDatas);
|
||||
//부모처리
|
||||
parent::create_process($formDatas);
|
||||
//Prefixed IP to array 등록
|
||||
foreach ($this->getHelper()->cidrToIpRange($formDatas['bandwith']) as $ip) {
|
||||
$this->getIpService()->createByLineInfo($entity, $ip);
|
||||
$this->getIpService()->createByLineInfo($this->entity, $ip);
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ class ServerController extends EquipmentController
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
//View부분
|
||||
protected function view_process(mixed $entity): mixed
|
||||
protected function view_process(mixed $entity): void
|
||||
{
|
||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||
$entity->setItemEntities(
|
||||
@ -44,7 +44,8 @@ class ServerController extends EquipmentController
|
||||
$this->getService()->getEntities(['serviceinfo_uid' => $entity->getPK(), 'item_type' => $item_type])
|
||||
);
|
||||
}
|
||||
return parent::view_process($entity);
|
||||
//부모처리
|
||||
parent::view_process($entity);
|
||||
}
|
||||
//List부분
|
||||
protected function setOrderByForList(): void
|
||||
|
||||
@ -118,8 +118,8 @@ class UserController extends AdminController
|
||||
protected function profile_modify_process(mixed $entity, array $formDatas): mixed
|
||||
{
|
||||
//데이터 검증
|
||||
$formDatas = $this->doValidate($this->getFieldRules(), $formDatas);
|
||||
return $this->getService()->modify($entity, $formDatas);
|
||||
$validDatas = $this->doValidate($this->getFieldRules(), $formDatas);
|
||||
return $this->getService()->modify($entity, $validDatas);
|
||||
}
|
||||
final public function profile_modify(int $uid): RedirectResponse|string
|
||||
{
|
||||
|
||||
@ -41,11 +41,11 @@ class GoogleController extends AuthController
|
||||
}
|
||||
|
||||
//로그인처리
|
||||
protected function create_process(array $formDatas): UserEntity
|
||||
protected function create_process(array $formDatas): void
|
||||
{
|
||||
if (!array_key_exists('access_code', $formDatas) || !$formDatas['access_code']) {
|
||||
throw new \Exception("구글 로그인 실패");
|
||||
}
|
||||
return $this->getService()->login($formDatas);
|
||||
$this->entity = $this->getService()->login($formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,8 +29,8 @@ class LocalController extends AuthController
|
||||
return "";
|
||||
}
|
||||
//로그인처리
|
||||
protected function create_process(array $formDatas): UserEntity
|
||||
protected function create_process(array $formDatas): void
|
||||
{
|
||||
return $this->getService()->login($formDatas);
|
||||
$this->entity = $this->getService()->login($formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,6 +218,7 @@ abstract class CommonController extends BaseController
|
||||
if (!$validation) {
|
||||
$validation = service('validation');
|
||||
}
|
||||
// dd($rules);
|
||||
foreach ($rules as $field => $rule) {
|
||||
$validation = $this->setValidation($validation, $field, $rule);
|
||||
}
|
||||
@ -242,6 +243,7 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
helper(['form']);
|
||||
switch ($this->getAction()) {
|
||||
case 'create':
|
||||
case 'modify':
|
||||
@ -295,11 +297,11 @@ abstract class CommonController extends BaseController
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
protected function create_process(array $formDatas): mixed
|
||||
protected function create_process(array $formDatas): void
|
||||
{
|
||||
//데이터 검증
|
||||
$formDatas = $this->doValidate($this->getFieldRules(), $formDatas);
|
||||
return $this->getService()->create($formDatas);
|
||||
$validDatas = $this->doValidate($this->getFieldRules(), $formDatas);
|
||||
$this->entity = $this->getService()->create($validDatas);
|
||||
}
|
||||
final public function create(): RedirectResponse|string
|
||||
{
|
||||
@ -313,7 +315,7 @@ abstract class CommonController extends BaseController
|
||||
$formDatas[$field] = $this->request->getPost($field);
|
||||
}
|
||||
// dd($formDatas);
|
||||
$this->entity = $this->create_process($formDatas);
|
||||
$this->create_process($formDatas);
|
||||
$this->getService()->getModel()->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
@ -322,9 +324,9 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
}
|
||||
//수정관련
|
||||
protected function modify_form_process(mixed $entity): mixed
|
||||
protected function modify_form_process(mixed $entity): void
|
||||
{
|
||||
return $entity;
|
||||
$this->entity = $entity;
|
||||
}
|
||||
final public function modify_form(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
@ -345,18 +347,18 @@ abstract class CommonController extends BaseController
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->modify_form_process($entity);
|
||||
$this->modify_form_process($entity);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
protected function modify_process(mixed $entity, array $formDatas): mixed
|
||||
protected function modify_process(mixed $entity, array $formDatas): void
|
||||
{
|
||||
//데이터 검증
|
||||
$formDatas = $this->doValidate($this->getFieldRules(), $formDatas);
|
||||
return $this->getService()->modify($entity, $formDatas);
|
||||
$validDatas = $this->doValidate($this->getFieldRules(), $formDatas);
|
||||
$this->entity = $this->getService()->modify($entity, $validDatas);
|
||||
}
|
||||
final public function modify(int $uid): RedirectResponse|string
|
||||
{
|
||||
@ -375,7 +377,7 @@ abstract class CommonController extends BaseController
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->modify_process($entity, $formDatas);
|
||||
$this->modify_process($entity, $formDatas);
|
||||
$this->getService()->getModel()->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
@ -384,10 +386,11 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
}
|
||||
//단일필드작업
|
||||
final protected function toggle_process(mixed $entity, array $formDatas): mixed
|
||||
final protected function toggle_process(mixed $entity, array $formDatas): void
|
||||
{
|
||||
//modify_process를 호출하여 수정처리
|
||||
return $this->modify_process($entity, $formDatas);
|
||||
//데이터 검증
|
||||
$validDatas = $this->doValidate($this->getFieldRules(), $formDatas);
|
||||
$this->entity = $this->getService()->modify($entity, $validDatas);
|
||||
}
|
||||
final public function toggle(mixed $uid, string $field): RedirectResponse|string
|
||||
{
|
||||
@ -405,7 +408,7 @@ abstract class CommonController extends BaseController
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->toggle_process($entity, $formDatas);
|
||||
$this->toggle_process($entity, $formDatas);
|
||||
$this->getService()->getModel()->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
@ -414,10 +417,21 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
}
|
||||
//일괄처리작업
|
||||
final protected function batchjob_process(mixed $entity, array $formDatas): mixed
|
||||
final protected function batchjob_process(array $uids, array $formDatas): void
|
||||
{
|
||||
//modify_process를 호출하여 수정처리
|
||||
return $this->modify_process($entity, $formDatas);
|
||||
$entities = [];
|
||||
foreach ($uids as $uid) {
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
LogCollector::debug(__METHOD__ . "에서 {$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
} else {
|
||||
//데이터 검증
|
||||
$validDatas = $this->doValidate($this->getFieldRules(), $formDatas);
|
||||
$entities[] = $this->getService()->modify($entity, $validDatas);
|
||||
}
|
||||
}
|
||||
$this->entities = $entities;
|
||||
}
|
||||
final public function batchjob(): RedirectResponse|string
|
||||
{
|
||||
@ -448,19 +462,9 @@ abstract class CommonController extends BaseController
|
||||
foreach ($selectedFields as $field) {
|
||||
$this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field));
|
||||
}
|
||||
$entities = [];
|
||||
foreach ($uids as $uid) {
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
LogCollector::debug(__METHOD__ . "에서 {$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
} else {
|
||||
$entities[] = $this->batchjob_process($entity, $formDatas);
|
||||
}
|
||||
}
|
||||
$this->entities = $entities;
|
||||
$this->batchjob_process($uids, $formDatas);
|
||||
$this->getService()->getModel()->transCommit();
|
||||
LogCollector::debug(sprintf("%s에서 총 %s개중 %s개 일괄작업을 완료하였습니다.", __METHOD__, count($uids), count($entities)));
|
||||
LogCollector::debug(sprintf("%s에서 총 %s개중 %s개 일괄작업을 완료하였습니다.", __METHOD__, count($uids), count($this->entities)));
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$this->getService()->getModel()->transRollback();
|
||||
@ -469,9 +473,9 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
|
||||
//삭제,일괄삭제 공통사용
|
||||
protected function delete_process(mixed $entity): mixed
|
||||
protected function delete_process(mixed $entity): void
|
||||
{
|
||||
return $this->getService()->delete($entity);
|
||||
$this->entity = $this->getService()->delete($entity);
|
||||
}
|
||||
final public function delete(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
@ -485,7 +489,7 @@ abstract class CommonController extends BaseController
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->delete_process($entity);
|
||||
$this->delete_process($entity);
|
||||
$this->getService()->getModel()->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
@ -494,10 +498,19 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
}
|
||||
//일괄삭제
|
||||
final protected function batchjob_delete_process(mixed $entity): mixed
|
||||
final protected function batchjob_delete_process(array $uids): void
|
||||
{
|
||||
//delete_process를 호출하여 삭제처리
|
||||
return $this->delete_process($entity);
|
||||
$entities = [];
|
||||
foreach ($uids as $uid) {
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
LogCollector::debug(__METHOD__ . "에서 {$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
} else {
|
||||
$entities[] = $this->getService()->delete($entity);
|
||||
}
|
||||
}
|
||||
$this->entities = $entities;
|
||||
}
|
||||
final public function batchjob_delete(): RedirectResponse|string
|
||||
{
|
||||
@ -511,19 +524,9 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
//각 Field 초기화:삭제는 다른 초기화 필요없음
|
||||
$this->setAction(__FUNCTION__);
|
||||
$entities = [];
|
||||
foreach ($uids as $uid) {
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
LogCollector::debug(__METHOD__ . "에서 {$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
} else {
|
||||
$entities[] = $this->batchjob_delete_process($entity);
|
||||
}
|
||||
}
|
||||
$this->entities = $entities;
|
||||
$this->batchjob_delete_process($uids);
|
||||
$this->getService()->getModel()->transCommit();
|
||||
LogCollector::debug(sprintf("%s에서 총 %s개중 %s개 일괄삭제를 완료하였습니다.", __METHOD__, count($uids), count($entities)));
|
||||
LogCollector::debug(sprintf("%s에서 총 %s개중 %s개 일괄삭제를 완료하였습니다.", __METHOD__, count($uids), count($this->entities)));
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$this->getService()->getModel()->transRollback();
|
||||
@ -532,9 +535,9 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
|
||||
//View
|
||||
protected function view_process(mixed $entity): mixed
|
||||
protected function view_process(mixed $entity): void
|
||||
{
|
||||
return $entity;
|
||||
$this->entity = $entity;
|
||||
}
|
||||
final public function view(string $uid): RedirectResponse|string
|
||||
{
|
||||
@ -558,7 +561,7 @@ abstract class CommonController extends BaseController
|
||||
$this->$field = $value;
|
||||
}
|
||||
}
|
||||
$this->entity = $this->view_process($entity);
|
||||
$this->view_process($entity);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
@ -640,7 +643,7 @@ abstract class CommonController extends BaseController
|
||||
$this->total_page = $pager->getPageCount($pager_group);
|
||||
return $pager->links($pager_group, $template);
|
||||
}
|
||||
protected function index_process(): array
|
||||
protected function index_process(): void
|
||||
{
|
||||
//조건절 처리
|
||||
$this->setConditionForList();
|
||||
@ -655,7 +658,7 @@ abstract class CommonController extends BaseController
|
||||
$this->setOrderByForList();
|
||||
$this->getService()->getModel()->limit($this->per_page);
|
||||
$this->getService()->getModel()->offset(($this->page - 1) * $this->per_page);
|
||||
return $this->getService()->getEntities();
|
||||
$this->entities = $this->getService()->getEntities();
|
||||
}
|
||||
public function index(): RedirectResponse|string
|
||||
{
|
||||
@ -670,7 +673,7 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
// 현재 URL을 스택에 저장
|
||||
helper(['form']);
|
||||
$this->entities = $this->index_process();
|
||||
$this->index_process();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
@ -708,8 +711,7 @@ abstract class CommonController extends BaseController
|
||||
case 'excel':
|
||||
case 'pdf':
|
||||
helper(['form']);
|
||||
// string buffer에서 읽어오는 경우
|
||||
$this->entities = $this->index_process();
|
||||
$this->index_process();
|
||||
$html = $this->getResultSuccess();
|
||||
//data loading
|
||||
$reader = new Html();
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -4,8 +4,8 @@
|
||||
"settings": {
|
||||
"width": 3000,
|
||||
"height": 3000,
|
||||
"scrollTop": -695.5286,
|
||||
"scrollLeft": -409.6025,
|
||||
"scrollTop": -1339.1952,
|
||||
"scrollLeft": -710.6025,
|
||||
"zoomLevel": 0.79,
|
||||
"show": 511,
|
||||
"database": 4,
|
||||
@ -63,7 +63,6 @@
|
||||
"wX0DbZb_RcK85hWv9dxcX",
|
||||
"anhMCXytE7rcE_drKBPWz",
|
||||
"Wma86GpS3BhikEaHSamgX",
|
||||
"I80TuGxKm3tXIO_EO2PSm",
|
||||
"o8yw46vm30cC7wl9cRMdo",
|
||||
"ocWjncqwtYkP02mw4A0-8",
|
||||
"Hj5AZkoYGvM_syvnqMeOi",
|
||||
@ -717,7 +716,6 @@
|
||||
"comment": "도메인 정보",
|
||||
"columnIds": [
|
||||
"XnNj7H0bnTxo_NuZm7BOs",
|
||||
"U3pGwK2LVZA4wQ1xa6EcF",
|
||||
"w404_rDrrYyt26iqY8Eur",
|
||||
"E8iokQ-rKyw43cNe746kt",
|
||||
"SeMtkfNiltpn4j-M-XkG-",
|
||||
@ -745,14 +743,14 @@
|
||||
],
|
||||
"ui": {
|
||||
"x": 2396.448,
|
||||
"y": 1019.4062,
|
||||
"y": 1063.71,
|
||||
"zIndex": 1276,
|
||||
"widthName": 63,
|
||||
"widthComment": 65,
|
||||
"color": ""
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1750828790659,
|
||||
"updateAt": 1751612551642,
|
||||
"createAt": 1748218895681
|
||||
}
|
||||
},
|
||||
@ -796,15 +794,15 @@
|
||||
"n9ZWAQ9754sZ3MM4IxCAA"
|
||||
],
|
||||
"ui": {
|
||||
"x": 146.1271,
|
||||
"y": 927.5572,
|
||||
"x": 143.5955,
|
||||
"y": 908.5701,
|
||||
"zIndex": 2278,
|
||||
"widthName": 110,
|
||||
"widthComment": 60,
|
||||
"color": ""
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1750916226017,
|
||||
"updateAt": 1751612577827,
|
||||
"createAt": 1748484896313
|
||||
}
|
||||
},
|
||||
@ -6239,7 +6237,7 @@
|
||||
"default": "",
|
||||
"options": 8,
|
||||
"ui": {
|
||||
"keys": 2,
|
||||
"keys": 0,
|
||||
"widthName": 73,
|
||||
"widthComment": 60,
|
||||
"widthDataType": 60,
|
||||
@ -7683,7 +7681,7 @@
|
||||
"_AcWUYKzNJd-V0fRHq8Cx"
|
||||
],
|
||||
"x": 2158.5371,
|
||||
"y": 648.4446,
|
||||
"y": 662.7779333333333,
|
||||
"direction": 2
|
||||
},
|
||||
"end": {
|
||||
@ -7739,7 +7737,7 @@
|
||||
"_AcWUYKzNJd-V0fRHq8Cx"
|
||||
],
|
||||
"x": 2158.5371,
|
||||
"y": 820.4446,
|
||||
"y": 892.1112666666666,
|
||||
"direction": 2
|
||||
},
|
||||
"end": {
|
||||
@ -7767,7 +7765,7 @@
|
||||
"_AcWUYKzNJd-V0fRHq8Cx"
|
||||
],
|
||||
"x": 2158.5371,
|
||||
"y": 734.4446,
|
||||
"y": 777.4445999999999,
|
||||
"direction": 2
|
||||
},
|
||||
"end": {
|
||||
@ -7980,34 +7978,6 @@
|
||||
"createAt": 1749520727362
|
||||
}
|
||||
},
|
||||
"6oBuPqT-ikPI7X8a05Trv": {
|
||||
"id": "6oBuPqT-ikPI7X8a05Trv",
|
||||
"identification": false,
|
||||
"relationshipType": 16,
|
||||
"startRelationshipType": 2,
|
||||
"start": {
|
||||
"tableId": "JoMB-mb6p6NoHpiAvjD2y",
|
||||
"columnIds": [
|
||||
"FMB1Pw8d7ED0xlrEAdVok"
|
||||
],
|
||||
"x": 1697.1127,
|
||||
"y": 1340.0307,
|
||||
"direction": 1
|
||||
},
|
||||
"end": {
|
||||
"tableId": "B8haiEbPc1lRBWTv1g25G",
|
||||
"columnIds": [
|
||||
"O7aGU_LJxCO1NeNVWbB-J"
|
||||
],
|
||||
"x": 1457.1138999999998,
|
||||
"y": 1366.5724666666667,
|
||||
"direction": 2
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1749527376196,
|
||||
"createAt": 1749527376196
|
||||
}
|
||||
},
|
||||
"Hj5AZkoYGvM_syvnqMeOi": {
|
||||
"id": "Hj5AZkoYGvM_syvnqMeOi",
|
||||
"identification": false,
|
||||
@ -8027,8 +7997,8 @@
|
||||
"columnIds": [
|
||||
"ZWV8iXrgQovfYTm32QGbZ"
|
||||
],
|
||||
"x": 694.1271,
|
||||
"y": 1254.2238666666667,
|
||||
"x": 691.5955,
|
||||
"y": 1235.2367666666667,
|
||||
"direction": 2
|
||||
},
|
||||
"meta": {
|
||||
@ -8055,8 +8025,8 @@
|
||||
"columnIds": [
|
||||
"yc1mNA3iMmF8xoUX60z6F"
|
||||
],
|
||||
"x": 694.1271,
|
||||
"y": 1123.5572,
|
||||
"x": 691.5955,
|
||||
"y": 1104.5701,
|
||||
"direction": 2
|
||||
},
|
||||
"meta": {
|
||||
@ -8092,34 +8062,6 @@
|
||||
"createAt": 1750645375148
|
||||
}
|
||||
},
|
||||
"2TcX9drzSjfyNoNBwHe2B": {
|
||||
"id": "2TcX9drzSjfyNoNBwHe2B",
|
||||
"identification": false,
|
||||
"relationshipType": 16,
|
||||
"startRelationshipType": 2,
|
||||
"start": {
|
||||
"tableId": "6ajvOCaGuXU9pzV0Y9jEi",
|
||||
"columnIds": [
|
||||
"_AcWUYKzNJd-V0fRHq8Cx"
|
||||
],
|
||||
"x": 1627.5371,
|
||||
"y": 734.4446,
|
||||
"direction": 1
|
||||
},
|
||||
"end": {
|
||||
"tableId": "QCNA57Pi6A9dJDgybxS5v",
|
||||
"columnIds": [
|
||||
"38UvwuKxUk-yugwJmu0o0"
|
||||
],
|
||||
"x": 684.0004,
|
||||
"y": 1019.2028,
|
||||
"direction": 2
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1750667733988,
|
||||
"createAt": 1750667733988
|
||||
}
|
||||
},
|
||||
"e74Cc4zZztxyoazM_ssbu": {
|
||||
"id": "e74Cc4zZztxyoazM_ssbu",
|
||||
"identification": false,
|
||||
@ -8139,8 +8081,8 @@
|
||||
"columnIds": [
|
||||
"s1Az-lXWK0NlVQqFEEK8o"
|
||||
],
|
||||
"x": 694.1271,
|
||||
"y": 992.8905333333332,
|
||||
"x": 691.5955,
|
||||
"y": 973.9034333333333,
|
||||
"direction": 2
|
||||
},
|
||||
"meta": {
|
||||
@ -8148,34 +8090,6 @@
|
||||
"createAt": 1750829265309
|
||||
}
|
||||
},
|
||||
"FHzw49BTN_7RwEJXeKdhl": {
|
||||
"id": "FHzw49BTN_7RwEJXeKdhl",
|
||||
"identification": false,
|
||||
"relationshipType": 16,
|
||||
"startRelationshipType": 2,
|
||||
"start": {
|
||||
"tableId": "IsMoJXzvtuoOFFt93qS0w",
|
||||
"columnIds": [
|
||||
"sVypeCGZk-JXvsbwc93Rw"
|
||||
],
|
||||
"x": 1696.4192,
|
||||
"y": 1116.281,
|
||||
"direction": 1
|
||||
},
|
||||
"end": {
|
||||
"tableId": "B8haiEbPc1lRBWTv1g25G",
|
||||
"columnIds": [
|
||||
"AU5HgX9gt97EPfq5SoKnd"
|
||||
],
|
||||
"x": 1457.1138999999998,
|
||||
"y": 1115.9058,
|
||||
"direction": 2
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1750898732189,
|
||||
"createAt": 1750898732189
|
||||
}
|
||||
},
|
||||
"Y-MNlBi4tzmX_zwrY0zTc": {
|
||||
"id": "Y-MNlBi4tzmX_zwrY0zTc",
|
||||
"identification": false,
|
||||
|
||||
@ -19,7 +19,7 @@ class DomainHelper extends PartHelper
|
||||
}
|
||||
switch ($field) {
|
||||
case 'domain':
|
||||
$form = form_input($field, "", ["placeholder" => "예)domain.co.kr", ...$extras]);
|
||||
$form = form_input($field, "", ['id' => $field, "placeholder" => "예)domain.co.kr", ...$extras]);
|
||||
$form .= "<div id=\"domain-errors\" style=\"color:red; margin-top:5px;\"></div>";
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
return [
|
||||
'title' => "Domain정보",
|
||||
'label' => [
|
||||
'clientinfo_uid' => "고객명",
|
||||
'domain' => "도메인",
|
||||
'expired_at' => "종료일",
|
||||
'price' => "금액",
|
||||
|
||||
@ -13,7 +13,6 @@ class DomainModel extends PartModel
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = DomainEntity::class;
|
||||
protected $allowedFields = [
|
||||
'clientinfo_uid',
|
||||
"domain",
|
||||
"status",
|
||||
"updated_at"
|
||||
@ -28,9 +27,6 @@ class DomainModel extends PartModel
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
case "clientinfo_uid":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "domain":
|
||||
$rule = "required|trim|valid_domain";
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
|
||||
|
||||
@ -23,14 +23,13 @@ class DomainService extends PartService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"domain",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status',];
|
||||
return ['status',];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
@ -39,6 +38,6 @@ class DomainService extends PartService
|
||||
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return ['clientinfo_uid', 'domain', 'status'];
|
||||
return ['domain', 'status'];
|
||||
}
|
||||
}
|
||||
|
||||
20
app/Views/admin/domain/view.php
Normal file
20
app/Views/admin/domain/view.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?php if ($error = session('error')): echo $viewDatas['helper']->alert($error) ?><?php endif ?>
|
||||
<div id="container" class="content">
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['entities'] as $entity): ?>
|
||||
<?php $viewDatas['entity'] = $entity ?>
|
||||
<?php foreach ($viewDatas['control']['view_fields'] as $field): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start"><?= $viewDatas['helper']->getFieldView($field, $viewDatas['entity']->$field, $viewDatas) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -3,9 +3,15 @@
|
||||
|
||||
<head>
|
||||
<title><?= LAYOUTS[$viewDatas['layout']]['title'] ?></title>
|
||||
<?php foreach (LAYOUTS[$viewDatas['layout']]['metas'] as $meta): ?><?= $meta ?><?php endforeach; ?>
|
||||
<?php foreach (LAYOUTS[$viewDatas['layout']]['stylesheets'] as $stylesheet): ?><?= $stylesheet ?><?php endforeach; ?>
|
||||
<?php foreach (LAYOUTS[$viewDatas['layout']]['javascripts'] as $javascript): ?><?= $javascript ?><?php endforeach; ?>
|
||||
<?php foreach (LAYOUTS[$viewDatas['layout']]['metas'] as $meta): ?>
|
||||
<?= $meta ?>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach (LAYOUTS[$viewDatas['layout']]['stylesheets'] as $stylesheet): ?>
|
||||
<?= $stylesheet ?>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach (LAYOUTS[$viewDatas['layout']]['javascripts'] as $javascript): ?>
|
||||
<?= $javascript ?>
|
||||
<?php endforeach; ?>
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>.js"></script>
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
|
||||
@ -1,49 +1,2 @@
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>
|
||||
<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
||||
<link rel="stylesheet" href="/assets/tagify/dist/tagify.css">
|
||||
<script src="/assets/tagify/dist/tagify.js"></script>
|
||||
<?php foreach ($viewDatas['individualStylesheets'] as $css): ?>
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/<?= $css ?>" media="screen" rel="stylesheet" type="text/css" />
|
||||
<?php endforeach ?>
|
||||
<?php foreach ($viewDatas['individualScripts'] as $js): ?>
|
||||
<script src="/js/<?= $viewDatas['layout'] ?>/<?= $js ?>" referrerpolicy="origin"></script>
|
||||
<?php endforeach ?>
|
||||
|
||||
<script>
|
||||
const input = document.querySelector('#domain');
|
||||
const errorBox = document.getElementById('domain-errors');
|
||||
|
||||
const tagify = new Tagify(input, {
|
||||
enforceWhitelist: false, // 자유 입력 허용
|
||||
whitelist: [], // 자동완성 후보
|
||||
duplicates: false, // 중복 제거
|
||||
delimiters: ", ", // 엔터나 콤마로 구분
|
||||
pattern: /^[a-zA-Z0-9.-]+\.[a-z]{2,}$/ // 기본 도메인 형식
|
||||
});
|
||||
|
||||
// ✅ 입력된 태그가 추가될 때 AJAX 검증
|
||||
tagify.on('add', async e => {
|
||||
const domain = e.detail.data.value;
|
||||
// 서버로 도메인 유효성 검증 요청
|
||||
const res = await fetch('/admin/equipment/part/domain/validate', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
domain
|
||||
})
|
||||
});
|
||||
|
||||
const result = await res.json();
|
||||
|
||||
if (!result.valid) {
|
||||
// 유효하지 않으면 해당 태그 제거
|
||||
tagify.removeTag(domain);
|
||||
errorBox.innerText = `"${domain}" 은(는) 이미 등록되었거나 유효하지 않습니다.`;
|
||||
} else {
|
||||
errorBox.innerText = '';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@ -31,4 +31,35 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
dropdownAutoWidth: true
|
||||
});
|
||||
}
|
||||
if (document.querySelector('#domain')) {
|
||||
const domainSelecor = document.querySelector('#domain')
|
||||
const errorBox = document.getElementById('domain-errors');
|
||||
|
||||
const tagify = new Tagify(domainSelecor, {
|
||||
enforceWhitelist: false,
|
||||
whitelist: [],
|
||||
duplicates: false,
|
||||
delimiters: ", ",
|
||||
pattern: /[a-zA-Z0-9\.\/\?\:@\-_=#]+\.([a-zA-Z0-9\&\.\/\?\:@\-_=#])*/ // 도메인주소 패턴
|
||||
});
|
||||
// ✅ 패턴이 맞지 않을 때
|
||||
tagify.on('invalid', e => {
|
||||
const value = e.detail.data.value;
|
||||
errorBox.innerText = `"${value}" 은(는) 유효한 도메인 형식이 아니거나 중복됩니다. 예: domain.co.kr`;
|
||||
});
|
||||
// ✅ 서버에서 존재 여부 확인
|
||||
tagify.on('add', async e => {
|
||||
const domain = e.detail.data.value;
|
||||
const res = await fetch('/admin/equipment/part/domain/confirm', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({domain})
|
||||
});
|
||||
const results = await res.json();
|
||||
if (exists = results.exists === true || results.exists === 'true') {
|
||||
tagify.removeTag(domain); // 이미 존재하는 도메인 제거
|
||||
errorBox.innerText = results.message;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user