Support filtering location points by country/address/postalCode/description

This commit is contained in:
Fabio Manganiello 2025-04-05 22:04:21 +02:00
parent 36846164bd
commit ca666c9ef8
Signed by: blacklight
GPG key ID: D90FBA7F76362774
8 changed files with 559 additions and 138 deletions
frontend/src/mixins

View file

@ -14,18 +14,22 @@ export default {
newValue?: LocationQuery,
oldValue?: LocationQuery,
}): boolean {
return !_.isEqual(
{
...(oldValue || {}),
startDate: this.normalizeDate(oldValue?.startDate),
endDate: this.normalizeDate(oldValue?.endDate),
},
{
...(newValue || {}),
startDate: this.normalizeDate(newValue?.startDate),
endDate: this.normalizeDate(newValue?.endDate),
}
const values = [oldValue, newValue].map((value) =>
Object.entries(value || {}).reduce((acc, [key, val]) => {
// Replace all undefined values with null to avoid the comparison from breaking
// when an attribute is not set and it's undefined on one side and null on the other
acc[key] = val === undefined ? null : val
// Normalize dates to avoid issues with different date formats
if (key === 'startDate' || key === 'endDate') {
acc[key] = this.normalizeDate(val)
}
return acc
}, {} as Record<string, any>)
)
return !_.isEqual(values[0], values[1])
},
}
}