|
|
@ -1,8 +1,8 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import dayjs from 'dayjs' |
|
|
|
import dayjs from 'dayjs' |
|
|
|
import { type ColumnType } from 'nocodb-sdk' |
|
|
|
import type { ColumnType } from 'nocodb-sdk' |
|
|
|
import type { Row } from '~/lib' |
|
|
|
import type { Row } from '~/lib' |
|
|
|
import { computed, ref, useViewColumnsOrThrow } from '#imports' |
|
|
|
import { computed, ref, useMemoize, useViewColumnsOrThrow } from '#imports' |
|
|
|
import { generateRandomNumber, isRowEmpty } from '~/utils' |
|
|
|
import { generateRandomNumber, isRowEmpty } from '~/utils' |
|
|
|
|
|
|
|
|
|
|
|
const emits = defineEmits(['expandRecord', 'newRecord']) |
|
|
|
const emits = defineEmits(['expandRecord', 'newRecord']) |
|
|
@ -14,7 +14,6 @@ const { |
|
|
|
calendarRange, |
|
|
|
calendarRange, |
|
|
|
displayField, |
|
|
|
displayField, |
|
|
|
selectedTime, |
|
|
|
selectedTime, |
|
|
|
selectedDate, |
|
|
|
|
|
|
|
updateRowProperty, |
|
|
|
updateRowProperty, |
|
|
|
sideBarFilterOption, |
|
|
|
sideBarFilterOption, |
|
|
|
showSideMenu, |
|
|
|
showSideMenu, |
|
|
@ -34,17 +33,54 @@ const fields = inject(FieldsInj, ref()) |
|
|
|
|
|
|
|
|
|
|
|
const { fields: _fields } = useViewColumnsOrThrow() |
|
|
|
const { fields: _fields } = useViewColumnsOrThrow() |
|
|
|
|
|
|
|
|
|
|
|
const getFieldStyle = (field: ColumnType | undefined) => { |
|
|
|
const fieldStyles = computed(() => { |
|
|
|
if (!field) return { underline: false, bold: false, italic: false } |
|
|
|
if (!_fields.value) return new Map() |
|
|
|
const fi = _fields.value?.find((f) => f.title === field.title) |
|
|
|
return new Map( |
|
|
|
|
|
|
|
_fields.value.map((field) => [ |
|
|
|
|
|
|
|
field.fk_column_id, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
underline: field.underline, |
|
|
|
|
|
|
|
bold: field.bold, |
|
|
|
|
|
|
|
italic: field.italic, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
]), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
const getFieldStyle = (field: ColumnType) => { |
|
|
|
underline: fi?.underline, |
|
|
|
return fieldStyles.value.get(field.id) |
|
|
|
bold: fi?.bold, |
|
|
|
} |
|
|
|
italic: fi?.italic, |
|
|
|
const calculateNewDates = useMemoize( |
|
|
|
|
|
|
|
({ |
|
|
|
|
|
|
|
startDate, |
|
|
|
|
|
|
|
endDate, |
|
|
|
|
|
|
|
scheduleStart, |
|
|
|
|
|
|
|
scheduleEnd, |
|
|
|
|
|
|
|
}: { |
|
|
|
|
|
|
|
startDate: dayjs.Dayjs |
|
|
|
|
|
|
|
endDate: dayjs.Dayjs |
|
|
|
|
|
|
|
scheduleStart: dayjs.Dayjs |
|
|
|
|
|
|
|
scheduleEnd: dayjs.Dayjs |
|
|
|
|
|
|
|
}) => { |
|
|
|
|
|
|
|
// If the end date is not valid, we set it to 15 minutes after the start date |
|
|
|
|
|
|
|
if (!endDate?.isValid()) { |
|
|
|
|
|
|
|
endDate = startDate.clone().add(15, 'minutes') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If the start date is before the start of the schedule, we set it to the start of the schedule |
|
|
|
|
|
|
|
// If the end date is after the end of the schedule, we set it to the end of the schedule |
|
|
|
|
|
|
|
// This is to ensure that the records are within the bounds of the schedule and do not overflow |
|
|
|
|
|
|
|
if (startDate.isBefore(scheduleStart, 'minutes')) { |
|
|
|
|
|
|
|
startDate = scheduleStart.clone() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (endDate.isAfter(scheduleEnd, 'minutes')) { |
|
|
|
|
|
|
|
endDate = scheduleEnd.clone() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return { startDate, endDate } |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// Since it is a datetime Week view, we need to create a 2D array of dayjs objects to represent the hours in a day for each day in the week |
|
|
|
// Since it is a datetime Week view, we need to create a 2D array of dayjs objects to represent the hours in a day for each day in the week |
|
|
|
const datesHours = computed(() => { |
|
|
|
const datesHours = computed(() => { |
|
|
|
const datesHours: Array<Array<dayjs.Dayjs>> = [] |
|
|
|
const datesHours: Array<Array<dayjs.Dayjs>> = [] |
|
|
@ -71,167 +107,178 @@ const datesHours = computed(() => { |
|
|
|
return datesHours |
|
|
|
return datesHours |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const recordsAcrossAllRange = computed<{ |
|
|
|
const getDayIndex = (date: dayjs.Dayjs) => { |
|
|
|
records: Array<Row> |
|
|
|
let dayIndex = date.day() - 1 |
|
|
|
count: { |
|
|
|
if (dayIndex === -1) { |
|
|
|
[key: string]: { |
|
|
|
dayIndex = 6 |
|
|
|
[key: string]: { |
|
|
|
|
|
|
|
id: Array<string> |
|
|
|
|
|
|
|
overflow: boolean |
|
|
|
|
|
|
|
overflowCount: number |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return dayIndex |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getGridTime = (date: dayjs.Dayjs, round = false) => { |
|
|
|
|
|
|
|
const gridCalc = date.hour() * 60 + date.minute() |
|
|
|
|
|
|
|
if (round) { |
|
|
|
|
|
|
|
return Math.ceil(gridCalc) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return Math.floor(gridCalc) |
|
|
|
} |
|
|
|
} |
|
|
|
}>(() => { |
|
|
|
|
|
|
|
if (!formattedData.value || !calendarRange.value || !container.value || !scrollContainer.value) |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
records: [], |
|
|
|
|
|
|
|
count: {}, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
const perWidth = containerWidth.value / 7 |
|
|
|
|
|
|
|
const perHeight = 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const scheduleStart = dayjs(selectedDateRange.value.start).startOf('day') |
|
|
|
const getGridTimeSlots = (from: dayjs.Dayjs, to: dayjs.Dayjs) => { |
|
|
|
const scheduleEnd = dayjs(selectedDateRange.value.end).endOf('day') |
|
|
|
return { |
|
|
|
|
|
|
|
from: getGridTime(from, false), |
|
|
|
// We need to keep track of the overlaps for each day and hour, minute in the week to calculate the width and left position of each record |
|
|
|
to: getGridTime(to, true) - 1, |
|
|
|
// The first key is the date, the second key is the hour, and the value is an object containing the ids of the records that overlap |
|
|
|
dayIndex: getDayIndex(from), |
|
|
|
// The key is in the format YYYY-MM-DD and the hour is in the format HH:mm |
|
|
|
|
|
|
|
const overlaps: { |
|
|
|
|
|
|
|
[key: string]: { |
|
|
|
|
|
|
|
[key: string]: { |
|
|
|
|
|
|
|
id: Array<string> |
|
|
|
|
|
|
|
overflow: boolean |
|
|
|
|
|
|
|
overflowCount: number |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} = {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let recordsToDisplay: Array<Row> = [] |
|
|
|
const hasSlotForRecord = ( |
|
|
|
|
|
|
|
columnArray: Row[], |
|
|
|
|
|
|
|
dates: { |
|
|
|
|
|
|
|
fromDate: dayjs.Dayjs |
|
|
|
|
|
|
|
toDate: dayjs.Dayjs |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
) => { |
|
|
|
|
|
|
|
const { fromDate, toDate } = dates |
|
|
|
|
|
|
|
|
|
|
|
calendarRange.value.forEach((range) => { |
|
|
|
if (!fromDate || !toDate) return false |
|
|
|
const fromCol = range.fk_from_col |
|
|
|
|
|
|
|
const toCol = range.fk_to_col |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// We fetch all the records that match the calendar ranges in a single time. |
|
|
|
for (const column of columnArray) { |
|
|
|
// But not all fetched records are valid for the certain range, so we filter them out & sort them |
|
|
|
const columnFromCol = column.rowMeta.range?.fk_from_col |
|
|
|
const sortedFormattedData = [...formattedData.value].filter((record) => { |
|
|
|
const columnToCol = column.rowMeta.range?.fk_to_col |
|
|
|
const fromDate = record.row[fromCol!.title!] ? dayjs(record.row[fromCol!.title!]) : null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (fromCol && toCol) { |
|
|
|
if (!columnFromCol) return false |
|
|
|
const fromDate = record.row[fromCol.title!] ? dayjs(record.row[fromCol.title!]) : null |
|
|
|
|
|
|
|
const toDate = record.row[toCol.title!] ? dayjs(record.row[toCol.title!]) : null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return fromDate && toDate && !toDate.isBefore(fromDate) |
|
|
|
const { startDate: columnFromDate, endDate: columnToDate } = calculateNewDates({ |
|
|
|
} else if (fromCol && !toCol) { |
|
|
|
startDate: dayjs(column.row[columnFromCol.title!]), |
|
|
|
return !!fromDate |
|
|
|
endDate: columnToCol |
|
|
|
} |
|
|
|
? dayjs(column.row[columnToCol.title!]) |
|
|
|
return false |
|
|
|
: dayjs(column.row[columnFromCol.title!]).add(1, 'hour').subtract(1, 'minute'), |
|
|
|
|
|
|
|
scheduleStart: dayjs(selectedDateRange.value.start).startOf('day'), |
|
|
|
|
|
|
|
scheduleEnd: dayjs(selectedDateRange.value.end).endOf('day'), |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
sortedFormattedData.forEach((record: Row) => { |
|
|
|
if ( |
|
|
|
if (!toCol && fromCol) { |
|
|
|
fromDate.isBetween(columnFromDate, columnToDate, null, '[]') || |
|
|
|
// If there is no toColumn chosen in the range |
|
|
|
toDate.isBetween(columnFromDate, columnToDate, null, '[]') |
|
|
|
const ogStartDate = record.row[fromCol.title!] ? dayjs(record.row[fromCol.title!]) : null |
|
|
|
) { |
|
|
|
if (!ogStartDate) return |
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
let endDate = ogStartDate.clone().add(1, 'hour') |
|
|
|
} |
|
|
|
|
|
|
|
return true |
|
|
|
if (endDate.isAfter(scheduleEnd, 'minutes')) { |
|
|
|
|
|
|
|
endDate = scheduleEnd |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const id = record.rowMeta.id ?? generateRandomNumber() |
|
|
|
const getMaxOverlaps = ({ |
|
|
|
|
|
|
|
row, |
|
|
|
let startDate = ogStartDate.clone() |
|
|
|
columnArray, |
|
|
|
|
|
|
|
graph, |
|
|
|
|
|
|
|
}: { |
|
|
|
|
|
|
|
row: Row |
|
|
|
|
|
|
|
columnArray: Array<Array<Array<Row>>> |
|
|
|
|
|
|
|
graph: Map<string, Set<string>> |
|
|
|
|
|
|
|
}) => { |
|
|
|
|
|
|
|
const id = row.rowMeta.id as string |
|
|
|
|
|
|
|
|
|
|
|
let style: Partial<CSSStyleDeclaration> = {} |
|
|
|
const visited: Set<string> = new Set() |
|
|
|
|
|
|
|
|
|
|
|
while (startDate.isBefore(endDate, 'minutes')) { |
|
|
|
const dayIndex = row.rowMeta.dayIndex |
|
|
|
const dateKey = startDate?.format('YYYY-MM-DD') |
|
|
|
const overlapIndex = columnArray[dayIndex].findIndex((column) => column.findIndex((r) => r.rowMeta.id === id) !== -1) + 1 |
|
|
|
const hourKey = startDate?.format('HH:mm') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If the dateKey and hourKey are valid, we add the id to the overlaps object |
|
|
|
const dfs = (id: string): number => { |
|
|
|
if (dateKey && hourKey) { |
|
|
|
visited.add(id) |
|
|
|
if (!overlaps[dateKey]) { |
|
|
|
let maxOverlaps = 1 |
|
|
|
overlaps[dateKey] = {} |
|
|
|
const neighbors = graph.get(id) |
|
|
|
|
|
|
|
if (neighbors) { |
|
|
|
|
|
|
|
for (const neighbor of neighbors) { |
|
|
|
|
|
|
|
if (maxOverlaps >= columnArray[dayIndex].length) return maxOverlaps |
|
|
|
|
|
|
|
if (!visited.has(neighbor)) { |
|
|
|
|
|
|
|
maxOverlaps = Math.min(Math.max(maxOverlaps, dfs(neighbor) + 1), columnArray[dayIndex].length) |
|
|
|
} |
|
|
|
} |
|
|
|
if (!overlaps[dateKey][hourKey]) { |
|
|
|
|
|
|
|
overlaps[dateKey][hourKey] = { |
|
|
|
|
|
|
|
id: [], |
|
|
|
|
|
|
|
overflow: false, |
|
|
|
|
|
|
|
overflowCount: 0, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
overlaps[dateKey][hourKey].id.push(id) |
|
|
|
return maxOverlaps |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// If the number of records that overlap in a single hour is more than 4, we hide the record and set the overflow flag to true |
|
|
|
let maxOverlaps = 1 |
|
|
|
// We also keep track of the number of records that overflow |
|
|
|
if (graph.has(id)) { |
|
|
|
if (overlaps[dateKey][hourKey].id.length > 4) { |
|
|
|
maxOverlaps = dfs(id) |
|
|
|
overlaps[dateKey][hourKey].overflow = true |
|
|
|
|
|
|
|
style.display = 'none' |
|
|
|
|
|
|
|
overlaps[dateKey][hourKey].overflowCount += 1 |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return { maxOverlaps, dayIndex, overlapIndex } |
|
|
|
// TODO: dayIndex is not calculated perfectly |
|
|
|
|
|
|
|
// Should revisit this part in next iteration |
|
|
|
|
|
|
|
let dayIndex = dayjs(dateKey).day() - 1 |
|
|
|
|
|
|
|
if (dayIndex === -1) { |
|
|
|
|
|
|
|
dayIndex = 6 |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
startDate = startDate.add(1, 'minute') |
|
|
|
const recordsAcrossAllRange = computed<{ |
|
|
|
|
|
|
|
records: Array<Row> |
|
|
|
|
|
|
|
gridTimeMap: Map< |
|
|
|
|
|
|
|
number, |
|
|
|
|
|
|
|
Map< |
|
|
|
|
|
|
|
number, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
count: number |
|
|
|
|
|
|
|
id: string[] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
> |
|
|
|
let dayIndex = ogStartDate.day() - 1 |
|
|
|
> |
|
|
|
|
|
|
|
}>(() => { |
|
|
|
if (dayIndex === -1) { |
|
|
|
if (!formattedData.value || !calendarRange.value || !container.value || !scrollContainer.value) |
|
|
|
dayIndex = 6 |
|
|
|
return { |
|
|
|
|
|
|
|
records: [], |
|
|
|
|
|
|
|
gridTimeMap: new Map(), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const perWidth = containerWidth.value / 7 |
|
|
|
|
|
|
|
const perHeight = 52 |
|
|
|
|
|
|
|
|
|
|
|
const minutes = (ogStartDate.minute() / 60 + ogStartDate.hour()) * 52 |
|
|
|
const scheduleStart = dayjs(selectedDateRange.value.start).startOf('day') |
|
|
|
|
|
|
|
const scheduleEnd = dayjs(selectedDateRange.value.end).endOf('day') |
|
|
|
|
|
|
|
|
|
|
|
style = { |
|
|
|
const columnArray: Array<Array<Array<Row>>> = [[[]]] |
|
|
|
...style, |
|
|
|
const gridTimeMap = new Map< |
|
|
|
top: `${minutes + 1}px`, |
|
|
|
number, |
|
|
|
height: `${perHeight - 2}px`, |
|
|
|
Map< |
|
|
|
|
|
|
|
number, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
count: number |
|
|
|
|
|
|
|
id: string[] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
>() |
|
|
|
|
|
|
|
const recordsToDisplay: Array<Row> = [] |
|
|
|
|
|
|
|
|
|
|
|
recordsToDisplay.push({ |
|
|
|
calendarRange.value.forEach((range) => { |
|
|
|
...record, |
|
|
|
const fromCol = range.fk_from_col |
|
|
|
rowMeta: { |
|
|
|
const toCol = range.fk_to_col |
|
|
|
...record.rowMeta, |
|
|
|
|
|
|
|
id, |
|
|
|
|
|
|
|
position: 'rounded', |
|
|
|
|
|
|
|
style, |
|
|
|
|
|
|
|
range, |
|
|
|
|
|
|
|
dayIndex, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else if (fromCol && toCol) { |
|
|
|
|
|
|
|
const id = record.rowMeta.id ?? generateRandomNumber() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let startDate = record.row[fromCol.title!] ? dayjs(record.row[fromCol.title!]) : null |
|
|
|
// We fetch all the records that match the calendar ranges in a single time. |
|
|
|
let endDate = record.row[toCol.title!] ? dayjs(record.row[toCol.title!]) : null |
|
|
|
// 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 fromDate = record.row[fromCol!.title!] ? dayjs(record.row[fromCol!.title!]) : null |
|
|
|
|
|
|
|
|
|
|
|
// If the start date is not valid, we skip the record |
|
|
|
if (fromCol && toCol) { |
|
|
|
if (!startDate?.isValid()) return |
|
|
|
const fromDate = record.row[fromCol.title!] ? dayjs(record.row[fromCol.title!]) : null |
|
|
|
|
|
|
|
const toDate = record.row[toCol.title!] ? dayjs(record.row[toCol.title!]) : null |
|
|
|
|
|
|
|
|
|
|
|
// If the end date is not valid, we set it to 30 minutes after the start date |
|
|
|
return fromDate && toDate && !toDate.isBefore(fromDate) |
|
|
|
if (!endDate?.isValid()) { |
|
|
|
} else if (fromCol && !toCol) { |
|
|
|
endDate = startDate.clone().add(30, 'minutes') |
|
|
|
return !!fromDate |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
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 the start date is before the start of the schedule, we set it to the start of the schedule |
|
|
|
for (const record of sortedFormattedData) { |
|
|
|
// If the end date is after the end of the schedule, we set it to the end of the schedule |
|
|
|
const id = record.rowMeta.id ?? generateRandomNumber() |
|
|
|
// This is to ensure that the records are within the bounds of the schedule and do not overflow |
|
|
|
|
|
|
|
if (startDate.isBefore(scheduleStart, 'minutes')) { |
|
|
|
if (fromCol && toCol) { |
|
|
|
startDate = scheduleStart |
|
|
|
const { startDate, endDate } = calculateNewDates({ |
|
|
|
} |
|
|
|
startDate: dayjs(record.row[fromCol.title!]), |
|
|
|
if (endDate.isAfter(scheduleEnd, 'minutes')) { |
|
|
|
endDate: dayjs(record.row[toCol.title!]), |
|
|
|
endDate = scheduleEnd |
|
|
|
scheduleStart, |
|
|
|
} |
|
|
|
scheduleEnd, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// Setting the current start date to the start date of the record |
|
|
|
// Setting the current start date to the start date of the record |
|
|
|
let currentStartDate: dayjs.Dayjs = startDate.clone() |
|
|
|
let currentStartDate: dayjs.Dayjs = startDate.clone() |
|
|
@ -242,14 +289,7 @@ const recordsAcrossAllRange = computed<{ |
|
|
|
const recordStart: dayjs.Dayjs = currentEndDate.isSame(startDate, 'day') ? startDate : currentStartDate |
|
|
|
const recordStart: dayjs.Dayjs = currentEndDate.isSame(startDate, 'day') ? startDate : currentStartDate |
|
|
|
const recordEnd = currentEndDate.isSame(endDate, 'day') ? endDate : currentEndDate |
|
|
|
const recordEnd = currentEndDate.isSame(endDate, 'day') ? endDate : currentEndDate |
|
|
|
|
|
|
|
|
|
|
|
const dateKey = recordStart.format('YYYY-MM-DD') |
|
|
|
const dayIndex = getDayIndex(recordStart) |
|
|
|
|
|
|
|
|
|
|
|
// TODO: dayIndex is not calculated perfectly |
|
|
|
|
|
|
|
// Should revisit this part in next iteration |
|
|
|
|
|
|
|
let dayIndex = recordStart.day() - 1 |
|
|
|
|
|
|
|
if (dayIndex === -1) { |
|
|
|
|
|
|
|
dayIndex = 6 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// We calculate the index of the start and end hour in the day |
|
|
|
// We calculate the index of the start and end hour in the day |
|
|
|
const startHourIndex = Math.max( |
|
|
|
const startHourIndex = Math.max( |
|
|
@ -278,36 +318,8 @@ const recordsAcrossAllRange = computed<{ |
|
|
|
position = 'none' |
|
|
|
position = 'none' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let _startHourIndex = startHourIndex |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let style: Partial<CSSStyleDeclaration> = {} |
|
|
|
let style: Partial<CSSStyleDeclaration> = {} |
|
|
|
|
|
|
|
|
|
|
|
// We loop through the start hour index to the end hour index and add the id to the overlaps object |
|
|
|
|
|
|
|
while (_startHourIndex <= endHourIndex) { |
|
|
|
|
|
|
|
const hourKey = datesHours.value[dayIndex][_startHourIndex].format('HH:mm') |
|
|
|
|
|
|
|
if (!overlaps[dateKey]) { |
|
|
|
|
|
|
|
overlaps[dateKey] = {} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!overlaps[dateKey][hourKey]) { |
|
|
|
|
|
|
|
overlaps[dateKey][hourKey] = { |
|
|
|
|
|
|
|
id: [], |
|
|
|
|
|
|
|
overflow: false, |
|
|
|
|
|
|
|
overflowCount: 0, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
overlaps[dateKey][hourKey].id.push(id) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If the number of records that overlap in a single hour is more than 4, we hide the record and set the overflow flag to true |
|
|
|
|
|
|
|
// We also keep track of the number of records that overflow |
|
|
|
|
|
|
|
if (overlaps[dateKey][hourKey].id.length > 4) { |
|
|
|
|
|
|
|
overlaps[dateKey][hourKey].overflow = true |
|
|
|
|
|
|
|
style.display = 'none' |
|
|
|
|
|
|
|
overlaps[dateKey][hourKey].overflowCount += 1 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_startHourIndex++ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const spanHours = endHourIndex - startHourIndex + 1 |
|
|
|
const spanHours = endHourIndex - startHourIndex + 1 |
|
|
|
|
|
|
|
|
|
|
|
const top = startHourIndex * perHeight |
|
|
|
const top = startHourIndex * perHeight |
|
|
@ -334,45 +346,170 @@ const recordsAcrossAllRange = computed<{ |
|
|
|
// We set the current start date to the next day |
|
|
|
// We set the current start date to the next day |
|
|
|
currentStartDate = currentStartDate.add(1, 'day').hour(0).minute(0) |
|
|
|
currentStartDate = currentStartDate.add(1, 'day').hour(0).minute(0) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else if (fromCol) { |
|
|
|
|
|
|
|
// If there is no toColumn chosen in the range |
|
|
|
|
|
|
|
const { startDate } = calculateNewDates({ |
|
|
|
|
|
|
|
startDate: dayjs(record.row[fromCol.title!]), |
|
|
|
|
|
|
|
endDate: dayjs(record.row[fromCol.title!]).add(1, 'hour').subtract(1, 'minute'), |
|
|
|
|
|
|
|
scheduleStart, |
|
|
|
|
|
|
|
scheduleEnd, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let style: Partial<CSSStyleDeclaration> = {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const dayIndex = getDayIndex(startDate) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const minutes = (startDate.minute() / 60 + startDate.hour()) * perHeight |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
style = { |
|
|
|
|
|
|
|
...style, |
|
|
|
|
|
|
|
top: `${minutes + 1}px`, |
|
|
|
|
|
|
|
height: `${perHeight - 2}px`, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
recordsToDisplay.push({ |
|
|
|
|
|
|
|
...record, |
|
|
|
|
|
|
|
rowMeta: { |
|
|
|
|
|
|
|
...record.rowMeta, |
|
|
|
|
|
|
|
id, |
|
|
|
|
|
|
|
position: 'rounded', |
|
|
|
|
|
|
|
style, |
|
|
|
|
|
|
|
range, |
|
|
|
|
|
|
|
dayIndex, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
recordsToDisplay.sort((a, b) => { |
|
|
|
|
|
|
|
const fromColA = a.rowMeta.range?.fk_from_col |
|
|
|
|
|
|
|
const fromColB = b.rowMeta.range?.fk_from_col |
|
|
|
|
|
|
|
if (!fromColA || !fromColB) return 0 |
|
|
|
|
|
|
|
return dayjs(a.row[fromColA.title!]).isBefore(dayjs(b.row[fromColB.title!])) ? -1 : 1 |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// With can't find the left and width of the record without knowing the overlaps |
|
|
|
for (const record of recordsToDisplay) { |
|
|
|
// Hence the first iteration is to find the overlaps, top, height and then the second iteration is to find the left and width |
|
|
|
const fromCol = record.rowMeta.range?.fk_from_col |
|
|
|
// This is because the left and width of the record depends on the overlaps |
|
|
|
const toCol = record.rowMeta.range?.fk_to_col |
|
|
|
|
|
|
|
|
|
|
|
recordsToDisplay = recordsToDisplay.map((record) => { |
|
|
|
if (!fromCol) continue |
|
|
|
// maxOverlaps is the maximum number of records that overlap in a single hour |
|
|
|
const { startDate, endDate } = calculateNewDates({ |
|
|
|
// overlapIndex is the index of the record in the overlaps object |
|
|
|
startDate: dayjs(record.row[fromCol.title!]), |
|
|
|
let maxOverlaps = 1 |
|
|
|
endDate: toCol ? dayjs(record.row[toCol.title!]) : dayjs(record.row[fromCol.title!]).add(1, 'hour').subtract(1, 'minute'), |
|
|
|
let overlapIndex = 0 |
|
|
|
scheduleStart, |
|
|
|
const dayIndex = record.rowMeta.dayIndex as number |
|
|
|
scheduleEnd, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const gridTimes = getGridTimeSlots(startDate, endDate) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const dayIndex = record.rowMeta.dayIndex ?? gridTimes.dayIndex |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (let gridCounter = gridTimes.from; gridCounter <= gridTimes.to; gridCounter++) { |
|
|
|
|
|
|
|
if (!gridTimeMap.has(dayIndex)) { |
|
|
|
|
|
|
|
gridTimeMap.set( |
|
|
|
|
|
|
|
dayIndex, |
|
|
|
|
|
|
|
new Map< |
|
|
|
|
|
|
|
number, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
count: number |
|
|
|
|
|
|
|
id: string[] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
>(), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!gridTimeMap.get(dayIndex)?.has(gridCounter)) { |
|
|
|
|
|
|
|
gridTimeMap.set(dayIndex, (gridTimeMap.get(dayIndex) ?? new Map()).set(gridCounter, { count: 0, id: [] })) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const idArray = gridTimeMap.get(dayIndex)!.get(gridCounter)!.id |
|
|
|
|
|
|
|
idArray.push(record.rowMeta.id!) |
|
|
|
|
|
|
|
const count = gridTimeMap.get(dayIndex)!.get(gridCounter)!.count + 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gridTimeMap.set(dayIndex, (gridTimeMap.get(dayIndex) ?? new Map()).set(gridCounter, { count, id: idArray })) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let foundAColumn = false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!columnArray[dayIndex]) { |
|
|
|
|
|
|
|
columnArray[dayIndex] = [] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const column in columnArray[dayIndex]) { |
|
|
|
|
|
|
|
if (hasSlotForRecord(columnArray[dayIndex][column], { fromDate: startDate, toDate: endDate })) { |
|
|
|
|
|
|
|
columnArray[dayIndex][column].push(record) |
|
|
|
|
|
|
|
foundAColumn = true |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!foundAColumn) { |
|
|
|
|
|
|
|
columnArray[dayIndex].push([record]) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const graph: Map<number, Map<string, Set<string>>> = new Map() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const dayIndex of gridTimeMap.keys()) { |
|
|
|
|
|
|
|
if (!graph.has(dayIndex)) { |
|
|
|
|
|
|
|
graph.set(dayIndex, new Map()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (const [_gridTime, { id: ids }] of gridTimeMap.get(dayIndex)) { |
|
|
|
|
|
|
|
for (const id1 of ids) { |
|
|
|
|
|
|
|
if (!graph.get(dayIndex).has(id1)) { |
|
|
|
|
|
|
|
graph.get(dayIndex).set(id1, new Set()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (const id2 of ids) { |
|
|
|
|
|
|
|
if (id1 !== id2) { |
|
|
|
|
|
|
|
if (!graph.get(dayIndex).get(id1).has(id2)) { |
|
|
|
|
|
|
|
graph.get(dayIndex).get(id1).add(id2) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const dateKey = dayjs(selectedDateRange.value.start).add(dayIndex, 'day').format('YYYY-MM-DD') |
|
|
|
for (const dayIndex in columnArray) { |
|
|
|
for (const hours in overlaps[dateKey]) { |
|
|
|
for (const columnIndex in columnArray[dayIndex]) { |
|
|
|
// We are checking if the overlaps object contains the id of the record |
|
|
|
for (const record of columnArray[dayIndex][columnIndex]) { |
|
|
|
// If it does, we set the maxOverlaps and overlapIndex |
|
|
|
record.rowMeta.overLapIteration = parseInt(columnIndex) + 1 |
|
|
|
if (overlaps[dateKey][hours].id.includes(record.rowMeta.id!)) { |
|
|
|
|
|
|
|
maxOverlaps = Math.max(maxOverlaps, overlaps[dateKey][hours].id.length - overlaps[dateKey][hours].overflowCount) |
|
|
|
|
|
|
|
overlapIndex = Math.max(overlapIndex, overlaps[dateKey][hours].id.indexOf(record.rowMeta.id!)) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const spacing = 0.1 |
|
|
|
} |
|
|
|
const widthPerRecord = (100 - spacing * (maxOverlaps - 1)) / maxOverlaps / 7 |
|
|
|
for (const record of recordsToDisplay) { |
|
|
|
const leftPerRecord = widthPerRecord * overlapIndex |
|
|
|
const { maxOverlaps, overlapIndex } = getMaxOverlaps({ |
|
|
|
|
|
|
|
row: record, |
|
|
|
|
|
|
|
columnArray, |
|
|
|
|
|
|
|
graph: graph.get(record.rowMeta.dayIndex!) ?? new Map(), |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const dayIndex = record.rowMeta.dayIndex ?? tDayIndex |
|
|
|
|
|
|
|
record.rowMeta.numberOfOverlaps = maxOverlaps |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let width = 0 |
|
|
|
|
|
|
|
let left = 100 |
|
|
|
|
|
|
|
const majorLeft = dayIndex * perWidth |
|
|
|
|
|
|
|
let display = 'block' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (record.rowMeta.overLapIteration! - 1 > 2) { |
|
|
|
|
|
|
|
display = 'none' |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
width = 100 / Math.min(maxOverlaps, 3) / 7 |
|
|
|
|
|
|
|
left = width * (overlapIndex - 1) |
|
|
|
|
|
|
|
} |
|
|
|
record.rowMeta.style = { |
|
|
|
record.rowMeta.style = { |
|
|
|
...record.rowMeta.style, |
|
|
|
...record.rowMeta.style, |
|
|
|
left: `calc(${dayIndex * perWidth}px + ${leftPerRecord}% )`, |
|
|
|
left: `calc(${majorLeft}px + ${left}%)`, |
|
|
|
width: `calc(${widthPerRecord - 0.1}%)`, |
|
|
|
width: `calc(${width}%)`, |
|
|
|
|
|
|
|
display, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return record |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
records: recordsToDisplay, |
|
|
|
records: recordsToDisplay, |
|
|
|
count: overlaps, |
|
|
|
gridTimeMap, |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
@ -497,9 +634,11 @@ const onResizeStart = (direction: 'right' | 'left', event: MouseEvent, record: R |
|
|
|
const calculateNewRow = ( |
|
|
|
const calculateNewRow = ( |
|
|
|
event: MouseEvent, |
|
|
|
event: MouseEvent, |
|
|
|
updateSideBar?: boolean, |
|
|
|
updateSideBar?: boolean, |
|
|
|
|
|
|
|
skipChangeCheck?: boolean, |
|
|
|
): { |
|
|
|
): { |
|
|
|
newRow: Row | null |
|
|
|
newRow: Row | null |
|
|
|
updatedProperty: string[] |
|
|
|
updatedProperty: string[] |
|
|
|
|
|
|
|
skipChangeCheck?: boolean |
|
|
|
} => { |
|
|
|
} => { |
|
|
|
const { width, left, top } = container.value.getBoundingClientRect() |
|
|
|
const { width, left, top } = container.value.getBoundingClientRect() |
|
|
|
|
|
|
|
|
|
|
@ -528,7 +667,7 @@ const calculateNewRow = ( |
|
|
|
...dragRecord.value, |
|
|
|
...dragRecord.value, |
|
|
|
row: { |
|
|
|
row: { |
|
|
|
...dragRecord.value.row, |
|
|
|
...dragRecord.value.row, |
|
|
|
[fromCol.title!]: dayjs(newStartDate).format('YYYY-MM-DD HH:mm:ssZ'), |
|
|
|
[fromCol.title!]: dayjs(newStartDate).utc().format('YYYY-MM-DD HH:mm:ssZ'), |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -546,11 +685,16 @@ const calculateNewRow = ( |
|
|
|
endDate = newStartDate.clone() |
|
|
|
endDate = newStartDate.clone() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
newRow.row[toCol.title!] = dayjs(endDate).format('YYYY-MM-DD HH:mm:ssZ') |
|
|
|
newRow.row[toCol.title!] = dayjs(endDate).utc().format('YYYY-MM-DD HH:mm:ssZ') |
|
|
|
updatedProperty.push(toCol.title!) |
|
|
|
updatedProperty.push(toCol.title!) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!newRow) return { newRow: null, updatedProperty } |
|
|
|
// If from and to columns of the dragRecord and the newRow are the same, we don't manipulate the formattedRecords and formattedSideBarData. This removes unwanted computation |
|
|
|
|
|
|
|
if (dragRecord.value.row[fromCol.title!] === newRow.row[fromCol.title!] && !skipChangeCheck) { |
|
|
|
|
|
|
|
return { newRow: null, updatedProperty: [] } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!newRow) return { newRow: null, updatedProperty: [] } |
|
|
|
|
|
|
|
|
|
|
|
const newPk = extractPkFromRow(newRow.row, meta.value!.columns!) |
|
|
|
const newPk = extractPkFromRow(newRow.row, meta.value!.columns!) |
|
|
|
|
|
|
|
|
|
|
@ -565,6 +709,10 @@ const calculateNewRow = ( |
|
|
|
const pk = extractPkFromRow(r.row, meta.value!.columns!) |
|
|
|
const pk = extractPkFromRow(r.row, meta.value!.columns!) |
|
|
|
return pk === newPk ? newRow : r |
|
|
|
return pk === newPk ? newRow : r |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
dragRecord.value = { |
|
|
|
|
|
|
|
...dragRecord.value, |
|
|
|
|
|
|
|
row: newRow.row, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return { newRow, updatedProperty } |
|
|
|
return { newRow, updatedProperty } |
|
|
@ -591,7 +739,7 @@ const stopDrag = (event: MouseEvent) => { |
|
|
|
event.preventDefault() |
|
|
|
event.preventDefault() |
|
|
|
clearTimeout(dragTimeout.value!) |
|
|
|
clearTimeout(dragTimeout.value!) |
|
|
|
|
|
|
|
|
|
|
|
const { newRow, updatedProperty } = calculateNewRow(event, false) |
|
|
|
const { newRow, updatedProperty } = calculateNewRow(event, false, true) |
|
|
|
|
|
|
|
|
|
|
|
// We set the visibility and opacity of the records back to normal |
|
|
|
// We set the visibility and opacity of the records back to normal |
|
|
|
const allRecords = document.querySelectorAll('.draggable-record') |
|
|
|
const allRecords = document.querySelectorAll('.draggable-record') |
|
|
@ -676,33 +824,19 @@ const viewMore = (hour: dayjs.Dayjs) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const isOverflowAcrossHourRange = (hour: dayjs.Dayjs) => { |
|
|
|
const isOverflowAcrossHourRange = (hour: dayjs.Dayjs) => { |
|
|
|
let startOfHour = hour.startOf('hour') |
|
|
|
if (!recordsAcrossAllRange.value || !recordsAcrossAllRange.value.gridTimeMap) return { isOverflow: false, overflowCount: 0 } |
|
|
|
const endOfHour = hour.endOf('hour') |
|
|
|
const { gridTimeMap } = recordsAcrossAllRange.value |
|
|
|
|
|
|
|
const dayIndex = getDayIndex(hour) |
|
|
|
const ids: Array<string> = [] |
|
|
|
const startMinute = hour.hour() * 60 + hour.minute() |
|
|
|
|
|
|
|
const endMinute = hour.hour() * 60 + hour.minute() + 59 |
|
|
|
let isOverflow = false |
|
|
|
|
|
|
|
let overflowCount = 0 |
|
|
|
let overflowCount = 0 |
|
|
|
|
|
|
|
|
|
|
|
while (startOfHour.isBefore(endOfHour, 'minute')) { |
|
|
|
for (let minute = startMinute; minute <= endMinute; minute++) { |
|
|
|
const dateKey = startOfHour.format('YYYY-MM-DD') |
|
|
|
const recordCount = gridTimeMap.get(dayIndex)?.get(minute)?.count ?? 0 |
|
|
|
const hourKey = startOfHour.format('HH:mm') |
|
|
|
overflowCount = Math.max(overflowCount, recordCount) |
|
|
|
if (recordsAcrossAllRange.value?.count?.[dateKey]?.[hourKey]?.overflow) { |
|
|
|
|
|
|
|
isOverflow = true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
recordsAcrossAllRange.value?.count?.[dateKey]?.[hourKey]?.id.forEach((id) => { |
|
|
|
|
|
|
|
if (!ids.includes(id)) { |
|
|
|
|
|
|
|
ids.push(id) |
|
|
|
|
|
|
|
overflowCount += 1 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
startOfHour = startOfHour.add(1, 'minute') |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
overflowCount = overflowCount > 4 ? overflowCount - 4 : 0 |
|
|
|
return { isOverflow: overflowCount - 3 > 0, overflowCount: overflowCount - 3 } |
|
|
|
|
|
|
|
|
|
|
|
return { isOverflow, overflowCount } |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// TODO: Add Support for multiple ranges when multiple ranges are supported |
|
|
|
// TODO: Add Support for multiple ranges when multiple ranges are supported |
|
|
@ -773,7 +907,6 @@ watch( |
|
|
|
@click=" |
|
|
|
@click=" |
|
|
|
() => { |
|
|
|
() => { |
|
|
|
selectedTime = hour |
|
|
|
selectedTime = hour |
|
|
|
selectedDate = hour |
|
|
|
|
|
|
|
dragRecord = undefined |
|
|
|
dragRecord = undefined |
|
|
|
} |
|
|
|
} |
|
|
|
" |
|
|
|
" |
|
|
|