<?php
namespace Modules\Admin\AutoProcessRules\BulkUpdate\InvoiceCumulate; class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract { public function getForm() { $form = \Engine\Form\General::create(); $fieldset = \Engine\Form\Container\Fieldset::create(); $form->addContainer($fieldset); $formInfo = new \Engine\Form\Input\Label(); $formInfo->setStyle('noLabel', true); $formInfo->setDetails($this->lang['index']['formFields']['formInfo']); $fieldset->addElement($formInfo); $values = []; foreach ($this->values['rulesIds'] as $id) { $entName = \Entity\AutoProcessRule::select($id)->name; if ($entName) { $values[] = '<span class="remoteLoadLink" onclick="RemoteLoad.loadEntity(this, \'autoProcessRule\', '.$id.')">'.$entName.'</span>'; } else { $values[] = '<span class="remoteLoadLink" onclick="RemoteLoad.loadEntity(this, \'autoProcessRule\', '.$id.')">#'.$id.'</span>'; } } $info = new \Engine\Form\Input\Label(); $info->setStyle('noLabel', true); $info->setValue(sprintf('You have selected %s rules : %s.', count($this->values['rulesIds']), implode(', ', $values))); $fieldset->addElement($info); $fieldsetInvResp = \Engine\Form\Container\Fieldset::create($this->lang['index']['formFields']['fieldset']['invoiceResponsible']); $form->addContainer($fieldsetInvResp); $selectInvResp = new \Engine\Form\Input\Select($this->lang['index']['formFields']['selectInvoiceResponsible'], 'selectInvResp', $this->values['selectInvResp']); $selectInvResp->setPossibleValues([ 'skip' => $this->lang['index']['formFields']['selectValues']['skip'], 'update' => $this->lang['index']['formFields']['selectValues']['update'], ]); $fieldsetInvResp->addElement($selectInvResp); $invResp = new \App\Form\Input\Autocomplete_User($this->lang['index']['formFields']['invoiceResponsible'], 'invoiceResponsibleUser', $this->values['invoiceResponsibleUser']); $invResp->setMandatory(); $fieldsetInvResp->addElement($invResp); $selectInvResp->setControlledElements( ['update'=> [$invResp]]); $fieldsetInvSeries = \Engine\Form\Container\Fieldset::create($this->lang['index']['formFields']['fieldset']['invoiceSeries']); $form->addContainer($fieldsetInvSeries); $selectInvSeries = new \Engine\Form\Input\Select($this->lang['index']['formFields']['selectInvoiceSeries'], 'selectInvSeries', $this->values['selectInvSeries']); $selectInvSeries->setPossibleValues([ 'skip' => $this->lang['index']['formFields']['selectValues']['skip'], 'update' => $this->lang['index']['formFields']['selectValues']['update'], ]); $fieldsetInvSeries->addElement($selectInvSeries); $invSeries = new \App\Form\Input\Select_DocumentSeries($this->lang['index']['formFields']['invoiceSeries'], 'idInvoiceSeries', $this->values['idInvoiceSeries']); $invSeries->showDefaultOption(); $invSeries->setDocTypesFilter(['invoice']); $invSeries->setMandatory(); $fieldsetInvSeries->addElement($invSeries); $selectInvSeries->setControlledElements( ['update'=> [$invSeries]]); $fieldsetFormOfPayment = \Engine\Form\Container\Fieldset::create($this->lang['index']['formFields']['fieldset']['formOfPayment']); $form->addContainer($fieldsetFormOfPayment); $selectFormOfPayment = new \Engine\Form\Input\Select($this->lang['index']['formFields']['selectFormOfPayment'], 'selectFormOfPayment', $this->values['selectFormOfPayment']); $selectFormOfPayment->setPossibleValues([ 'skip' => $this->lang['index']['formFields']['selectValues']['skip'], 'update' => $this->lang['index']['formFields']['selectValues']['update'], ]); $fieldsetFormOfPayment->addElement($selectFormOfPayment); $fop = new \App\Form\Input\Select_FormOfPayment($this->lang['index']['formFields']['formOfPayment'], 'formOfPayment', $this->values['formOfPayment']); $fop->showDefaultOption(); $fieldsetFormOfPayment->addElement($fop); $selectFormOfPayment->setControlledElements( ['update'=> [$fop]]); $fieldsetAgencyBankAccount = \Engine\Form\Container\Fieldset::create($this->lang['index']['formFields']['fieldset']['agencyBankAccount']); $form->addContainer($fieldsetAgencyBankAccount); $selectAgBankAccount = new \Engine\Form\Input\Select($this->lang['index']['formFields']['selectAgencyBankAccount'], 'selectAgencyBankAccount', $this->values['selectAgencyBankAccount']); $selectAgBankAccount->setPossibleValues([ 'skip' => $this->lang['index']['formFields']['selectValues']['skip'], 'update' => $this->lang['index']['formFields']['selectValues']['update'], ]); $fieldsetAgencyBankAccount->addElement($selectAgBankAccount); $agency = new \App\Form\Input\Select_AgencyBankAccount($this->lang['index']['formFields']['agencyBankAccount'], 'idAgencyBankAccount', $this->values['idAgencyBankAccount']); $agency->showDefaultOption(); $fieldsetAgencyBankAccount->addElement($agency); $selectAgBankAccount->setControlledElements( ['update'=> [$agency]]); $form->addElement(new \Engine\Form\Input\Hidden('', $this->submitButtonName, 1)); return $form; } }