Lists
Connection Calendar - Calendar View
- General
- Calendar View
- Options
| Table Name |
|---|
| Calendar (tt_calendar) |
Views
| Name |
|---|
| Connected Calendar |
| Page Size | ID Query String Parameter Name | Enable Table Permissions | Key |
|---|---|---|---|
| 10 | id | true | tt_contact.id eq 'params.id' |
Metadata Filter
| Enabled |
|---|
| true |
| Enabled |
|---|
| true |
Entity Field Mappings
| Start Date Field Name | End Date Field Name | Summary Field Name | Description Field Name |
|---|---|---|---|
| Start Date (tt_startdate) | Start Date (tt_startdate) | Name (tt_name) | Name (tt_name) |
Settings
| Initial View | Time Zone Display Mode | Style | Display Time Zone |
|---|---|---|---|
| Month | Specific Time Zone | Full calendar | (GMT +00:00 Dublin, Edinburgh, Lisbon, London) |
Custom JavaScript
var createForm = "{{createForm}}";
var editForm = "{{editForm}}";
var connectionContactid = "{{params.id}}";
var lastMonth = localStorage.getItem("PreviousCalendarMonthShared")
console.log(`Last Month 1: ${lastMonth}`);
var monthsToMove = 0;
if(lastMonth != null)
{
var currentMonth = new Date()
console.log(`Last Month 1: ${lastMonth}`);
var lastMonthDate = new Date(lastMonth);
monthsToMove = monthDiff(lastMonthDate , currentMonth)
}
$( document ).ready(function() {
waitForCells()
});
function monthDiff(dateFrom, dateTo) {
return dateTo.getMonth() - dateFrom.getMonth() +
(12 * (dateTo.getFullYear() - dateFrom.getFullYear()))
}
function setMonth(date, dateName)
{
$('h4.calendar-title').text();
console.log("Month Clicked");
console.log(date);
console.log(dateName);
var NextPress = 0;
switch(dateName){
case "January":
NextPress = 0;
break;
case "February":
NextPress = 1;
break;
case "March":
NextPress = 2;
break;
case "April":
NextPress = 3;
break;
case "May":
NextPress = 4;
break;
case "June":
NextPress = 5;
break;
case "July":
NextPress = 6;
break;
case "August":
NextPress = 7;
break;
case "September":
NextPress = 8;
break;
case "October":
NextPress = 9;
break;
case "November":
NextPress = 10;
break;
case "December":
NextPress = 11;
break;
}
$('#MonthViewToggleButton').click();
console.log("Presses: " + NextPress);
for (let i = 0; i < NextPress; i++) {
$('button[data-calendar-nav="next"]').click();
console.log("Press " + i);
}
setLocalStorage();
}
function setLocalStorage() {
var sessionMonth = Date.parse($('h4.calendar-title').text());
console.log("Setting PCM: " + sessionMonth.format("MMMM yyyy"))
localStorage.setItem("PreviousCalendarMonthShared", sessionMonth.format("MMMM yyyy"));
}
function clickPrevious() {
$('button[data-calendar-nav="prev"]').click();
}
function clickNext() {
$('button[data-calendar-nav="next"]').click();
}
function waitForCells()
{
console.log(`Waiting for Cells`);
var activeView = $('button.btn-default.btn-sm.active').attr("data-calendar-view")
if($('div.cal-cell').length > 0 || $('div.cal-week-box').length > 0)
{
console.log(`monthsToMove: ${monthsToMove}`);
if(monthsToMove != 0)
{
console.log($('div.calendar.cal-context').length);
for (let i = 0; i < monthsToMove; i++) {
console.log("Changing Month");
$('button[data-calendar-nav="prev"]').click();
}
monthsToMove = 0;
}
if(activeView == "year" )
{
$('button[data-calendar-nav="prev"]').attr('onclick', null);
$('button[data-calendar-nav="next"]').attr('onclick', null);
$('button[data-calendar-nav="next"]').click();
$('button[data-calendar-nav="prev"]').click();
$('button[data-calendar-nav="prev"]').attr('onclick', 'waitForCells()');
$('button[data-calendar-nav="next"]').attr('onclick', 'waitForCells()');
var yearNumber = $('h4.calendar-title').text()
$('div.cal-cell').each(function() {
var date = $(this).find('span[data-cal-view="month"]').attr('data-cal-date');
var month = $(this).find('span[data-cal-view="month"]').text()
var monthYear = ''.concat(month, ' ', yearNumber)
$(this).attr('onclick', 'setMonth("' + date + '","' + month + '")');
});
var monthCells = $('div.cal-cell').length;
for(var i = 0; i < monthCells; i++)
{
$('div.cal-cell')[i].replaceWith($('div.cal-cell')[i].cloneNode(true));
}
$('small.badge').each(function() {
$(this).remove()
});
}
if(activeView == "month" || activeView == "week")
{
var recordsToShow = contactsRecords.split(',')
$('a.event-info').each(function() {
var itemdata = $(this).attr('data-event-id');
if(recordsToShow.includes(itemdata))
{
console.log(" ");
}
else{
$(this).remove();
}
});
$('#YearViewToggleButton').attr('onclick', 'waitForCells()');
$('#MonthViewToggleButton').attr('onclick', 'waitForCells()');
$('#WeekViewToggleButton').attr('onclick', 'waitForCells()');
$('#NavigateToToday').attr('onclick', 'waitForCells()');
$('button[data-calendar-nav="prev"]').attr('onclick', 'waitForCells()');
$('button[data-calendar-nav="next"]').attr('onclick', 'waitForCells()');
$('a.event-info').each(function() {
var eventTitle = $(this).attr('title');
$(this).text(eventTitle);
});
$('div.cal-cell').find('div.cal-day-inmonth').each(function() {
var date = $(this).find('span[data-cal-view="day"]').attr('data-cal-date');
$(this).attr('onclick', 'SelectModal("' + this.tagName + '","' + date + '")');
});
$('div.cal-cell').find('div.cal-day-outmonth').each(function() {
var date = $(this).find('span[data-cal-view="day"]').attr('data-cal-date');
var monthToCheck = Date.parse($('h4.calendar-title').text());
var outMonthDate = new Date(date);
MoveToOutMonth = monthDiff(monthToCheck , outMonthDate);
if(MoveToOutMonth == -1) {
$(this).attr('onclick', 'clickPrevious()');
}
if(MoveToOutMonth == 1) {
$(this).attr('onclick', 'clickNext()');
}
});
$('a.event-info').each(function() {
var eventText = $(this)[0].text;
console.log("event: " + eventText);
if(eventText.includes("In Country At Midnight: Yes")) { $(this).addClass("InCountry"); }
else if(eventText.includes("In Country At Midnight: No")) { $(this).addClass("OutCountry"); }
if(eventText.includes(" Working ")) { $(this).addClass("dayWorking"); }
else if(eventText.includes(" Non-Working ")) { $(this).addClass("dayNonWorking"); }
else if(eventText.includes(" Non-Working ")) { $(this).addClass("dayNonWorking"); }
else if(eventText.includes(" Absence (Sick Leave) ")) { $(this).addClass("dayAbsence"); }
else if(eventText.includes(" Annual Leave ")) { $(this).addClass("dayAnnualLeave"); }
else if(eventText.includes(" Travelling ")) { $(this).addClass("dayTravelling"); }
else if(eventText.includes(" Other ")) { $(this).addClass("dayOther"); }
else if(eventText.includes(" Maternity Leave ")) { $(this).addClass("dayMaternityLeave"); }
var updatedEventText = eventText.split('- In Country');
$(this).text(updatedEventText[0]);
var recordID = $(this).attr('data-event-id');
$(this).attr('onclick', 'SelectModal("' + this.tagName + '","' + recordID + '")');
});
$('a.cal-event-week').each(function() {
var recordID = $(this).attr('data-event-id');
$(this).attr('onclick', 'SelectModal("' + this.tagName + '","' + recordID + '")');
});
$('span.badge').each(function() {
$(this).remove()
});
var dayCells = $('div.cal-cell').length;
for(var i = 0; i < dayCells; i++)
{
$('div.cal-cell')[i].replaceWith($('div.cal-cell')[i].cloneNode(true));
}
}
setLocalStorage();
}
else{
window.setTimeout(waitForCells, 250);
}
$('div.calendar.cal-context').show();
}
Contact Calendar - Calendar View
- General
- Calendar View
- Options
| Table Name |
|---|
| Calendar (tt_calendar) |
Views
| Name |
|---|
| Contact Calendar |
| Page Size | ID Query String Parameter Name | Enable Table Permissions | Key |
|---|---|---|---|
| 10 | id | true | id |
Filter Conditions
| Portal User Attribute |
|---|
| Contact (tt_contact) |
| Enabled |
|---|
| true |
Entity Field Mappings
| Start Date Field Name | End Date Field Name | Summary Field Name | Description Field Name |
|---|---|---|---|
| Start Date (tt_startdate) | Start Date (tt_startdate) | Name (tt_name) | Name (tt_name) |
Settings
| Initial View | Time Zone Display Mode | Style | Display Time Zone |
|---|---|---|---|
| Month | Specific Time Zone | Full calendar | (GMT +00:00 Dublin, Edinburgh, Lisbon, London) |
Custom JavaScript
var createForm = "{{createForm}}";
var editForm = "{{editForm}}";
var lastMonth = localStorage.getItem("PreviousCalendarMonth")
console.log(`Last Month 1: ${lastMonth}`);
var monthsToMove = 0;
if(lastMonth != null)
{
var currentMonth = new Date()
console.log(`Last Month 1: ${lastMonth}`);
var lastMonthDate = new Date(lastMonth);
monthsToMove = monthDiff(lastMonthDate , currentMonth)
}
$( document ).ready(function() {
waitForCells();
});
function monthDiff(dateFrom, dateTo) {
return dateTo.getMonth() - dateFrom.getMonth() +
(12 * (dateTo.getFullYear() - dateFrom.getFullYear()))
}
function clickPrevious() {
$('button[data-calendar-nav="prev"]').click();
}
function clickNext() {
$('button[data-calendar-nav="next"]').click();
}
function setMonth(date, dateName)
{
$('h4.calendar-title').text();
console.log("Month Clicked");
console.log(date);
console.log(dateName);
var NextPress = 0;
switch(dateName){
case "January":
NextPress = 0;
break;
case "February":
NextPress = 1;
break;
case "March":
NextPress = 2;
break;
case "April":
NextPress = 3;
break;
case "May":
NextPress = 4;
break;
case "June":
NextPress = 5;
break;
case "July":
NextPress = 6;
break;
case "August":
NextPress = 7;
break;
case "September":
NextPress = 8;
break;
case "October":
NextPress = 9;
break;
case "November":
NextPress = 10;
break;
case "December":
NextPress = 11;
break;
}
$('#MonthViewToggleButton').click();
console.log("Presses: " + NextPress);
for (let i = 0; i < NextPress; i++) {
$('button[data-calendar-nav="next"]').click();
console.log("Press " + i);
}
setLocalStorage();
}
function setLocalStorage() {
var sessionMonth = Date.parse($('h4.calendar-title').text());
console.log("Setting PCM: " + sessionMonth.format("MMMM yyyy"))
localStorage.setItem("PreviousCalendarMonth", sessionMonth.format("MMMM yyyy"));
}
function waitForCells()
{
console.log(`Waiting for Cells`);
var activeView = $('button.btn-default.btn-sm.active').attr("data-calendar-view")
if($('div.cal-cell').length > 0 || $('div.cal-week-box').length > 0)
{
console.log(`monthsToMove: ${monthsToMove}`);
if(monthsToMove != 0)
{
console.log($('div.calendar.cal-context').length);
for (let i = 0; i < monthsToMove; i++) {
console.log("Changing Month");
$('button[data-calendar-nav="prev"]').click();
}
monthsToMove = 0;
}
if(activeView == "year" )
{
$('button[data-calendar-nav="prev"]').attr('onclick', null);
$('button[data-calendar-nav="next"]').attr('onclick', null);
$('button[data-calendar-nav="next"]').click();
$('button[data-calendar-nav="prev"]').click();
$('button[data-calendar-nav="prev"]').attr('onclick', 'waitForCells()');
$('button[data-calendar-nav="next"]').attr('onclick', 'waitForCells()');
var yearNumber = $('h4.calendar-title').text()
$('div.cal-cell').each(function() {
var date = $(this).find('span[data-cal-view="month"]').attr('data-cal-date');
var month = $(this).find('span[data-cal-view="month"]').text()
var monthYear = ''.concat(month, ' ', yearNumber)
$(this).attr('onclick', 'setMonth("' + date + '","' + month + '")');
});
var monthCells = $('div.cal-cell').length;
for(var i = 0; i < monthCells; i++)
{
$('div.cal-cell')[i].replaceWith($('div.cal-cell')[i].cloneNode(true));
}
$('small.badge').each(function() {
var badge = $(this)[0];
var badgeMonth = $(this).parent().find('span').attr('data-cal-date');
var monthStart = new Date(badgeMonth);
var monthEnd = new Date(monthStart.getFullYear(), monthStart.getMonth()+1, 0);
var badgeText = 10;
//badge.innerText = badgeText;
$(this).remove()
});
}
if(activeView == "month" || activeView == "week")
{
$('#YearViewToggleButton').attr('onclick', 'waitForCells()');
$('#MonthViewToggleButton').attr('onclick', 'waitForCells()');
$('#WeekViewToggleButton').attr('onclick', 'waitForCells()');
$('#NavigateToToday').attr('onclick', 'waitForCells()');
$('button[data-calendar-nav="prev"]').attr('onclick', 'waitForCells()');
$('button[data-calendar-nav="next"]').attr('onclick', 'waitForCells()');
$('a.event-info').each(function() {
var eventTitle = $(this).attr('title');
$(this).text(eventTitle);
});
$('div.cal-cell').find('div.cal-day-inmonth').each(function() {
var date = $(this).find('span[data-cal-view="day"]').attr('data-cal-date');
$(this).attr('onclick', 'SelectModal("' + this.tagName + '","' + date + '")');
});
$('div.cal-cell').find('div.cal-day-outmonth').each(function() {
var date = $(this).find('span[data-cal-view="day"]').attr('data-cal-date');
var monthToCheck = Date.parse($('h4.calendar-title').text());
var outMonthDate = new Date(date);
MoveToOutMonth = monthDiff(monthToCheck , outMonthDate);
if(MoveToOutMonth == -1) {
$(this).attr('onclick', 'clickPrevious()');
}
if(MoveToOutMonth == 1) {
$(this).attr('onclick', 'clickNext()');
}
});
$('a.event-info').each(function() {
var eventText = $(this)[0].text;
console.log("event: " + eventText);
if(eventText.includes("In Country At Midnight: Yes")) { $(this).addClass("InCountry"); }
else if(eventText.includes("In Country At Midnight: No")) { $(this).addClass("OutCountry"); }
if(eventText.includes(" Working ")) { $(this).addClass("dayWorking"); }
else if(eventText.includes(" Non-Working ")) { $(this).addClass("dayNonWorking"); }
else if(eventText.includes(" Non-Working ")) { $(this).addClass("dayNonWorking"); }
else if(eventText.includes(" Absence (Sick Leave) ")) { $(this).addClass("dayAbsence"); }
else if(eventText.includes(" Annual Leave ")) { $(this).addClass("dayAnnualLeave"); }
else if(eventText.includes(" Travelling ")) { $(this).addClass("dayTravelling"); }
else if(eventText.includes(" Other ")) { $(this).addClass("dayOther"); }
else if(eventText.includes(" Annual Leave ")) { $(this).addClass("dayAnnualLeave"); }
else if(eventText.includes(" Maternity Leave ")) { $(this).addClass("dayMaternityLeave"); }
var updatedEventText = eventText.split('- In Country');
$(this).text(updatedEventText[0]);
var recordID = $(this).attr('data-event-id');
$(this).attr('onclick', 'SelectModal("' + this.tagName + '","' + recordID + '")');
});
$('a.cal-event-week').each(function() {
var recordID = $(this).attr('data-event-id');
$(this).attr('onclick', 'SelectModal("' + this.tagName + '","' + recordID + '")');
});
$('span.badge').each(function() {
$(this).remove()
});
var dayCells = $('div.cal-cell').length;
for(var i = 0; i < dayCells; i++)
{
$('div.cal-cell')[i].replaceWith($('div.cal-cell')[i].cloneNode(true));
}
}
setLocalStorage();
}
else{
window.setTimeout(waitForCells, 250);
}
$('div.calendar.cal-context').show();
}