



<div class="carousel-inner">
<?php

$thumbnails= "";
foreach ($new_consultants as $i => $new_consultant):

    $consultant_user = $new_consultant['cb_user'];
    $consultant_name = $consultant_user->get('name');
    $emergency_consultant_plan= $new_consultant['emergency_plan'];
	$emergency_consultant_id= $new_consultant['emergency_consultant_id'];

    $img= "/images/comprofiler/". $consultant_user->get('avatar');
    $thumbnail_classes= $i==$to? 'class= active': '';
    $thumbnails .= '    <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="'. $i .'" '. $thumbnail_classes .' aria-current="true" aria-label="Slide '. $i .'" style="position:relative;">
        <img src="'. $img .'" style="position: absolute; right: 0">
    </button>';

?>




    <div class="carousel-item <?= $i==$to? 'active': ''; ?>">
            <div class="card custom-as" data-consultantid="<?=$consultant_user->get('id'); ?>" style="direction: rtl">
                <div class="card-body-custom">
                    <!-- avatar consultant -->
                    <div class="align-items-center canvas-profile-doctor d-flex gap-3">
                        <img src='/images/comprofiler/<?php echo $consultant_user->get('avatar'); ?>'>
                        <div class="card-title d-flex flex-column mb-3 name">
                            <span class="name-consultant"><?= $consultant_name; ?></span>
                            <span class="tahsilat"><?php echo $consultant_user->get('cb_tahsilat'); ?></span>
                        </div>

                    </div>
                    <div class="list-item-counsultant">
                        <div class="item-user-counsultant">
                            <div>
                                <?php //echo $Money; ?>
                                <span class="Money-counsultant txt-item-consultant"><?php echo $emergency_consultant_plan->price; ?></span>
                                <span class="toman">تومان</span>
                            </div>
                        </div>
                        <div class="item-user-counsultant">
                            <div>
                                <?php //echo $view; ?>
                                <span class="view-users txt-item-consultant"><?php echo $consultant_user->get('hits'); ?></span>
                                <span class="view-name">بازدید</span>
                            </div>
                        </div>
                    </div>
                    <!-- Consultant fee -->
                    <div class="mb-2 about-counsultant">
                        <span>تخصص</span>
                        <!-- About the teacher -->
                        <?php echo $consultant_user->get('cb_aboutme'); ?>
                    </div>
                    <!-- <div class="card-subtitle text-muted mb-4">مشاوره اورژانسی؛ زمینه </div> -->

                    <div style="text-align: center">
                        <form action="" method="post">
                            <input type="hidden" name="start_url" value="<?= JRoute::_('index.php?option=com_reservation&view=firstqst&uid=' . $emergency_consultant_id . '&pid=' . $emergency_consultant_plan->id . '', false); ?>">
                            <input type="hidden" name="step_2" value="true">
                            <button class="button-eram button-eram-start" type="submit" name="do" value="start">شروع مشاوره</button>
                            <button class="button-eram button-eram-next" type="submit" name="do" value="find_next">یافتن مشاور بعدی</button>
                            <button class="button-eram" type="submit" name="do" value="cancel">ثبت مجدد درخواست</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>


<?php endforeach; ?>
</div>

<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Next</span>
</button>



<div class="carousel-indicators" style="margin-bottom: -30px; flex-direction: row-reverse">
<?php  echo $thumbnails; ?>
</div>