<?php
namespace Modules\Admin\Offices;

class View_Utils_FormFilters extends \App\Mvc\View_Utils_FormAbstract
{

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

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

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

		// country code and city id
		$fldLocation =  new \App\Form\Input\Autocomplete_CountryCity($this->lang['index']['filters']['location'], 'filters[location]', $fieldsValues['location']);
		$form->addElement($fldLocation);

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

	}
}
