<?php

namespace App\Cells;

use App\Services\PaymentService;

class PaymentCell extends CommonCell
{

  public function __construct()
  {
    parent::__construct(service('paymentservice'));
  }

  public function detail(array $params): string
  {
    $this->getService()->getActionForm()->form_init_process(__FUNCTION__);
    $entities = $this->getService()->getEntities(['clientinfo_uid' => $params['clientinfo_uid'], 'billing' => PAYMENT['BILLING']['ONETIME'], 'status' => STATUS['UNPAID']]);
    $template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__;
    return view('cells/payment/' . $template, [
      'paymentCellDatas' => [
        'formFilters' => $this->getService()->getActionForm()->getFormFilters(),
        'formOptions' => $this->getService()->getActionForm()->getFormOptions(),
        'helper' => $this->getService()->getHelper(),
        'entities' => $entities,
      ]
    ]);
  }
}
