<?php

namespace Modules\Partners\Customers\FrequentBuyerCards;


class View_Utils_FormFilters extends \App\Mvc\View_Utils_FormAbstract
{

	/**
	 * Creates the form for customers 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(3);

		// card number filter
		$fld = new \Engine\Form\Input\Text($this->lang['index']['filters']['cardNumber'], 'filters[cardNumber]', $fieldsValues['cardNumber']);
		$fld->setTooltip($this->lang['index']['filters']['tooltips']['cardNumber']);
		$form->addElement($fld);

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

		// supplier filter
		$fld = new \App\Form\Input\Autocomplete_Supplier($this->lang['index']['filters']['idSupplier'], 'filters[idSupplier]', $fieldsValues['idSupplier']);
		$form->addElement($fld);

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

	}

}


