<?php

namespace Modules\Partners\Trusts;


class View_Utils_FormFilters extends \App\Mvc\View_Utils_FormAbstract
{

	/**
	 * Creates the form for trusts filter
	 * @see \App\Mvc\View_Utils_FormAbstract::getForm()
	 */
	public function getForm()
	{
		$fieldsValues = $this->values['listingParams']->getFilters();

		// create form
		$form = \Engine\Form\Filters::create();
		$form->setColumns(2);

		// name filter
		$fld = new \Engine\Form\Input\Text($this->lang['index']['filters']['text'], 'filters[text]', $fieldsValues['text']);
		$form->addElement($fld);

		// type filter
		$fld = new \Engine\Form\Input\Select($this->lang['index']['filters']['type'], 'filters[type]', $fieldsValues['type']);
		$list = [];
		$list[''] = $this->lang['index']['filters']['anyType'];
		$list['corporate'] = $this->lang['index']['filters']['typeCorp'];
		$list['supplier']  = $this->lang['index']['filters']['typeSupp'];
		$fld->setPossibleValues($list);
		$form->addElement($fld);

		$form->setJsCallback('MVC.listing.installedHandlers["listing"].reloadAndResetListing');
		$form->loadMissingDefaultValues($this->values['listingParams']->getDefaultFilters());
		return $form;

	}

}

