88 lines
3.6 KiB
PHP
88 lines
3.6 KiB
PHP
<?php
|
|
|
|
namespace App\Helpers\Customer;
|
|
|
|
use App\Models\Customer\ServicePaymentModel;
|
|
use CodeIgniter\HTTP\IncomingRequest;
|
|
|
|
class ServicePaymentHelper extends CustomerHelper
|
|
{
|
|
protected ?IncomingRequest $request = null;
|
|
public function __construct(?IncomingRequest $request = null)
|
|
{
|
|
parent::__construct($request);
|
|
$this->setTitleField(field: ServicePaymentModel::TITLE);
|
|
}
|
|
|
|
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
|
|
{
|
|
switch ($field) {
|
|
case "countdown": //결제일Countdown
|
|
$value = $viewDatas['entity']->getView_CounDueAt();
|
|
break;
|
|
case 'item_uid':
|
|
// echo "Value:" . $viewDatas['entity']->getItemType() . ":" . $value;
|
|
// dd($viewDatas['control']['filter_optons']);
|
|
$value = $viewDatas['control']['filter_optons'][$viewDatas['entity']->getItemType()][$value]->getTitle();
|
|
break;
|
|
case 'amount':
|
|
$value = number_format($value);
|
|
break;
|
|
case 'status':
|
|
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
|
|
break;
|
|
default:
|
|
if (in_array($field, $viewDatas['control']['filter_fields'])) {
|
|
$value = $viewDatas['control']['filter_optons'][$field][$value]->getTitle();
|
|
}
|
|
break;
|
|
}
|
|
if (is_array($value)) {
|
|
echo __METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다";
|
|
exit;
|
|
}
|
|
return $value;
|
|
}
|
|
public function getListButton(string $action, array $viewDatas, array $extras = []): string
|
|
{
|
|
switch ($action) {
|
|
case 'modify':
|
|
$checkbox = '';
|
|
//상태가 미지급이 경우만 checkbox를 표시
|
|
if ($viewDatas['entity']->getStatus() === DEFAULTS['STATUS']) {
|
|
$oldBatchJobUids = old("batchjob_uids", null);
|
|
$oldBatchJobUids = is_array($oldBatchJobUids) ? $oldBatchJobUids : [$oldBatchJobUids];
|
|
$checkbox = form_checkbox([
|
|
"id" => "checkbox_uid_{$viewDatas['entity']->getPK()}",
|
|
"name" => "batchjob_uids[]",
|
|
"value" => $viewDatas['entity']->getPK(),
|
|
"class" => "batchjobuids_checkboxs",
|
|
"checked" => in_array($viewDatas['entity']->getPK(), $oldBatchJobUids)
|
|
]);
|
|
}
|
|
$action = $checkbox . form_label(
|
|
$viewDatas['cnt'],
|
|
$action,
|
|
[
|
|
"data-src" => current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK() . '?' . $this->getRequest()->getUri()->getQuery(),
|
|
"data-bs-toggle" => "modal",
|
|
"data-bs-target" => "#index_action_form",
|
|
...$extras
|
|
]
|
|
);
|
|
break;
|
|
case 'invoice':
|
|
$action = form_submit($action . "_submit", '청구서 발행', [
|
|
"formaction" => current_url() . '/' . $action,
|
|
"class" => "btn btn-outline btn-primary",
|
|
// "onclick" => "return submitBatchJob()"
|
|
]);
|
|
break;
|
|
default:
|
|
$action = parent::getListButton($action, $viewDatas, $extras);
|
|
break;
|
|
}
|
|
return $action;
|
|
}
|
|
}
|