<?php

namespace Modules\Admin\ExportData\ManualReExport\Invoice;

class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract
{

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

		$fieldset = \Engine\Form\Container\Fieldset::create( sprintf('Export XMLs for invoice(s): %s', implode(', ', $this->values['ids'])) );
		$form->addContainer($fieldset);

		// doc types
		$docTypeFld = new \App\Form\Input\Select_DocumentType('Doc type', 'invoiceDocType', $this->values['invoiceDocType']);
		$docTypeFld->setPivot('invoice');
		$docTypeFld->showDefaultOption();
		$docTypeFld->setMandatory(true);
		$fieldset->addElement($docTypeFld);

		// operation
		$operationFld = new \Engine\Form\Input\Select('Operation', 'operation', $this->values['operation']);
		$operationFld->setPossibleValues(['issue'=>'issue', 'void'=>'void', 'issue+void'=>'issue + void']);
		$operationFld->showDefaultOption();
		$operationFld->setMandatory(true);
		$operationFld->setTooltip('If you select `void` or  issue+void` the corresponding void XML is generated only if the invoice is actually voided.');
		$fieldset->addElement($operationFld);

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

		return $form;
	}


}