{lodgingToEdit ? $t('lodging.edit_lodging') : $t('lodging.new_lodging')}

{lodgingToEdit ? $t('lodging.update_lodging_details') : $t('lodging.create_new_lodging')}

    {#each steps as step, index}
  • {#if index > 0}
    {/if}
    {#if index < steps.length - 1}
    {/if}
  • {/each}
{#if steps[0].selected} { steps[1].selected = false; steps[0].selected = true; }} on:save={(e) => { // Update the entire lodging object with all saved data const detail = e.detail || {}; const previousImages = lodging.images || []; const previousAttachments = lodging.attachments || []; lodging = { ...lodging, ...detail }; // Preserve any prefilled 'rec-' images or attachments if the server returned an empty array if (Array.isArray(detail.images)) { if ( detail.images.length === 0 && previousImages.some((i) => String(i.id).startsWith('rec-')) ) { lodging.images = previousImages; } } else { lodging.images = previousImages; } if (Array.isArray(detail.attachments)) { if ( detail.attachments.length === 0 && previousAttachments.some((a) => String(a.id).startsWith('rec-')) ) { lodging.attachments = previousAttachments; } } else { lodging.attachments = previousAttachments; } // Mark that a save occurred so close() will notify parent didSave = true; // Only allow moving to Media once we have a persisted id. if (!lodging?.id) { addToast('error', $t('adventures.lodging_save_error')); steps[1].selected = false; steps[0].selected = true; return; } steps[0].selected = false; steps[1].selected = true; }} initialVisitDate={storedInitialVisitDate} /> {/if} {#if steps[1].selected} { steps[1].selected = false; steps[0].selected = true; }} on:close={() => close()} itemId={lodging.id} contentType="lodging" /> {/if}