diff --git a/app/Cells/Equipment/CHASSISCell.php b/app/Cells/Equipment/CHASSISCell.php index ee45b1d..fd8b162 100644 --- a/app/Cells/Equipment/CHASSISCell.php +++ b/app/Cells/Equipment/CHASSISCell.php @@ -14,6 +14,7 @@ class CHASSISCell extends EquipmentCell $template = array_key_exists('template', $params) ? $params['template'] : 'stock'; return view('cells/chassis/' . $template, [ 'partCellDatas' => [ + 'helper' => $this->getService()->getHelper(), 'entities' => $this->getService()->getEntities(), ], ]); diff --git a/app/Cells/Part/RAMCell.php b/app/Cells/Part/RAMCell.php index 276b018..27c404c 100644 --- a/app/Cells/Part/RAMCell.php +++ b/app/Cells/Part/RAMCell.php @@ -16,6 +16,7 @@ class RAMCell extends PartCell $template = array_key_exists('template', $params) ? $params['template'] : 'ram_stock'; return view('cells/part/' . $template, [ 'partCellDatas' => [ + 'helper' => $this->getService()->getHelper(), 'entities' => $this->getService()->getEntities(), ], ]); diff --git a/app/Config/Routes.php b/app/Config/Routes.php index f42a6bb..e65ce3a 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -83,6 +83,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au $routes->post('batchjob_delete', 'PaymentController::batchjob_delete'); $routes->get('download/(:alpha)', 'PaymentController::download/$1'); $routes->post('invoice', 'PaymentController::invoice'); + $routes->get('paid/(:num)', 'PaymentController::paid/$1'); }); //Customer 관련 $routes->group('customer', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) { diff --git a/app/Helpers/Customer/ClientHelper.php b/app/Helpers/Customer/ClientHelper.php index 84868bf..37832fd 100644 --- a/app/Helpers/Customer/ClientHelper.php +++ b/app/Helpers/Customer/ClientHelper.php @@ -134,6 +134,45 @@ class ClientHelper extends CustomerHelper ] ); break; + case 'invoice': + $action = form_label( + $label, + 'payment_invoice', + [ + "data-src" => "/admin/payment?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup", + "data-bs-toggle" => "modal", + "data-bs-target" => "#modal_action_form", + "class" => "text-primary form-label-sm", + ] + ); + break; + case 'addService': + $action = form_label( + '서비스추가', + 'create_service', + [ + "data-src" => "/admin/customer/service/create?clientinfo_uid={$viewDatas['entity']->getPK()}", + "data-bs-toggle" => "modal", + "data-bs-target" => "#modal_action_form", + "class" => "btn btn-sm btn-primary form-label-sm", + ] + ); + break; + case 'unpaid': + $action = "{$label} 0원"; + if (array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids'])) { + $action = form_label( + sprintf("총 %s: %s건/%s원", $label, $viewDatas['unPaids'][$viewDatas['entity']->getPK()]['cnt'], number_format($viewDatas['unPaids'][$viewDatas['entity']->getPK()]['amount'])), + 'payment_unpaid', + [ + "data-src" => "/admin/payment?clientinfo_uid={$viewDatas['entity']->getPK()}&status=unpaid&ActionTemplate=popup", + "data-bs-toggle" => "modal", + "data-bs-target" => "#modal_action_form", + "class" => "text-primary form-label-sm", + ] + ); + } + break; default: $action = parent::getListButton($action, $label, $viewDatas, $extras); break; diff --git a/app/Helpers/Customer/ServiceHelper.php b/app/Helpers/Customer/ServiceHelper.php index 966014e..c8089a4 100644 --- a/app/Helpers/Customer/ServiceHelper.php +++ b/app/Helpers/Customer/ServiceHelper.php @@ -77,6 +77,18 @@ class ServiceHelper extends CustomerHelper public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string { switch ($action) { + case 'modify': + $action = form_label( + $label, + 'modify_service', + [ + "data-src" => "/admin/customer/service/modify/{$viewDatas['entity']->getPK()}?clientinfo_uid={$viewDatas['entity']->getClientInfoUID()}", + "data-bs-toggle" => "modal", + "data-bs-target" => "#modal_action_form", + "class" => "text-primary form-label-sm", + ] + ); + break; case 'addServer': $action = form_label( $label ? $label : ICONS['REBOOT'], diff --git a/app/Helpers/Equipment/CHASSISHelper.php b/app/Helpers/Equipment/CHASSISHelper.php index 1c7fc4e..236963a 100644 --- a/app/Helpers/Equipment/CHASSISHelper.php +++ b/app/Helpers/Equipment/CHASSISHelper.php @@ -8,4 +8,26 @@ class CHASSISHelper extends EquipmentHelper { parent::__construct(); } + + public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string + { + switch ($action) { + case 'modify': + $action = form_label( + $label, + 'disk_modify', + [ + "data-src" => "admin/equipment/chassis/modify/{$viewDatas['entity']->getPK()}", + "data-bs-toggle" => "modal", + "data-bs-target" => "#modal_action_form", + "class" => "text-primary form-label-sm", + ] + ); + break; + default: + $action = parent::getListButton($action, $label, $viewDatas, $extras); + break; + } + return $action; + } } diff --git a/app/Helpers/Part/DISKHelper.php b/app/Helpers/Part/DISKHelper.php index d41a0b7..82d3206 100644 --- a/app/Helpers/Part/DISKHelper.php +++ b/app/Helpers/Part/DISKHelper.php @@ -8,4 +8,25 @@ class DISKHelper extends PartHelper { parent::__construct(); } + public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string + { + switch ($action) { + case 'modify': + $action = form_label( + $label, + 'disk_modify', + [ + "data-src" => "admin/part/disk/modify/{$viewDatas['entity']->getPK()}", + "data-bs-toggle" => "modal", + "data-bs-target" => "#modal_action_form", + "class" => "text-primary form-label-sm", + ] + ); + break; + default: + $action = parent::getListButton($action, $label, $viewDatas, $extras); + break; + } + return $action; + } } diff --git a/app/Helpers/Part/RAMHelper.php b/app/Helpers/Part/RAMHelper.php index 8bac320..19cbdaa 100644 --- a/app/Helpers/Part/RAMHelper.php +++ b/app/Helpers/Part/RAMHelper.php @@ -8,4 +8,25 @@ class RAMHelper extends PartHelper { parent::__construct(); } + public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string + { + switch ($action) { + case 'modify': + $action = form_label( + $label, + 'ram_modify', + [ + "data-src" => "admin/part/ram/modify/{$viewDatas['entity']->getPK()}", + "data-bs-toggle" => "modal", + "data-bs-target" => "#modal_action_form", + "class" => "text-primary form-label-sm", + ] + ); + break; + default: + $action = parent::getListButton($action, $label, $viewDatas, $extras); + break; + } + return $action; + } } diff --git a/app/Helpers/PaymentHelper.php b/app/Helpers/PaymentHelper.php index 02c1c34..b4a85cb 100644 --- a/app/Helpers/PaymentHelper.php +++ b/app/Helpers/PaymentHelper.php @@ -62,18 +62,18 @@ class PaymentHelper extends CommonHelper case 'delete': $action = $this->getAuthContext()->isAccessRole([ROLE['USER']['SECURITY']]) ? parent::getListButton($action, $label, $viewDatas, $extras) : ""; break; - case 'paid': - $action = form_submit($action . "_submit", $label ? $label : '결제 처리', [ - "formaction" => current_url() . '/' . $action, - "class" => "btn btn-outline btn-warning", - ]); - break; case 'invoice': $action = form_submit($action . "_submit", $label ? $label : '청구서 발행', [ "formaction" => current_url() . '/' . $action, "class" => "btn btn-outline btn-primary", ]); break; + case 'paid': + $action = form_submit($action . "_submit", $label ? $label : '결제 처리', [ + "formaction" => current_url() . '/' . $action, + "class" => "btn btn-outline btn-warning", + ]); + break; default: $action = parent::getListButton($action, $label, $viewDatas, $extras); break; diff --git a/app/Services/PaymentService.php b/app/Services/PaymentService.php index e8ac59d..bd60f5b 100644 --- a/app/Services/PaymentService.php +++ b/app/Services/PaymentService.php @@ -241,6 +241,17 @@ class PaymentService extends CommonService return $rows; } + //지불 관련 + public function setPaid(PaymentEntity $entity, array $formDatas): PaymentEntity + { + //결제 완료 처리 후 추가정보 처리 + $formDatas['status'] = STATUS['PAID']; + $entity = parent::modify_process($entity, $formDatas); + //pay방식에따른 고객 정보 처리 + service('customer_client')->setBalance($entity); + return $entity; + } + //서비스관련 private function getFormDatasByService(ServiceEntity $serviceEntity, array $formDatas = []): array { diff --git a/app/Views/admin/client/detail.php b/app/Views/admin/client/detail.php index 97223b5..d00f4a2 100644 --- a/app/Views/admin/client/detail.php +++ b/app/Views/admin/client/detail.php @@ -32,34 +32,8 @@