hl-core 0.0.9-beta.2 → 0.0.9-beta.20

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/base.api.ts +684 -0
  2. package/api/index.ts +2 -620
  3. package/api/interceptors.ts +52 -14
  4. package/components/Button/Btn.vue +3 -3
  5. package/components/Complex/ContentBlock.vue +1 -1
  6. package/components/Complex/MessageBlock.vue +1 -1
  7. package/components/Complex/Page.vue +7 -1
  8. package/components/Complex/WhiteBlock.vue +7 -0
  9. package/components/Dialog/Dialog.vue +2 -2
  10. package/components/Dialog/FamilyDialog.vue +5 -5
  11. package/components/Form/FormBlock.vue +36 -29
  12. package/components/Form/FormSection.vue +2 -2
  13. package/components/Form/FormTextSection.vue +3 -3
  14. package/components/Form/FormToggle.vue +3 -3
  15. package/components/Form/ManagerAttachment.vue +55 -42
  16. package/components/Form/ProductConditionsBlock.vue +73 -20
  17. package/components/Input/EmptyFormField.vue +1 -1
  18. package/components/Input/FileInput.vue +8 -3
  19. package/components/Input/Monthpicker.vue +33 -0
  20. package/components/Input/PanelInput.vue +5 -1
  21. package/components/Input/RoundedEmptyField.vue +5 -0
  22. package/components/Input/RoundedSelect.vue +13 -0
  23. package/components/Layout/Drawer.vue +2 -1
  24. package/components/Layout/Header.vue +1 -1
  25. package/components/Layout/SettingsPanel.vue +5 -9
  26. package/components/List/ListEmpty.vue +1 -1
  27. package/components/Menu/MenuHover.vue +1 -1
  28. package/components/Menu/MenuNav.vue +1 -1
  29. package/components/Menu/MenuNavItem.vue +4 -4
  30. package/components/Pages/Anketa.vue +88 -47
  31. package/components/Pages/Auth.vue +9 -9
  32. package/components/Pages/ContragentForm.vue +505 -0
  33. package/components/Pages/Documents.vue +5 -5
  34. package/components/Pages/InvoiceInfo.vue +2 -2
  35. package/components/Pages/MemberForm.vue +215 -59
  36. package/components/Pages/ProductAgreement.vue +1 -3
  37. package/components/Pages/ProductConditions.vue +677 -151
  38. package/components/Panel/PanelHandler.vue +86 -21
  39. package/components/Panel/PanelSelectItem.vue +18 -3
  40. package/components/Utilities/IconBorder.vue +17 -0
  41. package/composables/axios.ts +1 -1
  42. package/composables/classes.ts +276 -11
  43. package/composables/constants.ts +43 -0
  44. package/composables/index.ts +40 -4
  45. package/composables/styles.ts +20 -10
  46. package/configs/i18n.ts +0 -2
  47. package/layouts/default.vue +5 -2
  48. package/layouts/full.vue +1 -1
  49. package/locales/ru.json +202 -6
  50. package/nuxt.config.ts +1 -1
  51. package/package.json +30 -39
  52. package/pages/500.vue +2 -2
  53. package/pages/Token.vue +1 -0
  54. package/plugins/helperFunctionsPlugins.ts +6 -7
  55. package/plugins/vuetifyPlugin.ts +2 -0
  56. package/store/data.store.ts +541 -211
  57. package/store/form.store.ts +11 -1
  58. package/store/member.store.ts +1 -1
  59. package/store/rules.ts +37 -2
  60. package/types/enum.ts +6 -0
  61. package/types/index.ts +145 -31
  62. package/components/Button/BtnIcon.vue +0 -47
  63. package/locales/kz.json +0 -585
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <base-fade-transition>
3
3
  <section v-if="firstQuestionList && firstQuestionList.length && !firstPanel && !secondPanel" class="flex flex-col">
4
- <section :class="[$libStyles.blueBgLight, $libStyles.rounded]" class="mx-[10px] my-[14px] p-4 flex flex-col gap-4">
4
+ <section :class="[$styles.blueBgLight, $styles.rounded]" class="mx-[10px] my-[14px] p-4 flex flex-col gap-4">
5
5
  <base-form-toggle
6
6
  v-model="answerToAll"
7
7
  :title="$dataStore.t('questionnaireType.answerAllNo')"
@@ -10,10 +10,10 @@
10
10
  @clicked="handleToggler"
11
11
  />
12
12
  </section>
13
- <v-form ref="vForm" class="max-h-[70vh] overflow-y-scroll" @submit="submitForm">
13
+ <v-form ref="vForm" class="max-h-[65svh] overflow-y-scroll" @submit="submitForm">
14
14
  <section
15
15
  v-if="firstQuestionList.filter(i => i.first.definedAnswers === 'N').length"
16
- :class="[$libStyles.blueBgLight, $libStyles.rounded]"
16
+ :class="[$styles.blueBgLight, $styles.rounded]"
17
17
  class="mx-[10px] p-4 flex flex-col gap-4"
18
18
  >
19
19
  <base-form-input
@@ -28,35 +28,35 @@
28
28
  </section>
29
29
  <section
30
30
  v-if="firstQuestionList.filter(i => i.first.definedAnswers === 'Y').length"
31
- :class="[$libStyles.blueBgLight, $libStyles.rounded]"
31
+ :class="[$styles.blueBgLight, $styles.rounded]"
32
32
  class="mx-[10px] mt-[14px] p-4 flex flex-col gap-4"
33
33
  >
34
34
  <base-form-text-section v-for="(question, index) in firstQuestionList.filter(i => i.first.definedAnswers === 'Y')" :key="index">
35
35
  <base-fade-transition>
36
36
  <div
37
- v-if="question.first.answerName === 'Да' && secondQuestionList"
38
- :class="[$libStyles.greenBg, $libStyles.whiteText, $libStyles.textSimple]"
37
+ v-if="question.first.answerName === 'Да' && question.second"
38
+ :class="[$styles.greenBg, $styles.whiteText, $styles.textSimple]"
39
39
  class="rounded-t-lg pl-6 py-1 cursor-pointer"
40
40
  @click="openFirstPanel(question)"
41
41
  >
42
- {{ $dataStore.t('questionnaireType.pleaseAnswer', { text: secondQuestionList.length }) }}
42
+ {{ $dataStore.t('questionnaireType.pleaseAnswer', { text: question.second.length }) }}
43
43
  </div>
44
44
  </base-fade-transition>
45
- <span :class="[$libStyles.textTitle]" class="border-b-[1px] border-b-[#F3F6FC] p-6 flex items-center justify-between">
45
+ <span :class="[$styles.textTitle]" class="border-b-[1px] border-b-[#F3F6FC] p-6 flex items-center justify-between">
46
46
  {{ question.first.name }}
47
47
  <base-fade-transition>
48
48
  <i
49
- v-if="question.first.answerName === 'Да' && secondQuestionList && secondQuestionList.length"
49
+ v-if="question.first.answerName === 'Да' && question.second && question.second.length"
50
50
  class="mdi mdi-chevron-right text-2xl cursor-pointer"
51
51
  @click="openFirstPanel(question)"
52
52
  ></i>
53
53
  </base-fade-transition>
54
54
  </span>
55
- <div class="flex items-center justify-start gap-5 px-4 pt-4" :class="[$libStyles.textSimple]">
55
+ <div class="flex items-center justify-start gap-5 px-4 pt-4" :class="[$styles.textSimple]">
56
56
  <v-radio-group
57
57
  v-model="question.first.answerName"
58
58
  class="anketa-radio"
59
- :true-icon="`mdi-radiobox-marked ${$libStyles.greenText}`"
59
+ :true-icon="`mdi-radiobox-marked ${$styles.greenText}`"
60
60
  false-icon="mdi-radiobox-blank text-[#636363]"
61
61
  :rules="$rules.required"
62
62
  :readonly="formStore.isDisabled[whichSurvey] || !$dataStore.isTask()"
@@ -78,39 +78,43 @@
78
78
  />
79
79
  </section>
80
80
  <v-btn
81
- v-if="secondQuestionList && secondQuestionList.length && firstPanel"
81
+ v-if="currentQuestion && currentQuestion.second && currentQuestion.second.length && firstPanel"
82
82
  icon="mdi mdi-close"
83
83
  class="ml-3 !absolute z-10"
84
- @click="
85
- firstPanel = false;
86
- secondPanel = false;
87
- "
84
+ @click="submitSecondaryForm"
88
85
  />
89
- <section
90
- ref="firstPanelSection"
91
- v-if="secondQuestionList && secondQuestionList.length && firstPanel"
92
- class="flex flex-col px-[10px] pb-[14px]"
93
- :class="[$libStyles.scrollPage]"
94
- >
95
- <section v-if="currentQuestion" :class="[$libStyles.blueBgLight, $libStyles.rounded]" class="mx-[10px] mt-[14px] p-4 flex flex-col gap-4">
86
+ <section ref="firstPanelSection" v-if="currentQuestion && currentQuestion.second && firstPanel" class="flex flex-col px-[10px] pb-[14px]" :class="[$styles.scrollPage]">
87
+ <v-form
88
+ v-if="currentQuestion"
89
+ :class="[$styles.blueBgLight, $styles.rounded]"
90
+ class="mx-[10px] mt-[14px] p-4 flex flex-col gap-4"
91
+ ref="vSecondaryForm"
92
+ @submit="submitSecondaryForm"
93
+ >
96
94
  <base-form-text-section v-for="question in currentQuestion.second" :title="question.name" :key="question.name">
97
95
  <base-form-input
98
96
  v-if="question.definedAnswers === 'N'"
99
97
  v-model="question.answerText"
100
98
  class="border-t-[1px] border-t-[#F3F6FC]"
101
- placeholder="Введите текст"
99
+ :placeholder="$dataStore.t('labels.inputText')"
102
100
  :readonly="formStore.isDisabled[whichSurvey] || !$dataStore.isTask()"
101
+ :rules="isSecondRequired ? $rules.required : []"
103
102
  />
104
- <span v-else class="flex items-center justify-between p-4 cursor-pointer" :class="[$libStyles.textTitle, $libStyles.greenText]" @click="openSecondPanel(question)">
105
- {{ question.answerName ? question.answerName : 'Выбрать вариант ответа' }}
106
- <i class="mdi mdi-chevron-right text-[28px]"></i>
107
- </span>
103
+ <base-panel-input
104
+ v-else
105
+ :class="[$styles.textTitle, $styles.greenText]"
106
+ :value="question.answerName ? question.answerName : 'Выбрать вариант ответа'"
107
+ :readonly="formStore.isDisabled[whichSurvey] || !$dataStore.isTask()"
108
+ :clearable="false"
109
+ :error-messages="isSecondRequired ? (question.answerName ? [] : ['Выбрать вариант ответа']) : []"
110
+ @click="openSecondPanel(question)"
111
+ ></base-panel-input>
108
112
  </base-form-text-section>
109
- </section>
113
+ </v-form>
110
114
  </section>
111
115
  </base-fade-transition>
112
116
  <Teleport v-if="secondPanel" to="#panel-actions">
113
- <div :class="[$libStyles.scrollPage]" class="flex flex-col items-center">
117
+ <div :class="[$styles.scrollPage]" class="flex flex-col items-center">
114
118
  <base-rounded-input v-model="searchQuery" :label="$dataStore.t('labels.search')" class="w-full p-2" :hide-details="true" />
115
119
  <div v-if="$dataStore.questionRefs && $dataStore.questionRefs.length && isPanelLoading === false" class="w-full flex flex-col gap-2 p-2">
116
120
  <base-panel-select-item
@@ -124,7 +128,7 @@
124
128
  <base-loader v-if="isPanelLoading" class="absolute mt-10" :size="50" />
125
129
  </div>
126
130
  </Teleport>
127
- <base-scroll-buttons @up="scrollForm('up')" @down="scrollForm('down')" />
131
+ <base-scroll-buttons v-if="firstQuestionList && firstQuestionList.length" @up="scrollForm('up')" @down="scrollForm('down')" />
128
132
  </template>
129
133
 
130
134
  <script lang="ts">
@@ -137,6 +141,7 @@ export default defineComponent({
137
141
  const formStore = useFormStore();
138
142
  const dataStore = useDataStore();
139
143
  const vForm = ref<any>();
144
+ const vSecondaryForm = ref<any>();
140
145
  const firstPanelSection = ref<any>();
141
146
  const isButtonLoading = ref<boolean>(false);
142
147
  const answerToAll = ref<boolean>(false);
@@ -153,13 +158,13 @@ export default defineComponent({
153
158
  : 'surveyByCriticalBasePolicyholder',
154
159
  );
155
160
  const firstQuestionList = ref<AnketaBody[]>([]);
156
- const secondQuestionList = ref<AnketaSecond[]>([]);
157
161
  const currentQuestion = ref<AnketaBody>();
158
162
  const currentSecond = ref<AnketaSecond>();
159
163
  const isPanelLoading = ref<boolean>(false);
160
164
  const searchQuery = ref<string>('');
161
165
 
162
166
  const whichMember = computed(() => ('member' in route.query && !!route.query.member ? (route.query.member as 'insured' | 'policyholder') : 'insured'));
167
+ const isSecondRequired = computed(() => dataStore.controls.isSecondAnketaRequired);
163
168
  const scrollForm = (direction: 'up' | 'down') => {
164
169
  const scrollObject = { top: direction === 'up' ? 0 : screen.height * 10, behavior: 'smooth' };
165
170
  if (firstPanel.value) {
@@ -173,11 +178,25 @@ export default defineComponent({
173
178
  await vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
174
179
  if (v.valid) {
175
180
  isButtonLoading.value = true;
176
- formStore[whichSurvey.value]!.body.forEach((survey: AnketaBody) => {
177
- if (survey.first.answerText === 'Нет') {
178
- survey.second = [];
179
- }
180
- });
181
+ const isValid = dataStore.validateAnketa(whichSurvey.value);
182
+ if (!isValid) {
183
+ isButtonLoading.value = false;
184
+ return false;
185
+ }
186
+ if (formStore[whichSurvey.value] && formStore[whichSurvey.value]?.body) {
187
+ formStore[whichSurvey.value]?.body.forEach(question => {
188
+ if (question.first.definedAnswers === 'Y' && question.first.answerName?.match(new RegExp('Нет', 'i')) && question.second && question.second.length) {
189
+ question.second.forEach(second => {
190
+ if (second.definedAnswers === 'N') {
191
+ second.answerText = null;
192
+ } else {
193
+ second.answerId = null;
194
+ second.answerName = null;
195
+ }
196
+ });
197
+ }
198
+ });
199
+ }
181
200
  formStore[whichSurvey.value]!.type = surveyType.value;
182
201
  const anketaToken = await dataStore.setSurvey(formStore[whichSurvey.value]!);
183
202
  if (typeof anketaToken === 'string') {
@@ -206,13 +225,36 @@ export default defineComponent({
206
225
  });
207
226
  };
208
227
 
209
- const openFirstPanel = async (question: AnketaBody) => {
210
- currentQuestion.value = question;
211
- formStore[whichSurvey.value]!.body.forEach((question_object: AnketaBody) => {
212
- if ((question_object.first.id === question.first.id && question_object.second && !question_object.second.length) || question_object.second == null) {
213
- question_object.second = JSON.parse(JSON.stringify(formStore[surveyType.value === 'health' ? 'surveyByHealthSecond' : 'surveyByCriticalSecond']));
228
+ const submitSecondaryForm = async () => {
229
+ await vSecondaryForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
230
+ if (v.valid) {
231
+ if (isSecondRequired.value && currentQuestion.value && currentQuestion.value.second) {
232
+ const hasError = currentQuestion.value.second.find(second => (second.definedAnswers === 'N' ? !second.answerText : !second.answerName));
233
+ if (hasError) {
234
+ dataStore.showToaster('error', dataStore.t('toaster.emptySecondAnketa', { text: hasError.name }), 5000);
235
+ return false;
236
+ }
237
+ }
238
+ firstPanel.value = false;
239
+ secondPanel.value = false;
240
+ } else {
241
+ const errors = document.querySelector('.v-input--error');
242
+ if (errors) {
243
+ const errorText = errors.parentElement?.children[0].innerHTML;
244
+ if (errorText) {
245
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField', { text: errorText?.replace(/[-<>!//.]/g, '') }));
246
+ }
247
+ errors.scrollIntoView({
248
+ behavior: 'smooth',
249
+ block: 'center',
250
+ inline: 'nearest',
251
+ });
252
+ }
214
253
  }
215
254
  });
255
+ };
256
+ const openFirstPanel = async (question: AnketaBody) => {
257
+ currentQuestion.value = question;
216
258
  firstPanel.value = true;
217
259
  secondPanel.value = false;
218
260
  };
@@ -241,7 +283,6 @@ export default defineComponent({
241
283
  };
242
284
 
243
285
  const getDefinedAnswerId = async (id: string, value: any, index: number) => {
244
- // @ts-ignore
245
286
  await dataStore.definedAnswers(id, whichSurvey.value, value, index);
246
287
  };
247
288
 
@@ -277,18 +318,16 @@ export default defineComponent({
277
318
  formStore.applicationData.processInstanceId,
278
319
  whichMember.value === 'insured' ? formStore.applicationData.insuredApp[0].id : formStore.applicationData.clientApp.id,
279
320
  whichSurvey.value,
280
- surveyType.value === 'health' ? 'surveyByHealthSecond' : 'surveyByCriticalSecond',
281
321
  whichMember.value,
282
322
  );
283
323
  firstQuestionList.value = formStore[whichSurvey.value]!.body;
284
- secondQuestionList.value = formStore[surveyType.value === 'health' ? 'surveyByHealthSecond' : 'surveyByCriticalSecond']!;
285
324
  formStore[whichSurvey.value]!.type = surveyType.value;
286
325
  const negativeAnswer = firstQuestionList.value.every(i => i.first.answerName === 'Нет');
287
326
  if (negativeAnswer) {
288
327
  answerToAll.value = true;
289
328
  }
290
329
  await Promise.allSettled(
291
- firstQuestionList.value.map(async (question: any) => {
330
+ firstQuestionList.value.map(async question => {
292
331
  await dataStore.definedAnswers(question.first.id, whichSurvey.value);
293
332
  }),
294
333
  );
@@ -325,10 +364,10 @@ export default defineComponent({
325
364
  return {
326
365
  // State
327
366
  vForm,
367
+ vSecondaryForm,
328
368
  formStore,
329
369
  answerToAll,
330
370
  firstQuestionList,
331
- secondQuestionList,
332
371
  whichSurvey,
333
372
  isButtonLoading,
334
373
  firstPanel,
@@ -338,9 +377,11 @@ export default defineComponent({
338
377
  isPanelLoading,
339
378
  searchQuery,
340
379
  firstPanelSection,
380
+ isSecondRequired,
341
381
 
342
382
  // Functions
343
383
  submitForm,
384
+ submitSecondaryForm,
344
385
  getDefinedAnswerId,
345
386
  scrollForm,
346
387
  handleToggler,
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <section class="flex h-full" :class="$libStyles.blueBgLight">
2
+ <section class="flex h-full" :class="$styles.blueBgLight">
3
3
  <!-- @vue-ignore -->
4
4
  <aside :class="{ '!hidden': !$display().lgAndUp.value }" class="w-full lg:w-1/4 bg-white flex flex-col justify-between border-r-2 relative px-8">
5
5
  <img draggable="false" class="w-[50%] mt-8" src="~/assets/auth-logo.svg" />
@@ -21,7 +21,7 @@
21
21
  <img :class="{ '!block': !$display().lgAndUp.value }" draggable="false" class="hidden w-2/4 sm:w-1/3 mb-10 self-center" src="~/assets/auth-logo.svg" />
22
22
  <div class="flex flex-col items-center mb-8 text-center">
23
23
  <h1 class="text-[28px] font-medium mb-1">{{ $dataStore.t('labels.welcomeHL') }}</h1>
24
- <span :class="[$libStyles.greyTextDark]" class="text-[16px]">{{ $dataStore.t('labels.needAuth') }}</span>
24
+ <span :class="[$styles.greyTextDark]" class="text-[16px]">{{ $dataStore.t('labels.needAuth') }}</span>
25
25
  </div>
26
26
  <v-form ref="vForm" class="w-2/3 lg:w-[25vw] self-center">
27
27
  <base-rounded-input class="mb-1" v-model.trim="login" :rules="$rules.required" :loading="authLoading" :placeholder="$dataStore.t('buttons.userLogin')" type="text" />
@@ -35,19 +35,19 @@
35
35
  @append="showPassword = !showPassword"
36
36
  :type="showPassword ? ('' as InputTypes) : 'password'"
37
37
  />
38
- <span v-if="$dataStore.isLKA" class="inline-block w-full text-end mb-4" :class="[$libStyles.textSimple, $libStyles.greyTextDark]" @click="isLogin = false">{{
38
+ <span v-if="$dataStore.isLKA" class="inline-block w-full text-end mb-4" :class="[$styles.textSimple, $styles.greyTextDark]" @click="isLogin = false">{{
39
39
  $dataStore.t('labels.resetPassword')
40
40
  }}</span>
41
- <base-btn :text="$dataStore.t('buttons.login')" :disabled="authLoading" :btn="$libStyles.greenBtn" @click="submitAuthForm" />
41
+ <base-btn :text="$dataStore.t('buttons.login')" :disabled="authLoading" :btn="$styles.greenBtn" @click="submitAuthForm" />
42
42
  </v-form>
43
43
  </section>
44
44
  <section v-if="isLogin === false" class="w-full lg:w-3/4 flex flex-col justify-center items-center">
45
45
  <div class="flex flex-col items-center mb-4">
46
46
  <h1 class="text-[28px] font-medium mb-1">{{ $dataStore.t('labels.resetPassword') }}</h1>
47
- <span :class="[$libStyles.greyTextDark]" class="text-[16px]">{{ $dataStore.t('labels.resetType') }}</span>
47
+ <span :class="[$styles.greyTextDark]" class="text-[16px]">{{ $dataStore.t('labels.resetType') }}</span>
48
48
  </div>
49
- <div class="p-[2px] mb-8 rounded-[12px] border-[1px] w-2/3 lg:w-[25vw]" :class="[$libStyles.whiteBg]">
50
- <v-tabs v-model="resetPasswordType" density="compact" slider-color="#009c73" class="w-full base-reset-password rounded-[12px]" :class="[$libStyles.whiteBg]">
49
+ <div class="p-[2px] mb-8 rounded-[12px] border-[1px] w-2/3 lg:w-[25vw]" :class="[$styles.whiteBg]">
50
+ <v-tabs v-model="resetPasswordType" density="compact" slider-color="#009c73" class="w-full base-reset-password rounded-[12px]" :class="[$styles.whiteBg]">
51
51
  <v-tab :ripple="false" value="phone"> {{ $dataStore.t('form.phoneNumber') }} </v-tab>
52
52
  <v-tab :ripple="false" value="email"> {{ $dataStore.t('form.email') }} </v-tab>
53
53
  </v-tabs>
@@ -70,8 +70,8 @@
70
70
  :placeholder="$dataStore.t('form.email')"
71
71
  type="text"
72
72
  />
73
- <span class="inline-block w-full text-end mb-4" :class="[$libStyles.textSimple, $libStyles.greyTextDark]" @click="isLogin = true">{{ $dataStore.t('buttons.login') }}</span>
74
- <base-btn :text="$dataStore.t('buttons.reset')" :disabled="authLoading" :btn="$libStyles.greenBtn" @click="submitAuthForm" />
73
+ <span class="inline-block w-full text-end mb-4" :class="[$styles.textSimple, $styles.greyTextDark]" @click="isLogin = true">{{ $dataStore.t('buttons.login') }}</span>
74
+ <base-btn :text="$dataStore.t('buttons.reset')" :disabled="authLoading" :btn="$styles.greenBtn" @click="submitAuthForm" />
75
75
  </v-form>
76
76
  </section>
77
77
  </section>