Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4192 | Rev 4632 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
4113 efrain 1
<?php
2
 
3
$routeEvents = $this->url('calendar/events');
4
 
4398 efrain 5
$this->headLink()->appendStylesheet($this->basePath('vendors/nprogress/nprogress.css'));
6
$this->inlineScript()->appendFile($this->basePath('vendors/nprogress/nprogress.js'));
4113 efrain 7
 
8
$this->headLink()->appendStylesheet($this->basePath('vendors/fullcalendar/fullcalendar.css'));
9
 
10
$this->inlineScript()->appendFile($this->basePath('vendors/fullcalendar/lib/moment.min.js'));
11
$this->inlineScript()->appendFile($this->basePath('vendors/fullcalendar/fullcalendar.js'));
12
$this->inlineScript()->appendFile($this->basePath('vendors/fullcalendar/locale/es-us.js'));
13
$this->inlineScript()->appendFile($this->basePath('vendors/popper/umd/popper.js'));
14
 
15
 
16
$defaultDate = date('Y-m-d');
17
 
18
$this->inlineScript()->captureStart();
19
echo <<<JS
20
jQuery( document ).ready(function( $ ) {
21
 
22
    var data_resources  = new Array();
23
    var data_events = new Array();
24
 
25
    $('#calendar').fullCalendar({
26
        header: {
27
            left: 'prev,next today',
28
            center: 'title',
29
            right: 'month,agendaWeek,agendaDay,listWeek'
30
          },
31
          defaultDate: '$defaultDate',
32
          editable: true,
33
          navLinks: true, // can click day/week names to navigate views
34
          eventLimit: true, // allow "more" link when too many events
35
          events: {
36
            url: '$routeEvents',
37
            error: function() {
38
              $('#script-warning').show();
39
            }
40
          }
41
          ,eventRender: function(eventObj, \$el) {
42
            $('.popover').remove();
43
            \$el.popover({
4148 efrain 44
                title: eventObj.title,
4141 efrain 45
                content: eventObj.agenda,
4398 efrain 46
                trigger: 'click', // 'hover',
4113 efrain 47
                placement: 'top',
48
                container: 'body',
4398 efrain 49
 
4113 efrain 50
                popperOptions : {
51
                    removeOnDestroy: true
52
                },
53
                options : {
54
                    removeOnDestroy: true
55
                },
56
                 html: true
57
            });
4141 efrain 58
        },
4113 efrain 59
 
60
    });
61
 
4398 efrain 62
 
63
 
64
    $('body').on('click', 'a.goto-backend', function(e) {
65
        e.preventDefault();
66
        var action = $(this).attr('href');
67
 
68
        NProgress.start();
69
        $.ajax({
70
            'dataType'  : 'json',
71
            'method'    : 'get',
72
            'url'       :  action,
73
            'data'      :  $('#form').serialize(),
74
        }).done(function(response) {
75
            if(response['success']) {
76
              window.open(response['data'], '_backend')
77
            } else {
78
                $.fn.showError(response['data']);
79
            }
80
        }).fail(function( jqXHR, textStatus, errorThrown) {
81
            $.fn.showError(textStatus);
82
        }).always(function() {
83
            NProgress.done();
84
        });
85
 
86
    });
87
 
88
 
89
 
4131 efrain 90
 
91
 
4113 efrain 92
});
93
JS;
94
$this->inlineScript()->captureEnd();
4188 stevensc 95
$this->inlineScript()->appendFile('/react-bundles/calendar/calendarBundle.js');
4113 efrain 96
?>
97
<section class="info-page">
4188 stevensc 98
  <div class="container">
99
    <div class="row">
100
      <div id="calendar" class="col-12 col-md-8"></div>
101
      <div id="calendar-events" class="col-12 col-md-4"></div>
102
    </div>
103
  </div>
4192 stevensc 104
</section>
105
<script>
106
  const isMobile = Boolean(window.innerWidth < 768)
107
  const row = document.querySelector('.container .row')
108
 
109
  if (isMobile) row.setAttribute('style', 'gap: 1rem;')
110
</script>