<section class="chatters">

    <div class="row">
        <div class="col-12">
            <div class="card border-0">
                <div class="card-body">
                    <ul style="padding: 0;margin: 0;">

                        <?php foreach ($chatters as $chatter): ?>

                            <li class="flex-column p-2">
							<div class="d-flex">
                                <div class="image d-flex mr-3 position-relative">
                                    <?php if(isset($messageCount[$chatter->uid])):?>

                                        <?php if($messageCount[$chatter->uid]->seid== $chatter->seid):?>

                                            <span class="messageCounter">
                                     <?= $messageCount[$chatter->uid]->count;?>
                                  </span>

                                        <?php endif;?>

                                    <?php endif;?>
                                    <img src="templates/mytemp/assets/images/farzad.jpg" alt="">
                                </div>
                                <div class="info text-left">
                                    <a class="text-dark" href="#"><?= $chatter->name;?></a>
                                    <p>
                                        <?php if (isset($lastMessage[$chatter->seid])): ?>
                                            <?= mb_substr($lastMessage[$chatter->seid]->message,0,40,'UTF-8')?>
                                        ...
                                        <?php endif; ?>
                                    </p>
                                    <div>
                                        <span><span class="calender-cahtters-icon"><i class="far fa-calendar-alt"></i></span><?= Joomla\CMS\HTML\HtmlHelper::date($chatter->created, 'Y-m-d'); ?> </span>
                                        <span style="margin-right: .5rem;"><span class="time-cahtters-icon"><i class="far fa-clock"></i></span><?= Joomla\CMS\HTML\HtmlHelper::date($chatter->created, 'H:i'); ?> </span>
                                        <span style="margin-right: .5rem;"><span class="coins-cahtters-icon"><i class="fas fa-coins"></i></span><?= $chatter->price; ?> تومان</span>
                                    </div>
                                </div>
							</div>
                                <div class="button-consulting">
                                    <?php if($chatter->pay && !$chatter->finish): ?>
                                        <a href="<?= JRoute::_('index.php?option=com_reservation&view=messages&uid='. $chatter->uid.'&pid='. $chatter->pid.'&seid='.$chatter->seid ,false);?>" class="btn btn-info btn-sm">صفحه گفتگو</a>
                                    <?php elseif($chatter->pay && $chatter->finish) : ?>
                                        <a href="<?= JRoute::_('index.php?option=com_reservation&view=messages&uid='. $chatter->uid.'&pid='. $chatter->pid.'&seid='.$chatter->seid ,false);?>" class="btn btn-success btn-sm">خاتمه یافته</a>
                                    <?php else: ?>
                                        <a href="<?= JRoute::_('index.php?option=com_reservation&view=payment&seid='.$chatter->seid ,false);?>" class="btn btn-danger btn-sm">پرداخت</a>
                                    <?php endif; ?>
                                    <div>
                                        <?php if($group== 'sick'):?>
                                            <?php if ($chatter->finish==1 && !isset($comment[$chatter->seid])):?>
                                                <a href="<?= JRoute::_('index.php?option=com_reservation&view=comment&uid='.$chatter->uid.'&seid='.$chatter->seid ,false);?>" class="btn btn-warning btn-sm">ثبت نظر</a>
                                            <?php endif;?>
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </li>

                        <?php endforeach;?>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</section>