<?php
namespace Modules\Partners\Customers\CreditCards;

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(2);

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

		// 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;
	}

}