<?php if(!class_exists('raintpl')){exit;}?><?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("header") . ( substr("header",-1,1) != "/" ? "/" : "" ) . basename("header") );?>


<?php if( $fsc->template_top ){ ?>

<?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("".$fsc->template_top."") . ( substr("".$fsc->template_top."",-1,1) != "/" ? "/" : "" ) . basename("".$fsc->template_top."") );?>

<?php }else{ ?>

<div class="container-fluid" style="margin-bottom: 10px;">
    <div class="row">
        <div class="col-sm-4">
            <span class="btn-group">
                <a class="btn btn-sm btn-default" href="<?php echo $fsc->url();?>" title="Recargar la página">
                    <i class="fa fa-refresh" aria-hidden="true"></i>
                </a>
                <?php if( $fsc->page->is_default() ){ ?>

                <a class="btn btn-sm btn-default active" href="<?php echo $fsc->url();?>&amp;default_page=FALSE" title="Marcada como página de inicio (pulsa de nuevo para desmarcar)">
                    <i class="fa fa-bookmark" aria-hidden="true"></i>
                </a>
                <?php }else{ ?>

                <a class="btn btn-sm btn-default" href="<?php echo $fsc->url();?>&amp;default_page=TRUE" title="Marcar como página de inicio">
                    <i class="fa fa-bookmark-o" aria-hidden="true"></i>
                </a>
                <?php } ?>

            </span>
            <span class="btn-group">
                <?php $loop_var1=$fsc->extensions; $counter1=-1; if($loop_var1) foreach( $loop_var1 as $key1 => $value1 ){ $counter1++; ?>

                <?php if( $value1->type=='button' ){ ?>

                <a href="index.php?page=<?php echo $value1->from;?><?php echo $value1->params;?>" class="btn btn-sm btn-default"><?php echo $value1->text;?></a>
                <?php } ?>

                <?php } ?>

            </span>
        </div>
        <div class="col-sm-8 text-right">
            <span class="h2 text-capitalize"><?php echo $fsc->page->folder;?> / <?php echo $fsc->page->title;?></span>
        </div>
    </div>
</div>
<?php } ?>


<ul class="nav nav-tabs">
    <?php $loop_var1=$fsc->tabs; $counter1=-1; if($loop_var1) foreach( $loop_var1 as $key1 => $value1 ){ $counter1++; ?>

    <?php if( $value1["name"] == $fsc->active_tab ){ ?>

    <li role="presentation" class="active">
        <a href="<?php echo $fsc->url();?>&tab=<?php echo $value1["name"];?>">
            <i class="fa <?php echo $value1["icon"];?> fa-fw" aria-hidden="true"></i>
            <span class="hidden-xs"><?php echo $value1["title"];?></span>
            <span class="badge"><?php echo $fsc->show_numero($value1["count"], 0);?></span>
        </a>
    </li>
    <?php }else{ ?>

    <li role="presentation">
        <a href="<?php echo $fsc->url();?>&tab=<?php echo $value1["name"];?>">
            <i class="fa <?php echo $value1["icon"];?> fa-fw" aria-hidden="true"></i>
            <span class="hidden-xs hidden-sm"><?php echo $value1["title"];?></span>
            <span class="badge"><?php echo $fsc->show_numero($value1["count"], 0);?></span>
        </a>
    </li>
    <?php } ?>

    <?php } ?>

</ul>

<form name="f_custom_search" action="<?php echo $fsc->url();?>&tab=<?php echo $fsc->active_tab;?>" method="post" class="form">
    <input type="hidden" name="offset" value="<?php echo $fsc->offset;?>"/>
    <div class="container-fluid" style="margin-top: 15px; margin-bottom: 10px;">
        <div class="row">
            <?php if( count($fsc->get_current_tab('buttons')) > 0 ){ ?>

            <div class="col-sm-2">
                <div class="btn-group">
                    <?php $loop_var1=$fsc->get_current_tab('buttons'); $counter1=-1; if($loop_var1) foreach( $loop_var1 as $key1 => $value1 ){ $counter1++; ?>

                    <!--<?php $icon=$this->var['icon']='';?><?php if( $value1["icon"] ){ ?><?php echo $icon='<i class="fa ' . $value1["icon"] . '" aria-hidden="true"></i>&nbsp; ';?><?php } ?>-->
                    <a href="<?php echo $value1["link"];?>" target="<?php echo $value1["target"];?>" id="<?php echo $value1["id"];?>" class="btn btn-sm <?php echo $value1["class"];?>"><?php echo $icon;?><?php echo $value1["label"];?></a>
                    <?php } ?>

                </div>
            </div>
            <?php } ?>

            <!--<?php $search_columns=$this->var['search_columns']=$fsc->get_current_tab('search_columns');?>-->
            <?php if( count($search_columns) > 0 ){ ?>

            <div class="col-sm-2">
                <div class="input-group">
                    <input class="form-control" type="text" name="query" value="<?php echo $fsc->query;?>" autocomplete="off" autofocus="" placeholder="Buscar"/>
                    <span class="input-group-btn hidden-sm">
                        <button class="btn btn-primary" type="submit">
                            <i class="fa fa-search" aria-hidden="true"></i>
                        </button>
                    </span>
                </div>
            </div>
            <?php } ?>

            <?php $loop_var1=$fsc->get_current_tab('filters'); $counter1=-1; if($loop_var1) foreach( $loop_var1 as $key1 => $value1 ){ $counter1++; ?>

            <div class="col-sm-2">
                <?php echo $value1->show();?>

            </div>
            <?php } ?>

            <!--<?php $sort_options=$this->var['sort_options']=$fsc->get_current_tab('sort_options');?>-->
            <?php if( count($sort_options) > 0 ){ ?>

            <div class="col-sm-2">
                <div class="input-group">
                    <div class="input-group-addon">
                        <i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
                    </div>
                    <select name="sort" class="form-control" onchange="this.form.submit();">
                        <?php $loop_var1=$sort_options; $counter1=-1; if($loop_var1) foreach( $loop_var1 as $key1 => $value1 ){ $counter1++; ?>

                        <?php if( $key1==$fsc->sort_option ){ ?>

                        <option value="<?php echo $key1;?>" selected=""><?php echo $value1;?></option>
                        <?php }else{ ?>

                        <option value="<?php echo $key1;?>"><?php echo $value1;?></option>
                        <?php } ?>

                        <?php } ?>

                    </select>
                </div>
            </div>
            <?php } ?>

        </div>
    </div>
</form>

<div class="table-responsive">
    <table class="table table-hover">
        <thead>
            <tr>
                <?php $loop_var1=$fsc->decoration->get_columns($fsc->active_tab); $counter1=-1; if($loop_var1) foreach( $loop_var1 as $key1 => $value1 ){ $counter1++; ?>

                <th class="<?php echo $value1["class"];?>"><?php echo $value1["title"];?></th>
                <?php } ?>

            </tr>
        </thead>
        <?php $loop_var1=$fsc->get_current_tab('cursor'); $counter1=-1; if($loop_var1) foreach( $loop_var1 as $key1 => $value1 ){ $counter1++; ?>

        <tr class="<?php echo $fsc->decoration->row_class($fsc->active_tab, $value1);?>">
            <?php $loop_var2=$fsc->decoration->get_columns($fsc->active_tab); $counter2=-1; if($loop_var2) foreach( $loop_var2 as $key2 => $value2 ){ $counter2++; ?>

            <?php echo $fsc->decoration->show($key2, $value2, $value1);?>

            <?php } ?>

        </tr>
        <?php }else{ ?>

        <tr class="warning">
            <td colspan="20">Sin resultados</td>
        </tr>
        <?php } ?>

    </table>
</div>

<div class="container-fluid">
    <div class="row">
        <div class="col-sm-12 text-center">
            <ul class="pagination">
                <?php $loop_var1=$fsc->get_pagination(); $counter1=-1; if($loop_var1) foreach( $loop_var1 as $key1 => $value1 ){ $counter1++; ?>

                <li<?php if( $value1["active"] ){ ?> class="active"<?php } ?>>
                    <a href="#" onclick="document.f_custom_search.offset.value = '<?php echo $value1["offset"];?>';document.f_custom_search.submit();"><?php echo $value1["num"];?></a>
                </li>
                <?php } ?>

            </ul>
        </div>
    </div>
</div>

<?php if( $fsc->template_bottom ){ ?>

<?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("".$fsc->template_bottom."") . ( substr("".$fsc->template_bottom."",-1,1) != "/" ? "/" : "" ) . basename("".$fsc->template_bottom."") );?>

<?php } ?>


<?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("footer") . ( substr("footer",-1,1) != "/" ? "/" : "" ) . basename("footer") );?>