<?php

namespace App\Forms\Customer\Wallet;

class PointForm extends WalletForm
{
  public function __construct()
  {
    parent::__construct();
  }
  public function form_init_process(string $action, array &$formDatas = []): void
  {
    parent::form_init_process($action, $formDatas);
    $fields = [
      "clientinfo_uid",
      "title",
      "amount",
      "status",
      "content",
    ];
    $filters = [
      "clientinfo_uid",
      "status",
    ];
    $indexFilter = $filters;
    $batchjobFilters = ['status'];
    $actionButtons = ['view' => ICONS['SEARCH']];
    $batchjobButtons = [];
    switch ($action) {
      case 'view':
        $fields = [...$fields, 'created_at'];
        break;
      case 'index':
      case 'download':
        $fields = [
          "clientinfo_uid",
          "title",
          "amount",
          "status",
          'created_at'
        ];
        break;
    }
    $this->setFormFields($fields);
    $this->setFormRules($fields);
    $this->setFormFilters($filters);
    $this->setFormOptions($filters, $formDatas);
    $this->setIndexFilters($indexFilter);
    $this->setBatchjobFilters($batchjobFilters);
    $this->setActionButtons($actionButtons);
    $this->setBatchjobButtons($batchjobButtons);
  }
}
