hl-core 0.0.9-beta.3 → 0.0.9-beta.30

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 (72) hide show
  1. package/api/base.api.ts +862 -0
  2. package/api/index.ts +2 -620
  3. package/api/interceptors.ts +58 -14
  4. package/components/Button/Btn.vue +3 -3
  5. package/components/Complex/ContentBlock.vue +1 -1
  6. package/components/Complex/MessageBlock.vue +2 -2
  7. package/components/Complex/Page.vue +8 -2
  8. package/components/Complex/WhiteBlock.vue +7 -0
  9. package/components/Dialog/Dialog.vue +60 -15
  10. package/components/Dialog/FamilyDialog.vue +5 -5
  11. package/components/Form/DynamicForm.vue +99 -0
  12. package/components/Form/FormBlock.vue +36 -29
  13. package/components/Form/FormData.vue +48 -0
  14. package/components/Form/FormSection.vue +2 -2
  15. package/components/Form/FormTextSection.vue +3 -3
  16. package/components/Form/FormToggle.vue +3 -3
  17. package/components/Form/ManagerAttachment.vue +104 -52
  18. package/components/Form/ProductConditionsBlock.vue +73 -20
  19. package/components/Input/DynamicInput.vue +23 -0
  20. package/components/Input/EmptyFormField.vue +1 -1
  21. package/components/Input/FileInput.vue +15 -4
  22. package/components/Input/Monthpicker.vue +33 -0
  23. package/components/Input/PanelInput.vue +5 -1
  24. package/components/Input/RoundedEmptyField.vue +5 -0
  25. package/components/Input/RoundedSelect.vue +13 -0
  26. package/components/Input/SwitchInput.vue +64 -0
  27. package/components/Input/TextInput.vue +161 -0
  28. package/components/Layout/Drawer.vue +17 -4
  29. package/components/Layout/Header.vue +2 -2
  30. package/components/Layout/SettingsPanel.vue +10 -15
  31. package/components/List/ListEmpty.vue +1 -1
  32. package/components/Menu/MenuHover.vue +1 -1
  33. package/components/Menu/MenuNav.vue +3 -3
  34. package/components/Menu/MenuNavItem.vue +4 -4
  35. package/components/Pages/Anketa.vue +144 -65
  36. package/components/Pages/Auth.vue +21 -10
  37. package/components/Pages/ContragentForm.vue +505 -0
  38. package/components/Pages/Documents.vue +57 -11
  39. package/components/Pages/InvoiceInfo.vue +2 -2
  40. package/components/Pages/MemberForm.vue +253 -89
  41. package/components/Pages/ProductAgreement.vue +2 -11
  42. package/components/Pages/ProductConditions.vue +777 -164
  43. package/components/Panel/PanelHandler.vue +297 -54
  44. package/components/Panel/PanelSelectItem.vue +18 -3
  45. package/components/Panel/RightPanelCloser.vue +7 -0
  46. package/components/Utilities/IconBorder.vue +17 -0
  47. package/composables/axios.ts +1 -1
  48. package/composables/classes.ts +405 -9
  49. package/composables/constants.ts +40 -0
  50. package/composables/fields.ts +203 -0
  51. package/composables/index.ts +48 -0
  52. package/composables/styles.ts +22 -10
  53. package/configs/i18n.ts +0 -2
  54. package/layouts/default.vue +46 -4
  55. package/layouts/full.vue +1 -1
  56. package/locales/ru.json +423 -11
  57. package/nuxt.config.ts +1 -1
  58. package/package.json +30 -39
  59. package/pages/500.vue +2 -2
  60. package/pages/Token.vue +1 -0
  61. package/plugins/helperFunctionsPlugins.ts +6 -7
  62. package/plugins/vuetifyPlugin.ts +2 -0
  63. package/store/data.store.ts +936 -217
  64. package/store/extractStore.ts +17 -0
  65. package/store/form.store.ts +13 -1
  66. package/store/member.store.ts +1 -1
  67. package/store/rules.ts +38 -2
  68. package/types/enum.ts +8 -0
  69. package/types/form.ts +94 -0
  70. package/types/index.ts +162 -10
  71. package/components/Button/BtnIcon.vue +0 -47
  72. package/locales/kz.json +0 -590
@@ -0,0 +1,505 @@
1
+ <template>
2
+ <section v-show="showForm" class="flex flex-col gap-4 px-[10px]">
3
+ <v-form v-if="member" ref="vForm" @submit="submitForm" class="max-h-[75svh] overflow-y-scroll">
4
+ <base-form-section :title="$dataStore.t('form.personalData')" class="mt-[14px]">
5
+ <base-form-input
6
+ v-model="member.phoneNumber"
7
+ :label="$dataStore.t('form.phoneNumber')"
8
+ :readonly="disabled"
9
+ :clearable="!disabled"
10
+ :maska="$maska.phone"
11
+ :rules="$rules.required.concat($rules.phoneFormat)"
12
+ />
13
+ <base-form-input
14
+ v-model="member.iin"
15
+ :label="$dataStore.t('form.iin')"
16
+ :readonly="disabled"
17
+ :clearable="!disabled"
18
+ :maska="$maska.iin"
19
+ :rules="$rules.required.concat($rules.iinRight)"
20
+ />
21
+ <base-form-input
22
+ v-model.trim="member.lastName"
23
+ :label="$dataStore.t('form.lastName')"
24
+ :readonly="disabled"
25
+ :clearable="!disabled"
26
+ :rules="$rules.required.concat($rules.cyrillic)"
27
+ />
28
+ <base-form-input
29
+ v-model.trim="member.firstName"
30
+ :label="$dataStore.t('form.firstName')"
31
+ :readonly="disabled"
32
+ :clearable="!disabled"
33
+ :rules="$rules.required.concat($rules.cyrillic)"
34
+ />
35
+ <base-form-input
36
+ v-model.trim="member.middleName"
37
+ :label="$dataStore.t('form.middleName')"
38
+ :readonly="disabled"
39
+ :clearable="!disabled"
40
+ :rules="$rules.cyrillicNonRequired"
41
+ />
42
+ <base-form-input
43
+ v-model="member.birthDate"
44
+ :label="$dataStore.t('form.birthDate')"
45
+ :readonly="disabled"
46
+ :clearable="!disabled"
47
+ :rules="$rules.required.concat($rules.birthDate)"
48
+ :maska="$maska.date"
49
+ append-inner-icon="mdi mdi-calendar-blank-outline"
50
+ />
51
+ <base-form-input v-model="member.age" :label="$dataStore.t('form.age')" :readonly="disabled" :clearable="!disabled" :rules="$rules.numbers.concat($rules.age18)" />
52
+ <base-panel-input
53
+ v-model="member.gender"
54
+ :value="member.gender?.nameRu"
55
+ :readonly="disabled"
56
+ :clearable="!disabled"
57
+ :label="$dataStore.t('form.gender')"
58
+ :rules="$rules.objectRequired"
59
+ append-inner-icon="mdi mdi-chevron-right"
60
+ @append="openPanel($dataStore.t('form.gender'), $dataStore.gender, 'gender')"
61
+ />
62
+ </base-form-section>
63
+ <!-- <base-form-section :title="$dataStore.t('form.jobData')">
64
+ <base-form-input v-model.trim="member.job" :label="$dataStore.t('form.job')" :readonly="disabled" :clearable="!disabled" :rules="$rules.required" />
65
+ <base-form-input v-model.trim="member.jobPosition" :label="$dataStore.t('form.jobPosition')" :readonly="disabled" :clearable="!disabled" :rules="$rules.required" />
66
+ <base-form-input v-model.trim="member.jobPlace" :label="$dataStore.t('form.jobPlace')" :readonly="disabled" :clearable="!disabled" :rules="$rules.required" />
67
+ </base-form-section> -->
68
+ <base-form-section :title="$dataStore.t('form.placeRegistration')">
69
+ <base-panel-input
70
+ v-model="member.registrationCountry"
71
+ :value="member.registrationCountry?.nameRu"
72
+ :label="$dataStore.t('form.Country')"
73
+ :readonly="disabled"
74
+ :clearable="!disabled"
75
+ :rules="$rules.objectRequired"
76
+ append-inner-icon="mdi mdi-chevron-right"
77
+ @append="openPanel($dataStore.t('form.Country'), [], 'registrationCountry', $dataStore.getCountries)"
78
+ />
79
+ <base-fade-transition>
80
+ <div class="flex flex-col gap-[1px]" v-if="member.registrationCountry.nameRu === 'Казахстан' || member.registrationCountry.nameRu === null">
81
+ <base-panel-input
82
+ v-model="member.registrationProvince"
83
+ :value="member.registrationProvince?.nameRu"
84
+ :label="$dataStore.t('form.Province')"
85
+ :readonly="disabled"
86
+ :clearable="!disabled"
87
+ :rules="$rules.objectRequired"
88
+ append-inner-icon="mdi mdi-chevron-right"
89
+ @append="openPanel($dataStore.t('form.Province'), [], 'registrationProvince', $dataStore.getStates, 'registrationCountry')"
90
+ />
91
+ <base-panel-input
92
+ v-model="member.registrationRegionType"
93
+ :value="member.registrationRegionType?.nameRu"
94
+ :label="$dataStore.t('form.RegionType')"
95
+ :readonly="disabled"
96
+ :clearable="!disabled"
97
+ :rules="$rules.objectRequired"
98
+ append-inner-icon="mdi mdi-chevron-right"
99
+ @append="openPanel($dataStore.t('form.RegionType'), [], 'registrationRegionType', $dataStore.getLocalityTypes)"
100
+ />
101
+ <base-panel-input
102
+ v-if="member.registrationRegionType.nameRu !== 'город'"
103
+ v-model="member.registrationRegion"
104
+ :value="member.registrationRegion?.nameRu"
105
+ :label="$dataStore.t('form.Region')"
106
+ :readonly="disabled"
107
+ :clearable="!disabled"
108
+ :rules="$rules.objectRequired"
109
+ append-inner-icon="mdi mdi-chevron-right"
110
+ @append="openPanel($dataStore.t('form.Region'), [], 'registrationRegion', $dataStore.getRegions, 'registrationProvince')"
111
+ />
112
+ <base-panel-input
113
+ v-model="member.registrationCity"
114
+ :value="member.registrationCity?.nameRu"
115
+ :label="$dataStore.t('form.City')"
116
+ :readonly="disabled"
117
+ :clearable="!disabled"
118
+ :rules="$rules.objectRequired"
119
+ append-inner-icon="mdi mdi-chevron-right"
120
+ @append="openPanel($dataStore.t('form.City'), [], 'registrationCity', $dataStore.getCities, 'registrationProvince')"
121
+ />
122
+ <base-form-input v-model.trim="member.registrationQuarter" :label="$dataStore.t('form.Quarter')" :readonly="disabled" :clearable="!disabled" />
123
+ <base-form-input v-model.trim="member.registrationMicroDistrict" :label="$dataStore.t('form.MicroDistrict')" :readonly="disabled" :clearable="!disabled" />
124
+ <base-form-input v-model.trim="member.registrationStreet" :rules="$rules.required" :label="$dataStore.t('form.Street')" :readonly="disabled" :clearable="!disabled" />
125
+ <base-form-input
126
+ v-model.trim="member.registrationNumberHouse"
127
+ :rules="$rules.required"
128
+ :label="$dataStore.t('form.NumberHouse')"
129
+ :readonly="disabled"
130
+ :clearable="!disabled"
131
+ />
132
+ <base-form-input v-model.trim="member.registrationNumberApartment" :label="$dataStore.t('form.NumberApartment')" :readonly="disabled" :clearable="!disabled" />
133
+ </div>
134
+ </base-fade-transition>
135
+ </base-form-section>
136
+ <base-form-section :title="$dataStore.t('form.birthData')">
137
+ <base-panel-input
138
+ v-model="member.birthPlace"
139
+ :value="member.birthPlace?.nameRu"
140
+ :label="$dataStore.t('form.Country')"
141
+ :readonly="disabled"
142
+ :clearable="!disabled"
143
+ :rules="$rules.objectRequired"
144
+ append-inner-icon="mdi mdi-chevron-right"
145
+ @append="openPanel($dataStore.t('form.Country'), [], 'birthPlace', $dataStore.getCountries)"
146
+ />
147
+ </base-form-section>
148
+ <base-form-section :title="$dataStore.t('form.documentData')">
149
+ <base-panel-input
150
+ v-model="member.documentType"
151
+ :value="member.documentType?.nameRu"
152
+ :label="$dataStore.t('form.documentType')"
153
+ :readonly="disabled"
154
+ :clearable="!disabled"
155
+ :rules="$rules.objectRequired"
156
+ append-inner-icon="mdi mdi-chevron-right"
157
+ @append="openPanel($dataStore.t('form.documentType'), [], 'documentType', $dataStore.getDocumentTypes)"
158
+ />
159
+ <base-form-input v-model.trim="member.documentNumber" :label="$dataStore.t('form.documentNumber')" :readonly="disabled" :clearable="!disabled" :rules="$rules.required" />
160
+ <!-- <base-file-input v-if="!memberDocument" :disabled="isDisabled" :clearable="!isDisabled" @input="attachFile($event)" />
161
+ <base-empty-form-field v-if="memberDocument" @click="!isDisabled && openCustomPanel('document')" class="justify-between">
162
+ {{ `${memberDocument.fileTypeName} - ${memberDocument.fileName}` }}
163
+ <i class="cursor-pointer mdi mdi-file-document mr-6 text-[#a0b3d8] text-xl"></i>
164
+ </base-empty-form-field> -->
165
+ <base-panel-input
166
+ v-model="member.documentIssuers"
167
+ :value="member.documentIssuers?.nameRu"
168
+ :label="$dataStore.t('form.documentIssuers')"
169
+ :readonly="disabled"
170
+ :clearable="!disabled"
171
+ :rules="$rules.objectRequired"
172
+ append-inner-icon="mdi mdi-chevron-right"
173
+ @append="openPanel($dataStore.t('form.documentIssuers'), [], 'documentIssuers', $dataStore.getDocumentIssuers)"
174
+ />
175
+ <base-form-input
176
+ v-model="member.documentDate"
177
+ :label="$dataStore.t('form.documentDate')"
178
+ :rules="$rules.required.concat($rules.date)"
179
+ :readonly="disabled"
180
+ :clearable="!disabled"
181
+ :maska="$maska.date"
182
+ append-inner-icon="mdi mdi-calendar-blank-outline"
183
+ />
184
+ <base-fade-transition>
185
+ <base-form-input
186
+ v-if="member.documentType.ids !== 'SBI' && member.documentType.ids !== 'VNZ'"
187
+ v-model="member.documentExpire"
188
+ :label="$dataStore.t('form.documentExpire')"
189
+ :readonly="disabled"
190
+ :clearable="!disabled"
191
+ :rules="$rules.required.concat($rules.date)"
192
+ :maska="$maska.date"
193
+ append-inner-icon="mdi mdi-calendar-blank-outline"
194
+ />
195
+ </base-fade-transition>
196
+ <base-panel-input
197
+ v-model="member.signOfResidency"
198
+ :value="member.signOfResidency?.nameRu"
199
+ :label="$dataStore.t('form.signOfResidency')"
200
+ :readonly="disabled"
201
+ :clearable="!disabled"
202
+ :rules="$rules.objectRequired"
203
+ append-inner-icon="mdi mdi-chevron-right"
204
+ @append="openPanel($dataStore.t('form.signOfResidency'), [], 'signOfResidency', $dataStore.getResidents)"
205
+ />
206
+ <base-panel-input
207
+ v-model="member.countryOfTaxResidency"
208
+ :value="member.countryOfTaxResidency?.nameRu"
209
+ :label="$dataStore.t('form.countryOfTaxResidency')"
210
+ :readonly="disabled"
211
+ :clearable="!disabled"
212
+ :rules="$rules.objectRequired"
213
+ append-inner-icon="mdi mdi-chevron-right"
214
+ @append="openPanel($dataStore.t('form.countryOfTaxResidency'), [], 'countryOfTaxResidency', $dataStore.getTaxCountries)"
215
+ />
216
+ <base-fade-transition>
217
+ <base-panel-input
218
+ v-if="member.countryOfTaxResidency.ids === '500014.3'"
219
+ v-model="member.addTaxResidency"
220
+ :value="member.addTaxResidency?.nameRu"
221
+ :label="$dataStore.t('form.addTaxResidency')"
222
+ :readonly="disabled"
223
+ :clearable="!disabled"
224
+ :rules="$rules.objectRequired"
225
+ append-inner-icon="mdi mdi-chevron-right"
226
+ @append="openPanel($dataStore.t('form.addTaxResidency'), [], 'addTaxResidency', $dataStore.getAdditionalTaxCountries)"
227
+ />
228
+ </base-fade-transition>
229
+ <base-panel-input
230
+ v-model="member.countryOfCitizenship"
231
+ :value="member.countryOfCitizenship?.nameRu"
232
+ :label="$dataStore.t('form.countryOfCitizenship')"
233
+ :readonly="disabled"
234
+ :clearable="!disabled"
235
+ :rules="$rules.objectRequired"
236
+ append-inner-icon="mdi mdi-chevron-right"
237
+ @append="openPanel($dataStore.t('form.countryOfCitizenship'), [], 'countryOfCitizenship', $dataStore.getCitizenshipCountries)"
238
+ />
239
+ <base-panel-input
240
+ v-model="member.economySectorCode"
241
+ :value="member.economySectorCode?.nameRu"
242
+ :label="$dataStore.t('form.economySectorCode')"
243
+ :readonly="disabled"
244
+ :clearable="!disabled"
245
+ :rules="$rules.objectRequired"
246
+ append-inner-icon="mdi mdi-chevron-right"
247
+ @append="openPanel($dataStore.t('form.economySectorCode'), [], 'economySectorCode', $dataStore.getSectorCodeList)"
248
+ />
249
+ </base-form-section>
250
+ <base-form-section :title="$dataStore.t('form.contactsData')">
251
+ <base-form-input
252
+ v-model="member.homePhone"
253
+ :maska="$maska.phone"
254
+ placeholder="+7 7"
255
+ :label="$dataStore.t('form.homePhone')"
256
+ :readonly="disabled"
257
+ :clearable="!disabled"
258
+ :rules="$rules.phoneFormat"
259
+ />
260
+ <base-form-input v-model.trim="member.email" :label="$dataStore.t('form.email')" :readonly="disabled" :clearable="!disabled" :rules="$rules.email" />
261
+ </base-form-section>
262
+ </v-form>
263
+ <base-btn v-if="showSaveButton && !disabled" :loading="isButtonLoading" :text="$dataStore.t('buttons.save')" @click="submitForm" />
264
+ <Teleport v-if="isPanelOpen" to="#right-panel-actions">
265
+ <div :class="[$styles.scrollPage]" class="relative flex flex-col items-center">
266
+ <i
267
+ v-if="type === 'panel'"
268
+ class="mdi mdi-arrow-left cursor-pointer absolute text-xl left-0 top-0 rounded-br-full bg-white border-[1px] pb-3 pt-1 pl-1 pr-3 z-10"
269
+ @click="closeDictPanel"
270
+ ></i>
271
+ <base-rounded-input v-model="searchQuery" :label="$dataStore.t('labels.search')" class="w-full p-2 mt-2" :hide-details="true" />
272
+ <div v-if="panelList && isPanelLoading === false" class="w-full flex flex-col gap-2 p-2">
273
+ <base-panel-select-item :text="$dataStore.t('form.notChosen')" :selected="panelValue.nameRu === null" @click="pickPanelValue(new Value())" />
274
+ <base-panel-select-item
275
+ v-for="(item, index) of panelList.filter(i => i.nameRu && (i.nameRu as string).match(new RegExp(searchQuery ?? '', 'i')))"
276
+ :key="index"
277
+ :text="(item.nameRu as string)"
278
+ :selected="item.nameRu === panelValue.nameRu"
279
+ @click="pickPanelValue(item)"
280
+ />
281
+ </div>
282
+ <base-loader v-if="isPanelLoading" class="absolute mt-10" :size="50" />
283
+ </div>
284
+ </Teleport>
285
+ </section>
286
+ <base-scroll-buttons @up="scrollForm('up')" @down="scrollForm('down')" />
287
+ </template>
288
+
289
+ <script lang="ts">
290
+ import { StoreMembers } from '../../types/enum';
291
+ import { Member, Value } from '../../composables/classes';
292
+
293
+ export default defineComponent({
294
+ props: {
295
+ member: {
296
+ type: Object as PropType<Member>,
297
+ default: {},
298
+ },
299
+ type: {
300
+ type: String as PropType<'default' | 'panel'>,
301
+ default: 'default',
302
+ },
303
+ whichForm: {
304
+ type: String as PropType<'contragent' | keyof typeof StoreMembers>,
305
+ default: 'contragent',
306
+ },
307
+ disabled: {
308
+ type: Boolean,
309
+ default: false,
310
+ },
311
+ },
312
+ emits: ['success'],
313
+ setup(props, { emit }) {
314
+ const dataStore = useDataStore();
315
+
316
+ const vForm = ref<any>();
317
+ const searchQuery = ref<string>();
318
+ const currentPanel = ref<keyof typeof props.member>();
319
+ const showForm = ref<boolean>(true);
320
+ const isPanelOpen = ref<boolean>(false);
321
+ const isPanelLoading = ref<boolean>(false);
322
+ const isButtonLoading = ref<boolean>(false);
323
+ const panelValue = ref<Value>(new Value());
324
+ const panelList = ref<Value[]>([]);
325
+
326
+ const showSaveButton = computed(() => {
327
+ const generalCondition = dataStore.isAgent();
328
+ return generalCondition;
329
+ });
330
+
331
+ const scrollForm = (direction: 'up' | 'down') => {
332
+ vForm.value.scrollTo({ top: direction === 'up' ? 0 : screen.height * 10, behavior: 'smooth' });
333
+ };
334
+
335
+ const closeDictPanel = () => {
336
+ isPanelOpen.value = false;
337
+ showForm.value = true;
338
+ };
339
+
340
+ const openPanel = async (title: string, list: Value[], key: string, asyncFunction?: Function, filterKey?: string) => {
341
+ searchQuery.value = '';
342
+ // @ts-ignore
343
+ currentPanel.value = key as keyof typeof props.member;
344
+ isPanelOpen.value = true;
345
+ dataStore.panelAction = null;
346
+ if (props.type === 'default') {
347
+ dataStore.rightPanel.open = true;
348
+ dataStore.rightPanel.title = title;
349
+ }
350
+
351
+ let newList = list;
352
+ if (asyncFunction) {
353
+ isPanelLoading.value = true;
354
+ newList = await asyncFunction(filterKey, props.member);
355
+ }
356
+ if (props.type === 'panel') {
357
+ showForm.value = false;
358
+ }
359
+ panelList.value = newList;
360
+ panelValue.value = props.member[currentPanel.value!];
361
+ isPanelLoading.value = false;
362
+ };
363
+
364
+ const pickPanelValue = (item: Value) => {
365
+ if (props.type === 'default') {
366
+ dataStore.rightPanel.open = false;
367
+ }
368
+ showForm.value = true;
369
+ isPanelOpen.value = false;
370
+ // @ts-ignore
371
+ props.member[currentPanel.value] = item.nameRu === null ? new Value() : item;
372
+ };
373
+
374
+ const validateESBD = async (docTypeNumber: number) => {
375
+ const data: ESBDValidationType = {
376
+ personType: 1,
377
+ iin: props.member.iin!.replaceAll('-', ''),
378
+ lastName: props.member.lastName ?? '',
379
+ firstName: props.member.firstName ?? '',
380
+ middleName: props.member.middleName ?? '',
381
+ birthDate: props.member.getDateByKey('birthDate') ?? '',
382
+ sex: Number(props.member.gender.id),
383
+ docType: docTypeNumber,
384
+ docNumber: props.member.documentNumber ?? '',
385
+ docIssuedDate: props.member.getDateByKey('documentDate') ?? '',
386
+ docIssuedBy: props.member.documentIssuers.nameRu ?? '',
387
+ activityKindId: 0,
388
+ economicsSectorId: Number((props.member.economySectorCode.ids! as string).at(-1)),
389
+ resident: props.member.signOfResidency.ids === '500011.2' || props.member.signOfResidency.ids === null ? 0 : 1,
390
+ countryId: Number((props.member.countryOfTaxResidency.ids! as string).at(-1)),
391
+ };
392
+ return await dataStore.getValidateClientESBD(data);
393
+ };
394
+
395
+ const saveMember = async () => {
396
+ const hasSaved = await dataStore.saveContragent(props.member, props.whichForm, null, true);
397
+ if (hasSaved === false) {
398
+ return false;
399
+ }
400
+ dataStore.showToaster('success', dataStore.t('toaster.successSaved'));
401
+ dataStore.isLoading = false;
402
+ scrollForm('up');
403
+ emit('success', hasSaved);
404
+ };
405
+
406
+ const submitForm = async () => {
407
+ await vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
408
+ if (v.valid) {
409
+ isButtonLoading.value = true;
410
+ const docType = props.member.documentType.ids;
411
+ if (props.member.gotFromInsis === true && (docType === '1UDL' || docType === 'SBI')) {
412
+ dataStore.isLoading = true;
413
+ const ESBDResponse = await validateESBD(docType === '1UDL' ? 1 : 3);
414
+ if (!ESBDResponse) {
415
+ dataStore.isLoading = false;
416
+ return;
417
+ }
418
+ const initialPoint = `${props.member.iin!.replaceAll('-', '')}.`;
419
+ const RESPONSE = ESBDMessage(ESBDResponse, initialPoint);
420
+ let errorMessage = RESPONSE !== false ? RESPONSE : 'Что-то произошло не так';
421
+ if (typeof ESBDResponse === 'object' && ESBDResponse.errorCode === 0) {
422
+ props.member.verifyType = 'ESBD';
423
+ props.member.verifyDate = ESBDResponse.verifiedDate;
424
+ const hasMemberSaved = await saveMember();
425
+ } else {
426
+ dataStore.isLoading = false;
427
+ dataStore.showToaster('error', errorMessage, 5000);
428
+ }
429
+ } else {
430
+ const hasMemberSaved = await saveMember();
431
+ }
432
+ isButtonLoading.value = false;
433
+ } else {
434
+ const errors = document.querySelector('.v-input--error');
435
+ if (errors) {
436
+ const errorText = errors.querySelector('.v-label.v-field-label');
437
+ if (errorText) {
438
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField', { text: errorText.innerHTML?.replace(/[-<>!//.]/g, '') }));
439
+ } else {
440
+ const errorFieldText = errors.querySelector('.v-input__control');
441
+ if (errorFieldText) {
442
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField', { text: errorFieldText.innerHTML?.replace(/[-<>!//.]/g, '') }));
443
+ }
444
+ }
445
+ errors.scrollIntoView({
446
+ behavior: 'smooth',
447
+ block: 'center',
448
+ inline: 'nearest',
449
+ });
450
+ }
451
+ }
452
+ });
453
+ };
454
+
455
+ watch(
456
+ () => props.member!.birthDate,
457
+ val => {
458
+ if (props.member && val && val.length === useMask().date.length) {
459
+ const calculatedAge = props.member.getAgeByBirthDate();
460
+ if (calculatedAge) props.member.age = calculatedAge;
461
+ }
462
+ },
463
+ );
464
+
465
+ watch(
466
+ () => dataStore.rightPanel.open,
467
+ () => {
468
+ if (dataStore.rightPanel.open === false) {
469
+ isPanelOpen.value = false;
470
+ dataStore.panelAction = null;
471
+ }
472
+ },
473
+ { immediate: true },
474
+ );
475
+
476
+ watch(searchQuery, () => {
477
+ if (searchQuery.value === null) {
478
+ searchQuery.value = '';
479
+ }
480
+ });
481
+
482
+ return {
483
+ // State
484
+ vForm,
485
+ showForm,
486
+ panelList,
487
+ panelValue,
488
+ searchQuery,
489
+ isPanelOpen,
490
+ isPanelLoading,
491
+ isButtonLoading,
492
+
493
+ //Computed
494
+ showSaveButton,
495
+
496
+ // Functions
497
+ openPanel,
498
+ submitForm,
499
+ scrollForm,
500
+ pickPanelValue,
501
+ closeDictPanel,
502
+ };
503
+ },
504
+ });
505
+ </script>
@@ -1,23 +1,33 @@
1
1
  <template>
2
- <section class="w-full px-[10px] pt-[14px] flex flex-col gap-2" :class="[$libStyles.scrollPage]" v-if="formStore.signedDocumentList && formStore.signedDocumentList.length">
3
- <base-content-block v-for="document of formStore.signedDocumentList" :key="document.id" :class="[$libStyles.textSimple]">
2
+ <section class="w-full px-[10px] pt-[14px] flex flex-col gap-2" :class="[$styles.scrollPage]" v-if="formStore.signedDocumentList && formStore.signedDocumentList.length">
3
+ <base-content-block
4
+ v-if="$dataStore.isInitiator() && $dataStore.controls.hasChooseSign && formStore.applicationData.statusCode === 'ContractSignedFrom'"
5
+ :class="[$styles.textSimple]"
6
+ >
7
+ <h5 class="text-center font-medium mb-4">{{ $dataStore.t('Contract') }}</h5>
8
+ <base-form-input v-model="formStore.documentName" :label="$dataStore.t('form.document')" :readonly="true" />
9
+ <base-form-input v-model="formStore.policyNumber" :label="$dataStore.t('form.documentNumber')" :readonly="true" />
10
+ <base-form-input v-model="formStore.contractDate" :label="$dataStore.t('form.date')" :readonly="true" append-inner-icon="mdi mdi-calendar-blank-outline" />
11
+ <base-file-input :readonly="isDisabled" @input.prevent="onFileChange($event)" />
12
+ </base-content-block>
13
+ <base-content-block v-for="document of formStore.signedDocumentList" :key="document.id" :class="[$styles.textSimple]">
4
14
  <h5 class="text-center font-medium mb-4">
5
15
  {{ document.fileTypeName }}
6
16
  </h5>
7
- <div :class="[$libStyles.whiteBg, $libStyles.rounded]" class="p-2 h-12 flex items-center relative">
17
+ <div :class="[$styles.whiteBg, $styles.rounded]" class="p-2 h-12 flex items-center relative">
8
18
  <span class="ml-2">{{ document.fileName }}</span>
9
19
  <i
10
20
  class="transition-all cursor-pointer mdi mdi-dots-vertical pl-2 mr-3 border-l-[1px] text-xl absolute right-0"
11
- :class="[$libStyles.greenTextHover]"
21
+ :class="[$styles.greenTextHover]"
12
22
  @click="openPanel(document)"
13
23
  ></i>
14
24
  </div>
15
25
  </base-content-block>
16
26
  </section>
17
27
  <base-list-empty v-else />
18
- <Teleport v-if="$dataStore.panelAction === null" to="#panel-actions">
28
+ <Teleport v-if="$dataStore.panelAction === null" to="#right-panel-actions">
19
29
  <base-fade-transition>
20
- <div :class="[$libStyles.flexColNav]">
30
+ <div :class="[$styles.flexColNav]">
21
31
  <base-btn :disabled="documentLoading" :loading="documentLoading" text="Открыть" @click="getFile('view')" />
22
32
  <base-btn :disabled="documentLoading" :loading="documentLoading" text="Скачать" @click="getFile('download')" />
23
33
  </div>
@@ -35,6 +45,19 @@ export default defineComponent({
35
45
  const currentDocument = ref<DocumentItem>(new DocumentItem());
36
46
  const documentLoading = ref<boolean>(false);
37
47
 
48
+ const isDisabled = computed(() => !dataStore.isTask());
49
+ const contractDict = computed(() => dataStore.dicFileTypeList.find(i => i.nameRu === 'Договор страхования' || i.nameRu === 'Договор'));
50
+ const signedContract = reactive<{
51
+ processInstanceId: string | number;
52
+ fileTypeId: string | number | null;
53
+ fileTypeCode: string | number | null;
54
+ fileName?: string | number | null;
55
+ }>({
56
+ processInstanceId: formStore.applicationData.processInstanceId,
57
+ fileTypeId: contractDict.value ? contractDict.value.id : '',
58
+ fileTypeCode: contractDict.value ? contractDict.value.code : '',
59
+ });
60
+ const signedContractFormData = ref(new FormData());
38
61
  const currentState = reactive<{ action: string; text: string }>({
39
62
  action: '',
40
63
  text: '',
@@ -50,10 +73,29 @@ export default defineComponent({
50
73
  );
51
74
 
52
75
  const openPanel = async (document: DocumentItem) => {
53
- dataStore.panelAction = null;
54
- dataStore.panel.title = document.fileTypeName!;
76
+ dataStore.rightPanel.title = document.fileTypeName!;
55
77
  currentDocument.value = document;
56
- dataStore.panel.open = true;
78
+ dataStore.rightPanel.open = true;
79
+ };
80
+
81
+ const onFileChange = async (event: InputEvent) => {
82
+ if (event.target) {
83
+ const files = (event.target as HTMLInputElement).files;
84
+ if (files && files.length && files[0].name !== signedContract.fileName) {
85
+ if (files[0].size >= 20_000_000) {
86
+ return dataStore.showToaster('error', dataStore.t('toaster.fileOnlyBelow20mb'), 6000);
87
+ }
88
+ if (files[0].type !== 'application/pdf') {
89
+ return dataStore.showToaster('error', dataStore.t('toaster.onlyPDF'), 6000);
90
+ }
91
+ signedContract.fileName = files[0].name;
92
+ formStore.documentName = signedContract.fileName;
93
+ signedContractFormData.value.append('file', files[0]);
94
+ signedContractFormData.value.append('fileData', JSON.stringify([signedContract]));
95
+ formStore.signedContractFormData = signedContractFormData.value;
96
+ formStore.isUploadedSignedContract = true;
97
+ }
98
+ }
57
99
  };
58
100
 
59
101
  watch(
@@ -89,8 +131,7 @@ export default defineComponent({
89
131
  onInit();
90
132
 
91
133
  onUnmounted(() => {
92
- dataStore.panel.open = false;
93
- dataStore.panelAction = null;
134
+ dataStore.rightPanel.open = false;
94
135
  });
95
136
 
96
137
  return {
@@ -98,10 +139,15 @@ export default defineComponent({
98
139
  formStore,
99
140
  documentLoading,
100
141
  DocumentItem,
142
+ signedContract,
143
+
144
+ // Computed
145
+ isDisabled,
101
146
 
102
147
  // Functions
103
148
  openPanel,
104
149
  getFile,
150
+ onFileChange,
105
151
  };
106
152
  },
107
153
  });
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <section class="w-full px-[10px] pt-[14px] flex flex-col gap-4" :class="[$libStyles.scrollPage]" v-if="!!invoiceData">
2
+ <section class="w-full px-[10px] pt-[14px] flex flex-col gap-4" :class="[$styles.scrollPage]" v-if="!!invoiceData">
3
3
  <lazy-base-form-section :title="$dataStore.t('labels.jsonObject')">
4
4
  <template #icon>
5
5
  <v-btn icon="mdi mdi-content-copy !text-[18px]" size="x-small" variant="plain" color="#A0B3D8" @click="$dataStore.copyToClipboard(JSON.stringify(invoiceData))" />
@@ -8,7 +8,7 @@
8
8
  </lazy-base-form-section>
9
9
  <lazy-base-form-section v-if="invoiceData.paymentLink && invoiceData.status !== 1" :title="$dataStore.t('labels.epayPage')" class="flex items-center">
10
10
  <div class="w-full lg:w-[70%] bg-white">
11
- <iframe :src="invoiceData.paymentLink" frameborder="0" class="w-full h-[70vh]"></iframe>
11
+ <iframe :src="invoiceData.paymentLink" frameborder="0" class="w-full h-[70svh]"></iframe>
12
12
  </div>
13
13
  </lazy-base-form-section>
14
14
  </section>