2021-09-01 21:26:00 +00:00
document . addEventListener ( "DOMContentLoaded" , function ( ) {
var timeZone = Intl . DateTimeFormat ( ) . resolvedOptions ( ) . timeZone ;
2021-09-01 23:17:32 +00:00
/ * v a r s l o t M i n = n e w D a t e ( " 2 0 2 1 - 0 9 - 1 3 : 1 4 : 0 0 Z " )
var slotMax = new Date ( "2021-09-13:23:30Z" )
if ( slotMax . getHours ( ) < slotMin . getHours ( ) ) {
slotMax . setHours ( 23 )
slotMax . setMinutes ( 59 )
2021-09-01 21:26:00 +00:00
}
2021-09-01 23:17:32 +00:00
console . log ( slotMin . toLocaleTimeString ( ) , slotMax . toLocaleTimeString ( ) ) * /
//document.getElementById("timezone").innerHTML=`Zona Horaria: ${timeZone}`;
var timeZoneSelectorEl = document . getElementById ( "time-zone-selector" ) ;
if ( timeZone !== "America/Montevideo" ) {
var optionEl = document . createElement ( 'option' ) ;
optionEl . value = "local" ;
optionEl . innerText = timeZone ;
timeZoneSelectorEl . appendChild ( optionEl )
}
var calendarEl = document . getElementById ( "calendar" ) ;
var calendar = new FullCalendar . Calendar ( calendarEl , {
2021-09-02 16:27:42 +00:00
schedulerLicenseKey : "CC-Attribution-NonCommercial-NoDerivatives" ,
2021-09-10 15:25:26 +00:00
eventDidMount : function ( info ) {
if ( info . backgroundColor == "gray" ) {
var tooltip = tippy ( info . el , {
content : ` ${ info . event . extendedProps . description . replaceAll ( "|" , ',<br/>' ) } ` ,
// content: `<strong>${info.event.title}</strong><br/><ul>${info.event.extendedProps.description.split('|').map(ses=>`<li>${ses}</li>`)}</ul>`,
allowHTML : true ,
} ) ;
}
else {
var tooltip = tippy ( info . el , {
content : ` <strong> ${ info . event . title } </strong><br/><strong> ${ info . event . extendedProps . speaker . nombre } </strong><br/> ${ info . event . extendedProps . description } ` ,
allowHTML : true ,
} ) ;
}
2021-09-02 16:27:42 +00:00
} ,
eventSources : [
2021-09-08 23:02:44 +00:00
{ url : "/api/eventos/cursos" , color : "#755baf" } ,
{ url : "/api/eventos/plenarias" , color : "#578e44" } ,
{ url : "/api/eventos/semiplenarias" , color : "#3383cb" } ,
{ url : "/api/eventos/publicas" , color : "#a57b00" } ,
{ url : "/api/eventos/premiados" , color : "darkred" } ,
2021-09-10 15:25:26 +00:00
{ url : "/api/eventos/sesiones/" , color : "gray" , display : 'list-item' , eventDidMount : function ( info ) {
console . log ( info )
} } ,
{ url : "/api/eventos/genero" , color : "#812c64" } ,
2021-09-02 16:27:42 +00:00
{
2021-09-02 20:07:12 +00:00
events : function ( info , success , fail ) {
2021-09-02 16:27:42 +00:00
let asamblea = {
2021-09-02 20:07:12 +00:00
title : "Asamblea UMALCA" ,
start : "2021-09-13T19:00-0300" ,
end : "2019-09-13T20:00-0300" ,
2021-09-08 23:02:44 +00:00
url : 'https://us02web.zoom.us/j/88195214460' ,
speaker : {
nombre :
"Representantes de cada una de las sociedades que integran UMALCA" ,
} ,
description :
"Estatutariamente, la asamblea reúne a los representantes de cada una de las sociedades que integran UMALCA. Las autoridades de los distintos comités (ejecutivo, científico, etc) están presentes para dar cuentas de lo actuado. No está abierta al público en general." ,
2021-09-02 20:07:12 +00:00
color : "black" ,
} ;
success ( [ asamblea ] ) ;
} ,
} ,
2021-09-02 16:27:42 +00:00
] ,
2021-09-02 20:07:12 +00:00
2021-09-02 16:27:42 +00:00
headerToolbar : {
2021-09-02 20:07:12 +00:00
center : "timeGridAll,timeGridThree,timeGridOne,listView" ,
2021-09-01 21:26:00 +00:00
} ,
2021-09-02 16:27:42 +00:00
eventTimeFormat : {
hour : "numeric" ,
minute : "2-digit" ,
meridiem : false ,
2021-09-01 21:26:00 +00:00
} ,
2021-09-02 16:27:42 +00:00
timeZone : "America/Montevideo" ,
locale : "es" ,
initialView : "timeGridAll" ,
initialDate : "2021-09-13" ,
validRange : {
start : "2021-09-13" ,
end : "2021-09-18" ,
2021-09-01 21:26:00 +00:00
} ,
2021-09-02 16:27:42 +00:00
nowIndicator : true ,
now : "2021-09-12" ,
slotMinTime : "11:00:00" ,
2021-09-02 20:07:12 +00:00
slotMaxTime : "21:00:00" ,
2021-09-02 16:27:42 +00:00
slotDuration : "00:15" ,
allDaySlot : false ,
slotLabelFormat : {
hour : "numeric" ,
minute : "2-digit" ,
omitZeroMinute : false ,
meridiem : "short" ,
2021-09-01 21:26:00 +00:00
} ,
2021-09-02 21:02:46 +00:00
eventTimeFormat : {
hour : "numeric" ,
minute : "2-digit" ,
omitZeroMinute : false ,
meridiem : "short" ,
} ,
2021-09-02 16:27:42 +00:00
eventDisplay : "block" ,
views : {
timeGridAll : {
type : "timeGrid" ,
duration : { days : 5 } ,
buttonText : "Todos los dias" ,
} ,
timeGridThree : {
type : "timeGrid" ,
duration : { days : 2 } ,
buttonText : "2 dias" ,
} ,
timeGridOne : {
type : "timeGrid" ,
duration : { days : 1 } ,
buttonText : "1 dia" ,
} ,
2021-09-02 20:07:12 +00:00
dayGridD : {
type : "dayGridDay" ,
} ,
dayGridW : {
type : "dayGridWeek" ,
duration : { days : 2 } ,
} ,
2021-09-02 21:02:46 +00:00
listView : {
type : "listWeek" ,
buttonText : "Lista" ,
duration : { days : 2 } ,
2021-09-02 20:07:12 +00:00
} ,
2021-09-01 21:26:00 +00:00
} ,
2021-09-02 16:27:42 +00:00
} ) ;
2021-09-01 21:26:00 +00:00
calendar . render ( ) ;
2021-09-10 15:25:26 +00:00
2021-09-01 23:17:32 +00:00
timeZoneSelectorEl . addEventListener ( "change" , function ( ) {
2021-09-02 19:24:05 +00:00
console . log ( calendar . getOption ( 'slotMinTime' ) )
2021-09-01 23:17:32 +00:00
calendar . setOption ( "timeZone" , this . value ) ;
2021-09-02 19:24:05 +00:00
switch ( this . value ) {
case "America/Montevideo" :
2021-09-02 21:02:46 +00:00
calendar . setOption ( "locale" , "es" ) ;
2021-09-02 19:24:05 +00:00
calendar . setOption ( "slotMinTime" , "11:00:00" ) ;
calendar . setOption ( "slotMaxTime" , "21:00:00" ) ;
calendar . setOption ( "initialDate" , "2021-09-13" ) ;
calendar . setOption ( "validRange" , {
start : "2021-09-13" ,
end : "2021-09-18" ,
} ) ;
2021-09-02 20:07:12 +00:00
calendar . changeView ( "timeGridAll" ) ;
2021-09-02 19:24:05 +00:00
break ;
case "UTC" :
2021-09-02 21:02:46 +00:00
calendar . setOption ( "locale" , "en" ) ;
2021-09-02 19:24:05 +00:00
calendar . setOption ( "slotMinTime" , "14:00:00" ) ;
calendar . setOption ( "slotMaxTime" , "23:59:00" ) ;
calendar . setOption ( "initialDate" , "2021-09-13" ) ;
calendar . setOption ( "validRange" , {
start : "2021-09-13" ,
end : "2021-09-18" ,
} ) ;
2021-09-02 20:07:12 +00:00
calendar . changeView ( "timeGridAll" ) ;
2021-09-02 19:24:05 +00:00
break ;
2021-09-02 21:02:46 +00:00
default :
calendar . setOption ( "locale" , 'en' )
2021-09-02 19:24:05 +00:00
let initial = moment ( "2021-09-13T14:00Z" ) ;
let final = moment ( "2021-09-17T23:30Z" ) ;
let offset = initial . utcOffset ( ) ;
2021-09-02 21:02:46 +00:00
calendar . setOption ( "initialDate" , initial . format ( "Y-MM-DD" ) ) ;
if ( offset > 0 && offset < 600 ) {
//calendar.setOption("slotMinTime", "initial.format("H:mm")");
calendar . setOption ( "slotMinTime" , "00:00" ) ;
//calendar.setOption("slotMaxTime", {days:1,hours:offset/60});
calendar . setOption ( "slotMaxTime" , "24:00" ) ;
calendar . changeView ( "listView" ) ;
2021-09-02 19:24:05 +00:00
}
//let currentOffset = moment().utcOffset();
//initial.add(currentOffset, "minutes");
//calendar.setOption('slotMinTime', initial.utc().format('H:mm'))
2021-09-02 21:02:46 +00:00
//calendar.setOption("slotMaxTime", {days:1,hours:currentOffset/60});
2021-09-02 19:24:05 +00:00
else {
2021-09-02 21:02:46 +00:00
calendar . setOption ( "slotMaxTime" , final . format ( "H:mm" ) ) ;
calendar . setOption ( "slotMinTime" , initial . format ( "H:mm" ) ) ;
2021-09-02 19:24:05 +00:00
}
2021-09-02 21:02:46 +00:00
2021-09-02 19:24:05 +00:00
calendar . setOption ( "validRange" , {
start : initial . format ( "Y-MM-DD" ) ,
end : final . add ( 1 , 'd' ) . format ( "Y-MM-DD" )
} ) ;
}
2021-09-01 23:17:32 +00:00
} ) ;
2021-09-01 21:26:00 +00:00
} ) ;