1/*1790294966000*/ 2if ($(".agenda").is("#agenda-do-secretario")) { 3 function str_pad(input, pad_length, pad_string, pad_type) { 4 var half = "", 5 pad_to_go; 6 var str_pad_repeater = function (s, len) { 7 var collect = "", 8 i; 9 while (collect.length < len) { 10 collect += s; 11 } 12 collect = collect.substr(0, len); 13 return collect; 14 }; 15 input += ""; 16 pad_string = pad_string !== undefined ? pad_string : " "; 17 if ( 18 pad_type != "STR_PAD_LEFT" && 19 pad_type != "STR_PAD_RIGHT" && 20 pad_type != "STR_PAD_BOTH" 21 ) { 22 pad_type = "STR_PAD_RIGHT"; 23 } 24 if ((pad_to_go = pad_length - input.length) > 0) { 25 if (pad_type == "STR_PAD_LEFT") { 26 input = str_pad_repeater(pad_string, pad_to_go) + input; 27 } else if (pad_type == "STR_PAD_RIGHT") { 28 input = input + str_pad_repeater(pad_string, pad_to_go); 29 } else if (pad_type == "STR_PAD_BOTH") { 30 half = str_pad_repeater(pad_string, Math.ceil(pad_to_go / 2)); 31 input = half + input + half; 32 input = input.substr(0, pad_length); 33 } 34 } 35 return input; 36 } 37 38 var lstCompromissos = {}, 39 lstParticipantes = {}, 40 url = "https://agendamento.buriti.df.gov.br/calendario/publico/", 41 dtInicial = new Date().toISOString().substr(0, 10), 42 cores = { 43 month: "#12a7c0", 44 agendaWeek: "#eb6709", 45 agendaDay: "#044069", 46 listMonth: "#02b69f", 47 }, 48 calendarEl = document.getElementById("calendar"), 49 calendar = jQuery("#calendar"), 50 lstGabinetes = [ 51 { 52 name: $("#name").val(), 53 cargo: $("#cargo").val(), 54 img: $("#img").val(), 55 hash: $("#hash").val(), 56 }, 57 ]; 58 59 /** 60 * INIT: 61 * 62 * @returns {void} 63 */ 64 65 Liferay.on('allPortletsReady',function () { 66 var wdHeight = jQuery(window).height(); 67 68 renderCalendar( 69 typeof lstGabinetes[1] != "undefined" 70 ? lstGabinetes[1]["hash"] 71 : lstGabinetes[0]["hash"] 72 ); 73 resizeCalendario(wdHeight); 74 75 jQuery(".fc-right, .fc-left").addClass("hidden-xs"); 76 77 $( 78 ".paginas-internas #main-content.columns-1 > .portlet-layout > .portlet-column-only > .portlet-column-content-only > .portlet-boundary:not(.no-max-width) > .portlet" 79 ).css("maxWidth", "1170px"); 80 81 if (lstGabinetes.length > 1) { 82 for (var i = 0; i < 3; i++) { 83 jQuery(".icones-de-categoria").append( 84 _layoutImagem(lstGabinetes[i], i, i == 1 ? true : false) 85 ); 86 } 87 } else { 88 jQuery(".icones-de-categoria").append( 89 _layoutImagem(lstGabinetes[0], 0, true) 90 ); 91 jQuery(".setaEsquerda, .setaDireita").remove(); 92 } 93 }); 94 95 /** 96 * Renderiza o calendário na div especÃfica 97 * 98 * @returns {void} 99 */ 100 101 function renderCalendar(hash) { 102 jQuery(".area-agenda").removeClass("agendaVirtual"); 103 jQuery(".area-carregando").show(); 104 105 jQuery.post( 106 url, 107 { hash: hash }, 108 function (r) { 109 try { 110 lstCompromissos = r.data.lstCompromissos; 111 lstParticipantes = r.data.lstParticipantes; 112 113 if ($(".fc-toolbar").length == 0) { 114 calendarEl = document.getElementById("calendar"); 115 calendar = new FullCalendar.Calendar(calendarEl, { 116 plugins: ["interaction", "dayGrid", "list", "timeGrid"], 117 defaultView: "dayGridMonth", 118 header: { 119 left: "", 120 center: "", 121 right: "", 122 }, 123 businessHours: { 124 start: "07:00", // a start time (8am in this example) 125 end: "22:00", // an end time (6pm in this example) 126 }, 127 defaultDate: dtInicial, 128 minTime: "06:00:00", 129 maxTime: "23:00:00", 130 editable: false, 131 locale: "pt-br", 132 navLinks: true, 133 slotDuration: "00:15:00", 134 height: "1500", 135 eventLimit: false, 136 eventLimitText: "", 137 events: lstCompromissos, 138 dateClick: function (event) { 139 mudarLayoutCalendario( 140 "btnCalendar-timeGridDay", 141 "timeGridDay", 142 event.view.activeStart.toISOString().substr(0, 10) 143 ); 144 }, 145 eventClick: function (event) { 146 var html = "", 147 participantes = ""; 148 149 if (typeof lstParticipantes[event.id] != "undefined") { 150 for (var i in lstParticipantes[event.id]) { 151 participantes += 152 " - " + 153 lstParticipantes[event.id][i]["name"] + 154 "\n<br />"; 155 } 156 } 157 158 html += ` 159 <div class="d-flex justify-content-between pr-5"> 160 <div class="btnFecharMsg">X</div>
161 <span><strong>Data:</strong> ${event.event.start 162 .toISOString() 163 .substr(0, 10) 164 .split("-") 165 .reverse() 166 .join("/")}</span> 167 <span><strong>Horário:</strong> ${event.event.start 168 .toString() 169 .substr(16, 5)}</span> 170 </div> 171 <hr /> 172 <p><strong>Evento:</strong> ${event.event.title}</p> 173 <hr /> 174 <p><strong>Pauta:</strong> ${ 175 event.event._def.extendedProps.pauta 176 }</p> 177 ${ 178 participantes != "" 179 ? "<hr /><p><strong>Lista de Participantes:</strong></p>" + 180 participantes 181 : "" 182 } 183 `; 184 jQuery(".msgCalendarEvent") 185 .css({ 186 top: 187 event.jsEvent.pageY - event.jsEvent.offsetY - 603 + "px", 188 left: 189 event.jsEvent.pageX - event.jsEvent.offsetX - 100 + "px", 190 display: "block", 191 }) 192 .html(html); 193 }, 194 eventRender: function (event) { 195 $(event.el) 196 .find(".fc-list-item-title") 197 .append( 198 '<br/><div class="small"><span>Pauta:</span> ' + 199 event.event._def.extendedProps.pauta + 200 "</div>" 201 ); 202 }, 203 }); 204 calendar.render(); 205 } else { 206 calendar.addEventSource(lstCompromissos); 207 } 208 209 setTimeout(function () { 210 jQuery("#btnCalendar-title").html(calendar.view.title); 211 jQuery(".area-agenda h2").html( 212 jQuery(".imgGabinete.zoom").next().text() 213 ); 214 jQuery(".area-agenda").addClass("agendaVirtual"); 215 jQuery(".area-carregando").hide(); 216 removerScroll(); 217 }, 100); 218 } catch (e) { 219 console.log(e); 220 } //Atualiza a tela em caso de problema 221 }, 222 "json" 223 ); 224 } 225 226 /** 227 * 228 * 229 * @param {type} calendarView 230 * @returns {undefined} */ 231 232 function resizeCalendar(calendarView) { 233 calendarView.setHeight(650); 234 } 235 236 /** 237 * Função que irá redimensionar o calendário para ocupar a tela do celular do usuário 238 * 239 * @param int wdHeight 240 * @returns {undefined} 241 */ 242 243 function resizeCalendario(wdHeight) { 244 if (wdHeight + 450 >= 0) { 245 jQuery(".fc-scroller").height(wdHeight + 450); 246 } 247 } 248 249 /** 250 * Modifica o layout do calendário 251 * 252 * @param {string} btnClicked 253 * @param {string} action 254 * @param {date} changeDate 255 * @return {void} 256 */ 257 258 function mudarLayoutCalendario(btnClicked, action, changeDate) { 259 calendar.changeView(action); 260 261 if (changeDate != null) { 262 calendar.gotoDate(changeDate); 263 } 264 265 jQuery("#btnCalendar-title").html(calendar.view.title); 266 jQuery(".filtrosAgenda img.ativa").removeClass("ativa"); 267 jQuery("#" + btnClicked) 268 .children("img") 269 .addClass("ativa"); 270 jQuery(".escolhaMes").css("background-color", cores[action]); 271 if (jQuery(".menu-mobile").is(":visible")) { 272 jQuery(".filtrosAgenda").toggle(); 273 } 274 } 275 276 /** 277 * Função que será chamada para alterar as informações visÃveis do calendário. 278 * 279 * @return {undefined} 280 */ 281 282 jQuery(document).on( 283 "click", 284 "#btnCalendar-prev, #btnCalendar-next, #btnCalendar-dayGridMonth, #btnCalendar-timeGridWeek, #btnCalendar-timeGridDay, #btnCalendar-listMonth", 285 function () { 286 var idBtn = jQuery(this).attr("id"), 287 action = idBtn.substr(12), 288 leftActions = ["prev", "next"]; 289 290 if (jQuery.inArray(action, leftActions) == -1) { 291 mudarLayoutCalendario(idBtn, action, null); 292 } else { 293 if (action == "prev") { 294 calendar.prev(); 295 } else if (action == "next") { 296 calendar.next(); 297 } 298 jQuery("#btnCalendar-title").html(calendar.view.title); 299 } 300 } 301 ); 302 303 jQuery(document).on("click", ".btnFecharMsg", function () { 304 jQuery(".msgCalendarEvent").hide(); 305 }); 306 307 /** 308 * 309 * @param {type} btnClick 310 * @return {undefined} 311 */ 312 function mudarGabinete(btnClick) { 313 var gabAtivo = parseInt( 314 jQuery(".imgGabinete.zoom").parent().attr("data-id") 315 ), 316 keyProximoGab = 317 btnClick + gabAtivo < 0 318 ? lstGabinetes.length + btnClick + gabAtivo 319 : btnClick + gabAtivo > lstGabinetes.length - 1 320 ? Math.abs(btnClick + gabAtivo) - lstGabinetes.length 321 : btnClick + gabAtivo, 322 proximoGab = lstGabinetes[keyProximoGab]; 323 324 if (btnClick == -2) { 325 jQuery(".imgGabinete:first-of-type:nth(0)") 326 .addClass("zoom") 327 .next() 328 .removeClass("margin-top-negativa"); 329 jQuery(".imgGabinete:first-of-type:nth(1)") 330 .removeClass("zoom") 331 .next() 332 .addClass("margin-top-negativa"); 333 jQuery(".imgGabinete:first-of-type:nth(2)").parent().remove(); 334 jQuery(".icones-de-categoria").prepend( 335 _layoutImagem(proximoGab, keyProximoGab, false) 336 ); 337 } else { 338 jQuery(".imgGabinete:first-of-type:nth(2)") 339 .addClass("zoom") 340 .next() 341 .removeClass("margin-top-negativa"); 342 jQuery(".imgGabinete:first-of-type:nth(1)") 343 .removeClass("zoom") 344 .next() 345 .addClass("margin-top-negativa"); 346 jQuery(".imgGabinete:first-of-type:nth(0)").parent().remove(); 347 jQuery(".icones-de-categoria").append( 348 _layoutImagem(proximoGab, keyProximoGab, false) 349 ); 350 } 351 calendar.removeAllEventSources(); 352 renderCalendar( 353 lstGabinetes[jQuery(".imgGabinete.zoom").parent().attr("data-id")]["hash"] 354 ); 355 } 356 357 /** 358 * 359 * @param {int} proximoGab 360 * @param {int} key 361 * @param {bool} ativo 362 * @return {String} 363 */ 364 function _layoutImagem(proximoGab, key, ativo) { 365 var html = ` 366 <div class="imagem-do-gabinete" data-id="${key}"> 367 <img 368 src="${proximoGab["img"]}" 369 alt="Gabinete" 370 class="ImgCategoria imgGabinete ${ativo ? "zoom" : ""}" 371 /> 372 <p class="nome-autoridade ${ativo ? "" : "margin-top-negativa"}">${ 373 proximoGab["name"] 374 }</p> 375 <p class="cargo-autoridade">${proximoGab["cargo"]}</p> 376 </div> 377 `; 378 return html; 379 } 380 381 /** 382 * Função que remove a barra de rolagem para visualização de semana e diário. 383 * 384 * @return {void} 385 */ 386 function removerScroll() { 387 if ( 388 calendar.view.type == "timeGridWeek" || 389 calendar.view.type == "timeGridDay" 390 ) { 391 jQuery(".fc-scroller").css({ height: "1770px" }); 392 } 393 } 394 395 jQuery(document) 396 .on("click", ".setaEsquerda, .setaDireita", function () {
397 var btnClick = parseInt(jQuery(this).hasClass("setaEsquerda") ? -2 : 2); 398 mudarGabinete(btnClick); 399 }) 400 .on("click", ".imagem-do-gabinete:nth(0)", function () { 401 mudarGabinete(-2); 402 }) 403 .on("click", ".imagem-do-gabinete:nth(2)", function () { 404 mudarGabinete(2); 405 }); 406}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.