Merge start/end dates into compact trade fair term column
This commit is contained in:
@@ -1575,8 +1575,7 @@
|
|||||||
<th><button type="button" class="bookmark-subpage__sort" data-trade-sort="thema">Thema</button></th>
|
<th><button type="button" class="bookmark-subpage__sort" data-trade-sort="thema">Thema</button></th>
|
||||||
<th><button type="button" class="bookmark-subpage__sort" data-trade-sort="stadt">Stadt</button></th>
|
<th><button type="button" class="bookmark-subpage__sort" data-trade-sort="stadt">Stadt</button></th>
|
||||||
<th><button type="button" class="bookmark-subpage__sort" data-trade-sort="bundesland">Bundesland</button></th>
|
<th><button type="button" class="bookmark-subpage__sort" data-trade-sort="bundesland">Bundesland</button></th>
|
||||||
<th><button type="button" class="bookmark-subpage__sort" data-trade-sort="termin_start">Termin Start</button></th>
|
<th><button type="button" class="bookmark-subpage__sort" data-trade-sort="termin">Termin</button></th>
|
||||||
<th><button type="button" class="bookmark-subpage__sort" data-trade-sort="termin_ende">Termin Ende</button></th>
|
|
||||||
<th><button type="button" class="bookmark-subpage__sort" data-trade-sort="besucher">Besucher</button></th>
|
<th><button type="button" class="bookmark-subpage__sort" data-trade-sort="besucher">Besucher</button></th>
|
||||||
<th><button type="button" class="bookmark-subpage__sort" data-trade-sort="besucher_jahr">Besucher Jahr</button></th>
|
<th><button type="button" class="bookmark-subpage__sort" data-trade-sort="besucher_jahr">Besucher Jahr</button></th>
|
||||||
<th><button type="button" class="bookmark-subpage__sort" data-trade-sort="besucher_status">Besucher Status</button></th>
|
<th><button type="button" class="bookmark-subpage__sort" data-trade-sort="besucher_status">Besucher Status</button></th>
|
||||||
|
|||||||
@@ -24,8 +24,7 @@
|
|||||||
'thema',
|
'thema',
|
||||||
'stadt',
|
'stadt',
|
||||||
'bundesland',
|
'bundesland',
|
||||||
'termin_start',
|
'termin',
|
||||||
'termin_ende',
|
|
||||||
'besucher',
|
'besucher',
|
||||||
'besucher_jahr',
|
'besucher_jahr',
|
||||||
'besucher_status',
|
'besucher_status',
|
||||||
@@ -706,8 +705,7 @@
|
|||||||
thema: 'text',
|
thema: 'text',
|
||||||
stadt: 'text',
|
stadt: 'text',
|
||||||
bundesland: 'text',
|
bundesland: 'text',
|
||||||
termin_start: 'date',
|
termin: 'date',
|
||||||
termin_ende: 'date',
|
|
||||||
besucher: 'number',
|
besucher: 'number',
|
||||||
besucher_jahr: 'number',
|
besucher_jahr: 'number',
|
||||||
besucher_status: 'text',
|
besucher_status: 'text',
|
||||||
@@ -763,7 +761,8 @@
|
|||||||
return {
|
return {
|
||||||
...row,
|
...row,
|
||||||
tage_bis_start: getDaysUntil(row.termin_start),
|
tage_bis_start: getDaysUntil(row.termin_start),
|
||||||
zuletzt_gesucht_am: lastOpenedByTradeFair[getTradeFairOpenKey(row)] || null
|
zuletzt_gesucht_am: lastOpenedByTradeFair[getTradeFairOpenKey(row)] || null,
|
||||||
|
termin: row.termin_start || null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -806,6 +805,40 @@
|
|||||||
return date.toLocaleDateString('de-DE');
|
return date.toLocaleDateString('de-DE');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatTermRange(startIso, endIso) {
|
||||||
|
const start = toDate(startIso);
|
||||||
|
const end = toDate(endIso);
|
||||||
|
|
||||||
|
if (!start && !end) {
|
||||||
|
return 'k.A.';
|
||||||
|
}
|
||||||
|
if (start && !end) {
|
||||||
|
return formatDate(startIso);
|
||||||
|
}
|
||||||
|
if (!start && end) {
|
||||||
|
return formatDate(endIso);
|
||||||
|
}
|
||||||
|
|
||||||
|
const startDay = start.getDate();
|
||||||
|
const startMonth = start.getMonth() + 1;
|
||||||
|
const startYear = start.getFullYear();
|
||||||
|
const endDay = end.getDate();
|
||||||
|
const endMonth = end.getMonth() + 1;
|
||||||
|
const endYear = end.getFullYear();
|
||||||
|
|
||||||
|
if (startYear === endYear) {
|
||||||
|
if (startMonth === endMonth) {
|
||||||
|
if (startDay === endDay) {
|
||||||
|
return `${startDay}.${startMonth}.${startYear}`;
|
||||||
|
}
|
||||||
|
return `${startDay}.-${endDay}.${startMonth}.${startYear}`;
|
||||||
|
}
|
||||||
|
return `${startDay}.${startMonth}.-${endDay}.${endMonth}.${startYear}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${startDay}.${startMonth}.${startYear}-${endDay}.${endMonth}.${endYear}`;
|
||||||
|
}
|
||||||
|
|
||||||
function matchesSearch(row, term) {
|
function matchesSearch(row, term) {
|
||||||
if (!term) {
|
if (!term) {
|
||||||
return true;
|
return true;
|
||||||
@@ -1523,8 +1556,7 @@
|
|||||||
thema: createCell(row.thema, 'thema'),
|
thema: createCell(row.thema, 'thema'),
|
||||||
stadt: createCell(row.stadt, 'stadt'),
|
stadt: createCell(row.stadt, 'stadt'),
|
||||||
bundesland: createCell(row.bundesland, 'bundesland'),
|
bundesland: createCell(row.bundesland, 'bundesland'),
|
||||||
termin_start: createCell(formatDate(row.termin_start), 'termin_start'),
|
termin: createCell(formatTermRange(row.termin_start, row.termin_ende), 'termin'),
|
||||||
termin_ende: createCell(formatDate(row.termin_ende), 'termin_ende'),
|
|
||||||
besucher: createCell(formatNumber(row.besucher), 'besucher'),
|
besucher: createCell(formatNumber(row.besucher), 'besucher'),
|
||||||
besucher_jahr: createCell(formatNumber(row.besucher_jahr), 'besucher_jahr'),
|
besucher_jahr: createCell(formatNumber(row.besucher_jahr), 'besucher_jahr'),
|
||||||
besucher_status: createCell(row.besucher_status, 'besucher_status'),
|
besucher_status: createCell(row.besucher_status, 'besucher_status'),
|
||||||
|
|||||||
Reference in New Issue
Block a user