hl-core 0.0.8-beta.3 → 0.0.8-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api/index.ts CHANGED
@@ -147,21 +147,21 @@ export class ApiClass {
147
147
  async getQuestionList(surveyType: string, processInstanceId: string, insuredId: number | string): Promise<AnketaFirst> {
148
148
  return this.axiosCall({
149
149
  method: Methods.GET,
150
- url: `/Baiterek/api/Application/Anketa/${surveyType}/${processInstanceId}/${insuredId}`,
150
+ url: `/${this.productUrl}/api/Application/Anketa/${surveyType}/${processInstanceId}/${insuredId}`,
151
151
  });
152
152
  }
153
153
 
154
154
  async getQuestionListSecond(surveyType: string, processInstanceId: string, insuredId: number | string): Promise<AnketaSecond[]> {
155
155
  return this.axiosCall({
156
156
  method: Methods.GET,
157
- url: `/Baiterek/api/Application/Anketa/${surveyType}/${processInstanceId}/${insuredId}`,
157
+ url: `/${this.productUrl}/api/Application/Anketa/${surveyType}/${processInstanceId}/${insuredId}`,
158
158
  });
159
159
  }
160
160
 
161
161
  async definedAnswers(filter: string) {
162
162
  return this.axiosCall({
163
163
  method: Methods.GET,
164
- url: `/ekk/api/Contragentinsis/DictionaryItems/Questionary?filter=${filter}`,
164
+ url: `/Ekk/api/Contragentinsis/DictionaryItems/Questionary?filter=${filter}`,
165
165
  });
166
166
  }
167
167
 
@@ -227,7 +227,7 @@ export class ApiClass {
227
227
  });
228
228
  }
229
229
 
230
- async getDicFileTypeList() {
230
+ async getDicFileTypeList(): Promise<Value[]> {
231
231
  return this.axiosCall({
232
232
  method: Methods.GET,
233
233
  url: '/Arm/api/Dictionary/GetDictionaryItems/DicFileType',
@@ -498,7 +498,7 @@ export class ApiClass {
498
498
  }
499
499
 
500
500
  async getProcessTariff(code: number | string = 5) {
501
- return this.axiosCall({ url: `/arm/api/Dictionary/ProcessTariff/${code}` });
501
+ return this.axiosCall({ url: `/Arm/api/Dictionary/ProcessTariff/${code}` });
502
502
  }
503
503
 
504
504
  async setConfirmation(data: any) {
@@ -519,30 +519,37 @@ export class ApiClass {
519
519
  async sendUnderwritingCouncilTask(data: any) {
520
520
  return this.axiosCall({
521
521
  method: Methods.POST,
522
- url: '/arm/api/UnderwritingCouncil/SendTask',
522
+ url: '/Arm/api/UnderwritingCouncil/SendTask',
523
523
  data: data,
524
524
  });
525
525
  }
526
526
 
527
+ async getDictionaryItems(dictName: string): Promise<Value[]> {
528
+ return this.axiosCall({
529
+ method: Methods.GET,
530
+ url: `/Ekk/api/ContragentInsis/DictionaryItems/${dictName}`,
531
+ });
532
+ }
533
+
527
534
  async filterManagerByRegion(dictName: string, filterName: string) {
528
535
  return this.axiosCall({
529
536
  method: Methods.GET,
530
- url: `/ekk/api/ContragentInsis/DictionaryItems/${dictName}?filter=${filterName}`,
537
+ url: `/Ekk/api/ContragentInsis/DictionaryItems/${dictName}?filter=${filterName}`,
531
538
  });
532
539
  }
533
540
 
534
541
  async setINSISWorkData(data: any) {
535
542
  return this.axiosCall({
536
543
  method: Methods.POST,
537
- url: `/arm/api/Bpm/SetInsisWorkData`,
544
+ url: `/Arm/api/Bpm/SetInsisWorkData`,
538
545
  data: data,
539
546
  });
540
547
  }
541
548
 
542
- async searchAgentByName(name: string) {
549
+ async searchAgentByName(name: string): Promise<AgentData[]> {
543
550
  return this.axiosCall({
544
551
  method: Methods.GET,
545
- url: `/ekk/api/ContragentInsis/AgentByName?fullName=${name}`,
552
+ url: `/Ekk/api/ContragentInsis/AgentByName?fullName=${name}`,
546
553
  });
547
554
  }
548
555
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="pt-3 rounded-lg border-[1px]" :class="[$libStyles.whiteBg]">
2
+ <div class="pt-3 rounded-lg border-[1px]" :class="[$libStyles.whiteBg, disabled && $libStyles.disabled]">
3
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>
@@ -21,9 +21,9 @@
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="rounded-br-lg transition-all h-[70px] w-[60px] place-self-end cursor-pointer"
25
- :class="[$libStyles.blueBgLight, $libStyles.blueBgLightHover]"
26
- @click="$emit('onMore', { whichForm, index })"
24
+ class="rounded-br-lg transition-all h-[70px] w-[60px] place-self-end"
25
+ :class="[$libStyles.blueBgLight, $libStyles.blueBgLightHover, disabled ? $libStyles.disabled : 'cursor-pointer']"
26
+ @click="!disabled && $emit('onMore', { whichForm, index })"
27
27
  >
28
28
  <i class="mdi mdi-dots-vertical text-xl absolute top-[20px] right-[20px]"> </i>
29
29
  </div>
@@ -37,18 +37,18 @@
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="rounded-br-lg transition-all h-[70px] w-[60px] place-self-end cursor-pointer"
41
- :class="[$libStyles.blueBgLight, $libStyles.blueBgLightHover]"
42
- @click="$emit('onMore', { whichForm })"
40
+ class="rounded-br-lg transition-all h-[70px] w-[60px] place-self-end"
41
+ :class="[$libStyles.blueBgLight, $libStyles.blueBgLightHover, disabled ? $libStyles.disabled : 'cursor-pointer']"
42
+ @click="!disabled && $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
47
  <div
48
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)"
49
+ :class="[$libStyles.blueBg, $libStyles.whiteText, $libStyles.textSimple, disabled ? $libStyles.disabled : 'cursor-pointer']"
50
+ class="rounded-b-lg h-[36px] flex items-center font-medium justify-center"
51
+ @click="!disabled && memberStore.addMember(whichForm)"
52
52
  >
53
53
  {{ $t('buttons.add') }}
54
54
  </div>
@@ -76,6 +76,10 @@ export default defineComponent({
76
76
  type: Boolean,
77
77
  default: false,
78
78
  },
79
+ disabled: {
80
+ type: Boolean,
81
+ default: false,
82
+ },
79
83
  },
80
84
  emits: ['onMore', 'addMember'],
81
85
  setup(props) {
@@ -0,0 +1,196 @@
1
+ <template>
2
+ <div class="rounded-lg border-[1px]" :class="[$libStyles.whiteBg, disabled && $libStyles.disabled]">
3
+ <div class="mt-3 ml-5">
4
+ <p :class="[$libStyles.textTitle, $libStyles.greenText]">{{ $t('form.attachManager') }}</p>
5
+ </div>
6
+ <v-form ref="vForm" class="flex flex-col mt-1">
7
+ <base-panel-input
8
+ class="pl-1"
9
+ v-model="formStore.SaleChanellPolicy"
10
+ :value="formStore.SaleChanellPolicy.nameRu"
11
+ :readonly="isReadonly"
12
+ :clearable="!isReadonly"
13
+ :label="$t('form.salesChanell')"
14
+ :rules="$rules.objectRequired"
15
+ append-inner-icon="mdi mdi-chevron-right"
16
+ @append="openPanel('SaleChanellPolicy', $t('form.salesChanell'))"
17
+ ></base-panel-input>
18
+ <base-panel-input
19
+ class="pl-1"
20
+ v-model="formStore.RegionPolicy"
21
+ :value="formStore.RegionPolicy.nameRu"
22
+ :readonly="isReadonly"
23
+ :clearable="!isReadonly"
24
+ :label="$t('form.Region')"
25
+ :rules="$rules.objectRequired"
26
+ append-inner-icon="mdi mdi-chevron-right"
27
+ @append="openPanel('RegionPolicy', $t('form.Region'))"
28
+ ></base-panel-input>
29
+ <base-panel-input
30
+ class="pl-1"
31
+ v-model="formStore.ManagerPolicy"
32
+ :value="formStore.ManagerPolicy.nameRu"
33
+ :readonly="isReadonly"
34
+ :clearable="!isReadonly"
35
+ :label="$t('form.manager')"
36
+ :rules="$rules.objectRequired"
37
+ append-inner-icon="mdi mdi-chevron-right"
38
+ @append="openPanel('ManagerPolicy', $t('form.manager'))"
39
+ ></base-panel-input>
40
+ <base-panel-input
41
+ class="pl-1"
42
+ v-model="formStore.AgentData"
43
+ :value="formStore.AgentData.fullName"
44
+ :readonly="isReadonly"
45
+ :clearable="!isReadonly"
46
+ :label="$t('form.agent')"
47
+ :rules="$rules.agentDataRequired"
48
+ append-inner-icon="mdi mdi-chevron-right"
49
+ @append="openPanel('AgentData', $t('form.agent'))"
50
+ ></base-panel-input>
51
+ </v-form>
52
+ <Teleport v-if="isPanelOpen" to="#panel-actions">
53
+ <div :class="[$libStyles.scrollPage]" class="flex flex-col items-center">
54
+ <base-rounded-input
55
+ v-model="searchQuery"
56
+ :label="$t('labels.search')"
57
+ class="w-full p-2"
58
+ :hide-details="true"
59
+ :append-inner-icon="currentDictName === 'AgentData' ? 'mdi mdi-magnify' : ''"
60
+ @append="searchAgent"
61
+ ></base-rounded-input>
62
+ <div v-if="dictList && isPanelLoading === false" class="w-full flex flex-col gap-2 p-2">
63
+ <div v-for="(item, index) in dictList" :key="item.id">
64
+ <base-panel-select-item
65
+ :key="index"
66
+ :text="currentDictName === 'AgentData' ? item.fullName : (item.nameRu as string)"
67
+ :selected="currentDictName === 'AgentData' ? item.fullName === panelValue.fullName : item.nameRu === panelValue.nameRu"
68
+ @click="pickPanelValue(item)"
69
+ ></base-panel-select-item>
70
+ </div>
71
+ </div>
72
+ <base-loader v-if="isPanelLoading" class="absolute mt-10" :size="50"></base-loader>
73
+ </div>
74
+ </Teleport>
75
+ </div>
76
+ </template>
77
+
78
+ <script lang="ts">
79
+ import { Value } from '@/composables/classes';
80
+
81
+ export default defineComponent({
82
+ props: {
83
+ title: {
84
+ type: String,
85
+ default: '',
86
+ },
87
+ disabled: {
88
+ type: Boolean,
89
+ default: false,
90
+ },
91
+ },
92
+ setup(props) {
93
+ const route = useRoute();
94
+ const dataStore = useDataStore();
95
+ const formStore = useFormStore();
96
+ const isPanelOpen = ref<boolean>(false);
97
+ const isPanelLoading = ref<boolean>(false);
98
+ const panelValue = ref<Value & AgentData>(new Value());
99
+ const searchQuery = ref<string>('');
100
+ const currentDictName = ref<string>();
101
+
102
+ const dictList = computed(() => {
103
+ if (!currentDictName.value) {
104
+ return [];
105
+ }
106
+ if (currentDictName.value === 'AgentData') {
107
+ return dataStore[currentDictName.value];
108
+ } else {
109
+ // @ts-ignore
110
+ return dataStore[currentDictName.value].filter((item: Value) => {
111
+ // @ts-ignore
112
+ return item.nameRu ? item.nameRu.toLowerCase().includes(searchQuery.value.toLowerCase()) : item.fullName.toLowerCase().includes(searchQuery.value.toLowerCase());
113
+ });
114
+ }
115
+ });
116
+ const isReadonly = computed(
117
+ () =>
118
+ props.disabled ||
119
+ route.params.taskId === '0' ||
120
+ (route.params.taskId !== '0' && (!dataStore.isProcessEditable(formStore.applicationData.statusCode) || !dataStore.isTask())),
121
+ );
122
+
123
+ const openPanel = async (currentDict: string, title: string) => {
124
+ searchQuery.value = '';
125
+ if (dataStore.isTask() && !props.disabled) {
126
+ dataStore.panelAction = null;
127
+ dataStore.panel.open = true;
128
+ dataStore.panel.title = title;
129
+ currentDictName.value = currentDict;
130
+
131
+ if (currentDict === 'ManagerPolicy') {
132
+ isPanelLoading.value = true;
133
+ await dataStore.filterManagerByRegion(formStore.RegionPolicy?.ids);
134
+ }
135
+
136
+ isPanelOpen.value = true;
137
+ panelValue.value = formStore[currentDict as keyof typeof formStore];
138
+ isPanelLoading.value = false;
139
+ } else {
140
+ dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
141
+ }
142
+ };
143
+
144
+ const searchAgent = async () => {
145
+ if (searchQuery.value) {
146
+ isPanelLoading.value = true;
147
+ await dataStore.searchAgentByName(searchQuery.value);
148
+ isPanelLoading.value = false;
149
+ }
150
+ };
151
+
152
+ const pickPanelValue = (answer: any) => {
153
+ // @ts-ignore
154
+ formStore[currentDictName.value] = answer;
155
+ isPanelOpen.value = false;
156
+ dataStore.panel.open = false;
157
+ searchQuery.value = '';
158
+ };
159
+
160
+ watch(searchQuery, () => {
161
+ if (searchQuery.value === null) {
162
+ searchQuery.value = '';
163
+ }
164
+ });
165
+
166
+ watch(
167
+ () => formStore.RegionPolicy,
168
+ (val, oldVal) => {
169
+ if (val.ids !== oldVal.ids) {
170
+ formStore.ManagerPolicy = new Value();
171
+ }
172
+ },
173
+ );
174
+
175
+ return {
176
+ // State
177
+ formStore,
178
+ isPanelOpen,
179
+ isPanelLoading,
180
+ panelValue,
181
+ searchQuery,
182
+ Value,
183
+ currentDictName,
184
+
185
+ // Computed
186
+ dictList,
187
+ isReadonly,
188
+
189
+ // Functions
190
+ openPanel,
191
+ searchAgent,
192
+ pickPanelValue,
193
+ };
194
+ },
195
+ });
196
+ </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="pt-3 pl-5 rounded-lg border-[1px]" :class="[$libStyles.whiteBg]">
2
+ <div class="pt-3 pl-5 rounded-lg border-[1px]" :class="[$libStyles.whiteBg, disabled && $libStyles.disabled]">
3
3
  <div>
4
4
  <p :class="[$libStyles.textTitle, $libStyles.greenText]">
5
5
  {{ $t('productConditions') }}
@@ -20,9 +20,9 @@
20
20
  {{ paymentPeriod }}
21
21
  </span>
22
22
  <div
23
- class="rounded-br-lg transition-all h-[70px] w-[60px] relative place-self-end cursor-pointer"
24
- :class="[$libStyles.blueBgLight, $libStyles.blueBgLightHover]"
25
- @click="$emit('onMore', { whichForm: 'productConditions' })"
23
+ class="rounded-br-lg transition-all h-[70px] w-[60px] relative place-self-end"
24
+ :class="[$libStyles.blueBgLight, $libStyles.blueBgLightHover, disabled ? $libStyles.disabled : 'cursor-pointer']"
25
+ @click="!disabled && $emit('onMore', { whichForm: 'productConditions' })"
26
26
  >
27
27
  <i class="mdi mdi-dots-vertical text-xl absolute top-[20px] right-[20px]"> </i>
28
28
  </div>
@@ -37,6 +37,10 @@ export default defineComponent({
37
37
  type: String,
38
38
  default: '',
39
39
  },
40
+ disabled: {
41
+ type: Boolean,
42
+ default: false,
43
+ },
40
44
  },
41
45
  setup() {
42
46
  const formStore = useFormStore();
@@ -23,12 +23,11 @@
23
23
  @keyup.enter.prevent="submitted"
24
24
  @click:append="!props.readonly && $emit('append-out')"
25
25
  @click:prepend="!props.readonly && $emit('prepend-out')"
26
- @click:append-inner="!props.readonly && $emit('append')"
27
26
  @click:prepend-inner="!props.readonly && $emit('prepend')"
28
27
  @update:modelValue="$emit('update:modelValue', $event)"
29
28
  >
30
29
  <template v-if="appendInnerIcon && appendInnerIcon.length" v-slot:append-inner>
31
- <v-icon v-if="appendInnerIcon !== 'mdi mdi-calendar-blank-outline'" icon="appendInnerIcon"></v-icon>
30
+ <v-icon v-if="appendInnerIcon !== 'mdi mdi-calendar-blank-outline'" :icon="appendInnerIcon" @click="!props.readonly && $emit('append')"></v-icon>
32
31
  <base-datepicker v-else :model-value="modelValue" @update:modelValue="$emit('update:modelValue', $event)"></base-datepicker>
33
32
  </template>
34
33
  <template v-if="loading" #loader>
@@ -108,8 +108,8 @@
108
108
  :maska="$maska.numbers"
109
109
  :readonly="isDisabled"
110
110
  :clearable="!isDisabled"
111
- :rules="$rules.required.concat($rules.numbers, $rules.coverPeriodFrom3to20)"
112
- :label="$t('productConditionsForm.coverPeriodFrom3to20')"
111
+ :rules="coverPeriodRule"
112
+ :label="$t($dataStore.isGons ? 'productConditionsForm.coverPeriodFrom3to20' : 'productConditionsForm.coverPeriod')"
113
113
  ></base-form-input>
114
114
  <base-panel-input
115
115
  v-model="productConditionsForm.paymentPeriod"
@@ -121,6 +121,17 @@
121
121
  append-inner-icon="mdi mdi-chevron-right"
122
122
  @append="openPanel($t('productConditionsForm.processPaymentPeriod'), $dataStore.processPaymentPeriod, 'paymentPeriod', $dataStore.getProcessPaymentPeriod)"
123
123
  ></base-panel-input>
124
+ <base-panel-input
125
+ v-if="hasBaseProductConditions"
126
+ v-model="productConditionsForm.processIndexRate"
127
+ :value="productConditionsForm.processIndexRate.nameRu"
128
+ :readonly="isDisabled"
129
+ :clearable="!isDisabled"
130
+ :rules="$rules.objectRequired"
131
+ :label="$t('productConditionsForm.processIndexRate')"
132
+ append-inner-icon="mdi mdi-chevron-right"
133
+ @append="openPanel($t('productConditionsForm.processIndexRate'), $dataStore.processIndexRate, 'processIndexRate', $dataStore.getProcessIndexRate)"
134
+ ></base-panel-input>
124
135
  <base-form-input
125
136
  v-model="productConditionsForm.requestedSumInsured"
126
137
  :readonly="isDisabled"
@@ -136,6 +147,19 @@
136
147
  :label="$t('productConditionsForm.insurancePremiumAmount')"
137
148
  ></base-form-input>
138
149
  </base-form-section>
150
+ <base-form-section v-if="additionalTerms && additionalTerms.length" :title="$t('productConditionsForm.additional')">
151
+ <div v-for="(term, index) of additionalTerms" :key="index">
152
+ <base-panel-input
153
+ v-model="additionalTerms[index]"
154
+ :value="term.coverSumName"
155
+ :readonly="isDisabled"
156
+ :clearable="!isDisabled"
157
+ :label="term.coverTypeName"
158
+ append-inner-icon="mdi mdi-chevron-right"
159
+ @append="openTermPanel(term.coverTypeName, $dataStore.getAdditionalInsuranceTermsAnswers, term.coverTypeId, index)"
160
+ ></base-panel-input>
161
+ </div>
162
+ </base-form-section>
139
163
  </v-form>
140
164
  <base-btn
141
165
  v-if="!isDisabled && isTask && ($dataStore.isInitiator() || $dataStore.isUnderwriter())"
@@ -163,6 +187,21 @@
163
187
  <base-loader v-if="isPanelLoading" class="absolute mt-10" :size="50"></base-loader>
164
188
  </div>
165
189
  </Teleport>
190
+ <Teleport v-if="isTermsPanelOpen" to="#panel-actions">
191
+ <div :class="[$libStyles.scrollPage]" class="flex flex-col items-center">
192
+ <base-rounded-input v-model="searchQuery" :label="$t('labels.search')" class="w-full p-2" :hide-details="true"></base-rounded-input>
193
+ <div v-if="panelList && isPanelLoading === false" class="w-full flex flex-col gap-2 p-2">
194
+ <base-panel-select-item
195
+ v-for="(item, index) of panelList.filter(i => i.nameRu && (i.nameRu as string).match(new RegExp(searchQuery, 'i')))"
196
+ :key="index"
197
+ :text="(item.nameRu as string)"
198
+ :selected="item.nameRu === termValue?.coverSumName"
199
+ @click="pickTermValue(item)"
200
+ ></base-panel-select-item>
201
+ </div>
202
+ <base-loader v-if="isPanelLoading" class="absolute mt-10" :size="50"></base-loader>
203
+ </div>
204
+ </Teleport>
166
205
  </section>
167
206
  </template>
168
207
 
@@ -187,13 +226,17 @@ export default defineComponent({
187
226
  const isCalculating = ref<boolean>(false);
188
227
  const isPanelLoading = ref<boolean>(false);
189
228
  const isPanelOpen = ref<boolean>(false);
229
+ const isTermsPanelOpen = ref<boolean>(false);
190
230
  const panelValue = ref<Value>(new Value());
231
+ const termValue = ref<AddCover>();
191
232
  const panelList = ref<Value[]>([]);
192
233
  const productConditionsForm = formStore.productConditionsForm;
193
234
  const currentPanel = ref<keyof typeof productConditionsForm>();
235
+ const currentIndex = ref<number>();
194
236
  const searchQuery = ref<string>('');
195
237
  const whichSum = ref<'insurancePremiumPerMonth' | 'requestedSumInsured' | ''>('');
196
238
 
239
+ const additionalTerms = ref<AddCover[]>([]);
197
240
  const isUnderwriterForm = computed(() => {
198
241
  if (route.params.taskId === '0 ' || props.isRecalculation === true) {
199
242
  return false;
@@ -207,19 +250,42 @@ export default defineComponent({
207
250
  const isUnderwriterRole = computed(() => dataStore.isUnderwriter() || dataStore.isAdmin() || dataStore.isSupport());
208
251
  const insurancePremiumPerMonth = computed(() => (!!productConditionsForm.insurancePremiumPerMonth ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
209
252
  const requestedSumInsured = computed(() => (!!productConditionsForm.requestedSumInsured ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
253
+ const hasBaseProductConditions = computed(() => {
254
+ if (dataStore.isGons) {
255
+ return false;
256
+ }
257
+ return true;
258
+ });
259
+ const coverPeriodRule = computed(() => {
260
+ const baseCondition = dataStore.rules.required.concat(dataStore.rules.numbers);
261
+ if (dataStore.isGons) {
262
+ return baseCondition.concat(dataStore.rules.coverPeriodFrom3to20);
263
+ }
264
+ return baseCondition;
265
+ });
210
266
 
211
267
  const pickPanelValue = (item: Value) => {
212
268
  dataStore.panel.open = false;
213
269
  isPanelOpen.value = false;
270
+ if (!currentPanel.value) return;
214
271
  // @ts-ignore
215
272
  productConditionsForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
216
273
  };
217
274
 
275
+ const pickTermValue = (item: Value) => {
276
+ dataStore.panel.open = false;
277
+ isTermsPanelOpen.value = false;
278
+ if (typeof currentIndex.value !== 'number') return;
279
+ additionalTerms.value[currentIndex.value].coverSumId = item.id as string;
280
+ additionalTerms.value[currentIndex.value].coverSumName = item.nameRu as string;
281
+ };
282
+
218
283
  const openPanel = async (title: string, list: Value[], key: string, asyncFunction?: Function, filterKey?: string) => {
219
284
  if (!isDisabled.value || (key === 'riskGroup' && !isRecalculationDisabled.value)) {
220
285
  searchQuery.value = '';
221
286
  currentPanel.value = key as keyof typeof productConditionsForm;
222
287
  isPanelOpen.value = true;
288
+ isTermsPanelOpen.value = false;
223
289
  dataStore.panelAction = null;
224
290
  dataStore.panel.open = true;
225
291
  dataStore.panel.title = title;
@@ -238,6 +304,30 @@ export default defineComponent({
238
304
  }
239
305
  };
240
306
 
307
+ const openTermPanel = async (title: string, asyncFunction: Function, questionId: string, index: number) => {
308
+ if (!isDisabled.value) {
309
+ searchQuery.value = '';
310
+ currentIndex.value = index;
311
+ isPanelOpen.value = false;
312
+ isTermsPanelOpen.value = true;
313
+ dataStore.panelAction = null;
314
+ dataStore.panel.open = true;
315
+ dataStore.panel.title = title;
316
+
317
+ let newList;
318
+ if (asyncFunction) {
319
+ isPanelLoading.value = true;
320
+ newList = await asyncFunction(questionId);
321
+ }
322
+ panelList.value = newList;
323
+ // @ts-ignore
324
+ termValue.value = additionalTerms.value[index];
325
+ isPanelLoading.value = false;
326
+ } else {
327
+ dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
328
+ }
329
+ };
330
+
241
331
  const underwriterCalculate = async (type: 'sum' | 'premium') => {
242
332
  if (!type) return;
243
333
  if (type === 'sum') {
@@ -350,11 +440,14 @@ export default defineComponent({
350
440
  formStore.additionalInsuranceTermsWithout = defaultData.addCovers;
351
441
  productConditionsForm.requestedSumInsured = defaultData.amount;
352
442
  productConditionsForm.insurancePremiumPerMonth = defaultData.premium;
353
- productConditionsForm.processIndexRate = dataStore.processIndexRate.find(i => i.id === defaultData.indexRateId);
354
- productConditionsForm.paymentPeriod = dataStore.processPaymentPeriod.find(i => i.id == defaultData.paymentPeriodId);
443
+ const indexRate = dataStore.processIndexRate.find(i => i.id === defaultData.indexRateId);
444
+ if (indexRate) productConditionsForm.processIndexRate = indexRate;
445
+ const paymendPeriod = dataStore.processPaymentPeriod.find(i => i.id == defaultData.paymentPeriodId);
446
+ if (paymendPeriod) productConditionsForm.paymentPeriod = paymendPeriod;
355
447
  productConditionsForm.signDate = reformatDate(defaultData.signDate);
356
448
  }
357
449
  }
450
+ additionalTerms.value = props.isRecalculation ? formStore.additionalInsuranceTermsWithout : formStore.additionalInsuranceTerms;
358
451
  if (!!productConditionsForm.insurancePremiumPerMonth) {
359
452
  whichSum.value = 'insurancePremiumPerMonth';
360
453
  }
@@ -395,6 +488,7 @@ export default defineComponent({
395
488
  () => {
396
489
  if (dataStore.panel.open === false) {
397
490
  isPanelOpen.value = false;
491
+ isTermsPanelOpen.value = false;
398
492
  dataStore.panelAction = null;
399
493
  }
400
494
  },
@@ -406,10 +500,13 @@ export default defineComponent({
406
500
  formStore,
407
501
  vForm,
408
502
  productConditionsForm,
503
+ additionalTerms,
409
504
  isCalculating,
410
505
  isPanelLoading,
411
506
  isPanelOpen,
507
+ isTermsPanelOpen,
412
508
  panelValue,
509
+ termValue,
413
510
  panelList,
414
511
  searchQuery,
415
512
  whichSum,
@@ -423,11 +520,17 @@ export default defineComponent({
423
520
  requestedSumInsured,
424
521
  isRecalculationDisabled,
425
522
  isUnderwriterRole,
523
+ hasBaseProductConditions,
524
+
525
+ // Rules
526
+ coverPeriodRule,
426
527
 
427
528
  // Functions
428
529
  submitForm,
429
530
  pickPanelValue,
531
+ pickTermValue,
430
532
  openPanel,
533
+ openTermPanel,
431
534
  pickCalculation,
432
535
  underwriterCalculate,
433
536
  };
@@ -781,6 +781,8 @@ export class DataStoreClass {
781
781
  hasInsis: boolean;
782
782
  // Калькулятор без ввода данных
783
783
  hasCalculator: boolean;
784
+ // Блок прикрепления к менеджеру
785
+ hasAttachment: boolean;
784
786
  };
785
787
  hasLayoutMargins: boolean;
786
788
  readonly product: string | null;
@@ -840,9 +842,9 @@ export class DataStoreClass {
840
842
  user: User;
841
843
  accessToken: string | null = null;
842
844
  refreshToken: string | null = null;
843
- processCoverTypeSum: any[];
844
- processIndexRate: any[];
845
- processPaymentPeriod: any[];
845
+ processCoverTypeSum: Value[];
846
+ processIndexRate: Value[];
847
+ processPaymentPeriod: Value[];
846
848
  taskList: TaskListItem[];
847
849
  processHistory: TaskHistory[];
848
850
  contragentList: any[];
@@ -851,11 +853,11 @@ export class DataStoreClass {
851
853
  groupCode: string;
852
854
  userGroups: Item[];
853
855
  onMainPage: boolean;
854
- SaleChanellPolicyList: any[];
855
- RegionPolicyList: any[];
856
- ManagerPolicyList: any[];
857
- AgentDataList: any[];
858
- riskGroup: any[];
856
+ SaleChanellPolicy: Value[];
857
+ RegionPolicy: Value[];
858
+ ManagerPolicy: Value[];
859
+ AgentData: AgentData[];
860
+ riskGroup: Value[];
859
861
  constructor() {
860
862
  this.controls = {
861
863
  onAuth: false,
@@ -865,15 +867,16 @@ export class DataStoreClass {
865
867
  hasGKB: false,
866
868
  hasInsis: false,
867
869
  hasCalculator: false,
870
+ hasAttachment: true,
868
871
  };
869
872
  this.hasLayoutMargins = true;
870
873
  this.processIndexRate = [];
871
874
  this.processPaymentPeriod = [];
872
875
  this.questionRefs = [];
873
- this.SaleChanellPolicyList = [];
874
- this.RegionPolicyList = [];
875
- this.ManagerPolicyList = [];
876
- this.AgentDataList = [];
876
+ this.SaleChanellPolicy = [];
877
+ this.RegionPolicy = [];
878
+ this.ManagerPolicy = [];
879
+ this.AgentData = [];
877
880
  this.product = import.meta.env.VITE_PRODUCT ? (import.meta.env.VITE_PRODUCT as string) : null;
878
881
  this.showNav = true;
879
882
  this.menuItems = [];
@@ -949,27 +952,36 @@ export class DataStoreClass {
949
952
  id: '1',
950
953
  nameKz: '',
951
954
  nameRu: '1',
952
- isDefault: true,
955
+ code: '',
956
+ ids: '',
953
957
  },
954
958
  {
955
959
  id: '2',
956
960
  nameKz: '',
957
961
  nameRu: '2',
962
+ code: '',
963
+ ids: '',
958
964
  },
959
965
  {
960
966
  id: '3',
961
967
  nameKz: '',
962
968
  nameRu: '3',
969
+ code: '',
970
+ ids: '',
963
971
  },
964
972
  {
965
973
  id: '4',
966
974
  nameKz: '',
967
975
  nameRu: '4',
976
+ code: '',
977
+ ids: '',
968
978
  },
969
979
  {
970
980
  id: '5',
971
981
  nameKz: '',
972
982
  nameRu: '5',
983
+ code: '',
984
+ ids: '',
973
985
  },
974
986
  ];
975
987
  }
@@ -997,15 +1009,7 @@ export class FormStoreClass {
997
1009
  };
998
1010
  birthInfos: BirthInfoGKB[];
999
1011
  SaleChanellPolicy: Value;
1000
- AgentData: {
1001
- agentId: null;
1002
- manId: number;
1003
- fullName: string;
1004
- officeId: null;
1005
- officeCode: null;
1006
- saleChannel: string;
1007
- managerName: string;
1008
- };
1012
+ AgentData: AgentData;
1009
1013
  RegionPolicy: Value;
1010
1014
  ManagerPolicy: Value;
1011
1015
  isDisabled: {
@@ -7,6 +7,7 @@ export const constants = Object.freeze({
7
7
  bolashak: 8,
8
8
  liferenta: 9,
9
9
  gons: 10,
10
+ halykkazyna: 11,
10
11
  },
11
12
 
12
13
  editableStatuses: ['StartForm', 'EditBeneficiaryForm', 'EditForm'],
@@ -69,6 +69,7 @@ export class Styles {
69
69
 
70
70
  // Muted or disabled
71
71
  mutedText: string = 'text-[#99A3B3]';
72
+ disabled: string = 'cursor-not-allowed opacity-50';
72
73
 
73
74
  constructor() {
74
75
  // Button
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.8-beta.3",
3
+ "version": "0.0.8-beta.5",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -38,6 +38,7 @@ export const useDataStore = defineStore('data', {
38
38
  isLiferenta: state => state.product === 'liferenta',
39
39
  isPension: state => state.product === 'pension',
40
40
  isGons: state => state.product === 'gons',
41
+ isKazyna: state => state.product === 'halykkazyna',
41
42
  isEveryFormDisabled: state => Object.values(state.formStore.isDisabled).every(i => i === true),
42
43
  },
43
44
  actions: {
@@ -956,16 +957,23 @@ export const useDataStore = defineStore('data', {
956
957
  }
957
958
  },
958
959
  async getFromApi(whichField, whichRequest, parameter, reset = false) {
960
+ if (typeof this[whichField].length === 'number' && !!this[whichField].length) return this[whichField];
959
961
  const storageValue = JSON.parse(localStorage.getItem(whichField) || 'null');
960
962
  const currentHour = new Date().getHours();
963
+ const currentMinutePart = Math.ceil((new Date().getMinutes() + 1) / 15);
961
964
 
962
965
  const getDataCondition = () => {
963
966
  if (!storageValue) return true;
964
967
  const hasHourKey = 'hour' in storageValue;
968
+ const hasMiniteKey = 'minute' in storageValue;
965
969
  const hasModeKey = 'mode' in storageValue;
966
970
  const hasValueKey = 'value' in storageValue;
967
- if (storageValue && (hasHourKey === false || hasModeKey === false || hasValueKey === false)) return true;
968
- if (storageValue && (storageValue.hour !== currentHour || storageValue.mode !== import.meta.env.MODE || storageValue.value.length === 0)) return true;
971
+ if (storageValue && (hasHourKey === false || hasMiniteKey === false || hasModeKey === false || hasValueKey === false)) return true;
972
+ if (
973
+ storageValue &&
974
+ (storageValue.hour !== currentHour || storageValue.minute !== currentMinutePart || storageValue.mode !== import.meta.env.MODE || storageValue.value.length === 0)
975
+ )
976
+ return true;
969
977
  };
970
978
  if (!!getDataCondition() || reset === true) {
971
979
  this[whichField] = [];
@@ -977,6 +985,7 @@ export const useDataStore = defineStore('data', {
977
985
  JSON.stringify({
978
986
  value: response,
979
987
  hour: currentHour,
988
+ minute: currentMinutePart,
980
989
  mode: import.meta.env.MODE,
981
990
  }),
982
991
  );
@@ -1047,16 +1056,7 @@ export const useDataStore = defineStore('data', {
1047
1056
  });
1048
1057
  },
1049
1058
  async getDicFileTypeList() {
1050
- try {
1051
- if (this.dicFileTypeList.length) {
1052
- return this.dicFileTypeList;
1053
- } else {
1054
- this.dicFileTypeList = await this.api.getDicFileTypeList();
1055
- return this.dicFileTypeList;
1056
- }
1057
- } catch (err) {
1058
- console.log(err.response.data);
1059
- }
1059
+ return await this.getFromApi('dicFileTypeList', 'getDicFileTypeList');
1060
1060
  },
1061
1061
  async getDocumentIssuers() {
1062
1062
  return await this.getFromApi('documentIssuers', 'getDocumentIssuers');
@@ -1207,6 +1207,9 @@ export const useDataStore = defineStore('data', {
1207
1207
  this.getProcessIndexRate(),
1208
1208
  this.getProcessTariff(),
1209
1209
  this.getProcessPaymentPeriod(),
1210
+ this.getDicFileTypeList(),
1211
+ this.getDictionaryItems('RegionPolicy'),
1212
+ this.getDictionaryItems('SaleChanellPolicy'),
1210
1213
  ]);
1211
1214
  },
1212
1215
  async getUserGroups() {
@@ -1254,15 +1257,12 @@ export const useDataStore = defineStore('data', {
1254
1257
  },
1255
1258
  async searchAgentByName(name) {
1256
1259
  try {
1257
- this.isLoading = true;
1258
- this.AgentDataList = await this.api.searchAgentByName(name);
1259
- if (!this.AgentDataList.length) {
1260
+ this.AgentData = await this.api.searchAgentByName(name);
1261
+ if (!this.AgentData.length) {
1260
1262
  this.showToaster('error', this.t('toaster.notFound'), 1500);
1261
1263
  }
1262
1264
  } catch (err) {
1263
1265
  console.log(err);
1264
- } finally {
1265
- this.isLoading = false;
1266
1266
  }
1267
1267
  },
1268
1268
  async setINSISWorkData() {
@@ -1291,14 +1291,14 @@ export const useDataStore = defineStore('data', {
1291
1291
  this.isLoading = false;
1292
1292
  }
1293
1293
  },
1294
- async filterManagerByRegion(dictName, filterName) {
1294
+ async getDictionaryItems(dictName) {
1295
+ return await this.getFromApi(dictName, 'getDictionaryItems', dictName);
1296
+ },
1297
+ async filterManagerByRegion(filterName) {
1295
1298
  try {
1296
- this.isLoading = true;
1297
- this[`${dictName}List`] = await this.api.filterManagerByRegion(dictName, filterName);
1299
+ this.ManagerPolicy = await this.api.filterManagerByRegion('ManagerPolicy', filterName);
1298
1300
  } catch (err) {
1299
1301
  console.log(err);
1300
- } finally {
1301
- this.isLoading = false;
1302
1302
  }
1303
1303
  },
1304
1304
  async getUnderwritingCouncilData(id) {
@@ -1981,7 +1981,7 @@ export const useDataStore = defineStore('data', {
1981
1981
  }
1982
1982
  }
1983
1983
  }
1984
- if (!this.isGons) {
1984
+ if (this.controls.hasAttachment) {
1985
1985
  const areValid = this.formStore.SaleChanellPolicy.nameRu && this.formStore.RegionPolicy.nameRu && this.formStore.ManagerPolicy.nameRu && this.formStore.AgentData.fullName;
1986
1986
  if (areValid) {
1987
1987
  await this.setINSISWorkData();
package/store/messages.ts CHANGED
@@ -402,6 +402,10 @@ export const messages = {
402
402
  homePhone: 'Домашний номер телефон',
403
403
  email: 'Email адрес',
404
404
  otpCode: 'Код подтверждения',
405
+ salesChanell: ' Канал продаж',
406
+ manager: 'Менеджер',
407
+ attachManager: 'Прикрепление к менеджеру',
408
+ agent: 'Агент',
405
409
  },
406
410
  agreementBlock: {
407
411
  title: 'Согласие на сбор и обработку пресональных данных',
package/store/rules.js CHANGED
@@ -13,6 +13,14 @@ export const rules = {
13
13
  return t('rules.required');
14
14
  },
15
15
  ],
16
+ agentDataRequired: [
17
+ v => {
18
+ if (!!v && 'fullName' in v && v.fullName != null) {
19
+ return true;
20
+ }
21
+ return t('rules.required');
22
+ },
23
+ ],
16
24
  noResident: [
17
25
  v => {
18
26
  if (!!v && 'nameRu' in v && v.nameRu === 'Нерезидент') {
package/types/index.ts CHANGED
@@ -300,4 +300,18 @@ declare global {
300
300
  taskId: string;
301
301
  comment?: string;
302
302
  };
303
+
304
+ type AgentData = {
305
+ agentId?: number | null;
306
+ manId?: number;
307
+ fullName?: string;
308
+ officeId?: number | null;
309
+ officeCode?: string | null;
310
+ saleChannel?: string;
311
+ staffId?: number;
312
+ managerName?: string;
313
+ mainAgentId?: string | null;
314
+ agentNo?: string;
315
+ iin?: string | null;
316
+ };
303
317
  }