<?php
/**
 * @package DJ-Catalog2
 * @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email contact@dj-extensions.com
 *
 */

// no direct access
defined('_JEXEC') or die;

//Joomla\CMS\HTML\HTMLHelper::_('bootstrap.tooltip');

$listOrder = strtolower($this->state->get('list.ordering'));
$listDirn = strtolower($this->state->get('list.direction'));

?>
<form action="<?php echo JRoute::_('index.php?option=com_djcatalog2&view=customers');?>" method="post" name="adminForm" id="adminForm">
<div class="row">
    <div id="j-sidebar-container" class="col-md-2">
        <?php echo $this->sidebar; ?>
    </div>
    <div id="j-main-container" class="col-md-10">
            
            <?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
            
            <div class="clearfix"> </div>
            <table class="table table-striped">
                <thead>
                <tr>
                    <th width="1%" class="hidden-phone">
                        <input type="checkbox" name="checkall-toggle" value="" title="<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>" onclick="Joomla.checkAll(this)" />
                    </th>
                    <th class="left">
                        <?php echo Joomla\CMS\HTML\HTMLHelper::_('searchtools.sort', 'COM_DJCATALOG2_JUSER', 'u.username' , $listDirn, $listOrder); ?>
                    </th>
                    <th width="15%">
                        <?php echo Joomla\CMS\HTML\HTMLHelper::_('searchtools.sort', 'COM_DJCATALOG2_EMAIL', 'u.email', $listDirn, $listOrder); ?>
                    </th>
                    <th colspan="5" width="50%">
                        <?php echo JText::_('COM_DJCATALOG2_BILLING_DETAILS'); ?>
                    </th>
                    <th width="1%" class="nowrap">
                        <?php echo Joomla\CMS\HTML\HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'u.id', $listDirn, $listOrder); ?>
                    </th>
                </tr>
                </thead>
                <tfoot>
                <tr>
                    <td colspan="9">
                        <?php echo $this->pagination->getListFooter(); ?>
                    </td>
                </tr>
                </tfoot>
                <tbody>
                <?php

                foreach ($this->items as $i => $item) :
                    ?>
                    <tr class="row<?php echo $i % 2; ?>">

                        <td class="center">
                            <?php if(isset($item->_user_id)) : ?>
                                <?php echo Joomla\CMS\HTML\HTMLHelper::_('grid.id', $i, (int)$item->_user_id.','.(int)$item->id); ?>
                            <?php endif; ?>
                        </td>

                        <td>
                            <?php if(isset($item->username)) : ?>
                                <span class="editlinktip hasTip" title="<?php echo JText::_( 'COM_DJCATALOG2_EDIT_TOOLTIP' );?>::<?php echo $this->escape($item->username); ?>">
                            <a href="<?php echo JRoute::_('index.php?option=com_users&task=user.edit&id='.$item->_user_id);?>">
                                <?php echo $this->escape($item->username); ?></a>
                        </span>

                                <?php
                                /*?>
                                <span class="editlinktip hasTip" title="<?php echo JText::_( 'COM_DJCATALOG2_EDIT_TOOLTIP' );?>::<?php echo $this->escape($item->username); ?>">
                                    <a href="<?php echo JRoute::_('index.php?option=com_djcatalog2&task=customer.edit&cid[]='.(int)$item->_user_id.','.(empty($item->id) ? 0 : (int)$item->id));  ?>">
                                    <?php echo $item->username; ?></a>
                                </span>
                                <?php */ ?>

                                <p class="smallsub">
                                    <?php echo $this->escape($item->name); ?>
                                </p>
                            <?php endif; ?>
                            <?php if(isset($item->guestname)) : ?>
                                <?php echo $item->guestname; ?>
                            <?php endif;?>
                        </td>



                        <?php /* ?>
				<td class="center">

					[<a href="<?php echo JRoute::_('index.php?option=com_djcatalog2&task=customer.edit&cid[]='.(int)$item->_user_id.','.(empty($item->id) ? 0 : (int)$item->id));  ?>"><?php echo JText::_('COM_DJCATALOG2_EDIT_PROFILE'); ?></a>]
					[<a href="<?php echo JRoute::_('index.php?option=com_users&task=user.edit&id='.$item->_user_id);?>"><?php echo JText::_('COM_DJCATALOG2_EDIT_USER'); ?></a>]
				</td>
				<?php */ ?>

                        <td class="center">
                            <a href="mailto:<?php echo $this->escape($item->email); ?>"><?php echo $this->escape($item->email); ?></a>
                        </td>


                        <td class="center">
                            <?php if(isset($item->_user_id)) : ?>
                                <?php if ($item->id) { ?>
                                    <span class="editlinktip hasTip" title="<?php echo JText::_( 'COM_DJCATALOG2_EDIT_TOOLTIP' );?>::<?php echo $this->escape($item->username); ?>">
                                    <a href="<?php echo JRoute::_('index.php?option=com_djcatalog2&task=customer.edit&cid[]='.(int)$item->_user_id.','.(int)$item->id); ?>">
                                        <?php echo $item->firstname.' '.$item->lastname; ?></a>
                                </span>
                                <?php } ?>
                            <?php endif; ?>
                        </td>


                        <td class="center">
                            <?php echo $item->company; ?>
                        </td>
                        <td class="center">
                            <?php echo $item->city ? $item->postcode.' '.$item->city: ''; ?>
                        </td>
                        <td class="center">
                            <?php echo $item->address;?>
                        </td>
                        <td class="center">
                            <?php echo $item->country_name; ?>
                        </td>

                        <td class="center">
                            <?php if(isset($item->_user_id)) : ?>
                            	<?php /*?><a href="<?php echo JRoute::_('index.php?option=com_djcatalog2&task=customer.edit&cid[]='.(int)$item->_user_id.','.(empty($item->id) ? 0 : (int)$item->id)); ?>"><?php */ ?>
                                <?php echo (int) $item->_user_id; ?>
                                <?php /*?></a><?php */ ?>
                            <?php endif; ?>
                        </td>
                    </tr>
                <?php endforeach; ?>
                </tbody>
            </table>

            <div>
                <input type="hidden" name="task" value="" />
                <input type="hidden" name="boxchecked" value="0" />
                <?php echo Joomla\CMS\HTML\HTMLHelper::_('form.token'); ?>
            </div>
        </div>
</div>
</form>

