<?php
namespace Modules\Admin\AgencyCreditCards;

class View_Utils_FormFilters extends \App\Mvc\View_Utils_FormAbstract
{
	/**
	 * {@inheritDoc}
	 * @see \App\Mvc\View_Utils_FormAbstract::getForm()
	 */
	public function getForm()
	{
		$fieldsValues = $this->values['listingParams']->getFilters();

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

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

		// comments filter
		$comments = \Engine\Form\Input\Text::create($this->lang['index']['filters']['comments'], 'filters[comments]', $fieldsValues['comments']);
		$form->addElement($comments);

		// company filter
		$company = \App\Form\Input\Select_CreditCardVendors::create($this->lang['index']['filters']['company'], 'filters[company]', $fieldsValues['company']);
		$company->showDefaultOption();
		$form->addElement($company);

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


}