feat: Files delete modal error text done.
This commit is contained in:
@@ -328,12 +328,13 @@ export async function renameModal(rename, type, id) {
|
|||||||
* @param { string } files 有關連的檔案
|
* @param { string } files 有關連的檔案
|
||||||
* @param { string } type
|
* @param { string } type
|
||||||
* @param { number } id
|
* @param { number } id
|
||||||
|
* @param { string } name 原本的檔案
|
||||||
*/
|
*/
|
||||||
export async function deleteFileModal(files, type, id) {
|
export async function deleteFileModal(files, type, id, name) {
|
||||||
const filesStore = FilesStore();
|
const filesStore = FilesStore();
|
||||||
let htmlText = files.length === 0 ? '' : `<div class="w-[227px] text-left mx-auto space-y-1"><p>All related files will be deleted.</p><p>List of file(s) to delete: </p><ul class="list-disc ml-6">${files}</ul></div>`;
|
let htmlText = files.length === 0 ? `Do you really want to delete <span class="text-primary">${name}</span>?` : `<div class="text-left mx-4 space-y-1"><p class="mb-2">Do you really want to delete <span class="text-primary">${name}</span>?</p><p>The following dependent file(s) will also be deleted:</p><ul class="list-disc ml-6">${files}</ul></div>`;
|
||||||
const result = await Swal.fire({
|
const result = await Swal.fire({
|
||||||
title: 'ARE YOU SURE?',
|
title: 'Confirm Deletion?',
|
||||||
html: htmlText,
|
html: htmlText,
|
||||||
icon: 'warning',
|
icon: 'warning',
|
||||||
iconColor: '#FF3366',
|
iconColor: '#FF3366',
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
<ul class="opacity-0 group-hover:opacity-100 flex justify-end items-center gap-x-2 text-neutral-700">
|
<ul class="opacity-0 group-hover:opacity-100 flex justify-end items-center gap-x-2 text-neutral-700">
|
||||||
<li><span class="material-symbols-outlined align-bottom cursor-pointer hover:text-primary" @click="rename(slotProps.data.type, slotProps.data.id, 'list-hover')">edit_square</span></li>
|
<li><span class="material-symbols-outlined align-bottom cursor-pointer hover:text-primary" @click="rename(slotProps.data.type, slotProps.data.id, 'list-hover')">edit_square</span></li>
|
||||||
<li><span class="material-symbols-outlined align-bottom cursor-pointer hover:text-primary" @click="download(slotProps.data.type, slotProps.data.id, 'list-hover', slotProps.data.name)">download</span></li>
|
<li><span class="material-symbols-outlined align-bottom cursor-pointer hover:text-primary" @click="download(slotProps.data.type, slotProps.data.id, 'list-hover', slotProps.data.name)">download</span></li>
|
||||||
<li><span class="material-symbols-outlined align-bottom cursor-pointer hover:text-primary" @click="deleteFile(slotProps.data.type, slotProps.data.id, 'list-hover')">delete</span></li>
|
<li><span class="material-symbols-outlined align-bottom cursor-pointer hover:text-primary" @click="deleteFile(slotProps.data.type, slotProps.data.id, slotProps.data.name, 'list-hover')">delete</span></li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
</Column>
|
</Column>
|
||||||
@@ -288,14 +288,15 @@
|
|||||||
* @param {number} id
|
* @param {number} id
|
||||||
* @param {string} source hover icon
|
* @param {string} source hover icon
|
||||||
*/
|
*/
|
||||||
async deleteFile(type, id, source) {
|
async deleteFile(type, id, name, source) {
|
||||||
let srt = '';
|
let srt = '';
|
||||||
let data = [];
|
let data = [];
|
||||||
|
|
||||||
// 判斷是否來自 hover icon 選單
|
// 判斷是否來自 hover icon 選單
|
||||||
if(type && id && source === 'list-hover') {
|
if(type && id && name && source === 'list-hover') {
|
||||||
this.selectedType = type;
|
this.selectedType = type;
|
||||||
this.selectedId = id;
|
this.selectedId = id;
|
||||||
|
this.selecteName = name;
|
||||||
}
|
}
|
||||||
// 取得相依性檔案
|
// 取得相依性檔案
|
||||||
await this.store.getDependents(this.selectedType, this.selectedId);
|
await this.store.getDependents(this.selectedType, this.selectedId);
|
||||||
@@ -314,7 +315,7 @@
|
|||||||
srt += content;
|
srt += content;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
deleteFileModal(srt, this.selectedType, this.selectedId);
|
deleteFileModal(srt, this.selectedType, this.selectedId, this.selecteName);
|
||||||
srt = '';
|
srt = '';
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user