feat: credit note => remove attachment on create

This commit is contained in:
puriphatt 2025-01-14 11:40:55 +07:00
parent c5d3897d76
commit 1cdc2bd4cc
2 changed files with 8 additions and 4 deletions

View file

@ -75,7 +75,7 @@ onMounted(() => {
color="positive" color="positive"
size="1rem" size="1rem"
/> />
{{ idle ? '' : progress !== 1 ? `Uploading...` : 'Completed' }} {{ idle ? `Pending` : progress !== 1 ? `Uploading...` : 'Completed' }}
</span> </span>
</article> </article>
<q-btn <q-btn

View file

@ -668,12 +668,12 @@ onMounted(async () => {
attachmentList = f; attachmentList = f;
attachmentData = []; attachmentData = [];
Array.from(f).forEach(({ name }) => { Array.from(f).forEach((el) => {
attachmentData.push({ attachmentData.push({
name: name, name: el.name,
progress: 1, progress: 1,
loaded: 0, loaded: 0,
total: 0, total: el.size,
placeholder: true, placeholder: true,
}); });
}); });
@ -685,6 +685,10 @@ onMounted(async () => {
" "
@remove=" @remove="
async (n) => { async (n) => {
const attIndex = attachmentData.findIndex((v) => v.name === n);
attachmentData.splice(attIndex, 1);
if (!creditNoteData) return; if (!creditNoteData) return;
await remove(creditNoteData.id, n); await remove(creditNoteData.id, n);
} }