diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 494a217..d1ab850 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -125,6 +125,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au $routes->get('changeServer/(:num)', 'ServiceController::alternative_modify/$1'); $routes->get('terminateServer/(:num)', 'ServiceController::alternative_delete/$1'); $routes->post('history/(:num)', 'ServiceController::history/$1'); + $routes->post('billingat/(:num)', 'ServiceController::billingat/$1'); }); $routes->group('wallet', ['namespace' => 'App\Controllers\Admin\Customer\Wallet'], function ($routes) { $routes->group('account', function ($routes) { diff --git a/app/Controllers/AbstractCRUDController.php b/app/Controllers/AbstractCRUDController.php index 60acc51..40f8508 100644 --- a/app/Controllers/AbstractCRUDController.php +++ b/app/Controllers/AbstractCRUDController.php @@ -39,10 +39,10 @@ abstract class AbstractCRUDController extends AbstractWebController return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 생성폼 오류:" . $e->getMessage()); } } - protected function create_process(): object + protected function create_process(array $formDatas): object { // POST 데이터를 DTO 객체로 변환 (getPost()는 POST 요청 본문만 가져옵니다.) - return $this->service->create($this->service->createDTO($this->request->getPost())); + return $this->service->create($this->service->createDTO($formDatas)); } protected function create_result_process($entity, ?string $redirect_url = null): string|RedirectResponse @@ -59,7 +59,7 @@ abstract class AbstractCRUDController extends AbstractWebController try { $action = __FUNCTION__; $this->action_init_process($action); - $entity = $this->create_process(); + $entity = $this->create_process($this->request->getPost()); // 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사 $entityClass = $this->service->getEntityClass(); if (!$entity instanceof $entityClass) { @@ -99,10 +99,10 @@ abstract class AbstractCRUDController extends AbstractWebController } } - protected function modify_process($uid): object + protected function modify_process($uid, array $formDatas): object { // POST 데이터를 DTO 객체로 변환 - return $this->service->modify($uid, $this->service->createDTO($this->request->getPost())); + return $this->service->modify($uid, $this->service->createDTO($formDatas)); } protected function modify_result_process($entity, ?string $redirect_url = null): string|RedirectResponse @@ -121,7 +121,7 @@ abstract class AbstractCRUDController extends AbstractWebController } $action = __FUNCTION__; $this->action_init_process($action); - $entity = $this->modify_process($uid); + $entity = $this->modify_process($uid, $this->request->getPost()); $this->addViewDatas('entity', $entity); return $this->modify_result_process($entity); } catch (\Throwable $e) { diff --git a/app/Controllers/Admin/Customer/ServiceController.php b/app/Controllers/Admin/Customer/ServiceController.php index f1c6ffd..9de67b9 100644 --- a/app/Controllers/Admin/Customer/ServiceController.php +++ b/app/Controllers/Admin/Customer/ServiceController.php @@ -45,16 +45,21 @@ class ServiceController extends CustomerController public function history(int $uid): RedirectResponse|string { try { - $action = __FUNCTION__; - $fields = ['history']; - $this->service->getFormService()->setFormFields($fields); - $this->service->getFormService()->setFormRules($action, $fields); - $this->addViewDatas('entity', $this->service->modify($uid, $this->service->createDTO($this->request->getPost()))); + $this->addViewDatas('entity', parent::modify_process($uid, $this->request->getPost())); return $this->action_redirect_process('info', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 비고설정이 완료되었습니다."); } catch (\Throwable $e) { return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 비고설정 오류:" . $e->getMessage()); } } + public function billingat(int $uid): RedirectResponse|string + { + try { + $this->addViewDatas('entity', parent::modify_process($uid, $this->request->getPost())); + return $this->action_redirect_process('info', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 결제일 변경이 완료되었습니다."); + } catch (\Throwable $e) { + return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 결제일 변경 오류:" . $e->getMessage()); + } + } //대체서버 추가 public function alternative_create_form(int $uid): string|RedirectResponse diff --git a/app/Controllers/CommonController.php b/app/Controllers/CommonController.php index 0acfa91..19ba749 100644 --- a/app/Controllers/CommonController.php +++ b/app/Controllers/CommonController.php @@ -17,9 +17,8 @@ abstract class CommonController extends AbstractCRUDController { // --- 일괄 작업 (Batch Job) --- - protected function batchjob_pre_process(array $postDatas = []): array + protected function batchjob_pre_process(array $postDatas): array { - $postDatas = $this->request->getPost(); // 1. postDatas에서 선택된 uids 정보 추출 $uids = $postDatas['batchjob_uids'] ?? []; if (empty($uids)) { @@ -55,7 +54,7 @@ abstract class CommonController extends AbstractCRUDController try { $action = __FUNCTION__; // 사전작업 및 데이터 추출 초기화 - list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process(); + list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process($this->request->getPost()); $this->service->getFormService()->setFormFields($selectedFields); $this->service->getFormService()->setFormRules($action, $selectedFields); $this->service->getFormService()->setFormFilters($selectedFields); @@ -68,9 +67,8 @@ abstract class CommonController extends AbstractCRUDController } // --- 일괄 삭제 (Batch Job Delete) --- - protected function batchjob_delete_pre_process(): array + protected function batchjob_delete_pre_process(array $postDatas): array { - $postDatas = $this->request->getPost(); $uids = $postDatas['batchjob_uids'] ?? []; if (empty($uids)) { throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 삭제할 리스트을 선택하셔야합니다."); @@ -98,7 +96,7 @@ abstract class CommonController extends AbstractCRUDController final public function batchjob_delete(): string|RedirectResponse { try { - $uids = $this->batchjob_delete_pre_process(); + $uids = $this->batchjob_delete_pre_process($this->request->getPost()); $entities = $this->batchjob_delete_process($uids); return $this->batchjob_delete_result_process($uids, $entities); } catch (\Throwable $e) { diff --git a/app/Helpers/CommonHelper.php b/app/Helpers/CommonHelper.php index 1e378db..dd2b5d4 100644 --- a/app/Helpers/CommonHelper.php +++ b/app/Helpers/CommonHelper.php @@ -106,14 +106,12 @@ abstract class CommonHelper switch ($field) { case 'email': $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' form-control' : 'form-control'; - $extras['style'] = 'width:100%;'; $extras['placeholder'] = '예)test@example.co.kr'; $form = form_input($field, $value ?? "", $extras); break; case 'mobile': case 'phone': $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' form-control' : 'form-control'; - $extras['style'] = 'width:100%;'; $extras['placeholder'] = '예)010-0010-0010'; $form = form_input($field, $value ?? "", $extras); break; @@ -125,8 +123,7 @@ abstract class CommonHelper case 'updated_at': case 'created_at': case 'deleted_at': - $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' form-control calender' : 'form-control calender'; - $extras['style'] = 'width:100%;'; + $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender'; $form = form_input($field, $value ?? "", $extras); break; case 'description': @@ -134,7 +131,6 @@ abstract class CommonHelper case 'detail': case 'history': $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' form-control tinymce' : 'form-control tinymce'; - $extras['style'] = 'width:100%;'; $form = form_textarea($field, html_entity_decode($value ?? "", ENT_QUOTES, 'UTF-8'), $extras); break; case 'status': @@ -153,7 +149,6 @@ abstract class CommonHelper } $form = form_dropdown($field, $viewDatas['formOptions'][$field]['options'], $value, $extras); } else { - $extras['style'] = 'width:100%;'; $form = form_input($field, $value ?? "", $extras); } break; diff --git a/app/Views/cells/service/detail.php b/app/Views/cells/service/detail.php index e1204af..c36b67e 100644 --- a/app/Views/cells/service/detail.php +++ b/app/Views/cells/service/detail.php @@ -4,7 +4,7 @@
| 결제일 | -= $serviceEntity->getBillingAT() ?> | ++ = form_open("/admin/customer/service/billingat/{$serviceEntity->getPK()}", $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?> + 결제일 = $serviceCellDatas['helper']->getFieldForm('billing_at', $serviceEntity->getBillingAt(), ['entity' => $serviceEntity]) ?> + = form_submit('', '변경', array("class" => "btn btn-outline btn-primary")); ?> + = form_close(); ?> + | |
|---|---|---|---|
| 결제금 | +결제금 | = number_format(intval($serviceEntity->getAmount())) ?>원 | |