<?php

namespace Modules\Admin\Config\ClientInvoices\FormsOfPayment;

class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract
{

	/**
	 * @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
		$codeInput = new \Engine\Form\Input\Text($this->lang['form']['fields']['code']['label'], 'id', $this->values['id']);
		$codeInput->setMandatory();
		$codeInput->setValidatorParam('maxLength', 20);

		if ($this->controller->getAction()=='update') {
			$codeInput->setDisabled();
		}

		$fieldset->addElement($codeInput);

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

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

		return $form;

	}
}