Loca7 · Administration
[ k, { reported: 'signalées', archived: 'archivées' }?.[k] ?? v ]) )} bind:value={currentCategory} let:display let:option > {display} {#if option === 'pending'} {byCategory.pending.length} {:else if option === 'reported'} {byCategory.reported.length} {/if}
{#if confirmingBulkDelete}

Êtes-vous sûr·e de vouloir supprimer {selection.length} annonce{selection.length > 1 ? 's' : ''} ? Cette action n'est pas réversible.

{ await Promise.all( selection.map(async (id) => { await fetch(`/appartements/${id}/supprimer?/confirm`, { method: 'POST', body: new FormData() }); }) ); confirmingBulkDelete = false; window.location.reload(); }}>Confirmer {:else if selection.length > 0}

{selection.length} sélectionnée{selection.length > 1 ? 's' : ''}

{ await Promise.all( selection.map(async (id) => { await fetch(`/appartements/${id}/archiver`, { method: 'POST' }); }) ); window.location.reload(); }} >Archiver {#if currentCategory !== 'online'} { await Promise.all( selection.map(async (id) => { await fetch(`/appartements/${id}/approuver`, { method: 'POST' }); await fetch(`/appartements/${id}/publier`, { method: 'POST' }); }) ); window.location.reload(); }} >Valider & publier {/if} { confirmingBulkDelete = true; }} >Supprimer
{ selection = []; }} icon="close" />
{:else}

Aucune annonce sélectionnée

{ selection = byCategory[currentCategory].map((a) => a.id); }}>Tout sélectionner {/if}