Commit 2a01a1a5 authored by Raph El's avatar Raph El

Hotfix calendar

parent 90939760
......@@ -239,6 +239,27 @@ var calendar = {
}
});
},
searchInCalendar : function(startDate, endDate){
//var paramsSearchCalendar=searchInterface.constructObjectAndUrl();
$.ajax({
type: "POST",
url: baseUrl+"/" + moduleId + "/search/geteventsforcalendar/startDate/" + startDate + "/endDate/" + endDate,
data: {},
dataType: "json",
error: function (data){
mylog.log("calendar.php globalautocomplete error", data);
},
success: function(data){
mylog.log("calendar.php globalautocomplete success", data);
if(!data){
toastr.error(data.content);
} else {
if(typeof calendar != "undefined" && searchObject.initType == "events" && searchObject.text=="")
calendar.addEvents(data.events);
}
}
});
},
searchInAgenda : function(date, format){
var today = new Date();
var start = new Date();
......@@ -257,6 +278,8 @@ var calendar = {
searchObject.startDate=(Date.parse(date)/1000);
endDate = new Date(stringDate.getFullYear(), stringDate.getMonth() + 1, 0);
searchObject.endDate=(Date.parse(endDate)/1000);
calendar.searchInCalendar(searchObject.startDate, searchObject.endDate);
}
//$("#situate-day .date-label").text(labelStr);
coInterface.scrollTo(".dayEvent");
......
......@@ -398,6 +398,8 @@ function initPageTable(number){
today = new Date(today.setHours(0));
var todayUTC0 = moment(todayMoment.format()).utcOffset("+00:00");
STARTDATE = moment(todayUTC0.format()).valueOf();
mylog.log("directory.js calculateAgendaWindow today2", typeof today, today);
mylog.log("directory.js calculateAgendaWindow todayMoment", typeof todayMoment, todayMoment.format(), todayMoment.valueOf());
mylog.log("directory.js calculateAgendaWindow todayUTC0", typeof todayUTC0, todayUTC0, todayUTC0.format(), todayUTC0.valueOf());
......@@ -4286,11 +4288,14 @@ var directory = {
}
},
initOpeningHours : function(params, allInfos) {
mylog.log("initOpeningHours");
mylog.log("initOpeningHours", params, allInfos);
var html = (notNull(allInfos)) ? "<span class='uppercase bold col-xs-12 no-padding'>"+trad.eachWeeks+"</span>" : "<span class='uppercase bold no-padding'>"+trad.each+" </span>" ;
mylog.log("initOpeningHours contextData.openingHours", params.openingHours);
if(notNull(params.openingHours) ){
count=0;
var openHour = "";
var closesHour = "";
$.each(params.openingHours, function(i,data){
mylog.log("initOpeningHours data", data, data.allDay, notNull(data));
mylog.log("initOpeningHours notNull data", notNull(data), typeof data, data.length);
......@@ -4311,13 +4316,28 @@ var directory = {
else
html += day;
}else{
if(count > 0) html+=", ";
html+= "<b style='font-variant: small-caps;' class='text-orange'>"+moment().day(dayNum).local().locale(mainLanguage).format("dddd")+"</b>";
if(count > 0) html+=", ";
var color = "text-orange";
if( (moment(agenda.getStartMoment(agenda.dayCount)).isoWeekday() - 1 ) == i ){
color = "text-red";
openHour = data.hours[i].opens;
closesHour = data.hours[i].closes;
}
html+= "<b style='font-variant: small-caps;' class='"+color+"'>"+moment().day(dayNum).local().locale(mainLanguage).format("dddd")+"</b>";
}
count++;
}
});
html += '<small class="pull-right margin-top-5"><b><i class="fa fa-clock-o"></i> '+
openHour+"-"+closesHour+"</b></small>";
} else
html = '<i>'+trad.notSpecified+'</i>';
......
......@@ -72,26 +72,8 @@ if(isset(Yii::app()->session["costum"]) && !empty($calendarParams)){
<script type="text/javascript">
jQuery(document).ready(function() {
mylog.log("calendar.php");
var paramsSearchCalendar=searchInterface.constructObjectAndUrl();
$.ajax({
type: "POST",
url: baseUrl+"/" + moduleId + "/search/geteventsforcalendar/startDate/1577995200/endDate/1580673600",
data: paramsSearchCalendar,
dataType: "json",
error: function (data){
mylog.log("calendar.php globalautocomplete error", data);
},
success: function(data){
mylog.log("calendar.php globalautocomplete success", data);
if(!data){
toastr.error(data.content);
} else {
if(typeof calendar != "undefined" && searchObject.initType == "events" && searchObject.text=="")
calendar.addEvents(data.events);
}
}
});
mylog.log("calendar.php", searchObject.startDate);
});
</script>
\ No newline at end of file
......@@ -292,9 +292,15 @@ jQuery(document).ready(function() {
window.history.pushState({},"", window.location.href+"#agenda");
calculateAgendaWindow(0);
if(typeof calendar != "undefined")
if(typeof calendar != "undefined"){
calendar.init("#profil-content-calendar");
var endDate = moment(STARTDATE).set("month", moment(STARTDATE).get("month")+1).valueOf();
var secondEndDate = Math.floor(endDate / 1000);
calendar.searchInCalendar(searchObject.startDate, secondEndDate);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment