<?php

namespace Modules\Admin\Config\SupplierInvoices\ActiveServices;

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()
	{

		// form
		$form = \Engine\Form\General::create();

		$label = new \Engine\Form\Input\Label();
		$label->setDetails($this->lang['index']['description']);
		$form->addElement($label);

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

		// checkboxes of enabled/disabled services
		foreach (\App\Config\Services_Basic::getInstance()->getListLinear() as $serviceCode => $serviceDetails) {
			$fld_checkbox = new \Engine\Form\Input\Checkbox($serviceDetails['name'],'activeServices['.$serviceCode.']',$this->values['activeServices'][$serviceCode]);
			$fieldset->addElement($fld_checkbox);

		}

		// submit flag
		$fieldset->addElement(new \Engine\Form\Input\Hidden(null, 'save', 1));
		// submit button
		$form->addButton(new \Engine\Form\Button\Submit('save'));

		return $form;

	}
}