dbmsv2_init...1

This commit is contained in:
choi.jh 2025-09-03 18:03:04 +09:00
parent a9629138e8
commit 75527e0caa
44 changed files with 454 additions and 595 deletions

View File

@ -2,13 +2,14 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\AccountEntity;
use App\Helpers\Customer\AccountHelper;
use App\Services\Customer\AccountService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\AccountHelper;
use App\Services\Customer\AccountService;
class AccountController extends CustomerController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
@ -35,4 +36,17 @@ class AccountController extends CustomerController
return $this->_helper;
}
//Index,FieldForm관련.
protected function create_process(array $formDatas): AccountEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::create_process($formDatas);
}
//수정관련
protected function modify_process(mixed $entity, array $formDatas): AccountEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::modify_process($entity, $formDatas);
}
}

View File

@ -2,13 +2,14 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\CouponEntity;
use App\Helpers\Customer\CouponHelper;
use App\Services\Customer\CouponService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\CouponHelper;
use App\Services\Customer\CouponService;
class CouponController extends CustomerController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
@ -35,4 +36,17 @@ class CouponController extends CustomerController
return $this->_helper;
}
//Index,FieldForm관련.
protected function create_process(array $formDatas): CouponEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::create_process($formDatas);
}
//수정관련
protected function modify_process(mixed $entity, array $formDatas): CouponEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::modify_process($entity, $formDatas);
}
}

View File

@ -2,13 +2,14 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\PointEntity;
use App\Helpers\Customer\PointHelper;
use App\Services\Customer\PointService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\PointHelper;
use App\Services\Customer\PointService;
class PointController extends CustomerController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
@ -35,4 +36,17 @@ class PointController extends CustomerController
return $this->_helper;
}
//Index,FieldForm관련.
protected function create_process(array $formDatas): PointEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::create_process($formDatas);
}
//수정관련
protected function modify_process(mixed $entity, array $formDatas): PointEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::modify_process($entity, $formDatas);
}
}

View File

@ -403,7 +403,6 @@ abstract class CommonController extends BaseController
try {
$this->setAction(__FUNCTION__);
$this->setFormFields([$field]);
$this->setFormFilters([$field]);
$this->setFormRules();
//기본값정의
$this->setFormDatas($this->request->getGet());
@ -424,12 +423,11 @@ abstract class CommonController extends BaseController
//일괄처리작업기능
protected function batchjob_process(mixed $entity, array $formDatas): mixed
{
return $this->getService()->modify($entity, $formDatas);
return $this->getService()->batchjob($entity, $formDatas);
}
private function batchjob_pre_process(): array
{
$selectedFields = [];
//getBatchJobFields를 이용해서 선택된 Field 와 값정의
$formDatas = [];
foreach ($this->getService()->getBatchjobFields() as $field) {
$value = $this->request->getPost($field);
@ -457,10 +455,9 @@ abstract class CommonController extends BaseController
$this->setAction(__FUNCTION__);
list($selectedFields, $formDatas, $uids) = $this->batchjob_pre_process();
$this->setFormFields($selectedFields);
$this->setFormFilters($selectedFields);
$this->setFormRules();
//기본값정의
$this->setFormDatas($this->request->getGet());
$this->setFormDatas($this->request->getPost());
$this->doValidations();
$entities = [];
foreach ($uids as $uid) {

View File

@ -33,7 +33,7 @@ abstract class CommonEntity extends Entity
}
final public function getUpdatedAt(): string|null
{
return $this->attributes['updated_at'];
return $this->attributes['updated_at'] ?? null;
}
final public function getCreatedAt(): string
{
@ -41,6 +41,6 @@ abstract class CommonEntity extends Entity
}
final public function getDeletedAt(): string
{
return $this->attributes['deleted_at'];
return $this->attributes['deleted_at'] ?? null;
}
}

View File

@ -10,7 +10,7 @@ class AccountEntity extends CustomerEntity
const TITLE = AccountModel::TITLE;
const STATUS_WIDTHDRAWAL = "widthdrawal";
const STATUS_DEPOSIT = "deposit";
const DEFAULT_STATUS = self::STATUS_WIDTHDRAWAL;
const DEFAULT_STATUS = self::STATUS_DEPOSIT;
//고객정보객체-상속
//타 객체정의 부분
}

View File

@ -29,14 +29,14 @@ class ClientEntity extends CustomerEntity
}
public function getAccountBalance(): int
{
return intval($this->attributes['account_balance']);
return $this->attributes['account_balance'];
}
public function getCouponBalance(): int
{
return intval($this->attributes['coupon_balance']);
return $this->attributes['coupon_balance'];
}
public function getPointBalance(): int
{
return intval($this->attributes['point_balance']);
return $this->attributes['point_balance'];
}
}

View File

@ -10,7 +10,7 @@ class CouponEntity extends CustomerEntity
const TITLE = CouponModel::TITLE;
const STATUS_WIDTHDRAWAL = "widthdrawal";
const STATUS_DEPOSIT = "deposit";
const DEFAULT_STATUS = self::STATUS_WIDTHDRAWAL;
const DEFAULT_STATUS = self::STATUS_DEPOSIT;
//고객정보객체-상속
//타 객체정의 부분
}

View File

@ -11,8 +11,8 @@ abstract class CustomerEntity extends CommonEntity
parent::__construct($data);
}
//고객정보객체
final public function getClientUID(): int
final public function getClientUID(): int|null
{
return intval($this->attributes['clientinfo_uid']);
return $this->attributes['clientinfo_uid'] ?? null;
}
}

View File

@ -15,15 +15,15 @@ class PaymentEntity extends CustomerEntity
//관리자정보객체
final public function getUserUID(): int
{
return intval($this->attributes['user_uid']);
return $this->attributes['user_uid'];
}
final public function getClientCode(): int
{
return intval($this->attributes['clientinfo_uid']);
return $this->attributes['clientinfo_uid'];
}
final public function getServiceCode(): int
{
return intval($this->attributes['serviceinfo_uid']);
return $this->attributes['serviceinfo_uid'];
}
//타 객체정의 부분
public function getItemType(): string
@ -32,11 +32,11 @@ class PaymentEntity extends CustomerEntity
}
public function getIsOnetime(): int
{
return intval($this->attributes['isOnetime']);
return $this->attributes['isOnetime'];
}
public function getAmount(): int
{
return intval($this->attributes['amount']);
return $this->attributes['amount'];
}
public function getBillingAt(): string
{

View File

@ -10,7 +10,7 @@ class PointEntity extends CustomerEntity
const TITLE = PointModel::TITLE;
const STATUS_WIDTHDRAWAL = "widthdrawal";
const STATUS_DEPOSIT = "deposit";
const DEFAULT_STATUS = self::STATUS_WIDTHDRAWAL;
const DEFAULT_STATUS = self::STATUS_DEPOSIT;
//고객정보객체-상속
//타 객체정의 부분
}

View File

@ -25,21 +25,17 @@ class ServiceEntity extends CustomerEntity
}
return $this->attributes['serverEntity'];
}
public function getCode(): string
public function getCode(): string|null
{
return $this->attributes['code'] ?? "null";
return $this->attributes['code'];
}
final public function getUserUID(): int
final public function getUserUID(): int|null
{
return intval($this->attributes['user_uid']);
return $this->attributes['user_uid'];
}
final public function getClientInfoUID(): int
final public function getClientInfoUID(): int|null
{
return intval($this->attributes['clientinfo_uid']);
}
public function getSwitchCode(): string
{
return $this->attributes['switchinfo_code'];
return $this->attributes['clientinfo_uid'];
}
public function getType(): string
{
@ -49,13 +45,4 @@ class ServiceEntity extends CustomerEntity
{
return $this->attributes['billing_at'];
}
public function getItemEntities(string $type): array
{
return $this->attributes[$type] ?? [];
}
public function setItemEntities(string $type, array $itemEntities): void
{
$this->attributes[$type] = $itemEntities;
// $this->attributes[$type] = array_unique($this->attributes[$type], SORT_REGULAR);
}
}

View File

@ -12,7 +12,7 @@ class LineEntity extends EquipmentEntity
const STATUS_OCCUPIED = "occupied";
const STATUS_FORBIDDEN = "forbidden";
const DEFAULT_STATUS = self::STATUS_AVAILABLE;
public function getBandwith()
public function getBandwith(): string
{
return $this->attributes['bandwith'];
}

View File

@ -19,7 +19,7 @@ class PartEntity extends EquipmentEntity
}
public function getPrice(): int
{
return (int) $this->attributes['price'];
return $this->attributes['price'];
}
public function getFormTitle(): string
{

View File

@ -29,15 +29,25 @@ class ServerEntity extends EquipmentEntity
if (!array_key_exists('serverPartEntities', $this->attributes)) {
$this->attributes['serverPartEntities'] = [];
}
$this->attributes['serverPartEntities'][$partType] = $entity;
if (!array_key_exists($partType, $this->attributes['serverPartEntities'])) {
$this->attributes['serverPartEntities'][$partType] = [];
}
public function getServerPartEntity(string $partType): ServerPartEntity|null
$this->attributes['serverPartEntities'][$partType][] = $entity;
}
public function setServerPartEntities(string $partType, array $serverPartEntities): void
{
if (!array_key_exists('serverPartEntities', $this->attributes)) {
return null;
$this->attributes['serverPartEntities'] = [];
}
$this->attributes['serverPartEntities'][$partType] = $serverPartEntities;
}
public function getServerPartEntities(string $partType): array
{
if (!array_key_exists('serverPartEntities', $this->attributes)) {
return [];
}
if (!array_key_exists($partType, $this->attributes['serverPartEntities'])) {
return null;
return [];
}
return $this->attributes['serverPartEntities'][$partType];
}
@ -76,6 +86,10 @@ class ServerEntity extends EquipmentEntity
{
return $this->attributes['code'];
}
public function getTitle(): string
{
return sprintf("%s[%s]", parent::getTitle(), $this->getCode());
}
public function getClientInfoUID(): int|null
{
return $this->attributes['clientinfo_uid'] ?? null;

View File

@ -37,7 +37,7 @@ class ServerPartEntity extends EquipmentEntity
}
public function getServiceInfoUID(): int|null
{
return $this->attributes['serviceinfo_uid'] ?? null;
return $this->attributes['serviceinfo_uid'];
}
public function getType(): string
{

View File

@ -226,7 +226,7 @@ class CommonHelper
// echo "{$field}->{$value}";
foreach ($viewDatas['control']['field_optons'][$field] as $key => $entity) {
$isSelected = $key == $value ? ' selected' : '';
$isDisabled = $entity->getStatus() === $entity::DEFAULT_STATUS ? '' : ' disabled';
$isDisabled = $viewDatas['control']['action'] === 'index' && $entity->getStatus() !== $entity::DEFAULT_STATUS ? ' disabled' : '';
$html .= sprintf("<option value=\"%s\"%s%s>%s</option>", $key, $isSelected, $isDisabled, array_key_exists('isForm', $extras) ? $entity->getFormTitle() : $entity->getTitle());
}
$html .= '</select>';
@ -349,6 +349,17 @@ class CommonHelper
}
public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
switch ($field) {
case 'user_uid':
case 'old_clientinfo_uid':
case 'clientinfo_uid':
case 'serviceinfo_uid':
case 'serverinfo_uid':
case 'csinfo_uid':
case 'ipinfo_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
break;
}
if (!array_key_exists($field, $viewDatas['control']['field_optons'])) {
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 정의되지 않았습니다.");
}

View File

@ -74,7 +74,7 @@ class ClientHelper extends CustomerHelper
if (!$this->getMyAuth()->isAccessRole(['security'])) {
$action = $viewDatas['entity']->getCode();
} else {
$action = parent::getListButton($action, $viewDatas['entity']->getCode(), $viewDatas, $extras);
$action = parent::getListButton($action, $label ? $label : $viewDatas['entity']->getCode(), $viewDatas, $extras);
}
break;
case 'create':
@ -86,7 +86,7 @@ class ClientHelper extends CustomerHelper
case 'history':
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
$action = form_label(
ICONS['HISTORY'],
$label ? $label : ICONS['HISTORY'],
$action,
[
"data-src" => "/admin/customer/clienthistory?clientinfo_uid={$viewDatas['entity']->getPK()}",

View File

@ -10,22 +10,4 @@ abstract class CustomerHelper extends CommonHelper
{
parent::__construct();
}
public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
switch ($field) {
case 'user_uid':
case 'old_clientinfo_uid':
case 'clientinfo_uid':
case 'serviceinfo_uid':
case 'serverinfo_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = parent::getListFilter($field, $value, $viewDatas, $extras);
break;
default:
$form = parent::getListFilter($field, $value, $viewDatas, $extras);
break;
}
return $form;
}
}

View File

@ -49,7 +49,7 @@ class PaymentHelper extends CustomerHelper
$action = $viewDatas['entity']->getStatus() !== $viewDatas['entity']::DEFAULT_STATUS ? "" : parent::getListButton($action, $label, $viewDatas, $extras);
break;
case 'invoice':
$action = form_submit($action . "_submit", '청구서 발행', [
$action = form_submit($action . "_submit", $label ? $label : '청구서 발행', [
"formaction" => current_url() . '/' . $action,
"class" => "btn btn-outline btn-primary",
]);

View File

@ -11,25 +11,6 @@ class ServiceHelper extends CustomerHelper
parent::__construct();
$this->setTitleField(field: ServiceModel::TITLE);
}
private function getServerPartForm(string $field, mixed $value, array $viewDatas, array $extras, string $partType): string
{
//Type별로 부품연결정보가 있는지 확인
$serverpartEntity = null;
if (array_key_exists('entity', $viewDatas)) {
$serverpartEntity = $viewDatas['entity']->getServerPartEntity($partType);
}
$form = "";
//수정시 Type별 사용할 hidden partinfo_uid
if ($serverpartEntity !== null) {
$form .= form_hidden("partinfo_uid_{$partType}", $serverpartEntity->getPK());
}
//기존 입력화면에서 return 된것인지?
if ($value === null && $serverpartEntity !== null) {
$value = $serverpartEntity->getPartInfoUID();
}
$form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
return $form;
}
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
switch ($field) {
@ -73,69 +54,12 @@ class ServiceHelper extends CustomerHelper
}
$form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
break;
case 'partinfo_uid_CPU':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'CPU');
break;
case 'partinfo_uid_CPU_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'partinfo_uid_RAM':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'RAM',);
break;
case 'partinfo_uid_RAM_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'partinfo_uid_DISK':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'DISK');
break;
case 'partinfo_uid_DISK_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'partinfo_uid_DISK_extra':
$form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
break;
case 'partinfo_uid_OS':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'OS');
break;
case 'partinfo_uid_OS_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'partinfo_uid_DB':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'DB');
break;
case 'partinfo_uid_DB_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'partinfo_uid_SOFTWARE':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'SOFTWARE');
break;
case 'partinfo_uid_SOFTWARE_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
// case 'ipinfo_uid':
// case 'csinfo_uid':
// $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
// $form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
// break;
default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;
}
return $form;
}
private function getServerPartView(string $field, mixed $value, array $viewDatas, array $extras, string $partType): string
{
$serverPartEntity = $viewDatas['entity']->getServerEntity()->getServerPartEntity($partType);
if ($serverPartEntity !== null) {
$value .= sprintf(
"<div>%s%s %s</div>",
$serverPartEntity->getTitle(),
$serverPartEntity->getCnt() >= 1 ? "*" . $serverPartEntity->getCnt() . "" : "",
$serverPartEntity->getExtra() ?? ""
);
}
return $value;
}
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
{
switch ($field) {
@ -159,16 +83,34 @@ class ServiceHelper extends CustomerHelper
case 'OS':
case 'DB':
case 'SOFTWARE':
$value = $this->getServerPartView($field, $value, $viewDatas, $extras, $field);
$temps = [];
foreach ($viewDatas['entity']->getServerEntity()->getServerPartEntities($field) as $serverPartEntity) {
$modal = form_label(
ICONS['SETUP'],
$field,
[
"data-src" => "/admin/equipment/serverpart/modify/{$serverPartEntity->getPK()}?ActionTemplate=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
["class" => "btn btn-sm btn-outline btn-circle", "target" => "_self"]
]
);
$temps[] = sprintf(
"%s%s%s %s",
$modal,
$serverPartEntity->getTitle(),
$serverPartEntity->getCnt() >= 1 ? "*" . $serverPartEntity->getCnt() . "" : "",
$serverPartEntity->getExtra() ?? ""
);
}
$value .= implode("<BR>", $temps);
break;
case 'ipinfo_uid':
$value = "";
foreach ($viewDatas['entity']->getServerEntity()->getIPEntities() as $ipEntity) {
$value .= sprintf("<div>%s%s %s</div>", $ipEntity->getTitle(), $ipEntity->getAmount());
}
break;
case 'csinfo_uid':
$value = "";
foreach ($viewDatas['entity']->getServerEntity()->getCSEntities() as $csEntity) {
$value .= sprintf("<div>%s%s %s</div>", $csEntity->getTitle(), $csEntity->getAmount());
}
@ -203,7 +145,26 @@ class ServiceHelper extends CustomerHelper
$label ? $label : ICONS['HISTORY'],
$action,
[
"data-src" => "/admin/customer/servicehistory?serviceinfo_uid={$viewDatas['entity']->getPK()}",
"data-src" => "/admin/customer/servicehistory?serviceinfo_uid={$viewDatas['entity']->getPK()}&serviceinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case 'CPU':
case 'RAM':
case 'DISK':
case 'OS':
case 'DB':
case 'SOFTWARE':
$serverEntity = $viewDatas['entity']->getServerEntity();
$extras = ["class" => "btn btn-sm btn-outline btn-circle", "target" => "_self", ...$extras];
$action = form_label(
$label ? $label : ICONS['SETUP'],
$action,
[
"data-src" => "/admin/equipment/serverpart?serverinfo_uid={$serverEntity->getPK()}&type={$action}&ActionTemplate=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras

View File

@ -10,22 +10,4 @@ abstract class EquipmentHelper extends CommonHelper
{
parent::__construct();
}
public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
switch ($field) {
case 'user_uid':
case 'old_clientinfo_uid':
case 'clientinfo_uid':
case 'serviceinfo_uid':
case 'serverinfo_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = parent::getListFilter($field, $value, $viewDatas, $extras);
break;
default:
$form = parent::getListFilter($field, $value, $viewDatas, $extras);
break;
}
return $form;
}
}

View File

@ -13,21 +13,18 @@ class ServerHelper extends EquipmentHelper
}
private function getServerPartForm(string $field, mixed $value, array $viewDatas, array $extras, string $partType): string
{
//Type별로 부품연결정보가 있는지 확인
$serverpartEntity = null;
if (array_key_exists('entity', $viewDatas)) {
$serverpartEntity = $viewDatas['entity']->getServerPartEntity($partType);
}
$form = "";
//수정시 Type별 사용할 hidden partinfo_uid
if ($serverpartEntity !== null) {
$form .= form_hidden("partinfo_uid_{$partType}", $serverpartEntity->getPK());
}
if (array_key_exists('entity', $viewDatas)) {
foreach ($viewDatas['entity']->getServerPartEntities($partType) as $serverPartEntity) {
//기존 입력화면에서 return 된것인지?
if ($value === null && $serverpartEntity !== null) {
$value = $serverpartEntity->getPartInfoUID();
if ($value === null && $serverPartEntity !== null) {
$value = $serverPartEntity->getPartInfoUID();
}
$form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
}
} else {
$form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
}
return $form;
}
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
@ -37,72 +34,86 @@ class ServerHelper extends EquipmentHelper
// $extras['readonly'] = in_array($viewDatas['control']['action'], ['modify_form']) ? ' readonly' : '';
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;
case 'switchinfo_uid':
if (array_key_exists('entity', $viewDatas)) {
$value = $viewDatas['entity']->getSwitchEntity() !== null ? $viewDatas['entity']->getSwitchEntity()->getPK() : $value;
}
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
break;
case 'ipinfo_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = "";
if (array_key_exists('entity', $viewDatas)) {
foreach ($viewDatas['entity']->getIPEntities() as $ipEntity) {
$form .= "<div>" . $this->form_dropdown_custom($field, $ipEntity->getPK(), $viewDatas, $extras) . "</div>";
}
}
$form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
break;
case 'csinfo_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = "";
if (array_key_exists('entity', $viewDatas)) {
foreach ($viewDatas['entity']->getCSEntities() as $csEntity) {
$form .= "<div>" . $this->form_dropdown_custom($field, $csEntity->getPK(), $viewDatas, $extras) . "</div>";
}
}
$form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
break;
case 'manufactur_at':
case 'format_at':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender';
$form = form_input($field, $value ?? "", $extras);
break;
case 'partinfo_uid_CPU':
case 'CPU':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'CPU');
break;
case 'partinfo_uid_CPU_cnt':
case 'CPU_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'partinfo_uid_RAM':
case 'RAM':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'RAM',);
break;
case 'partinfo_uid_RAM_cnt':
case 'RAM_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'partinfo_uid_DISK':
case 'DISK':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'DISK');
break;
case 'partinfo_uid_DISK_cnt':
case 'DISK_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'partinfo_uid_DISK_extra':
case 'DISK_extra':
$form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
break;
case 'partinfo_uid_OS':
case 'OS':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'OS');
break;
case 'partinfo_uid_OS_cnt':
case 'OS_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'partinfo_uid_DB':
case 'DB':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'DB');
break;
case 'partinfo_uid_DB_cnt':
case 'DB_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'partinfo_uid_SOFTWARE':
case 'SOFTWARE':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'SOFTWARE');
break;
case 'partinfo_uid_SOFTWARE_cnt':
case 'SOFTWARE_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'ipinfo_uid':
case 'csinfo_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
break;
default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;
}
return $form;
}
private function getServerPartView(string $field, mixed $value, array $viewDatas, array $extras, string $partType): string
private function getServerPartView(string $field, mixed $value, array $viewDatas, array $extras): string
{
$serverPartEntity = $viewDatas['entity']->getServerPartEntity($partType);
if ($serverPartEntity !== null) {
$value .= sprintf(
"<div>%s%s %s</div>",
$serverPartEntity->getTitle(),
$serverPartEntity->getCnt() >= 1 ? "*" . $serverPartEntity->getCnt() . "" : "",
$serverPartEntity->getExtra() ?? ""
);
}
return $value;
}
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
@ -118,16 +129,34 @@ class ServerHelper extends EquipmentHelper
case 'OS':
case 'DB':
case 'SOFTWARE':
$value = $this->getServerPartView($field, $value, $viewDatas, $extras, $field);
$temps = [];
foreach ($viewDatas['entity']->getServerPartEntities($field) as $serverPartEntity) {
$modal = form_label(
ICONS['SETUP'],
$field,
[
"data-src" => "/admin/equipment/serverpart/modify/{$serverPartEntity->getPK()}?ActionTemplate=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
["class" => "btn btn-sm btn-outline btn-circle", "target" => "_self"]
]
);
$temps[] = sprintf(
"%s%s%s %s",
$modal,
$serverPartEntity->getTitle(),
$serverPartEntity->getCnt() >= 1 ? "*" . $serverPartEntity->getCnt() . "" : "",
$serverPartEntity->getExtra() ?? ""
);
}
$value .= implode("<BR>", $temps);
break;
case 'ipinfo_uid':
$value = "";
foreach ($viewDatas['entity']->getIPEntities() as $ipEntity) {
$value .= sprintf("<div>%s%s %s</div>", $ipEntity->getTitle(), $ipEntity->getAmount());
}
break;
case 'csinfo_uid':
$value = "";
foreach ($viewDatas['entity']->getCSEntities() as $csEntity) {
$value .= sprintf("<div>%s%s %s</div>", $csEntity->getTitle(), $csEntity->getAmount());
}
@ -142,21 +171,6 @@ class ServerHelper extends EquipmentHelper
}
return $value;
}
public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
switch ($field) {
case 'csinfo_uid':
case 'ipinfo_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = parent::getListFilter($field, $value, $viewDatas, $extras);
break;
default:
$form = parent::getListFilter($field, $value, $viewDatas, $extras);
break;
}
return $form;
}
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
{
switch ($action) {
@ -164,7 +178,7 @@ class ServerHelper extends EquipmentHelper
if (!$this->getMyAuth()->isAccessRole(['security'])) {
$action = $viewDatas['entity']->getCode();
} else {
$action = parent::getListButton($action, $viewDatas['entity']->getCode(), $viewDatas, $extras);
$action = parent::getListButton($action, $label ? $label : $viewDatas['entity']->getCode(), $viewDatas, $extras);
}
break;
case 'create':
@ -175,8 +189,8 @@ class ServerHelper extends EquipmentHelper
break;
case 'history':
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
$action = form_label(
ICONS['HISTORY'],
$action = $label ? $label : form_label(
$label ? $label : ICONS['HISTORY'],
$action,
[
"data-src" => "/admin/customer/clienthistory?clientinfo_uid={$viewDatas['entity']->getPK()}",
@ -186,6 +200,24 @@ class ServerHelper extends EquipmentHelper
]
);
break;
case 'CPU':
case 'RAM':
case 'DISK':
case 'OS':
case 'DB':
case 'SOFTWARE':
$extras = ["class" => "btn btn-sm btn-outline btn-circle", "target" => "_self", ...$extras];
$action = form_label(
$label ? $label : ICONS['SETUP'],
$action,
[
"data-src" => "/admin/equipment/serverpart?serverinfo_uid={$viewDatas['entity']->getPK()}&type={$action}&ActionTemplate=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
default:
$action = parent::getListButton($action, $label, $viewDatas, $extras);
break;

View File

@ -11,25 +11,6 @@ class ServerPartHelper extends EquipmentHelper
parent::__construct();
$this->setTitleField(field: ServerPartModel::TITLE);
}
private function getServerPartForm(string $field, mixed $value, array $viewDatas, array $extras, string $partType): string
{
//Type별로 부품연결정보가 있는지 확인
$serverpartEntity = null;
if (array_key_exists('entity', $viewDatas)) {
$serverpartEntity = $viewDatas['entity']->getServerPartEntity($partType);
}
$form = "";
//수정시 Type별 사용할 hidden partinfo_uid
if ($serverpartEntity !== null) {
$form .= form_hidden("partinfo_uid_{$partType}", $serverpartEntity->getPK());
}
//기존 입력화면에서 return 된것인지?
if ($value === null && $serverpartEntity !== null) {
$value = $serverpartEntity->getPartInfoUID();
}
$form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
return $form;
}
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
switch ($field) {
@ -37,123 +18,10 @@ class ServerPartHelper extends EquipmentHelper
// $extras['readonly'] = in_array($viewDatas['control']['action'], ['modify_form']) ? ' readonly' : '';
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;
case 'manufactur_at':
case 'format_at':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender';
$form = form_input($field, $value ?? "", $extras);
break;
case 'partinfo_uid_CPU':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'CPU');
break;
case 'partinfo_uid_CPU_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'partinfo_uid_RAM':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'RAM',);
break;
case 'partinfo_uid_RAM_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'partinfo_uid_DISK':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'DISK');
break;
case 'partinfo_uid_DISK_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'partinfo_uid_DISK_extra':
$form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
break;
case 'partinfo_uid_OS':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'OS');
break;
case 'partinfo_uid_OS_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'partinfo_uid_DB':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'DB');
break;
case 'partinfo_uid_DB_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'partinfo_uid_SOFTWARE':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'SOFTWARE');
break;
case 'partinfo_uid_SOFTWARE_cnt':
$form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "";
break;
case 'ipinfo_uid':
case 'csinfo_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
break;
default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;
}
return $form;
}
private function getServerPartView(string $field, mixed $value, array $viewDatas, array $extras, string $partType): string
{
$serverPartEntity = $viewDatas['entity']->getServerPartEntity($partType);
if ($serverPartEntity !== null) {
$value .= sprintf(
"<div>%s%s %s</div>",
$serverPartEntity->getTitle(),
$serverPartEntity->getCnt() >= 1 ? "*" . $serverPartEntity->getCnt() . "" : "",
$serverPartEntity->getExtra() ?? ""
);
}
return $value;
}
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
{
switch ($field) {
case 'manufactur_at':
case 'format_at':
$value = $value ? date("Y-m-d", strtotime($value)) : "";
break;
case 'CPU':
case 'RAM':
case 'DISK':
case 'OS':
case 'DB':
case 'SOFTWARE':
$value = $this->getServerPartView($field, $value, $viewDatas, $extras, $field);
break;
case 'ipinfo_uid':
$value = "";
foreach ($viewDatas['entity']->getIPEntities() as $ipEntity) {
$value .= sprintf("<div>%s%s %s</div>", $ipEntity->getTitle(), $ipEntity->getAmount());
}
break;
case 'csinfo_uid':
$value = "";
foreach ($viewDatas['entity']->getCSEntities() as $csEntity) {
$value .= sprintf("<div>%s%s %s</div>", $csEntity->getTitle(), $csEntity->getAmount());
}
break;
default:
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
break;
}
if (is_array($value)) {
echo __METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다";
exit;
}
return $value;
}
public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
switch ($field) {
case 'csinfo_uid':
case 'ipinfo_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = parent::getListFilter($field, $value, $viewDatas, $extras);
break;
default:
$form = parent::getListFilter($field, $value, $viewDatas, $extras);
break;
}
return $form;
}
}

View File

@ -19,7 +19,7 @@ class SwitchHelper extends EquipmentHelper
if (!$this->getMyAuth()->isAccessRole(['security'])) {
$action = $viewDatas['entity']->getCode();
} else {
$action = parent::getListButton($action, $viewDatas['entity']->getCode(), $viewDatas, $extras);
$action = parent::getListButton($action, $label ? $label : $viewDatas['entity']->getCode(), $viewDatas, $extras);
}
break;
default:

View File

@ -18,19 +18,19 @@ return [
"serverpartinfo" => "부품정보",
"ipinfo_uid" => "IP정보",
"csinfo_uid" => "CS정보",
'partinfo_uid_CPU' => "CPU",
'partinfo_uid_CPU_cnt' => "CPU갯수",
'partinfo_uid_RAM' => "RAM",
'partinfo_uid_RAM_cnt' => "RAM갯수",
'partinfo_uid_DISK' => "DISK",
'partinfo_uid_DISK_cnt' => "DISK갯수",
'partinfo_uid_DISK_extra' => "RAID설정",
'partinfo_uid_OS' => "OS",
'partinfo_uid_OS_cnt' => "OS갯수",
'partinfo_uid_DB' => "DB",
'partinfo_uid_DB_cnt' => "DB갯수",
'partinfo_uid_SOFTWARE' => "기타SW",
'partinfo_uid_SOFTWARE_cnt' => "SOFTWARE갯수",
'CPU' => "CPU",
'CPU_cnt' => "CPU갯수",
'RAM' => "RAM",
'RAM_cnt' => "RAM갯수",
'DISK' => "DISK",
'DISK_cnt' => "DISK갯수",
'DISK_extra' => "RAID설정",
'OS' => "OS",
'OS_cnt' => "OS갯수",
'DB' => "DB",
'DB_cnt' => "DB갯수",
'SOFTWARE' => "기타SW",
'SOFTWARE_cnt' => "SOFTWARE갯수",
],
"TITLE" => [
'HP DL360 Gen6' => "HP DL360 Gen6",
@ -50,7 +50,7 @@ return [
'occupied' => "서비스중",
'forbidden' => "사용불가",
],
"PARTINFO_UID_DISK_EXTRA" => [
"DISK_EXTRA" => [
'RAID0' => "RAID0",
'RAID1' => "RAID1",
'RAID5' => "RAID5",

View File

@ -35,7 +35,6 @@ class ServerPartModel extends EquipmentModel
switch ($field) {
case "partinfo_uid":
case "serverinfo_uid":
case "billing":
case "cnt":
case "amount":
$rule = "required|numeric";
@ -44,6 +43,7 @@ class ServerPartModel extends EquipmentModel
$rule = "permit_empty|numeric";
break;
case "type":
case "billing":
$rule = "required|trim|string";
break;
case "extra":

View File

@ -171,6 +171,13 @@ abstract class CommonService
// LogCollector::info("[{$entity->getTitle()}]" . MESSAGES["UPDATED"] . ":");
return $entity;
}
//일괄처리작업
public function batchjob(mixed $entity, array $formDatas): mixed
{
$entity = $this->getModel()->modify($entity, $formDatas);
// LogCollector::info("[{$entity->getTitle()}]" . MESSAGES["UPDATED"] . ":");
return $entity;
}
//삭제
public function delete(mixed $entity): mixed
{

View File

@ -48,8 +48,7 @@ class AccountService extends CustomerService
throw new \Exception("{$formDatas['clientinfo_uid']}에 대한 고객정보를 찾을수 없습니다.");
}
$amount = intval($formDatas['amount']);
// dd($formDatas);
if ($formDatas['status'] === AccountEntity::DEFAULT_STATUS) { //입금, 쿠폰추가
if ($formDatas['status'] === AccountEntity::STATUS_DEPOSIT) { //입금, 쿠폰추가
$entity = $this->getClientService()->deposit($entity, 'account_balance', $amount);
} else { // 출금, 쿠폰사용
$entity = $this->getClientService()->withdrawal($entity, 'account_balance', $amount);

View File

@ -44,7 +44,7 @@ class CouponService extends CustomerService
throw new \Exception("{$formDatas['clientinfo_uid']}에 대한 고객정보를 찾을수 없습니다.");
}
$cnt = intval($formDatas['cnt']);
if ($formDatas['status'] === CouponEntity::DEFAULT_STATUS) { //입금, 쿠폰추가
if ($formDatas['status'] === CouponEntity::STATUS_DEPOSIT) { //입금, 쿠폰추가
$entity = $this->getClientService()->deposit($entity, 'coupon_balance', $cnt);
} else { // 출금, 쿠폰사용
$entity = $this->getClientService()->withdrawal($entity, 'coupon_balance', $cnt);

View File

@ -2,8 +2,6 @@
namespace App\Services\Customer;
use App\Entities\Customer\ServiceEntity;
use App\Entities\Customer\ServiceItemEntity;
use App\Entities\Customer\PaymentEntity;
use App\Models\Customer\PaymentModel;

View File

@ -43,7 +43,7 @@ class PointService extends CustomerService
throw new \Exception("{$formDatas['clientinfo_uid']}에 대한 고객정보를 찾을수 없습니다.");
}
$amount = intval($formDatas['amount']);
if ($formDatas['status'] === PointEntity::DEFAULT_STATUS) { //입금, 쿠폰추가
if ($formDatas['status'] === PointEntity::STATUS_DEPOSIT) { //입금, 쿠폰추가
$entity = $this->getClientService()->deposit($entity, 'point_balance', $amount);
} else { // 출금, 쿠폰사용
$entity = $this->getClientService()->withdrawal($entity, 'point_balance', $amount);

View File

@ -136,23 +136,23 @@ class ServiceService extends CustomerService
public function getFormOption(string $field, array $options = []): array
{
switch ($field) {
case 'partinfo_uid_CPU':
$options = $this->getServerPartService()->getFormOption('partinfo_uid_CPU');
case 'CPU':
$options = $this->getServerPartService()->getFormOption('CPU');
break;
case 'partinfo_uid_RAM':
$options = $this->getServerPartService()->getFormOption('partinfo_uid_RAM');
case 'RAM':
$options = $this->getServerPartService()->getFormOption('RAM');
break;
case 'partinfo_uid_DISK':
$options = $this->getServerPartService()->getFormOption('partinfo_uid_DISK');
case 'DISK':
$options = $this->getServerPartService()->getFormOption('DISK');
break;
case 'partinfo_uid_OS':
$options = $this->getServerPartService()->getFormOption('partinfo_uid_OS');
case 'OS':
$options = $this->getServerPartService()->getFormOption('OS');
break;
case 'partinfo_uid_DB':
$options = $this->getServerPartService()->getFormOption('partinfo_uid_DB');
case 'DB':
$options = $this->getServerPartService()->getFormOption('DB');
break;
case 'partinfo_uid_SOFTWARE':
$options = $this->getServerPartService()->getFormOption('partinfo_uid_SOFTWARE');
case 'SOFTWARE':
$options = $this->getServerPartService()->getFormOption('SOFTWARE');
break;
case 'ipinfo_uid': //수정때문에 전체가 필요
$options = $this->getIPService()->getEntities();

View File

@ -18,7 +18,6 @@ class ServerPartService extends EquipmentService
public function getFormFields(): array
{
return [
"serviceinfo_uid",
"serverinfo_uid",
"type",
"partinfo_uid",
@ -31,7 +30,6 @@ class ServerPartService extends EquipmentService
public function getFormFilters(): array
{
return [
"serviceinfo_uid",
"serverinfo_uid",
"type",
"partinfo_uid",
@ -64,22 +62,22 @@ class ServerPartService extends EquipmentService
public function getFormOption(string $field, array $options = []): array
{
switch ($field) {
case 'partinfo_uid_CPU':
case 'CPU':
$options = $this->getPartService()->getEntities(['type' => 'CPU']);
break;
case 'partinfo_uid_RAM':
case 'RAM':
$options = $this->getPartService()->getEntities(['type' => 'RAM']);
break;
case 'partinfo_uid_DISK':
case 'DISK':
$options = $this->getPartService()->getEntities(['type' => 'DISK']);
break;
case 'partinfo_uid_OS':
case 'OS':
$options = $this->getPartService()->getEntities(['type' => 'OS']);
break;
case 'partinfo_uid_DB':
case 'DB':
$options = $this->getPartService()->getEntities(['type' => 'DB']);
break;
case 'partinfo_uid_SOFTWARE':
case 'SOFTWARE':
$options = $this->getPartService()->getEntities(['type' => 'SOFTWARE']);
break;
case 'partinfo_uid': //수정때문에 전체가 필요
@ -91,19 +89,19 @@ class ServerPartService extends EquipmentService
}
return $options;
}
//생성
//서버별생성
public function createByServer(ServerEntity $serverEntity, array $formDatas): ServerPartEntity
{
foreach (SERVER['PARTTYPES'] as $partType) {
$serverPartFormDatas = [];
$serverPartFormDatas["partinfo_uid"] = $formDatas["partinfo_uid_{$partType}"];
$serverPartFormDatas["partinfo_uid"] = $formDatas["{$partType}"];
$serverPartFormDatas["serverinfo_uid"] = $serverEntity->getPK();
$serverPartFormDatas["serviceinfo_uid"] = $serverEntity->getServiceInfoUID();
$serverPartFormDatas["type"] = $partType;
$serverPartFormDatas["billing"] = array_key_exists("partinfo_uid_{$partType}_billing", $formDatas) ? $formDatas["partinfo_uid_{$partType}_billing"] : null;
$serverPartFormDatas["amount"] = array_key_exists("partinfo_uid_{$partType}_amount", $formDatas) ? $formDatas["partinfo_uid_{$partType}_amount"] : 0;
$serverPartFormDatas["cnt"] = array_key_exists("partinfo_uid_{$partType}_cnt", $formDatas) ? $formDatas["partinfo_uid_{$partType}_cnt"] : null;
$serverPartFormDatas["extra"] = array_key_exists("partinfo_uid_{$partType}_extra", $formDatas) ? $formDatas["partinfo_uid_{$partType}_extra"] : null;
$serverPartFormDatas["billing"] = array_key_exists("{$partType}_billing", $formDatas) ? $formDatas["{$partType}_billing"] : null;
$serverPartFormDatas["amount"] = array_key_exists("{$partType}_amount", $formDatas) ? $formDatas["{$partType}_amount"] : 0;
$serverPartFormDatas["cnt"] = array_key_exists("{$partType}_cnt", $formDatas) ? $formDatas["{$partType}_cnt"] : null;
$serverPartFormDatas["extra"] = array_key_exists("{$partType}_extra", $formDatas) ? $formDatas["{$partType}_extra"] : null;
$entity = parent::create($serverPartFormDatas);
//부품정보 정의
$partEntity = $this->getPartService()->getEntity($entity->getPartInfoUID());
@ -113,7 +111,7 @@ class ServerPartService extends EquipmentService
}
return $entity;
}
//삭제
//서버별삭제
public function deleteByServer(ServerEntity $serverEntity): void
{
//기존 서벼별 부품연결정보 삭제 후
@ -121,4 +119,18 @@ class ServerPartService extends EquipmentService
$this->delete($entity);
}
}
//서비스연결
public function enableService(ServerEntity $serverEntity, ServerPartEntity $entity): ServerPartEntity
{
$formDatas = [];
$formDatas["serviceinfo_uid"] = $serverEntity->getServiceInfoUID();
return parent::modify($entity, $formDatas);
}
//서비스해지
public function disableService(ServerPartEntity $entity): ServerPartEntity
{
$formDatas = [];
$formDatas["serviceinfo_uid"] = null;
return parent::modify($entity, $formDatas);
}
}

View File

@ -28,13 +28,13 @@ class ServerService extends EquipmentService
"manufactur_at",
"format_at",
"status",
"partinfo_uid_CPU",
"partinfo_uid_CPU_cnt",
"partinfo_uid_RAM",
"partinfo_uid_RAM_cnt",
"partinfo_uid_DISK",
"partinfo_uid_DISK_cnt",
"partinfo_uid_DISK_extra",
"CPU",
"CPU_cnt",
"RAM",
"RAM_cnt",
"DISK",
"DISK_cnt",
"DISK_extra",
];
}
public function getFormFilters(): array
@ -44,10 +44,10 @@ class ServerService extends EquipmentService
"serviceinfo_uid",
"type",
"title",
"partinfo_uid_CPU",
"partinfo_uid_RAM",
"partinfo_uid_DISK",
"partinfo_uid_DISK_extra",
"CPU",
"RAM",
"DISK",
"DISK_extra",
"status"
];
}
@ -104,8 +104,7 @@ class ServerService extends EquipmentService
{
//부품연결정보 정의
foreach (SERVER['PARTTYPES'] as $partType) {
$serverPartEntity = $this->getServerPartService()->getEntity(['serverinfo_uid' => $entity->getPK(), 'type' => $partType]);
if ($serverPartEntity) {
foreach ($this->getServerPartService()->getEntities(['serverinfo_uid' => $entity->getPK(), 'type' => $partType]) as $serverPartEntity) {
$entity->addServerPartEntity($partType, $serverPartEntity);
}
}
@ -126,23 +125,23 @@ class ServerService extends EquipmentService
public function getFormOption(string $field, array $options = []): array
{
switch ($field) {
case 'partinfo_uid_CPU':
$options = $this->getServerPartService()->getFormOption('partinfo_uid_CPU');
case 'CPU':
$options = $this->getServerPartService()->getFormOption('CPU');
break;
case 'partinfo_uid_RAM':
$options = $this->getServerPartService()->getFormOption('partinfo_uid_RAM');
case 'RAM':
$options = $this->getServerPartService()->getFormOption('RAM');
break;
case 'partinfo_uid_DISK':
$options = $this->getServerPartService()->getFormOption('partinfo_uid_DISK');
case 'DISK':
$options = $this->getServerPartService()->getFormOption('DISK');
break;
case 'partinfo_uid_OS':
$options = $this->getServerPartService()->getFormOption('partinfo_uid_OS');
case 'OS':
$options = $this->getServerPartService()->getFormOption('OS');
break;
case 'partinfo_uid_DB':
$options = $this->getServerPartService()->getFormOption('partinfo_uid_DB');
case 'DB':
$options = $this->getServerPartService()->getFormOption('DB');
break;
case 'partinfo_uid_SOFTWARE':
$options = $this->getServerPartService()->getFormOption('partinfo_uid_SOFTWARE');
case 'SOFTWARE':
$options = $this->getServerPartService()->getFormOption('SOFTWARE');
break;
case 'ipinfo_uid': //수정때문에 전체가 필요
$options = $this->getIPService()->getEntities();
@ -186,18 +185,6 @@ class ServerService extends EquipmentService
}
return $entity;
}
//수정
public function modify(mixed $entity, array $formDatas): ServerEntity
{
$entity = parent::modify($entity, $formDatas);
//기존 ServerPart정보 삭제
$this->getServerPartService()->deleteByServer($entity);
//신규 ServerPart정보 생성
foreach ($this->getServerPartService()->createByServer($entity, $formDatas) as $serverPartEntity) {
$entity->addServerPartEntity($serverPartEntity->getType(), $serverPartEntity);
}
return $entity;
}
//삭제
public function delete(mixed $entity): ServerEntity
{
@ -220,7 +207,10 @@ class ServerService extends EquipmentService
$formDatas["serviceinfo_uid"] = $serviceEntity->getPK();
$formDatas['status'] = ServerEntity::STATUS_OCCUPIED;
$entity = parent::modify($entity, $formDatas);
//ServerPart경우 서비스번호 설정
foreach ($this->getServerPartService()->getEntities(['serverinfo_uid' => $entity->getPK()]) as $serverPartEntity) {
$this->getServerPartService()->enableService($entity, $serverPartEntity);
}
//Switch경우 서비스중으로 설정
if (array_key_exists('switchinfo_uid', $formDatas)) {
$switchEntity = $this->getSwitchService()->getEntity($formDatas['switchinfo_uid']);
@ -252,19 +242,21 @@ class ServerService extends EquipmentService
}
public function disableService(ServerEntity $entity): ServerEntity
{
//ServerPart경우 서비스번호 해지
foreach ($this->getServerPartService()->getEntities(['serverinfo_uid' => $entity->getPK()]) as $serverPartEntity) {
$this->getServerPartService()->disableService($serverPartEntity);
}
//서비스 해지시 기존 Switch정보를 사용가능 상태로 변경
$switchEntity = $entity->getSwitchEntity();
if ($switchEntity !== null) {
$this->getSwitchService()->disableService($switchEntity);
$entity->setSwitchEntity(null);
}
//서비스 해지시 기존 IP정보를 사용가능 상태로 변경
foreach ($entity->getIPEntities() as $ipEntity) {
$this->getIPService()->disableService($ipEntity);
}
$entity->setIPEntities([]);
//서비스 해지시 기존 CS정보를 사용가능 상태로 변경
foreach ($entity->getCSEntities() as $csEntity) {
$this->getCSService()->disableService($csEntity);

View File

@ -0,0 +1,24 @@
<?= $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">
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<div class="action_form">
<table class="table table-bordered">
<?php foreach ($viewDatas['control']['actionFields'] 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']->getFieldForm($field, old($field) ?? ($viewDatas['entity']->$field ?? null), $viewDatas) ?>
<span><?= validation_show_error($field); ?></span>
</td>
</tr>
<?php endforeach; ?>
</table>
<div class="text-center"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></div>
<?= form_close(); ?>
</div>
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
</div>
<?= $this->endSection() ?>

View File

@ -28,12 +28,12 @@
<table class="table table-bordered">
<?php foreach (SERVER['PARTTYPES'] as $partType): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("partinfo_uid_{$partType}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$partType}"), $viewDatas) ?></th>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("{$partType}", lang("{$viewDatas['class_path']}.label.{$partType}"), $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$partType}", old("partinfo_uid_{$partType}") ?? ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}"] ?? null), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$partType}_cnt", old("partinfo_uid_{$partType}_cnt") ?? ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_cnt"] ?? null), $viewDatas) ?>
<?php if ($partType === "DISK"): ?>
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$partType}_extra", old("partinfo_uid_{$partType}_extra") ?? ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_extra"] ?? null), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldForm("{$partType}", old("{$partType}") ?? ($viewDatas['control']['form_datas']["{$partType}"] ?? null), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldForm("{$partType}_cnt", old("{$partType}_cnt") ?? ($viewDatas['control']['form_datas']["{$partType}_cnt"] ?? null), $viewDatas) ?>
<?php if ($partType == 'DISK'): ?>
<?= $viewDatas['helper']->getFieldForm("{$partType}_extra", old("{$partType}_extra") ?? ($viewDatas['control']['form_datas']["{$partType}_extra"] ?? null), $viewDatas) ?>
<?php endif ?>
</td>
</tr>

View File

@ -51,27 +51,40 @@
<tr <?= $entity->getStatus() === $entity::DEFAULT_STATUS ? "" : 'class="table-danger"' ?>>
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
<td nowrap><?= $viewDatas['helper']->getListButton('modify', '', $viewDatas) ?></td>
<td>
<td nowrap>
<div><?= $viewDatas['helper']->getFieldView('clientinfo_uid', $entity->getClientInfoUID(), $viewDatas) ?></div>
<div><?= $viewDatas['helper']->getFieldView('serviceinfo_uid', $entity->getServiceInfoUID(), $viewDatas) ?></div>
</td>
<td>
<td nowrap>
<div><?= $viewDatas['helper']->getFieldView('type', $entity->type, $viewDatas) ?></div>
<div><?= $viewDatas['helper']->getFieldView('title', $entity->getTitle(), $viewDatas) ?></div>
</td>
<td>
<td nowrap>
<div><?= $viewDatas['helper']->getFieldView('price', $entity->price, $viewDatas) ?></div>
<div><?= $viewDatas['helper']->getFieldView('amount', $entity->amount, $viewDatas) ?></div>
</td>
<td>
<td nowrap>
<div><?= $viewDatas['helper']->getFieldView('manufactur_at', $entity->manufactur_at, $viewDatas) ?></div>
<div><?= $viewDatas['helper']->getFieldView('format_at', $entity->format_at, $viewDatas) ?></div>
</td>
<td><?= $viewDatas['helper']->getFieldView('status', $entity->status, $viewDatas) ?></td>
<td nowrap>
<?php foreach (SERVER['PARTTYPES'] as $partType): ?><div><?= $viewDatas['helper']->getFieldView($partType, "", $viewDatas) ?></div><?php endforeach; ?>
<div><?= $viewDatas['helper']->getFieldView("ipinfo_uid", "", $viewDatas) ?></div>
<div><?= $viewDatas['helper']->getFieldView("csinfo_uid", "", $viewDatas) ?></div>
<table class="table table-bordered table-striped m-0 p-0">
<?php foreach (SERVER['PARTTYPES'] as $partType): ?>
<tr class="m-0 p-0">
<th class="m-0 p-0"><?= $viewDatas['helper']->getListButton($partType, $partType, $viewDatas) ?></th>
<td class="m-0 p-0"><?= $viewDatas['helper']->getFieldView($partType, "", $viewDatas) ?></td>
</tr>
<?php endforeach ?>
<tr class="m-0 p-0">
<th class="m-0 p-0">IP</th>
<td class="m-0 p-0"><?= $viewDatas['helper']->getFieldView("ipinfo_uid", "", $viewDatas) ?></td>
</tr>
<tr class="m-0 p-0">
<th class="m-0 p-0">CS</th>
<td class="m-0 p-0"><?= $viewDatas['helper']->getFieldView("csinfo_uid", "", $viewDatas) ?></td>
</tr>
</table>
</td>
<td nowrap>
<?= $viewDatas['helper']->getListButton('view', '', $viewDatas) ?>&nbsp;
@ -87,7 +100,8 @@
<?= form_close() ?>
</div>
</div>
<div class="layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?></div>
<div class=" layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?>
</div>
<!-- Layout Right End -->
</td>
</tr>

View File

@ -5,13 +5,6 @@
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<div class="action_form">
<table class="table table-bordered">
<tr>
<th>서버정보</th>
<th>추가정보</th>
</tr>
<tr>
<td>
<table class="table table-bordered">
<?php foreach (["code", "type", "title", "price", "amount", "manufactur_at", "format_at", "status",] as $field): ?>
<tr>
@ -23,25 +16,6 @@
</tr>
<?php endforeach; ?>
</table>
</td>
<td>
<table class="table table-bordered">
<?php foreach (SERVER['PARTTYPES'] as $partType): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("partinfo_uid_{$partType}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$partType}"), $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$partType}", old("partinfo_uid_{$partType}") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getPartInfoUID() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}"] ?? null)), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$partType}_cnt", old("partinfo_uid_{$partType}_cnt") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getCnt() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_cnt"] ?? null)), $viewDatas) ?>
<?php if ($partType === "DISK"): ?>
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$partType}_extra", old("partinfo_uid_{$partType}_extra") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getExtra() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_extra"] ?? null)), $viewDatas) ?>
<?php endif ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</td>
</tr>
</table>
<div class="text-center"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></div>
<?= form_close(); ?>
</div>

View File

@ -21,23 +21,25 @@
<span><?= validation_show_error($field); ?></span>
</td>
</tr>
<?php endforeach; ?>
<?php endforeach ?>
</table>
</td>
<td>
<table class="table table-bordered">
<?php foreach (SERVER['PARTTYPES'] as $partType): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("partinfo_uid_{$partType}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$partType}"), $viewDatas) ?></th>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("{$partType}", lang("{$viewDatas['class_path']}.label.{$partType}"), $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['helper']->getFieldView("partinfo_uid_{$partType}", old("partinfo_uid_{$partType}") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getPartInfoUID() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}"] ?? null)), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldView("partinfo_uid_{$partType}_cnt", old("partinfo_uid_{$partType}_cnt") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getCnt() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_cnt"] ?? null)), $viewDatas) ?>
<?php if ($partType === "DISK"): ?>
<?= $viewDatas['helper']->getFieldView("partinfo_uid_{$partType}_extra", old("partinfo_uid_{$partType}_extra") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getExtra() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_extra"] ?? null)), $viewDatas) ?>
<?php endif ?>
<?php foreach ($viewDatas['entity']->getServerPartEntities($partType) as $serverPartEntity): ?>
<div>
<?= $viewDatas['helper']->getFieldView("{$partType}", $serverPartEntity->getPartInfoUID(), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldView("{$partType}_cnt", $serverPartEntity->getCnt(), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldView("{$partType}_extra", $serverPartEntity->getExtra(), $viewDatas) ?>
</div>
<?php endforeach ?>
</td>
</tr>
<?php endforeach; ?>
<?php endforeach ?>
</table>
</td>
</tr>

View File

@ -5,13 +5,6 @@
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<div class="action_form">
<table class="table table-bordered">
<tr>
<th>기본 서버정보</th>
<th>기본 추가정보(서버 비용에 포함)</th>
</tr>
<tr>
<td>
<table class="table table-bordered">
<tr>
<?php foreach (["code", "type", "title", "price", "amount", "manufactur_at", "format_at", "status",] as $field): ?>
@ -23,25 +16,6 @@
</tr>
<?php endforeach ?>
</table>
</td>
<td>
<table class="table table-bordered">
<?php foreach (SERVICE['PARTTYPES'] as $partType): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("partinfo_uid_{$partType}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$partType}"), $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$partType}", old("partinfo_uid_{$partType}") ?? ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}"] ?? null), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$partType}_cnt", old("partinfo_uid_{$partType}_cnt") ?? ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_cnt"] ?? null), $viewDatas) ?>
<?php if ($partType === "DISK"): ?>
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$partType}_extra", old("partinfo_uid_{$partType}_extra") ?? ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_extra"] ?? null), $viewDatas) ?>
<?php endif ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</td>
</tr>
</table>
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
<?= form_close(); ?>
</div>

View File

@ -54,33 +54,46 @@
<tr <?= $entity->getStatus() === $entity::DEFAULT_STATUS ? "" : 'class="table-danger"' ?>>
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
<td nowrap><?= $viewDatas['helper']->getListButton('modify', '', $viewDatas) ?></td>
<td>
<td nowrap>
<div><?= $viewDatas['helper']->getFieldView('site', $entity->site, $viewDatas) ?></div>
<div><?= $viewDatas['helper']->getFieldView('location', $entity->location, $viewDatas) ?></div>
<div><?= $viewDatas['helper']->getFieldView('switchinfo_uid', $entity->switchinfo_uid, $viewDatas) ?></div>
</td>
<td>
<td nowrap>
<div><?= $viewDatas['helper']->getFieldView('clientinfo_uid', $entity->getClientInfoUID(), $viewDatas) ?></div>
<div><?= $viewDatas['helper']->getFieldView('type', $entity->type, $viewDatas) ?></div>
</td>
<td>
<td nowrap>
<div><?= $viewDatas['helper']->getFieldView('serverinfo_uid', $entity->getServerEntity()->getTitle(), $viewDatas) ?></div>
<div><?= $viewDatas['helper']->getFieldView('start_at', $entity->start_at, $viewDatas) ?></div>
</td>
<td>
<td nowrap>
<div><?= $viewDatas['helper']->getFieldView('amount', $entity->amount, $viewDatas) ?></div>
<div><?= $viewDatas['helper']->getFieldView('billing_at', $entity->billing_at, $viewDatas) ?></div>
</td>
<td>
<td nowrap>
<div><?= $viewDatas['helper']->getFieldView('status', $entity->status, $viewDatas) ?></div>
<div><?= $viewDatas['helper']->getFieldView('updated_at', $entity->updated_at, $viewDatas) ?></div>
</td>
<td nowrap>
<?php foreach (SERVICE['PARTTYPES'] as $partType): ?><div><?= $viewDatas['helper']->getFieldView($partType, "", $viewDatas) ?></div><?php endforeach; ?>
<div><?= $viewDatas['helper']->getFieldView("ipinfo_uid", "", $viewDatas) ?></div>
<div><?= $viewDatas['helper']->getFieldView("csinfo_uid", "", $viewDatas) ?></div>
<table class="table table-bordered table-striped m-0 p-0">
<?php foreach (SERVER['PARTTYPES'] as $partType): ?>
<tr class="m-0 p-0">
<th class="m-0 p-0"><?= $viewDatas['helper']->getListButton($partType, $partType, $viewDatas) ?></th>
<td class="m-0 p-0"><?= $viewDatas['helper']->getFieldView($partType, "", $viewDatas) ?></td>
</tr>
<?php endforeach ?>
<tr class="m-0 p-0">
<th class="m-0 p-0">IP</th>
<td class="m-0 p-0"><?= $viewDatas['helper']->getFieldView("ipinfo_uid", "", $viewDatas) ?></td>
</tr>
<tr class="m-0 p-0">
<th class="m-0 p-0">CS</th>
<td class="m-0 p-0"><?= $viewDatas['helper']->getFieldView("csinfo_uid", "", $viewDatas) ?></td>
</tr>
</table>
</td>
<td>
<td nowrap>
<div><?= $viewDatas['helper']->getFieldView('user_uid', $entity->user_uid, $viewDatas) ?></div>
</td>
<td nowrap>

View File

@ -5,13 +5,6 @@
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<div class="action_form">
<table class="table table-bordered">
<tr>
<th>서버정보</th>
<th>추가정보</th>
</tr>
<tr>
<td>
<table class="table table-bordered">
<?php foreach (["code", "type", "title", "price", "amount", "manufactur_at", "format_at", "status",] as $field): ?>
<tr>
@ -23,25 +16,6 @@
</tr>
<?php endforeach; ?>
</table>
</td>
<td>
<table class="table table-bordered">
<?php foreach (SERVICE['PARTTYPES'] as $partType): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("partinfo_uid_{$partType}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$partType}"), $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$partType}", old("partinfo_uid_{$partType}") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getPartInfoUID() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}"] ?? null)), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$partType}_cnt", old("partinfo_uid_{$partType}_cnt") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getCnt() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_cnt"] ?? null)), $viewDatas) ?>
<?php if ($partType === "DISK"): ?>
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$partType}_extra", old("partinfo_uid_{$partType}_extra") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getExtra() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_extra"] ?? null)), $viewDatas) ?>
<?php endif ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</td>
</tr>
</table>
<div class="text-center"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></div>
<?= form_close(); ?>
</div>

View File

@ -28,12 +28,12 @@
<table class="table table-bordered">
<?php foreach (SERVICE['PARTTYPES'] as $partType): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("partinfo_uid_{$partType}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$partType}"), $viewDatas) ?></th>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("{$partType}", lang("{$viewDatas['class_path']}.label.{$partType}"), $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['helper']->getFieldView("partinfo_uid_{$partType}", old("partinfo_uid_{$partType}") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getPartInfoUID() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}"] ?? null)), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldView("partinfo_uid_{$partType}_cnt", old("partinfo_uid_{$partType}_cnt") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getCnt() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_cnt"] ?? null)), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldView("{$partType}", old("{$partType}") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getPartInfoUID() : ($viewDatas['control']['form_datas']["{$partType}"] ?? null)), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldView("{$partType}_cnt", old("{$partType}_cnt") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getCnt() : ($viewDatas['control']['form_datas']["{$partType}_cnt"] ?? null)), $viewDatas) ?>
<?php if ($partType === "DISK"): ?>
<?= $viewDatas['helper']->getFieldView("partinfo_uid_{$partType}_extra", old("partinfo_uid_{$partType}_extra") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getExtra() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_extra"] ?? null)), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldView("{$partType}_extra", old("{$partType}_extra") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getExtra() : ($viewDatas['control']['form_datas']["{$partType}_extra"] ?? null)), $viewDatas) ?>
<?php endif ?>
</td>
</tr>