hl-core 0.0.8-beta.4 → 0.0.8-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/index.ts +17 -10
- package/components/Form/ManagerAttachment.vue +196 -0
- package/components/Pages/Anketa.vue +3 -3
- package/components/Pages/MemberForm.vue +5 -5
- package/components/Pages/ProductConditions.vue +6 -4
- package/composables/classes.ts +26 -22
- package/composables/constants.ts +1 -0
- package/configs/i18n.ts +19 -0
- package/locales/en.json +396 -0
- package/locales/kz.json +396 -0
- package/locales/ru.json +396 -0
- package/nuxt.config.ts +8 -0
- package/package.json +5 -1
- package/plugins/helperFunctionsPlugins.ts +2 -0
- package/plugins/storePlugin.ts +0 -1
- package/store/data.store.js +29 -30
- package/store/member.store.ts +1 -1
- package/store/rules.js +13 -3
- package/types/index.ts +14 -0
- package/store/messages.ts +0 -434
package/store/data.store.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
|
-
import { t } from './messages';
|
|
3
2
|
import { rules } from './rules';
|
|
3
|
+
import { i18n } from '@/configs/i18n';
|
|
4
4
|
import { Toast, Types, Positions, ToastOptions } from './toast';
|
|
5
5
|
import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate } from '../composables';
|
|
6
6
|
import { DataStoreClass, Contragent } from '../composables/classes';
|
|
@@ -10,7 +10,7 @@ import { useFormStore } from './form.store';
|
|
|
10
10
|
export const useDataStore = defineStore('data', {
|
|
11
11
|
state: () => ({
|
|
12
12
|
...new DataStoreClass(),
|
|
13
|
-
t: t,
|
|
13
|
+
t: i18n.t,
|
|
14
14
|
rules: rules,
|
|
15
15
|
toast: Toast,
|
|
16
16
|
toastTypes: Types,
|
|
@@ -38,6 +38,7 @@ export const useDataStore = defineStore('data', {
|
|
|
38
38
|
isLiferenta: state => state.product === 'liferenta',
|
|
39
39
|
isPension: state => state.product === 'pension',
|
|
40
40
|
isGons: state => state.product === 'gons',
|
|
41
|
+
isKazyna: state => state.product === 'halykkazyna',
|
|
41
42
|
isEveryFormDisabled: state => Object.values(state.formStore.isDisabled).every(i => i === true),
|
|
42
43
|
},
|
|
43
44
|
actions: {
|
|
@@ -958,14 +959,20 @@ export const useDataStore = defineStore('data', {
|
|
|
958
959
|
async getFromApi(whichField, whichRequest, parameter, reset = false) {
|
|
959
960
|
const storageValue = JSON.parse(localStorage.getItem(whichField) || 'null');
|
|
960
961
|
const currentHour = new Date().getHours();
|
|
962
|
+
const currentMinutePart = Math.ceil((new Date().getMinutes() + 1) / 15);
|
|
961
963
|
|
|
962
964
|
const getDataCondition = () => {
|
|
963
965
|
if (!storageValue) return true;
|
|
964
966
|
const hasHourKey = 'hour' in storageValue;
|
|
967
|
+
const hasMiniteKey = 'minute' in storageValue;
|
|
965
968
|
const hasModeKey = 'mode' in storageValue;
|
|
966
969
|
const hasValueKey = 'value' in storageValue;
|
|
967
|
-
if (storageValue && (hasHourKey === false || hasModeKey === false || hasValueKey === false)) return true;
|
|
968
|
-
if (
|
|
970
|
+
if (storageValue && (hasHourKey === false || hasMiniteKey === false || hasModeKey === false || hasValueKey === false)) return true;
|
|
971
|
+
if (
|
|
972
|
+
storageValue &&
|
|
973
|
+
(storageValue.hour !== currentHour || storageValue.minute !== currentMinutePart || storageValue.mode !== import.meta.env.MODE || storageValue.value.length === 0)
|
|
974
|
+
)
|
|
975
|
+
return true;
|
|
969
976
|
};
|
|
970
977
|
if (!!getDataCondition() || reset === true) {
|
|
971
978
|
this[whichField] = [];
|
|
@@ -977,6 +984,7 @@ export const useDataStore = defineStore('data', {
|
|
|
977
984
|
JSON.stringify({
|
|
978
985
|
value: response,
|
|
979
986
|
hour: currentHour,
|
|
987
|
+
minute: currentMinutePart,
|
|
980
988
|
mode: import.meta.env.MODE,
|
|
981
989
|
}),
|
|
982
990
|
);
|
|
@@ -1047,16 +1055,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1047
1055
|
});
|
|
1048
1056
|
},
|
|
1049
1057
|
async getDicFileTypeList() {
|
|
1050
|
-
|
|
1051
|
-
if (this.dicFileTypeList.length) {
|
|
1052
|
-
return this.dicFileTypeList;
|
|
1053
|
-
} else {
|
|
1054
|
-
this.dicFileTypeList = await this.api.getDicFileTypeList();
|
|
1055
|
-
return this.dicFileTypeList;
|
|
1056
|
-
}
|
|
1057
|
-
} catch (err) {
|
|
1058
|
-
console.log(err.response.data);
|
|
1059
|
-
}
|
|
1058
|
+
return await this.getFromApi('dicFileTypeList', 'getDicFileTypeList');
|
|
1060
1059
|
},
|
|
1061
1060
|
async getDocumentIssuers() {
|
|
1062
1061
|
return await this.getFromApi('documentIssuers', 'getDocumentIssuers');
|
|
@@ -1207,6 +1206,9 @@ export const useDataStore = defineStore('data', {
|
|
|
1207
1206
|
this.getProcessIndexRate(),
|
|
1208
1207
|
this.getProcessTariff(),
|
|
1209
1208
|
this.getProcessPaymentPeriod(),
|
|
1209
|
+
this.getDicFileTypeList(),
|
|
1210
|
+
this.getDictionaryItems('RegionPolicy'),
|
|
1211
|
+
this.getDictionaryItems('SaleChanellPolicy'),
|
|
1210
1212
|
]);
|
|
1211
1213
|
},
|
|
1212
1214
|
async getUserGroups() {
|
|
@@ -1254,15 +1256,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1254
1256
|
},
|
|
1255
1257
|
async searchAgentByName(name) {
|
|
1256
1258
|
try {
|
|
1257
|
-
this.
|
|
1258
|
-
|
|
1259
|
-
if (!this.AgentDataList.length) {
|
|
1259
|
+
this.AgentData = await this.api.searchAgentByName(name);
|
|
1260
|
+
if (!this.AgentData.length) {
|
|
1260
1261
|
this.showToaster('error', this.t('toaster.notFound'), 1500);
|
|
1261
1262
|
}
|
|
1262
1263
|
} catch (err) {
|
|
1263
1264
|
console.log(err);
|
|
1264
|
-
} finally {
|
|
1265
|
-
this.isLoading = false;
|
|
1266
1265
|
}
|
|
1267
1266
|
},
|
|
1268
1267
|
async setINSISWorkData() {
|
|
@@ -1291,14 +1290,14 @@ export const useDataStore = defineStore('data', {
|
|
|
1291
1290
|
this.isLoading = false;
|
|
1292
1291
|
}
|
|
1293
1292
|
},
|
|
1294
|
-
async
|
|
1293
|
+
async getDictionaryItems(dictName) {
|
|
1294
|
+
return await this.getFromApi(dictName, 'getDictionaryItems', dictName);
|
|
1295
|
+
},
|
|
1296
|
+
async filterManagerByRegion(filterName) {
|
|
1295
1297
|
try {
|
|
1296
|
-
this.
|
|
1297
|
-
this[`${dictName}List`] = await this.api.filterManagerByRegion(dictName, filterName);
|
|
1298
|
+
this.ManagerPolicy = await this.api.filterManagerByRegion('ManagerPolicy', filterName);
|
|
1298
1299
|
} catch (err) {
|
|
1299
1300
|
console.log(err);
|
|
1300
|
-
} finally {
|
|
1301
|
-
this.isLoading = false;
|
|
1302
1301
|
}
|
|
1303
1302
|
},
|
|
1304
1303
|
async getUnderwritingCouncilData(id) {
|
|
@@ -1913,7 +1912,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1913
1912
|
const localMembers = [...this.formStore[localKey]].sort((a, b) => a.id - b.id);
|
|
1914
1913
|
const applicationMembers = [...this.formStore.applicationData[applicationKey]].sort((a, b) => a.insisId - b.insisId);
|
|
1915
1914
|
if (localMembers.every((each, index) => applicationMembers[index].insisId === each.id && applicationMembers[index].iin === each.iin.replace(/-/g, '')) === false) {
|
|
1916
|
-
this.showToaster('error', this.t('toaster.notSavedMember'
|
|
1915
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
1917
1916
|
return false;
|
|
1918
1917
|
}
|
|
1919
1918
|
if (localKey === this.formStore.beneficiaryFormKey) {
|
|
@@ -1928,15 +1927,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1928
1927
|
}
|
|
1929
1928
|
} else {
|
|
1930
1929
|
if (this.formStore[localKey].some(i => i.iin !== null)) {
|
|
1931
|
-
this.showToaster('error', this.t('toaster.notSavedMember'
|
|
1930
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
1932
1931
|
return false;
|
|
1933
1932
|
}
|
|
1934
1933
|
if (this.formStore.applicationData[applicationKey].length !== 0) {
|
|
1935
|
-
this.showToaster('error', this.t('toaster.notSavedMember'
|
|
1934
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
1936
1935
|
return false;
|
|
1937
1936
|
} else {
|
|
1938
1937
|
if (this.formStore[localKey][0].iin !== null) {
|
|
1939
|
-
this.showToaster('error', this.t('toaster.notSavedMember'
|
|
1938
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
1940
1939
|
return false;
|
|
1941
1940
|
}
|
|
1942
1941
|
}
|
|
@@ -1949,7 +1948,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1949
1948
|
return false;
|
|
1950
1949
|
}
|
|
1951
1950
|
if (this.formStore.policyholderForm.id !== this.formStore.applicationData.clientApp.insisId) {
|
|
1952
|
-
this.showToaster('error', this.t('toaster.notSavedMember'
|
|
1951
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
|
|
1953
1952
|
return false;
|
|
1954
1953
|
}
|
|
1955
1954
|
if (!this.isGons) {
|
|
@@ -1981,7 +1980,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1981
1980
|
}
|
|
1982
1981
|
}
|
|
1983
1982
|
}
|
|
1984
|
-
if (
|
|
1983
|
+
if (this.controls.hasAttachment) {
|
|
1985
1984
|
const areValid = this.formStore.SaleChanellPolicy.nameRu && this.formStore.RegionPolicy.nameRu && this.formStore.ManagerPolicy.nameRu && this.formStore.AgentData.fullName;
|
|
1986
1985
|
if (areValid) {
|
|
1987
1986
|
await this.setINSISWorkData();
|
package/store/member.store.ts
CHANGED
|
@@ -264,7 +264,7 @@ export const useMemberStore = defineStore('members', {
|
|
|
264
264
|
}
|
|
265
265
|
} else {
|
|
266
266
|
if (onInit === false) {
|
|
267
|
-
this.dataStore.showToaster('error', this.dataStore.t('toaster.errorFormField'
|
|
267
|
+
this.dataStore.showToaster('error', this.dataStore.t('toaster.errorFormField', { text: 'Номер телефона, ИИН' }));
|
|
268
268
|
this.dataStore.isLoading = false;
|
|
269
269
|
}
|
|
270
270
|
}
|
package/store/rules.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i18n } from '@/configs/i18n';
|
|
2
2
|
import { formatDate } from '../composables';
|
|
3
3
|
|
|
4
|
+
const t = i18n.t;
|
|
5
|
+
|
|
4
6
|
export const rules = {
|
|
5
|
-
recalculationMultiply: [v => (v !== null && v !== '' && v >= 100) || t('toaster.valueShouldBeHigher'
|
|
6
|
-
recalculationAdditive: [v => (v !== null && v !== '' && v <= 100 && v >= 0) || t('toaster.valueShouldBeBetween'
|
|
7
|
+
recalculationMultiply: [v => (v !== null && v !== '' && v >= 100) || t('toaster.valueShouldBeHigher', { text: '100' })],
|
|
8
|
+
recalculationAdditive: [v => (v !== null && v !== '' && v <= 100 && v >= 0) || t('toaster.valueShouldBeBetween', { floor: '0', ceil: '100' })],
|
|
7
9
|
required: [v => !!v || t('rules.required')],
|
|
8
10
|
objectRequired: [
|
|
9
11
|
v => {
|
|
@@ -13,6 +15,14 @@ export const rules = {
|
|
|
13
15
|
return t('rules.required');
|
|
14
16
|
},
|
|
15
17
|
],
|
|
18
|
+
agentDataRequired: [
|
|
19
|
+
v => {
|
|
20
|
+
if (!!v && 'fullName' in v && v.fullName != null) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return t('rules.required');
|
|
24
|
+
},
|
|
25
|
+
],
|
|
16
26
|
noResident: [
|
|
17
27
|
v => {
|
|
18
28
|
if (!!v && 'nameRu' in v && v.nameRu === 'Нерезидент') {
|
package/types/index.ts
CHANGED
|
@@ -300,4 +300,18 @@ declare global {
|
|
|
300
300
|
taskId: string;
|
|
301
301
|
comment?: string;
|
|
302
302
|
};
|
|
303
|
+
|
|
304
|
+
type AgentData = {
|
|
305
|
+
agentId?: number | null;
|
|
306
|
+
manId?: number;
|
|
307
|
+
fullName?: string;
|
|
308
|
+
officeId?: number | null;
|
|
309
|
+
officeCode?: string | null;
|
|
310
|
+
saleChannel?: string;
|
|
311
|
+
staffId?: number;
|
|
312
|
+
managerName?: string;
|
|
313
|
+
mainAgentId?: string | null;
|
|
314
|
+
agentNo?: string;
|
|
315
|
+
iin?: string | null;
|
|
316
|
+
};
|
|
303
317
|
}
|