hl-core 0.0.7-beta.14 → 0.0.7-beta.15

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.
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <div class="pt-3 pl-5 rounded border-[1px]" :class="[$libStyles.whiteBg]">
3
- <div>
2
+ <div class="pt-3 rounded-lg border-[1px]" :class="[$libStyles.whiteBg]">
3
+ <div class="ml-5">
4
4
  <p :class="[$libStyles.textTitle, $libStyles.greenText]">{{ title }}</p>
5
5
  <p v-if="!!subtitle" :class="[$libStyles.greyText, $libStyles.textSimple]">{{ subtitle }}</p>
6
6
  </div>
7
- <div class="mt-6 grid grid-cols-4 md:gap-5 md:grid-cols-4 lg:grid-cols-7 auto-rows-fr items-center">
7
+ <div class="ml-5 mt-6 grid grid-cols-4 md:gap-5 md:grid-cols-4 lg:grid-cols-7 auto-rows-fr items-center">
8
8
  <span :class="[$libStyles.textSimple]" class="font-medium">{{ $t('form.fullName') }}</span>
9
9
  <span :class="[$libStyles.textSimple]" class="font-medium">{{ $t('form.iin') }}</span>
10
10
  <span :class="[$libStyles.textSimple]" class="font-medium hidden lg:block"> {{ $t('form.gender') }}</span>
@@ -12,7 +12,7 @@
12
12
  <span :class="[$libStyles.textSimple]" class="font-medium hidden lg:block">{{ $t('form.Country') }} </span>
13
13
  <span :class="[$libStyles.textSimple]" class="font-medium hidden lg:block"> {{ $t('code') }}</span>
14
14
  </div>
15
- <div v-if="isMultiple" class="flex flex-col">
15
+ <div v-if="isMultiple" class="ml-5 flex flex-col">
16
16
  <div v-for="(each, index) of member" :key="index" class="grid grid-cols-4 md:gap-5 md:grid-cols-4 lg:grid-cols-7 auto-rows-fr items-center relative">
17
17
  <span :class="[getMemberInfo(each).fullName === null && $libStyles.emptyBlockCol]">{{ getMemberInfo(each).fullName }}</span>
18
18
  <span :class="[getMemberInfo(each).iin === null && $libStyles.emptyBlockCol]">{{ getMemberInfo(each).iin }}</span>
@@ -21,7 +21,7 @@
21
21
  <span :class="[getMemberInfo(each).birthPlace === null && $libStyles.emptyBlockCol]" class="hidden lg:block"> {{ getMemberInfo(each).birthPlace }} </span>
22
22
  <span :class="[getMemberInfo(each).sectorCode === null && $libStyles.emptyBlockCol]" class="hidden lg:block"> {{ getMemberInfo(each).sectorCode }} </span>
23
23
  <div
24
- class="transition-all h-[70px] w-[60px] place-self-end cursor-pointer"
24
+ class="rounded-br-lg transition-all h-[70px] w-[60px] place-self-end cursor-pointer"
25
25
  :class="[$libStyles.blueBgLight, $libStyles.blueBgLightHover]"
26
26
  @click="$emit('onMore', { whichForm, index })"
27
27
  >
@@ -29,7 +29,7 @@
29
29
  </div>
30
30
  </div>
31
31
  </div>
32
- <div v-else class="grid grid-cols-4 md:gap-5 md:grid-cols-4 lg:grid-cols-7 auto-rows-fr items-center relative">
32
+ <div v-else class="ml-5 grid grid-cols-4 md:gap-5 md:grid-cols-4 lg:grid-cols-7 auto-rows-fr items-center relative">
33
33
  <span :class="[getMemberInfo(member).fullName === null && $libStyles.emptyBlockCol]">{{ getMemberInfo(member).fullName }}</span>
34
34
  <span :class="[getMemberInfo(member).iin === null && $libStyles.emptyBlockCol]">{{ getMemberInfo(member).iin }}</span>
35
35
  <span :class="[getMemberInfo(member).gender === null && $libStyles.emptyBlockCol]" class="hidden lg:block">{{ getMemberInfo(member).gender }} </span>
@@ -37,13 +37,21 @@
37
37
  <span :class="[getMemberInfo(member).birthPlace === null && $libStyles.emptyBlockCol]" class="hidden lg:block"> {{ getMemberInfo(member).birthPlace }} </span>
38
38
  <span :class="[getMemberInfo(member).sectorCode === null && $libStyles.emptyBlockCol]" class="hidden lg:block"> {{ getMemberInfo(member).sectorCode }} </span>
39
39
  <div
40
- class="transition-all h-[70px] w-[60px] place-self-end cursor-pointer"
40
+ class="rounded-br-lg transition-all h-[70px] w-[60px] place-self-end cursor-pointer"
41
41
  :class="[$libStyles.blueBgLight, $libStyles.blueBgLightHover]"
42
42
  @click="$emit('onMore', { whichForm })"
43
43
  >
44
44
  <i class="mdi mdi-dots-vertical text-xl absolute top-[20px] right-[20px]"> </i>
45
45
  </div>
46
46
  </div>
47
+ <div
48
+ v-if="isMultiple && more"
49
+ :class="[$libStyles.blueBg, $libStyles.whiteText, $libStyles.textSimple]"
50
+ class="cursor-pointer rounded-b-lg h-[36px] flex items-center font-medium justify-center"
51
+ @click="memberStore.addMember(whichForm)"
52
+ >
53
+ {{ $t('buttons.add') }}
54
+ </div>
47
55
  </div>
48
56
  </template>
49
57
 
@@ -62,11 +70,16 @@ export default defineComponent({
62
70
  type: String as PropType<'policyholderForm' | 'insuredForm' | 'beneficiaryForm' | 'beneficialOwnerForm' | 'policyholdersRepresentativeForm' | 'productConditionsForm'>,
63
71
  default: '',
64
72
  },
73
+ more: {
74
+ type: Boolean,
75
+ default: false,
76
+ },
65
77
  },
66
- emits: ['onMore'],
78
+ emits: ['onMore', 'addMember'],
67
79
  setup(props) {
68
80
  const dataStore = useDataStore();
69
81
  const formStore = useFormStore();
82
+ const memberStore = useMemberStore();
70
83
  const multipleMembers = ['insuredForm', 'beneficiaryForm', 'beneficialOwnerForm'];
71
84
  const isMultiple = ref(multipleMembers.includes(props.whichForm));
72
85
  const member = formStore[props.whichForm as keyof typeof formStore];
@@ -85,6 +98,7 @@ export default defineComponent({
85
98
  return {
86
99
  // State
87
100
  formStore,
101
+ memberStore,
88
102
  member,
89
103
  isMultiple,
90
104
 
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <section :class="[$libStyles.blueBgLight, $libStyles.rounded]" class="mt-[14px] p-4 flex flex-col gap-[1px]">
3
+ <h2 :class="[$libStyles.textTitle]" class="font-medium text-center w-full mb-4">{{ title }}</h2>
4
+ <slot></slot>
5
+ </section>
6
+ </template>
7
+
8
+ <script lang="ts">
9
+ export default defineComponent({
10
+ props: {
11
+ title: {
12
+ type: String,
13
+ default: 'Заголовок',
14
+ required: true,
15
+ },
16
+ },
17
+ });
18
+ </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="h-[74px] !pl-2 md:!pl-5 rounded border-[1px] flex items-center justify-start gap-4" :class="[$libStyles.whiteBg]">
2
+ <div class="h-[74px] !pl-2 md:!pl-5 rounded-lg border-[1px] flex items-center justify-start gap-4" :class="[$libStyles.whiteBg]">
3
3
  <v-switch class="base-toggle" :model-value="modelValue" @update:modelValue="$emit('update:modelValue', $event)" color="#009C73" hide-details :disabled="disabled"> </v-switch>
4
4
  <p :class="[$libStyles.textSimple]">{{ `${title}` }}</p>
5
5
  <p class="mr-3" :class="[modelValue ? $libStyles.greenText : '', $libStyles.textSimple]">{{ `${modelValue ? $dataStore.t('confirm.yes') : $dataStore.t('confirm.no')}` }}</p>
@@ -0,0 +1,376 @@
1
+ <template>
2
+ <section class="flex flex-col gap-4 px-[10px]">
3
+ <v-form v-if="member" ref="vForm" @submit="submitForm" class="max-h-[75vh] md:max-h-[77vh] overflow-y-scroll">
4
+ <base-form-section :title="$t('form.personalData')">
5
+ <base-form-input
6
+ v-model="member.iin"
7
+ :label="$t('form.iin')"
8
+ maska="###-###-###-###"
9
+ append-inner-icon="mdi mdi-magnify"
10
+ @append="searchMember"
11
+ :rules="$rules.required.concat($rules.iinRight)"
12
+ ></base-form-input>
13
+ <base-form-input
14
+ v-model="member.phoneNumber"
15
+ :label="$t('form.phoneNumber')"
16
+ maska="+7 (7##) ### ## ##"
17
+ placeholder="+7 7"
18
+ :rules="$rules.required.concat($rules.phoneFormat)"
19
+ ></base-form-input>
20
+ <base-form-input v-model="member.lastName" :label="$t('form.lastName')" :rules="$rules.required.concat($rules.cyrillic)"></base-form-input>
21
+ <base-form-input v-model="member.firstName" :label="$t('form.firstName')" :rules="$rules.required.concat($rules.cyrillic)"></base-form-input>
22
+ <base-form-input v-model="member.middleName" :label="$t('form.middleName')" :rules="$rules.required.concat($rules.cyrillic)"></base-form-input>
23
+ <base-form-input
24
+ v-model="member.birthDate"
25
+ :label="$t('form.birthDate')"
26
+ :rules="$rules.required.concat($rules.birthDate)"
27
+ maska="##.##.####"
28
+ append-inner-icon="mdi mdi-calendar-blank-outline"
29
+ ></base-form-input>
30
+ <base-form-input v-model="member.age" :label="$t('form.age')" :rules="$rules.required.concat($rules.numbers)"></base-form-input>
31
+ <base-panel-input
32
+ v-model="member.gender"
33
+ :value="member.gender.nameRu"
34
+ :label="$t('form.gender')"
35
+ :rules="$rules.objectRequired"
36
+ append-inner-icon="mdi mdi-chevron-right"
37
+ @append="openPanel($t('form.gender'), $dataStore.gender, 'gender')"
38
+ ></base-panel-input>
39
+ <base-panel-input
40
+ v-model="member.familyStatus"
41
+ :value="member.familyStatus.nameRu"
42
+ :label="$t('form.familyStatus')"
43
+ :rules="$rules.objectRequired"
44
+ append-inner-icon="mdi mdi-chevron-right"
45
+ @append="openPanel($t('form.familyStatus'), [], 'familyStatus', $dataStore.getFamilyStatuses)"
46
+ ></base-panel-input>
47
+ </base-form-section>
48
+ <base-form-section :title="$t('form.jobData')">
49
+ <base-form-input v-model="member.job" :label="$t('form.job')" :rules="$rules.required"></base-form-input>
50
+ <base-form-input v-model="member.jobPosition" :label="$t('form.jobPosition')" :rules="$rules.required"></base-form-input>
51
+ <base-form-input v-model="member.jobPlace" :label="$t('form.jobPlace')" :rules="$rules.required"></base-form-input>
52
+ </base-form-section>
53
+ <base-form-section :title="$t('form.placeRegistration')">
54
+ <base-panel-input
55
+ v-model="member.registrationCountry"
56
+ :value="member.registrationCountry.nameRu"
57
+ :label="$t('form.Country')"
58
+ :rules="$rules.objectRequired"
59
+ append-inner-icon="mdi mdi-chevron-right"
60
+ @append="openPanel($t('form.Country'), [], 'registrationCountry', $dataStore.getCountries)"
61
+ ></base-panel-input>
62
+ <div class="flex flex-col gap-[1px]" v-if="member.registrationCountry.nameRu === 'Казахстан' || member.registrationCountry.nameRu === null">
63
+ <base-panel-input
64
+ v-model="member.registrationProvince"
65
+ :value="member.registrationProvince.nameRu"
66
+ :label="$t('form.Province')"
67
+ :rules="$rules.objectRequired"
68
+ append-inner-icon="mdi mdi-chevron-right"
69
+ @append="openPanel($t('form.Province'), [], 'registrationProvince', $dataStore.getStates, 'registrationCountry')"
70
+ ></base-panel-input>
71
+ <base-panel-input
72
+ v-model="member.registrationRegionType"
73
+ :value="member.registrationRegionType.nameRu"
74
+ :label="$t('form.RegionType')"
75
+ :rules="$rules.objectRequired"
76
+ append-inner-icon="mdi mdi-chevron-right"
77
+ @append="openPanel($t('form.RegionType'), [], 'registrationRegionType', $dataStore.getLocalityTypes)"
78
+ ></base-panel-input>
79
+ <base-panel-input
80
+ v-if="member.registrationRegionType.nameRu !== 'город'"
81
+ v-model="member.registrationRegion"
82
+ :value="member.registrationRegion.nameRu"
83
+ :label="$t('form.Region')"
84
+ :rules="$rules.objectRequired"
85
+ append-inner-icon="mdi mdi-chevron-right"
86
+ @append="openPanel($t('form.Region'), [], 'registrationRegion', $dataStore.getRegions, 'registrationProvince')"
87
+ ></base-panel-input>
88
+ <base-panel-input
89
+ v-model="member.registrationCity"
90
+ :value="member.registrationCity.nameRu"
91
+ :label="$t('form.City')"
92
+ :rules="$rules.objectRequired"
93
+ append-inner-icon="mdi mdi-chevron-right"
94
+ @append="openPanel($t('form.City'), [], 'registrationCity', $dataStore.getCities, 'registrationProvince')"
95
+ ></base-panel-input>
96
+ <base-form-input v-model="member.registrationQuarter" :label="$t('form.Quarter')"></base-form-input>
97
+ <base-form-input v-model="member.registrationMicroDistrict" :label="$t('form.MicroDistrict')"></base-form-input>
98
+ <base-form-input v-model="member.registrationStreet" :rules="$rules.required" :label="$t('form.Street')"></base-form-input>
99
+ <base-form-input v-model="member.registrationNumberHouse" :rules="$rules.required" :label="$t('form.NumberHouse')"></base-form-input>
100
+ <base-form-input v-model="member.registrationNumberApartment" :label="$t('form.NumberApartment')"></base-form-input>
101
+ </div>
102
+ </base-form-section>
103
+ <base-form-section :title="$t('form.birthData')">
104
+ <base-panel-input
105
+ v-model="member.birthPlace"
106
+ :value="member.birthPlace.nameRu"
107
+ :label="$t('form.Country')"
108
+ :rules="$rules.objectRequired"
109
+ append-inner-icon="mdi mdi-chevron-right"
110
+ @append="openPanel($t('form.Country'), [], 'birthPlace', $dataStore.getCountries)"
111
+ ></base-panel-input>
112
+ <!-- TODO -->
113
+ <!-- <base-panel-input
114
+ v-model="member.birthRegion"
115
+ :value="member.birthRegion.nameRu"
116
+ :label="$t('form.Region')"
117
+ :rules="$rules.objectRequired"
118
+ append-inner-icon="mdi mdi-chevron-right"
119
+ @append="openPanel($t('form.Region'), [], 'birthRegion', $dataStore.getRegions)"
120
+ ></base-panel-input> -->
121
+ </base-form-section>
122
+ <base-form-section :title="$t('form.documentData')">
123
+ <base-panel-input
124
+ v-model="member.documentType"
125
+ :value="member.documentType.nameRu"
126
+ :label="$t('form.documentType')"
127
+ :rules="$rules.objectRequired"
128
+ append-inner-icon="mdi mdi-chevron-right"
129
+ @append="openPanel($t('form.documentType'), [], 'documentType', $dataStore.getDocumentTypes)"
130
+ ></base-panel-input>
131
+ <base-form-input v-model="member.documentNumber" :label="$t('form.documentNumber')" :rules="$rules.required"></base-form-input>
132
+ <base-panel-input
133
+ v-model="member.documentIssuers"
134
+ :value="member.documentIssuers.nameRu"
135
+ :label="$t('form.documentIssuers')"
136
+ :rules="$rules.objectRequired"
137
+ append-inner-icon="mdi mdi-chevron-right"
138
+ @append="openPanel($t('form.documentIssuers'), [], 'documentIssuers', $dataStore.getDocumentIssuers)"
139
+ ></base-panel-input>
140
+ <base-form-input
141
+ v-model="member.documentDate"
142
+ :label="$t('form.documentDate')"
143
+ :rules="$rules.required.concat($rules.date)"
144
+ maska="##.##.####"
145
+ append-inner-icon="mdi mdi-calendar-blank-outline"
146
+ ></base-form-input>
147
+ <base-form-input
148
+ v-if="member.documentType.ids !== 'SBI' && member.documentType.ids !== 'VNZ'"
149
+ v-model="member.documentExpire"
150
+ :label="$t('form.documentExpire')"
151
+ :rules="$rules.required.concat($rules.date)"
152
+ maska="##.##.####"
153
+ append-inner-icon="mdi mdi-calendar-blank-outline"
154
+ ></base-form-input>
155
+ <base-panel-input
156
+ v-model="member.signOfResidency"
157
+ :value="member.signOfResidency.nameRu"
158
+ :label="$t('form.signOfResidency')"
159
+ :rules="$rules.objectRequired"
160
+ append-inner-icon="mdi mdi-chevron-right"
161
+ @append="openPanel($t('form.signOfResidency'), [], 'signOfResidency', $dataStore.getResidents)"
162
+ ></base-panel-input>
163
+ <base-panel-input
164
+ v-model="member.countryOfTaxResidency"
165
+ :value="member.countryOfTaxResidency.nameRu"
166
+ :label="$t('form.countryOfTaxResidency')"
167
+ :rules="$rules.objectRequired"
168
+ append-inner-icon="mdi mdi-chevron-right"
169
+ @append="openPanel($t('form.countryOfTaxResidency'), [], 'countryOfTaxResidency', $dataStore.getTaxCountries)"
170
+ ></base-panel-input>
171
+ <base-panel-input
172
+ v-if="member.countryOfTaxResidency.ids === '500014.3'"
173
+ v-model="member.addTaxResidency"
174
+ :value="member.addTaxResidency.nameRu"
175
+ :label="$t('form.addTaxResidency')"
176
+ :rules="$rules.objectRequired"
177
+ append-inner-icon="mdi mdi-chevron-right"
178
+ @append="openPanel($t('form.addTaxResidency'), [], 'addTaxResidency', $dataStore.getAdditionalTaxCountries)"
179
+ ></base-panel-input>
180
+ <base-panel-input
181
+ v-model="member.signOfIPDL"
182
+ :value="member.signOfIPDL.nameRu"
183
+ :label="$t('form.signOfIPDL')"
184
+ :rules="$rules.objectRequired"
185
+ append-inner-icon="mdi mdi-chevron-right"
186
+ @append="openPanel($t('form.signOfIPDL'), $dataStore.ipdl, 'signOfIPDL')"
187
+ ></base-panel-input>
188
+ <base-panel-input
189
+ v-model="member.countryOfCitizenship"
190
+ :value="member.countryOfCitizenship.nameRu"
191
+ :label="$t('form.countryOfCitizenship')"
192
+ :rules="$rules.objectRequired"
193
+ append-inner-icon="mdi mdi-chevron-right"
194
+ @append="openPanel($t('form.countryOfCitizenship'), [], 'countryOfCitizenship', $dataStore.getCitizenshipCountries)"
195
+ ></base-panel-input>
196
+ <base-panel-input
197
+ v-model="member.economySectorCode"
198
+ :value="member.economySectorCode.nameRu"
199
+ :label="$t('form.economySectorCode')"
200
+ :rules="$rules.objectRequired"
201
+ append-inner-icon="mdi mdi-chevron-right"
202
+ @append="openPanel($t('form.economySectorCode'), [], 'economySectorCode', $dataStore.getSectorCodeList)"
203
+ ></base-panel-input>
204
+ </base-form-section>
205
+ <base-form-section :title="$t('form.contactsData')">
206
+ <base-form-input
207
+ v-model="member.homePhone"
208
+ maska="+7 (7##) ### ## ##"
209
+ placeholder="+7 7"
210
+ :label="$t('form.homePhone')"
211
+ :rules="whichForm === formStore.beneficiaryFormKey ? [] : $rules.phoneFormat"
212
+ ></base-form-input>
213
+ <base-form-input v-model="member.email" :label="$t('form.email')" :rules="$rules.email"></base-form-input>
214
+ </base-form-section>
215
+ </v-form>
216
+ <base-btn :text="$t('buttons.save')" @click="submitForm"></base-btn>
217
+ <Teleport v-if="isPanelOpen" to="#panel-actions">
218
+ <div :class="[$libStyles.scrollPage]">
219
+ <base-rounded-input v-model="searchQuery" :label="$t('labels.search')" class="p-2" :hide-details="true"></base-rounded-input>
220
+ <div v-if="panelList && isPanelLoading === false">
221
+ <base-panel-item class="cursor-pointer border-t-[1px]" @click="pickPanelValue(new Value())">{{ $t('form.notChosen') }}</base-panel-item>
222
+ <base-panel-item
223
+ v-for="(item, index) of panelList.filter(i => i.nameRu && (i.nameRu as string).match(new RegExp(searchQuery, 'i')))"
224
+ :key="index"
225
+ class="cursor-pointer"
226
+ :class="[item.nameRu === panelValue.nameRu && $libStyles.greenText]"
227
+ @click="pickPanelValue(item)"
228
+ >
229
+ {{ item.nameRu }}
230
+ </base-panel-item>
231
+ </div>
232
+ <base-loader v-if="isPanelLoading" class="absolute mx-auto mt-10" :size="50"></base-loader>
233
+ </div>
234
+ </Teleport>
235
+ </section>
236
+ </template>
237
+
238
+ <script lang="ts">
239
+ import { LocationQueryValue } from 'vue-router';
240
+ import { Value } from '@/composables/classes';
241
+
242
+ export default defineComponent({
243
+ setup() {
244
+ const componentKey = ref<number>(0);
245
+ const vForm = ref<any>();
246
+ const route = useRoute();
247
+ const router = useRouter();
248
+ const dataStore = useDataStore();
249
+ const formStore = useFormStore();
250
+ const memberStore = useMemberStore();
251
+ const getMember = (whichForm: LocationQueryValue | LocationQueryValue[], whichIndex?: LocationQueryValue | LocationQueryValue[]) =>
252
+ memberStore.getMemberFromStore(whichForm as keyof typeof formStore, Number((whichIndex ? whichIndex : '0') as string))!;
253
+ const member = ref(getMember(route.query.tab, route.query.i));
254
+ const isPanelOpen = ref<boolean>(false);
255
+ const isPanelLoading = ref<boolean>(false);
256
+ const panelValue = ref<Value>(new Value());
257
+ const panelList = ref<Value[]>([]);
258
+ const currentPanel = ref<string>('');
259
+ const searchQuery = ref<string>('');
260
+
261
+ const whichForm = computed(() => route.query.tab);
262
+ const whichIndex = computed(() => route.query.i);
263
+
264
+ const searchMember = async () => {
265
+ console.log('Search');
266
+ };
267
+
268
+ const openPanel = async (title: string, list: Value[], key: string, asyncFunction?: Function, filterKey?: string) => {
269
+ if (formStore.isDisabled[whichForm.value as keyof typeof formStore.isDisabled] === false) {
270
+ const notAllowedToChange = ['gender', 'documentType', 'documentIssuers'];
271
+ if (member.value.gotFromInsis === false && notAllowedToChange.includes(key)) {
272
+ return;
273
+ }
274
+ currentPanel.value = key;
275
+ isPanelOpen.value = true;
276
+ dataStore.panelAction = null;
277
+ dataStore.panel.open = true;
278
+ dataStore.panel.title = title;
279
+
280
+ let newList = list;
281
+ if (asyncFunction) {
282
+ isPanelLoading.value = true;
283
+ newList = await asyncFunction(filterKey, whichForm.value);
284
+ }
285
+ panelList.value = newList;
286
+ panelValue.value = member.value[key as keyof typeof member.value];
287
+ isPanelLoading.value = false;
288
+ } else {
289
+ dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
290
+ }
291
+ };
292
+
293
+ const pickPanelValue = (item: Value) => {
294
+ if (formStore.isDisabled[whichForm.value as keyof typeof formStore.isDisabled] === false) {
295
+ dataStore.panel.open = false;
296
+ isPanelOpen.value = false;
297
+ member.value[currentPanel.value as keyof typeof member.value] = item.nameRu === null ? new Value() : item;
298
+ } else {
299
+ dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
300
+ }
301
+ };
302
+
303
+ const submitForm = async () => {
304
+ await vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
305
+ if (v.valid) {
306
+ console.log(v);
307
+ } else {
308
+ const errors = document.querySelector('.v-input--error');
309
+ if (errors) {
310
+ const errorText = errors.querySelector('.v-label.v-field-label');
311
+ if (errorText) {
312
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', errorText.innerHTML?.replace(/[-<>!//.]/g, '')));
313
+ } else {
314
+ const errorFieldText = errors.querySelector('.v-input__control');
315
+ if (errorFieldText) {
316
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', errorFieldText.innerHTML?.replace(/[-<>!//.]/g, '')));
317
+ }
318
+ }
319
+ errors.scrollIntoView({
320
+ behavior: 'smooth',
321
+ block: 'center',
322
+ inline: 'nearest',
323
+ });
324
+ }
325
+ }
326
+ });
327
+ };
328
+
329
+ onBeforeRouteUpdate(to => {
330
+ member.value = getMember(to.query.tab, to.query.i);
331
+ componentKey.value++;
332
+ });
333
+
334
+ watch(
335
+ () => dataStore.panel.open,
336
+ () => {
337
+ if (dataStore.panel.open === false) {
338
+ isPanelOpen.value = false;
339
+ }
340
+ },
341
+ { immediate: true },
342
+ );
343
+
344
+ watch(searchQuery, () => {
345
+ if (searchQuery.value === null) {
346
+ searchQuery.value = '';
347
+ }
348
+ });
349
+
350
+ return {
351
+ // State
352
+ vForm,
353
+ formStore,
354
+ memberStore,
355
+ member,
356
+ isPanelOpen,
357
+ isPanelLoading,
358
+ componentKey,
359
+ panelValue,
360
+ panelList,
361
+ searchQuery,
362
+ Value,
363
+
364
+ // Computed
365
+ whichForm,
366
+ whichIndex,
367
+
368
+ // Functions
369
+ searchMember,
370
+ openPanel,
371
+ pickPanelValue,
372
+ submitForm,
373
+ };
374
+ },
375
+ });
376
+ </script>
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <section class="flex flex-col gap-4 px-[10px]">
3
+ <v-form ref="vForm" @submit="submitForm">
4
+ <base-form-section :title="$t('generalConditions')">
5
+ <base-form-input
6
+ v-model="formStore.productConditionsForm.requestedSumInsured"
7
+ :rules="$dataStore.rules.numbers"
8
+ :label="$t('productConditionsForm.requestedSumInsured')"
9
+ ></base-form-input>
10
+ <base-form-input
11
+ v-model="formStore.productConditionsForm.insurancePremiumPerMonth"
12
+ :rules="$dataStore.rules.numbers"
13
+ :label="$t('productConditionsForm.insurancePremiumAmount')"
14
+ ></base-form-input>
15
+ </base-form-section>
16
+ </v-form>
17
+ <base-btn :text="$t('buttons.calculate')" @click="submitForm"></base-btn>
18
+ </section>
19
+ </template>
20
+
21
+ <script lang="ts">
22
+ export default defineComponent({
23
+ setup() {
24
+ const formStore = useFormStore();
25
+ const vForm = ref<any>();
26
+
27
+ const submitForm = async () => {
28
+ vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
29
+ console.log(v);
30
+ });
31
+ };
32
+
33
+ return {
34
+ // State
35
+ formStore,
36
+ vForm,
37
+
38
+ // Functions
39
+ submitForm,
40
+ };
41
+ },
42
+ });
43
+ </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="pt-3 pl-5 rounded border-[1px]" :class="[$libStyles.whiteBg]">
2
+ <div class="pt-3 pl-5 rounded-lg border-[1px]" :class="[$libStyles.whiteBg]">
3
3
  <div>
4
4
  <p :class="[$libStyles.textTitle, $libStyles.greenText]">
5
5
  {{ $t('productConditions') }}
@@ -20,7 +20,7 @@
20
20
  {{ paymentPeriod }}
21
21
  </span>
22
22
  <div
23
- class="transition-all h-[70px] w-[60px] relative place-self-end cursor-pointer"
23
+ class="rounded-br-lg transition-all h-[70px] w-[60px] relative place-self-end cursor-pointer"
24
24
  :class="[$libStyles.blueBgLight, $libStyles.blueBgLightHover]"
25
25
  @click="$emit('onMore', { whichForm: 'productConditions' })"
26
26
  >
@@ -1,22 +1,31 @@
1
1
  <template>
2
2
  <v-text-field
3
- class="rounded-input"
3
+ class="form-input"
4
4
  :model-value="modelValue"
5
5
  v-maska="maska"
6
6
  :rules="rules"
7
7
  :loading="loading"
8
8
  :placeholder="placeholder"
9
+ :label="label"
10
+ :messages="messages"
9
11
  :type="type"
10
12
  :variant="variant"
11
13
  :clear-icon="clearIcon"
12
14
  :color="color"
13
15
  :hint="hint"
14
- :clearable="clearable"
16
+ :clearable="readonly ? false : clearable"
15
17
  :disabled="disabled"
16
- :prepend-inner-icon="prependIcon ? prependIcon : ''"
18
+ :readonly="readonly"
19
+ :prepend-icon="prependIcon ? prependIcon : ''"
17
20
  :append-icon="appendIcon ? appendIcon : ''"
21
+ :prepend-inner-icon="prependInnerIcon ? prependInnerIcon : ''"
22
+ :append-inner-icon="appendInnerIcon ? appendInnerIcon : ''"
18
23
  :bg-color="bgColor ? bgColor : ''"
19
24
  @keyup.enter.prevent="submitted"
25
+ @click:append="!readonly && $emit('append-out')"
26
+ @click:prepend="!readonly && $emit('prepend-out')"
27
+ @click:append-inner="!readonly && $emit('append')"
28
+ @click:prepend-inner="!readonly && $emit('prepend')"
20
29
  @update:modelValue="$emit('update:modelValue', $event)"
21
30
  >
22
31
  <template v-if="loading" #loader>
@@ -32,8 +41,7 @@ export default defineComponent({
32
41
  name: 'BaseRoundedInput',
33
42
  props: {
34
43
  modelValue: {
35
- type: String,
36
- default: '',
44
+ required: false,
37
45
  },
38
46
  loading: {
39
47
  type: Boolean,
@@ -47,9 +55,20 @@ export default defineComponent({
47
55
  type: Boolean,
48
56
  default: false,
49
57
  },
58
+ readonly: {
59
+ type: Boolean,
60
+ default: false,
61
+ },
50
62
  placeholder: {
51
63
  type: String,
52
- default: 'Поле',
64
+ default: '',
65
+ },
66
+ label: {
67
+ type: String,
68
+ default: '',
69
+ },
70
+ messages: {
71
+ type: [String, Array<string>],
53
72
  },
54
73
  maska: {
55
74
  type: String,
@@ -85,11 +104,17 @@ export default defineComponent({
85
104
  appendIcon: {
86
105
  type: String,
87
106
  },
107
+ prependInnerIcon: {
108
+ type: String,
109
+ },
110
+ appendInnerIcon: {
111
+ type: String,
112
+ },
88
113
  bgColor: {
89
114
  type: String,
90
115
  },
91
116
  },
92
- emits: ['update:modelValue', 'submitted'],
117
+ emits: ['update:modelValue', 'submitted', 'prepend', 'append', 'prepend-out', 'append-out'],
93
118
 
94
119
  setup(props, { emit }) {
95
120
  const submitted = (event: any) => {
@@ -104,19 +129,44 @@ export default defineComponent({
104
129
  </script>
105
130
 
106
131
  <style>
107
- .rounded-input input:focus {
132
+ .form-input input:focus {
108
133
  border: none !important;
109
134
  outline: none !important;
110
135
  }
111
-
112
- /* .rounded-input .v-field {
113
- border-radius: 8px;
114
- border: 1px solid #dadada;
136
+ .form-input input {
137
+ padding-top: 30px;
138
+ }
139
+ .form-input .v-field {
115
140
  box-shadow: none;
116
141
  font-size: 14px;
117
- } */
118
-
119
- .rounded-input .v-field--error {
142
+ }
143
+ .form-input .v-label.v-field-label {
144
+ top: 20px;
145
+ }
146
+ .form-input .v-field__append-inner {
147
+ padding-top: 18px;
148
+ padding-right: 6px;
149
+ }
150
+ .form-input .v-field__append-inner i {
151
+ color: #a0b3d8 !important;
152
+ margin-left: 10px;
153
+ margin-right: 4px;
154
+ }
155
+ .form-input {
156
+ border-bottom: 1px solid #f3f6fc;
157
+ }
158
+ .form-input.v-input--error {
159
+ border-color: #ff5449;
160
+ }
161
+ .form-input.v-input--error .v-input__details {
162
+ display: block;
163
+ }
164
+ .form-input .v-input__details {
165
+ display: none;
166
+ background-color: white;
167
+ padding-top: 0 !important;
168
+ }
169
+ .form-input .v-field--error {
120
170
  border-color: #ff5449;
121
171
  }
122
172
  </style>
@@ -0,0 +1,132 @@
1
+ <template>
2
+ <v-text-field
3
+ class="form-input"
4
+ :model-value="modelValue"
5
+ v-maska="maska"
6
+ :rules="rules"
7
+ :loading="loading"
8
+ :placeholder="placeholder"
9
+ :label="label"
10
+ :messages="messages"
11
+ :type="type"
12
+ :variant="variant"
13
+ :clear-icon="clearIcon"
14
+ :color="color"
15
+ :hint="hint"
16
+ :clearable="clearable"
17
+ :disabled="disabled"
18
+ :readonly="true"
19
+ :prepend-icon="prependIcon ? prependIcon : ''"
20
+ :append-icon="appendIcon ? appendIcon : ''"
21
+ :prepend-inner-icon="prependInnerIcon ? prependInnerIcon : ''"
22
+ :append-inner-icon="appendInnerIcon ? appendInnerIcon : ''"
23
+ :bg-color="bgColor ? bgColor : ''"
24
+ @keyup.enter.prevent="submitted"
25
+ @click:clear="(readonly ? false : clearable) && $emit('update:modelValue', new Value())"
26
+ @click:append="!readonly && $emit('append-out')"
27
+ @click:prepend="!readonly && $emit('prepend-out')"
28
+ @click:append-inner="!readonly && $emit('append')"
29
+ @click:prepend-inner="!readonly && $emit('prepend')"
30
+ @update:modelValue="$emit('update:modelValue', $event)"
31
+ >
32
+ <template v-if="loading" #loader>
33
+ <v-progress-linear :active="loading" :color="color" absolute height="1" indeterminate></v-progress-linear>
34
+ </template>
35
+ </v-text-field>
36
+ </template>
37
+
38
+ <script lang="ts">
39
+ import { InputTypes } from '@/composables/models';
40
+ import { Value } from '@/composables/classes';
41
+
42
+ export default defineComponent({
43
+ name: 'BaseRoundedInput',
44
+ props: {
45
+ modelValue: {
46
+ required: false,
47
+ },
48
+ loading: {
49
+ type: Boolean,
50
+ default: false,
51
+ },
52
+ clearable: {
53
+ type: Boolean,
54
+ default: true,
55
+ },
56
+ disabled: {
57
+ type: Boolean,
58
+ default: false,
59
+ },
60
+ readonly: {
61
+ type: Boolean,
62
+ default: false,
63
+ },
64
+ placeholder: {
65
+ type: String,
66
+ default: '',
67
+ },
68
+ label: {
69
+ type: String,
70
+ default: '',
71
+ },
72
+ messages: {
73
+ type: [String, Array<string>],
74
+ },
75
+ maska: {
76
+ type: String,
77
+ default: '',
78
+ },
79
+ hint: {
80
+ type: String,
81
+ default: '',
82
+ },
83
+ rules: {
84
+ type: Array<any>,
85
+ default: [],
86
+ },
87
+ type: {
88
+ type: String as PropType<InputTypes>,
89
+ default: 'text',
90
+ },
91
+ variant: {
92
+ type: String as PropType<'solo' | 'filled' | 'outlined' | 'plain' | 'underlined'>,
93
+ default: 'solo',
94
+ },
95
+ color: {
96
+ type: String,
97
+ default: '#009c73',
98
+ },
99
+ clearIcon: {
100
+ type: String,
101
+ default: 'mdi-close',
102
+ },
103
+ prependIcon: {
104
+ type: String,
105
+ },
106
+ appendIcon: {
107
+ type: String,
108
+ },
109
+ prependInnerIcon: {
110
+ type: String,
111
+ },
112
+ appendInnerIcon: {
113
+ type: String,
114
+ },
115
+ bgColor: {
116
+ type: String,
117
+ },
118
+ },
119
+ emits: ['update:modelValue', 'submitted', 'prepend', 'append', 'prepend-out', 'append-out', 'clear'],
120
+
121
+ setup(props, { emit }) {
122
+ const submitted = (event: any) => {
123
+ emit('submitted', event);
124
+ };
125
+
126
+ return {
127
+ submitted,
128
+ Value,
129
+ };
130
+ },
131
+ });
132
+ </script>
@@ -6,17 +6,25 @@
6
6
  :rules="rules"
7
7
  :loading="loading"
8
8
  :placeholder="placeholder"
9
+ :label="label"
9
10
  :type="type"
10
11
  :variant="variant"
11
12
  :clear-icon="clearIcon"
12
13
  :color="color"
13
14
  :hint="hint"
14
- :clearable="clearable"
15
+ :clearable="readonly ? false : clearable"
15
16
  :disabled="disabled"
16
- :prepend-inner-icon="prependIcon ? prependIcon : ''"
17
+ :readonly="readonly"
18
+ :prepend-icon="prependIcon ? prependIcon : ''"
17
19
  :append-icon="appendIcon ? appendIcon : ''"
20
+ :prepend-inner-icon="prependInnerIcon ? prependInnerIcon : ''"
21
+ :append-inner-icon="appendInnerIcon ? appendInnerIcon : ''"
18
22
  :bg-color="bgColor ? bgColor : ''"
19
23
  @keyup.enter.prevent="submitted"
24
+ @click:append="!readonly && $emit('append-out')"
25
+ @click:prepend="!readonly && $emit('prepend-out')"
26
+ @click:append-inner="!readonly && $emit('append')"
27
+ @click:prepend-inner="!readonly && $emit('prepend')"
20
28
  @update:modelValue="$emit('update:modelValue', $event)"
21
29
  >
22
30
  <template v-if="loading" #loader>
@@ -29,11 +37,11 @@
29
37
  import { InputTypes } from '@/composables/models';
30
38
 
31
39
  export default defineComponent({
40
+ extends: {},
32
41
  name: 'BaseRoundedInput',
33
42
  props: {
34
43
  modelValue: {
35
- type: String,
36
- default: '',
44
+ required: false,
37
45
  },
38
46
  loading: {
39
47
  type: Boolean,
@@ -47,9 +55,17 @@ export default defineComponent({
47
55
  type: Boolean,
48
56
  default: false,
49
57
  },
58
+ readonly: {
59
+ type: Boolean,
60
+ default: false,
61
+ },
50
62
  placeholder: {
51
63
  type: String,
52
- default: 'Поле',
64
+ default: '',
65
+ },
66
+ label: {
67
+ type: String,
68
+ default: '',
53
69
  },
54
70
  maska: {
55
71
  type: String,
@@ -85,11 +101,17 @@ export default defineComponent({
85
101
  appendIcon: {
86
102
  type: String,
87
103
  },
104
+ prependInnerIcon: {
105
+ type: String,
106
+ },
107
+ appendInnerIcon: {
108
+ type: String,
109
+ },
88
110
  bgColor: {
89
111
  type: String,
90
112
  },
91
113
  },
92
- emits: ['update:modelValue', 'submitted'],
114
+ emits: ['update:modelValue', 'submitted', 'prepend', 'append', 'prepend-out', 'append-out'],
93
115
 
94
116
  setup(props, { emit }) {
95
117
  const submitted = (event: any) => {
@@ -108,14 +130,18 @@ export default defineComponent({
108
130
  border: none !important;
109
131
  outline: none !important;
110
132
  }
111
-
133
+ .rounded-input input {
134
+ padding-top: 30px;
135
+ }
136
+ .rounded-input .v-label.v-field-label {
137
+ top: 20px;
138
+ }
112
139
  .rounded-input .v-field {
113
140
  border-radius: 8px;
114
141
  border: 1px solid #dadada;
115
142
  box-shadow: none;
116
143
  font-size: 14px;
117
144
  }
118
-
119
145
  .rounded-input .v-field--error {
120
146
  border-color: #ff5449;
121
147
  }
@@ -59,13 +59,7 @@ export class Value {
59
59
  nameKz: string | number | null;
60
60
  ids: string | number | null;
61
61
 
62
- constructor(
63
- id: string | number | null = null,
64
- nameRu: string | number | null = null,
65
- nameKz: string | number | null = null,
66
- code: string | number | null = null,
67
- ids: string | number | null = null,
68
- ) {
62
+ constructor(id: string | number | null = null, nameRu: string | null = null, nameKz: string | null = null, code: string | null = null, ids: string | null = null) {
69
63
  this.id = id;
70
64
  this.code = code;
71
65
  this.nameRu = nameRu;
@@ -760,6 +754,9 @@ export class ProductConditions {
760
754
  }
761
755
 
762
756
  export class DataStoreClass {
757
+ controls: {
758
+ onAuth: boolean;
759
+ };
763
760
  hasLayoutMargins: boolean;
764
761
  readonly product: string | null;
765
762
  showNav: boolean;
@@ -852,6 +849,9 @@ export class DataStoreClass {
852
849
  };
853
850
  riskGroup: any[];
854
851
  constructor() {
852
+ this.controls = {
853
+ onAuth: false,
854
+ };
855
855
  this.hasLayoutMargins = true;
856
856
  this.processIndexRate = [];
857
857
  this.processPaymentPeriod = [];
@@ -983,28 +983,28 @@ export class FormStoreClass {
983
983
  SaleChanellPolicy: Value;
984
984
  AgentData: {
985
985
  agentId: null;
986
- manId: 0;
987
- fullName: '';
986
+ manId: number;
987
+ fullName: string;
988
988
  officeId: null;
989
989
  officeCode: null;
990
- saleChannel: '';
991
- managerName: '';
990
+ saleChannel: string;
991
+ managerName: string;
992
992
  };
993
993
  RegionPolicy: Value;
994
994
  ManagerPolicy: Value;
995
995
  isDisabled: {
996
- policyholderForm: true;
997
- beneficiaryForm: true;
998
- beneficialOwnerForm: true;
999
- insuredForm: true;
1000
- policyholdersRepresentativeForm: true;
1001
- productConditionsForm: true;
1002
- recalculationForm: true;
1003
- surveyByHealthBase: true;
1004
- surveyByCriticalBase: true;
1005
- surveyByHealthBasePolicyholder: true;
1006
- surveyByCriticalBasePolicyholder: true;
1007
- insuranceDocument: true;
996
+ policyholderForm: boolean;
997
+ beneficiaryForm: boolean;
998
+ beneficialOwnerForm: boolean;
999
+ insuredForm: boolean;
1000
+ policyholdersRepresentativeForm: boolean;
1001
+ productConditionsForm: boolean;
1002
+ recalculationForm: boolean;
1003
+ surveyByHealthBase: boolean;
1004
+ surveyByCriticalBase: boolean;
1005
+ surveyByHealthBasePolicyholder: boolean;
1006
+ surveyByCriticalBasePolicyholder: boolean;
1007
+ insuranceDocument: boolean;
1008
1008
  };
1009
1009
  isPolicyholderInsured: boolean = false;
1010
1010
  isPolicyholderBeneficiary: boolean = false;
@@ -28,6 +28,8 @@ export const constants = Object.freeze({
28
28
  upk: 'UPK',
29
29
  financeCenter: 'FinanceCenter',
30
30
  supervisor: 'Supervisor',
31
+ support: 'Support',
32
+ managerHalykBank: 'ManagerHalykBank',
31
33
  },
32
34
  actions: {
33
35
  accept: 'accept',
@@ -40,6 +40,7 @@ const openSettings = async () => {
40
40
  span,
41
41
  header,
42
42
  *[class='text-[14px]'],
43
+ .v-label,
43
44
  .text-\[14px\] {
44
45
  font-size: v-bind('dataStore.fontSize + "px"') !important;
45
46
  /* line-height: v-bind('dataStore.fontSize*1.5 + "px"') !important; */
@@ -49,7 +50,6 @@ header,
49
50
  .text-\[16px\],
50
51
  label .v-label .v-field-label,
51
52
  .v-field__input,
52
- .v-label,
53
53
  .v-field,
54
54
  .v-input {
55
55
  font-size: v-bind('dataStore.fontSize+2 + "px"') !important;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.7-beta.14",
3
+ "version": "0.0.7-beta.15",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -11,6 +11,7 @@ export default defineNuxtPlugin(nuxtApp => {
11
11
  return {
12
12
  provide: {
13
13
  dataStore: useDataStore(),
14
+ rules: useDataStore().rules,
14
15
  libStyles: new Styles(),
15
16
  t: useDataStore().t,
16
17
  toast: useDataStore().showToaster,
@@ -2,7 +2,7 @@ import { defineStore } from 'pinia';
2
2
  import { t } from './messages';
3
3
  import { rules } from './rules';
4
4
  import { Toast, Types, Positions, ToastOptions } from './toast';
5
- import { isValidGUID, yearEnding, jwtDecode } from '../composables';
5
+ import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern } from '../composables';
6
6
  import { DataStoreClass, Contragent } from '../composables/classes';
7
7
  import { ApiClass } from '@/api';
8
8
  import { useFormStore } from './form.store';
@@ -16,6 +16,7 @@ export const useDataStore = defineStore('data', {
16
16
  toastTypes: Types,
17
17
  toastPositions: Positions,
18
18
  isValidGUID: isValidGUID,
19
+ route: useRoute(),
19
20
  router: useRouter(),
20
21
  formStore: useFormStore(),
21
22
  contragent: useContragentStore(),
@@ -82,7 +83,6 @@ export const useDataStore = defineStore('data', {
82
83
  async loginUser(login, password, numAttempt) {
83
84
  try {
84
85
  const token = localStorage.getItem('accessToken') || null;
85
-
86
86
  if (token && isValidToken(token)) {
87
87
  this.accessToken = token;
88
88
  this.getUserRoles();
@@ -97,28 +97,34 @@ export const useDataStore = defineStore('data', {
97
97
  this.refreshToken = response.refreshToken;
98
98
  this.getUserRoles();
99
99
  }
100
- if (
101
- this.isManager() ||
102
- this.isUnderwriter() ||
103
- this.isAdmin() ||
104
- this.isAgent() ||
105
- this.isCompliance() ||
106
- this.isAgentMycar() ||
107
- this.isAnalyst() ||
108
- this.isUpk() ||
109
- this.isFinanceCenter() ||
110
- this.isSupervisor()
111
- ) {
100
+ if (this.controls.onAuth) {
101
+ const hasPermission =
102
+ this.isManager() ||
103
+ this.isUnderwriter() ||
104
+ this.isAdmin() ||
105
+ this.isAgent() ||
106
+ this.isCompliance() ||
107
+ this.isAgentMycar() ||
108
+ this.isAnalyst() ||
109
+ this.isUpk() ||
110
+ this.isFinanceCenter() ||
111
+ this.isSupervisor() ||
112
+ this.isSupport() ||
113
+ this.isManagerHalykBank();
114
+ if (hasPermission) {
115
+ localStorage.setItem('accessToken', this.accessToken);
116
+ localStorage.setItem('refreshToken', this.refreshToken);
117
+ } else {
118
+ this.showToaster('error', this.t('toaster.noProductPermission'), 5000);
119
+ this.accessToken = null;
120
+ this.refreshToken = null;
121
+ }
122
+ } else {
112
123
  localStorage.setItem('accessToken', this.accessToken);
113
124
  localStorage.setItem('refreshToken', this.refreshToken);
114
- } else {
115
- this.showToaster('error', this.t('toaster.noProductPermission'), 5000);
116
125
  }
117
126
  } catch (err) {
118
- console.log(err);
119
- if ('response' in err) {
120
- this.showToaster('error', err.response.data, 3000);
121
- }
127
+ ErrorHandler(err);
122
128
  }
123
129
  },
124
130
  getUserRoles() {
@@ -145,7 +151,7 @@ export const useDataStore = defineStore('data', {
145
151
  return !!isRole;
146
152
  },
147
153
  isInitiator() {
148
- return this.isRole(constants.roles.manager) || this.isRole(constants.roles.agent) || this.isRole(constants.roles.agentMycar);
154
+ return this.isManager() || this.isAgent() || this.isAgentMycar();
149
155
  },
150
156
  isManager() {
151
157
  return this.isRole(constants.roles.manager);
@@ -159,6 +165,9 @@ export const useDataStore = defineStore('data', {
159
165
  isAgent() {
160
166
  return this.isRole(constants.roles.agent);
161
167
  },
168
+ isManagerHalykBank() {
169
+ return this.isRole(constants.roles.managerHalykBank);
170
+ },
162
171
  isUnderwriter() {
163
172
  return this.isRole(constants.roles.underwriter);
164
173
  },
@@ -171,19 +180,26 @@ export const useDataStore = defineStore('data', {
171
180
  isUpk() {
172
181
  return this.isRole(constants.roles.upk);
173
182
  },
183
+ isSupport() {
184
+ return this.isRole(constants.roles.support);
185
+ },
174
186
  isFinanceCenter() {
175
187
  return this.isRole(constants.roles.financeCenter);
176
188
  },
177
189
  isSupervisor() {
178
190
  return this.isRole(constants.roles.supervisor);
179
191
  },
180
-
181
192
  isProcessEditable(statusCode) {
182
193
  return !!constants.editableStatuses.find(status => status === statusCode);
183
194
  },
184
195
  isTask() {
185
196
  return this.formStore.applicationData.processInstanceId != 0 && this.formStore.applicationData.isTask;
186
197
  },
198
+ resetSelected() {
199
+ this.settings.open = false;
200
+ this.menu.selectedItem = new MenuItem();
201
+ this.router.replace({ name: this.route.name });
202
+ },
187
203
  async logoutUser() {
188
204
  this.isLoading = true;
189
205
  try {
@@ -1002,7 +1018,7 @@ export const useDataStore = defineStore('data', {
1002
1018
  };
1003
1019
 
1004
1020
  if (getDataCondition()) {
1005
- this.whichField = [];
1021
+ this[whichField] = [];
1006
1022
  try {
1007
1023
  const response = await this.api[whichRequest](parameter);
1008
1024
  if (response) {
@@ -1015,9 +1031,6 @@ export const useDataStore = defineStore('data', {
1015
1031
  }),
1016
1032
  );
1017
1033
  this[whichField] = response;
1018
- if (this[whichField].length && this[whichField][this[whichField].length - 1].nameRu == 'невключено') {
1019
- this[whichField].unshift(this[whichField].pop());
1020
- }
1021
1034
  }
1022
1035
  } catch (err) {
1023
1036
  console.log(err);
@@ -12,13 +12,32 @@ export const useMemberStore = defineStore('members', {
12
12
  }),
13
13
  getters: {},
14
14
  actions: {
15
+ isStatementEditible(whichForm: string, showToaster: boolean = false) {
16
+ if (this.formStore.isDisabled[whichForm as keyof typeof this.formStore.isDisabled] === true) {
17
+ if (showToaster) this.dataStore.showToaster('error', this.dataStore.t('toaster.viewErrorText'), 2000);
18
+ return false;
19
+ }
20
+ return true;
21
+ },
22
+ validateInitiator(showToaster: boolean = true) {
23
+ if (!this.dataStore.isInitiator()) {
24
+ if (showToaster) this.dataStore.showToaster('error', this.dataStore.t('toaster.viewErrorText'));
25
+ return false;
26
+ }
27
+ return true;
28
+ },
15
29
  hasMemberData(whichForm: keyof typeof this.formStore, whichIndex?: number, key: string = 'id', emptyValue: any = 0) {
16
30
  if (!this.validateInitiator(false)) return false;
31
+ if (!this.isStatementEditible(whichForm)) return false;
17
32
  return typeof whichIndex === 'number' ? this.formStore[whichForm][whichIndex][key] != emptyValue : this.formStore[whichForm][key] != emptyValue;
18
33
  },
19
34
  canMemberDeleted(whichForm: keyof typeof this.formStore, whichIndex?: number) {
20
35
  if (!whichForm) return false;
36
+ if (!this.isStatementEditible(whichForm)) return false;
21
37
  if (!this.validateInitiator(false)) return false;
38
+ if (typeof whichIndex === 'number' && whichIndex > 0) {
39
+ return true;
40
+ }
22
41
  if (this.dataStore.isTask() && this.dataStore.isProcessEditable(this.formStore.applicationData.statusCode)) {
23
42
  if (whichForm !== this.formStore.policyholderFormKey) {
24
43
  return this.hasMemberData(whichForm, whichIndex);
@@ -27,7 +46,6 @@ export const useMemberStore = defineStore('members', {
27
46
  return false;
28
47
  },
29
48
  getMemberFromStore(whichForm: keyof typeof this.formStore, whichIndex?: number) {
30
- if (!whichForm) return false;
31
49
  switch (whichForm) {
32
50
  case this.formStore.policyholderFormKey:
33
51
  return this.formStore.policyholderForm;
@@ -39,6 +57,8 @@ export const useMemberStore = defineStore('members', {
39
57
  return this.formStore.beneficiaryForm[whichIndex!];
40
58
  case this.formStore.beneficialOwnerFormKey:
41
59
  return this.formStore.beneficialOwnerForm[whichIndex!];
60
+ default:
61
+ return this.formStore.policyholderForm;
42
62
  }
43
63
  },
44
64
  getMemberFromApplication(whichForm: keyof typeof this.formStore, whichIndex?: number) {
@@ -91,15 +111,9 @@ export const useMemberStore = defineStore('members', {
91
111
  return 'Spokesman';
92
112
  }
93
113
  },
94
- validateInitiator(showToaster: boolean = true) {
95
- if (!this.dataStore.isInitiator()) {
96
- if (showToaster) this.dataStore.showToaster('error', this.dataStore.t('toaster.viewErrorText'));
97
- return false;
98
- }
99
- return true;
100
- },
101
114
  clearMember(whichForm: keyof typeof this.formStore, whichIndex?: number) {
102
115
  if (!whichForm) return false;
116
+ if (!this.isStatementEditible(whichForm)) return false;
103
117
  if (!this.validateInitiator()) return false;
104
118
  const memberClass = this.getMemberClass(whichForm);
105
119
  if (!memberClass) return false;
@@ -120,24 +134,31 @@ export const useMemberStore = defineStore('members', {
120
134
  },
121
135
  async deleteMember(whichForm: keyof typeof this.formStore, whichIndex?: number) {
122
136
  if (!whichForm) return false;
137
+ if (!this.isStatementEditible(whichForm)) return false;
123
138
  if (!this.validateInitiator()) return false;
124
139
  try {
125
140
  const memberCode = this.getMemberCode(whichForm);
141
+ const memberData = this.getMemberFromApplication(whichForm, whichIndex);
126
142
  if (!memberCode) return false;
127
143
  if (typeof whichIndex !== 'number') {
128
144
  if (whichForm === this.formStore.policyholdersRepresentativeFormKey) {
129
145
  await this.dataStore.api.deleteMember(memberCode, this.formStore.applicationData.processInstanceId);
130
146
  }
131
147
  } else {
132
- const memberData = this.getMemberFromApplication(whichForm, whichIndex);
133
- if (!memberData) return false;
134
- await this.dataStore.api.deleteMember(memberCode, memberData.id as number);
148
+ if (memberData) await this.dataStore.api.deleteMember(memberCode, memberData.id as number);
135
149
  }
136
- await this.dataStore.getApplicationData(this.route.params.taskId, true, true, true, false);
150
+ if (memberData) await this.dataStore.getApplicationData(this.route.params.taskId, true, true, true, false);
137
151
  return this.clearMember(whichForm, whichIndex);
138
152
  } catch (err) {
153
+ console.log(err);
139
154
  return ErrorHandler(err);
140
155
  }
141
156
  },
157
+ addMember(whichForm: keyof typeof this.formStore) {
158
+ if (!whichForm) return false;
159
+ if (!this.isStatementEditible(whichForm)) return false;
160
+ if (!this.validateInitiator()) return false;
161
+ this.formStore[whichForm].push(this.getMemberClass(whichForm));
162
+ },
142
163
  },
143
164
  });
package/store/messages.ts CHANGED
@@ -92,6 +92,7 @@ export const messages = {
92
92
  tokenExpire: 'Истекло время ожидания',
93
93
  },
94
94
  buttons: {
95
+ add: 'Добавить',
95
96
  userLogin: 'Логин',
96
97
  password: 'Пароль',
97
98
  login: 'Вход в систему',
@@ -231,6 +232,9 @@ export const messages = {
231
232
  conditions: 'Условия оплаты страховой премии',
232
233
  processTariff: 'Тариф',
233
234
  riskGroup: 'Группа риска',
235
+ requestedProductConditions: 'Запрашиваемые условия страхования',
236
+ coverPeriodFrom3to20: 'Срок страхования (от 3-х до 20 лет)',
237
+ insurancePremiumAmount: 'Размер Страховой премии (страховой взнос)',
234
238
  },
235
239
  history: {
236
240
  addRegNumber: 'Номер',