new featured added
This commit is contained in:
parent
3671f4001d
commit
ebe8d24c07
|
|
@ -6,29 +6,84 @@
|
|||
<Calculator @on-enter="(number) => onEnter(number)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex sm:w-2/3 intro-y grid grid-cols-1 lg:grid-cols-2 gap-6">
|
||||
<div v-if="!firstTouched"
|
||||
class="flex sm:w-2/3 intro-y grid grid-cols-1 lg:grid-cols-1 text-center m-auto text-primary text-lg">
|
||||
{{ $t('FIRST_TOUCH_WARNING') }}
|
||||
</div>
|
||||
<div v-else-if="isLoading"
|
||||
class="flex sm:w-2/3 intro-y grid grid-cols-1 lg:grid-cols-1 text-center m-auto text-primary text-lg">
|
||||
{{ $t('LOADING') }} ..
|
||||
</div>
|
||||
<div v-else-if="!hasNumber"
|
||||
class="flex sm:w-2/3 intro-y grid grid-cols-1 lg:grid-cols-1 text-center m-auto text-primary text-lg">
|
||||
{{ $t('DATA_NOT_FOUND') }}
|
||||
</div>
|
||||
<div v-else class="flex sm:w-2/3 intro-y grid grid-cols-1 lg:grid-cols-2 gap-6">
|
||||
<PreviewComponent class="intro-y box text-center font-semibold text-lg pt-3">{{ $t('DEP_REG') }}
|
||||
<div class="text-sm">
|
||||
<div class="flex pl-4 m-2">
|
||||
<div class="flex">
|
||||
<div class="font-medium">{{ $t('STATUS') }} :</div>
|
||||
<div class="font-normal pl-3"> 67567567 </div>
|
||||
<div class="font-normal pl-3"> {{ contractREG.status }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex pl-4 m-2">
|
||||
<div class="flex">
|
||||
<div class="font-medium">{{ $t('NOTE') }} :</div>
|
||||
<div class="font-normal pl-3"> 67567567 </div>
|
||||
<div class="font-normal pl-3"> {{ contractREG.note }} </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</PreviewComponent>
|
||||
<PreviewComponent class="intro-y box text-center font-weight text-lg pt-3">{{ $t('DEP_ANALYSYS') }}
|
||||
<PreviewComponent class="intro-y box text-center font-semibold text-lg pt-3">{{ $t('DEP_ANALYSYS') }}
|
||||
<div class="text-sm">
|
||||
<div class="flex pl-4 m-2">
|
||||
<div class="flex">
|
||||
<div class="font-medium">{{ $t('STATUS') }} :</div>
|
||||
<div class="font-normal pl-3"> {{ contractMAR.status }} </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex pl-4 m-2">
|
||||
<div class="flex">
|
||||
<div class="font-medium">{{ $t('NOTE') }} :</div>
|
||||
<div class="font-normal pl-3"> {{ contractMAR.note }} </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</PreviewComponent>
|
||||
<PreviewComponent class="intro-y box text-center font-weight text-lg pt-3">{{ $t('TDHCMB_RESULT') }}
|
||||
<PreviewComponent class="intro-y box text-center font-semibold text-lg pt-3">{{ $t('TDHCMB_RESULT') }}
|
||||
<div class="text-sm">
|
||||
<div class="flex pl-4 m-2">
|
||||
<div class="flex">
|
||||
<div class="font-medium">{{ $t('STATUS') }} :</div>
|
||||
<div class="font-normal pl-3"> {{ contractRESULT.status }} </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex pl-4 m-2">
|
||||
<div class="flex">
|
||||
<div class="font-medium">{{ $t('NOTE') }} :</div>
|
||||
<div class="font-normal pl-3"> {{ contractRESULT.note }} </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</PreviewComponent>
|
||||
<PreviewComponent class="intro-y box text-center font-weight text-lg pt-3">{{ $t('DIR_LAW_AND_JUSTICE')
|
||||
<PreviewComponent class="intro-y box text-center font-semibold text-lg pt-3">{{
|
||||
$t('DIR_LAW_AND_JUSTICE')
|
||||
}}
|
||||
<div class="text-sm">
|
||||
<div class="flex pl-4 m-2">
|
||||
<div class="flex">
|
||||
<div class="font-medium">{{ $t('STATUS') }} :</div>
|
||||
<div class="font-normal pl-3"> {{ contractJUS.status }} </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex pl-4 m-2">
|
||||
<div class="flex">
|
||||
<div class="font-medium">{{ $t('NOTE') }} :</div>
|
||||
<div class="font-normal pl-3"> {{ contractJUS.note }} </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</PreviewComponent>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -40,6 +95,7 @@ import Calculator from "@/components/calculator/Main.vue";
|
|||
import { fetchWrapper } from "@/api";
|
||||
import { ref, reactive } from "vue";
|
||||
import { helper as $h } from "@/utils/helper";
|
||||
import { delay } from "@/helpers";
|
||||
|
||||
const baseUrl = `${import.meta.env.VITE_API_URL}/api`;
|
||||
|
||||
|
|
@ -47,22 +103,33 @@ const isLoading = ref(false);
|
|||
const hasNumber = ref(false);
|
||||
const firstTouched = ref(false);
|
||||
|
||||
let contract = reactive({});
|
||||
// Hasaba alys bolumi
|
||||
let contractREG = reactive({});
|
||||
|
||||
// Baha seljeris we analiz
|
||||
let contractMAR = reactive({});
|
||||
|
||||
// Yuridicski otdel
|
||||
let contractJUS = reactive({});
|
||||
|
||||
// TDHCMB_RESULT (5 orunbasar, 10 baslyk)
|
||||
let contractRESULT = reactive({});
|
||||
|
||||
const onEnter = async (number) => {
|
||||
|
||||
// reset contract
|
||||
Object.assign(contract, {});
|
||||
Object.assign(contractREG, {});
|
||||
Object.assign(contractMAR, {});
|
||||
Object.assign(contractJUS, {});
|
||||
Object.assign(contractRESULT, {});
|
||||
|
||||
firstTouched.value = true;
|
||||
|
||||
console.log("NUMBER ENTERED: " + number);
|
||||
|
||||
try {
|
||||
hasNumber.value = false;
|
||||
isLoading.value = true;
|
||||
|
||||
// await delay(2000)
|
||||
await delay(2000)
|
||||
|
||||
const response = await fetchWrapper.post(
|
||||
`${baseUrl}/contract`,
|
||||
|
|
@ -71,16 +138,35 @@ const onEnter = async (number) => {
|
|||
}
|
||||
);
|
||||
|
||||
isLoading.value = false;
|
||||
|
||||
console.log('responseeeeee ', response);
|
||||
|
||||
|
||||
if ('data' in response) {
|
||||
Object.assign(contract, response.data);
|
||||
contract.InputDate = $h.formatDate(contract.InputDate, "DD.MM.YYYY");
|
||||
contract.RegDate = $h.formatDate(contract.RegDate, "DD.MM.YYYY");
|
||||
console.log("contract: ", contract);
|
||||
// Object.assign(contract, response.data);
|
||||
// contract.InputDate = $h.formatDate(contract.InputDate, "DD.MM.YYYY");
|
||||
// contract.RegDate = $h.formatDate(contract.RegDate, "DD.MM.YYYY");
|
||||
// console.log("contract: ", contract);
|
||||
hasNumber.value = true;
|
||||
|
||||
const resolutionBasis = response['data']['ResolutionBasis'];
|
||||
|
||||
console.log("resolution basis: ", resolutionBasis);
|
||||
|
||||
const depReg = resolutionBasis.filter(e => e.department_id == 1);
|
||||
const depMAR = resolutionBasis.filter(e => e.department_id == 2);
|
||||
const depJUS = resolutionBasis.filter(e => e.department_id == 3);
|
||||
const depRES = resolutionBasis.filter(e => e.department_id == 5 || e.department_id == 10);
|
||||
|
||||
// assign the last item
|
||||
Object.assign(contractREG, depReg[depReg.length - 1]);
|
||||
Object.assign(contractMAR, depMAR[depMAR.length - 1]);
|
||||
Object.assign(contractJUS, depJUS[depJUS.length - 1]);
|
||||
Object.assign(contractRESULT, depRES[depRES.length - 1]);
|
||||
|
||||
}
|
||||
|
||||
isLoading.value = false;
|
||||
|
||||
} catch (error) {
|
||||
console.log("contract error ", error);
|
||||
|
|
|
|||
Loading…
Reference in New Issue