added online broker application

This commit is contained in:
saparatayev 2023-03-31 12:01:21 +05:00
parent f2640d4ece
commit cb772279d6
6 changed files with 69 additions and 40 deletions

View File

@ -12,6 +12,9 @@ export const ALLOWED_FILE_TYPES = [
export const QUESTIONNAIRE_LINK = "/export-questionnaire/"; export const QUESTIONNAIRE_LINK = "/export-questionnaire/";
export const LETTER_LINK = "/doc/"; export const LETTER_LINK = "/doc/";
export const FAQ = "/storage/faq/"; export const FAQ = "/storage/faq/";
export const BANK_BLANK = "/storage/bank_blank.doc"
export const OBLIGATIONS_BLANK = "/storage/obligations_blank.doc"
export const REQUEST_LETTER = "/storage/request_letter.doc"
// Application states // Application states
export const APPLICATION_DRAFT_STATE = "draft"; export const APPLICATION_DRAFT_STATE = "draft";

View File

@ -189,4 +189,8 @@ export const locale = {
OPEN: "Open", OPEN: "Open",
CLOSED: "Closed", CLOSED: "Closed",
BROKER_APPLICATION_TWO: "Apply online for broker registration",
BANK_BLANK: "Bank form",
OBLIGATIONS_BLANK: "Obligations form",
}; };

View File

@ -190,4 +190,8 @@ export const locale = {
OPEN: "Открыть", OPEN: "Открыть",
CLOSED: "Закрыто", CLOSED: "Закрыто",
BROKER_APPLICATION_TWO: "Онлайн регистрация брокера",
BANK_BLANK: "Банковская форма",
OBLIGATIONS_BLANK: "Форма обязательств",
}; };

View File

@ -190,4 +190,8 @@ export const locale = {
OPEN :"Açyk", OPEN :"Açyk",
CLOSED:"Ýapyk", CLOSED:"Ýapyk",
BROKER_APPLICATION_TWO: "Dellal bolmak uçin onlaýn arza tabşyrmak",
BANK_BLANK: "Bank blank",
OBLIGATIONS_BLANK: "Borçlar blank",
}; };

View File

@ -19,7 +19,7 @@ export const useBrokerStore = defineStore({
const response = await fetchWrapper.get(`${baseUrl}`); const response = await fetchWrapper.get(`${baseUrl}`);
// update pinia state // update pinia state
this.application = response["data"]; this.brokerApplication = response["data"];
} catch (error) { } catch (error) {
// const alertStore = useAlertStore(); // const alertStore = useAlertStore();
// alertStore.error(error); // alertStore.error(error);

View File

@ -16,6 +16,7 @@
</div> </div>
<!-- BEGIN: Files --> <!-- BEGIN: Files -->
<div class="grid grid-cols-2 lg:grid-cols-1 xl:grid-cols-2 gap-3 mt-5"> <div class="grid grid-cols-2 lg:grid-cols-1 xl:grid-cols-2 gap-3 mt-5">
<!-- FILE 1 -->
<div <div
class="intro-y" class="intro-y"
> >
@ -24,23 +25,22 @@
> >
<a <a
:href="baseUrl + QUESTIONNAIRE_LINK" :href="baseUrl + BANK_BLANK"
class="w-3/5 file__icon file__icon--file mx-auto" class="w-3/5 file__icon file__icon--file mx-auto"
@click.prevent="downloadQuestionnaire"
> >
<div class="file__icon__file-name"> <div class="file__icon__file-name">
{{ EXTENSION_QUESTIONNAIRE_FILE }} {{ EXTENSION_QUESTIONNAIRE_FILE }}
</div> </div>
</a> </a>
<a <a
:href="baseUrl + QUESTIONNAIRE_LINK" :href="baseUrl + BANK_BLANK"
class="block font-medium mt-4 text-center truncate" class="block font-medium mt-4 text-center truncate"
@click.prevent="downloadQuestionnaire"
> >
{{ $t("NAME_QUESTIONNAIRE_FILE") }}.{{ EXTENSION_QUESTIONNAIRE_FILE.toLowerCase() }} {{ $t("BANK_BLANK") }}.{{ EXTENSION_QUESTIONNAIRE_FILE.toLowerCase() }}
</a> </a>
</div> </div>
</div> </div>
<!-- FILE 2 -->
<div <div
class="intro-y" class="intro-y"
> >
@ -48,12 +48,30 @@
class="file box rounded-md px-5 pt-8 pb-5 px-3 sm:px-5 relative zoom-in" class="file box rounded-md px-5 pt-8 pb-5 px-3 sm:px-5 relative zoom-in"
> >
<a :href="baseUrl + LETTER_LINK + accountType + '.' + EXTENSION_LETTER_FILE.toLowerCase()" class="w-3/5 file__icon file__icon--file mx-auto"> <a :href="baseUrl + OBLIGATIONS_BLANK" class="w-3/5 file__icon file__icon--file mx-auto">
<div class="file__icon__file-name"> <div class="file__icon__file-name">
{{ EXTENSION_LETTER_FILE }} {{ EXTENSION_LETTER_FILE }}
</div> </div>
</a> </a>
<a :href="baseUrl + LETTER_LINK + accountType + '.' + EXTENSION_LETTER_FILE.toLowerCase()" class="block font-medium mt-4 text-center truncate"> <a :href="baseUrl + OBLIGATIONS_BLANK" class="block font-medium mt-4 text-center truncate">
{{ $t("OBLIGATIONS_BLANK") }}.{{ EXTENSION_LETTER_FILE.toLowerCase() }}
</a>
</div>
</div>
<!-- FILE 3 -->
<div
class="intro-y"
>
<div
class="file box rounded-md px-5 pt-8 pb-5 px-3 sm:px-5 relative zoom-in"
>
<a :href="baseUrl + REQUEST_LETTER" class="w-3/5 file__icon file__icon--file mx-auto">
<div class="file__icon__file-name">
{{ EXTENSION_LETTER_FILE }}
</div>
</a>
<a :href="baseUrl + REQUEST_LETTER" class="block font-medium mt-4 text-center truncate">
{{ $t("NAME_LETTER_FILE") }}.{{ EXTENSION_LETTER_FILE.toLowerCase() }} {{ $t("NAME_LETTER_FILE") }}.{{ EXTENSION_LETTER_FILE.toLowerCase() }}
</a> </a>
</div> </div>
@ -64,22 +82,22 @@
<div class="intro-y col-span-3"> <div class="intro-y col-span-3">
<!-- BEGIN: Upload --> <!-- BEGIN: Upload -->
<div class="intro-y flex items-center my-8"> <div class="intro-y flex items-center my-8">
<h2 class="text-lg font-medium mr-auto">{{ $t("DOCUMENTS_TWO") }}</h2> <h2 class="text-lg font-medium mr-auto">{{ $t("BROKER_APPLICATION_TWO") }}</h2>
</div> </div>
<h4 v-html="$t('PLEASE_UPLOAD_DOCUMENTS_TWO')" class="text-md font-medium mr-auto pb-2"></h4> <h4 v-html="$t('PLEASE_UPLOAD_DOCUMENTS_TWO')" class="text-md font-medium mr-auto pb-2"></h4>
<div class="pb-6 text-primary"> <div class="pb-6 text-primary">
{{ $t("APPLICATION_PROCESS_DESCRIPTION_TWO") }} {{ $t("APPLICATION_PROCESS_DESCRIPTION_TWO") }}
</div> </div>
<div class="intro-y box p-5 mt-5" v-if="application"> <div class="intro-y box p-5 mt-5" v-if="brokerApplication">
<div <div
class="border border-slate-200/60 dark:border-darkmode-400 rounded-md p-5 divide-y md:divide-y-0" class="border border-slate-200/60 dark:border-darkmode-400 rounded-md p-5 divide-y md:divide-y-0"
> >
<!-- <template v-if="application"> --> <!-- <template v-if="brokerApplication"> -->
<!-- BEGIN 1.row --> <!-- BEGIN 1.row -->
<div <div
class="flex flex-wrap md:flex-nowrap items-center pt-2" class="flex flex-wrap md:flex-nowrap items-center pt-2"
v-for="(attachment, index) in application.attachments" v-for="(attachment, index) in brokerApplication.broker_attachments"
:key="attachment.id" :key="attachment.attachment_id"
> >
<div class="flex items-center self-end my-2 md:my-0 w-[55px]"> <div class="flex items-center self-end my-2 md:my-0 w-[55px]">
<Tippy <Tippy
@ -100,13 +118,13 @@
<label <label
class="grow-0 btn mr-5" class="grow-0 btn mr-5"
style="padding: 3px" style="padding: 3px"
:class="{'opacity-30': application.state === APPLICATION_APPROVED_STATE || application.state === APPLICATION_ACCEPTED_STATE, 'btn-outline-primary': !isLoadingDoc[index]}" :class="{'opacity-30': brokerApplication.state === APPLICATION_APPROVED_STATE || brokerApplication.state === APPLICATION_ACCEPTED_STATE, 'btn-outline-primary': !isLoadingDoc[index]}"
> >
<input type="file" <input type="file"
@change="onFileChange(index, attachment, $event)" @change="onFileChange(index, attachment, $event)"
class="hidden" class="hidden"
:disabled="application.state === APPLICATION_APPROVED_STATE || application.state === APPLICATION_ACCEPTED_STATE" :disabled="brokerApplication.state === APPLICATION_APPROVED_STATE || brokerApplication.state === APPLICATION_ACCEPTED_STATE"
/> />
<LoadingIcon class="w-7 h-7" icon="oval" color="#003197" v-if="isLoadingDoc[index]" /> <LoadingIcon class="w-7 h-7" icon="oval" color="#003197" v-if="isLoadingDoc[index]" />
<UploadIcon class="w-7 h-7" v-else /> <UploadIcon class="w-7 h-7" v-else />
@ -123,20 +141,20 @@
</div> </div>
<Alert <Alert
class="font-medium alert-secondary mt-4" class="font-medium alert-secondary mt-4"
v-if="application.state === APPLICATION_REFINE_STATE" v-if="brokerApplication.state === APPLICATION_REFINE_STATE"
> >
{{ $t('APPLICATION_NEEDS_TO_BE_IMPROVED_TEXT_INTRO') }} <br> {{ $t('APPLICATION_NEEDS_TO_BE_IMPROVED_TEXT_INTRO') }} <br>
<template v-if="application.refine_note"> <template v-if="brokerApplication.refine_note">
{{ $t('REFINE_NOTE') }}: {{ application.refine_note }} {{ $t('REFINE_NOTE') }}: {{ brokerApplication.refine_note }}
</template> </template>
<br> <br>
<i18n-t <i18n-t
v-if="application.ticket" v-if="brokerApplication.ticket"
keypath="APPLICATION_NEEDS_TO_BE_IMPROVED_TEXT" keypath="APPLICATION_NEEDS_TO_BE_IMPROVED_TEXT"
for="APPLICATION_NEEDS_TO_BE_IMPROVED_LINK" for="APPLICATION_NEEDS_TO_BE_IMPROVED_LINK"
> >
<a <a
@click.prevent="goToTicket(application.ticket.id)" @click.prevent="goToTicket(brokerApplication.ticket.id)"
href="#" href="#"
class="font-bold underline" class="font-bold underline"
> >
@ -147,29 +165,29 @@
<Alert <Alert
class="font-medium mt-4 alert-primary" class="font-medium mt-4 alert-primary"
v-if="application.state === APPLICATION_ACCEPTED_STATE" v-if="brokerApplication.state === APPLICATION_ACCEPTED_STATE"
> >
{{ $t('APPLICATION_ACCEPTED_BY', {accepted_by: application.accepted_by}) }} {{ $t('APPLICATION_ACCEPTED_BY', {accepted_by: brokerApplication.accepted_by}) }}
<br> <br>
{{ $t('APPLICATION_ACCEPTED_DATE', {accepted_date: normalizeDate(application.accepted_date)}) }} {{ $t('APPLICATION_ACCEPTED_DATE', {accepted_date: normalizeDate(brokerApplication.accepted_date)}) }}
</Alert> </Alert>
<Alert <Alert
class="font-medium text-white mt-4 alert-success" class="font-medium text-white mt-4 alert-success"
v-if="application.state === APPLICATION_APPROVED_STATE" v-if="brokerApplication.state === APPLICATION_APPROVED_STATE"
> >
{{ $t('APPLICATION_APPROVED_BY', {approved_by: application.approved_by}) }} {{ $t('APPLICATION_APPROVED_BY', {approved_by: brokerApplication.approved_by}) }}
<br> <br>
{{ $t('APPLICATION_APPROVED_DATE', {approved_date: application.approved_date}) }} {{ $t('APPLICATION_APPROVED_DATE', {approved_date: normalizeDate(brokerApplication.approved_date)}) }}
</Alert> </Alert>
<Alert <Alert
class="font-medium alert-warning mt-4" class="font-medium alert-warning mt-4"
v-if="application.state === APPLICATION_NEW_STATE" v-if="brokerApplication.state === APPLICATION_NEW_STATE"
> >
{{ $t('APPLICATION_APPLIED') }} {{ $t('APPLICATION_APPLIED') }}
</Alert> </Alert>
<div <div
class="flex justify-end mt-4" class="flex justify-end mt-4"
v-if="application.state === APPLICATION_NEW_STATE || application.state === APPLICATION_REFINE_STATE || application.state === APPLICATION_DRAFT_STATE" v-if="brokerApplication.state === APPLICATION_NEW_STATE || brokerApplication.state === APPLICATION_REFINE_STATE || brokerApplication.state === APPLICATION_DRAFT_STATE"
> >
<button class="btn btn-primary" @click="apply" :disabled="isApplying"> <button class="btn btn-primary" @click="apply" :disabled="isApplying">
{{ $t("APPLY") }} {{ $t("APPLY") }}
@ -194,8 +212,9 @@ import { storeToRefs } from 'pinia';
import { import {
BYTES_IN_KB, BYTES_IN_KB,
ALLOWED_FILE_TYPES, ALLOWED_FILE_TYPES,
QUESTIONNAIRE_LINK, OBLIGATIONS_BLANK,
LETTER_LINK, BANK_BLANK,
REQUEST_LETTER,
APPLICATION_DRAFT_STATE, APPLICATION_DRAFT_STATE,
APPLICATION_NEW_STATE, APPLICATION_NEW_STATE,
APPLICATION_ACCEPTED_STATE, APPLICATION_ACCEPTED_STATE,
@ -218,7 +237,7 @@ const accountType = ref("");
const brokerStore = useBrokerStore(); const brokerStore = useBrokerStore();
const { application } = storeToRefs(brokerStore); const { brokerApplication } = storeToRefs(brokerStore);
const docFile = ref(null); const docFile = ref(null);
const validationError = ref({}); const validationError = ref({});
@ -235,6 +254,7 @@ const onFileChange = async (index, attachment, e) => {
if (!files.length) { if (!files.length) {
docFile.value = null; docFile.value = null;
isLoadingDoc.value = {};
return return
} }
docFile.value = files[0] docFile.value = files[0]
@ -269,7 +289,7 @@ const checkRequiredFilesUploaded = () => {
let validToContinueRequest = true; let validToContinueRequest = true;
application.value.attachments.forEach((element, index) => { brokerApplication.value.broker_attachments.forEach((element, index) => {
if(element.is_required && !element.attachment_file_path) { if(element.is_required && !element.attachment_file_path) {
validationError.value[index] = i18nn.global.t('REQUIRED_VALIDATION'); validationError.value[index] = i18nn.global.t('REQUIRED_VALIDATION');
validToContinueRequest = false; validToContinueRequest = false;
@ -292,18 +312,12 @@ const goToTicket = (ticketId) => {
router.push({ name: "ticket-list", query: { ticketId: ticketId } }); router.push({ name: "ticket-list", query: { ticketId: ticketId } });
}; };
const downloadQuestionnaire = async () => {
// console.log(user.value.token);
window.open(baseUrl + QUESTIONNAIRE_LINK + user.value.token, '_blank');
// await brokerStore.downloadQuestionnaire(user.value.token);
};
onBeforeMount(async () => { onBeforeMount(async () => {
await brokerStore.getApplication(); await brokerStore.getApplication();
if(!application.value) { if(!brokerApplication.value) {
router.push({ name: "error-page" }); router.push({ name: "error-page" });
} }
console.log(application.value); console.log(brokerApplication.value);
accountType.value = localStorage.getItem('account_type'); accountType.value = localStorage.getItem('account_type');
}); });