<?php

namespace Modules\Admin\Config\Services\AgencyCostCenters;

class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract
{

	/**
	 * Creates the form for department insert/update.
	 * @see \App\Mvc\View_Utils_FormAbstract::getForm()
	 */
	public function getForm()
	{
		// NEW FORM ///////////////////////////////////////////////////////////////////////////////////////
		$form = \Engine\Form\General::create();
		$form->setStyle('width', 250);

		// NEW CONTAINER ----------------------------------------------------------------------------------
		$fieldset=\Engine\Form\Container\Fieldset::create();
		$form->addContainer($fieldset);


		// code
		$fld=new \Engine\Form\Input\Text($this->lang['fields_code'], 'id', $this->values['id']);
		$fld->setMandatory();
		if ($this->controller->getAction()=='update') {
			$fld->setDisabled(true);
		}
		$fld->setValidatorParam('maxLength', 20);
		$fieldset->addElement($fld);

		// name
		$fld=new \Engine\Form\Input\Text($this->lang['fields_name'], 'name', $this->values['name']);
		$fld->setMandatory();
		$fld->setValidatorParam('maxLength', 50);
		$fieldset->addElement($fld);

		// submit button
		$form->addElement(new \Engine\Form\Input\Hidden('', $this->submitButtonName, 1));

		return $form;
	}
}