@php
$link = $link ?? null;
$selectedTagIds = old('tags', $link?->tags?->pluck('id')->toArray() ?? []);
$selectedTagNames = old('tags', $link?->tags?->map(fn ($t) => ['id' => $t->id, 'name' => $t->name, 'color' => $t->color])->values()->toArray() ?? []);
@endphp
project_id ?? $defaultProjectId ?? '') }}",
folderId: "{{ old('folder_id', $link?->folder_id ?? $defaultFolderId ?? '') }}",
foldersByProject: @json($foldersByProject),
get folders() { return this.foldersByProject[String(this.projectId)] ?? [] },
duplicateInfo: null,
checkingDuplicate: false,
async checkDuplicate(url) {
if (!url || !url.startsWith("http")) { this.duplicateInfo = null; return; }
this.checkingDuplicate = true;
try {
const r = await fetch("{{ route('links.check-duplicate') }}?url=" + encodeURIComponent(url), {
headers: { "X-Requested-With": "XMLHttpRequest" }
});
const data = await r.json();
this.duplicateInfo = data.exists ? data.link : null;
} catch(e) { this.duplicateInfo = null; }
this.checkingDuplicate = false;
}
}' class="grid gap-5 sm:grid-cols-2">
{{-- URL --}}
URL *
@if ($link)
{{-- En edición la URL no cambia --}}
La URL no se puede modificar una vez guardada.
@else
{{-- Aviso de duplicado --}}
Verificando duplicado…
@endif
{{-- Título (opcional) --}}
Título (opcional — se rellena automáticamente)
{{-- Proyecto --}}
Proyecto *
@foreach ($projects as $project)
@endforeach
{{-- Carpeta (dependiente del proyecto) --}}
{{-- Categoría --}}
Categoría
@foreach ($categories as $cat)
@endforeach
{{-- Etiquetas typeahead --}}
{{-- Nota personal --}}
Nota personal