/** * @param Phalcon\Mvc\ModelInstance $entity * @param array $options */ public function initialize($entity = null, $options = null) { if (!isset($options['edit']) && !isset($options['create'])) { $id = new Text('id'); $id->setLabel('Id'); $this->add($id); } $category = new Select('categoriesId', Categories::find(), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => '...')); $category->setLabel('Category'); $category->addValidator(new PresenceOf(array('message' => 'Category is mandatory'))); $category->setUserOption('searcheable', true); $category->setUserOption('browseable', true); $category->setUserOption('relation', 'category'); $this->add($category); $icon = new Text('icon', array('placeholder' => 'Enter a css-icon class name')); $icon->setLabel('Icon'); $icon->addValidator(new PresenceOf(array('message' => 'Icon is mandatory'))); $this->add($icon); $code = new Text('code', array('maxlength' => 10)); $code->setLabel('Code'); $code->setUserOption('searcheable', true); $code->setUserOption('browseable', true); $code->addValidator(new PresenceOf(array('message' => 'Code is mandatory'))); $this->add($code); $name = new Text('name', array('maxlength' => 64)); $name->setLabel('Name'); $name->setUserOption('searcheable', true); $name->setUserOption('browseable', true); $name->addValidator(new PresenceOf(array('message' => 'Name is mandatory'))); $this->add($name); $description = new TextArea('description'); $description->setLabel('Description'); $description->addValidator(new PresenceOf(array('message' => 'Description is mandatory'))); $this->add($description); $price = new Text('price'); $price->setLabel('Price'); $price->setUserOption('searcheable', true); $price->setUserOption('browseable', true); $price->addValidator(new PresenceOf(array('message' => 'Price is mandatory'))); $price->addValidator(new Numericality(array('message' => 'Price must be a number'))); $this->add($price); $stock = new Text('stock'); $stock->setLabel('Stock'); $stock->setUserOption('browseable', true); $stock->addValidator(new PresenceOf(array('message' => 'Current stock is mandatory'))); $stock->addValidator(new Numericality(array('message' => 'Current stock must be a number'))); $this->add($stock); if (isset($options['edit'])) { $createdAt = new Date('created', array('readonly' => 'readonly')); $createdAt->setLabel('Created At'); if ($entity->createdAt) { $entity->created = date('Y-m-d', $entity->createdAt); } $this->add($createdAt); } }
public function initialize($entity = null, $options = null) { $created = new Date('created'); $created->setLabel('Дата'); $this->add($created); $sum = new Numeric('sum'); $sum->setLabel('Сумма'); $this->add($sum); $categoryID = new Hidden('categoryID'); $this->add($categoryID); $text = new Textarea('text'); $text->setLabel('Описание'); $this->add($text); }
/** * Initialize the products form */ public function initialize($model = null, $options = array()) { $ativo = new Select("ativo", array('1' => 'Sim', '0' => 'Não')); $ativo->setAttribute('class', 'form-control'); $this->add($ativo); $nome = new Text("nome"); $nome->setAttribute('class', 'form-control'); $this->add($nome); $codigo = new Text("codigo"); $codigo->setLabel("código"); $codigo->setAttribute('class', 'form-control'); $codigo->setAttribute('readonly', 'true'); if (is_null($model)) { $str = $this->getCodigo(); if (Cupons::count(array('codigo = "' . $str . '"')) == 0) { $codigo->setAttribute('value', $str); } else { $str = $this->getCodigo(); $codigo->setAttribute('value', $str); } } $this->add($codigo); $quantidade = new Numeric("quantidade"); $quantidade->setLabel("quantidade de cupons"); $quantidade->setAttribute('class', 'form-control'); $this->add($quantidade); $quantidade_uso = new Numeric("quantidade_uso"); $quantidade_uso->setLabel("quantas utilização por usuário?"); $quantidade_uso->setAttribute('class', 'form-control'); $this->add($quantidade_uso); $valor = new Text("valor"); $valor->setAttribute('class', 'form-control money'); $this->add($valor); $valor_minimo = new Text("valor_minimo"); $valor_minimo->setLabel('VALOR MíNIMO'); $valor_minimo->setAttribute('class', 'form-control money'); $this->add($valor_minimo); $data_expiracao = new Date("data_expiracao"); $data_expiracao->setLabel('DATA EXPIRAÇÃO'); $data_expiracao->setAttribute('class', 'form-control money'); $this->add($data_expiracao); }
function initialize($entity = null, $options = null) { $date = new Date('date'); $date->setLabel('Input Date'); $date->setFilters(array('striptags', 'string')); $date->setDefault(date('Y-m-d')); $date->addValidators(array(new PresenceOf(array('message' => 'Date is required')))); $this->add($date); $start_time = new Text('start_hour'); $start_time->setLabel('Input Start Hour'); $start_time->setFilters(array('striptags', 'string')); $start_time->addValidators(array(new PresenceOf(array('message' => 'Start Time is required')))); $this->add($start_time); $finish_time = new Text('finish_hour'); $finish_time->setLabel('Input Finish Hour'); $finish_time->setFilters(array('striptags', 'string')); $finish_time->addValidators(array(new PresenceOf(array('message' => 'Finish Time is required')))); $this->add($finish_time); $systemId = new Select('system_id', Systems::find(), array('using' => array('id', 'name'), 'useEmpty' => true)); $systemId->setLabel('Select System'); $systemId->addValidators(array(new PresenceOf(array('message' => 'System is required')))); if ($entity) { $systemId->setDefault(array($entity->system_id)); } $this->add($systemId); $description = new TextArea('description'); $description->setLabel('Input Description'); $description->addValidators(array(new PresenceOf(array('message' => 'Description is required')))); $this->add($description); $hidden = new Hidden('id'); if ($entity) { $hidden->setDefault(array($entity->id)); } $this->add($hidden); }
function initialize($entity = null, $options = null) { $date = new Date('date'); $date->setLabel('Input Date'); $date->setFilters(array('striptags', 'string')); $date->setDefault(date('Y-m-d')); $date->addValidators(array(new PresenceOf(array('message' => 'Date is required')))); $this->add($date); $version = new Text('version'); $version->setLabel('Create Version'); $version->setFilters(array('striptags', 'string')); $version->addValidators(array(new PresenceOf(array('message' => 'Name is required')))); $this->add($version); }
public function initialize($entity = null, $options = array()) { /*Si el form es de creacion, los campos seran required. Viceversa.*/ $required['clave'] = ""; $required['valor'] = ""; if (isset($options['required'])) { $required['clave'] = "required"; $required['valor'] = "true"; } /*======================= ID ==============================*/ if (!isset($options['edit'])) { $element = new Text("remito_id"); $this->add($element->setLabel("ID")); } else { $this->add(new Hidden("remito_id")); } /*=========================== REMITO SYA =====================================*/ $periodo = new Numeric("remito_nro", array('class' => 'form-control', 'placeholder' => 'INGRESAR VALOR NÚMERICO', $required['clave'] => $required['valor'])); $periodo->setLabel("REMITO SYA"); $periodo->setFilters(array('int')); $periodo->addValidators(array(new PresenceOf(array('message' => 'El Remito es Requerido')))); $this->add($periodo); /*=========================== TRANSPORTE =====================================*/ $transporte = new DataListElement('transporte_dominio', array(array('placeholder' => 'SELECCIONAR LA PATENTE', 'class' => 'form-control', 'maxlength' => 11, $required['clave'] => $required['valor']), Transporte::find(array('transporte_habilitado=1', 'order' => 'transporte_dominio')), array('transporte_id', 'transporte_dominio'), 'remito_transporteId')); $transporte->setLabel('TRANSPORTE'); $this->add($transporte); /*=========================== TIPO DE EQUIPO =====================================*/ $elemento = new DataListElement('tipoEquipo_nombre', array(array('placeholder' => 'SELECCIONAR EL NOMBRE', 'class' => 'form-control', 'maxlength' => 50, $required['clave'] => $required['valor']), Tipoequipo::find(array('tipoEquipo_habilitado=1', 'order' => 'tipoEquipo_nombre')), array('tipoEquipo_id', 'tipoEquipo_nombre'), 'remito_tipoEquipoId')); $elemento->setLabel('TIPO DE EQUIPO'); $this->add($elemento); /*=========================== TIPO DE CARGA =====================================*/ $elemento = new DataListElement('tipoCarga_nombre', array(array('placeholder' => 'SELECCIONAR EL NOMBRE', 'class' => 'form-control', 'maxlength' => 50, $required['clave'] => $required['valor']), Tipocarga::find(array('tipoCarga_habilitado=1', 'order' => 'tipoCarga_nombre')), array('tipoCarga_id', 'tipoCarga_nombre'), 'remito_tipoCargaId')); $elemento->setLabel('TIPO DE CARGA'); $this->add($elemento); /*=========================== CHOFER =====================================*/ $elemento = new DataListElement('chofer_dni', array(array('placeholder' => 'SELECCIONAR EL DNI', 'class' => 'form-control', 'maxlength' => 50, $required['clave'] => $required['valor']), Chofer::find(array('chofer_habilitado=1', 'order' => 'chofer_nombreCompleto')), array('chofer_id', 'chofer_dni'), 'remito_choferId')); $elemento->setLabel('CHOFER'); $this->add($elemento); /*=========================== VIAJE =====================================*/ $viaje = Viaje::find(array('viaje_habilitado=1', 'order' => array('viaje_origen'))); $elemento = new DataListElement('viaje_origen', array(array('placeholder' => 'SELECCIONAR EL ORIGEN', 'class' => 'form-control', 'maxlength' => 50, $required['clave'] => $required['valor']), $viaje, array('viaje_id', 'viaje_origen'), 'remito_viajeId')); $elemento->setLabel('VIAJE'); $this->add($elemento); /*=========================== CONCATENADO =====================================*/ $elemento = new DataListElement('concatenado_nombre', array(array('placeholder' => 'SELECCIONAR EL NOMBRE', 'class' => 'form-control', 'maxlength' => 60, $required['clave'] => $required['valor']), Concatenado::find(array('concatenado_habilitado=1', 'order' => 'concatenado_nombre')), array('concatenado_id', 'concatenado_nombre'), 'remito_concatenadoId')); $elemento->setLabel('CONCATENADO'); $this->add($elemento); /*=========================== FECHA =====================================*/ $fecha = new Date("remito_fecha", array('class' => 'form-control', $required['clave'] => $required['valor'])); $fecha->setLabel("FECHA"); $fecha->addValidators(array(new PresenceOf(array('message' => 'La fecha es Requerida')))); $this->add($fecha); /*=========================== TARIFA =====================================*/ $elemento = new Text("tarifa_horaInicial", array('class' => 'form-control', $required['clave'] => $required['valor'])); $elemento->setLabel("HORA INICIAL"); $elemento->addValidators(array(new PresenceOf(array('message' => 'La Hora Inicial es requerida')))); $this->add($elemento); $elemento = new Text("tarifa_horaFinal", array('class' => 'form-control', $required['clave'] => $required['valor'])); $elemento->setLabel("HORA FINAL"); $elemento->addValidators(array(new PresenceOf(array('message' => 'La Hora Final es requerida')))); $this->add($elemento); $elemento = new Numeric('tarifa_hsServicio', array('placeholder' => 'INGRESAR VALOR NÚMERICO', 'class' => 'form-control', 'min' => 0)); $elemento->setFilters(array('float')); $elemento->setLabel("HORAS DE SERVICIO"); $this->add($elemento); $elemento = new Numeric('tarifa_hsHidro', array('placeholder' => 'INGRESAR VALOR NÚMERICO', 'class' => 'form-control', 'min' => 0)); $elemento->setFilters(array('float')); $elemento->setLabel("HORAS DE HIDRO"); $this->add($elemento); $elemento = new Numeric('tarifa_hsMalacate', array('placeholder' => 'INGRESAR VALOR NÚMERICO', 'class' => 'form-control', 'min' => 0)); $elemento->setFilters(array('float')); $elemento->setLabel("HORAS DE MALACATE"); $this->add($elemento); $elemento = new Numeric('tarifa_hsStand', array('placeholder' => 'INGRESAR VALOR NÚMERICO', 'class' => 'form-control', 'min' => 0)); $elemento->setFilters(array('float')); $elemento->setLabel("HORAS DE ESPERA"); $this->add($elemento); $elemento = new Numeric('tarifa_km', array('placeholder' => 'INGRESAR VALOR NÚMERICO', 'class' => 'form-control', 'min' => 0)); $elemento->setFilters(array('float')); $elemento->setLabel("KILOMETROS"); $this->add($elemento); /*=========================== OBSERVACION =====================================*/ $elemento = new \Phalcon\Forms\Element\TextArea('remito_observacion', array('placeholder' => 'ESCRIBIR...', 'class' => 'form-control', 'maxlength' => 150)); $elemento->setLabel('OBSERVACIÓN'); $this->add($elemento); /*=========================== ORDEN DE CONFORMIDAD =====================================*/ $elemento = new Text('remito_conformidad', array('placeholder' => '', 'class' => 'form-control', 'maxlength' => 50)); $elemento->setLabel('CONFORMIDAD RE'); $this->add($elemento); /*=========================== ORDEN DE NO CONFORMIDAD =====================================*/ $elemento = new Text('remito_noConformidad', array('placeholder' => '', 'class' => 'form-control', 'maxlength' => 50)); $elemento->setLabel('MOT NO CONF RE'); $this->add($elemento); }
public function setDefault($value) { parent::setDefault(gmdate('Y-m-d', $value)); }
/** * Initialize the cliente form * Los campos que se generarán automaticamente son: * - Fecha de Creacion - CreadoPor * Los campos relacionados con el cliente se generarán en un formulario aparte. */ public function initialize($entity = null, $options = array()) { $required['clave'] = ""; $required['valor'] = ""; if (isset($options['required'])) { $required['clave'] = "required"; $required['valor'] = "true"; } /*======================= ID ==============================*/ if (!isset($options['edit'])) { $element = new Text("orden_id"); $this->add($element->setLabel("N° de Orden")); } else { $this->add(new Hidden("orden_id")); } /*=========================== PLANILLA =====================================*/ $planilla = new DataListElement('planilla_nombreCliente', array(array('placeholder' => 'Seleccione una Planilla', 'class' => 'form-control', 'maxlength' => 11, 'autofocus' => 'true', $required['clave'] => $required['valor']), Planilla::find(array('planilla_habilitado=1', 'order' => 'planilla_nombreCliente')), array('planilla_id', 'planilla_nombreCliente'), 'orden_planillaId')); $planilla->setLabel('Planilla'); $this->add($planilla); /*=========================== REMITO SYA =====================================*/ $periodo = new Numeric("orden_remito", array('class' => 'form-control', 'placeholder' => 'Ingrese un valor númerico', $required['clave'] => $required['valor'])); $periodo->setLabel("Remito Sya"); $periodo->setFilters(array('int')); $periodo->addValidators(array(new \Phalcon\Validation\Validator\PresenceOf(array('message' => 'El Remito es Requerido')))); $this->add($periodo); /*=========================== TRANSPORTE =====================================*/ $transporte = new DataListElement('transporte_dominio', array(array('placeholder' => 'Seleccione el Dominio', 'class' => 'form-control', 'maxlength' => 11, $required['clave'] => $required['valor']), Transporte::find(array('transporte_habilitado=1', 'order' => 'transporte_dominio')), array('transporte_id', 'transporte_dominio'), 'orden_transporteId')); $transporte->setLabel('Dominio'); $this->add($transporte); /*=========================== TIPO DE EQUIPO =====================================*/ $elemento = new DataListElement('tipoEquipo_nombre', array(array('placeholder' => 'Seleccione el Equipo', 'class' => 'form-control', 'maxlength' => 50, $required['clave'] => $required['valor']), Tipoequipo::find(array('tipoEquipo_habilitado=1', 'order' => 'tipoEquipo_nombre')), array('tipoEquipo_id', 'tipoEquipo_nombre'), 'orden_tipoEquipoId')); $elemento->setLabel('Tipo de Equipo'); $this->add($elemento); /*=========================== TIPO DE CARGA =====================================*/ $elemento = new DataListElement('tipoCarga_nombre', array(array('placeholder' => 'Seleccione el Tipo de Carga', 'class' => 'form-control', 'maxlength' => 50, $required['clave'] => $required['valor']), Tipocarga::find(array('tipoCarga_habilitado=1', 'order' => 'tipoCarga_nombre')), array('tipoCarga_id', 'tipoCarga_nombre'), 'orden_tipoCargaId')); $elemento->setLabel('Tipo de Carga'); $this->add($elemento); /*=========================== CHOFER =====================================*/ $elemento = new DataListElement('chofer_nombreCompleto', array(array('placeholder' => 'Seleccione el Chofer', 'class' => 'form-control', 'maxlength' => 50, $required['clave'] => $required['valor']), Chofer::find(array('chofer_habilitado=1', 'order' => 'chofer_nombreCompleto')), array('chofer_id', 'chofer_nombreCompleto'), 'orden_choferId')); $elemento->setLabel('Nombre del Chofer'); $this->add($elemento); /*=========================== VIAJE =====================================*/ $viaje = Viaje::find(array('viaje_habilitado=1', 'order' => array('viaje_origen', 'viaje_concatenado'))); $elemento = new DataListElement('viaje_origen', array(array('placeholder' => 'Seleccione el Origen', 'class' => 'form-control', 'maxlength' => 50, $required['clave'] => $required['valor']), $viaje, array('viaje_id', 'viaje_origen'), 'orden_viajeId')); $elemento->setLabel('Origen'); $this->add($elemento); /*=========================== CONCATENADO =====================================*/ $elemento = new DataListElement('concatenado_nombre', array(array('placeholder' => 'Seleccione el Concatenado', 'class' => 'form-control', 'maxlength' => 60, $required['clave'] => $required['valor']), Concatenado::find(array('concatenado_habilitado=1', 'order' => 'concatenado_nombre')), array('concatenado_id', 'concatenado_nombre'), 'orden_concatenadoId')); $elemento->setLabel('Concatenado'); $this->add($elemento); /*=========================== FECHA =====================================*/ $fecha = new Date("orden_fecha", array('class' => 'form-control', $required['clave'] => $required['valor'])); $fecha->setLabel("Fecha"); $fecha->setFilters(array('date')); $fecha->addValidators(array(new PresenceOf(array('message' => 'La fecha es Requerida')))); $this->add($fecha); /*=========================== TARIFA =====================================*/ $elemento = new TypeElement("tarifa_horaInicial", array('type' => 'time', 'class' => 'form-control', $required['clave'] => $required['valor'])); $elemento->setLabel("Hora Inicial"); $elemento->addValidators(array(new PresenceOf(array('message' => 'La Hora Inicial es requerida')))); $this->add($elemento); $elemento = new TypeElement("tarifa_horaFinal", array('type' => 'time', 'class' => 'form-control', $required['clave'] => $required['valor'])); $elemento->setLabel("Hora Final"); $elemento->addValidators(array(new PresenceOf(array('message' => 'La Hora Final es requerida')))); $this->add($elemento); $elemento = new Numeric('tarifa_hsServicio', array('placeholder' => 'Ingresar valor númerico', 'class' => 'form-control', 'min' => 0)); $elemento->setFilters(array('float')); $elemento->setLabel("Horas de Servicio"); $this->add($elemento); $elemento = new Numeric('tarifa_hsHidro', array('placeholder' => 'Ingresar valor númerico', 'class' => 'form-control', 'min' => 0)); $elemento->setFilters(array('float')); $elemento->setLabel("Horas de Hidro"); $this->add($elemento); $elemento = new Numeric('tarifa_hsMalacate', array('placeholder' => 'Ingresar valor númerico', 'class' => 'form-control', 'min' => 0)); $elemento->setFilters(array('float')); $elemento->setLabel("Horas de Malacate"); $this->add($elemento); $elemento = new Numeric('tarifa_hsStand', array('placeholder' => 'Ingresar valor númerico', 'class' => 'form-control', 'min' => 0)); $elemento->setFilters(array('float')); $elemento->setLabel("Horas Stand"); $this->add($elemento); $elemento = new Numeric('tarifa_km', array('placeholder' => 'Ingresar valor númerico', 'class' => 'form-control', 'min' => 0)); $elemento->setFilters(array('float')); $elemento->setLabel("Kilometros"); $this->add($elemento); /*=========================== COLUMNA EXTRA =====================================*/ //El id de este elemento se agrega a contenidoExtra //Las Columnas Extras deberian ser agregadas despues de crear la orden, para poder agregar las columnas extras que se quieran. /* $elemento = new DataListElement('columnaExtra_nombre', array( array('placeholder' => 'Titulo de la Columna', 'class'=>'form-control', 'maxlength' => 50,$required['clave']=>$required['valor']), Columnaextra::find(array('columnaExtra_habilitado=1','order'=>'columnaExtra_nombre')), array('columnaExtra_id', 'columnaExtra_nombre'), 'columnaExtra_id' )); $elemento->setLabel('Titulo de la Columna Extra'); $this->add($elemento); /*=========================== CONTENIDO EXTRA =====================================*/ //El id de este elemento se agrega a contenidoExtra /*$elemento = new Text('contenidoExtra_descripcion', array('placeholder' => 'Titulo de la Columna', 'class'=>'form-control', 'maxlength' => 50,$required['clave']=>$required['valor'])); $elemento->setLabel('Concatenado'); $this->add($elemento); /*=========================== OBSERVACION =====================================*/ $elemento = new \Phalcon\Forms\Element\TextArea('orden_observacion', array('placeholder' => 'Escribir ...', 'class' => 'form-control', 'maxlength' => 150)); $elemento->setLabel('Observación'); $this->add($elemento); /*=========================== ORDEN DE CONFORMIDAD =====================================*/ $elemento = new Text('orden_conformidad', array('placeholder' => '', 'class' => 'form-control', 'maxlength' => 50)); $elemento->setLabel('Conformidad RE'); $this->add($elemento); /*=========================== ORDEN DE NO CONFORMIDAD =====================================*/ $elemento = new Text('orden_noConformidad', array('placeholder' => '', 'class' => 'form-control', 'maxlength' => 50)); $elemento->setLabel('Mot no Conformidad RE'); $this->add($elemento); }
/** * Utiliza select2 * @param null $entity * @param array $options */ public function initialize($entity = null, $options = array()) { /*Si el form es de creacion, los campos seran required. Viceversa.*/ $required['clave'] = "unrequired"; $required['valor'] = "true"; if (isset($options['required'])) { $required['clave'] = "required"; $required['valor'] = "true"; } /*======================= ID ==============================*/ if (!isset($options['edit'])) { $element = new Text("remito_id", array('class' => 'form-control')); $this->add($element->setLabel("ID")); } else { $this->add(new Hidden("remito_id")); } /*=========================== FECHA =====================================*/ $fecha = new Date("remito_fecha", array('class' => 'form-control', 'tabindex' => '1', $required['clave'] => $required['valor'])); $fecha->setLabel("Fecha"); $fecha->addValidators(array(new PresenceOf(array('message' => 'La fecha es Requerida')))); $this->add($fecha); /*=========================== REMITO SYA =====================================*/ $elemento = new Numeric("remito_nro", array('class' => 'form-control', 'placeholder' => 'Ingrese un valor númerico', $required['clave'] => $required['valor'], 'tabindex' => '2')); $elemento->setLabel("Remito Sya"); $elemento->setFilters(array('int')); $elemento->addValidators(array(new PresenceOf(array('message' => 'El Remito es Requerido')))); $this->add($elemento); /*=========================== TRANSPORTE =====================================*/ $elemento = new Select('remito_transporteId', Transporte::find(array('transporte_habilitado=1', 'order' => 'transporte_dominio')), array('using' => array('transporte_id', 'transporte_dominio'), 'useEmpty' => true, 'emptyText' => 'INGRESE EL DOMINIO', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', $required['clave'] => $required['valor'], 'tabindex' => '3')); $elemento->setLabel('Transporte'); $this->add($elemento); /*=========================== TIPO DE EQUIPO =====================================*/ $elemento = new Select('remito_tipoEquipoId', Tipoequipo::find(array('tipoEquipo_habilitado=1', 'order' => 'tipoEquipo_nombre')), array('using' => array('tipoEquipo_id', 'tipoEquipo_nombre'), 'useEmpty' => true, 'emptyText' => 'INGRESE EL NOMBRE', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', $required['clave'] => $required['valor'], 'tabindex' => '4')); $elemento->setLabel('Tipo de Equipo'); $this->add($elemento); /*=========================== TIPO DE CARGA =====================================*/ $elemento = new Select('remito_tipoCargaId', Tipocarga::find(array('tipoCarga_habilitado=1', 'order' => 'tipoCarga_nombre')), array('using' => array('tipoCarga_id', 'tipoCarga_nombre'), 'useEmpty' => true, 'emptyText' => 'INGRESE EL NOMBRE', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', $required['clave'] => $required['valor'], 'tabindex' => '5')); $elemento->setLabel('Tipo de Carga'); $this->add($elemento); /*=========================== TIPO DE CARGA =====================================*/ $elemento = new Select('remito_choferId', Chofer::find(array('chofer_habilitado=1', 'order' => 'chofer_nombreCompleto')), array('using' => array('chofer_id', 'chofer_dni'), 'useEmpty' => true, 'emptyText' => 'INGRESE EL DNI', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', $required['clave'] => $required['valor'], 'tabindex' => '6')); $elemento->setLabel('Chofer'); $this->add($elemento); /*=========================== VIAJE =====================================*/ $elemento = new Select('remito_viajeId', Viaje::find(array('viaje_habilitado=1', 'order' => 'viaje_origen')), array('using' => array('viaje_id', 'viaje_origen'), 'useEmpty' => true, 'emptyText' => 'INGRESE EL ORIGEN', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', $required['clave'] => $required['valor'], 'tabindex' => '7')); $elemento->setLabel('Viaje'); $this->add($elemento); /*=========================== CONCATENADO =====================================*/ $elemento = new Select('remito_concatenadoId', Concatenado::find(array('concatenado_habilitado=1', 'order' => 'concatenado_nombre')), array('using' => array('concatenado_id', 'concatenado_nombre'), 'useEmpty' => true, 'emptyText' => 'INGRESE EL NOMBRE', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', $required['clave'] => $required['valor'], 'tabindex' => '8')); $elemento->setLabel('Concatenado'); $this->add($elemento); /*=========================== TARIFA =====================================*/ $tarifa = ""; $tarifa_horaInicial = new Text("tarifa_horaInicial", array('class' => 'form-control', $required['clave'] => $required['valor'], 'tabindex' => '9')); $tarifa_horaInicial->setLabel("Hora Inicial"); $tarifa_horaInicial->addValidators(array(new PresenceOf(array('message' => 'La Hora Inicial es requerida')))); $this->add($tarifa_horaInicial); $tarifa_horaFinal = new Text("tarifa_horaFinal", array('class' => 'form-control', $required['clave'] => $required['valor'], 'tabindex' => '10')); $tarifa_horaFinal->setLabel("Hora Final"); $tarifa_horaFinal->addValidators(array(new PresenceOf(array('message' => 'La Hora Final es requerida')))); $this->add($tarifa_horaFinal); $tarifa_hsServicio = new Numeric('tarifa_hsServicio', array('placeholder' => 'Ingresar valor númerico', 'class' => 'form-control', 'min' => 0, 'tabindex' => '11')); $tarifa_hsServicio->setFilters(array('float')); $tarifa_hsServicio->setLabel("Horas de Servicio"); $this->add($tarifa_hsServicio); $tarifa_hsHidro = new Numeric('tarifa_hsHidro', array('placeholder' => 'Ingresar valor númerico', 'class' => 'form-control', 'min' => 0, 'tabindex' => '12')); $tarifa_hsHidro->setFilters(array('float')); $tarifa_hsHidro->setLabel("Horas de Hidro"); $this->add($tarifa_hsHidro); $tarifa_hsMalacate = new Numeric('tarifa_hsMalacate', array('placeholder' => 'Ingresar valor númerico', 'class' => 'form-control', 'min' => 0, 'tabindex' => '13')); $tarifa_hsMalacate->setFilters(array('float')); $tarifa_hsMalacate->setLabel("Horas de Malacate"); $this->add($tarifa_hsMalacate); $tarifa_hsStand = new Numeric('tarifa_hsStand', array('placeholder' => 'Ingresar valor númerico', 'class' => 'form-control', 'min' => 0, 'tabindex' => '14')); $tarifa_hsStand->setFilters(array('float')); $tarifa_hsStand->setLabel("Horas Stand"); $this->add($tarifa_hsStand); $tarifa_km = new Numeric('tarifa_km', array('placeholder' => 'Ingresar valor númerico', 'class' => 'form-control', 'min' => 0, 'tabindex' => '15')); $tarifa_km->setFilters(array('float')); $tarifa_km->setLabel("Kilometros"); $this->add($tarifa_km); if ($entity != null) { $tarifa = $entity->getTarifa(); $tarifa_horaInicial->setDefault($tarifa->getTarifaHoraInicial()); $tarifa_horaFinal->setDefault($tarifa->getTarifaHoraFinal()); $tarifa_hsServicio->setDefault($tarifa->getTarifaHsservicio()); $tarifa_hsHidro->setDefault($tarifa->getTarifaHshidro()); $tarifa_hsMalacate->setDefault($tarifa->getTarifaHsmalacate()); $tarifa_hsStand->setDefault($tarifa->getTarifaHsstand()); $tarifa_km->setDefault($tarifa->getTarifaKm()); } /*======================= YACIMIENTO ==============================*/ $elemento = new Select('yacimiento_id', Yacimiento::find(array('yacimiento_habilitado=1', 'order' => 'yacimiento_destino')), array('using' => array('yacimiento_id', 'yacimiento_destino'), 'useEmpty' => false, 'emptyText' => 'INGRESE EL DESTINO', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', $required['clave'] => $required['valor'])); $elemento->setDefault($entity->getOperadora()->getYacimiento()->getYacimientoId()); $elemento->setLabel('Yacimiento'); $this->add($elemento); /*=========================== OPERADORA =====================================*/ $elemento = new Select('remito_operadoraId', Operadora::find(array('operadora_habilitado=1', 'order' => 'operadora_nombre')), array('using' => array('operadora_id', 'operadora_nombre'), 'useEmpty' => false, 'emptyText' => 'INGRESE LA OPERADORA', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', $required['clave'] => $required['valor'])); $elemento->setLabel('Operadora'); $this->add($elemento); /*======================= EQUIPO POZO ==============================*/ $elemento = new Select('remito_equipoPozoId', Equipopozo::find(array('equipoPozo_habilitado=1', 'order' => 'equipoPozo_nombre')), array('using' => array('equipoPozo_id', 'equipoPozo_nombre'), 'useEmpty' => false, 'emptyText' => 'INGRESE EL EQUIPO/POZO', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', $required['clave'] => $required['valor'])); $elemento->setLabel('Equipo/Pozo'); $this->add($elemento); /*======================= LINEA ==============================*/ $elemento = new Select('centroCosto_lineaId', Linea::find(array('linea_habilitado=1', 'order' => 'linea_nombre')), array('using' => array('linea_id', 'linea_nombre'), 'useEmpty' => false, 'emptyText' => 'INGRESE LA LINEA', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', $required['clave'] => $required['valor'])); $elemento->setDefault($entity->getCentroCosto()->getLinea()->getLineaId()); $elemento->setLabel('Linea'); $this->add($elemento); /*======================= CENTROCOSTO ==============================*/ $elemento = new Select('remito_centroCostoId', Centrocosto::find(array('centroCosto_habilitado=1', 'order' => 'centroCosto_codigo')), array('using' => array('centroCosto_id', 'centroCosto_codigo'), 'useEmpty' => false, 'emptyText' => 'INGRESE EL CODIGO', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', $required['clave'] => $required['valor'])); $elemento->setLabel('Centro de Costo'); $this->add($elemento); /*=========================== ORDEN DE CONFORMIDAD =====================================*/ $elemento = new Text('remito_conformidad', array('placeholder' => '', 'class' => 'form-control', 'maxlength' => 50, 'tabindex' => '16')); $elemento->setLabel('Conformidad RE'); $this->add($elemento); /*=========================== ORDEN DE NO CONFORMIDAD =====================================*/ $elemento = new Text('remito_noConformidad', array('placeholder' => '', 'class' => 'form-control', 'maxlength' => 50, 'tabindex' => '17')); $elemento->setLabel('Mot no Conformidad RE'); $this->add($elemento); /*=========================== OBSERVACION =====================================*/ $elemento = new \Phalcon\Forms\Element\TextArea('remito_observacion', array('placeholder' => 'INGRESAR UNA OBSERVACIÓN', 'class' => 'form-control', 'maxlength' => 150, 'tabindex' => '18')); $elemento->setLabel('Observación'); $this->add($elemento); /*=========================== CONTINUA =====================================*/ $elemento = new Numeric("remito_continua", array('class' => 'form-control', 'placeholder' => 'INGRESE EL NRO REMITO', 'tabindex' => '15')); $elemento->setLabel("EL REMITO CONTINUA EN:"); $elemento->setFilters(array('int')); $this->add($elemento); }
function initialize($entity = null, $options = null) { $date = new Date('date_found'); $date->setLabel('Input Date Found'); $date->setFilters(array('striptags', 'string')); $this->add($date); /*====================== Number =====================*/ $number = new Text('number'); $number->setLabel('Input Number'); $number->setFilters(array('striptags', 'string')); $number->addValidators(array(new PresenceOf(array('message' => 'Number is required')))); $this->add($number); /*====================== Solved =====================*/ $isSolved = new Radio('is_solved', array('name' => 'is_solved', 'value' => '1')); $isSolved->setLabel('Is Solved'); $isSolved->addValidators(array(new PresenceOf(array('message' => 'Is solved is required')))); $this->add($isSolved); $isSolved2 = new Radio('is_solved2', array('name' => 'is_solved', 'value' => '0', 'checked' => TRUE)); $isSolved2->setLabel('Is Solved2'); $isSolved2->addValidators(array(new PresenceOf(array('message' => 'Is solved is required')))); $this->add($isSolved2); $systemId = new Select('system_id', Systems::find(), array('using' => array('id', 'name'), 'useEmpty' => true)); $systemId->setLabel('Select System'); $systemId->addValidators(array(new PresenceOf(array('message' => 'System is required')))); if ($entity) { $systemId->setDefault(array($entity->system_id)); } $this->add($systemId); $modulesId = new Select('modules_id', Modules::find(), array('using' => array('id', 'name'), 'useEmpty' => true)); $modulesId->setLabel('Select Modules'); $modulesId->addValidators(array(new PresenceOf(array('message' => 'Modules is required')))); if ($entity) { $modulesId->setDefault(array($entity->modules_id)); } $this->add($modulesId); /*===== Bug =============*/ $systemId = new Select('system_id', Systems::find(), array('using' => array('id', 'name'), 'useEmpty' => true)); $systemId->setLabel('Select System'); $systemId->addValidators(array(new PresenceOf(array('message' => 'System is required')))); if ($entity) { $systemId->setDefault(array($entity->system_id)); } $this->add($systemId); $description = new TextArea('description'); $description->setLabel('Input Description'); $description->addValidators(array(new PresenceOf(array('message' => 'Description is required')))); $this->add($description); $hidden = new Hidden('id'); if ($entity) { $hidden->setDefault(array($entity->id)); } $this->add($hidden); }