<?php 

function _inputgroup2($label,$clase,$tabla,$columnas,$nombres,$requeridos,$key,$id){
    
    $item = '<div class="form-group row">';
    $item .= '<label class="col-md-2 control-label" for="inputDefault">'.$label.'<br><a href="javascript:void(0)" id="addgroup2"><i class="fa fa-plus"></i> Agregar</a></label>';
    $item .= '<div class="col-md-10">';
                                         
    $item .= '<table style="widht:100%;" class="'.$clase.'"></table>';
                 
    
    
    $item .= '</div></div>';
    
    echo $item;
    
}


function _inputgroup($label,$clase,$tabla,$columnas,$nombres,$requeridos,$key,$id){
    
    $item = '<div class="form-group row">';
    $item .= '<label class="col-md-12 control-label" for="inputDefault">'.$label.'<br><a href="javascript:void(0)" id="addgroup"><i class="fa fa-plus"></i> Agregar</a></label>';
    $item .= '<div class="col-md-12">';
                                         
    $item .= '<table style="widht:100%;" class="'.$clase.'"></table>';
                 
    
    
    $item .= '</div></div>';
    
    echo $item;
    
}


function _inputvariable($label,$clase,$tabla,$columnas,$nombres,$requeridos,$key,$id){
    
    $item = '<div class="form-group row">';
    $item .= '<label class="col-md-2 control-label" for="inputDefault">'.$label.'<br><a href="javascript:void(0)" id="addvariable"><i class="fa fa-plus"></i> Agregar</a></label>';
    $item .= '<div class="col-md-8">';
                                         
    $item .= '<table style="widht:100%;" class="'.$clase.'"></table>';
                 
    
    
    $item .= '</div></div>';
    
    echo $item;
    
}



function _input($label,$name,$valid,$type,$value,$place,$help=''){

        $item = '<div class="form-group row">';
        $item .= '<label class="col-md-2 control-label" for="inputDefault">'.$label.'</label>';
        $item .= '<div class="col-md-8"><input name="'.$name.'" id="'.$name.'" class="form-control" type="'.$type.'" '.$valid.' value="'.$value.'" placeholder="'.$place.'">';
        $item .= '<span class="help-block">'.$help.'</span>';
        $item .= '</div>';
        $item .= '</div>';
        echo $item;
        

}



function _file($label,$name,$valid,$type,$value,$place,$showupload,$multiple,$files,$size,$help){
    
    
        if($multiple=="multiple"){ $convertmatriz = "[]";}else{ $convertmatriz="";}
        
        $item = '<div class="form-group row">';
        $item .= '<label class="col-md-2 control-label">'.$label.'</label>';
		$item .= '<div class="col-md-8">';
		$item .= '<input id="'.$name.'" name="'.$name.$convertmatriz.'" type="file" class="file" data-msg-placeholder="'.$place.'" '.$valid.' data-show-upload="'.$showupload.'" '.$multiple.' data-show-caption="true" data-allowed-file-extensions=\'['.$files.']\' data-max-file-size="'.$size.'">';
        $item .= '<span class="help-block">'.$help.'</span>';
        $item .= '</div>';
        $item .= '</div>';
        echo $item;
        
    
}


function _filebasic($label,$name,$valid,$type,$value,$multiple,$help){
    
    
  
    
        if($multiple=="multiple"){ $convertmatriz = "[]";}else{ $convertmatriz="";}
    
        $item = '<div class="form-group row">';
		$item .= '<label class="col-lg-2 control-label text-lg-right pt-2">'.$label.'</label>';
		$item .= '<div class="col-md-8">';
		$item .= '<div class="fileupload fileupload-new" data-provides="fileupload">';
		$item .= '<div class="input-append">';
		$item .= '<div class="uneditable-input">';
		$item .= '<i class="fa fa-file fileupload-exists"></i>';
		$item .= '<span class="fileupload-preview"></span>';
		$item .= '</div>';
		$item .= '<span class="btn btn-default btn-file">';
		$item .= '<span class="fileupload-exists">Cambiar</span>';
		$item .= '<span class="fileupload-new">Seleccione Archivo</span>';
		$item .= '<input type="file" name="'.$name.$convertmatriz.'" id="'.$name.'">';
        $item .= '</span>';
		$item .= '<a href="#" class="btn btn-default fileupload-exists" data-dismiss="fileupload">Quitar</a>';
		$item .= '</div>';
		$item .= '</div>';
        $item .= '<span class="help-block">'.$help.'</span>';
		$item .= '</div>';
		$item .= '</div>';
    echo $item;
    
    
}


function _fileinfinity($label,$name,$valid,$type,$value,$help){
    
        $convertmatriz = "[]";
    
    

        $item = '<div class="form-group row">';
		$item .= '<label class="col-md-2 control-label">'.$label.'</label>';
		$item .= '<div class="col-md-8">';
		$item .= '<input type="file" name="'.$name.$convertmatriz.'" id="'.$name.'">';
        $item .= '<span class="help-block">'.$help.'</span>';
		$item .= '</div>';
		$item .= '</div>';
        echo $item;
        
  
}


function _textarea($label,$name,$valid,$maxlength,$value,$place,$help){
    
    
        $item = '<div class="form-group row">';
        $item .= '<label class="col-md-2 control-label" for="textareaAutosize">'.$label.'</label>';
        $item .= '<div class="col-md-8">';
        $item .= '<textarea class="form-control" rows="3" id="'.$name.'" name="'.$name.'" data-plugin-textarea-autosize data-plugin-maxlength maxlength="'.$maxlength.'" '.$valid.'>'.$value.'</textarea>';
        $item .= '<span class="help-block">'.$help.'</span>';
        $item .= '</div>';
        $item .= '</div>';
        echo $item;
    
    
}




function _select($label,$name,$valid,$option,$value,$help,$multiple=false){
    
       
    
    
        $item = '<div class="form-group row">';
        $item .= '<label class="col-md-2 control-label" for="textareaAutosize">'.$label.'</label>';
        $item .= '<div class="col-md-8">';
        
        if($multiple){
            $item .= '<select multiple data-plugin-selectTwo class="form-control populate" name="'.$name.'[]" id="'.$name.'" '.$valid.'>';
        }else{
            $item .= '<select class="form-control input-sm mb-md" name="'.$name.'" id="'.$name.'" '.$valid.'>';   
        }
       
        $value = explode(",",$value);
		
    
        $item .='<option value=""></option>';
        $attroption='';
        if (is_array($option) || is_object($option))  {  
            foreach($option as $k => $val){
                if(in_array($k, $value)){ $selected = "selected='selected'";}else{ $selected = "";}
                $item .= '<option value="'.$k.'" '.$selected.' '.$attroption.'>'.$option[$k].'</option>';

            }
        }
        $item .= '</select>';
        $item .= '<span class="help-block">'.$help.'</span>';
        $item .= '</div>';
        $item .= '</div>';
        echo $item;
    
    
}



function _radio($label,$name,$valid,$option,$value,$help){
    
    
        $item = '<div class="form-group row">';
        $item .= '<label class="col-sm-2 control-label">'.$label.'</label>';
        $item .= '<div class="col-sm-8">';
    
        if (is_array($option) || is_object($option))  {
        foreach($option as $k => $val){
            
            if($value==$k){ $selected = "checked='checked'";}else{ $selected = "";}
            
            $item .= '<div class="radio-custom">';
            $item .= '<input id="" name="'.$name.'" type="radio" value="'.$k.'" '.$selected.'>';
            $item .= '<label for="radioExample1">'.$option[$k].'</label>';
            $item .= '</div>';
            
            
        }}
		
        $item .= '<span class="help-block">'.$help.'</span>';
        $item .= '</div></div>';
        echo $item;
    
}


function _summernote($label,$name,$valid,$maxlength,$value,$place,$help){
    
        $item = '<div class="form-group row">';
        $item .= '<label class="col-md-2 control-label" for="textareaAutosize">'.$label.'</label>';
        $item .= '<div class="col-md-8">';
        $item .= '<textarea name="'.$name.'" id="'.$name.'" class="summernote" data-plugin-summernote data-plugin-options=\'{ "height": 180, "codemirror": { "theme": "ambiance" } }\'>'.$value.'</textarea>';
        $item .= '<span class="help-block">'.$help.'</span>';
        $item .= '</div>';
        $item .= '</div>';
        echo $item;
    
}



function _geomapa($label,$lat,$lng,$address){
        
    $item = '<div class="form-group row">';
    $item .= '<label class="col-md-2 control-label" for="textareaAutosize">'.$label.'</label>';
    $item .= '<div class="col-md-8">';
    $item .= '<div class="map_canvas"></div>';
    $item .= '<input id="find" type="button" value="MOSTRAR MAPA" />';
    $item .= '<input name="lat" type="hidden" value="'.$lat.'">';
    $item .= '<input name="lng" type="hidden" value="'.$lng.'">';
    $item .= '<input name="formatted_address" type="hidden" value="'.$address.'">';
    $item .= '</div>';
    $item .= '</div>';
    echo $item;
    
}



function _datepicker($label,$name,$valid,$type,$value,$place,$help){

        $item = '<div class="form-group row">';
        $item .= '<label class="col-md-2 control-label">'.$label.'</label>';
        $item .= '<div class="col-md-3"><div class="input-group"><span class="input-group-addon"><i class="fa fa-calendar"></i></span><input type="'.$type.'" data-plugin-datepicker class="form-control" name="'.$name.'" id="'.$name.'" '.$valid.' value="'.$value.'" placeholder="'.$place.'"></div>';
        $item .= '<span class="help-block">'.$help.'</span>';
        $item .= '</div>';
        $item .= '</div>';
        echo $item;
    
}


function _timepicker($label,$name,$valid,$type,$value,$place,$help){
        
  
    
    $item = '<div class="form-group row">';
	$item .= '<label class="col-md-2 control-label">'.$label.'</label>';
	$item .= '<div class="col-md-3">';
	$item .= '<div class="input-group">';
	$item .= '<span class="input-group-addon"><i class="fa fa-clock-o"></i></span>';
    $item .= '<input type="'.$type.'" data-plugin-timepicker class="form-control" name="'.$name.'" id="'.$name.'" '.$valid.' value="'.$value.'" placeholder="'.$place.'"  data-plugin-options=\'{ "showMeridian": false }\'>';
	$item .= '</div>';
    $item .= '<span class="help-block">'.$help.'</span>';
	$item .= '</div>';
	$item .= '</div>';
     echo $item;
    
    
}





function _colorpicker($label,$name,$valid,$type,$value,$place,$help){
    
    $item = '<div class="form-group row">';
	$item .= '<label class="col-md-2 control-label">'.$label.'</label>';
	$item .= '<div class="col-md-3">';
	$item .= '<input type="'.$type.'" data-plugin-colorpicker class="colorpicker-default form-control" name="'.$name.'" id="'.$name.'" '.$valid.' value="'.$value.'" placeholder="'.$place.'" />';
    $item .= '<span class="help-block">'.$help.'</span>';
	$item .= '</div>';
	$item .= '</div>';
     echo $item;
    
    
    
}
