diff --git a/app/Config/Constants.php b/app/Config/Constants.php
index f5d06b2..5cda487 100644
--- a/app/Config/Constants.php
+++ b/app/Config/Constants.php
@@ -163,6 +163,7 @@ define("MESSENGERS", [
]);
//아이콘 및 Sound관련
define('ICONS', [
+ 'ADD' => ' ',
'LOGO' => ' ',
'EXCEL' => ' ',
'PDF' => ' ',
@@ -175,6 +176,31 @@ define('ICONS', [
'NEW' => ' ',
'REPLY' => ' ',
'DATABASE' => ' ',
+ 'DISLIKE' => ' ',
+ 'LIKE' => ' ',
+ 'DOWNLOAD' => ' ',
+ 'UPLOAD' => ' ',
+ 'COPY' => ' ',
+ 'PASTE' => ' ',
+ 'EDIT' => ' ',
+ 'VIEW' => ' ',
+ 'VIEW_OFF' => ' ',
+ 'PRINT' => ' ',
+ 'SAVE' => ' ',
+ 'CANCEL' => ' ',
+ 'CLOSE' => ' ',
+ 'CLIENT' => ' ',
+ 'CHECK' => ' ',
+ 'CHECK_OFF' => ' ',
+ 'CHECK_ON' => ' ',
+ 'CHECK_ALL' => ' ',
+ 'CHECK_NONE' => ' ',
+ 'CHECK_SOME' => ' ',
+ 'COUPON' => ' ',
+ 'HISTORY' => ' ',
+ 'MODIFY' => ' ',
+ 'MODIFY_ALL' => ' ',
+ 'BATCHJOB' => ' ',
'DELETE' => ' ',
'REBOOT' => ' ',
'RELOAD' => ' ',
@@ -186,6 +212,7 @@ define('ICONS', [
'CARD' => ' ',
'DEPOSIT' => ' ',
'DESKTOP' => ' ',
+ 'DEVICE' => ' ',
'UP' => ' ',
'DOWN' => ' ',
'LEFT' => ' ',
@@ -198,7 +225,50 @@ define('ICONS', [
'BOX' => ' ',
'BOXS' => ' ',
'ONETIME' => ' ',
- 'SALE' => ' ',
+ 'EMAIL' => ' ',
+ 'MAIL' => ' ',
+ 'PHONE' => ' ',
+ 'POINT' => ' ',
+ 'ALRAM' => ' ',
+ 'PAYMENT' => ' ',
+ 'SALE_UP' => ' ',
+ 'SALE_DOWN' => ' ',
+ 'SERVICE' => ' ',
+ 'SERVICE_ITEM' => ' ',
+ 'SERVICE_ITEM_LINE' => ' ',
+ 'SERVICE_ITEM_IP' => ' ',
+ 'SERVICE_ITEM_SERVER' => ' ',
+ 'SERVICE_ITEM_CPU' => ' ',
+ 'SERVICE_ITEM_RAM' => ' ',
+ 'SERVICE_ITEM_STORAGE' => ' ',
+ 'SERVICE_ITEM_SOFTWARE' => ' ',
+ 'SERVICE_ITEM_DEFENCE' => ' ',
+ 'SERVICE_ITEM_DOMAIN' => ' ',
+ 'SERVICE_ITEM_OTHER' => ' ',
+
+]);
+//메신저 아이콘
+define('MESSENGER_ICONS', [
+ 'WHATSAPP' => ' ',
+ 'VIBER' => ' ',
+ 'LINE' => ' ',
+ 'KAKAO' => ' ',
+ 'DISCORD' => ' ',
+ 'TELEGRAM' => ' ',
+ 'SKYPE' => ' ',
+ 'YOUTUBE' => ' ',
+ 'FACEBOOK' => ' ',
+ 'TWITTER' => '',
+ 'INSTAGRAM' => ' ',
+ 'LINKEDIN' => ' ',
+ 'GITHUB' => ' ',
+ 'GITLAB' => ' ',
+ 'BITBUCKET' => ' ',
+ 'REDDIT' => ' ',
+ 'TIKTOK' => ' ',
+ 'PINTEREST' => ' ',
+ 'TUMBLR' => ' ',
+ 'SNAPCHAT' => ' ',
]);
//배너관련
define('TOP_BANNER', [
diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index f314327..4e85489 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -144,6 +144,8 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->post('batchjob', 'ServicePaymentController::batchjob');
$routes->post('batchjob_delete', 'ServicePaymentController::batchjob_delete');
$routes->get('download/(:alpha)', 'ServicePaymentController::download/$1');
+ $routes->get('invoice_email', 'ServicePaymentController::invoice_email', []);
+ $routes->get('invoice_mobile', 'ServicePaymentController::invoice_mobile', []);
});
});
$routes->group('equipment', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
diff --git a/app/Controllers/Admin/Customer/ServicePaymentController.php b/app/Controllers/Admin/Customer/ServicePaymentController.php
index b18f7a2..20ccca6 100644
--- a/app/Controllers/Admin/Customer/ServicePaymentController.php
+++ b/app/Controllers/Admin/Customer/ServicePaymentController.php
@@ -2,15 +2,16 @@
namespace App\Controllers\Admin\Customer;
+use App\Helpers\Customer\ServicePaymentHelper;
+use App\Libraries\LogCollector;
+use App\Services\Customer\ServicePaymentService;
+use App\Services\Customer\ServiceService;
+
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
-use App\Helpers\Customer\ServicePaymentHelper;
-use App\Services\Customer\ServicePaymentService;
-use App\Services\Customer\ServiceService;
-
class ServicePaymentController extends CustomerController
{
private ?ServiceService $_serviceService = null;
@@ -67,5 +68,73 @@ class ServicePaymentController extends CustomerController
}
return $options;
}
+ protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
+ {
+ switch ($this->getAction()) {
+ case 'invoice_email':
+ $result = parent::getResultSuccess($message, 'invoice_email');
+ break;
+ case 'invoice':
+ $result = parent::getResultSuccess($message, 'invoice');
+ break;
+ case 'index':
+ $result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'payment');
+ break;
+ default:
+ $result = parent::getResultSuccess($message, $actionTemplate);
+ break;
+ }
+ return $result;
+ }
//Index,FieldForm관련
+ private function setService(int $uid): void
+ {
+ $this->getServiceService()->getEntity($uid);
+ $entity = $this->getServiceService()->getEntity($uid);
+ if (!$entity) {
+ throw new \Exception("서비스 정보가 존재하지 않습니다. uid: {$uid}");
+ }
+ $this->_services[$uid] = $entity;
+ }
+ private function invoice_process(): array
+ {
+ //변경할 UIDS
+ $uids = $this->request->getPost('batchjob_uids[]');
+ if (!is_array($uids) || !count($uids)) {
+ throw new \Exception("청구서에 적용될 리스트를 선택하셔야합니다.");
+ }
+ $this->item_fields = ['item_type', 'ammount', 'biiling_cycle'];
+ $entities = [];
+ foreach ($uids as $uid) {
+ //기존 Entity 가져오기
+ $entity = $this->getService()->getEntity($uid);
+ if (!$entity) {
+ LogCollector::debug(__METHOD__ . "에서 {$uid}에 대한 정보를 찾을수 없습니다.");
+ }
+ //서비스 정보 추가
+ $this->addService($entity->getServiceUid());
+ $entities[] = $entity;
+ }
+ return $entities;
+ }
+ public function invoice_email(): RedirectResponse|string
+ {
+ try {
+ $this->setAction(__FUNCTION__);
+ $this->entities = $this->invoice_process();
+ return $this->getResultSuccess();
+ } catch (\Exception $e) {
+ return $this->getResultFail($e->getMessage());
+ }
+ }
+ public function invoice_mobile(): RedirectResponse|string
+ {
+ try {
+ $this->setAction(__FUNCTION__);
+ $this->entities = $this->invoice_process();
+ return $this->getResultSuccess();
+ } catch (\Exception $e) {
+ return $this->getResultFail($e->getMessage());
+ }
+ }
}
diff --git a/app/Entities/Customer/AccountEntity.php b/app/Entities/Customer/AccountEntity.php
index 017ba49..ec57e2a 100644
--- a/app/Entities/Customer/AccountEntity.php
+++ b/app/Entities/Customer/AccountEntity.php
@@ -8,4 +8,6 @@ class AccountEntity extends CustomerEntity
{
const PK = AccountModel::PK;
const TITLE = AccountModel::TITLE;
+ //고객정보객체-상속
+ //타 객체정의 부분
}
diff --git a/app/Entities/Customer/ClientEntity.php b/app/Entities/Customer/ClientEntity.php
index 2beff57..eb65302 100644
--- a/app/Entities/Customer/ClientEntity.php
+++ b/app/Entities/Customer/ClientEntity.php
@@ -8,6 +8,7 @@ class ClientEntity extends CustomerEntity
{
const PK = ClientModel::PK;
const TITLE = ClientModel::TITLE;
+ //타 객체정의 부분
public function getRole(): string
{
return $this->attributes['role'];
diff --git a/app/Entities/Customer/CouponEntity.php b/app/Entities/Customer/CouponEntity.php
index f02eed0..0708236 100644
--- a/app/Entities/Customer/CouponEntity.php
+++ b/app/Entities/Customer/CouponEntity.php
@@ -8,4 +8,6 @@ class CouponEntity extends CustomerEntity
{
const PK = CouponModel::PK;
const TITLE = CouponModel::TITLE;
+ //고객정보객체-상속
+ //타 객체정의 부분
}
diff --git a/app/Entities/Customer/CustomerEntity.php b/app/Entities/Customer/CustomerEntity.php
index 36e4370..e5fafdf 100644
--- a/app/Entities/Customer/CustomerEntity.php
+++ b/app/Entities/Customer/CustomerEntity.php
@@ -3,16 +3,27 @@
namespace App\Entities\Customer;
use App\Entities\CommonEntity;
+use App\Entities\Customer\ClientEntity;
abstract class CustomerEntity extends CommonEntity
{
+ private ?ClientEntity $_clientEntity = null;
public function __construct(array|null $data = null)
{
parent::__construct($data);
}
-
+ //고객정보객체
final public function getClientUID(): int
{
return intval($this->attributes['clientinfo_uid']);
}
+ final public function getClient(): ClientEntity|null
+ {
+ return $this->_clientEntity;
+ }
+ final public function setClient(ClientEntity $clientEntity): void
+ {
+ $this->_clientEntity = $clientEntity;
+ }
+ //타 객체정의 부분
}
diff --git a/app/Entities/Customer/PointEntity.php b/app/Entities/Customer/PointEntity.php
index 0713ba7..ead7c25 100644
--- a/app/Entities/Customer/PointEntity.php
+++ b/app/Entities/Customer/PointEntity.php
@@ -8,4 +8,6 @@ class PointEntity extends CustomerEntity
{
const PK = PointModel::PK;
const TITLE = PointModel::TITLE;
+ //고객정보객체-상속
+ //타 객체정의 부분
}
diff --git a/app/Entities/Customer/ServiceEntity.php b/app/Entities/Customer/ServiceEntity.php
index 62c173e..3501068 100644
--- a/app/Entities/Customer/ServiceEntity.php
+++ b/app/Entities/Customer/ServiceEntity.php
@@ -2,16 +2,29 @@
namespace App\Entities\Customer;
+use App\Entities\Customer\ClientEntity;
use App\Models\Customer\ServiceModel;
class ServiceEntity extends CustomerEntity
{
const PK = ServiceModel::PK;
const TITLE = ServiceModel::TITLE;
+ private ?ClientEntity $_ownerEntity = null;
+ //고객정보객체-상속
+ //관리자정보객체
final public function getOwnerUID(): int
{
return intval($this->attributes['ownerinfo_uid']);
}
+ final public function getOwner(): ClientEntity|null
+ {
+ return $this->_ownerEntity;
+ }
+ final public function setOwner(ClientEntity $ownerEntity): void
+ {
+ $this->_ownerEntity = $ownerEntity;
+ }
+ //타 객체정의 부분
public function getCode(): string
{
return $this->attributes['code'];
@@ -20,7 +33,6 @@ class ServiceEntity extends CustomerEntity
{
return $this->attributes['billing_at'];
}
-
public function getItemEntities(string $type): array
{
return $this->attributes[$type] ?? [];
diff --git a/app/Entities/Customer/ServiceHistoryEntity.php b/app/Entities/Customer/ServiceHistoryEntity.php
index 9d91537..c21c674 100644
--- a/app/Entities/Customer/ServiceHistoryEntity.php
+++ b/app/Entities/Customer/ServiceHistoryEntity.php
@@ -2,14 +2,26 @@
namespace App\Entities\Customer;
+use App\Entities\Customer\ServiceEntity;
use App\Models\Customer\ServiceHistoryModel;
class ServiceHistoryEntity extends CustomerEntity
{
const PK = ServiceHistoryModel::PK;
const TITLE = ServiceHistoryModel::TITLE;
+ private ?ServiceEntity $_serviceEntity = null;
+ //서비스정보객체
public function getServiceUid(): int
{
return intval($this->attributes['serviceinfo_uid']);
}
+ final public function getService(): ServiceEntity|null
+ {
+ return $this->_serviceEntity;
+ }
+ final public function setService(ServiceEntity $serviceEntity): void
+ {
+ $this->_serviceEntity = $serviceEntity;
+ }
+ //타 객체정의 부분
}
diff --git a/app/Entities/Customer/ServiceItemEntity.php b/app/Entities/Customer/ServiceItemEntity.php
index 4f331c9..95db9fb 100644
--- a/app/Entities/Customer/ServiceItemEntity.php
+++ b/app/Entities/Customer/ServiceItemEntity.php
@@ -2,16 +2,29 @@
namespace App\Entities\Customer;
+use App\Entities\Customer\ServiceEntity;
use App\Models\Customer\ServiceItemModel;
class ServiceItemEntity extends CustomerEntity
{
const PK = ServiceItemModel::PK;
const TITLE = ServiceItemModel::TITLE;
- public function getServiceUid(): int
+ private ?ServiceEntity $_serviceEntity = null;
+ //서비스정보객체
+ final public function getServiceUid(): int
{
return intval($this->attributes['serviceinfo_uid']);
}
+ final public function getService(): ServiceEntity|null
+ {
+ return $this->_serviceEntity;
+ }
+ final public function setService(ServiceEntity $serviceEntity): void
+ {
+ $this->_serviceEntity = $serviceEntity;
+ }
+ //타 객체정의 부분
+
public function getItemType(): string
{
return $this->attributes['item_type'];
@@ -38,7 +51,7 @@ class ServiceItemEntity extends CustomerEntity
}
public function getView_Sale(): string
{
- return $this->getPrice() > $this->getAmount() ? "" : ICONS['SALE'];
+ return $this->getPrice() > $this->getAmount() ? "" : ICONS['SALE_DOWN'];
}
public function getView_BillingCycle(): string
{
diff --git a/app/Entities/Customer/ServicePaymentEntity.php b/app/Entities/Customer/ServicePaymentEntity.php
index 45abffe..4e3640d 100644
--- a/app/Entities/Customer/ServicePaymentEntity.php
+++ b/app/Entities/Customer/ServicePaymentEntity.php
@@ -2,6 +2,7 @@
namespace App\Entities\Customer;
+use App\Entities\Customer\ServiceEntity;
use App\Models\Customer\ServicePaymentModel;
use DateTime;
@@ -9,10 +10,36 @@ class ServicePaymentEntity extends CustomerEntity
{
const PK = ServicePaymentModel::PK;
const TITLE = ServicePaymentModel::TITLE;
- public function getServiceUid(): int
+ private ?ServiceEntity $_serviceEntity = null;
+ private ?ClientEntity $_ownerEntity = null;
+ //고객정보객체-상속
+ //서비스정보객체
+ final public function getServiceUid(): int
{
return intval($this->attributes['serviceinfo_uid']);
}
+ final public function getService(): ServiceEntity|null
+ {
+ return $this->_serviceEntity;
+ }
+ final public function setService(ServiceEntity $serviceEntity): void
+ {
+ $this->_serviceEntity = $serviceEntity;
+ }
+ //관리자정보객체
+ final public function getOwnerUID(): int
+ {
+ return intval($this->attributes['ownerinfo_uid']);
+ }
+ final public function getOwner(): ClientEntity|null
+ {
+ return $this->_ownerEntity;
+ }
+ final public function setOwner(ClientEntity $ownerEntity): void
+ {
+ $this->_ownerEntity = $ownerEntity;
+ }
+ //타 객체정의 부분
public function getItemType(): string
{
return $this->attributes['item_type'];
@@ -32,16 +59,20 @@ class ServicePaymentEntity extends CustomerEntity
}
public function getView_CounDueAt(): string
{
- $now = new DateTime(); // 오늘 날짜
- $due = new DateTime($this->getBillingAt());
- if ($due < $now) {
- $interval = $due->diff($now);
- return "{$interval->days}일 전";
- } else if ($due > $now) {
- $interval = $now->diff($due);
- return "{$interval->days}일 남음";
- } else {
- return "당일";
+ $result = "";
+ if ($this->getStatus() === DEFAULTS['STATUS']) {
+ $now = new DateTime(); // 오늘 날짜
+ $due = new DateTime($this->getBillingAt());
+ if ($due < $now) {
+ $interval = $due->diff($now);
+ $result = "{$interval->days}일전";
+ } else if ($due > $now) {
+ $interval = $now->diff($due);
+ $result = "{$interval->days}일후";
+ } else {
+ $result = "당일";
+ }
}
+ return $result;
}
}
diff --git a/app/Helpers/CommonHelper.php b/app/Helpers/CommonHelper.php
index ab52723..bfc4891 100644
--- a/app/Helpers/CommonHelper.php
+++ b/app/Helpers/CommonHelper.php
@@ -357,7 +357,7 @@ class CommonHelper
// echo current_url() . '/' . $action . '?' . $this->request->getUri()->getQuery();
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
$action = form_label(
- '입력',
+ ICONS['ADD'],
$action,
[
"data-src" => current_url() . '/' . $action . '?' . $this->request->getUri()->getQuery(),
diff --git a/app/Helpers/Customer/ServiceHelper.php b/app/Helpers/Customer/ServiceHelper.php
index de86585..a79d844 100644
--- a/app/Helpers/Customer/ServiceHelper.php
+++ b/app/Helpers/Customer/ServiceHelper.php
@@ -113,7 +113,7 @@ class ServiceHelper extends CustomerHelper
case 'history':
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
$action = form_label(
- ICONS['PLAY'],
+ ICONS['HISTORY'],
$action,
[
"data-src" => "/admin/customer/servicehistory?serviceinfo_uid={$viewDatas['entity']->getPK()}",
diff --git a/app/Helpers/Customer/ServicePaymentHelper.php b/app/Helpers/Customer/ServicePaymentHelper.php
index 1209261..e426333 100644
--- a/app/Helpers/Customer/ServicePaymentHelper.php
+++ b/app/Helpers/Customer/ServicePaymentHelper.php
@@ -72,7 +72,7 @@ class ServicePaymentHelper extends CustomerHelper
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
{
switch ($field) {
- case "due_at":
+ case "countdown": //결제일Countdown
$value = $viewDatas['entity']->getView_CounDueAt();
break;
default:
@@ -85,4 +85,64 @@ class ServicePaymentHelper extends CustomerHelper
}
return $value;
}
+ public function getListButton(string $action, array $viewDatas, array $extras = []): string
+ {
+ switch ($action) {
+ case 'modify':
+ $checkbox = '';
+ //상태가 미지급이 경우만 checkbox를 표시
+ if ($viewDatas['entity']->getStatus() === DEFAULTS['STATUS']) {
+ $oldBatchJobUids = old("batchjob_uids", null);
+ $oldBatchJobUids = is_array($oldBatchJobUids) ? $oldBatchJobUids : [$oldBatchJobUids];
+ $checkbox = form_checkbox([
+ "id" => "checkbox_uid_{$viewDatas['entity']->getPK()}",
+ "name" => "batchjob_uids[]",
+ "value" => $viewDatas['entity']->getPK(),
+ "class" => "batchjobuids_checkboxs",
+ "checked" => in_array($viewDatas['entity']->getPK(), $oldBatchJobUids)
+ ]);
+ }
+ $action = $checkbox . form_label(
+ $viewDatas['cnt'],
+ $action,
+ [
+ "data-src" => current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK() . '?' . $this->request->getUri()->getQuery(),
+ "data-bs-toggle" => "modal",
+ "data-bs-target" => "#index_action_form",
+ ...$extras
+ ]
+ );
+ break;
+ case 'invoice_email':
+ $extras = ["class" => "btn btn-outline btn-success btn-circle", "target" => "_self", ...$extras];
+ $action = form_label(
+ ICONS['MAIL'],
+ $action,
+ [
+ "data-src" => "/admin/customer/payment/invoice?ActionTemplate=email",
+ "data-bs-toggle" => "modal",
+ "data-bs-target" => "#index_action_form",
+ ...$extras
+ ]
+ );
+ break;
+ case 'invoice_mobile':
+ $extras = ["class" => "btn btn-outline btn-success btn-circle", "target" => "_self", ...$extras];
+ $action = form_label(
+ ICONS['PHONE'],
+ $action,
+ [
+ "data-src" => "/admin/customer/payment/invoice?ActionTemplate=mobile",
+ "data-bs-toggle" => "modal",
+ "data-bs-target" => "#index_action_form",
+ ...$extras
+ ]
+ );
+ break;
+ default:
+ $action = parent::getListButton($action, $viewDatas, $extras);
+ break;
+ }
+ return $action;
+ }
}
diff --git a/app/Language/en/Customer/Service.php b/app/Language/en/Customer/Service.php
index 29c00aa..06d42c1 100644
--- a/app/Language/en/Customer/Service.php
+++ b/app/Language/en/Customer/Service.php
@@ -10,7 +10,7 @@ return [
'switch' => "스위치코드",
'code' => "서버코드",
'raid' => "RAID",
- 'billing_at' => "청구일",
+ 'billing_at' => "납부기한",
'start_at' => "개통일",
'status' => "상태",
'updated_at' => "수정일",
diff --git a/app/Language/en/Customer/ServiceItem.php b/app/Language/en/Customer/ServiceItem.php
index 127e876..035bdb5 100644
--- a/app/Language/en/Customer/ServiceItem.php
+++ b/app/Language/en/Customer/ServiceItem.php
@@ -5,7 +5,7 @@ return [
'serviceinfo_uid' => "서비스명",
'item_type' => "항목형식",
'item_uid' => "항목",
- 'billing_cycle' => "청구방식",
+ 'billing_cycle' => "납부방식",
'price' => "소비자금액",
'amount' => "서비스금액",
'start_at' => "개통일",
diff --git a/app/Language/en/Customer/ServicePayment.php b/app/Language/en/Customer/ServicePayment.php
index 02cc5d8..099096f 100644
--- a/app/Language/en/Customer/ServicePayment.php
+++ b/app/Language/en/Customer/ServicePayment.php
@@ -4,17 +4,17 @@ return [
'label' => [
'serviceinfo_uid' => "서비스명",
'ownerinfo_uid' => "관리자",
- 'item_type' => "항목형식",
+ 'item_type' => "항목종류",
'item_uid' => "항목",
- 'billing_cycle' => "청구방식",
+ 'billing_cycle' => "납부방식",
'amount' => "결제금액",
- 'billing_at' => "지급기한일",
+ 'billing_at' => "납부기한",
'issue_at' => "발행일",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "신청일",
'deleted_at' => "삭제일",
- 'due_at' => "결제일",
+ 'countdown' => "납부기간",
"LINE" => "라인",
"IP" => "IP주소",
"SERVER" => "서버",
@@ -48,6 +48,5 @@ return [
"STATUS" => [
'default' => "미지급",
"paid" => "지급완료",
- "delete" => "삭제",
],
];
diff --git a/app/Services/CommonService.php b/app/Services/CommonService.php
index 5b78e57..d2d805f 100644
--- a/app/Services/CommonService.php
+++ b/app/Services/CommonService.php
@@ -58,25 +58,36 @@ abstract class CommonService
}
return $this->_model;
}
- final public function getEntity(mixed $where, ?string $message = null): mixed
+ //Entity의 관련객체정의용
+ protected function setRelatedEntity(mixed $entity): mixed
{
- return is_array($where) ? $this->getModel()->where($where)->first() : $this->getModel()->find($where);
+ return $entity;
}
- final public function getEntities(mixed $where = null, array $columns = ['*']): array
+ public function getEntity(mixed $where, ?string $message = null): mixed
+ {
+ $entity = is_array($where) ? $this->getModel()->where($where)->first() : $this->getModel()->find($where);
+ if (!$entity) {
+ throw new \Exception($message ?? __METHOD__ . "에서 해당 정보가 존재하지 않습니다");
+ }
+ return $this->setRelatedEntity($entity);
+ }
+ public function getEntities(mixed $where = null, array $columns = ['*']): array
{
if ($where) {
$this->getModel()->where($where);
}
- $entitys = [];
+ $entities = [];
foreach ($this->getModel()->select(implode(',', $columns))->findAll() as $entity) {
- $entitys[$entity->getPK()] = $entity;
+ $entitys[$entity->getPK()] = $this->setRelatedEntity($entity);
}
if (env('app.debug.index')) {
echo $this->getModel()->getLastQuery() . " ";
// exit;
}
- return $entitys;
+ return $entities;
} //
+ //기본 기능부분
+
//FieldForm관련용
public function getFormFieldRule(string $action, string $field): string
{
diff --git a/app/Services/Customer/AccountService.php b/app/Services/Customer/AccountService.php
index 89b98f0..c468d57 100644
--- a/app/Services/Customer/AccountService.php
+++ b/app/Services/Customer/AccountService.php
@@ -42,6 +42,15 @@ class AccountService extends CustomerService
{
return ['status'];
}
+ //Entity의 관련객체정의용
+ protected function setRelatedEntity(mixed $entity): AccountEntity
+ {
+ //고객정보정의
+ $entity->setClient($this->getClient($entity->getClientUID()));
+ return $entity;
+ }
+ //기본 기능부분
+
//고객예치금처리
private function setBalance(array $formDatas): ClientEntity
{
diff --git a/app/Services/Customer/ClientService.php b/app/Services/Customer/ClientService.php
index 9e5cd69..5fcdb38 100644
--- a/app/Services/Customer/ClientService.php
+++ b/app/Services/Customer/ClientService.php
@@ -40,6 +40,8 @@ class ClientService extends CustomerService
{
return ['name', 'email', 'phone', 'role', 'account_balance', 'coupon_balance', 'point_balance', 'status'];
}
+ //기본 기능부분
+
//압금(쿠폰:추가)처리
public function deposit(ClientEntity $entity, string $field, int $amount): ClientEntity
{
diff --git a/app/Services/Customer/CouponService.php b/app/Services/Customer/CouponService.php
index 393f986..35fbace 100644
--- a/app/Services/Customer/CouponService.php
+++ b/app/Services/Customer/CouponService.php
@@ -41,6 +41,15 @@ class CouponService extends CustomerService
{
return ['status'];
}
+ //Entity의 관련객체정의용
+ protected function setRelatedEntity(mixed $entity): CouponEntity
+ {
+ //고객정보정의
+ $entity->setClient($this->getClient($entity->getClientUID()));
+ return $entity;
+ }
+ //기본 기능부분
+
//고객예치금처리
private function setBalance(array $formDatas): ClientEntity
{
diff --git a/app/Services/Customer/CustomerService.php b/app/Services/Customer/CustomerService.php
index f54eee1..d99803a 100644
--- a/app/Services/Customer/CustomerService.php
+++ b/app/Services/Customer/CustomerService.php
@@ -2,19 +2,20 @@
namespace App\Services\Customer;
+use App\Entities\Customer\ClientEntity;
use App\Services\CommonService;
-use CodeIgniter\HTTP\IncomingRequest;
use App\Services\Customer\ClientService;
+use App\Services\Equipment\DomainService;
use App\Services\Equipment\Part\CpuService;
use App\Services\Equipment\Part\DefenceService;
-use App\Services\Equipment\Part\StorageService;
use App\Services\Equipment\Part\IpService;
use App\Services\Equipment\Part\LineService;
use App\Services\Equipment\Part\RamService;
use App\Services\Equipment\Part\SoftwareService;
+use App\Services\Equipment\Part\StorageService;
use App\Services\Equipment\ServerService;
-use App\Services\Equipment\DomainService;
+use CodeIgniter\HTTP\IncomingRequest;
abstract class CustomerService extends CommonService
{
@@ -71,4 +72,13 @@ abstract class CustomerService extends CommonService
}
return $this->_equipmentService[$key];
}
+ //기본기능
+ final public function getClient(int $uid): ClientEntity
+ {
+ $entity = $this->getClientService()->getEntity($uid);
+ if (!$entity) {
+ throw new \Exception("{$uid}에 해당하는 고객/관리자 정보가 존재하지 않습니다. uid: {$uid}");
+ }
+ return $entity;
+ }
}
diff --git a/app/Services/Customer/PointService.php b/app/Services/Customer/PointService.php
index 0d43187..c9f108f 100644
--- a/app/Services/Customer/PointService.php
+++ b/app/Services/Customer/PointService.php
@@ -41,6 +41,15 @@ class PointService extends CustomerService
{
return ['status'];
}
+ //Entity의 관련객체정의용
+ protected function setRelatedEntity(mixed $entity): PointEntity
+ {
+ //고객정보정의
+ $entity->setClient($this->getClient($entity->getClientUID()));
+ return $entity;
+ }
+ //기본 기능부분
+
private function setBalance(array $formDatas): ClientEntity
{
//point_balance 체크
diff --git a/app/Services/Customer/ServiceHistoryService.php b/app/Services/Customer/ServiceHistoryService.php
index d28f06b..902aa44 100644
--- a/app/Services/Customer/ServiceHistoryService.php
+++ b/app/Services/Customer/ServiceHistoryService.php
@@ -4,11 +4,13 @@ namespace App\Services\Customer;
use App\Entities\Customer\ServiceHistoryEntity;
use App\Models\Customer\ServiceHistoryModel;
+use App\Services\Customer\ServiceService;
use CodeIgniter\HTTP\IncomingRequest;
class ServiceHistoryService extends CustomerService
{
protected ?IncomingRequest $request = null;
+ private ?ServiceService $_serviceService = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
@@ -22,6 +24,13 @@ class ServiceHistoryService extends CustomerService
{
return new ServiceHistoryEntity();
}
+ public function getServiceService(): ServiceService
+ {
+ if (!$this->_serviceService) {
+ $this->_serviceService = new ServiceService($this->request);
+ }
+ return $this->_serviceService;
+ }
public function getFormFields(): array
{
return [
@@ -42,4 +51,12 @@ class ServiceHistoryService extends CustomerService
{
return ['serviceinfo_uid', 'title', 'status', 'created_at'];
}
+ //Entity의 관련객체정의용
+ protected function setRelatedEntity(mixed $entity): ServiceHistoryEntity
+ {
+ //서비스정보정의
+ $entity->setService($this->getClient($entity->getClientUID()));
+ return $entity;
+ }
+ //기본 기능부분
}
diff --git a/app/Services/Customer/ServiceItemService.php b/app/Services/Customer/ServiceItemService.php
index c5ead43..95b1494 100644
--- a/app/Services/Customer/ServiceItemService.php
+++ b/app/Services/Customer/ServiceItemService.php
@@ -64,14 +64,19 @@ class ServiceItemService extends CustomerService
{
return ['serviceinfo_uid', 'item_type', 'item_uid', 'billing_cycle', 'price', 'amount', 'start_at', 'updated_at', 'status'];
}
-
+ //Entity의 관련객체정의용
+ protected function setRelatedEntity(mixed $entity): ServiceItemEntity
+ {
+ //서비스정보정의
+ $entity->setService($this->getClient($entity->getClientUID()));
+ return $entity;
+ }
+ //기본 기능부분
public function create(array $formDatas, mixed $entity = null): ServiceItemEntity
{
$entity = parent::create($formDatas, $entity);
- //결제방식이 ontime인경우에는 바로 결제정보 ServicePaymentService에 등록
- if ($entity->getBillingCycle() !== 'ontime') {
- $this->getServicePaymentService()->createPaymentByServiceItem($entity);
- }
+ //결제정보 ServicePaymentService에 등록
+ $this->getServicePaymentService()->createPaymentByServiceItem($entity);
return $entity;
}
public function modify(mixed $entity, array $formDatas): ServiceItemEntity
diff --git a/app/Services/Customer/ServicePaymentService.php b/app/Services/Customer/ServicePaymentService.php
index b15b4ec..988324c 100644
--- a/app/Services/Customer/ServicePaymentService.php
+++ b/app/Services/Customer/ServicePaymentService.php
@@ -50,7 +50,7 @@ class ServicePaymentService extends CustomerService
}
public function getIndexFields(): array
{
- return ['serviceinfo_uid', "ownerinfo_uid", 'item_type', 'item_uid', 'billing_cycle', 'amount', 'billing_at', 'issue_at', 'due_at', 'status'];
+ return ['serviceinfo_uid', "ownerinfo_uid", 'item_type', 'item_uid', 'billing_cycle', 'amount', 'billing_at', 'issue_at', 'countdown', 'status'];
}
public function getServiceService(): ServiceService
@@ -60,6 +60,16 @@ class ServicePaymentService extends CustomerService
}
return $this->_serviceService;
}
+ //Entity의 관련객체정의용
+ protected function setRelatedEntity(mixed $entity): ServicePaymentEntity
+ {
+ //서비스정보정의
+ $entity->setService($this->getClient($entity->getClientUID()));
+ //관리자정보정의
+ $entity->setOwner($this->getClient($entity->getOwnerUID()));
+ return $entity;
+ }
+ //기본 기능부분
//ServiceItemService에서 사용
public function createPaymentByServiceItem(ServiceItemEntity $serviceItemEntity): ServicePaymentEntity
@@ -76,7 +86,7 @@ class ServicePaymentService extends CustomerService
'billing_cycle' => $serviceItemEntity->getBillingCycle(),
'amount' => $serviceItemEntity->getAmount(),
'billing_at' => $serviceEntity->getBillingAt(),
- 'issue_at' => $serviceItemEntity->getBillingCycle() === 'onetime' ? date('Y-m-d') : $serviceEntity->getBillingAt(),
+ 'issue_at' => date('Y-m-d'),
];
return $this->create($formDatas);
}
diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php
index c2f1855..899a153 100644
--- a/app/Services/Customer/ServiceService.php
+++ b/app/Services/Customer/ServiceService.php
@@ -8,6 +8,7 @@ use CodeIgniter\HTTP\IncomingRequest;
use App\Entities\Equipment\CodeEntity;
use App\Services\Equipment\CodeService;
+use PhpOffice\PhpSpreadsheet\Calculation\Web\Service;
class ServiceService extends CustomerService
{
@@ -54,7 +55,6 @@ class ServiceService extends CustomerService
{
return ['clientinfo_uid', 'ownerinfo_uid', 'title', 'type', 'location', 'switch', 'code', 'raid', 'billing_at', 'start_at', 'updated_at', 'status'];
}
-
public function getCodeService(): CodeService
{
if (!$this->_codeService) {
@@ -62,6 +62,17 @@ class ServiceService extends CustomerService
}
return $this->_codeService;
}
+ //Entity의 관련객체정의용
+ protected function setRelatedEntity(mixed $entity): ServiceEntity
+ {
+ //고객정보정의
+ $entity->setClient($this->getClient($entity->getClientUID()));
+ //관리자정보정의
+ $entity->setOwner($this->getClient($entity->getOwnerUID()));
+ return $entity;
+ }
+ //기본 기능부분
+
//다음 달로 결제일을 연장합니다.
public function extendPaymentDate(ServiceEntity $entity): void
{
diff --git a/app/Views/admin/payment/index.php b/app/Views/admin/payment/index.php
new file mode 100644
index 0000000..acdef2e
--- /dev/null
+++ b/app/Views/admin/payment/index.php
@@ -0,0 +1,76 @@
+= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
+= $this->section('content') ?>
+alert($error) ?>
+
= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/top'); ?>
+
+
+
+
+
+ = $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu'); ?>
+
+
+
+
+ = $this->include("templates/{$viewDatas['layout']}/index_header"); ?>
+
+
+
+ = $this->include("templates/{$viewDatas['layout']}/index_content_top"); ?>
+ = form_open(current_url(), ['id' => 'batchjob_form', 'method' => "post"]) ?>
+
+
+
+ 번호
+
+ = $viewDatas['helper']->getListLabel($field, $viewDatas) ?>
+
+ 작업
+
+
+
+
+
+
+ getListRowColor($entity) ?>>
+
+ = $viewDatas['helper']->getListButton('modify', $viewDatas) ?>
+
+ = $viewDatas['helper']->getFieldView($field, $entity->$field, $viewDatas) ?>
+
+
+ = $viewDatas['helper']->getListButton('view', $viewDatas) ?>
+ = $viewDatas['helper']->getListButton('delete', $viewDatas) ?>
+
+
+
+
+
+
+
+
+ = form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL
+
+ = $viewDatas['helper']->getFieldForm($field, null, $viewDatas, ['data-batchjob' => 'true']) ?>
+
+ = $viewDatas['helper']->getListButton('batchjob', $viewDatas) ?>
+ 청구서:
+ = $viewDatas['helper']->getListButton('invoice_email', $viewDatas) ?>
+ = $viewDatas['helper']->getListButton('invoice_mobile', $viewDatas) ?>
+
+
+
+ = $this->include("templates/{$viewDatas['layout']}/index_content_bottom_script"); ?>
+ = form_close() ?>
+
+
= $this->include("templates/common/" . (isset($viewDatas['modal_type']) ? $viewDatas['modal_type'] : 'modal_iframe')); ?>
+
+
+
+
+
+
+
+
+= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?>
+= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/admin/payment/invoice_email.php b/app/Views/admin/payment/invoice_email.php
new file mode 100644
index 0000000..362333c
--- /dev/null
+++ b/app/Views/admin/payment/invoice_email.php
@@ -0,0 +1,70 @@
+= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
+= $this->section('content') ?>
+
+= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/admin/popup/index.php b/app/Views/admin/popup/index.php
index 13960f5..13c07bf 100644
--- a/app/Views/admin/popup/index.php
+++ b/app/Views/admin/popup/index.php
@@ -5,7 +5,24 @@
- = $this->include("templates/{$viewDatas['layout']}/index_content_top_popup"); ?>
+ = form_open(current_url(), ["method" => "get"]) ?>
+
+
+
+ 조건:
+
+ = $viewDatas['helper']->getFieldForm($field, $viewDatas[$field] ? $viewDatas[$field] : old($field), $viewDatas) ?>
+
+ 검색
+
+
+ Page:= $viewDatas['page'] ?>/= $viewDatas['total_page'] ?>
+ = form_dropdown('per_page', $viewDatas['page_options'], $viewDatas['per_page'], ['onChange' => 'this.form.submit()']) ?>
+ / 총:= $viewDatas['total_count'] ?>
+
+
+
+ = form_close() ?>
= form_open(current_url(), ['id' => 'batchjob_form', 'method' => "post"]) ?>
- = $this->include("templates/{$viewDatas['layout']}/index_content_bottom_popup"); ?>
+
+
+ = $viewDatas['helper']->getListButton('create', $viewDatas) ?>
+
+
+
+ = $this->include("templates/{$viewDatas['layout']}/index_content_bottom_script"); ?>
= form_close() ?>
= $this->include("templates/common/" . (isset($viewDatas['modal_type']) ? $viewDatas['modal_type'] : 'modal_iframe')); ?>
diff --git a/app/Views/layouts/admin/left_menu/base.php b/app/Views/layouts/admin/left_menu/base.php
index e159dd9..fe7170e 100644
--- a/app/Views/layouts/admin/left_menu/base.php
+++ b/app/Views/layouts/admin/left_menu/base.php
@@ -2,5 +2,5 @@
= ICONS['MEMBER'] ?> 계정 관리
\ No newline at end of file
diff --git a/app/Views/layouts/admin/left_menu/customer.php b/app/Views/layouts/admin/left_menu/customer.php
index 0e5d099..a2ad96c 100644
--- a/app/Views/layouts/admin/left_menu/customer.php
+++ b/app/Views/layouts/admin/left_menu/customer.php
@@ -12,15 +12,15 @@
= ICONS['DEPOSIT'] ?> 예치금내역
\ No newline at end of file
diff --git a/app/Views/layouts/admin/left_menu/equipment.php b/app/Views/layouts/admin/left_menu/equipment.php
index c3bc8f4..6f84ab8 100644
--- a/app/Views/layouts/admin/left_menu/equipment.php
+++ b/app/Views/layouts/admin/left_menu/equipment.php
@@ -1,38 +1,38 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/templates/admin/index_content_bottom.php b/app/Views/templates/admin/index_content_bottom.php
index e96c00d..3f6c151 100644
--- a/app/Views/templates/admin/index_content_bottom.php
+++ b/app/Views/templates/admin/index_content_bottom.php
@@ -1,56 +1,13 @@
+ = $viewDatas['helper']->getListButton('create', $viewDatas) ?>
= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL
= $viewDatas['helper']->getFieldForm($field, null, $viewDatas, ['data-batchjob' => 'true']) ?>
= $viewDatas['helper']->getListButton('batchjob', $viewDatas) ?>
- = $viewDatas['helper']->getListButton('create', $viewDatas) ?>
= $viewDatas['helper']->getListButton('batchjob_delete', $viewDatas) ?>
-
\ No newline at end of file
+= $this->include("templates/{$viewDatas['layout']}/index_content_bottom_script"); ?>
\ No newline at end of file
diff --git a/app/Views/templates/admin/index_content_bottom_popup.php b/app/Views/templates/admin/index_content_bottom_script.php
similarity index 86%
rename from app/Views/templates/admin/index_content_bottom_popup.php
rename to app/Views/templates/admin/index_content_bottom_script.php
index 7964158..275c2f3 100644
--- a/app/Views/templates/admin/index_content_bottom_popup.php
+++ b/app/Views/templates/admin/index_content_bottom_script.php
@@ -1,9 +1,3 @@
-
-
- = $viewDatas['helper']->getListButton('create', $viewDatas) ?>
-
-
-