<div class="row">
    <div class="col-lg-12">
        <ol class="breadcrumb">
            <?php      
            $currentAction = '';
            $agregarNuevo = '';
            if($action =='edit'){
                $sucursalAction = 'Editar Sucursal';
                $currentAction = "<li class='active'><i class='fa fa-pencil'></i> ".$_translator->_getTranslation('Editar')."</li>";
                $agregarNuevo = "<a href='Store.php' class='btn btn-sm btn-default'><i class='fa fa-plus'></i> ".$_translator->_getTranslation('Agregar sucursal')."</a>";
                $agregarNuevo .= '<hr>';
            }elseif($action =='' || $action =='insert'){
                $sucursalAction = 'Agregar Sucursal';
                $currentAction = "<li class='active'><i class='fa fa-plus'></i> ".$_translator->_getTranslation('Agregar')."</li>";
            } ?>
            <li><i class="fa fa-dashboard"></i>  <a href="<?php echo ROOT_HOST?>/Controller/Inicio.php"><?php echo $_translator->_getTranslation('Inicio')?></a></li>
            <li class="active"><i class="fa fa-map-marker"></i> <a href="<?php echo ROOT_HOST?>/Controller/Store.php?action=list"><?php echo $_translator->_getTranslation('Lista de sucursales')?></a></li>
            <li class="active"><i class="fa fa-map-marker"></i> <?php echo $_translator->_getTranslation('Sucursal')?></li>
            <?php echo $currentAction?>
        </ol>
    </div>
</div>
<div class="row">
    <div class="col-lg-12">
        <div id="flashmessenger"><?php $flashmessenger->showMessage();?></div>
        <div class="box">
            <div class="box-header"> 
                <h3><i class='fa-fw fa fa-bookmark'></i><?php echo $_translator->_getTranslation($sucursalAction);?></h3>
                <div class='box-icon'><i class='icon fa fa-tasks'></i></div>
            </div>
            <div class='box-content'>
                <div class="row">
                    <div class="col-md-12 col-xs-12 text-right">
                        <?php echo $agregarNuevo;?>                        
                        <div class="clear"></div>
                    </div> 
                    <?php 
                        echo $_form->openForm();
                        echo $_form->showActionController();
                        echo $_form->showId();
                        ?>                 
                    <div class="col-lg-6">
                        <div><?php echo $_form->showElement('nombre');?></div>                               
                        <div><?php echo $_form->showElement('direccion');?></div>                               
                        <div><?php echo $_form->showElement('ciudad');?></div> 
                        <div><?php echo $_form->showElement('estado');?></div>  
                        <div><?php echo $_form->showElement('codigopostal');?></div> 
                        <div><?php echo $_form->showElement('status');?></div>
                    </div>
                    <div class="col-lg-6">                                                     
                        <div><?php echo $_form->showElement('nombre_contacto');?></div>
                        <div><?php echo $_form->showElement('telefono');?></div>                            
                        <div><?php echo $_form->showElement('fax');?></div>
                        <div><?php echo $_form->showElement('email');?></div>
                        <div><?php echo $_form->showElement('paginaweb');?></div>                            
                        <div><?php echo $_form->showElement('logo_file');?></div>   
                    </div>  
                    <div class='clear'></div>
                    <div class='row'>
                        <hr/>
                        <?php 
                        $compraAjax = new StoreAjax();
                        $edit = null;
                        if($action=='edit'){$edit = true;}
                        $listCompraDetalles = $compraAjax->getListStoreDetails($_form->getTokenForm());?>
                        <table id='store-table' class="table table-condensed table-striped table-hover table-thead-customize table-tfoot-customize">
                            <thead>                
                                <th class="col-lg-1 text-center"><?php echo $_translator->_getTranslation('Accion')?></th>
                                <th class="col-lg-1 text-center"><?php echo $_translator->_getTranslation('Codigo');?></th>
                                <th class="col-lg-3"><?php echo $_translator->_getTranslation('Descripcion');?></th>
                                <th class="col-lg-2 text-center"><?php echo $_translator->_getTranslation('Tamaño');?></th>
                                <th class="col-lg-3 text-center"><?php echo $_translator->_getTranslation('Dias')?></th>
                                <th class="col-lg-1 text-right"><?php echo $_translator->_getTranslation('Minimo')?></th> 
                                <th class="col-lg-1 text-right"><?php echo $_translator->_getTranslation('Maximo')?></th> 
                            </thead>
                            <tbody>
                                <?php echo $listCompraDetalles['storeDetails'];?>
                            </tbody>
                            <tfoot>
                                <tr>
                                  <td></td>
                                  <td class="text-right" colspan="4"><?php echo $_translator->_getTranslation('Total');?></td>
                                  <td class="text-right"><span id='totalItemsMin'><?php echo $listCompraDetalles['totalItemsMin']?></span></td>
                                  <td class="text-right"><span id='totalItemsMax'><?php echo $listCompraDetalles['totalItemsMax']?></span></td>
                                </tr>
                            </tfoot>
                        </table>
                    </div>
                    <div class="row">
                        <?php $_form->showElement('idDetailTemp');?>
                        <div class='col-lg-3'>
                            <?php $element = $_form->getElement('days');?>
                            <div class='col-lg-12 p-a-0'><label><?php echo $element['label']?></label></div>
                            <?php echo $_form->createElement($element);?>
                        </div>                 
                        <div class='col-lg-5'>
                            <?php $element = $_form->getElement('product');?>
                            <div class='col-lg-12 p-a-0'><label><?php echo $element['label']?></label></div>
                            <?php echo $_form->createElement($element);?>
                        </div>
                        <div class='col-lg-1'>
                            <?php $element = $_form->getElement('min');?>
                            <div class='col-lg-12 p-a-0'><label><?php echo $element['label']?></label></div>
                            <?php echo $_form->createElement($element);?>
                        </div> 
                        <div class='col-lg-1'>
                            <?php $element = $_form->getElement('max');?>
                            <div class='col-lg-12 p-a-0'><label><?php echo $element['label']?></label></div>
                            <?php echo $_form->createElement($element);?>
                        </div> 
                        <div class='col-lg-1 p-t-1 m-t-2'>
                            <?php $element = $_form->getElement('buscar');?>
                            <?php echo $_form->createElement($element);?>
                        </div>
                    </div>
                    <div class="form-group m-t-3">
                        <div class="col-md-12 p-r-0 text-right">
                            <?php $element = $_form->getElement('send'); echo $_form->createOnlyElement($element);?>
                            <?php $element = $_form->getElement('cancelar'); echo $_form->createOnlyElement($element);?>                               
                        </div>
                    </div> 
                    <?php echo $_form->closeForm();?>
                </div>
            </div>
        </div>
    </div>
</div>
<style>
    label.numero_exterior{
        padding-right: 15px;
    }
</style>
<script type="text/javascript" language="javascript">
    $('#status,#days,#product').select2();
    
    $('#tblSucursals').DataTable( {paginate:true,filter:true});
    $('#tblSucursals')
            .removeClass( 'display' )
            .addClass('table table-striped table-bordered');
    
     $("#logo_file").fileinput({
        showPreview: false,
        allowedFileExtensions: ['jpg', 'png', 'gif','jpeg'],
        maxFileSize: 1000,
        showUpload:false,
        showRemove:false
    });

</script>