<?php
 namespace Modules\Admin\Config\ClientInvoices\General; class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract { public function getForm() { $form = \Engine\Form\General::create(); $label = new \Engine\Form\Input\Label(); $label->setDetails($this->lang['index']['description']); $form->addElement($label); $fieldsetCurrencies = \Engine\Form\Container\Fieldset::create($this->lang['currency']['legend']); $this->currencyForm($fieldsetCurrencies); $form->addContainer($fieldsetCurrencies); $fieldsetDueDates = \Engine\Form\Container\Fieldset::create($this->lang['dueDates']['legends']['dueDates']); $this->dueDatesForm($fieldsetDueDates); $form->addContainer($fieldsetDueDates); $fieldsetInvoiceVoiding = \Engine\Form\Container\Fieldset::create($this->lang['invoiceVoiding']['legends']['voidInvoice']); $this->invoiceVoidingForm($fieldsetInvoiceVoiding); $form->addContainer($fieldsetInvoiceVoiding); $form->addElement(new \Engine\Form\Input\Hidden(null, 'save', 1)); $form->addButton(new \Engine\Form\Button\Submit('save')); return $form; } private function currencyForm(\Engine\Form\Container\Fieldset $fieldset) { $inputInvDefCurrency = new \App\Form\Input\Select_Currency($this->lang['currency']['formRow']['defaultCurrency'], 'defaultCurrency', $this->values['defaultCurrency']); $inputInvDefCurrency->showDefaultOption(); $inputInvDefCurrency->setTooltip($this->lang['currency']['formRow']['defaultCurrencyTooltip']); $fieldset->addElement($inputInvDefCurrency); } private function dueDatesForm(\Engine\Form\Container\Fieldset $fieldset) { $fld = new \Engine\Form\Input\Label(); $fld->setDetails($this->lang['dueDates']['description']); $fld->setStyle("noLabel", true); $fieldset->addElement($fld); $inputCorporate = new \Engine\Form\Input\Text($this->lang['dueDates']['formRow']['corporate'], 'dueDates[corporate]', $this->values['dueDates']['corporate']); $inputCorporate->setStyle('width', 40); $inputCorporate->setCustomHTML($this->lang['dueDates']['texts']['days']); $inputCorporate->setValidatorParam('type', 'int')->setValidatorParam('minValue', 0)->setValidatorParam('maxValue', 366); $fieldset->addElement($inputCorporate); $inputSubagent = new \Engine\Form\Input\Text($this->lang['dueDates']['formRow']['subagent'], 'dueDates[subagent]', $this->values['dueDates']['subagent']); $inputSubagent->setStyle('width', 40); $inputSubagent->setCustomHTML($this->lang['dueDates']['texts']['days']); $inputSubagent->setValidatorParam('type', 'int')->setValidatorParam('minValue', 0)->setValidatorParam('maxValue', 366); $fieldset->addElement($inputSubagent); $inputCustomer = new \Engine\Form\Input\Text($this->lang['dueDates']['formRow']['customer'], 'dueDates[customer]', $this->values['dueDates']['customer']); $inputCustomer->setStyle('width', 40); $inputCustomer->setCustomHTML($this->lang['dueDates']['texts']['days']); $inputCustomer->setValidatorParam('type', 'int')->setValidatorParam('minValue', 0)->setValidatorParam('maxValue', 366); $fieldset->addElement($inputCustomer); } private function invoiceVoidingForm(\Engine\Form\Container\Fieldset $fieldset) { $fld = new \Engine\Form\Input\Label(); $fld->setDetails($this->lang['invoiceVoiding']['Description']); $fld->setStyle("noLabel", true); $fieldset->addElement($fld); $_LANG = \App\Loader_Lang::getInstance()->getGlobal(); $inputAllowVoidIssue = new \Engine\Form\Input\Radio($this->lang['invoiceVoiding']['formFields']['allowVoidIssue'], 'voidIssuedInvoices[allow]', $this->values['voidIssuedInvoices']['allow']); $inputAllowVoidIssue->setPossibleValues([true => $_LANG['yes'], false => $_LANG['no']]); $inputAllowVoidIssue->setTooltip($this->lang['invoiceVoiding']['tooltip']['allow']); $fieldset->addElement($inputAllowVoidIssue); $inputChangeMonth = new \Engine\Form\Input\Radio($this->lang['invoiceVoiding']['formFields']['changeMonth'], 'voidIssuedInvoices[sameMonth]', $this->values['voidIssuedInvoices']['sameMonth']); $inputChangeMonth->setPossibleValues([ true => $this->lang['invoiceVoiding']['formFields']['sameMonth'], false => $this->lang['invoiceVoiding']['formFields']['otherMonth']]); $inputChangeMonth->setTooltip($this->lang['invoiceVoiding']['tooltip']['changeMonth']); $fieldset->addElement($inputChangeMonth); $inputFixedDays = new \Engine\Form\Input\Text($this->lang['invoiceVoiding']['formFields']['fixedDays'], 'voidIssuedInvoices[fixedDays]', $this->values['voidIssuedInvoices']['fixedDays']); $inputFixedDays->setTooltip($this->lang['invoiceVoiding']['formFields']['fixedDaysExplanations']); $inputFixedDays->setValidatorParam('type', 'int')->setValidatorParam('minValue', 0); $inputFixedDays->setTooltip($this->lang['invoiceVoiding']['tooltip']['fixedDays']); $fieldset->addElement($inputFixedDays); $inputAllowVoidIssue->setControlledElements([true=> [$inputChangeMonth,$inputFixedDays]], 'hide'); } }