diff --git a/app/Cells/Customer/ServiceCell.php b/app/Cells/Customer/ServiceCell.php
index b19076c..fb4b830 100644
--- a/app/Cells/Customer/ServiceCell.php
+++ b/app/Cells/Customer/ServiceCell.php
@@ -40,4 +40,18 @@ class ServiceCell extends CustomerCell
]
]);
}
+
+ //서비스 방식에 따른 서비스별 Count
+ final public function totalCountDashboard(array $params): string
+ {
+ $totalCounts = $this->getService()->getTotalServiceCount(array_key_exists('where', $params) ? $params['where'] : []);
+ $template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__;
+ return view('cells/service/' . $template, [
+ 'serviceCellDatas' => [
+ 'control' => $this->getService()->getControlDatas(),
+ 'service' => $this->getService(),
+ 'totalCounts' => $totalCounts,
+ ]
+ ]);
+ }
}
diff --git a/app/Controllers/Admin/Customer/ClientController.php b/app/Controllers/Admin/Customer/ClientController.php
index 9daff83..980bdc8 100644
--- a/app/Controllers/Admin/Customer/ClientController.php
+++ b/app/Controllers/Admin/Customer/ClientController.php
@@ -100,7 +100,7 @@ class ClientController extends CustomerController
if (!$entity instanceof ClientEntity) {
throw new \Exception("{$uid}에 해당하는 고객정보를 찾을수 없습니다.");
}
- $this->totalCounts = $this->getService()->getServiceService()->getTotalCountsBySite(['clientinfo_uid' => $entity->getPK()]);
+ $this->totalCounts = $this->getService()->getServiceService()->getTotalServiceCount(['clientinfo_uid' => $entity->getPK()]);
$this->totalAmounts = $this->getService()->getServiceService()->getTotalAmounts([
'clientinfo_uid' => $entity->getPK(),
'status' => STATUS['AVAILABLE']
diff --git a/app/Controllers/Admin/Home.php b/app/Controllers/Admin/Home.php
index 8d7e54e..0fa1c65 100644
--- a/app/Controllers/Admin/Home.php
+++ b/app/Controllers/Admin/Home.php
@@ -69,7 +69,6 @@ class Home extends AdminController
$this->getService()->setFormRules();
$this->getService()->setFormOptions();
//Total 서버 현황
- $this->totalCounts = $this->getService()->getTotalCountsBySite();
//interval을 기준으로 최근 신규 서비스정보 가져오기
$this->interval = intval($this->request->getVar('interval') ?? SERVICE['NEW_INTERVAL']);
$this->newServiceEntities = $this->getService()->getEntitiesByNewService($this->interval);
diff --git a/app/Entities/Customer/ClientEntity.php b/app/Entities/Customer/ClientEntity.php
index 0078905..eb1ca72 100644
--- a/app/Entities/Customer/ClientEntity.php
+++ b/app/Entities/Customer/ClientEntity.php
@@ -18,6 +18,10 @@ class ClientEntity extends CustomerEntity
{
return $this->attributes['name'] ?? "";
}
+ public function getSite(): string
+ {
+ return $this->attributes['site'] ?? "";
+ }
public function getRole(): string
{
return $this->attributes['role'] ?? "";
diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php
index 0bf150e..f96d17a 100644
--- a/app/Services/Customer/ServiceService.php
+++ b/app/Services/Customer/ServiceService.php
@@ -137,14 +137,12 @@ class ServiceService extends CustomerService
}
return $this->_serverPartService;
}
- //create용 서비스코드 마지막번호 가져오기
//interval을 기준으로 최근 신규 서비스정보 가져오기
final public function getEntitiesByNewService(int $interval, string $status = ServiceEntity::DEFAULT_STATUS): array
{
return $this->getEntities(sprintf("start_at >= NOW()-INTERVAL {$interval} DAY AND status = '%s'", $status));
}
- //서비스 방식에 따른 서비스별 Count
- final public function getTotalCountsBySite(array $where = []): array
+ final public function getTotalServiceCount(array $where = []): array
{
$rows = $this->getModel()->groupBy(['site', 'type'])->select("site,type,
COUNT(CASE WHEN location = 'chiba' THEN 1 END) AS chiba,
@@ -152,7 +150,7 @@ class ServiceService extends CustomerService
COUNT(CASE WHEN location IN ('chiba', 'tokyo') THEN 1 END) AS summary")
->where($where)
->get()->getResult();
- // dd($rows);
+
$totalCounts = [
'normal' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0],
'defence' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0],
@@ -191,6 +189,7 @@ class ServiceService extends CustomerService
// dd($totalCounts);
return $totalCounts;
}
+
//서비스별 총 금액
final public function getTotalAmounts($where = []): array
{
diff --git a/app/Views/admin/client/detail.php b/app/Views/admin/client/detail.php
index 6c852c6..184e665 100644
--- a/app/Views/admin/client/detail.php
+++ b/app/Views/admin/client/detail.php
@@ -50,15 +50,15 @@
- | = $viewDatas['totalCounts']['tokyo_total'] ?> |
- = $viewDatas['totalCounts']['chiba_total'] ?> |
- = $viewDatas['totalCounts']['vpn']['total'] ?> |
- = $viewDatas['totalCounts']['normal']['total'] ?> |
- = $viewDatas['totalCounts']['defence']['total'] ?> |
- = $viewDatas['totalCounts']['dedicated']['total'] ?> |
- = $viewDatas['totalCounts']['event']['total'] ?> |
- = $viewDatas['totalCounts']['test']['total'] ?> |
- = $viewDatas['totalCounts']['alternative']['total'] ?> |
+ = $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['tokyo_summary'] ?> |
+ = $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['chiba_summary'] ?> |
+ = $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['vpn']['summary'] ?> |
+ = $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['normal']['summary'] ?> |
+ = $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['defence']['summary'] ?> |
+ = $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['dedicated']['summary'] ?> |
+ = $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['event']['summary'] ?> |
+ = $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['test']['summary'] ?> |
+ = $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['alternative']['summary'] ?> |
= $viewDatas['entity']->getCouponBalance() ?>% |
= $viewDatas['entity']->getSaleRate() ?>% |
= $viewDatas['entity']->getAccountBalance() ?> |
diff --git a/app/Views/admin/welcome/index.php b/app/Views/admin/welcome/index.php
index b137813..68b1b85 100644
--- a/app/Views/admin/welcome/index.php
+++ b/app/Views/admin/welcome/index.php
@@ -15,7 +15,7 @@
= $this->include("{$viewDatas['layout']}/welcome/banner"); ?>
- = $this->include("{$viewDatas['layout']}/welcome/total_service"); ?>
+ = view_cell("\App\Cells\Customer\ServiceCell::totalCountDashboard") ?>>
= $this->include("{$viewDatas['layout']}/welcome/new_service"); ?>
diff --git a/app/Views/admin/welcome/new_service.php b/app/Views/admin/welcome/new_service.php
index 3dff60e..2ab393b 100644
--- a/app/Views/admin/welcome/new_service.php
+++ b/app/Views/admin/welcome/new_service.php
@@ -11,7 +11,7 @@
- | 서비스코드 |
+ 사이트 |
업체명 |
구분 |
@@ -25,15 +25,15 @@
|
- | = $entity->getCode() ?> |
- = $viewDatas['service']->getHelper()->getFieldView('clientinfo_uid', $entity->getClientInfoUID(), $viewDatas) ?> |
- = $viewDatas['service']->getHelper()->getFieldView('type', $entity->getType(), $viewDatas) ?> |
+ = SITES[$entity->getSite()] ?> |
+ = $viewDatas['service']->getHelper()->getFieldView('clientinfo_uid', $entity->getClientInfoUID(), $viewDatas) ?> |
+ = $viewDatas['service']->getHelper()->getFieldView('type', $entity->getType(), $viewDatas) ?> |
= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
'serverinfo_uid' => $entity->getServerEntity()->getPK(),
'types' => SERVERPART['SERVICE_PARTTYPES'],
'template' => 'partlist_service'
]) ?> |
- = $viewDatas['service']->getHelper()->getFieldView('user_uid', $entity->getUserUID(), $viewDatas) ?> |
+ = $viewDatas['service']->getHelper()->getFieldView('user_uid', $entity->getUserUID(), $viewDatas) ?> |
diff --git a/app/Views/cells/service/totalCountDashboard.php b/app/Views/cells/service/totalCountDashboard.php
new file mode 100644
index 0000000..ced3be9
--- /dev/null
+++ b/app/Views/cells/service/totalCountDashboard.php
@@ -0,0 +1,75 @@
+
+
+
+
+ | 고객명 |
+ 일반 |
+ 방어 |
+ 전용 |
+ 대체 |
+ 테스트 |
+ 합계 |
+
+
+ | 도쿄 |
+ 치바 |
+ 도쿄 |
+ 치바 |
+ 도쿄 |
+ 치바 |
+ 도쿄 |
+ 치바 |
+ 도쿄 |
+ 치바 |
+ 합계 |
+ 도쿄 |
+ 치바 |
+ 합계 |
+
+ $label): ?>
+
+ | = $label ?> |
+ = $serviceCellDatas['totalCounts'][$key]['normal']['tokyo'] ?> |
+ = $serviceCellDatas['totalCounts'][$key]['normal']['chiba'] ?> |
+ = $serviceCellDatas['totalCounts'][$key]['defence']['tokyo'] ?> |
+ = $serviceCellDatas['totalCounts'][$key]['defence']['chiba'] ?> |
+ = $serviceCellDatas['totalCounts'][$key]['dedicated']['tokyo'] ?> |
+ = $serviceCellDatas['totalCounts'][$key]['dedicated']['chiba'] ?> |
+ = $serviceCellDatas['totalCounts'][$key]['alternative']['tokyo'] ?> |
+ = $serviceCellDatas['totalCounts'][$key]['alternative']['chiba'] ?> |
+ = $serviceCellDatas['totalCounts'][$key]['test']['tokyo'] ?> |
+ = $serviceCellDatas['totalCounts'][$key]['test']['chiba'] ?> |
+ = $serviceCellDatas['totalCounts'][$key]['test']['summary'] ?> |
+ = $serviceCellDatas['totalCounts'][$key]['tokyo_summary'] ?> |
+ = $serviceCellDatas['totalCounts'][$key]['chiba_summary'] ?> |
+ = $serviceCellDatas['totalCounts'][$key]['all_summary'] ?> |
+
+
+
+ | 총합계 |
+ 0 |
+ 0 |
+ 0 |
+ 0 |
+ 0 |
+ 0 |
+ 0 |
+ 0 |
+ 0 |
+ 0 |
+ 0 |
+ 0 |
+ 0 |
+ 0 |
+
+
+
+
\ No newline at end of file