Added File Moving

This commit is contained in:
2025-01-05 22:11:42 +01:00
parent 639cdb4c1f
commit 7f23d8efd8
2 changed files with 28 additions and 18 deletions

View File

@@ -26,14 +26,11 @@ const setup = async () => {
data.forEach(folder => {
let name = folder.name
console.log(folder)
const addParent = (item) => {
name = `${item.name} > ${name}`
const addParent = (folder) => {
console.log(folder)
name = `${folder.name} > ${name}`
if(folder.parent){
addParent(folder)
if(item.parent){
addParent(data.find(i => i.id === item.parent))
} else {
folders.value.push({
id: folder.id,
@@ -129,16 +126,19 @@ const updateDocumentAssignment = async () => {
const folderToMoveTo = ref(null)
const moveFile = async () => {
console.log(folderToMoveTo.value)
const {data,error} = await supabase
.from("files")
.update({folder: folderToMoveTo.value})
.eq("id",props.documentData.id)
.select()
if(error) {
console.log(error)
toast.add({title: "Fehler beim verschieben", color:"rose"})
} else {
toast.add({title: "Datei verschoben"})
console.log(data)
}
modal.close()
}
@@ -225,13 +225,21 @@ const moveFile = async () => {
<UDivider class="my-5">Datei verschieben</UDivider>
<USelectMenu
v-model="folderToMoveTo"
value-attribute="id"
option-attribute="name"
@change="moveFile"
:options="folders"
/>
<InputGroup class="w-full">
<USelectMenu
class="flex-auto"
v-model="folderToMoveTo"
value-attribute="id"
option-attribute="name"
:options="folders"
/>
<UButton
@click="moveFile"
variant="outline"
>Verschieben</UButton>
</InputGroup>
</div>
</div>
</UCard>

View File

@@ -144,7 +144,7 @@ const breadcrumbLinks = computed(() => {
const addParent = (parent) => {
parents.push(parent)
if(parent.parent) {
addParent(folders.value.find(i => i.id === currentFolder.value.parent))
addParent(folders.value.find(i => i.id === parent.parent))
}
}
@@ -167,7 +167,7 @@ const breadcrumbLinks = computed(() => {
},
icon: "i-heroicons-folder"
}
}),
}).reverse(),
{
label: currentFolder.value.name,
click: () => {
@@ -403,8 +403,10 @@ const showFile = (fileId) => {
<div v-if="displayMode === 'list'">
<table class="w-full">
<thead>
<td class="font-bold">Name</td>
<td class="font-bold">Erstellt am</td>
<tr>
<td class="font-bold">Name</td>
<td class="font-bold">Erstellt am</td>
</tr>
</thead>
<tr v-for="(entry,index) in renderedFileList">
<td>