function __construct() { parent::__construct(); parent::include_css('app/resources/custom-table.css'); //cria o formulario $this->form = new TForm('SrpFormView'); $this->form->class = 'tform'; //$this->form->style = 'max-width: 500px'; $table = new TTable(); $table->width = '100%'; $this->form->add($table); $row = $table->addRow(); $row->class = 'tformtitle'; $row->addCell(new TLabel('Listagem de Itens da SRP'))->colspan = 2; //cria os campos do formulário $id = new TEntry('id'); $numeroSRP = new TEntry('numeroSRP'); $numeroIRP = new TEntry('numeroIRP'); $numeroProcesso = new TEntry('numeroProcesso'); $nome = new TEntry('nome'); $uasg = new TEntry('uasg'); $validade = new TDate('validade'); $natureza = new TEntry('natureza'); // define os tamanhos $id->setSize(70); $numeroSRP->setSize(90); $numeroIRP->setSize(90); $numeroProcesso->setSize(120); $nome->setSize(350); $uasg->setSize(70); $validade->setSize(90); $natureza->setSize(200); //desabilitando os campos $id->setEditable(false); $numeroSRP->setEditable(false); $numeroIRP->setEditable(false); $numeroProcesso->setEditable(false); $nome->setEditable(false); $uasg->setEditable(false); $validade->setEditable(false); $natureza->setEditable(false); // adiciona uma linha para cada campo no formulario $table->addRowSet(new TLabel('id:'), $id); $table->addRowSet(new TLabel('Nº SRP:'), $numeroSRP); $table->addRowSet(new TLabel('Nº IRP:'), $numeroIRP); $table->addRowSet(new TLabel('Proc. Orig.:'), $numeroProcesso); $table->addRowSet(new TLabel('Nome:'), $nome); $table->addRowSet(new TLabel('UASG:'), $uasg); $table->addRowSet(new TLabel('Validade:'), $validade); $table->addRowSet(new TLabel('Natureza:'), $natureza); $this->form->setFields(array($id, $numeroSRP, $numeroIRP, $numeroProcesso, $nome, $uasg, $validade, $natureza)); //criar a datagrid $this->datagrid = new TDataGrid(); $this->datagrid->class = 'tdatagrid_table customized-table'; $this->datagrid->makeScrollable(); $this->datagrid->disableDefaultClick(); $this->datagrid->setHeight(180); //criar as colunas da datagrid $GnumeroItem = new TDataGridColumn('numeroItem', 'Nº Item', 'left', 50); $GdescricaoSumaria = new TDataGridColumn('descricaoSumaria', 'Descrição Sumária', 'left', 400); $GquantidadeEstimada = new TDataGridColumn('quantidadeDisponivel', 'Qtd. Estimada', 'right', 100); $GquantidadeDisponivel = new TDataGridColumn('estoqueDisponivel', 'Qtd. Disponível', 'right', 100); $GunidadeMedida = new TDataGridColumn('unidadeMedida', 'Unidade', 'left', 50); $GvalorUnitario = new TDataGridColumn('valorUnitario', 'Valor Unit.', 'right', 70); // add the columns to the DataGrid $this->datagrid->addColumn($GnumeroItem); $this->datagrid->addColumn($GdescricaoSumaria); $this->datagrid->addColumn($GquantidadeEstimada); $this->datagrid->addColumn($GquantidadeDisponivel); $this->datagrid->addColumn($GunidadeMedida); $this->datagrid->addColumn($GvalorUnitario); /* $viewDetalhe = new TDataGridAction(array($this, 'onShowDetail')); $viewDetalhe->setLabel('Detalhes'); $viewDetalhe->setImage('ico_view.png'); $viewDetalhe->setField('id'); $this->datagrid->addAction($viewDetalhe); */ // cria o modelo no datagrid $this->datagrid->createModel(); $back_button = new TButton('back'); $back_button->setAction(new TAction(array('SrpList', 'onReload')), 'Voltar'); $back_button->setImage('ico_back.png'); $this->form->addField($back_button); $buttons_box = new THBox(); $buttons_box->add($back_button); // add a row for the form action $row = $table->addRow(); $row->class = 'tformaction'; // CSS class $row->addCell($buttons_box)->colspan = 2; // cria o container da pagina $container = TVBox::pack($this->form, $this->datagrid); parent::add($container); }
/** * */ public function makeTDate($properties) { $widget = new TDate((string) $properties->{'name'}); $widget->setValue((string) $properties->{'value'}); $widget->setSize((int) $properties->{'width'}); $widget->setEditable((string) $properties->{'editable'}); if ((string) $properties->{'mask'}) { $widget->setMask((string) $properties->{'mask'}); } if (isset($properties->{'tip'})) { $widget->setTip((string) $properties->{'tip'}); } if (isset($properties->{'required'}) and $properties->{'required'} == '1') { $widget->addValidation((string) $properties->{'name'}, new TRequiredValidator()); } $this->fields[] = $widget; $this->fieldsByName[(string) $properties->{'name'}] = $widget; return $widget; }