hl-core 0.0.8 → 0.0.9-beta.2

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.
Files changed (63) hide show
  1. package/api/index.ts +142 -101
  2. package/api/interceptors.ts +17 -13
  3. package/components/Button/Btn.vue +1 -1
  4. package/components/Button/ScrollButtons.vue +2 -2
  5. package/components/Complex/MessageBlock.vue +26 -0
  6. package/components/Complex/Page.vue +1 -1
  7. package/components/Dialog/Dialog.vue +9 -39
  8. package/components/Dialog/FamilyDialog.vue +7 -4
  9. package/components/Form/FormBlock.vue +90 -42
  10. package/components/Form/FormSection.vue +4 -1
  11. package/components/Form/FormToggle.vue +1 -2
  12. package/components/Form/ManagerAttachment.vue +197 -0
  13. package/components/Form/ProductConditionsBlock.vue +68 -14
  14. package/components/Input/Datepicker.vue +45 -0
  15. package/components/Input/FileInput.vue +2 -3
  16. package/components/Input/FormInput.vue +31 -7
  17. package/components/Input/PanelInput.vue +7 -2
  18. package/components/Input/RoundedInput.vue +2 -2
  19. package/components/Input/RoundedSelect.vue +137 -0
  20. package/components/Layout/Drawer.vue +4 -2
  21. package/components/Layout/Header.vue +40 -4
  22. package/components/Layout/Loader.vue +1 -1
  23. package/components/Layout/SettingsPanel.vue +51 -13
  24. package/components/Menu/MenuHover.vue +30 -0
  25. package/components/Menu/MenuNav.vue +29 -13
  26. package/components/Menu/MenuNavItem.vue +6 -3
  27. package/components/Pages/Anketa.vue +59 -33
  28. package/components/Pages/Auth.vue +139 -46
  29. package/components/Pages/Documents.vue +7 -7
  30. package/components/Pages/InvoiceInfo.vue +30 -0
  31. package/components/Pages/MemberForm.vue +544 -293
  32. package/components/Pages/ProductAgreement.vue +4 -2
  33. package/components/Pages/ProductConditions.vue +673 -75
  34. package/components/Panel/PanelHandler.vue +304 -0
  35. package/components/Panel/PanelSelectItem.vue +1 -1
  36. package/components/Transitions/SlideTransition.vue +5 -0
  37. package/components/Utilities/Chip.vue +27 -0
  38. package/components/Utilities/JsonViewer.vue +27 -0
  39. package/composables/axios.ts +1 -1
  40. package/composables/classes.ts +223 -101
  41. package/composables/constants.ts +26 -51
  42. package/composables/index.ts +80 -2
  43. package/composables/styles.ts +15 -3
  44. package/configs/i18n.ts +17 -0
  45. package/layouts/default.vue +6 -6
  46. package/locales/kz.json +585 -0
  47. package/locales/ru.json +587 -0
  48. package/nuxt.config.ts +13 -1
  49. package/package.json +43 -11
  50. package/pages/500.vue +2 -2
  51. package/pages/Token.vue +51 -0
  52. package/plugins/helperFunctionsPlugins.ts +6 -0
  53. package/plugins/storePlugin.ts +0 -1
  54. package/plugins/vuetifyPlugin.ts +8 -1
  55. package/store/data.store.ts +2649 -0
  56. package/store/form.store.ts +1 -1
  57. package/store/member.store.ts +164 -52
  58. package/store/{rules.js → rules.ts} +65 -34
  59. package/types/enum.ts +83 -0
  60. package/types/env.d.ts +10 -0
  61. package/types/index.ts +262 -5
  62. package/store/data.store.js +0 -2482
  63. package/store/messages.ts +0 -429
@@ -1,65 +1,40 @@
1
+ import { Actions, PostActions, Roles, Statuses } from '../types/enum';
2
+
1
3
  export const constants = Object.freeze({
2
4
  products: {
3
- pensionannuity: 1,
4
5
  baiterek: 3,
5
6
  halykmycar: 5,
6
7
  lifetrip: 7,
7
8
  bolashak: 8,
8
9
  liferenta: 9,
9
10
  gons: 10,
11
+ halykkazyna: 11,
10
12
  },
11
-
12
- editableStatuses: ['StartForm', 'EditBeneficiaryForm', 'EditForm'],
13
- documentsLinkVisibleStatuses: ['DocumentsSignedFrom', 'UnderwriterForm', 'AffilationResolutionForm', 'Completed', 'InsurancePremiumOnlinePaid'],
13
+ editableStatuses: [Statuses.StartForm, Statuses.EditBeneficiaryForm, Statuses.EditForm],
14
+ documentsLinkVisibleStatuses: [
15
+ Statuses.DocumentsSignedFrom,
16
+ Statuses.UnderwriterForm,
17
+ Statuses.AffilationResolutionForm,
18
+ Statuses.Completed,
19
+ Statuses.InsurancePremiumOnlinePaid,
20
+ ],
21
+ returnStatementStatuses: [Statuses.DocumentsSignedFrom, Statuses.ContractSignedFrom, Statuses.WaitingInsurancePremiumForm, Statuses.UnderwriterForm],
22
+ cancelApplicationStatuses: [
23
+ Statuses.StartForm,
24
+ Statuses.EditForm,
25
+ Statuses.EditBeneficiaryForm,
26
+ Statuses.WaitingInsurancePremiumForm,
27
+ Statuses.DocumentsSignedFrom,
28
+ Statuses.ContractSignedFrom,
29
+ ],
14
30
  gbdErrors: ['INVALID', 'TIMEOUT', 'ERROR', 'NOT_FOUND'],
15
- types: {
16
- string: 'string',
17
- array: 'object',
18
- object: 'object',
19
- },
20
- roles: {
21
- manager: 'Manager',
22
- admin: 'Admin',
23
- underwriter: 'Underwriter',
24
- agent: 'Agent',
25
- compliance: 'Compliance',
26
- agentMycar: 'AgentMycar',
27
- analyst: 'Analyst',
28
- upk: 'UPK',
29
- financeCenter: 'FinanceCenter',
30
- supervisor: 'Supervisor',
31
- support: 'Support',
32
- managerHalykBank: 'ManagerHalykBank',
33
- serviceManager: 'ServiceManager',
34
- },
35
- actions: {
36
- accept: 'accept',
37
- rejectclient: 'rejectclient',
38
- reject: 'reject',
39
- return: 'return',
40
- claim: 'claim',
41
- signed: 'signed',
42
- payed: 'payed',
43
- },
31
+ roles: Roles,
32
+ actions: Actions,
33
+ postActions: PostActions,
44
34
  yearCases: [2, 0, 1, 1, 1, 2],
45
35
  yearTitles: ['год', 'года', 'лет'],
46
- panelActions: {
47
- accept: 'accept',
48
- claim: 'claim',
49
- return: 'return',
50
- reject: 'reject',
51
- rejectclient: 'rejectclient',
52
- },
53
- postActions: {
54
- font: 'font',
55
- route: 'route',
56
- applicationCreated: 'applicationCreated',
57
- clipboard: 'clipboard',
58
- toHomePage: 'toHomePage',
59
- toStatementHistory: 'toStatementHistory',
60
- toAuth: 'toAuth',
61
- DOMevent: 'DOMevent',
62
- Error401: 'Error401',
63
- Error500: 'Error500',
36
+ currencySymbols: {
37
+ kzt: '',
38
+ usd: '$',
64
39
  },
65
40
  });
@@ -3,6 +3,25 @@ import jwt_decode from 'jwt-decode';
3
3
  import { XMLParser } from 'fast-xml-parser';
4
4
  import { AxiosError } from 'axios';
5
5
 
6
+ export const getBaseCredentials = () => {
7
+ return {
8
+ production: { login: '', password: '' },
9
+ test: { login: '', password: '' },
10
+ development: { login: 'manager', password: 'asdqwe123' },
11
+ vercel: { login: '', password: 'asdqwe123' },
12
+ };
13
+ };
14
+
15
+ export const useEnv = () => {
16
+ return {
17
+ envMode: import.meta.env.VITE_MODE,
18
+ isDev: import.meta.env.VITE_MODE === 'development',
19
+ isTest: import.meta.env.VITE_MODE === 'test',
20
+ isVercel: import.meta.env.VITE_MODE === 'vercel',
21
+ isProduction: import.meta.env.VITE_MODE === 'production',
22
+ };
23
+ };
24
+
6
25
  export class Masks {
7
26
  numbers: string = '#*';
8
27
  otp: string = '# # # #';
@@ -141,10 +160,11 @@ export const parseXML = (xml: boolean | string = true, withTag = false, tag: str
141
160
  };
142
161
 
143
162
  export const ESBDMessage = (ESBDObject: any, initialPoint: any) => {
163
+ return ESBDObject.errorMsg;
144
164
  let result;
145
165
  if (ESBDObject.errorCode === 2) {
146
166
  if (ESBDObject.errorMsg.indexOf('EMSG') === -1) {
147
- result = 'Клиент не является резидентом РК!';
167
+ result = 'Контрагент не является резидентом РК!';
148
168
  } else {
149
169
  result = ESBDObject.errorMsg.substring(ESBDObject.errorMsg.indexOf('EMSG') + 6, ESBDObject.errorMsg.lastIndexOf('EWS-100')).replace(initialPoint, '');
150
170
  }
@@ -165,8 +185,66 @@ export const ErrorHandler = (err: unknown, errorText?: string) => {
165
185
  console.log(err);
166
186
  if (err instanceof AxiosError) {
167
187
  if ('response' in err && err.response && err.response.data) {
168
- useDataStore().showToaster('error', errorText ? errorText : err.response.data, 10000);
188
+ if ('status' in err.response && err.response.status === 403) {
189
+ useDataStore().showToaster('error', useDataStore().t('toaster.noPermission'), 10000);
190
+ } else if (err.response.data) {
191
+ useDataStore().showToaster('error', errorText ? errorText : err.response.data, 10000);
192
+ }
169
193
  }
170
194
  }
171
195
  return false;
172
196
  };
197
+
198
+ export const setAddressBeneficiary = (whichIndex: number, sameAddress: boolean) => {
199
+ const formStore = useFormStore();
200
+ const dataStore = useDataStore();
201
+ const beneficiary = formStore.beneficiaryForm[Number(whichIndex)];
202
+ const policyholder = formStore.policyholderForm;
203
+ if (sameAddress === true) {
204
+ beneficiary.registrationCity = policyholder.registrationCity;
205
+ beneficiary.registrationCountry = policyholder.registrationCountry;
206
+ beneficiary.birthPlace = policyholder.birthPlace;
207
+ beneficiary.registrationMicroDistrict = policyholder.registrationMicroDistrict;
208
+ beneficiary.registrationNumberApartment = policyholder.registrationNumberApartment;
209
+ beneficiary.registrationNumberApartment = policyholder.registrationNumberApartment;
210
+ beneficiary.registrationNumberHouse = policyholder.registrationNumberHouse;
211
+ beneficiary.registrationProvince = policyholder.registrationProvince;
212
+ beneficiary.registrationQuarter = policyholder.registrationQuarter;
213
+ beneficiary.registrationRegion = policyholder.registrationRegion;
214
+ beneficiary.registrationRegionType = policyholder.registrationRegionType;
215
+ beneficiary.registrationStreet = policyholder.registrationStreet;
216
+ } else {
217
+ if (beneficiary.id === 0) {
218
+ beneficiary.registrationCity = new Value();
219
+ beneficiary.registrationCountry = new Value();
220
+ beneficiary.registrationMicroDistrict = '';
221
+ beneficiary.registrationNumberApartment = '';
222
+ beneficiary.registrationNumberApartment = '';
223
+ beneficiary.registrationNumberHouse = '';
224
+ beneficiary.registrationProvince = new Value();
225
+ beneficiary.registrationQuarter = '';
226
+ beneficiary.registrationRegion = new Value();
227
+ beneficiary.registrationRegionType = new Value();
228
+ beneficiary.registrationStreet = '';
229
+ } else {
230
+ if (beneficiary.response && beneficiary.response.addresses && beneficiary.response.addresses.length) {
231
+ const benAddress = beneficiary.response.addresses;
232
+ const country = dataStore.countries.find(i => (i.nameRu as string).match(new RegExp(benAddress[0].countryName, 'i')));
233
+ const city = dataStore.cities.find(i => i.nameRu === benAddress[0].cityName.replace('г.', ''));
234
+ const province = dataStore.states.find(i => i.ids === benAddress[0].stateCode);
235
+ const localityType = dataStore.localityTypes.find(i => i.nameRu === benAddress[0].cityTypeName);
236
+ const region = dataStore.regions.find(i => i.ids == benAddress[0].regionCode);
237
+ beneficiary.registrationCountry = country ?? new Value();
238
+ beneficiary.registrationCity = city ?? new Value();
239
+ beneficiary.registrationMicroDistrict = beneficiary.response?.addresses[0].microRaion ?? '';
240
+ beneficiary.registrationNumberApartment = beneficiary.response?.addresses[0].apartmentNumber ?? '';
241
+ beneficiary.registrationNumberHouse = beneficiary.response?.addresses[0].blockNumber ?? '';
242
+ beneficiary.registrationProvince = province ?? new Value();
243
+ beneficiary.registrationQuarter = beneficiary.response?.addresses[0].kvartal ?? '';
244
+ beneficiary.registrationRegion = region ?? new Value();
245
+ beneficiary.registrationRegionType = localityType ?? new Value();
246
+ beneficiary.registrationStreet = beneficiary.response?.addresses[0].streetName ?? '';
247
+ }
248
+ }
249
+ }
250
+ };
@@ -17,12 +17,15 @@ export class Styles {
17
17
  // Green
18
18
  greenBg: string = 'bg-[#009C73]';
19
19
  greenBgHover: string = 'hover:bg-[#00a277]';
20
- greenBgLight: string = 'bg-[#009C73]';
21
- greenText: string = 'text-[#009C73]';
20
+ greenBgLight: string = 'bg-[#EAF6EF]';
21
+ greenText: string = '!text-[#009C73]';
22
22
  greenTextHover: string = 'hover:text-[#009C73]';
23
+ greenBgLightHover: string = 'hover:bg-[#dbf0e4]';
23
24
 
24
25
  // Yellow
25
26
  yellowText: string = 'text-[#FAB31C]';
27
+ yellowBg: string = 'bg-[#FAB31C]';
28
+ yellowBgHover: string = 'hover:bg-[#FAB31C]';
26
29
 
27
30
  // Grey
28
31
  greyBg: string = 'bg-[#B8B8B8]';
@@ -33,8 +36,10 @@ export class Styles {
33
36
  greyBtnBg: string = 'bg-[#EEE6E6]';
34
37
  greyBtnDisabledBg: string = 'bg-[#919191]';
35
38
  blueLightBgHover: string = 'hover:bg-[#F3F6FC]';
39
+ greyTextDark: string = 'text-[#9197A1]';
40
+
36
41
  // Red
37
- redText: string = 'text-[#FF897D]';
42
+ redText: string = 'text-[#FD2D39]';
38
43
  redBg: string = 'bg-[#FF897D]';
39
44
  redBgHover: string = 'hover:bg-[#ff9b91]';
40
45
  // Error
@@ -56,8 +61,10 @@ export class Styles {
56
61
  greenBtn: string;
57
62
  blueBtn: string;
58
63
  redBtn: string;
64
+ yellowBtn: string;
59
65
  whiteBtn: string;
60
66
  blueLightBtn: string;
67
+ greenLightBtn: string;
61
68
 
62
69
  // Complex
63
70
  flexColNav: string;
@@ -66,14 +73,17 @@ export class Styles {
66
73
 
67
74
  // Muted or disabled
68
75
  mutedText: string = 'text-[#99A3B3]';
76
+ disabled: string = 'cursor-not-allowed opacity-50';
69
77
 
70
78
  constructor() {
71
79
  // Button
72
80
  this.greenBtn = `${this.greenBg} ${this.whiteText} ${this.textTitle} ${this.rounded} w-full ${this.greenBgHover}`;
73
81
  this.redBtn = `${this.redBg} ${this.whiteText} ${this.textTitle} ${this.rounded} w-full ${this.redBgHover}`;
82
+ this.yellowBtn = `${this.yellowBg} ${this.whiteText} ${this.textTitle} ${this.rounded} w-full ${this.yellowBgHover}`;
74
83
  this.blueBtn = `${this.blueBg} ${this.whiteText} ${this.textTitle} ${this.rounded} w-full ${this.blueBgHover}`;
75
84
  this.whiteBtn = ` ${this.blackText} ${this.textTitle} ${this.rounded} w-full ${this.blueLightBgHover}`;
76
85
  this.blueLightBtn = `${this.blueBgLight} ${this.greyTextLight} ${this.textTitle} ${this.rounded} w-full ${this.blueBgLightHover}`;
86
+ this.greenLightBtn = `${this.greenBgLight} ${this.greenText} ${this.textTitle} ${this.rounded} w-full ${this.greenBgLightHover}`;
77
87
 
78
88
  // Complex
79
89
  this.flexColNav = 'flex flex-col gap-[10px] px-2 pt-[14px]';
@@ -81,3 +91,5 @@ export class Styles {
81
91
  this.scrollPage = 'max-h-[90vh] overflow-y-scroll';
82
92
  }
83
93
  }
94
+
95
+ export const useStyles = () => new Styles();
@@ -0,0 +1,17 @@
1
+ import { createI18n } from 'vue-i18n';
2
+ import ru from '../locales/ru.json';
3
+ import kz from '../locales/kz.json';
4
+
5
+ const instance = createI18n({
6
+ legacy: false,
7
+ globalInjection: true,
8
+ locale: 'ru',
9
+ messages: {
10
+ ru,
11
+ kz,
12
+ },
13
+ });
14
+
15
+ export default instance;
16
+
17
+ export const i18n = instance.global;
@@ -8,8 +8,8 @@
8
8
  :title="$dataStore.menu.title ?? 'Страховые продукты'"
9
9
  :has-back="$dataStore.menu.hasBack ?? false"
10
10
  :back-icon="$dataStore.menu.backIcon ?? 'mdi-arrow-left'"
11
+ :more-icon="$dataStore.menu.moreIcon ?? 'mdi-cog-outline'"
11
12
  :has-more="'hasMore' in $route.meta && $route.meta.hasMore ? !!$route.meta.hasMore : false"
12
- :hide-more-on-lg="true"
13
13
  :class="{
14
14
  // @ts-ignore
15
15
  '!hidden': !$display().lgAndUp.value && !!$dataStore.menu.selectedItem.title,
@@ -19,17 +19,17 @@
19
19
  @onLink="onLink"
20
20
  >
21
21
  <template #end>
22
- <base-loader v-if="$dataStore.menu.loading" class="self-center m-5 opacity-70"></base-loader>
22
+ <base-loader v-if="$dataStore.menu.loading" class="self-center m-5 opacity-70" />
23
23
  </template>
24
24
  </base-menu-nav>
25
- <slot> </slot>
26
- <base-settings-panel></base-settings-panel>
25
+ <slot></slot>
26
+ <base-settings-panel />
27
27
  </section>
28
28
  </div>
29
29
  </template>
30
30
 
31
31
  <script setup lang="ts">
32
- import { MenuItem } from '@/composables/classes';
32
+ import { MenuItem } from '../composables/classes';
33
33
  const dataStore = useDataStore();
34
34
 
35
35
  const openSettings = async () => {
@@ -38,7 +38,7 @@ const openSettings = async () => {
38
38
 
39
39
  const onLink = async (item: MenuItem) => {
40
40
  if (dataStore.menu.onLink) await dataStore.menu.onLink(item);
41
- if (typeof item.disabled === 'boolean' ? !item.disabled : true) dataStore.menu.selectedItem = item;
41
+ if (!dataStore.filters.disabled(item)) dataStore.menu.selectedItem = item;
42
42
  };
43
43
 
44
44
  const onBack = async (item: MenuItem) => {