Date Fixes, Translations, Misc Bugs (#840)
* Translated using Weblate (Spanish) Currently translated at 100.0% (956 of 956 strings) Translation: AdventureLog/Web App Translate-URL: https://hosted.weblate.org/projects/adventurelog/web-app/es/ * Added translation using Weblate (English (United States)) * Translated using Weblate (Norwegian Bokmål) Currently translated at 100.0% (956 of 956 strings) Translation: AdventureLog/Web App Translate-URL: https://hosted.weblate.org/projects/adventurelog/web-app/nb_NO/ * Remove empty English (United States) locale file * Translated using Weblate (Spanish) Currently translated at 100.0% (956 of 956 strings) Translation: AdventureLog/Web App Translate-URL: https://hosted.weblate.org/projects/adventurelog/web-app/es/ * [BUG]Ordered Itinerary includes visits that are outside itinerary date range Fixes #746 * [BUG] Server Error (500) when trying to access the API docs Fixes #712 * [BUG] Single day Collections will think location visits are out of date range Fixes #827 * Fixes #654 * Translated using Weblate (Spanish) Currently translated at 100.0% (956 of 956 strings) Translation: AdventureLog/Web App Translate-URL: https://hosted.weblate.org/projects/adventurelog/web-app/es/ * Added Slovak translations (#815) * Created sk.json * Update Navbar.svelte * Update +layout.svelte --------- Co-authored-by: Sean Morley <98704938+seanmorley15@users.noreply.github.com> * Implement code changes to enhance functionality and improve performance --------- Co-authored-by: Nikolai Eidsheim <nikolai.eidsheim@gmail.com> Co-authored-by: Sergio <garcia.sergio@me.com> Co-authored-by: fantastron27 <fantastron27@gmail.com>
This commit is contained in:
@@ -9,29 +9,18 @@
|
||||
import TrashCan from '~icons/mdi/trash-can';
|
||||
import Calendar from '~icons/mdi/calendar';
|
||||
import DeleteWarning from './DeleteWarning.svelte';
|
||||
import { isEntityOutsideCollectionDateRange } from '$lib/dateUtils';
|
||||
|
||||
export let checklist: Checklist;
|
||||
export let user: User | null = null;
|
||||
export let collection: Collection | null = null;
|
||||
export let collection: Collection;
|
||||
|
||||
let isWarningModalOpen: boolean = false;
|
||||
|
||||
let unlinked: boolean = false;
|
||||
let outsideCollectionRange: boolean = false;
|
||||
|
||||
$: {
|
||||
if (collection?.start_date && collection.end_date) {
|
||||
const startOutsideRange =
|
||||
checklist.date &&
|
||||
collection.start_date < checklist.date &&
|
||||
collection.end_date < checklist.date;
|
||||
|
||||
const endOutsideRange =
|
||||
checklist.date &&
|
||||
collection.start_date > checklist.date &&
|
||||
collection.end_date > checklist.date;
|
||||
|
||||
unlinked = !!(startOutsideRange || endOutsideRange || !checklist.date);
|
||||
}
|
||||
outsideCollectionRange = isEntityOutsideCollectionDateRange(checklist, collection);
|
||||
}
|
||||
|
||||
function editChecklist() {
|
||||
@@ -71,7 +60,7 @@
|
||||
<h2 class="text-xl font-bold break-words">{checklist.name}</h2>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<div class="badge badge-primary">{$t('adventures.checklist')}</div>
|
||||
{#if unlinked}
|
||||
{#if outsideCollectionRange}
|
||||
<div class="badge badge-error">{$t('adventures.out_of_range')}</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
let items: ChecklistItem[] = [];
|
||||
|
||||
let constrainDates: boolean = false;
|
||||
let constrainDates: boolean = true;
|
||||
|
||||
items = checklist?.items || [];
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
import StarOutline from '~icons/mdi/star-outline';
|
||||
import Eye from '~icons/mdi/eye';
|
||||
import EyeOff from '~icons/mdi/eye-off';
|
||||
import { isEntityOutsideCollectionDateRange } from '$lib/dateUtils';
|
||||
|
||||
export let type: string | null = null;
|
||||
export let user: User | null;
|
||||
@@ -48,17 +49,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
let unlinked: boolean = false;
|
||||
let outsideCollectionRange: boolean = false;
|
||||
|
||||
// Reactive block to update `unlinked` when dependencies change
|
||||
$: {
|
||||
if (collection && collection?.start_date && collection.end_date) {
|
||||
unlinked = adventure.visits.every((visit) => {
|
||||
if (!visit.start_date || !visit.end_date) return true;
|
||||
const isBeforeVisit = collection.end_date && collection.end_date < visit.start_date;
|
||||
const isAfterVisit = collection.start_date && collection.start_date > visit.end_date;
|
||||
return isBeforeVisit || isAfterVisit;
|
||||
});
|
||||
if (collection) {
|
||||
outsideCollectionRange = adventure.visits.every((visit) =>
|
||||
isEntityOutsideCollectionDateRange(visit, collection)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +196,7 @@
|
||||
>
|
||||
{adventure.is_visited ? $t('adventures.visited') : $t('adventures.planned')}
|
||||
</div>
|
||||
{#if unlinked}
|
||||
{#if outsideCollectionRange}
|
||||
<div class="badge badge-sm badge-error shadow-lg">{$t('adventures.out_of_range')}</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { t } from 'svelte-i18n';
|
||||
import DeleteWarning from './DeleteWarning.svelte';
|
||||
import { LODGING_TYPES_ICONS } from '$lib';
|
||||
import { formatDateInTimezone } from '$lib/dateUtils';
|
||||
import { formatDateInTimezone, isEntityOutsideCollectionDateRange } from '$lib/dateUtils';
|
||||
import { formatAllDayDate } from '$lib/dateUtils';
|
||||
import { isAllDay } from '$lib';
|
||||
import CardCarousel from './CardCarousel.svelte';
|
||||
@@ -31,38 +31,11 @@
|
||||
dispatch('edit', lodging);
|
||||
}
|
||||
|
||||
let unlinked: boolean = false;
|
||||
let outsideCollectionRange: boolean = false;
|
||||
|
||||
$: {
|
||||
if (collection?.start_date && collection.end_date) {
|
||||
// Parse transportation dates
|
||||
let transportationStartDate = lodging.check_in
|
||||
? new Date(lodging.check_in.split('T')[0]) // Ensure proper date parsing
|
||||
: null;
|
||||
let transportationEndDate = lodging.check_out
|
||||
? new Date(lodging.check_out.split('T')[0])
|
||||
: null;
|
||||
|
||||
// Parse collection dates
|
||||
let collectionStartDate = new Date(collection.start_date);
|
||||
let collectionEndDate = new Date(collection.end_date);
|
||||
|
||||
// Check if the collection range is outside the transportation range
|
||||
const startOutsideRange =
|
||||
transportationStartDate &&
|
||||
collectionStartDate < transportationStartDate &&
|
||||
collectionEndDate < transportationStartDate;
|
||||
|
||||
const endOutsideRange =
|
||||
transportationEndDate &&
|
||||
collectionStartDate > transportationEndDate &&
|
||||
collectionEndDate > transportationEndDate;
|
||||
|
||||
unlinked = !!(
|
||||
startOutsideRange ||
|
||||
endOutsideRange ||
|
||||
(!transportationStartDate && !transportationEndDate)
|
||||
);
|
||||
if (collection) {
|
||||
outsideCollectionRange = isEntityOutsideCollectionDateRange(lodging, collection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +93,7 @@
|
||||
{$t(`lodging.${lodging.type}`)}
|
||||
{getLodgingIcon(lodging.type)}
|
||||
</div>
|
||||
{#if unlinked}
|
||||
{#if outsideCollectionRange}
|
||||
<div class="badge badge-error">{$t('adventures.out_of_range')}</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -63,7 +63,8 @@
|
||||
ru: 'Русский',
|
||||
ja: '日本語',
|
||||
ar: 'العربية',
|
||||
'pt-br': 'Português (Brasil)'
|
||||
'pt-br': 'Português (Brasil)',
|
||||
'sk': 'Slovenský'
|
||||
};
|
||||
|
||||
const submitLocaleChange = (event: Event) => {
|
||||
|
||||
@@ -15,23 +15,18 @@
|
||||
import TrashCan from '~icons/mdi/trash-can';
|
||||
import Calendar from '~icons/mdi/calendar';
|
||||
import DeleteWarning from './DeleteWarning.svelte';
|
||||
import { isEntityOutsideCollectionDateRange } from '$lib/dateUtils';
|
||||
|
||||
export let note: Note;
|
||||
export let user: User | null = null;
|
||||
export let collection: Collection | null = null;
|
||||
|
||||
let isWarningModalOpen: boolean = false;
|
||||
let unlinked: boolean = false;
|
||||
let outsideCollectionRange: boolean = false;
|
||||
|
||||
$: {
|
||||
if (collection?.start_date && collection.end_date) {
|
||||
const startOutsideRange =
|
||||
note.date && collection.start_date < note.date && collection.end_date < note.date;
|
||||
|
||||
const endOutsideRange =
|
||||
note.date && collection.start_date > note.date && collection.end_date > note.date;
|
||||
|
||||
unlinked = !!(startOutsideRange || endOutsideRange || !note.date);
|
||||
if (collection) {
|
||||
outsideCollectionRange = isEntityOutsideCollectionDateRange(note, collection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +68,7 @@
|
||||
<h2 class="text-xl font-bold break-words">{note.name}</h2>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<div class="badge badge-primary">{$t('adventures.note')}</div>
|
||||
{#if unlinked}
|
||||
{#if outsideCollectionRange}
|
||||
<div class="badge badge-error">{$t('adventures.out_of_range')}</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
export let collection: Collection;
|
||||
export let user: User | null = null;
|
||||
|
||||
let constrainDates: boolean = false;
|
||||
let constrainDates: boolean = true;
|
||||
|
||||
let isReadOnly =
|
||||
!(note && user?.uuid == note?.user) &&
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
import DeleteWarning from './DeleteWarning.svelte';
|
||||
// import ArrowDownThick from '~icons/mdi/arrow-down-thick';
|
||||
import { TRANSPORTATION_TYPES_ICONS } from '$lib';
|
||||
import { formatAllDayDate, formatDateInTimezone } from '$lib/dateUtils';
|
||||
import {
|
||||
formatAllDayDate,
|
||||
formatDateInTimezone,
|
||||
isEntityOutsideCollectionDateRange
|
||||
} from '$lib/dateUtils';
|
||||
import { isAllDay } from '$lib';
|
||||
import CardCarousel from './CardCarousel.svelte';
|
||||
|
||||
@@ -36,52 +40,11 @@
|
||||
dispatch('edit', transportation);
|
||||
}
|
||||
|
||||
let unlinked: boolean = false;
|
||||
let outsideCollectionRange: boolean = false;
|
||||
|
||||
$: {
|
||||
if (collection?.start_date && collection.end_date) {
|
||||
// Parse transportation dates
|
||||
let transportationStartDate = transportation.date
|
||||
? new Date(transportation.date.split('T')[0]) // Ensure proper date parsing
|
||||
: null;
|
||||
let transportationEndDate = transportation.end_date
|
||||
? new Date(transportation.end_date.split('T')[0])
|
||||
: null;
|
||||
|
||||
// Parse collection dates
|
||||
let collectionStartDate = new Date(collection.start_date);
|
||||
let collectionEndDate = new Date(collection.end_date);
|
||||
|
||||
// // Debugging outputs
|
||||
// console.log(
|
||||
// 'Transportation Start Date:',
|
||||
// transportationStartDate,
|
||||
// 'Transportation End Date:',
|
||||
// transportationEndDate
|
||||
// );
|
||||
// console.log(
|
||||
// 'Collection Start Date:',
|
||||
// collectionStartDate,
|
||||
// 'Collection End Date:',
|
||||
// collectionEndDate
|
||||
// );
|
||||
|
||||
// Check if the collection range is outside the transportation range
|
||||
const startOutsideRange =
|
||||
transportationStartDate &&
|
||||
collectionStartDate < transportationStartDate &&
|
||||
collectionEndDate < transportationStartDate;
|
||||
|
||||
const endOutsideRange =
|
||||
transportationEndDate &&
|
||||
collectionStartDate > transportationEndDate &&
|
||||
collectionEndDate > transportationEndDate;
|
||||
|
||||
unlinked = !!(
|
||||
startOutsideRange ||
|
||||
endOutsideRange ||
|
||||
(!transportationStartDate && !transportationEndDate)
|
||||
);
|
||||
if (collection) {
|
||||
outsideCollectionRange = isEntityOutsideCollectionDateRange(transportation, collection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +128,7 @@
|
||||
{#if transportation.type === 'plane' && transportation.flight_number}
|
||||
<div class="badge badge-neutral">{transportation.flight_number}</div>
|
||||
{/if}
|
||||
{#if unlinked}
|
||||
{#if outsideCollectionRange}
|
||||
<div class="badge badge-error">{$t('adventures.out_of_range')}</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -173,6 +173,10 @@
|
||||
Math.round(transportation.destination_longitude * 1e6) / 1e6;
|
||||
}
|
||||
|
||||
if (transportation.date && !transportation.end_date) {
|
||||
transportation.end_date = transportation.date;
|
||||
}
|
||||
|
||||
if (!transportation.type) {
|
||||
transportation.type = 'other';
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
import ArrowLeftIcon from '~icons/mdi/arrow-left';
|
||||
import RunFastIcon from '~icons/mdi/run-fast';
|
||||
import LoadingIcon from '~icons/mdi/loading';
|
||||
import InfoIcon from '~icons/mdi/information';
|
||||
import UploadIcon from '~icons/mdi/upload';
|
||||
import FileIcon from '~icons/mdi/file';
|
||||
import CloseIcon from '~icons/mdi/close';
|
||||
@@ -1535,6 +1536,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- if localStartDate and localEndDate are set, show a callout saying its not saved yet -->
|
||||
{#if localStartDate || localEndDate}
|
||||
<div class="alert alert-neutral">
|
||||
<InfoIcon class="w-5 h-5" />
|
||||
<div>
|
||||
<div class="font-medium text-sm">{$t('adventures.dates_not_saved')}</div>
|
||||
<div class="text-xs opacity-75">{$t('adventures.dates_not_saved_description')}</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="flex gap-3 justify-end pt-4">
|
||||
<button class="btn btn-neutral-200 gap-2" on:click={handleBack}>
|
||||
<ArrowLeftIcon class="w-5 h-5" />
|
||||
|
||||
Reference in New Issue
Block a user