diff --git a/src/components/05_quotation/QuotationCard.vue b/src/components/05_quotation/QuotationCard.vue index 1de73166..1cce142d 100644 --- a/src/components/05_quotation/QuotationCard.vue +++ b/src/components/05_quotation/QuotationCard.vue @@ -22,7 +22,9 @@ defineProps<{ badgeColor?: string; hideKebabView?: boolean; hideKebabEdit?: boolean; + hideKebabDelete?: boolean; hideAction?: boolean; + useCancel?: boolean; customData?: { label: string; @@ -39,6 +41,7 @@ defineEmits<{ (e: 'delete'): void; (e: 'example'): void; (e: 'preview'): void; + (e: 'cancel'): void; }>(); const rand = Math.random(); @@ -93,7 +96,8 @@ const rand = Math.random(); :idName="code" status="ACTIVE" hide-toggle - hide-delete + :use-cancel + :hide-delete="hideKebabDelete" :hide-view="hideKebabView" :hide-edit="hideKebabEdit" @view="$emit('view')" @@ -101,6 +105,7 @@ const rand = Math.random(); @link="$emit('link')" @upload="$emit('upload')" @delete="$emit('delete')" + @cancel="$emit('cancel')" /> diff --git a/src/components/11_credit-note/FormCredit.vue b/src/components/11_credit-note/FormCredit.vue new file mode 100644 index 00000000..68bb7ab2 --- /dev/null +++ b/src/components/11_credit-note/FormCredit.vue @@ -0,0 +1,39 @@ + + + diff --git a/src/components/dialog/DialogViewFile.vue b/src/components/dialog/DialogViewFile.vue index dd13f4d1..db574376 100644 --- a/src/components/dialog/DialogViewFile.vue +++ b/src/components/dialog/DialogViewFile.vue @@ -6,29 +6,57 @@ import DialogHeader from './DialogHeader.vue'; import MainButton from '../button/MainButton.vue'; import NoData from '../NoData.vue'; -defineProps<{ - title: string; +const props = defineProps<{ + title?: string; url?: string; + hideTab?: boolean; + download?: boolean; + transformUrl?: (url: string) => string | Promise; }>(); const open = defineModel({ default: false }); const state = reactive({ imageZoom: 100, + transformedUrl: props.url, }); -function openDialog() { +async function openDialog() { state.imageZoom = 100; + if (props.url && props.transformUrl) { + state.transformedUrl = await props.transformUrl(props.url); + } else { + state.transformedUrl = props.url; + } +} + +async function downloadImage(url: string | null) { + if (!url) return; + const res = await fetch(url); + const blob = await res.blob(); + + let extension = ''; + + if (blob.type === 'image/jpeg') extension = '.jpg'; + else if (blob.type === 'image/png') extension = '.png'; + else return; + + let a = document.createElement('a'); + a.download = `download${extension}`; + a.href = window.URL.createObjectURL(blob); + a.click(); + a.remove(); }