dbmsv4 init...1

This commit is contained in:
최준흠 2025-11-25 11:52:10 +09:00
parent a7caf53c86
commit 92caea4ba8
41 changed files with 166 additions and 118 deletions

View File

@ -34,8 +34,9 @@ abstract class AbstractCRUDController extends AbstractWebController
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
$formDatas = $this->create_form_process();
$this->action_init_process($action, $formDatas);
$this->addViewDatas('formDatas', $formDatas);
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
@ -103,7 +104,7 @@ abstract class AbstractCRUDController extends AbstractWebController
}
$this->addViewDatas('entity', $entity);
$action = __FUNCTION__;
$this->action_init_process($action, $entity);
$this->action_init_process($action, [], $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());

View File

@ -76,11 +76,10 @@ abstract class AbstractWebController extends Controller
/**
* 모든 액션 실행 공통 초기화 작업
*/
protected function action_init_process(string $action, ?object $entity = null): void
protected function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$this->addViewDatas('action', $action);
$this->addViewDatas('authContext', $this->getAuthContext());
// $this->service가 하위 클래스에서 설정되었다고 가정
$this->addViewDatas('classPath', $this->service->getClassPaths(false));
}

View File

@ -17,10 +17,10 @@ abstract class AdminController extends CommonController
$this->addActionPaths($this->_layout);
$this->layouts = LAYOUTS[$this->_layout];
}
protected function action_init_process(string $action, ?object $entity = null): void
protected function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$this->service->action_init_process($action, $entity);
parent::action_init_process($action, $entity);
$this->service->action_init_process($action, $formDatas, $entity);
parent::action_init_process($action, $formDatas, $entity);
$this->addViewDatas('layout', $this->layouts);
$this->addViewDatas('title', $this->getTitle());
$this->addViewDatas('helper', $this->service->getHelper());

View File

@ -16,17 +16,13 @@ class ServiceController extends CustomerController
$this->service = service('customer_serviceservice');
}
$this->addActionPaths('service');
$this->layouts['javascripts'][] = '<script src="/js/admin/clipboard.js"></script>';
}
protected function getEntityClass(): string
{
return ServiceEntity::class;
}
//기본 함수 작업
protected function action_init_process(string $action, ?object $entity = null): void
{
$this->layouts['javascripts'][] = '<script src="/js/admin/clipboard.js"></script>';
parent::action_init_process($action, $entity);
}
//Custom 추가 함수
public function create_form_process(array $formDatas = []): array
{

View File

@ -16,6 +16,7 @@ class ServerController extends EquipmentController
$this->service = service('equipment_serverservice');
}
$this->addActionPaths('server');
$this->layouts['javascripts'][] = '<script src="/js/admin/clipboard.js"></script>';
}
protected function getEntityClass(): string
{

View File

@ -17,10 +17,10 @@ class Home extends AbstractWebController
}
$this->addActionPaths('home');
}
protected function action_init_process(string $action, ?object $entity = null): void
protected function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
// $this->service->action_init_process($action, $entity);
parent::action_init_process($action, $entity);
parent::action_init_process($action, $formDatas, $entity);
$this->addViewDatas('layout', LAYOUTS['admin']);
}
//Index,FieldForm관련

View File

@ -23,7 +23,7 @@ class ServerEntity extends EquipmentEntity
//기본기능용
public function getCustomTitle(mixed $title = null): string
{
return sprintf("[%s]%s / %s", $this->getCode(), $title ? $title : $this->getIP(), $this->getOS());
return sprintf("[%s]%s", $this->getCode(), $title ? $title : $this->getIP());
}
final public function getCode(): string
{

View File

@ -44,19 +44,19 @@ class BoardForm extends CommonForm
}
return $rule;
}
public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
public function getFormOption(string $action, string $field, array $formDatas = [], array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
{
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
switch ($field) {
case 'worker_uid':
foreach ($this->getFormOption_process(service('userservice'), $action, $field, $entity) as $tempEntity) {
foreach ($this->getFormOption_process(service('userservice'), $action, $field, $formDatas) as $tempEntity) {
$tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle();
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
}
$options['options'] = $tempOptions;
break;
default:
$options = parent::getFormOption($action, $field, $entity, $options);
$options = parent::getFormOption($action, $field, $formDatas, $options);
break;
}
return $options;

View File

@ -8,6 +8,7 @@ use RuntimeException;
abstract class CommonForm
{
private array $_attributes = [];
private array $_formDatas = [];
private array $_formFields = [];
private array $_formRules = [];
private array $_formFilters = [];
@ -28,6 +29,19 @@ abstract class CommonForm
}
return $this->_attributes[$key];
}
final public function setFormDatas(array $formDatas): void
{
$this->_formDatas = $formDatas;
}
//$fields 매치된것만 반환, []->전체
final public function getFormDatas(array $fields = []): array
{
if (empty($fields)) {
return $this->_formDatas;
}
// _formDatas 키를 비교하여 교집합을 반환합니다. $fields에 지정된 필드 정의만 추출됩니다.
return array_intersect_key($this->_formDatas, array_flip($fields));
}
final public function setFormFields(array $fields): void
{
foreach ($fields as $field) {
@ -57,10 +71,10 @@ abstract class CommonForm
}
return array_intersect_key($this->_formRules, array_flip($fields));
}
final public function setFormOptions(string $action, array $fields, ?object $entity = null, $formOptions = []): void
final public function setFormOptions(string $action, array $fields, array $formDatas = [], $formOptions = []): void
{
foreach ($fields as $field) {
$formOptions[$field] = $formOptions[$field] ?? $this->getFormOption($action, $field, $entity);
$formOptions[$field] = $formOptions[$field] ?? $this->getFormOption($action, $field, $formDatas);
}
$this->_formOptions = $formOptions;
}
@ -183,37 +197,35 @@ abstract class CommonForm
}
return $rule;
}
protected function getFormOption_process($service, string $action, string $field, ?object $entity = null): array
protected function getFormOption_process($service, string $action, string $field, array $formDatas = []): array
{
$entities = [];
switch ($action) {
case 'create_form':
$entities = $service->getEntities(['status' => STATUS['AVAILABLE']]);
break;
case 'modify_form':
$where = sprintf("status = '%s' OR %s='%s'", STATUS['AVAILABLE'], $this->getAttribute('pk_field'), $entity->$field);
$entities = $service->getEntities([$where => null]);
break;
switch ($field) {
default:
$entities = $service->getEntities();
if (array_key_exists($field, $formDatas)) {
$where = sprintf("status = '%s' OR %s='%s'", STATUS['AVAILABLE'], $this->getAttribute('pk_field'), $formDatas[$field]);
$entities = $service->getEntities([$where => null]);
} else {
$entities = $service->getEntities();
}
break;
}
return $entities;
}
public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
public function getFormOption(string $action, string $field, array $formDatas = [], array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
{
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
switch ($field) {
case 'user_uid':
foreach ($this->getFormOption_process(service('userservice'), $action, $field, $entity) as $entity) {
foreach ($this->getFormOption_process(service('userservice'), $action, $field, $formDatas) as $entity) {
$tempOptions[$entity->getPK()] = $entity->getTitle();
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
}
$options['options'] = $tempOptions;
break;
case 'clientinfo_uid':
foreach ($this->getFormOption_process(service('customer_clientservice'), $action, $field, $entity) as $entity) {
foreach ($this->getFormOption_process(service('customer_clientservice'), $action, $field, $formDatas) as $entity) {
$tempOptions[$entity->getPK()] = $entity->getTitle();
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
}

View File

@ -46,19 +46,19 @@ class ServiceForm extends CustomerForm
return $rule;
}
public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
public function getFormOption(string $action, string $field, array $formDatas = [], array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
{
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
switch ($field) {
case 'serverinfo_uid':
foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $entity) as $tempEntity) {
foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $formDatas) as $tempEntity) {
$tempOptions[$tempEntity->getPK()] = $tempEntity->getCustomTitle();
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
}
$options['options'] = $tempOptions;
break;
default:
$options = parent::getFormOption($action, $field, $entity, $options);
$options = parent::getFormOption($action, $field, $formDatas, $options);
break;
}
return $options;

View File

@ -46,38 +46,38 @@ class ServerForm extends EquipmentForm
return $rule;
}
protected function getFormOption_process($service, string $action, string $field, ?object $entity = null): array
protected function getFormOption_process($service, string $action, string $field, array $formDatas = []): array
{
$entities = [];
switch ($action) {
case 'modify_form':
if ($field === 'ip') {
$where = sprintf("status = '%s' OR %s='%s'", STATUS['AVAILABLE'], "ip", $entity->$field);
switch ($field) {
case 'ip':
if (array_key_exists($field, $formDatas)) {
$where = sprintf("status = '%s' OR %s='%s'", STATUS['AVAILABLE'], $field, $formDatas[$field]);
$entities = $service->getEntities([$where => null]);
} else {
$entities = parent::getFormOption_process($service, $action, $field, $entity);
$entities = parent::getFormOption_process($service, $action, $field, $formDatas);
}
break;
default:
$entities = parent::getFormOption_process($service, $action, $field, $entity);
$entities = parent::getFormOption_process($service, $action, $field, $formDatas);
break;
}
return $entities;
}
public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
public function getFormOption(string $action, string $field, array $formDatas = [], array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
{
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
switch ($field) {
case 'serviceinfo_uid':
foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $entity) as $tempEntity) {
foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $formDatas) as $tempEntity) {
$tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle();
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
}
$options['options'] = $tempOptions;
break;
case 'switchinfo_uid':
foreach ($this->getFormOption_process(service('part_switchservice'), $action, $field, $entity) as $tempEntity) {
foreach ($this->getFormOption_process(service('part_switchservice'), $action, $field, $formDatas) as $tempEntity) {
$tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle();
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
}
@ -85,14 +85,14 @@ class ServerForm extends EquipmentForm
// dd($options);
break;
case 'ip': //key=value이 같음주의
foreach ($this->getFormOption_process(service('part_ipservice'), $action, $field, $entity) as $tempEntity) {
foreach ($this->getFormOption_process(service('part_ipservice'), $action, $field, $formDatas) as $tempEntity) {
$tempOptions[$tempEntity->getTitle()] = $tempEntity->getTitle();
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
}
$options['options'] = $tempOptions;
break;
default:
$options = parent::getFormOption($action, $field, $entity, $options);
$options = parent::getFormOption($action, $field, $formDatas, $options);
break;
}
return $options;

View File

@ -42,7 +42,7 @@ class ServerPartForm extends EquipmentForm
{
return service('part_' . strtolower($type) . 'service');
}
public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
public function getFormOption(string $action, string $field, array $formDatas = [], array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
{
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
switch ($field) {
@ -58,21 +58,21 @@ class ServerPartForm extends EquipmentForm
$options['options'] = $tempOptions;
break;
case 'serverinfo_uid':
foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $entity) as $tempEntity) {
foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $formDatas) as $tempEntity) {
$tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle();
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
}
$options['options'] = $tempOptions;
break;
case 'serviceinfo_uid':
foreach ($this->getFormOption_process(service('customer_clientservice'), $action, $field, $entity) as $tempEntity) {
foreach ($this->getFormOption_process(service('customer_clientservice'), $action, $field, $formDatas) as $tempEntity) {
$tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle();
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
}
$options['options'] = $tempOptions;
break;
default:
$options = parent::getFormOption($action, $field, $entity, $options);
$options = parent::getFormOption($action, $field, $formDatas, $options);
break;
}
return $options;

View File

@ -27,19 +27,19 @@ class IPForm extends PartForm
}
return $rule;
}
public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
public function getFormOption(string $action, string $field, array $formDatas = [], array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
{
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
switch ($field) {
case 'lineinfo_uid':
foreach ($this->getFormOption_process(service('equipment_lineservice'), $action, $field, $entity) as $tempEntity) {
foreach ($this->getFormOption_process(service('equipment_lineservice'), $action, $field, $formDatas) as $tempEntity) {
$tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle();
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
}
$options['options'] = $tempOptions;
break;
case 'old_clientinfo_uid':
foreach ($this->getFormOption_process(service('customer_clientservice'), $action, $field, $entity) as $tempEntity) {
foreach ($this->getFormOption_process(service('customer_clientservice'), $action, $field, $formDatas) as $tempEntity) {
$tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle();
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
}
@ -47,7 +47,7 @@ class IPForm extends PartForm
$options['options'] = $tempOptions;
break;
default:
$options = parent::getFormOption($action, $field, $entity, $options);
$options = parent::getFormOption($action, $field, $formDatas, $options);
break;
}
return $options;

View File

@ -35,26 +35,26 @@ abstract class PartForm extends CommonForm
}
return $rule;
}
public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
public function getFormOption(string $action, string $field, array $formDatas = [], array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
{
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
switch ($field) {
case 'serviceinfo_uid':
foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $entity) as $tempEntity) {
foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $formDatas) as $tempEntity) {
$tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle();
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
}
$options['options'] = $tempOptions;
break;
case 'serverinfo_uid':
foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $entity) as $tempEntity) {
foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $formDatas) as $tempEntity) {
$tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle();
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
}
$options['options'] = $tempOptions;
break;
default:
$options = parent::getFormOption($action, $field, $entity, $options);
$options = parent::getFormOption($action, $field, $formDatas, $options);
break;
}
return $options;

View File

@ -41,19 +41,19 @@ class PaymentForm extends CommonForm
return $rule;
}
public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
public function getFormOption(string $action, string $field, array $formDatas = [], array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
{
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
switch ($field) {
case 'serviceinfo_uid':
foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $entity) as $tempEntity) {
foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $formDatas) as $tempEntity) {
$tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle();
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
}
$options['options'] = $tempOptions;
break;
default:
$options = parent::getFormOption($action, $field, $entity, $options);
$options = parent::getFormOption($action, $field, $formDatas, $options);
break;
}
return $options;

View File

@ -37,8 +37,12 @@ class ServiceHelper extends CustomerHelper
{
switch ($field) {
case 'serverinfo_uid':
$value = $viewDatas['formOptions'][$field]['options'][$value];
$value = "<span class=\"serverparts\" style=\"cursor:pointer;\" onClick=\"copyServerPartToClipboard('{$value}')\" text-data=\"{$value}\">📋</span>{$value}";
$value = view_cell("\App\Cells\Equipment\ServerCell::detail", [
'serviceEntity' => $viewDatas['entity'],
'template' => 'servicelist',
]);
// $value = $viewDatas['formOptions'][$field]['options'][$value];
// $value = "<span class=\"serverparts\" style=\"cursor:pointer;\" onClick=\"copyServerPartToClipboard('{$value}')\" text-data=\"{$value}\">📋</span>{$value}";
break;
case 'amount':
case 'sale':

View File

@ -48,6 +48,13 @@ class ServerHelper extends EquipmentHelper
case 'format_at':
$value = $value ? date("Y-m-d", strtotime($value)) : "";
break;
case 'part':
$value = view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
'serverinfo_uid' => $viewDatas['entity']->getPK(),
'types' => SERVERPART['SERVER_PARTTYPES'],
'template' => 'serverlist',
]);
break;
default:
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
break;
@ -69,6 +76,19 @@ class ServerHelper extends EquipmentHelper
}
return $filter;
}
public function getListLabel(string $field, string $label, array $viewDatas, array $extras = []): string
{
switch ($field) {
case 'part':
$label = parent::getListLabel($field, $label, $viewDatas, $extras);
$label .= "<span class=\"float-start rounded border border-primary\" style=\"cursor:pointer;\" onclick=\"copyServerPartsToClipboard()\">ALL 📋</span>";
break;
default:
$label = parent::getListLabel($field, $label, $viewDatas, $extras);
break;
}
return $label;
}
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
{
switch ($action) {

View File

@ -9,6 +9,7 @@ return [
'switchinfo_uid' => "스위치",
'ip' => "IP",
'os' => "OS",
'part' => "부품",
'title' => "모델명",
'price' => "기본가",
'manufactur_at' => "입고일",

View File

@ -53,7 +53,7 @@ class BoardService extends CommonService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
'category',
@ -108,6 +108,7 @@ class BoardService extends CommonService
];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -30,7 +30,7 @@ abstract class CommonService
{
return $isArray ? $this->_classPaths : implode($delimeter, $this->_classPaths);
}
abstract public function action_init_process(string $action, ?object $entity = null): void;
abstract public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void;
/**
* 단일 엔티티를 조회합니다.
* @return CommonEntity|null CommonEntity 인스턴스 또는 찾지 못했을 경우 null

View File

@ -54,7 +54,7 @@ class AccountService extends CustomerService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
"clientinfo_uid",
@ -89,6 +89,7 @@ class AccountService extends CustomerService
$fields = [...$fields, 'created_at'];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -54,7 +54,7 @@ class ClientService extends CustomerService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
'site',
@ -98,6 +98,7 @@ class ClientService extends CustomerService
];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -54,7 +54,7 @@ class CouponService extends CustomerService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
"clientinfo_uid",
@ -83,6 +83,7 @@ class CouponService extends CustomerService
$fields = [...$fields, 'created_at'];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -54,7 +54,7 @@ class PointService extends CustomerService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
"clientinfo_uid",
@ -83,6 +83,7 @@ class PointService extends CustomerService
$fields = [...$fields, 'created_at'];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -56,7 +56,7 @@ class ServiceService extends CustomerService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
"site",
@ -115,6 +115,7 @@ class ServiceService extends CustomerService
];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -54,7 +54,7 @@ class LineService extends EquipmentService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
"type",
@ -84,6 +84,7 @@ class LineService extends EquipmentService
$fields = [...$fields, 'status', 'created_at'];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -56,7 +56,7 @@ class ServerPartService extends EquipmentService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
"serverinfo_uid",
@ -93,6 +93,7 @@ class ServerPartService extends EquipmentService
$fields = [...$fields, 'created_at'];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -54,7 +54,7 @@ class ServerService extends EquipmentService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
"code",
@ -90,9 +90,23 @@ class ServerService extends EquipmentService
break;
case 'index':
case 'download':
$fields = ['clientinfo_uid', ...$fields, 'status', 'created_at'];
$fields = [
'clientinfo_uid',
"code",
"type",
"switchinfo_uid",
"ip",
"title",
"os",
"part",
"price",
"manufactur_at",
"format_at",
'status',
];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -42,7 +42,7 @@ class MylogService extends CommonService implements PipelineStepInterface
}
return $this->_form;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = ['title', 'content'];
$filters = [];
@ -62,6 +62,7 @@ class MylogService extends CommonService implements PipelineStepInterface
$fields = [...$fields, 'status', 'created_at'];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -54,7 +54,7 @@ class CPUService extends PartService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
"title",
@ -81,6 +81,7 @@ class CPUService extends PartService
$fields = [...$fields, 'status', 'created_at'];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -54,7 +54,7 @@ class CSService extends PartService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
"type",
@ -108,6 +108,7 @@ class CSService extends PartService
];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -54,7 +54,7 @@ class DISKService extends PartService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
"title",
@ -82,6 +82,7 @@ class DISKService extends PartService
$fields = [...$fields, "format", 'status', 'created_at'];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -54,7 +54,7 @@ class IPService extends PartService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
"lineinfo_uid",
@ -99,6 +99,7 @@ class IPService extends PartService
];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -54,7 +54,7 @@ class RAMService extends PartService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
"title",
@ -81,6 +81,7 @@ class RAMService extends PartService
$fields = [...$fields, 'status', 'created_at'];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -40,7 +40,7 @@ class SOFTWAREService extends PartService
}
return $this->_form;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
"title",
@ -67,6 +67,7 @@ class SOFTWAREService extends PartService
$fields = [...$fields, 'status', 'created_at'];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -54,7 +54,7 @@ class SWITCHService extends PartService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
"code",
@ -100,6 +100,7 @@ class SWITCHService extends PartService
];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -54,7 +54,7 @@ class PaymentService extends CommonService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
"serviceinfo_uid",
@ -119,6 +119,7 @@ class PaymentService extends CommonService
];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -54,7 +54,7 @@ class UserService extends CommonService
}
return $this->_helper;
}
public function action_init_process(string $action, ?object $entity = null): void
public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void
{
$fields = [
'id',
@ -84,6 +84,7 @@ class UserService extends CommonService
$fields = ['id', 'name', 'email', 'mobile', 'role', 'status', 'created_at'];
break;
}
$this->getFormService()->setFormDatas($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules($action, $fields);
$this->getFormService()->setFormFilters($filters);

View File

@ -0,0 +1,13 @@
<?php $temps = []; ?>
<?php foreach ($serverCellDatas['entities'] as $entity): ?>
<?php $serverCellDatas['entity'] = $entity ?>
<?php $value = sprintf(
"%s / %s / %s / %s",
$entity->getCustomTitle(),
$serverCellDatas['helper']->getFieldView('switchinfo_uid', $entity->getSwitchInfoUID(), $serverCellDatas),
$entity->getIP(),
$entity->getOS()
) ?>
<?php $temps[] = "<span class=\"serverparts\" style=\"cursor:pointer;\" onClick=\"copyServerPartToClipboard('{$value}')\" text-data=\"{$value}\">📋</span>{$value}" ?>
<?php endforeach; ?>
<?= implode("<BR>", $temps) ?>

View File

@ -1,31 +0,0 @@
<?php $htmls = $texts = [] ?>
<?php foreach ($serverPartCellDatas['types'] as $type): ?>
<?php $htmls[$type] = [] ?>
<?php $texts[$type] = []; ?>
<?php foreach ($serverPartCellDatas['entities'][$type] as $entities): ?>
<?php foreach ($entities as $entity): ?>
<?php $serverPartCellDatas['entity'] = $entity ?>
<?php $htmls[$type][] = $serverPartCellDatas['helper']->getFieldView($type, $entity->getPK(), $serverPartCellDatas) ?>
<?php $texts[$type][] = $serverPartCellDatas['helper']->getFieldView($type, $entity->getPK(), $serverPartCellDatas, ['return' => 'onlyText']) ?>
<?php endforeach ?>
<?php endforeach ?>
<?php endforeach ?>
<?php $view_htmls = [
$serverPartCellDatas['helper']->getFieldView('SERVER', "", $serverPartCellDatas),
$serverPartCellDatas['serverEntity']->getIP(),
$serverPartCellDatas['serverEntity']->getSwitch(),
$serverPartCellDatas['serverEntity']->getOS()
] ?>
<?php foreach ($htmls as $type => $datas): ?><?php $view_htmls[] = implode(",", $datas) ?><?php endforeach ?>
<?php $view_texts = [
$serverPartCellDatas['serverEntity']->getCode(),
$serverPartCellDatas['serverEntity']->getIP(),
$serverPartCellDatas['serverEntity']->getSwitch(),
$serverPartCellDatas['serverEntity']->getOS()
] ?>
<?php foreach ($texts as $type => $datas): ?><?php $view_texts[] = implode(',', $datas) ?><?php endforeach ?>
<?php $text = implode("/", $view_texts) ?>
<div class="text-nowrap" style="font-size: 0.9em;">
<span class="serverparts" style="cursor:pointer;" onClick="copyServerPartToClipboard('<?= $text ?>')" text-data="<?= $text ?>">📋</span>
<?= implode("/", $view_htmls) ?>
</div>