<?php

// TODO: integrare cu plugin ce adauga validare de CUI (RO)

namespace Modules\Orders\Cancel;

class View_Utils_FormOrder extends \App\Mvc\View_Utils_FormAbstract
{

	/**
	 * Creates the form for supplier insert/update.
	 * @see \App\Mvc\View_Utils_FormAbstract::getForm()
	 */
	public function getForm()
	{

		// FORM FIELDS FOR ADDING AND EDITING SUPPLIERS ///////////////////////////////////////////
		$form = \Engine\Form\General::create();
		$form->setStyle('width', 250)->setStyle('labelWidth', 40);

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

		// info text
		$fieldsetInfo=\Engine\Form\Container\Simple::create();
		$fieldsetInfo->setHtml($this->lang['cancelAllServicesOnOrder']);
		$fieldset->addContainer($fieldsetInfo);

		// service cancel reason
		$fld_servCancelReason = new \App\Form\Input\Select_ServiceCancelReason($this->lang['formFields']['serviceCancelReason'], 'serviceCancelReason', $this->values['serviceCancelReason']);
		$fld_servCancelReason->setMandatory(true);
		$fld_servCancelReason->showDefaultOption();
		$fieldset->addElement($fld_servCancelReason);

		// service cancel details
		$fld_servCancelDet = new \Engine\Form\Input\Textarea($this->lang['formFields']['serviceCancelDetails'], 'serviceCancelDetails', $this->values['serviceCancelDetails']);
		$fld_servCancelDet->setMandatory(false);
		$fieldset->addElement($fld_servCancelDet);

		// order id
		$form->addElement(new \Engine\Form\Input\Hidden('', 'idOrder', $this->values['idOrder']));

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

		return $form;

	}

}