<?php
namespace Modules\Documents\DocumentsList; class View_Utils_FormFilters extends \App\Mvc\View_Utils_FormAbstract { public function getForm() { $_LANG = \App\Loader_Lang::getInstance()->getGlobal(); $fieldsValues = $this->values['listingParams']->getFilters(); $form=\Engine\Form\Filters::create(); $form->setColumns(2); $docDate = new \Engine\Form\Input\DateInterval($this->lang['index']['filters']['docDate'], 'filters[docDate]', $fieldsValues['docDate']); $docDate ->setValidatorParam('denyOpenIntervals', true) ->setValidatorParam('maxDifference', $this->cfg['listingParams']['filters']['docDate']['maxDifference']) ->setMandatory(); $form->addElement($docDate); $docType = new \App\Form\Input\Select_DocumentType($this->lang['index']['filters']['docType'], 'filters[docType]', $fieldsValues['docType']); $form->addElement($docType); $docNumber = new \Engine\Form\Input\Text($this->lang['index']['filters']['docNumber'], 'filters[docNumber]', $fieldsValues['docNumber']); $form->addElement($docNumber); $idDoc = new \Engine\Form\Input\Text($this->lang['index']['filters']['idDoc'], 'filters[idDoc]', $fieldsValues['idDoc']); $form->addElement($idDoc); $idPivot = new \Engine\Form\Input\Text($this->lang['index']['filters']['idPivot'], 'filters[idPivot]', $fieldsValues['idPivot']); $form->addElement($idPivot); $pivot = new \Engine\Form\Input\Select($this->lang['index']['filters']['pivot'], 'filters[pivot]', $fieldsValues['pivot']); $pivot->setPossibleValues( [ 'invoice' => $_LANG['documentPivotName']['invoice'], 'order' => $_LANG['documentPivotName']['order'], 'service' => $_LANG['documentPivotName']['service'], 'cashing' => $_LANG['documentPivotName']['cashing'], 'payment' => $_LANG['documentPivotName']['payment'], 'balance' => $_LANG['documentPivotName']['balance'], 'cashBookDoc' => $_LANG['documentPivotName']['cashBookDoc'], 'importedService' => $_LANG['documentPivotName']['importedService'], 'importedDocument' => $_LANG['documentPivotName']['importedDocument'], ] ); $pivot->showDefaultOption(); $form->addElement($pivot); $genType = new \Engine\Form\Input\Select($this->lang['index']['filters']['generationType'], 'filters[generationType]', $fieldsValues['generationType']); $genType->setPossibleValues( [ 'auto' => $this->lang['generationType']['auto'], 'manual' => $this->lang['generationType']['manual'], ] ); $genType->showDefaultOption(); $form->addElement($genType); $availableMainDocTypes = array_keys( \App\Config\IssueDocuments::getInstance()->getInvoiceDocsList() ); $docTemplate = new \App\Form\Input\Select_DocumentTemplate($this->lang['index']['filters']['docTemplate'], 'filters[docTemplate]', $fieldsValues['docTemplate']); $docTemplate->showDefaultOption(); $docTemplate->setDocTypeFilter($availableMainDocTypes); $form->addElement($docTemplate); $form->showResetButton(true); $form->setJsCallback('MVC.listing.installedHandlers["listing"].reloadAndResetListing'); $form->loadMissingDefaultValues($this->values['listingParams']->getDefaultFilters()); return $form; } }