| 4113 | efrain | 1 | <?php
 | 
        
           |  |  | 2 |   | 
        
           |  |  | 3 | $routeEvents = $this->url('calendar/events');
 | 
        
           | 7187 | efrain | 4 | $routeNextEvents = $this->url('helpers/next-events');
 | 
        
           | 4113 | efrain | 5 |   | 
        
           |  |  | 6 |   | 
        
           | 7187 | efrain | 7 | $this->inlineScript()->appendFile($this->basePath('vendors/moment/moment-with-locales.js'));
 | 
        
           | 7184 | efrain | 8 |   | 
        
           |  |  | 9 | $this->inlineScript()->appendFile($this->basePath('vendors/nprogress/nprogress.js'));
 | 
        
           |  |  | 10 | $this->headLink()->appendStylesheet($this->basePath('vendors/nprogress/nprogress.css'));
 | 
        
           |  |  | 11 |   | 
        
           | 4113 | efrain | 12 | $this->headLink()->appendStylesheet($this->basePath('vendors/fullcalendar/fullcalendar.css'));
 | 
        
           | 7178 | efrain | 13 | //$this->headLink()->appendStylesheet($this->basePath('vendors/fullcalendar-scheduler/dist/scheduler.css'));
 | 
        
           |  |  | 14 | //$this->headLink()->appendStylesheet($this->basePath('vendors/iCheck/skins/flat/green.css'));
 | 
        
           | 4113 | efrain | 15 |   | 
        
           | 7178 | efrain | 16 |   | 
        
           | 4113 | efrain | 17 | $this->inlineScript()->appendFile($this->basePath('vendors/fullcalendar/lib/moment.min.js'));
 | 
        
           |  |  | 18 | $this->inlineScript()->appendFile($this->basePath('vendors/fullcalendar/fullcalendar.js'));
 | 
        
           |  |  | 19 | $this->inlineScript()->appendFile($this->basePath('vendors/fullcalendar/locale/es-us.js'));
 | 
        
           | 7178 | efrain | 20 | //$this->inlineScript()->appendFile($this->basePath('vendors/fullcalendar-scheduler/dist/scheduler.js'));
 | 
        
           |  |  | 21 | //$this->inlineScript()->appendFile($this->basePath('vendors/iCheck/icheck.min.js'));
 | 
        
           | 4113 | efrain | 22 | $this->inlineScript()->appendFile($this->basePath('vendors/popper/umd/popper.js'));
 | 
        
           |  |  | 23 |   | 
        
           | 7197 | efrain | 24 | $this->inlineScript()->appendFile($this->basePath('vendors/jsrender/jsrender.js'));
 | 
        
           | 4113 | efrain | 25 |   | 
        
           | 7197 | efrain | 26 |   | 
        
           | 4692 | stevensc | 27 | $defaultDate = date('Y-m-d');
 | 
        
           | 4113 | efrain | 28 |   | 
        
           |  |  | 29 | $this->inlineScript()->captureStart();
 | 
        
           |  |  | 30 | echo <<<JS
 | 
        
           |  |  | 31 | jQuery( document ).ready(function( $ ) {
 | 
        
           |  |  | 32 |   | 
        
           |  |  | 33 |     var data_resources  = new Array();
 | 
        
           |  |  | 34 |     var data_events = new Array();
 | 
        
           |  |  | 35 |   | 
        
           | 7187 | efrain | 36 |     $.fn.reloadHelper = function() {
 | 
        
           |  |  | 37 |   | 
        
           |  |  | 38 |   | 
        
           |  |  | 39 |         NProgress.start();
 | 
        
           |  |  | 40 |         $.ajax({
 | 
        
           |  |  | 41 |             'dataType'  : 'json',
 | 
        
           |  |  | 42 |             'method'    : 'get',
 | 
        
           |  |  | 43 |             'url'       :  '$routeNextEvents',
 | 
        
           |  |  | 44 |             'data'      :  {
 | 
        
           |  |  | 45 |                 t : moment().unix()
 | 
        
           |  |  | 46 |             },
 | 
        
           |  |  | 47 |         }).done(function(response) {
 | 
        
           |  |  | 48 |             if(response['success']) {
 | 
        
           | 7197 | efrain | 49 |                 $('#containerNextEvents').html(
 | 
        
           |  |  | 50 |                     $('#templateNextEvents').render(response['data'])
 | 
        
           |  |  | 51 |                 );
 | 
        
           | 7187 | efrain | 52 |             } else {
 | 
        
           |  |  | 53 |                 $.fn.showError(response['data']);
 | 
        
           |  |  | 54 |             }
 | 
        
           |  |  | 55 |         }).fail(function( jqXHR, textStatus, errorThrown) {
 | 
        
           |  |  | 56 |             $.fn.showError(textStatus);
 | 
        
           |  |  | 57 |         }).always(function() {
 | 
        
           |  |  | 58 |             NProgress.done();
 | 
        
           |  |  | 59 |         });
 | 
        
           |  |  | 60 |     }
 | 
        
           |  |  | 61 |   | 
        
           | 7180 | efrain | 62 |     $.fn.openBackend = function(url) {
 | 
        
           |  |  | 63 |         NProgress.start();
 | 
        
           |  |  | 64 |         $.ajax({
 | 
        
           |  |  | 65 |             'dataType'  : 'json',
 | 
        
           |  |  | 66 |             'method'    : 'get',
 | 
        
           | 7185 | efrain | 67 |             'url'       :  url,
 | 
        
           | 7180 | efrain | 68 |             'data'      :  $('#form').serialize(),
 | 
        
           |  |  | 69 |         }).done(function(response) {
 | 
        
           |  |  | 70 |             if(response['success']) {
 | 
        
           |  |  | 71 |               window.open(response['data'], '_backend')
 | 
        
           |  |  | 72 |             } else {
 | 
        
           |  |  | 73 |                 $.fn.showError(response['data']);
 | 
        
           |  |  | 74 |             }
 | 
        
           |  |  | 75 |         }).fail(function( jqXHR, textStatus, errorThrown) {
 | 
        
           |  |  | 76 |             $.fn.showError(textStatus);
 | 
        
           |  |  | 77 |         }).always(function() {
 | 
        
           |  |  | 78 |             NProgress.done();
 | 
        
           |  |  | 79 |         });
 | 
        
           |  |  | 80 |   | 
        
           |  |  | 81 |     }
 | 
        
           |  |  | 82 |   | 
        
           | 4113 | efrain | 83 |     $('#calendar').fullCalendar({
 | 
        
           |  |  | 84 |         header: {
 | 
        
           | 7178 | efrain | 85 |             left: 'prev,next today',
 | 
        
           |  |  | 86 |             center: 'title',
 | 
        
           |  |  | 87 |             right: 'month,agendaWeek,agendaDay,listWeek'
 | 
        
           | 4113 | efrain | 88 |           },
 | 
        
           |  |  | 89 |           defaultDate: '$defaultDate',
 | 
        
           |  |  | 90 |           editable: true,
 | 
        
           |  |  | 91 |           navLinks: true, // can click day/week names to navigate views
 | 
        
           |  |  | 92 |           eventLimit: true, // allow "more" link when too many events
 | 
        
           |  |  | 93 |           events: {
 | 
        
           |  |  | 94 |             url: '$routeEvents',
 | 
        
           |  |  | 95 |             error: function() {
 | 
        
           |  |  | 96 |               $('#script-warning').show();
 | 
        
           |  |  | 97 |             }
 | 
        
           | 7182 | efrain | 98 |           },
 | 
        
           |  |  | 99 |           eventClick: function(event) {
 | 
        
           | 7180 | efrain | 100 |             if (event.url) {
 | 
        
           |  |  | 101 |                 setTimeout(() => {
 | 
        
           |  |  | 102 |                   $.fn.openBackend(event.url)
 | 
        
           |  |  | 103 |                 }, 200);
 | 
        
           |  |  | 104 |                 return false;
 | 
        
           |  |  | 105 |             }
 | 
        
           |  |  | 106 |           },
 | 
        
           | 7183 | efrain | 107 |           eventRender: function(eventObj, \$el) {
 | 
        
           | 4113 | efrain | 108 |             $('.popover').remove();
 | 
        
           |  |  | 109 |             \$el.popover({
 | 
        
           | 4148 | efrain | 110 |                 title: eventObj.title,
 | 
        
           | 4141 | efrain | 111 |                 content: eventObj.agenda,
 | 
        
           | 7179 | efrain | 112 |                 trigger: 'click', //'hover',
 | 
        
           | 4113 | efrain | 113 |                 placement: 'top',
 | 
        
           |  |  | 114 |                 container: 'body',
 | 
        
           |  |  | 115 |                 popperOptions : {
 | 
        
           |  |  | 116 |                     removeOnDestroy: true
 | 
        
           |  |  | 117 |                 },
 | 
        
           |  |  | 118 |                 options : {
 | 
        
           |  |  | 119 |                     removeOnDestroy: true
 | 
        
           |  |  | 120 |                 },
 | 
        
           |  |  | 121 |                  html: true
 | 
        
           |  |  | 122 |             });
 | 
        
           | 4141 | efrain | 123 |         },
 | 
        
           | 4113 | efrain | 124 |   | 
        
           |  |  | 125 |     });
 | 
        
           |  |  | 126 |   | 
        
           | 7180 | efrain | 127 |     $('body').on('click', 'a.goto-backend', function(e) {
 | 
        
           |  |  | 128 |         e.preventDefault();
 | 
        
           |  |  | 129 |         var action = $(this).attr('href');
 | 
        
           | 7197 | efrain | 130 |         if(action) {
 | 
        
           |  |  | 131 |             $.fn.openBackend(action)
 | 
        
           |  |  | 132 |     }
 | 
        
           | 7180 | efrain | 133 |     });
 | 
        
           |  |  | 134 |   | 
        
           | 7188 | efrain | 135 |      $.fn.reloadHelper();
 | 
        
           | 7187 | efrain | 136 |   | 
        
           | 4131 | efrain | 137 |   | 
        
           |  |  | 138 |   | 
        
           | 4113 | efrain | 139 | });
 | 
        
           |  |  | 140 | JS;
 | 
        
           |  |  | 141 | $this->inlineScript()->captureEnd();
 | 
        
           | 7178 | efrain | 142 |   | 
        
           | 7194 | efrain | 143 | $this->headLink()->appendStylesheet('/css/calendar.css');
 | 
        
           |  |  | 144 | $this->headLink()->appendStylesheet('/look-and-field/calendar.css');
 | 
        
           |  |  | 145 |   | 
        
           | 4113 | efrain | 146 | ?>
 | 
        
           |  |  | 147 | <section class="info-page">
 | 
        
           | 7193 | efrain | 148 | 	<div class="container">
 | 
        
           |  |  | 149 | 		<div class="row">
 | 
        
           |  |  | 150 | 			<div id="calendar" class="col-12 col-md-8"></div>
 | 
        
           |  |  | 151 |   | 
        
           |  |  | 152 |    			<div id="calendar-events" class="col-12 col-md-4">
 | 
        
           |  |  | 153 | 				<div class="task-widget">
 | 
        
           |  |  | 154 | 					<div class="sd-title d-flex align-items-center justify-content-between"
 | 
        
           |  |  | 155 | 						><h3>Eventos y Tareas</h3>
 | 
        
           |  |  | 156 | 					</div>
 | 
        
           | 7197 | efrain | 157 | 					<div id="containerNextEvents" class="d-flex flex-column" style="gap: 0.5rem; max-height: 500px; overflow: hidden scroll;">
 | 
        
           |  |  | 158 |   | 
        
           | 7193 | efrain | 159 |    					</div>
 | 
        
           |  |  | 160 |    				</div>
 | 
        
           |  |  | 161 |    			</div>
 | 
        
           |  |  | 162 |    		</div>
 | 
        
           |  |  | 163 | 	</div>
 | 
        
           | 7197 | efrain | 164 | </section>
 | 
        
           |  |  | 165 |   | 
        
           |  |  | 166 | <script id="templateNextEvents" type="text/x-jsrender">
 | 
        
           | 7199 | efrain | 167 |     <a href="{{:url}}"  class="goto-backend" rel="noreferrer">
 | 
        
           | 7197 | efrain | 168 | 	   <div class="calendar-event" style="{{:textColor}}; background: {{:backgroundColor}}">
 | 
        
           | 7237 | efrain | 169 | 	       <h4><b>LABEL_EVENT: </b> {{:title}}</h4><span><b>LABEL_START: </b>{{:start}}</span>
 | 
        
           | 7197 | efrain | 170 | 	   </div>
 | 
        
           |  |  | 171 |     </a>
 | 
        
           |  |  | 172 | </script>
 | 
        
           |  |  | 173 |   | 
        
           |  |  | 174 |   |