shoppingmallv2 init...

This commit is contained in:
최준흠git config git config --helpgit config --global user.name 최준흠 2023-08-05 21:30:46 +09:00
parent 7e1bb74f08
commit c717aab6e9
8 changed files with 54 additions and 8 deletions

View File

@ -575,7 +575,7 @@ abstract class BaseController extends Controller
//setting return_url to session flashdata
helper(['form']);
$this->_session->setFlashdata(SESSION_NAMES['RETURN_URL'], current_url() . '?' . $this->request->getUri()->getQuery() ?: "");
return view($this->_viewPath . '/index', ['viewDatas' => $this->_viewDatas]);
return view($this->_viewPath . '/index' . $this->request->getVar('v') ?: '', ['viewDatas' => $this->_viewDatas]);
} catch (\Exception $e) {
return alert_CommonHelper($e->getMessage(), "back");
// return redirect()->back()->with('return_message', $e->getMessage());

View File

@ -17,11 +17,11 @@ class ProductController extends FrontController
}
public function getFields(string $action = ""): array
{
$fields = ["category_uid", 'name', "photo", "cost", "price", "sale", "stock", "view_cnt", "status", "content",];
$fields = ['name', "photo", "cost", "price", "sale", "stock", "view_cnt", "status", "content",];
switch ($action) {
case "index":
case "excel":
return ["category_uid", "user_uid", 'name', "photo", "cost", "price", "sale", "stock", "view_cnt", "status", "created_at"];
return ["user_uid", 'name', "photo", "cost", "price", "sale", "stock", "view_cnt", "status", "created_at"];
break;
case "view":
return [...$fields, "created_at"];
@ -33,7 +33,7 @@ class ProductController extends FrontController
}
public function getFieldFilters(): array
{
return ["category_uid", "user_uid", "status"];
return ["user_uid", "status"];
}
public function getFieldBatchFilters(): array
{

View File

@ -82,6 +82,10 @@ function getFieldView_ProductHelper($field, $entity, array $viewDatas)
case 'photo':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]);
break;
case 'cost':
case 'price':
case 'sale':
case 'stock':
case 'view_cnt':
return number_format(!$value ? 0 : $value);
break;

View File

@ -29,7 +29,7 @@
<?php endif ?>
</td>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<td nowrap><?= getFieldIndex_Row_BoardHelper_Admin($field, $entity, $viewDatas) ?></td>
<td nowrap><?= getFieldIndex_Row_BoardHelper($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
<td>
<!-- 사용자가 자신의 작성한것인지 확인되면 delete 가능-->

View File

@ -23,7 +23,7 @@
<?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<td nowrap><?= getFieldIndex_Row_OrderHelper_Admin($field, $entity, $viewDatas) ?></td>
<td nowrap><?= getFieldIndex_Row_OrderHelper($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
<td>
<?= $entity->getStatus() == DEFAULTS['STATUS'] ? anchor('ecommerce/cancelCart/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) : "" ?>

View File

@ -10,6 +10,10 @@
</ul>
<?= form_close() ?>
</div>
<div style="text-align:right;">
<?= anchor(current_url() . '?category=' . $viewDatas['category']->getPrimaryKey(), 'List', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
<?= anchor(current_url() . '?category=' . $viewDatas['category']->getPrimaryKey() . '&v=_b', 'Block', ["class" => "btn btn-sm btn-info btn-circle", "target" => "_self"]) ?>
</div>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="table table-bordered table-hover table-striped">
<tr>
@ -23,7 +27,7 @@
<?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<td nowrap><?= getFieldIndex_Row_ProductHelper_Admin($field, $entity, $viewDatas) ?></td>
<td nowrap><?= getFieldIndex_Row_ProductHelper($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
</tr>
<?php $cnt++ ?>

View File

@ -0,0 +1,38 @@
<?= $this->extend('layouts/front') ?>
<?= $this->section('content') ?>
<div class="content">
<div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
<div class="top">
<?= form_open(current_url(), array("method" => "get")) ?>
<ul class="nav">
조건검색:<?php foreach ($viewDatas['fieldFilters'] as $field) : ?><?= getFieldFilter_ProductHelper($field, $viewDatas[$field], $viewDatas) ?><?php endforeach ?>
<?= $this->include('templates/front/index_head') ?>
</ul>
<?= form_close() ?>
</div>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<div>
<div style="text-align:right;">
<?= anchor(current_url() . '?category=' . $viewDatas['category']->getPrimaryKey(), 'List', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
<?= anchor(current_url() . '?category=' . $viewDatas['category']->getPrimaryKey() . '&v=_b', 'Block', ["class" => "btn btn-sm btn-info btn-circle", "target" => "_self"]) ?>
</div>
<?php $cnt = 0 ?>
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
<table class="table table-bordered table-hover table-striped">
<tr>
<td rowspan="3"><?= getFieldIndex_Row_ProductHelper('photo', $entity, $viewDatas) ?></td>
<td><?= getFieldIndex_Row_ProductHelper('name', $entity, $viewDatas) ?></td>
<td><?= getFieldIndex_Row_ProductHelper('price', $entity, $viewDatas) ?>-<?= getFieldIndex_Row_ProductHelper('sale', $entity, $viewDatas) ?></td>
<td><?= getFieldIndex_Row_ProductHelper('user_uid', $entity, $viewDatas) ?></td>
</tr>
</table>
<?php $cnt++ ?>
<?php endforeach ?>
</div>
<div class="bottom">
<?= $viewDatas['pagination'] ?>
</div>
<?= form_close() ?>
<div><?= html_entity_decode($viewDatas['category']->getTail()) ?></div>
</div>
<?= $this->endSection() ?>

View File

@ -25,7 +25,7 @@
<?php endif ?>
</td>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<td nowrap><?= getFieldIndex_Row_UserHelper_Admin($field, $entity, $viewDatas) ?></td>
<td nowrap><?= getFieldIndex_Row_UserHelper($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
<td>
<!-- 사용자가 자신의 작성한것인지 확인되면 delete 가능-->