<?php
/**
 * @version 7.10 [rev.7.10.02]
 */
?>
<nav class="navbar navbar-filter">
    <form class="navbar-form navbar-right"
          action="<?php echo $this->url(array('action' => 'browse'), null, true, array('page')); ?>" method="get">
        <div class="form-group">
            <?php echo $this->formElement('text', 'keywords')
                ->setAttributes(array('placeholder' => $this->_('Enter Store Name'), 'class' => 'form-control input-medium'))
                ->render();
            ?>
        </div>

        <?php echo $this->formElement('submit', 'submit', $this->_('Search'))
            ->setAttributes(array('class' => 'btn btn-default'))
            ->render();
        ?>
    </form>
</nav>

<div class="row">
    <div id="browse" class="col-sm-8">
        <?php $featuredStoresContent = $this->action('featured', 'stores', 'members'); ?>
        <?php if (!empty($featuredStoresContent)) { ?>
            <h2 class="headline">
                <span><?php echo $this->_('Featured Stores'); ?></span>
            </h2>
            <div class="featured">
                <?php echo $featuredStoresContent; ?>
            </div>
        <?php } ?>

        <div>
            <h2 class="headline">
                <span><?php echo $this->_('Search by Category'); ?></span>
            </h2>

            <div class="masonry">
                <?php foreach ($categories as $category) { ?>
                    <div class="col-sm-4 col-xs-6 item">
                        <div class="pdr-10">
                            <a href="<?php echo $this->url(array('action' => 'browse', 'parent_id' => $category['id']), null, true); ?>"><?php echo $this->_($category['name']); ?></a>
                        </div>
                    </div>
                <?php } ?>
            </div>
        </div>
    </div>
    <div class="col-sm-4">
        <?php if (count($stores) > 0) { ?>
            <div class="standard-stores">
                <h2 class="headline">
                    <span><?php echo $this->_('Standard Stores'); ?></span>
                </h2>

                <?php
                /** @var \Ppb\Db\Table\Row\User $store */
                foreach ($stores as $store) { ?>
                    <div>
                        <a href="<?php echo $this->url($store->storeLink()); ?>"><?php echo $store->storeName(); ?></a>
                    </div>
                <?php } ?>
            </div>
        <?php } ?>

        <div>
            <h2 class="headline">
                <span><?php echo $this->_('Open a Store'); ?></span>
            </h2>

            <p class="text-info"><?php echo $this->_('Would you like to have your own store?'); ?></p>

            <p><?php echo $this->_('Open a store today and reach more buyers. Our stores offer elegant design layout '
                    . 'and powerful tools to help you manage, promote and grow your business. Get on board now!'); ?>
            </p>

            <div class="text-right">
                <a class="btn btn-default"
                   href="<?php echo $this->url(array('module' => 'members', 'controller' => 'store', 'action' => 'setup')); ?>">
                    <?php echo $this->_('Open a Store'); ?></a>
            </div>
        </div>
    </div>
</div>