How to render Fullcalendar on the second page of Carousel?

Asked

Viewed 10 times

1

I have a code to show a "dynamic" carousel and inside the carousel I show some Fullcalendar charts.

The problem : only the graphics on the first page are rendered, regardless of how many I want to appear...

  <section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="card card-purple card-outline card-outline-tabs">
                <div class="card-body">
                    <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
                        <ol class="carousel-indicators">
                            <?php for ($i = 0; $i < $qtd_pages; $i++) : ?>
                                <li data-target="#carouselExampleIndicators" data-slide-to="<?= $i ?>" <?php if ($i == 0) {
                                                                                                            echo 'class="active"';
                                                                                                        } ?>></li>
                            <?php endfor ?>
                        </ol>
                        <div class="carousel-inner">
                            <?php for ($a = 0; $a < $qtd_pages; $a++) : ?>
                                <div class="carousel-item <?php if (!$a) {
                                                                echo 'active';
                                                            } ?>">
                                    <div class="row">
                                        <?php for ($count; $count < $data['qtd_graphs']; $count) : ?>
                                            <?php
                                            if (!$a) {
                                                if ($count == $qtd_por_page) {
                                                    $ind = false;
                                                    break;
                                                } else {
                                                    $ind = true;
                                                }
                                            } else {
                                                if ($count == (($a + 1) * $qtd_por_page)) {
                                                    $ind = false;
                                                    break;
                                                } else {
                                                    $ind = true;
                                                }
                                            }
                                            ?>
                                            <div class="col-lg-3" onclick="carrega_grafico('<?= $data['array_vendedores'][$count][0]['cnpj_estab'] . '?' . $data['mes'] ?>')">
                                                <div class="card">
                                                    <div class="card-header border-0">
                                                        <div class="d-flex justify-content-between">
                                                            <h3 class="card-title" style="margin-bottom:-50px!important;">
                                                                <h3 style="margin-bottom:-60px!important;  font-weight: bold;">
                                                                    <?php
                                                                    if ($data['nome_empresa']) {
                                                                        echo $data['nome_empresa'] . ' - ';
                                                                    }
                                                                    echo $data['array_vendedores'][$count][0]['vendedor'];
                                                                    ?>
                                                                </h3>
                                                            </h3>
                                                        </div>
                                                    </div>
                                                    <div id="graph_<?= $count ?>" class="calendar"></div>
                                                </div>
                                            </div>
                                            <!-- FIM GRÁFICO -->
                                            <?php if ($ind) {
                                                $count++;
                                            } ?>
                                        <?php endfor ?>
                                    </div>
                                </div>
                            <?php endfor ?>
                        </div>
                        <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
                            <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                            <span class="sr-only">Previous</span>
                        </a>
                        <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
                            <span class="carousel-control-next-icon" aria-hidden="true"></span>
                            <span class="sr-only">Next</span>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

Has a code there q makes the divisions of the pages and has tbm the js script that is made with php for each calendar...

<script>
    $(document).ready(function() {
        //array com os gráficos
        <?php for ($i = 0; $i < $data['qtd_graphs']; $i++) : ?>

            $('#graph_<?= $i ?>').fullCalendar({
                weekends: true,
                height: 500,
                firstDay: 1,
                selectable: true,
                defaultDate: '<?= $data['mes'] ?>',
                locale: 'pt-BR',
                header: {
                    left: 'title',
                    center: '',
                    right: ''
                },
                monthNames: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
                dayNamesShort: ['Dom', 'Seg', 'Ter', 'Qua',
                    'Qui', 'Sex', 'Sab'
                ],
                buttonText: {
                    today: 'hoje',
                    month: 'mês',
                    week: 'semana',
                    day: 'dia'
                },
                events: [<?php for ($e = 0; $e < sizeof($data['array_vendedores'][$i]); $e++) :
                                echo "
            {
                id: '',
                title: '',
                start: '" . $data['array_vendedores'][$i][$e]['data'] . "',
                backgroundColor:'" . $data['array_vendedores'][$i][$e]['cor'] . "',
                rendering: 'background'
            },
            ";
                            endfor; ?>]
            });

        <?php endfor ?>
    });
</script>

I can’t find anything in inspect, but I see that does not write the scripts of the ids that go to the second page.

thank you in advance...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.