jws-frontend/src/components/ImageUploadDialog.vue

469 lines
13 KiB
Vue
Raw Normal View History

2024-08-01 14:20:13 +07:00
<script lang="ts" setup>
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
import { ref, watch } from 'vue';
2024-08-01 14:20:13 +07:00
import AppBox from './app/AppBox.vue';
2024-08-28 13:17:29 +07:00
import { CancelButton, ClearButton, SaveButton } from './button';
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
import { dialog } from 'src/stores/utils';
2024-08-01 14:20:13 +07:00
2024-08-02 11:36:48 +07:00
defineExpose({ browse });
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
const props = defineProps<{
changeDisabled?: boolean;
2024-08-02 09:28:09 +07:00
clearButtonDisabled?: boolean;
clearButton?: boolean;
2024-08-02 09:18:11 +07:00
hiddenFooter?: boolean;
2024-08-02 09:28:09 +07:00
defaultUrl?: string;
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
onCreate?: boolean;
2024-08-02 09:18:11 +07:00
}>();
2024-08-08 09:45:59 +07:00
const emit = defineEmits<{
2024-08-02 11:36:48 +07:00
(e: 'save', file: File | null, url: string | null): void;
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
(e: 'addImage', file: File | null): void;
(e: 'removeImage', name: string): void;
(e: 'submit', name: string): void;
2024-08-02 11:36:48 +07:00
}>();
2024-08-01 14:20:13 +07:00
const imageUrl = defineModel<string>('imageUrl', {
required: false,
default: '',
});
const fallbackUrl = defineModel<string>('fallbackUrl', {
required: false,
default: '',
});
const dialogState = defineModel<boolean>('dialogState', {
required: false,
default: true,
});
2024-08-01 14:29:00 +07:00
const file = defineModel<File | null>('file', {
required: true,
});
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
const dataList = defineModel<{ selectedImage: string; list: string[] }>(
'dataList',
{
required: false,
default: { selectedImage: '', list: [] },
},
);
const onCreateData = defineModel<{
selectedImage: string;
list: { url: string; imgFile: File | null; name: string }[];
}>('onCreateDataList', {
required: false,
default: { selectedImage: '', list: [] },
});
2024-08-01 14:20:13 +07:00
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
const apiBaseUrl = import.meta.env.VITE_API_BASE_URL;
2024-08-01 14:20:13 +07:00
const reader = new FileReader();
2024-08-02 11:36:48 +07:00
const inputFile = (() => {
const _element = document.createElement('input');
_element.type = 'file';
_element.accept = 'image/*';
_element.addEventListener('change', change);
return _element;
})();
2024-08-01 14:20:13 +07:00
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
const selectedImg = ref('');
const currentImag = ref('');
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
const tempImage = ref<string | null>('');
2024-08-01 14:20:13 +07:00
reader.addEventListener('load', () => {
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
if (typeof reader.result === 'string') {
tempImage.value = reader.result;
if (props.onCreate) {
onCreateData.value.list.push({
url: reader.result,
imgFile: file.value,
name: Date.now().toString(),
});
onCreateData.value.selectedImage =
onCreateData.value.list[onCreateData.value.list.length - 1].name;
selectedImg.value = reader.result;
} else {
emit('addImage', file.value);
}
}
2024-08-01 14:20:13 +07:00
});
2024-08-02 11:36:48 +07:00
function browse() {
inputFile?.click();
}
2024-08-01 14:20:13 +07:00
function change(e: Event) {
2024-08-01 14:29:00 +07:00
const _element = e.target as HTMLInputElement | null;
const _file = _element?.files?.[0];
2024-08-01 14:20:13 +07:00
2024-08-01 14:29:00 +07:00
if (_file) {
file.value = _file;
reader.readAsDataURL(_file);
2024-08-08 17:09:36 +07:00
if (!dialogState.value) {
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
emit('save', _file, tempImage.value);
2024-08-08 17:09:36 +07:00
}
2024-08-01 14:29:00 +07:00
}
2024-08-01 14:20:13 +07:00
}
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
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';
2024-08-22 13:51:05 +07:00
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();
}
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
function selectImg(name: string) {
if (props.onCreate) {
selectedImg.value = name;
tempImage.value = name;
onCreateData.value.selectedImage =
onCreateData.value.list.find((v) => v.url === name)?.name || '';
} else {
selectedImg.value = name.split('/').pop() || '';
tempImage.value = `${apiBaseUrl}/${name}`;
}
}
function closeCheckToDefault() {
let imgNameList: string[];
let inList: boolean;
if (props.onCreate) {
imgNameList = onCreateData.value.list.map((v) => v.url || '');
} else {
imgNameList = dataList.value.list.map((v) => v.split('/').pop() || '');
}
inList = imgNameList.includes(currentImag.value);
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
if (!inList && currentImag.value !== '') {
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
selectImg('');
emit('submit', selectedImg.value);
}
}
watch(
() => dialogState.value,
() => {
if (dialogState.value) {
if (props.onCreate) {
tempImage.value = imageUrl.value;
selectedImg.value = imageUrl.value;
} else {
tempImage.value = `${imageUrl.value}?ts=${Date.now()}`;
selectedImg.value = dataList.value.selectedImage;
currentImag.value = dataList.value.selectedImage;
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
}
} else {
tempImage.value = '';
selectedImg.value = '';
}
},
);
watch(
() => dataList.value.list,
(n, o) => {
if (n.length > o.length) {
selectImg(n[n.length - 1]);
}
},
{ deep: true },
);
2024-08-01 14:20:13 +07:00
</script>
<template>
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
<q-dialog v-model="dialogState" @before-hide="closeCheckToDefault">
<AppBox class="image-dialog-content column">
<!-- header -->
2024-08-01 14:20:13 +07:00
<div class="row items-center q-py-sm q-px-md bordered-b">
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
<div style="width: 38.61px" />
2024-08-01 14:20:13 +07:00
<div style="flex: 1"><slot name="title" /></div>
<div>
<CancelButton icon-only v-close-popup @click="closeCheckToDefault" />
2024-08-01 14:20:13 +07:00
</div>
</div>
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
<!-- body -->
<div class="q-px-lg surface-2 col row full-width">
<div
class="image-dialog-body q-my-lg relative-position rounded surface-1 flex items-center"
>
<img
:src="tempImage || fallbackUrl"
v-if="tempImage || fallbackUrl"
style="object-fit: contain; width: 100%"
@error="
() => {
tempImage = '';
}
"
/>
<div
style="object-fit: contain; height: 100%; width: 100%"
v-if="!tempImage && !fallbackUrl"
>
<slot name="error"></slot>
</div>
<div class="absolute-top-left q-pa-md">
<q-btn
class="upload-image-btn q-mr-md"
icon="mdi-camera-plus-outline"
id="btn-add-img"
size="md"
unelevated
round
v-if="!changeDisabled"
@click="
() => {
inputFile?.click();
}
"
style="color: hsla(var(--stone-0-hsl) / 0.7)"
></q-btn>
<q-btn
v-if="!onCreate"
class="upload-image-btn"
icon="mdi-download-outline"
id="btn-download-img"
size="md"
unelevated
round
@click="downloadImage(tempImage)"
style="color: hsla(var(--stone-0-hsl) / 0.7)"
></q-btn>
</div>
2024-08-01 14:20:13 +07:00
</div>
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
<div
v-if="!hiddenFooter"
class="col q-ml-md q-pt-sm q-my-md"
style="width: 40em; height: 30em; overflow: auto"
>
<div class="row items-center q-gutter-sm">
<div
class="rounded surface-1 relative-position"
:class="{
'selected-img': selectedImg === '',
}"
style="
object-fit: cover;
height: 5vw;
width: 5vw;
overflow: hidden;
"
@click="selectImg('')"
>
<slot name="error"></slot>
</div>
<template v-if="dataList">
<div
v-for="(img, n) in onCreate
? onCreateData.list.map((item) => item.url)
: dataList.list"
:key="n"
class="rounded surface-1 relative-position"
:class="{
'selected-img':
selectedImg && onCreate
? selectedImg === img
: selectedImg === img.split('/').pop(),
}"
style="height: 5vw; width: 5vw"
@click="selectImg(img)"
>
<q-btn
icon="mdi-close"
class="absolute-top-right"
rounded
padding="0"
size="sm"
style="
z-index: 2;
top: -5px;
right: -5px;
background: var(--surface-1);
color: hsl(var(--negative-bg));
"
@click.stop="
() => {
if (onCreate) {
const v = onCreateData.list.splice(n, 1);
if (v[0].url === selectedImg) {
if (onCreateData.list.length === 0 || n === 0) {
selectImg('');
} else {
selectImg(onCreateData.list[n - 1].url);
}
}
} else {
dialog({
color: 'negative',
icon: 'mdi-alert',
title: $t('dialog.title.confirmDelete'),
actionText: $t('general.delete'),
message: $t('dialog.message.confirmDelete'),
action: async () => {
$emit('removeImage', img);
const index = dataList.list.indexOf(img);
if (img.split('/').pop() === selectedImg) {
if (dataList.list.length === 0 || index === 0) {
selectImg('');
} else {
selectImg(dataList.list[index - 1]);
}
}
},
cancel: () => {},
});
}
}
"
></q-btn>
<div
class="rounded full-width full-height surface-1"
style="overflow: hidden"
>
<img
v-if="img"
:src="onCreate ? img : `${apiBaseUrl}/${img}`"
class=""
style="object-fit: cover; height: 100%; width: 100%"
/>
</div>
</div>
</template>
</div>
2024-08-01 14:20:13 +07:00
</div>
</div>
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
<!-- footer -->
2024-08-02 09:18:11 +07:00
<div
class="row items-center justify-end q-py-sm q-px-md bordered-t"
v-if="!hiddenFooter"
>
2024-08-28 13:17:29 +07:00
<ClearButton
outlined
2024-08-02 09:28:09 +07:00
@click="
inputFile && (inputFile.value = ''),
(imageUrl = defaultUrl || fallbackUrl || ''),
(file = null)
"
class="q-px-md q-mr-auto"
2024-08-28 13:17:29 +07:00
:disabled="
2024-08-02 09:28:09 +07:00
clearButtonDisabled ||
imageUrl === fallbackUrl ||
imageUrl === defaultUrl ||
!imageUrl
"
v-if="clearButton"
/>
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
<!-- <CancelButton
id="btn-cancel-img"
outlined
class="q-px-md q-mr-sm"
2024-08-15 11:02:01 +07:00
@click="
inputFile && (inputFile.value = ''),
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
(tempImage = defaultUrl || fallbackUrl || ''),
2024-08-15 11:02:01 +07:00
(file = null)
"
2024-08-01 14:20:13 +07:00
v-close-popup
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
/> -->
<SaveButton
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
id="btn-save-img"
outlined
:disabled="currentImag === selectedImg"
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
:label="$t('general.apply')"
@click="$emit('submit', selectedImg)"
2024-08-01 14:20:13 +07:00
/>
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
<!-- @click="$emit('save', inputFile?.files?.[0] || null, tempImage)" -->
2024-08-01 14:20:13 +07:00
</div>
</AppBox>
</q-dialog>
</template>
<style scoped>
2024-08-01 17:18:04 +07:00
.image-dialog-content {
2024-08-01 14:20:13 +07:00
padding: 0;
border-radius: var(--radius-2);
flex-wrap: nowrap;
}
@media (min-width: 768px) {
2024-08-01 17:18:04 +07:00
.image-dialog-content {
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
max-width: 70%;
2024-08-01 14:20:13 +07:00
}
}
2024-08-01 17:18:04 +07:00
.image-dialog-body {
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
/* overflow-y: auto;
background-color: var(--surface-1) !important;
2024-08-01 14:20:13 +07:00
position: relative;
display: flex;
flex-direction: column;
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
flex: 1; */
overflow: hidden;
width: 30em;
height: 30em;
2024-08-01 14:20:13 +07:00
}
.upload-image-btn {
transition: 0.3s background-color ease-in-out;
background-color: hsla(0 0% 0% / 0.2);
backdrop-filter: blur(1px);
&:not(:hover) {
color: hsla(0 0% 40% / 1);
background-color: hsla(0 0% 0% / 0.2);
}
}
.image-container {
width: 100%;
2024-08-01 17:18:04 +07:00
height: calc(100vh - 200px);
2024-08-01 14:20:13 +07:00
min-height: 480px;
2024-08-02 09:31:49 +07:00
& > :deep(*) {
2024-08-01 14:20:13 +07:00
height: 100%;
width: 100%;
}
}
.image-container > :deep(*:not(:first-child)) {
display: none;
}
2024-08-02 03:52:56 +00:00
.close-btn {
color: hsl(var(--negative-bg));
background-color: hsla(var(--negative-bg) / 0.1);
&.dark {
background-color: transparent;
border: 1px solid hsl(var(--negative-bg));
}
}
Squashed commit of the following: commit eb6c7b164a9f182f8d1ce73cc5354866c6d6b10e Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:29:44 2024 +0700 refactor: no img close to default on create commit eae9eb26071cc2985624bb1c6ce551bf5eb6eb8b Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 11:04:04 2024 +0700 refactor/feat: save => apply, disabled selected img, no img close to default commit ccbf80fc53db3144873c049bd6dbd37b4e2e9ff3 Author: puriphatt <puriphat@frappet.com> Date: Wed Sep 11 09:31:32 2024 +0700 fix(01): use submit function commit 36b4f6ca15e5966f37dfefc9fdb744feec60dd27 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:45:19 2024 +0700 fix: imgList error commit bac0eaf3ab955672ae0c78d3295b4a839827c5f2 Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 17:18:03 2024 +0700 refactor(03): customer new upload img dialog commit 9d7398e9613a738c33e265482cdb7d7bb250ea9f Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:40:39 2024 +0700 refactor(02): new upload dialog commit 8b91d43f41eae3ba2442f6c742d617c25ee180cb Author: puriphatt <puriphat@frappet.com> Date: Tue Sep 10 15:25:21 2024 +0700 refactor(01): new upload dialog, confirm remove, individual action commit 61caf1919168bc5635568d7ca246574fdc43cd04 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(01): branch new img upload commit e791b7316d001d839c8afb1950f7331c62d9e81a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 refactor(02): personnel new img upload commit af4d11312b9cb666338901efa9971117cb7738c4 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:42 2024 +0700 feat(02): new image upload commit e4d7afdb8c74d65a550644f2c60f70909d51d4a8 Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock select image function commit 5ab3f045b9c7d2c821920c12114da15eed09655a Author: puriphatt <puriphat@frappet.com> Date: Mon Sep 9 17:08:41 2024 +0700 refactor: mock new image preview
2024-09-11 16:43:41 +07:00
.selected-img {
position: relative;
border: 2px solid hsl(var(--info-bg));
}
.selected-img:before {
content: ' ';
position: absolute;
z-index: 1;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
border: 2px solid var(--surface-1);
border-radius: 5px;
}
2024-08-01 14:20:13 +07:00
</style>