shoppingmallv2 init...
This commit is contained in:
parent
85299dc1e1
commit
e7e2a276d8
@ -2,13 +2,18 @@
|
|||||||
|
|
||||||
namespace App\Controllers\Admin;
|
namespace App\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Entities\BillingEntity;
|
||||||
use App\Models\BillingModel;
|
use App\Models\BillingModel;
|
||||||
|
use App\Models\OrderBillingModel;
|
||||||
|
use App\Models\OrderModel;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class BillingController extends AdminController
|
class BillingController extends AdminController
|
||||||
{
|
{
|
||||||
|
private $_orderBillingModel = null;
|
||||||
|
private $_orderModel = null;
|
||||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
parent::initController($request, $response, $logger);
|
parent::initController($request, $response, $logger);
|
||||||
@ -20,6 +25,15 @@ class BillingController extends AdminController
|
|||||||
helper($this->_viewDatas['className']);
|
helper($this->_viewDatas['className']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final protected function getOrderModel(): OrderModel
|
||||||
|
{
|
||||||
|
return $this->_orderModel = $this->_orderModel ?: new OrderModel();
|
||||||
|
}
|
||||||
|
final protected function getOrderBillingModel(): OrderBillingModel
|
||||||
|
{
|
||||||
|
return $this->_orderBillingModel = $this->_orderBillingModel ?: new OrderBillingModel();
|
||||||
|
}
|
||||||
|
|
||||||
public function getFields(string $action = ""): array
|
public function getFields(string $action = ""): array
|
||||||
{
|
{
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
@ -46,4 +60,32 @@ class BillingController extends AdminController
|
|||||||
{
|
{
|
||||||
return ["user_uid", "status"];
|
return ["user_uid", "status"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final protected function getOrdersByBillingEntity(BillingEntity $entity): array
|
||||||
|
{
|
||||||
|
//청구서 연결 주문정보 가져오기
|
||||||
|
$orderBillings = $this->getOrderBillingModel()->getEntitys(['billing_uid' => $entity->getPrimaryKey()]);
|
||||||
|
$orders = array();
|
||||||
|
foreach ($orderBillings as $orderBilling) {
|
||||||
|
array_push(
|
||||||
|
$orders,
|
||||||
|
$this->getOrderModel()->getEntity(
|
||||||
|
[$this->getOrderModel()->getPrimaryKey() => $orderBilling->order_uid]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $orders;
|
||||||
|
}
|
||||||
|
|
||||||
|
//View 관련
|
||||||
|
protected function view_process($entity)
|
||||||
|
{
|
||||||
|
$entity = parent::view_process($entity);
|
||||||
|
//청구서 연결 주문정보 가져오기
|
||||||
|
$this->_viewDatas['orders'] = $this->getOrdersByBillingEntity($entity);
|
||||||
|
if (!count($this->_viewDatas['orders'])) {
|
||||||
|
throw new \Exception("해당하는 주문정보가 없습니다.");
|
||||||
|
}
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,17 +148,17 @@ function getFieldIndex_Row_BillingHelper($field, $entity, array $viewDatas): str
|
|||||||
break;
|
break;
|
||||||
case 'type':
|
case 'type':
|
||||||
if ($entity->status != DEFAULTS['STATUS']) {
|
if ($entity->status != DEFAULTS['STATUS']) {
|
||||||
$card = anchor(
|
// $card = anchor(
|
||||||
URLS['card'] . '/' . $entity->getPrimaryKey(),
|
// URLS['card'] . '/' . $entity->getPrimaryKey(),
|
||||||
ICONS['CARD'] . lang("{$viewDatas['className']}.TYPE.CARD"),
|
// ICONS['CARD'] . lang("{$viewDatas['className']}.TYPE.CARD"),
|
||||||
["class" => "btn btn-sm btn-primary btn-circle", "style" => "color:white", "target" => "_self"]
|
// ["class" => "btn btn-sm btn-primary btn-circle", "style" => "color:white", "target" => "_self"]
|
||||||
);
|
// );
|
||||||
$deposit = anchor(
|
$deposit = anchor(
|
||||||
URLS['deposit'] . '/' . $entity->getPrimaryKey(),
|
URLS['deposit'] . '/' . $entity->getPrimaryKey(),
|
||||||
ICONS['DEPOSIT'] . lang("{$viewDatas['className']}.TYPE.DEPOSIT"),
|
ICONS['DEPOSIT'] . lang("{$viewDatas['className']}.TYPE.DEPOSIT"),
|
||||||
["class" => "btn btn-sm btn-info btn-circle", "style" => "color:white", "target" => "_self"]
|
["class" => "btn btn-sm btn-info btn-circle", "style" => "color:white", "target" => "_self"]
|
||||||
);
|
);
|
||||||
return sprintf("%s<BR>%s", $card, $deposit);
|
return $deposit;
|
||||||
} else {
|
} else {
|
||||||
//결제처리가된경우
|
//결제처리가된경우
|
||||||
$value = strtoupper($value);
|
$value = strtoupper($value);
|
||||||
|
|||||||
@ -192,7 +192,7 @@ abstract class BaseModel extends Model
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "user_uid": //입력데이터로 있을시 관리툴에서 (사용자,등)추가, 없을시는 입력의 경우에만 자동(장바구니,등)으로 추가
|
case "user_uid": //입력데이터로 있을시 관리툴에서 (사용자,등)추가, 없을시는 입력의 경우에만 자동(장바구니,등)으로 추가
|
||||||
if (array_key_exists($field, $formDatas)) {
|
if (array_key_exists($field, $formDatas) && !is_null($formDatas[$field])) {
|
||||||
//관리툴 USERSNS에서 사용자 연동 시 추가기능등에 사용
|
//관리툴 USERSNS에서 사용자 연동 시 추가기능등에 사용
|
||||||
$entity->$field = $formDatas[$field];
|
$entity->$field = $formDatas[$field];
|
||||||
} elseif ($action == 'create' && $this->_session->get(SESSION_NAMES["ISLOGIN"])) {
|
} elseif ($action == 'create' && $this->_session->get(SESSION_NAMES["ISLOGIN"])) {
|
||||||
@ -202,17 +202,17 @@ abstract class BaseModel extends Model
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "passwd":
|
case "passwd":
|
||||||
if (array_key_exists($field, $formDatas)) {
|
if (array_key_exists($field, $formDatas) && $formDatas[$field]) {
|
||||||
$entity->$field = password_hash($formDatas[$field], PASSWORD_DEFAULT);
|
$entity->$field = password_hash($formDatas[$field], PASSWORD_DEFAULT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "content":
|
case "content":
|
||||||
if (array_key_exists($field, $formDatas)) {
|
if (array_key_exists($field, $formDatas) && $formDatas[$field]) {
|
||||||
$entity->$field = htmlentities($formDatas[$field]);
|
$entity->$field = htmlentities($formDatas[$field]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (array_key_exists($field, $formDatas)) {
|
if (array_key_exists($field, $formDatas) && $formDatas[$field]) {
|
||||||
$entity->$field = $formDatas[$field];
|
$entity->$field = $formDatas[$field];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -79,13 +79,13 @@ class CategoryModel extends BaseHierarchyModel
|
|||||||
case "isreply":
|
case "isreply":
|
||||||
case "isupload":
|
case "isupload":
|
||||||
case "isdownload":
|
case "isdownload":
|
||||||
if (array_key_exists($field, $formDatas)) {
|
if (array_key_exists($field, $formDatas) && $formDatas[$field]) {
|
||||||
$entity->$field = is_array($formDatas[$field]) ? implode(DEFAULTS['DELIMITER_ROLE'], $formDatas[$field]) : $formDatas[$field];
|
$entity->$field = is_array($formDatas[$field]) ? implode(DEFAULTS['DELIMITER_ROLE'], $formDatas[$field]) : $formDatas[$field];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "head":
|
case "head":
|
||||||
case "tail":
|
case "tail":
|
||||||
if (array_key_exists($field, $formDatas)) {
|
if (array_key_exists($field, $formDatas) && $formDatas[$field]) {
|
||||||
$entity->$field = htmlentities($formDatas[$field]);
|
$entity->$field = htmlentities($formDatas[$field]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -64,13 +64,13 @@ class UserModel extends BaseModel
|
|||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case "role":
|
case "role":
|
||||||
if (array_key_exists($field, $formDatas)) {
|
if (array_key_exists($field, $formDatas) && $formDatas[$field]) {
|
||||||
$entity->$field = is_array($formDatas[$field]) ? implode(DEFAULTS['DELIMITER_ROLE'], $formDatas[$field]) : $formDatas[$field];
|
$entity->$field = is_array($formDatas[$field]) ? implode(DEFAULTS['DELIMITER_ROLE'], $formDatas[$field]) : $formDatas[$field];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "head":
|
case "head":
|
||||||
case "tail":
|
case "tail":
|
||||||
if (array_key_exists($field, $formDatas)) {
|
if (array_key_exists($field, $formDatas) && $formDatas[$field]) {
|
||||||
$entity->$field = htmlentities($formDatas[$field]);
|
$entity->$field = htmlentities($formDatas[$field]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
40
app/Views/admin/billing/view.php
Normal file
40
app/Views/admin/billing/view.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?= $this->extend('layouts/admin') ?>
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
|
||||||
|
<div id="content">
|
||||||
|
<table class="form table table-bordered table-hover table-striped">
|
||||||
|
<tr>
|
||||||
|
<td class="label">주문정보</td>
|
||||||
|
<td class="column">
|
||||||
|
<ul class="orders">
|
||||||
|
<?php foreach ($viewDatas['orders'] as $order) : ?>
|
||||||
|
<li class="text-start"><?= $order->getTitle() ?> * <?= $order->quantity ?>개 = <?= number_format($order->price) ?>원</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label">결제금액</td>
|
||||||
|
<td class="column"><?= number_format($viewDatas['entity']->price) ?>원</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label">은행정보</td>
|
||||||
|
<td class="column">
|
||||||
|
<ul class="banks">
|
||||||
|
<?php foreach (MALLS['banks'] as $bank) : ?>
|
||||||
|
<li><?= $bank['name'] ?> , <?= $bank['account'] ?> , <?= $bank['holder'] ?></li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php foreach ($viewDatas['fields'] as $field) : ?>
|
||||||
|
<tr>
|
||||||
|
<td class="label"><?= getFieldLabel_BillingHelper($field, $viewDatas) ?></td>
|
||||||
|
<td class="column">
|
||||||
|
<?= getFieldView_BillingHelper($field, $viewDatas['entity'], $viewDatas) ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?= $this->endSection() ?>
|
||||||
Loading…
Reference in New Issue
Block a user