|
|
@ -90,7 +90,8 @@ const recordsAcrossAllRange = computed<{ |
|
|
|
|
|
|
|
|
|
|
|
// We fetch all the records that match the calendar ranges in a single time. |
|
|
|
// We fetch all the records that match the calendar ranges in a single time. |
|
|
|
// But not all fetched records are valid for the certain range, so we filter them out & sort them |
|
|
|
// But not all fetched records are valid for the certain range, so we filter them out & sort them |
|
|
|
const sortedFormattedData = [...formattedData.value].filter((record) => { |
|
|
|
const sortedFormattedData = [...formattedData.value] |
|
|
|
|
|
|
|
.filter((record) => { |
|
|
|
const fromDate = record.row[fromCol!.title!] ? dayjs(record.row[fromCol!.title!]) : null |
|
|
|
const fromDate = record.row[fromCol!.title!] ? dayjs(record.row[fromCol!.title!]) : null |
|
|
|
|
|
|
|
|
|
|
|
if (fromCol && endCol) { |
|
|
|
if (fromCol && endCol) { |
|
|
@ -103,6 +104,11 @@ const recordsAcrossAllRange = computed<{ |
|
|
|
} |
|
|
|
} |
|
|
|
return false |
|
|
|
return false |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
.sort((a, b) => { |
|
|
|
|
|
|
|
const aDate = dayjs(a.row[fromCol!.title!]) |
|
|
|
|
|
|
|
const bDate = dayjs(b.row[fromCol!.title!]) |
|
|
|
|
|
|
|
return aDate.isBefore(bDate) ? -1 : 1 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// If there is a start and end column, we calculate the top and height of the record based on the start and end date |
|
|
|
// If there is a start and end column, we calculate the top and height of the record based on the start and end date |
|
|
|
if (fromCol && endCol) { |
|
|
|
if (fromCol && endCol) { |
|
|
@ -145,7 +151,7 @@ const recordsAcrossAllRange = computed<{ |
|
|
|
top: `${topInPixels + 5 + startHour * 2}px`, |
|
|
|
top: `${topInPixels + 5 + startHour * 2}px`, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// We loop through every 15 minutes between the start and end date and keep track of the number of records that overlap at a given time |
|
|
|
// We loop through every 1 minutes between the start and end date and keep track of the number of records that overlap at a given time |
|
|
|
// If the number of records exceeds 4, we hide the record and show a button to view more records |
|
|
|
// If the number of records exceeds 4, we hide the record and show a button to view more records |
|
|
|
while (_startDate.isBefore(endDate)) { |
|
|
|
while (_startDate.isBefore(endDate)) { |
|
|
|
const timeKey = _startDate.format('HH:mm') |
|
|
|
const timeKey = _startDate.format('HH:mm') |
|
|
@ -203,7 +209,7 @@ const recordsAcrossAllRange = computed<{ |
|
|
|
|
|
|
|
|
|
|
|
const startDate = dayjs(record.row[fromCol.title!]) |
|
|
|
const startDate = dayjs(record.row[fromCol.title!]) |
|
|
|
|
|
|
|
|
|
|
|
let endDate = dayjs(record.row[fromCol.title!]).add(1, 'hour') |
|
|
|
let endDate = dayjs(record.row[fromCol.title!]).add(1, 'hour').add(1, 'minute') |
|
|
|
|
|
|
|
|
|
|
|
if (endDate.isAfter(scheduleEnd)) { |
|
|
|
if (endDate.isAfter(scheduleEnd)) { |
|
|
|
endDate = scheduleEnd |
|
|
|
endDate = scheduleEnd |
|
|
@ -215,7 +221,7 @@ const recordsAcrossAllRange = computed<{ |
|
|
|
let _startDate = startDate.clone() |
|
|
|
let _startDate = startDate.clone() |
|
|
|
|
|
|
|
|
|
|
|
// We loop through every minute between the start and end date and keep track of the number of records that overlap at a given time |
|
|
|
// We loop through every minute between the start and end date and keep track of the number of records that overlap at a given time |
|
|
|
while (_startDate.isBefore(endDate)) { |
|
|
|
while (_startDate.isBefore(endDate, 'minute')) { |
|
|
|
const timeKey = _startDate.format('HH:mm') |
|
|
|
const timeKey = _startDate.format('HH:mm') |
|
|
|
|
|
|
|
|
|
|
|
if (!overlaps[timeKey]) { |
|
|
|
if (!overlaps[timeKey]) { |
|
|
|