<?php

namespace App\Cells\Customer;

class ServiceCell extends CustomerCell
{
  public function __construct()
  {
    parent::__construct(service('customer_serviceservice'));
  }

  public function detail(array $params): string
  {
    $this->getService()->getActionForm()->form_init_process(__FUNCTION__);
    //서비스별 미납 Count
    $unPaids = service('paymentservice')->getUnPaids('serviceinfo_uid', ['clientinfo_uid' => $params['clientinfo_uid']]);
    //서비스별 서버리스트
    $entities = $this->getService()->getEntities(['clientinfo_uid' => $params['clientinfo_uid']]);
    $template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__;
    return view('cells/service/' . $template, [
      'serviceCellDatas' => [
        'formFilters' => $this->getService()->getActionForm()->getFormFilters(),
        'formOptions' => $this->getService()->getActionForm()->getFormOptions(),
        'helper' => $this->getService()->getHelper(),
        'unPaids' => $unPaids,
        'entities' => $entities,
      ]
    ]);
  }
}
