<?php

namespace Modules\Partners\Corporates\Contacts;


class View_Utils_FormFilters extends \App\Mvc\View_Utils_FormAbstract
{

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

		// corporate
		$corporate = new \App\Form\Input\Autocomplete_Corporate($this->lang['index']['filters']['corporate'], "filters[corporate]", $fieldsValues['corporate']);
		$form->addElement($corporate);

		// contactperson
		$contactPerson = new \App\Form\Input\Autocomplete_ContactPersonCorporate($this->lang['index']['filters']['contactPerson'], "filters[contactPerson]", $fieldsValues['contactPerson']);
		$form->addElement($contactPerson);

		// contactDate
		$contactDate = new \Engine\Form\Input\DateInterval($this->lang['index']['filters']['contactDate'], "filters[contactDate]", $fieldsValues['contactDate']);
		$form->addElement($contactDate);

		// idUser
		$idUser = new \App\Form\Input\Autocomplete_User($this->lang['index']['filters']['idUser'], "filters[idUser]", $fieldsValues['idUser']);
		$form->addElement($idUser);

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

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

	}

}


