Jump to content

Put two text fields on the same line


Recommended Posts

I wanted to know how I can put the two text fields "comisionFija" and "comisionVariable" one after the other, on the same line. Currently they are shown to me one below the other. I tried to do it by adding this line of code in each text field but there was no result: 'class' => 'col-lg-6'. This is my getConfigForm() function:

protected function getConfigForm() {

    $campos = array(
        'form' => array(
            'legend' => array(
                'title' => $this->l('Settings'),
                'icon' => 'icon-cogs'
            ),
           
                
            'input' => array(
                array(
                    'type' => 'date',
                    'label' => $this->l('Desde'),
                    'name' => 'my_date_desde',
                    'required' => true,
                    //'class' => 'col-lg-6',
                    //'class' => 'my-custom-class',
                ),
                array(
                    'type' => 'date',
                    'label' => $this->l('Hasta'),
                    'name' => 'my_date_hasta',
                    'required' => true,
                    //'class' => 'col-lg-6',
                    //'class' => 'my-custom-class',
                ),
                array(
                    'type' => 'text',
                    'label' => $this->l('Comision fija'),
                    'name' => 'comisionFija',
                    'required' => true,
                    'class' => 'col-lg-6',
                ),
                array(
                    'type' => 'text',
                    'label' => $this->l('Comision variable'),
                    'name' => 'comisionVariable',
                    'required' => true,
                    'class' => 'col-lg-6',
                ),
            ),
            /*
              'submit' => array(
              'title' => $this->l('Save settings'),
              'class' => 'button btn btn-default pull-right',
              'name' => 'submitSave',
              ), */
            'buttons' => [
                [
                    'title' => $this->l('Calcular Iva'),
                    'name' => 'calcularIva',
                    'type' => 'submit',
                    'class' => 'btn btn-default pull-right',
                ],
                [
                    'title' => $this->l('Exportar a Excel'),
                    'name' => 'exportarExcel',
                    'type' => 'submit',
                    'class' => 'btn btn-default pull-right',
                ],
            ],
            
        ),
    );

    $db = \Db::getInstance();
    $sqlTipos = "select tax_name,tax_rate from order_detail group by tax_rate";
    $tipos = $db->executeS($sqlTipos);
    $i = 0;
    foreach ($tipos as $t) {

        $miCampo = array(
            'type' => 'text',
            'label' => $this->l($t['tax_name']),
            'name' => str_replace(" ", "", str_replace("%", '', $t['tax_name'])),
                //'name' => '21.000',
        );
        array_push($campos['form']['input'], $miCampo);
        $i++;
    }


    //$helper = new HelperForm(); 
    // Estilo para mostrar ambos campos en la misma línea
    //$style = '<style>label[for="comisionFija"], label[for="comisionVariable"] { display: inline-block; width: 100px; } #form-configuration .form-group { display: flex; align-items: center; }</style>';
    //$output = $style . $helper->generateForm($campos);

    return $campos;
}

And this is the link to the complete project in github:complete code

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...