dbmsv3 init...1
This commit is contained in:
parent
9f42710724
commit
ead109480b
@ -291,6 +291,7 @@ class CommonHelper
|
||||
case 'end_at':
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
case 'deleted_at':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender';
|
||||
$form = form_input($field, $value ?? "", $extras);
|
||||
break;
|
||||
|
||||
@ -2,4 +2,4 @@
|
||||
|
||||
namespace App\Interfaces\Customer;
|
||||
|
||||
interface CustomerInterFace {}
|
||||
interface CustomerInterface {}
|
||||
|
||||
@ -22,8 +22,9 @@ return [
|
||||
PAYMENT['BILLING']['ONETIME'] => "일회성",
|
||||
],
|
||||
"PAY" => [
|
||||
"account" => "예치금",
|
||||
"coupon" => "쿠폰",
|
||||
PAYMENT['PAY']['ACCOUNT'] => "예치금",
|
||||
PAYMENT['PAY']['COUPON'] => "쿠폰",
|
||||
PAYMENT['PAY']['POINT'] => "포인트",
|
||||
],
|
||||
"STATUS" => [
|
||||
STATUS['UNPAID'] => "미지급",
|
||||
|
||||
@ -5,7 +5,7 @@ namespace App\Libraries\DBMigration\Process;
|
||||
use App\Entities\Part\SWITCHEntity;
|
||||
use CodeIgniter\Database\BaseConnection;
|
||||
|
||||
class SWITCHCodeProcess implements MigrationProcessInterface
|
||||
class SwitchCodeProcess implements MigrationProcessInterface
|
||||
{
|
||||
private $db;
|
||||
public function __construct(BaseConnection $db)
|
||||
|
||||
@ -56,6 +56,9 @@ class AccountService extends CustomerService
|
||||
if (!$entity instanceof ClientEntity) {
|
||||
throw new \Exception("{$formDatas['clientinfo_uid']}에 대한 고객정보를 찾을수 없습니다.");
|
||||
}
|
||||
if (!array_key_exists('amount', $formDatas) || !array_key_exists('status', $formDatas)) {
|
||||
throw new \Exception("입출금처리를 위한 금액과 상태값이 필요합니다.");
|
||||
}
|
||||
$amount = intval($formDatas['amount']);
|
||||
if ($formDatas['status'] === AccountEntity::DEFAULT_STATUS) { //입금, 쿠폰추가
|
||||
$entity = $this->getClientService()->deposit($entity, 'account_balance', $amount);
|
||||
|
||||
@ -110,10 +110,9 @@ class ClientService extends CustomerService
|
||||
break;
|
||||
default:
|
||||
throw new \Exception("{$field}는 알수없는 Field가 정의되었습니다.");
|
||||
// break;
|
||||
}
|
||||
$formDatas = [$field => $amount];
|
||||
// dd($formDatas);
|
||||
return parent::modify($entity, $formDatas);
|
||||
return parent::modify($entity, [$field => $amount]);
|
||||
}
|
||||
//출금(쿠폰:사용)처리
|
||||
final public function withdrawal(ClientEntity $entity, string $field, int $amount): ClientEntity
|
||||
@ -141,8 +140,7 @@ class ClientService extends CustomerService
|
||||
throw new \Exception("{$field}는 알수없는 Field가 정의되었습니다.");
|
||||
// break;
|
||||
}
|
||||
$formDatas = [$field => $amount];
|
||||
return parent::modify($entity, $formDatas);
|
||||
return parent::modify($entity, [$field => $amount]);
|
||||
}
|
||||
//기본 기능부분
|
||||
//생성
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Entities\Customer\ClientEntity;
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Entities\PaymentEntity;
|
||||
@ -10,6 +11,7 @@ use App\Interfaces\Customer\ServiceInterface;
|
||||
use App\Interfaces\Equipment\ServerPartInterface;
|
||||
use App\Models\PaymentModel;
|
||||
use App\Services\CommonService;
|
||||
use App\Services\Customer\AccountService;
|
||||
use App\Services\Customer\ClientService;
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Services\Equipment\ServerPartService;
|
||||
@ -103,7 +105,6 @@ class PaymentService extends CommonService implements ServiceInterface, ServerPa
|
||||
}
|
||||
return $this->_serverPartService;
|
||||
}
|
||||
|
||||
//총 미납건수, 금액
|
||||
final public function getUnPaids(string $group, array $where = []): array
|
||||
{
|
||||
@ -219,6 +220,40 @@ class PaymentService extends CommonService implements ServiceInterface, ServerPa
|
||||
$formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID();
|
||||
return parent::create($formDatas);
|
||||
}
|
||||
//일괄처리작업(결제작업)
|
||||
public function batchjob(mixed $entity, array $formDatas): mixed
|
||||
{
|
||||
//고객정보
|
||||
$userEntity = $this->getClientService()->getEntity($entity->getClientInfoUID());
|
||||
if (!$userEntity instanceof ClientEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 고객정보[{$entity->getClientInfoUID()}]를 찾을수 없습니다.");
|
||||
}
|
||||
if (!array_key_exists('pay', $formDatas)) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 결제상태(pay) 정보가 없습니다.");
|
||||
}
|
||||
switch ($formDatas['pay']) {
|
||||
case PAYMENT['PAY']['ACCOUNT']:
|
||||
//예치금 출금처리
|
||||
if ($userEntity->getAccountBalance() < $entity->getAmount()) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 고객[{$userEntity->getName()}]의 예치금이 부족합니다.({$userEntity->getAccountBalance()} < {$entity->getAmount()})");
|
||||
}
|
||||
break;
|
||||
case PAYMENT['PAY']['COUPON']:
|
||||
//쿠폰 출금처리
|
||||
if ($userEntity->getCouponBalance() < 1) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 고객[{$userEntity->getName()}]의 쿠폰이 부족합니다.({$userEntity->getCouponBalance()} < 1)");
|
||||
}
|
||||
break;
|
||||
case PAYMENT['PAY']['POINT']:
|
||||
break;
|
||||
default:
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 알수없는 결제방법(pay)입니다.");
|
||||
// break;
|
||||
}
|
||||
//결제처리완료
|
||||
$entity = parent::batchjob($entity, $formDatas);
|
||||
return $entity;
|
||||
}
|
||||
//List 검색용
|
||||
//OrderBy 처리
|
||||
final public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||
|
||||
@ -80,7 +80,7 @@
|
||||
<td nowrap>
|
||||
<?= $viewDatas['service']->getHelper()->getFieldView('ip', $entity->ip, $viewDatas) ?>
|
||||
</td>
|
||||
<td nowrap>
|
||||
<td>
|
||||
<?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
||||
'serverinfo_uid' => $entity->getPK(),
|
||||
'types' => SERVERPART['SERVER_PARTTYPES'],
|
||||
|
||||
@ -1,49 +1,53 @@
|
||||
/**
|
||||
* 공용 폼 초기화 함수
|
||||
* @param {HTMLElement} context - 초기화 대상 (없으면 document 전체)
|
||||
*/
|
||||
function initFormJS(context) {
|
||||
const root = context || document;
|
||||
// /public/js/admin/form.js
|
||||
window.initFormModal = function (context) {
|
||||
const $context = context ? $(context) : $(document);
|
||||
|
||||
// Datepicker
|
||||
if (root.querySelector(".calender")) {
|
||||
$(root).find(".calender").datepicker({
|
||||
changeYear: true,
|
||||
changeMonth: true,
|
||||
yearRange: "-10:+0",
|
||||
dateFormat: "yy-mm-dd"
|
||||
});
|
||||
}
|
||||
// ✅ 캘린더
|
||||
$context.find(".calender").datepicker({
|
||||
changeYear: true,
|
||||
changeMonth: true,
|
||||
yearRange: "-10:+0",
|
||||
dateFormat: "yy-mm-dd"
|
||||
});
|
||||
|
||||
// TinyMCE
|
||||
if (root.querySelector(".tinymce")) {
|
||||
if (document.compatMode !== "CSS1Compat") {
|
||||
console.error("문서가 표준 모드가 아닙니다.");
|
||||
return;
|
||||
// ✅ TinyMCE
|
||||
if ($context.find(".tinymce").length) {
|
||||
if (typeof tinymce !== "undefined") {
|
||||
tinymce.remove(); // 기존 인스턴스 제거
|
||||
tinymce.init({
|
||||
selector: ".tinymce",
|
||||
license_key: "gpl",
|
||||
height: 250,
|
||||
plugins: "advlist autolink lists link image charmap preview anchor",
|
||||
toolbar: "undo redo | bold italic underline | align | link image | code fullscreen preview",
|
||||
menubar: "file edit view insert format tools table help"
|
||||
});
|
||||
}
|
||||
tinymce.init({
|
||||
selector: 'textarea.tinymce',
|
||||
license_key: 'gpl',
|
||||
height: 250,
|
||||
plugins: 'advlist autolink lists link image charmap preview anchor',
|
||||
toolbar: 'undo redo blocks fontfamily fontsize forecolor backcolor | ' +
|
||||
'bold italic underline strikethrough | align numlist bullist | ' +
|
||||
'link image | table media | code fullscreen preview',
|
||||
menubar: 'file edit view insert format tools table help'
|
||||
});
|
||||
}
|
||||
|
||||
// Select2
|
||||
if (root.querySelector(".select-field")) {
|
||||
$(root).find(".select-field").select2({
|
||||
// ✅ Select2 (입력 허용)
|
||||
if ($context.find(".select-field").length) {
|
||||
$context.find(".select-field").select2({
|
||||
theme: "bootstrap-5",
|
||||
tags: true, // 없는 값 입력 가능
|
||||
tags: true,
|
||||
allowClear: true,
|
||||
language: {
|
||||
noResults: function () {
|
||||
return "직접 입력 후 Enter";
|
||||
return "직접 입력 후 Enter"; // 사용자 안내
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
console.log("✅ Form initialized inside modal:", context);
|
||||
};
|
||||
|
||||
// ✅ DOM 전체 로드 후 (페이지 최초 로드시 실행)
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
window.initFormModal(document);
|
||||
});
|
||||
|
||||
// ✅ Modal 로드 시점에 재초기화
|
||||
$(document).on("shown.bs.modal", ".modal", function (e) {
|
||||
window.initFormModal(this);
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user