<?php
namespace Modules\Partners\Customers\CreditCards;

class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract
{
	/**
	 * {@inheritDoc}
	 * @see \App\Mvc\View_Utils_FormAbstract::getForm()
	 */
	public function getForm()
	{
		$cfg = \Entity\CustomerCreditCard::loadCFG();

		$form = \Engine\Form\General::create();
		$fieldset = \Engine\Form\Container\Fieldset::create();
		$form->addContainer($fieldset);

		// customer
		$customer = \App\Form\Input\Autocomplete_Customer::create($this->lang['insert']['customer'], 'customer', $this->values['customer']);
		$customer->importFromConfig($cfg['idCustomer']);
		$fieldset->addElement($customer);

		// credit card details
		$ccDetails = \App\Form\Input\CreditCardDetails::create($this->lang['insert']['ccDetails'], 'ccDetails', $this->values['ccDetails']);

		if ($this->controller->getAction() == 'update') {
			$ccDetails->setTooltip($this->lang['update']['numberTooltip']);
		}
		$fieldset->addElement($ccDetails);

		$form->addElement(\Engine\Form\Input\Hidden::create('', $this->submitButtonName, 1));
		return $form;
	}

}