Pick up the day of the week with Fullcalendar

0

I'm working on a project where you'll have an online schedule. The user clicking on the desired date will appear this way:

Ijustwanttogetthedayoftheweek,forexample,iftheuserclicksadatethatfallsonThursday:

  

RepeatweeklyeveryThursday

Thecodelookslikethis:

<divclass="modal fade" id="cadastrar" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" data-backdrop="static">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header btn-primary">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title text-center">Informações do mês</h4>
      </div>
      <div class="modal-body">
         <form class="form-horizontal" method="post" action="#">
           <div class="form-group">
             <input type="text" id="start" name="Data" class="form-control" readonly style="font-weight: bold">
           </div>
           <div class="form-group">
             <div class="form-group">
               <label class="marcar" style="color: green">Repetir semanal a cada {colocar o dia da semana aqui!}
               <span class="checkmark"></span>
               <small id="emailInfo" class="form-text text-muted" style="font-size: 12px"><strong>Obs.:</strong> Se repetirá apenas para o mês corrente</small>
               </label>
             </div>
           </div>
           <div class="form-group">
                <textarea name="Conteudo" id="summernote" class="form-control" style="height: 300px"></textarea>
           </div>
           <div class="md-input-wrapper text-right">
                   <button class="btn btn-primary waves-effect waves-light"><i class="fas fa-save fa-lg"></i> Salvar</button>
                   <button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fas fa-times fa-lg"></i> Fechar</button>
           </div>
        </form>
      </div>
    </div>
  </div>
</div>

JQuery

<script>
  $(document).ready(function() {

   var calendar = $('#calendar').fullCalendar({

    header: {
       left: 'prev,next today',
       center: 'title',
       right: 'month,agendaWeek,agendaDay'
     },
     defaultDate: Date(),
     navLinks: true,
     editable: true,
     eventLimit: true,
     eventClick: function(event) {

       $('#visualizar #id').text(event.id);
       $('#visualizar #id').val(event.id);
       $('#visualizar #title').text(event.title);
       $('#visualizar #title').val(event.title);
       $('#visualizar #start').text(event.start.format('DD/MM/YYYY'));
       $('#visualizar #start').val(event.start.format('DD/MM/YYYY'));
       $('#visualizar #hour').text(event.start.format('HH:mm'));
       $('#visualizar #hour').val(event.start.format('HH:mm'));
       $('#visualizar #color').val(event.color);
       $('#visualizar #description').text(event.title);
       $('#visualizar #description').val(event.description);
       $('#visualizar').modal('show');
       calendar.fullCalendar('refetchEvents');
       return false;
     },
     selectable: true,
     selectHelper: true,
     select: function(start, end){

       $('#cadastrar #start').val(moment(start).format('DD/MM/YYYY'));
       $('#cadastrar #end').val(moment(end).format('DD/MM/YYYY HH:mm:ss'));
       $('#cadastrar').modal('show');
     },
     events:<?php echo $metodos->visualizarAgenda($idEmpresa); ?>,

     eventDrop:function(event)
     {
       var start = $.fullCalendar.formatDate(event.start, "Y-MM-DD HH:mm:ss");
       var title = event.title;
       var id = event.id;

      $.ajax({
       url:"cadastrar-informacoes.php",
       type:"POST",
       dataType: 'JSON',
       data:{start:start,id:id},

       success:function(sucesso){

        if(sucesso.hasEvent == false){
           $('#confirmar').modal('show');
            temporiza();
            calendar.fullCalendar('refetchEvents');
         }else{
          $('#erro').modal('show');
          temporizaErro();
         }
       }
      });
     }
   });
});
  </script>
    
asked by anonymous 10.10.2018 / 16:55

0 answers