<?php

namespace Modules\Partners\Customers\UpdateBulk;

class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract
{
	public function getForm()
	{
		// load the configurations for this form
		$entCfg = \Entity\Customer::loadCFG();

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

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

		// FIELDSET - email
		$flds1 = new \Engine\Form\Container\Fieldset($this->lang['index']['form']['flds1']);
		$form->addContainer($flds1);

		// clean email
		$fldEmailReset = new \Engine\Form\Input\Select($this->lang['index']['form']['emailAction'], 'emailAction', $this->values['emailAction']);
		$fldEmailReset->setPossibleValues(['delete'=>$this->lang['index']['form']['deleteOption']]);
		$fldEmailReset->showDefaultOption(true);
		$fldEmailReset->setDefaultOptionText($this->lang['index']['form']['noActionOption']);
		$flds1->addElement($fldEmailReset);

		// FIELDSET - telephone
		$flds2 = new \Engine\Form\Container\Fieldset($this->lang['index']['form']['fieldset']['phone']);
		$form->addContainer($flds2);

		// clean telephone
		$fldTelReset = new \Engine\Form\Input\Select($this->lang['index']['form']['telAction'], 'telephoneAction', $this->values['telephoneAction']);
		$fldTelReset->setPossibleValues(['delete'=>$this->lang['index']['form']['deleteOption']]);
		$fldTelReset->showDefaultOption(true);
		$fldTelReset->setDefaultOptionText($this->lang['index']['form']['noActionOption']);
		$flds2->addElement($fldTelReset);

		// clean telephoneMobile
		$fldTel2Reset = new \Engine\Form\Input\Select($this->lang['index']['form']['telmAction'], 'telephoneMobileAction', $this->values['telephoneMobileAction']);
		$fldTel2Reset->setPossibleValues(['delete'=>$this->lang['index']['form']['deleteOption']]);
		$fldTel2Reset->showDefaultOption(true);
		$fldTel2Reset->setDefaultOptionText($this->lang['index']['form']['noActionOption']);
		$flds2->addElement($fldTel2Reset);

		// FIELDSET - KAM
		$flds3 = new \Engine\Form\Container\Fieldset($this->lang['index']['form']['fieldset']['kam']);
		$form->addContainer($flds3);

		// accountManager
		$fldAccManager = new \App\Form\Input\Autocomplete_User($this->lang['index']['form']['idAccountManager'], 'idAccountManager', $this->values['idAccountManager']);
		$fldAccManager->importFromConfig($entCfg['idAccountManager']);
		$flds3->addElement($fldAccManager);

		// FIELDSET - Companies
		$flds4 = new \Engine\Form\Container\Fieldset($this->lang['index']['form']['fieldset']['company']);
		$form->addContainer($flds4);

		$fldCompanyReset = new \Engine\Form\Input\Select($this->lang['index']['form']['companyAction'], 'companyAction', $this->values['companyAction']);
		$fldCompanyReset->setPossibleValues([
			'update'	=>	$this->lang['index']['form']['updateOption'],
			'delete'	=>	$this->lang['index']['form']['deleteOption'],
		]);
		$fldCompanyReset->showDefaultOption(true);
		$fldCompanyReset->setDefaultOptionText($this->lang['index']['form']['noActionOption']);
		$flds4->addElement($fldCompanyReset);

		$fldCompanyUpdate = new \App\Form\Input\Autocomplete_Corporate($this->lang['index']['form']['idCorporate'], 'idCorporate', $this->values['idCorporate']);
		$flds4->addElement($fldCompanyUpdate);
		$fldCompanyReset->setControlledElements(['update'=>[$fldCompanyUpdate]]);

		$flds5 = new \Engine\Form\Container\Fieldset($this->lang['index']['form']['fieldset']['PNC']);
		$form->addContainer($flds5);

		$fldpncReset = new \Engine\Form\Input\Select($this->lang['index']['form']['pncAction'], 'pncAction', $this->values['pncAction']);
		$fldpncReset->setPossibleValues([
			'delete'	=>	$this->lang['index']['form']['deleteOption'],
		]);
		$fldpncReset->showDefaultOption(true);
		$fldpncReset->setDefaultOptionText($this->lang['index']['form']['noActionOption']);
		$flds5->addElement($fldpncReset);

		$flds6 = new \Engine\Form\Container\Fieldset($this->lang['index']['form']['fieldset']['address']);
		$form->addContainer($flds6);

		$fldaddressReset = new \Engine\Form\Input\Select($this->lang['index']['form']['addressAction'], 'addressAction', $this->values['addressAction']);
		$fldaddressReset->setPossibleValues([
			'delete'	=>	$this->lang['index']['form']['deleteOption'],
		]);
		$fldaddressReset->showDefaultOption(true);
		$fldaddressReset->setDefaultOptionText($this->lang['index']['form']['noActionOption']);
		$flds6->addElement($fldaddressReset);

		$flds7 = new \Engine\Form\Container\Fieldset($this->lang['index']['form']['fieldset']['deliveryAddress']);
		$form->addContainer($flds7);

		$flddeliveryAddressReset = new \Engine\Form\Input\Select($this->lang['index']['form']['deliveryAddressAction'], 'deliveryAddressAction', $this->values['deliveryAddressAction']);
		$flddeliveryAddressReset->setPossibleValues([
			'delete'	=>	$this->lang['index']['form']['deleteOption'],
		]);
		$flddeliveryAddressReset->showDefaultOption(true);
		$flddeliveryAddressReset->setDefaultOptionText($this->lang['index']['form']['noActionOption']);
		$flds7->addElement($flddeliveryAddressReset);

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

		return $form;

	}

}