<?php
namespace Modules\Admin\Config\CorporateGroupsManagement;

class View_Utils_AddGroup extends \App\Mvc\View_Utils_FormAbstract
{
	/**
	 *************************************************************************************
	 *************************************************************************************
	 *************************************************************************************
	 *
	 * Please pay attention that any changes in the corporate groups management files
	 * might affect the supplier groups management files.
	 *
	 **************************************************************************************
	 **************************************************************************************
	 **************************************************************************************
	 */

	/**
	 * (non-PHPdoc)
	 * @see \App\Mvc\View_Utils_FormAbstract::getForm()
	 */
	public function getForm()
	{
		// NEW FORM
		$form = \Engine\Form\General::create();

		// NEW CONTAINER
		$fieldset = \Engine\Form\Container\Fieldset::create($this->lang['index']['formFieldset']['editGroup']);
		$form->addContainer($fieldset);

		// GROUP NAME
		$groupName = new \Engine\Form\Input\Text($this->lang['index']['formFields']['groupName'], 'groupName', $this->values['groupName']);
		$groupName->setMandatory();
		$fieldset->addElement($groupName);

		// GROUP ELEMENTS (ITEMS)
		if ($this->values['action'] !== 'update') {
			$groupElements = new \Engine\Form\Input\Cloned_Text($this->lang['index']['formFields']['items'], 'groupElements', $this->values['groupElements']);
			$groupElements->setMandatory();
			$fieldset->addElement($groupElements);
		}

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

		return $form;
	}
}