doc upload: loading upload, change path
This commit is contained in:
parent
e97acd4269
commit
1992556487
|
|
@ -10,7 +10,7 @@ export const ALLOWED_FILE_TYPES = [
|
|||
"image/jpeg",
|
||||
];
|
||||
export const QUESTIONNAIRE_LINK = "http://ba.digital-tps.tk/export-questionnaire/";
|
||||
export const LETTER_LINK = "http://ba.digital-tps.tk/storage/";
|
||||
export const LETTER_LINK = "http://ba.digital-tps.tk/doc/";
|
||||
export const APPLICATION_APPROVED_STATE = "approved";
|
||||
export const APPLICATION_TO_BE_IMPROVED_STATE = "to_be_improved";
|
||||
export const APPLICATION_NEW_STATE = "new";
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ import globalComponents from "./global-components";
|
|||
import utils from "./utils";
|
||||
import "./assets/css/app.css";
|
||||
|
||||
const reCaptchaKey = import.meta.env.VITE_RECAPTCHA_KEY;
|
||||
|
||||
const app = createApp(App).use(router).use(i18n).use(createPinia());
|
||||
|
||||
globalComponents(app);
|
||||
|
|
|
|||
|
|
@ -98,16 +98,18 @@
|
|||
<div class="flex items-center self-end my-2 md:my-0 w-full md:w-auto justify-end md:justify-start">
|
||||
|
||||
<label
|
||||
class="grow-0 btn btn-outline-primary mr-5"
|
||||
class="grow-0 btn mr-5"
|
||||
style="padding: 3px"
|
||||
:class="{'opacity-30': application.state === APPLICATION_APPROVED_STATE}"
|
||||
:class="{'opacity-30': application.state === APPLICATION_APPROVED_STATE, 'btn-outline-primary': !isLoadingDoc[index]}"
|
||||
|
||||
>
|
||||
<input type="file"
|
||||
@change="onFileChange(index, attachment, $event)"
|
||||
class="hidden"
|
||||
:disabled="application.state === APPLICATION_APPROVED_STATE"
|
||||
/>
|
||||
<UploadIcon class="w-7 h-7" />
|
||||
<LoadingIcon class="w-7 h-7" icon="oval" color="#003197" v-if="isLoadingDoc[index]" />
|
||||
<UploadIcon class="w-7 h-7" v-else />
|
||||
</label>
|
||||
<div class="grow-0">
|
||||
<CheckCircleIcon class="w-7 h-7 text-success" :class="{'text-danger': !attachment.attachment_size}" />
|
||||
|
|
@ -183,10 +185,14 @@ const { application } = storeToRefs(applicationStore);
|
|||
const docFile = ref(null);
|
||||
const validationError = ref({});
|
||||
|
||||
const isLoadingDoc = ref({});
|
||||
|
||||
const isApplying = ref(false);
|
||||
|
||||
const onFileChange = async (index, attachment, e) => {
|
||||
// todo: loading
|
||||
isLoadingDoc.value = {};
|
||||
isLoadingDoc.value[index] = true;
|
||||
|
||||
let files = e.target.files || e.dataTransfer.files
|
||||
|
||||
if (!files.length) {
|
||||
|
|
@ -199,6 +205,8 @@ const onFileChange = async (index, attachment, e) => {
|
|||
|
||||
await applicationStore.fileUpload(attachment.attachment_id, files[0]);
|
||||
}
|
||||
|
||||
isLoadingDoc.value[index] = false;
|
||||
}
|
||||
|
||||
const fileIsValid = (index, attachment) => {
|
||||
|
|
@ -224,6 +232,7 @@ const apply = async () => {
|
|||
};
|
||||
|
||||
const downloadQuestionnaire = async () => {
|
||||
// console.log(user.value.token);
|
||||
window.open(QUESTIONNAIRE_LINK + user.value.token, '_blank');
|
||||
// await applicationStore.downloadQuestionnaire(user.value.token);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue