@webitel/ui-datalist 1.0.0 → 1.0.1

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 (155) hide show
  1. package/Readme.md +19 -0
  2. package/package.json +3 -1
  3. package/src/filter-presets/api/PresetQuery.api.ts +123 -0
  4. package/src/filter-presets/components/_shared/input-fields/preset-description-field.vue +33 -0
  5. package/src/filter-presets/components/_shared/input-fields/preset-name-field.vue +29 -0
  6. package/src/filter-presets/components/_shared/preset-filters-preview.vue +45 -0
  7. package/src/filter-presets/components/apply-preset/apply-preset-action.vue +234 -0
  8. package/src/filter-presets/components/apply-preset/preset-preview.vue +210 -0
  9. package/src/filter-presets/components/save-preset/overwrite-preset-popup.vue +64 -0
  10. package/src/filter-presets/components/save-preset/save-preset-action.vue +139 -0
  11. package/src/filter-presets/components/save-preset/save-preset-popup.vue +136 -0
  12. package/src/filter-presets/index.ts +5 -0
  13. package/src/filter-presets/stores/createFilterPresetsStore.ts +17 -0
  14. package/src/filter-presets/stores/headers/headers.ts +24 -0
  15. package/src/filters/classes/Filter.ts +30 -0
  16. package/src/filters/classes/FilterStorage.ts +34 -0
  17. package/src/filters/classes/FilterStorageOptions.d.ts +6 -0
  18. package/src/filters/classes/FiltersManager.ts +189 -0
  19. package/src/filters/components/config/dynamic-filter-config-form-label.vue +50 -0
  20. package/src/filters/components/config/dynamic-filter-config-form.vue +140 -0
  21. package/src/filters/components/config/dynamic-filter-config-view.vue +40 -0
  22. package/src/filters/components/dynamic-filter-add-action.vue +54 -0
  23. package/src/filters/components/dynamic-filter-panel-wrapper.vue +57 -0
  24. package/src/filters/components/dynamic-filter-search.vue +61 -0
  25. package/src/filters/components/filter-options/_shared/composables/booleanFilterToolkit.ts +39 -0
  26. package/src/filters/components/filter-options/_shared/composables/useFromToSecToPreviewTime.ts +41 -0
  27. package/src/filters/components/filter-options/_shared/date-time-filter/date-time-filter-value-field.vue +56 -0
  28. package/src/filters/components/filter-options/_shared/durations/duration-filter-value-field.vue +84 -0
  29. package/src/filters/components/filter-options/_shared/has-options/has-option-filter-value-field.vue +38 -0
  30. package/src/filters/components/filter-options/_shared/types/BooleanFilter.ts +1 -0
  31. package/src/filters/components/filter-options/actual-reaction-time/actual-reaction-time-filter-value-field.vue +18 -0
  32. package/src/filters/components/filter-options/actual-reaction-time/actual-reaction-time-filter-value-preview.vue +44 -0
  33. package/src/filters/components/filter-options/actual-resolution-time/actual-resolution-time-filter-value-field.vue +18 -0
  34. package/src/filters/components/filter-options/actual-resolution-time/actual-resolution-time-filter-value-preview.vue +44 -0
  35. package/src/filters/components/filter-options/agent/agent-filter-value-field.vue +58 -0
  36. package/src/filters/components/filter-options/agent/agent-filter-value-preview.vue +31 -0
  37. package/src/filters/components/filter-options/agent/config.js +4 -0
  38. package/src/filters/components/filter-options/amd-result/amd-result-filter-value-field.vue +52 -0
  39. package/src/filters/components/filter-options/amd-result/amd-result-filter-value-preview.vue +18 -0
  40. package/src/filters/components/filter-options/assignee/assignee-filter-value-field.vue +74 -0
  41. package/src/filters/components/filter-options/assignee/assignee-filter-value-preview.vue +36 -0
  42. package/src/filters/components/filter-options/assignee/config.js +4 -0
  43. package/src/filters/components/filter-options/author/author-filter-value-field.vue +56 -0
  44. package/src/filters/components/filter-options/author/author-filter-value-preview.vue +31 -0
  45. package/src/filters/components/filter-options/author/config.js +4 -0
  46. package/src/filters/components/filter-options/cause/cause-filter-value-field.vue +52 -0
  47. package/src/filters/components/filter-options/cause/cause-filter-value-preview.vue +18 -0
  48. package/src/filters/components/filter-options/close-reason-groups-case/close-reason-groups-case-filter-value-field.vue +102 -0
  49. package/src/filters/components/filter-options/close-reason-groups-case/close-reason-groups-case-filter-value-preview.vue +34 -0
  50. package/src/filters/components/filter-options/close-reason-groups-case/config.js +7 -0
  51. package/src/filters/components/filter-options/contact/config.js +4 -0
  52. package/src/filters/components/filter-options/contact/contact-filter-value-field.vue +56 -0
  53. package/src/filters/components/filter-options/contact/contact-filter-value-preview.vue +31 -0
  54. package/src/filters/components/filter-options/contact-group/config.js +4 -0
  55. package/src/filters/components/filter-options/contact-group/contact-group-filter-value-field.vue +74 -0
  56. package/src/filters/components/filter-options/contact-group/contact-group-filter-value-preview.vue +38 -0
  57. package/src/filters/components/filter-options/created-at-from/created-at-from-filter-value-field.vue +24 -0
  58. package/src/filters/components/filter-options/created-at-from/created-at-from-filter-value-preview.vue +15 -0
  59. package/src/filters/components/filter-options/created-at-to/created-at-to-filter-value-field.vue +24 -0
  60. package/src/filters/components/filter-options/created-at-to/created-at-to-filter-value-preview.vue +15 -0
  61. package/src/filters/components/filter-options/direction/direction-filter-value-field.vue +51 -0
  62. package/src/filters/components/filter-options/direction/direction-filter-value-preview.vue +17 -0
  63. package/src/filters/components/filter-options/gateway/config.js +4 -0
  64. package/src/filters/components/filter-options/gateway/gateway-filter-value-field.vue +56 -0
  65. package/src/filters/components/filter-options/gateway/gateway-filter-value-preview.vue +31 -0
  66. package/src/filters/components/filter-options/grantee/config.js +4 -0
  67. package/src/filters/components/filter-options/grantee/grantee-filter-value-field.vue +56 -0
  68. package/src/filters/components/filter-options/grantee/grantee-filter-value-preview.vue +31 -0
  69. package/src/filters/components/filter-options/has-attachment/has-attachment-filter-value-field.vue +43 -0
  70. package/src/filters/components/filter-options/has-attachment/has-attachment-filter-value-preview.vue +24 -0
  71. package/src/filters/components/filter-options/has-file/has-file-filter-value-field.vue +33 -0
  72. package/src/filters/components/filter-options/has-file/has-file-filter-value-preview.vue +15 -0
  73. package/src/filters/components/filter-options/has-rating/has-rating-filter-value-field.vue +33 -0
  74. package/src/filters/components/filter-options/has-rating/has-rating-filter-value-preview.vue +15 -0
  75. package/src/filters/components/filter-options/has-transcription/has-transcription-filter-value-field.vue +33 -0
  76. package/src/filters/components/filter-options/has-transcription/has-transcription-filter-value-preview.vue +15 -0
  77. package/src/filters/components/filter-options/impacted/config.js +4 -0
  78. package/src/filters/components/filter-options/impacted/impacted-filter-value-field.vue +56 -0
  79. package/src/filters/components/filter-options/impacted/impacted-filter-value-preview.vue +31 -0
  80. package/src/filters/components/filter-options/index.ts +250 -0
  81. package/src/filters/components/filter-options/priority-case/config.js +4 -0
  82. package/src/filters/components/filter-options/priority-case/priority-case-filter-value-field.vue +57 -0
  83. package/src/filters/components/filter-options/priority-case/priority-case-filter-value-preview.vue +31 -0
  84. package/src/filters/components/filter-options/queue/config.js +4 -0
  85. package/src/filters/components/filter-options/queue/queue-filter-value-field.vue +56 -0
  86. package/src/filters/components/filter-options/queue/queue-filter-value-preview.vue +31 -0
  87. package/src/filters/components/filter-options/rated-by/config.js +4 -0
  88. package/src/filters/components/filter-options/rated-by/rated-by-filter-value-field.vue +56 -0
  89. package/src/filters/components/filter-options/rated-by/rated-by-filter-value-preview.vue +31 -0
  90. package/src/filters/components/filter-options/rating/rating-from-to-filter-value-field.vue +101 -0
  91. package/src/filters/components/filter-options/rating/rating-from-to-filter-value-preview.vue +39 -0
  92. package/src/filters/components/filter-options/reaction-time/reaction-time-filter-value-field.vue +18 -0
  93. package/src/filters/components/filter-options/reaction-time/reaction-time-filter-value-preview.vue +44 -0
  94. package/src/filters/components/filter-options/reporter/config.js +4 -0
  95. package/src/filters/components/filter-options/reporter/reporter-filter-value-field.vue +56 -0
  96. package/src/filters/components/filter-options/reporter/reporter-filter-value-preview.vue +31 -0
  97. package/src/filters/components/filter-options/resolution-time/resolution-time-filter-value-field.vue +18 -0
  98. package/src/filters/components/filter-options/resolution-time/resolution-time-filter-value-preview.vue +44 -0
  99. package/src/filters/components/filter-options/score/score-from-to-filter-value-field.vue +100 -0
  100. package/src/filters/components/filter-options/score/score-from-to-filter-value-preview.vue +39 -0
  101. package/src/filters/components/filter-options/service-case/config.js +6 -0
  102. package/src/filters/components/filter-options/service-case/service-case-filter-value-field.vue +82 -0
  103. package/src/filters/components/filter-options/service-case/service-case-filter-value-preview.vue +34 -0
  104. package/src/filters/components/filter-options/sla/config.js +4 -0
  105. package/src/filters/components/filter-options/sla/sla-filter-value-field.vue +57 -0
  106. package/src/filters/components/filter-options/sla/sla-filter-value-preview.vue +31 -0
  107. package/src/filters/components/filter-options/sla-condition/config.js +6 -0
  108. package/src/filters/components/filter-options/sla-condition/sla-condition-filter-value-field.vue +98 -0
  109. package/src/filters/components/filter-options/sla-condition/sla-condition-filter-value-preview.vue +37 -0
  110. package/src/filters/components/filter-options/source-case/config.js +4 -0
  111. package/src/filters/components/filter-options/source-case/source-case-filter-value-field.vue +57 -0
  112. package/src/filters/components/filter-options/source-case/source-case-filter-value-preview.vue +31 -0
  113. package/src/filters/components/filter-options/status-case/config.js +7 -0
  114. package/src/filters/components/filter-options/status-case/status-case-filter-value-field.vue +102 -0
  115. package/src/filters/components/filter-options/status-case/status-case-filter-value-preview.vue +37 -0
  116. package/src/filters/components/filter-options/tag/tag-filter-value-field.vue +52 -0
  117. package/src/filters/components/filter-options/tag/tag-filter-value-preview.vue +38 -0
  118. package/src/filters/components/filter-options/talk-duration/TalkDurationFilter.d.ts +4 -0
  119. package/src/filters/components/filter-options/talk-duration/talk-duration-filter-value-field.vue +19 -0
  120. package/src/filters/components/filter-options/talk-duration/talk-duration-filter-value-preview.vue +44 -0
  121. package/src/filters/components/filter-options/team/config.js +4 -0
  122. package/src/filters/components/filter-options/team/team-filter-value-field.vue +56 -0
  123. package/src/filters/components/filter-options/team/team-filter-value-preview.vue +31 -0
  124. package/src/filters/components/filter-options/total-duration/TotalDurationFilter.d.ts +4 -0
  125. package/src/filters/components/filter-options/total-duration/total-duration-filter-value-field.vue +19 -0
  126. package/src/filters/components/filter-options/total-duration/total-duration-filter-value-preview.vue +44 -0
  127. package/src/filters/components/filter-options/user/config.js +4 -0
  128. package/src/filters/components/filter-options/user/user-filter-value-field.vue +56 -0
  129. package/src/filters/components/filter-options/user/user-filter-value-preview.vue +31 -0
  130. package/src/filters/components/filter-options/variable/variable-filter-value-field.vue +50 -0
  131. package/src/filters/components/filter-options/variable/variable-filter-value-preview.vue +39 -0
  132. package/src/filters/components/preview/dynamic-filter-preview-info.vue +35 -0
  133. package/src/filters/components/preview/dynamic-filter-preview.vue +76 -0
  134. package/src/filters/components/table-filters-panel.vue +87 -0
  135. package/src/filters/createTableFiltersStore.ts +81 -0
  136. package/src/filters/enums/FilterOption.ts +43 -0
  137. package/src/filters/enums/amd-result-options.ts +38 -0
  138. package/src/filters/enums/boolean-options.ts +16 -0
  139. package/src/filters/enums/direction-options.ts +20 -0
  140. package/src/filters/enums/hangup-cause-options.ts +265 -0
  141. package/src/filters/enums/tag-options.ts +8 -0
  142. package/src/filters/index.ts +27 -0
  143. package/src/filters/scripts/utils.ts +31 -0
  144. package/src/filters/types/Filter.d.ts +46 -0
  145. package/src/filters/types/FiltersManager.d.ts +76 -0
  146. package/src/headers/createTableHeadersStore.ts +140 -0
  147. package/src/index.d.ts +0 -0
  148. package/src/index.ts +3 -0
  149. package/src/pagination/createTablePaginationStore.ts +64 -0
  150. package/src/persist/PersistedStorage.types.ts +51 -0
  151. package/src/persist/useLocalStoragePersistedStorage.ts +37 -0
  152. package/src/persist/usePersistedStorage.ts +151 -0
  153. package/src/persist/useRoutePersistedStorage.ts +41 -0
  154. package/src/table/createTableStore.store.ts +206 -0
  155. package/src/types/tableStore.types.ts +61 -0
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <div class="actual-resolution-time-filter-value-preview">
3
+ <div v-if="props.value.from">
4
+ <p class="actual-resolution-time-filter-value-preview__title">
5
+ {{ t('reusable.from') }}
6
+ </p>
7
+
8
+ <span>{{ convertTimestampToDate(props.value.from) }}</span>
9
+ </div>
10
+
11
+ <div v-if="props.value.to">
12
+ <p class="actual-resolution-time-filter-value-preview__title">
13
+ {{ t('reusable.to') }}
14
+ </p>
15
+
16
+ <span>{{ convertTimestampToDate(props.value.to) }}</span>
17
+ </div>
18
+ </div>
19
+ </template>
20
+
21
+ <script lang="ts" setup>
22
+ import { format } from 'date-fns';
23
+ import { useI18n } from 'vue-i18n';
24
+
25
+ const props = defineProps<{
26
+ value: number[];
27
+ }>();
28
+
29
+ const { t } = useI18n();
30
+
31
+ function convertTimestampToDate(value) {
32
+ return format(new Date(value), 'dd.MM.yyyy HH:mm');
33
+ }
34
+ </script>
35
+
36
+ <style lang="scss" scoped>
37
+ @use '@webitel/styleguide/typography' as *;
38
+
39
+ .actual-resolution-time-filter-value-preview {
40
+ &__title {
41
+ @extend %typo-subtitle-1;
42
+ }
43
+ }
44
+ </style>
@@ -0,0 +1,58 @@
1
+ <template>
2
+ <wt-select
3
+ :close-on-select="false"
4
+ :label="t('webitelUI.filters.filterValue')"
5
+ :search-method="searchMethod"
6
+ :value="model"
7
+ :v="v$.model"
8
+ multiple
9
+ use-value-from-options-by-prop="id"
10
+ @input="handleInput"
11
+ />
12
+ </template>
13
+
14
+ <script lang="ts" setup>
15
+ import { useVuelidate } from '@vuelidate/core';
16
+ import { required } from '@vuelidate/validators';
17
+ import { computed, watch } from 'vue';
18
+ import { useI18n } from 'vue-i18n';
19
+
20
+ import WtSelect from '../../../../../../../components/wt-select/wt-select.vue';
21
+ import { searchMethod } from './config.js';
22
+
23
+ type ModelValue = number[];
24
+
25
+ const model = defineModel<ModelValue>();
26
+
27
+ const emit = defineEmits<{
28
+ 'update:invalid': [boolean];
29
+ }>();
30
+
31
+ const { t } = useI18n();
32
+
33
+ const v$ = useVuelidate(
34
+ computed(() => ({
35
+ model: {
36
+ required,
37
+ },
38
+ })),
39
+ { model },
40
+ { $autoDirty: true },
41
+ );
42
+
43
+ v$.value.$touch();
44
+
45
+ watch(
46
+ () => v$.value.$invalid,
47
+ (invalid) => {
48
+ emit('update:invalid', invalid);
49
+ },
50
+ { immediate: true },
51
+ );
52
+
53
+ const handleInput = (value: ModelValue) => {
54
+ model.value = value;
55
+ };
56
+ </script>
57
+
58
+ <style lang="scss" scoped></style>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <ul v-if="localValue">
3
+ <li
4
+ v-for="({ name }, index) of localValue"
5
+ :key="index"
6
+ >
7
+ {{ name }}
8
+ </li>
9
+ </ul>
10
+ </template>
11
+
12
+ <script lang="ts" setup>
13
+ import { ref } from 'vue';
14
+
15
+ import { searchMethod } from './config.js';
16
+
17
+ const props = defineProps<{
18
+ value: number[];
19
+ }>();
20
+
21
+ const localValue = ref([]);
22
+
23
+ const getLocalValue = async () => {
24
+ const { items } = await searchMethod({ id: props.value });
25
+ localValue.value = items;
26
+ };
27
+
28
+ getLocalValue();
29
+ </script>
30
+
31
+ <style lang="scss" scoped></style>
@@ -0,0 +1,4 @@
1
+ import AgentsAPI from '../../../../../../../api/clients/agents/agents.js';
2
+
3
+ export const searchMethod = AgentsAPI.getLookup;
4
+ export const localePath = '';
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <wt-select
3
+ :clearable="false"
4
+ :label="t('webitelUI.filters.filterValue')"
5
+ :options="AmdResultOptions"
6
+ :value="model"
7
+ :v="v$.model"
8
+ multiple
9
+ track-by="value"
10
+ use-value-from-options-by-prop="value"
11
+ @input="model = $event"
12
+ />
13
+ </template>
14
+
15
+ <script lang="ts" setup>
16
+ import { useVuelidate } from '@vuelidate/core';
17
+ import { required } from '@vuelidate/validators';
18
+ import { computed, watch } from 'vue';
19
+ import { useI18n } from 'vue-i18n';
20
+
21
+ import WtSelect from '../../../../../../../components/wt-select/wt-select.vue';
22
+ import { AmdResultOptions } from '../../../enums/amd-result-options';
23
+
24
+ const model = defineModel<string>();
25
+ const { t } = useI18n();
26
+
27
+ const v$ = useVuelidate(
28
+ computed(() => ({
29
+ model: {
30
+ required,
31
+ },
32
+ })),
33
+ { model },
34
+ { $autoDirty: true },
35
+ );
36
+
37
+ v$.value.$touch();
38
+
39
+ const emit = defineEmits<{
40
+ 'update:invalid': [boolean];
41
+ }>();
42
+
43
+ watch(
44
+ () => v$.value.$invalid,
45
+ (invalid) => {
46
+ emit('update:invalid', invalid);
47
+ },
48
+ { immediate: true },
49
+ );
50
+ </script>
51
+
52
+ <style lang="scss" scoped></style>
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <ul>
3
+ <li
4
+ v-for="(result, index) of props.value"
5
+ :key="index"
6
+ >
7
+ {{ result }}
8
+ </li>
9
+ </ul>
10
+ </template>
11
+
12
+ <script lang="ts" setup>
13
+ const props = defineProps<{
14
+ value: number[];
15
+ }>();
16
+ </script>
17
+
18
+ <style lang="scss" scoped></style>
@@ -0,0 +1,74 @@
1
+ <template>
2
+ <wt-select
3
+ :close-on-select="false"
4
+ :label="t('webitelUI.filters.filterValue')"
5
+ :search-method="searchMethod"
6
+ :v="v$.model.list"
7
+ :value="model?.list"
8
+ multiple
9
+ track-by="id"
10
+ use-value-from-options-by-prop="id"
11
+ @input="model.list = $event"
12
+ />
13
+ <wt-checkbox
14
+ :label="t('reusable.showUnassigned')"
15
+ :selected="model?.unassigned"
16
+ :v="v$.model.unassigned"
17
+ @change="model.unassigned = $event"
18
+ />
19
+ </template>
20
+
21
+ <script lang="ts" setup>
22
+ import { useVuelidate } from '@vuelidate/core';
23
+ import { requiredIf } from '@vuelidate/validators';
24
+ import { computed, onMounted, watch } from 'vue';
25
+ import { useI18n } from 'vue-i18n';
26
+
27
+ import WtCheckbox from '../../../../../../../components/wt-checkbox/wt-checkbox.vue';
28
+ import WtSelect from '../../../../../../../components/wt-select/wt-select.vue';
29
+ import { searchMethod } from './config.js';
30
+
31
+ type ModelValue = {
32
+ list: string[];
33
+ unassigned: boolean;
34
+ };
35
+
36
+ const model = defineModel<ModelValue>();
37
+
38
+ const emit = defineEmits<{
39
+ 'update:invalid': [boolean];
40
+ }>();
41
+ const { t } = useI18n();
42
+
43
+ const initModel = () => {
44
+ if (!model.value) {
45
+ model.value = {
46
+ list: [],
47
+ unassigned: false,
48
+ };
49
+ }
50
+ };
51
+ onMounted(() => initModel());
52
+
53
+ const v$ = useVuelidate(
54
+ computed(() => ({
55
+ model: {
56
+ list: { required: requiredIf(() => !model.value.unassigned) },
57
+ unassigned: { required: requiredIf(() => !model.value.list.length) },
58
+ },
59
+ })),
60
+ { model },
61
+ { $autoDirty: true },
62
+ );
63
+ v$.value.$touch();
64
+
65
+ watch(
66
+ () => v$.value.$invalid,
67
+ (invalid) => {
68
+ emit('update:invalid', invalid);
69
+ },
70
+ { immediate: true },
71
+ );
72
+ </script>
73
+
74
+ <style lang="scss" scoped></style>
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <div>
3
+ <p v-if="props.value.unassigned">{{ t('reusable.unassigned') }}</p>
4
+ <ul v-if="localValue">
5
+ <li
6
+ v-for="({ name }, index) of localValue"
7
+ :key="index"
8
+ >
9
+ {{ name }}
10
+ </li>
11
+ </ul>
12
+ </div>
13
+ </template>
14
+
15
+ <script lang="ts" setup>
16
+ import { ref } from 'vue';
17
+ import { useI18n } from 'vue-i18n';
18
+
19
+ import { searchMethod } from './config.js';
20
+
21
+ const props = defineProps<{
22
+ value: number[];
23
+ }>();
24
+
25
+ const localValue = ref([]);
26
+ const { t } = useI18n();
27
+
28
+ const getLocalValue = async () => {
29
+ const { items } = await searchMethod({ id: props.value.list });
30
+ localValue.value = items;
31
+ };
32
+
33
+ getLocalValue();
34
+ </script>
35
+
36
+ <style lang="scss" scoped></style>
@@ -0,0 +1,4 @@
1
+ import ContactsAPI from '../../../../../../../api/clients/сontacts/contacts.js';
2
+
3
+ export const searchMethod = ContactsAPI.getLookup;
4
+ export const localePath = '';
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <wt-select
3
+ :close-on-select="false"
4
+ :label="t('webitelUI.filters.filterValue')"
5
+ :search-method="searchMethod"
6
+ :v="v$.model"
7
+ :value="model"
8
+ multiple
9
+ use-value-from-options-by-prop="id"
10
+ @input="handleInput"
11
+ />
12
+ </template>
13
+
14
+ <script lang="ts" setup>
15
+ import { useVuelidate } from '@vuelidate/core';
16
+ import { required } from '@vuelidate/validators';
17
+ import { computed, watch } from 'vue';
18
+ import { useI18n } from 'vue-i18n';
19
+
20
+ import WtSelect from '../../../../../../../components/wt-select/wt-select.vue';
21
+ import { searchMethod } from './config.js';
22
+
23
+ type ModelValue = number[];
24
+
25
+ const model = defineModel<ModelValue>();
26
+
27
+ const emit = defineEmits<{
28
+ 'update:invalid': [boolean];
29
+ }>();
30
+ const { t } = useI18n();
31
+
32
+ const v$ = useVuelidate(
33
+ computed(() => ({
34
+ model: {
35
+ required,
36
+ },
37
+ })),
38
+ { model },
39
+ { $autoDirty: true },
40
+ );
41
+ v$.value.$touch();
42
+
43
+ watch(
44
+ () => v$.value.$invalid,
45
+ (invalid) => {
46
+ emit('update:invalid', invalid);
47
+ },
48
+ { immediate: true },
49
+ );
50
+
51
+ const handleInput = (value: ModelValue) => {
52
+ model.value = value;
53
+ };
54
+ </script>
55
+
56
+ <style lang="scss" scoped></style>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <ul v-if="localValue">
3
+ <li
4
+ v-for="({ name }, index) of localValue"
5
+ :key="index"
6
+ >
7
+ {{ name }}
8
+ </li>
9
+ </ul>
10
+ </template>
11
+
12
+ <script lang="ts" setup>
13
+ import { ref } from 'vue';
14
+
15
+ import { searchMethod } from './config.js';
16
+
17
+ const props = defineProps<{
18
+ value: number[];
19
+ }>();
20
+
21
+ const localValue = ref([]);
22
+
23
+ const getLocalValue = async () => {
24
+ const { items } = await searchMethod({ id: props.value });
25
+ localValue.value = items;
26
+ };
27
+
28
+ getLocalValue();
29
+ </script>
30
+
31
+ <style lang="scss" scoped></style>
@@ -0,0 +1,4 @@
1
+ import UsersAPI from '../../../../../../../api/clients/users/users.js';
2
+
3
+ export const searchMethod = UsersAPI.getLookup;
4
+ export const localePath = '';
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <wt-select
3
+ :clearable="false"
4
+ :label="t('webitelUI.filters.filterValue')"
5
+ :options="HangupCauseOptions"
6
+ :value="model"
7
+ :v="v$.model"
8
+ multiple
9
+ track-by="value"
10
+ use-value-from-options-by-prop="value"
11
+ @input="model = $event"
12
+ />
13
+ </template>
14
+
15
+ <script lang="ts" setup>
16
+ import { useVuelidate } from '@vuelidate/core';
17
+ import { required } from '@vuelidate/validators';
18
+ import { computed, watch } from 'vue';
19
+ import { useI18n } from 'vue-i18n';
20
+
21
+ import WtSelect from '../../../../../../../components/wt-select/wt-select.vue';
22
+ import { HangupCauseOptions } from '../../../enums/hangup-cause-options';
23
+
24
+ const model = defineModel<string>();
25
+ const { t } = useI18n();
26
+
27
+ const v$ = useVuelidate(
28
+ computed(() => ({
29
+ model: {
30
+ required,
31
+ },
32
+ })),
33
+ { model },
34
+ { $autoDirty: true },
35
+ );
36
+
37
+ v$.value.$touch();
38
+
39
+ const emit = defineEmits<{
40
+ 'update:invalid': [boolean];
41
+ }>();
42
+
43
+ watch(
44
+ () => v$.value.$invalid,
45
+ (invalid) => {
46
+ emit('update:invalid', invalid);
47
+ },
48
+ { immediate: true },
49
+ );
50
+ </script>
51
+
52
+ <style lang="scss" scoped></style>
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <ul>
3
+ <li
4
+ v-for="(hangupCause, index) of props.value"
5
+ :key="index"
6
+ >
7
+ {{ hangupCause }}
8
+ </li>
9
+ </ul>
10
+ </template>
11
+
12
+ <script lang="ts" setup>
13
+ const props = defineProps<{
14
+ value: number[];
15
+ }>();
16
+ </script>
17
+
18
+ <style lang="scss" scoped></style>
@@ -0,0 +1,102 @@
1
+ <template>
2
+ <div>
3
+ <wt-select
4
+ :clearable="false"
5
+ :label="t('cases.reason')"
6
+ :search-method="caseCloseReasonsGroupsSearchMethod"
7
+ :v="v$.model.selection"
8
+ :value="model?.selection"
9
+ track-by="id"
10
+ use-value-from-options-by-prop="id"
11
+ @input="updateSelected"
12
+ />
13
+
14
+ <wt-select
15
+ v-if="model?.selection"
16
+ :key="model.selection"
17
+ :clearable="false"
18
+ :disabled="!model.selection"
19
+ :label="t('webitelUI.filters.filterValue')"
20
+ :search-method="getConditionList"
21
+ :v="v$.model.conditions"
22
+ :value="model.conditions"
23
+ multiple
24
+ track-by="id"
25
+ use-value-from-options-by-prop="id"
26
+ @input="model.conditions = $event"
27
+ />
28
+ </div>
29
+ </template>
30
+
31
+ <script lang="ts" setup>
32
+ import { useVuelidate } from '@vuelidate/core';
33
+ import { required } from '@vuelidate/validators';
34
+ import { computed, onMounted, ref, watch } from 'vue';
35
+ import { useI18n } from 'vue-i18n';
36
+
37
+ import WtSelect from '../../../../../../../components/wt-select/wt-select.vue';
38
+ import {
39
+ caseCloseReasonsGroupsSearchMethod,
40
+ caseCloseReasonsSearchMethod,
41
+ } from './config.js';
42
+
43
+ type ModelValue = {
44
+ selection: string;
45
+ conditions: string;
46
+ };
47
+ const model = defineModel<ModelValue>();
48
+ const { t } = useI18n();
49
+
50
+ const updateSelected = (value) => {
51
+ model.value.selection = value;
52
+ model.value.conditions = '';
53
+ };
54
+
55
+ const getConditionList = (params) => {
56
+ return caseCloseReasonsSearchMethod({
57
+ parentId: model.value.selection,
58
+ ...params,
59
+ });
60
+ };
61
+
62
+ const initModel = () => {
63
+ if (!model.value) {
64
+ model.value = {
65
+ selection: '',
66
+ conditions: '',
67
+ };
68
+ }
69
+ };
70
+ onMounted(() => initModel());
71
+
72
+ const v$ = useVuelidate(
73
+ computed(() => ({
74
+ model: {
75
+ selection: {
76
+ required,
77
+ },
78
+ conditions: {
79
+ required,
80
+ },
81
+ },
82
+ })),
83
+ { model },
84
+ { $autoDirty: true },
85
+ );
86
+
87
+ v$.value.$touch();
88
+
89
+ const emit = defineEmits<{
90
+ 'update:invalid': [boolean];
91
+ }>();
92
+
93
+ watch(
94
+ () => v$.value.$invalid,
95
+ (invalid) => {
96
+ emit('update:invalid', invalid);
97
+ },
98
+ { immediate: true },
99
+ );
100
+ </script>
101
+
102
+ <style lang="scss" scoped></style>
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <ul v-if="localValue">
3
+ <li
4
+ v-for="({ name }, index) of localValue"
5
+ :key="index"
6
+ >
7
+ {{ name }}
8
+ </li>
9
+ </ul>
10
+ </template>
11
+
12
+ <script lang="ts" setup>
13
+ import { ref } from 'vue';
14
+
15
+ import { caseCloseReasonsSearchMethod } from './config';
16
+
17
+ const props = defineProps<{
18
+ value: number[];
19
+ }>();
20
+
21
+ const localValue = ref([]);
22
+
23
+ const getLocalValue = async () => {
24
+ const { items } = await caseCloseReasonsSearchMethod({
25
+ parentId: props.value?.selection,
26
+ id: props.value?.conditions,
27
+ });
28
+ localValue.value = items;
29
+ };
30
+
31
+ getLocalValue();
32
+ </script>
33
+
34
+ <style lang="scss" scoped></style>
@@ -0,0 +1,7 @@
1
+ import CaseCloseReasonGroupsAPI from '../../../../../../../api/clients/caseCloseReasonGroups/caseCloseReasonGroups.js';
2
+ import CaseCloseReasonsAPI from '../../../../../../../api/clients/caseCloseReasons/caseCloseReasons.js';
3
+
4
+ export const caseCloseReasonsGroupsSearchMethod =
5
+ CaseCloseReasonGroupsAPI.getLookup;
6
+ export const caseCloseReasonsSearchMethod = CaseCloseReasonsAPI.getLookup;
7
+ export const localePath = '';
@@ -0,0 +1,4 @@
1
+ import ContactsAPI from '../../../../../../../api/clients/сontacts/contacts.js';
2
+
3
+ export const searchMethod = ContactsAPI.getLookup;
4
+ export const localePath = '';