I can’t capture a value and present it in a modal

Asked

Viewed 21 times

-2

I am including an agenda using fullCalendar in my system, the time has come when you need to present the value of the schedules within a modal, but I followed the step-by-step exactly as it is in the video and I can not present the value within the modal.

<?php
include("conexao.php");
include("topo.php");
$consulta = "SELECT * FROM agendamentos";
$con = mysqli_query($conn, $consulta);

?>


<script>

  document.addEventListener('DOMContentLoaded', function() {
    var calendarEl = document.getElementById('calendar');

    var calendar = new FullCalendar.Calendar(calendarEl, {
      locale: 'pt-br',
      height: '100%',
      expandRows: true,
      slotMinTime: '08:00',
      slotMaxTime: '20:00',
      headerToolbar: {
        left: 'prev,next today',
        center: 'title',
        right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'
      },

      initialView: 'dayGridMonth',
      defaultDate: Date(),
      navLinks: true, // can click day/week names to navigate views
      editable: true,
      selectable: true,
      nowIndicator: true,
      dayMaxEvents: true, // allow "more" link when too many events
      eventClick: function(event) {

        $('#visualizar #id').text(event.id);
        $('#visualizar').modal('show');
        return false;

      },
      events: [
      <?php

      while($dados = mysqli_fetch_array($con)){

        ?>
        {
          id: '<?php echo $dados['id_agendamento'];?>',
          title: '<?php echo $dados['titulo_agendamento'];?>',
          start: '<?php echo $dados['inicio_agendamento'];?>',
          end: '<?php echo $dados['fim_agendamento'];?>',
          color: '<?php echo $dados['cor_agendamento'];?>',
        },
      <?php }?>
      ]
    });

    calendar.render();
  });

</script>
<style>

#calendar-container {
  position: fixed;
  top: 70px;
  left: 215px;
  right: 215px;
  bottom: 0;
}

.fc-header-toolbar {
    /*
    the calendar will be butting up against the edges,
    but let's scoot in the header's buttons
    */
    padding-top: 1em;
    padding-left: 1em;
    padding-right: 1em;
  }

</style>
</head>
<body>

  <div id='calendar-container'>
    <div id='calendar'></div>
  </div>

 <div class="modal fade" id="visualizar" tabindex="-1" role="dialog" aria-labelledby="TituloModalCentralizado" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="TituloModalCentralizado">Agendamento</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Fechar">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <dl class="dl-horizontal">
        <dt>ID</dt>
        <dd id="id"></dd>
      </dl>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Fechar</button>
        <button type="button" class="btn btn-primary">Salvar mudanças</button>
      </div>
    </div>
  </div>
</div>
</body>
</html>

up is my code

  <dd id="id"></dd>

and here the top should take the value and present in the modal

  • what value? which modal? insert your HTML and what you want. It’s unclear. https://pt.meta.stackoverflow.com/questions/1186/como-crea-um-exemplo-m%C3%adnimo-completo-e-verific%C3%a1vel? cb=1

No answers

Browser other questions tagged

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