@dative-gpi/foundation-core-components 1.0.26 → 1.0.28-remove-deprecated2

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 (82) hide show
  1. package/components/autocompletes/FSAutocompleteChart.vue +60 -58
  2. package/components/autocompletes/FSAutocompleteDashboard.vue +59 -56
  3. package/components/autocompletes/FSAutocompleteDashboardOrganisation.vue +30 -39
  4. package/components/autocompletes/FSAutocompleteDataCategory.vue +52 -38
  5. package/components/autocompletes/FSAutocompleteDataDefinition.vue +25 -39
  6. package/components/autocompletes/FSAutocompleteGroup.vue +23 -38
  7. package/components/autocompletes/FSAutocompleteLocation.vue +23 -38
  8. package/components/autocompletes/FSAutocompleteManufacturer.vue +65 -2
  9. package/components/autocompletes/FSAutocompleteModel.vue +66 -3
  10. package/components/autocompletes/FSAutocompleteOrganisationType.vue +23 -0
  11. package/components/autocompletes/FSAutocompleteRole.vue +59 -56
  12. package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +105 -0
  13. package/components/autocompletes/FSAutocompleteUserOrganisation.vue +32 -57
  14. package/components/customProperties/FSMetaField.vue +31 -35
  15. package/components/customProperties/FSMetaHistory.vue +4 -4
  16. package/components/customProperties/FSMetaValue.vue +66 -33
  17. package/components/customProperties/helpers.ts +2 -1
  18. package/components/entities/FSBaseEntitiesList.vue +50 -0
  19. package/components/entities/FSDialogSelectEntities.vue +83 -0
  20. package/components/entities/FSEntityField.vue +203 -0
  21. package/components/entities/FSSelectEntitiesList.vue +209 -0
  22. package/components/entities/FSSimpleEntitiesList.vue +100 -0
  23. package/components/explorers/FSBaseDevicesExplorer.vue +310 -0
  24. package/components/explorers/FSBaseFoldersExplorer.vue +265 -0
  25. package/components/lists/FSDataTable.vue +23 -21
  26. package/components/lists/alerts/FSBaseAlertsList.vue +337 -0
  27. package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +101 -0
  28. package/components/lists/authTokens/FSBaseAuthTokensList.vue +79 -0
  29. package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +204 -0
  30. package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +205 -0
  31. package/components/lists/charts/FSBaseChartsList.vue +268 -0
  32. package/components/lists/comments/FSBaseCommentsList.vue +143 -0
  33. package/components/lists/connectivityScenarios/FSBaseConnectivityScenariosList.vue +128 -0
  34. package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +168 -0
  35. package/components/lists/dashboards/FSBaseDashboardsList.vue +227 -0
  36. package/components/lists/dashboards/FSSimpleDashboardsList.vue +63 -0
  37. package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +154 -0
  38. package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +129 -0
  39. package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +327 -0
  40. package/components/lists/deviceOrganisations/FSSimpleDeviceOrganisationsList.vue +44 -0
  41. package/components/lists/folders/FSBaseFoldersList.vue +127 -0
  42. package/components/lists/folders/FSSimpleFoldersList.vue +44 -0
  43. package/components/lists/groups/FSBaseGroupsList.vue +136 -0
  44. package/components/lists/groups/FSSimpleGroupsList.vue +44 -0
  45. package/components/lists/locations/FSBaseLocationsList.vue +118 -0
  46. package/components/lists/locations/FSSimpleLocationsList.vue +44 -0
  47. package/components/lists/models/FSBaseModelsList.vue +155 -0
  48. package/components/lists/models/FSSimpleModelsList.vue +44 -0
  49. package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +128 -0
  50. package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +128 -0
  51. package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +157 -0
  52. package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +145 -0
  53. package/components/lists/scenarios/FSBaseScenariosList.vue +241 -0
  54. package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +156 -0
  55. package/components/lists/serviceAccountRoleOrganisations/FSBaseServiceAccountRoleOrganisationsList.vue +128 -0
  56. package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +172 -0
  57. package/components/lists/userOrganisations/FSSimpleUserOrganisationsList.vue +45 -0
  58. package/components/tiles/FSDeviceOrganisationTile.vue +9 -2
  59. package/components/tiles/FSLocationTile.vue +66 -0
  60. package/components/treeviews/FSTreeViewFolder.vue +15 -3
  61. package/components/treeviews/FSTreeViewGroup.vue +22 -4
  62. package/package.json +9 -9
  63. package/utils/dashboards.ts +33 -5
  64. package/utils/index.ts +2 -2
  65. package/utils/permissions.ts +80 -0
  66. package/utils/roles.ts +4 -4
  67. package/utils/tables.ts +41 -0
  68. package/utils/users.ts +7 -4
  69. package/components/selects/FSAggregationSelector.vue +0 -51
  70. package/components/selects/FSAxisTypeSelector.vue +0 -48
  71. package/components/selects/FSDataCategorySelector.vue +0 -62
  72. package/components/selects/FSDataDefinitionSelector.vue +0 -66
  73. package/components/selects/FSDisplayAsSelector.vue +0 -52
  74. package/components/selects/FSFilterTypeSelector.vue +0 -53
  75. package/components/selects/FSHeatmapRuleSelector.vue +0 -52
  76. package/components/selects/FSModelSelector.vue +0 -56
  77. package/components/selects/FSOperationOnSelector.vue +0 -51
  78. package/components/selects/FSPlanningTypeSelector.vue +0 -51
  79. package/components/selects/FSPlotPerSelector.vue +0 -51
  80. package/components/selects/FSSelectSelectedEntities.vue +0 -59
  81. package/components/selects/FSSerieTypeSelector.vue +0 -51
  82. package/utils/charts.ts +0 -136
@@ -0,0 +1,268 @@
1
+ <template>
2
+ <FSDataTable
3
+ defaultMode="iterator"
4
+ :loading="fetchingChartOrganisationTypes || fetchingChartOrganisations"
5
+ :headersOptions="headersOptions"
6
+ :items="charts"
7
+ :tableCode="$props.tableCode"
8
+ :modelValue="$props.modelValue"
9
+ @update:modelValue="onSelect"
10
+ v-bind="$attrs"
11
+ >
12
+ <template
13
+ v-for="(_, name) in $slots"
14
+ v-slot:[name]="slotData"
15
+ >
16
+ <slot
17
+ :name="name"
18
+ v-bind="slotData"
19
+ />
20
+ </template>
21
+ <template
22
+ #header.imageId-title
23
+ >
24
+ <FSIcon>
25
+ mdi-panorama-variant-outline
26
+ </FSIcon>
27
+ </template>
28
+ <template
29
+ #item.icon="{ item }"
30
+ >
31
+ <FSIcon>
32
+ {{ item.icon }}
33
+ </FSIcon>
34
+ </template>
35
+ <template
36
+ #item.imageId="{ item }"
37
+ >
38
+ <FSImage
39
+ v-if="item.imageId"
40
+ height="32px"
41
+ width="32px"
42
+ :imageId="item.imageId"
43
+ :thumbnail="true"
44
+ />
45
+ </template>
46
+ <template
47
+ #item.tags="{ item }"
48
+ >
49
+ <FSTagGroup
50
+ variant="slide"
51
+ :editable="false"
52
+ :tags="item.tags"
53
+ />
54
+ </template>
55
+ <template
56
+ #item.chartType="{ item }"
57
+ >
58
+ <FSRow
59
+ :wrap="false"
60
+ >
61
+ <FSIcon
62
+ :icon="chartIcon(item.chartType)"
63
+ />
64
+ <FSText>
65
+ {{ chartTypeLabel(item.chartType) }}
66
+ </FSText>
67
+ </FSRow>
68
+ </template>
69
+ <template
70
+ #item.modelsLabels="{ item }"
71
+ >
72
+ <FSTagGroup
73
+ :editable="false"
74
+ :tags="item.modelsLabels.map((d: any) => d.label)"
75
+ />
76
+ </template>
77
+ <template
78
+ #item.tile="{ item }"
79
+ >
80
+ <FSChartTileUI
81
+ variant="standard"
82
+ :label="item.label"
83
+ :categoryLabel="item.chartCategoryLabel"
84
+ :icon="item.icon"
85
+ :imageId="item.imageId"
86
+ :type="item.chartType"
87
+ :color="isSelected(item.id) ? ColorEnum.Primary : ColorEnum.Light"
88
+ @click="update(item.id)"
89
+ />
90
+ </template>
91
+ </FSDataTable>
92
+ </template>
93
+
94
+ <script lang="ts">
95
+ import { defineComponent, type PropType, watch, computed } from "vue";
96
+ import _ from "lodash";
97
+
98
+ import { ChartType } from "@dative-gpi/foundation-shared-domain/enums";
99
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
100
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
101
+ import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
102
+
103
+ import type { ChartModelLabel, ChartOrganisationFilters, ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
104
+ import { useChartOrganisations, useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
105
+
106
+ import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
107
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
108
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
109
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
110
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
111
+
112
+ import FSDataTable from "../FSDataTable.vue";
113
+
114
+ export default defineComponent({
115
+ name: "FSBaseChartsList",
116
+ components: {
117
+ FSChartTileUI,
118
+ FSDataTable,
119
+ FSTagGroup,
120
+ FSImage,
121
+ FSIcon,
122
+ FSRow
123
+ },
124
+ props: {
125
+ tableCode: {
126
+ type: String as PropType<string | null>,
127
+ required: false,
128
+ default: null
129
+ },
130
+ chartOrganisationFilters: {
131
+ type: Object as PropType<ChartOrganisationFilters>,
132
+ required: false,
133
+ default: null
134
+ },
135
+ chartOrganisationTypeFilters: {
136
+ type: Object as PropType<ChartOrganisationTypeFilters>,
137
+ required: false,
138
+ default: null
139
+ },
140
+ modelValue: {
141
+ type: Array as PropType<string[]>,
142
+ default: () => [],
143
+ required: false
144
+ }
145
+ },
146
+ emits: ["update", "update:modelValue", "update:scope"],
147
+ setup(props, { emit }) {
148
+ const { entities: chartOrganisations, fetching: fetchingChartOrganisations, getMany: getManyChartOrganisations } = useChartOrganisations();
149
+ const { entities: chartOrganisationTypes, fetching: fetchingChartOrganisationTypes, getMany: getManyChartOrganisationTypes } = useChartOrganisationTypes();
150
+
151
+ const isSelected = (value : string): boolean => {
152
+ return props.modelValue.includes(value);
153
+ };
154
+
155
+ const fetch = () =>{
156
+ getManyChartOrganisations(props.chartOrganisationFilters);
157
+ getManyChartOrganisationTypes(props.chartOrganisationTypeFilters)
158
+ }
159
+
160
+ const charts = computed(() => {
161
+ return chartOrganisations.value.map(c => ({
162
+ id: c.id,
163
+ imageId: c.imageId,
164
+ chartId: c.chartId,
165
+ chartCategoryId: c.chartCategoryId,
166
+ chartCategoryLabel: c.chartCategoryLabel,
167
+ scope: c.scope,
168
+ label: c.label,
169
+ title: c.title,
170
+ code: c.code,
171
+ icon: c.icon,
172
+ tags: c.tags,
173
+ multiple: c.multiple,
174
+ chartType: c.chartType,
175
+ modelsLabels: c.modelsLabels
176
+ })).concat(chartOrganisationTypes.value.map(c => ({
177
+ id: c.id,
178
+ imageId: c.imageId,
179
+ chartId: c.chartId,
180
+ chartCategoryId: c.chartCategoryId,
181
+ chartCategoryLabel: c.chartCategoryLabel,
182
+ scope: c.scope,
183
+ label: c.label,
184
+ title: c.title,
185
+ code: c.code,
186
+ icon: c.icon,
187
+ tags: c.tags,
188
+ multiple: c.multiple,
189
+ chartType: c.chartType,
190
+ modelsLabels: c.modelsLabels
191
+ })));
192
+ });
193
+
194
+ const headersOptions = computed(() => ({
195
+ modelsLabels: {
196
+ fixedFilters: chartOrganisationTypes.value.map(c => c.modelsLabels).reduce((acc, models) => {
197
+ for(const m of models){
198
+ if(!acc.map((m) => m.id).includes(m.id)){
199
+ acc.push(m);
200
+ }
201
+ }
202
+ return acc;
203
+ }, []).map((m) => ({
204
+ value: m.id,
205
+ text: m.label
206
+ })).concat({
207
+ value: '',
208
+ text: '--'
209
+ }),
210
+ methodFilter: (value: string, items: ChartModelLabel[]) => (items.length == 0 && value == '') || (items.length > 0 && items.some(ml => ml.id == value))
211
+ },
212
+ chartType: {
213
+ fixedFilters: getEnumEntries(ChartType).map(e => ({
214
+ value: e.value,
215
+ text: chartTypeLabel(e.value)
216
+ })),
217
+ methodFilter: (value: ChartType, item: ChartType) => value == item
218
+ }
219
+ }));
220
+
221
+ const update = (value : string) => {
222
+ const item = isSelected(value);
223
+ if (item) {
224
+ onSelect(props.modelValue.filter(m => m != value));
225
+ }
226
+ else {
227
+ onSelect([...props.modelValue, value]);
228
+ }
229
+ }
230
+
231
+ const onSelect = (values: string[] | null) => {
232
+ if(!values){
233
+ emit("update:modelValue", []);
234
+ emit("update:scope", []);
235
+ emit("update", { modelValue: [], scope: [] });
236
+ return;
237
+ }
238
+ const selectedItems = charts.value.filter(i => values.includes(i.id));
239
+ const newModelValue = selectedItems.map(i => i.id);
240
+ const newScope = selectedItems.map(i => i.scope);
241
+ emit("update:modelValue", newModelValue);
242
+ emit("update:scope", newScope);
243
+ emit("update", { modelValue: newModelValue, scope: newScope });
244
+ };
245
+
246
+ watch(() => [props.chartOrganisationFilters,props.chartOrganisationTypeFilters], (next, previous) => {
247
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
248
+ fetch();
249
+ }
250
+ }, { immediate: true });
251
+
252
+ return {
253
+ fetchingChartOrganisationTypes,
254
+ fetchingChartOrganisations,
255
+ chartOrganisationTypes,
256
+ chartOrganisations,
257
+ headersOptions,
258
+ ColorEnum,
259
+ charts,
260
+ chartTypeLabel,
261
+ isSelected,
262
+ chartIcon,
263
+ onSelect,
264
+ update
265
+ };
266
+ }
267
+ });
268
+ </script>
@@ -0,0 +1,143 @@
1
+ <template>
2
+ <FSCol
3
+ v-if="$props.allowAlertComment"
4
+ padding="24px"
5
+ gap="48px"
6
+ align="center-center"
7
+ >
8
+ <FSText
9
+ font="text-h3"
10
+ >
11
+ {{ $tr('ui.common.comments', 'Comments') }}
12
+ </FSText>
13
+
14
+ <FSRow
15
+ width="500px"
16
+ >
17
+ <FSCommentField
18
+ :buttonLabel="$tr('ui.common.publish','Publish')"
19
+ :creating="creatingComment"
20
+ @submit="createNewComment"
21
+ :userImageId="currentUser?.imageId"
22
+ />
23
+ </FSRow>
24
+ <FSCol
25
+ gap="12px"
26
+ >
27
+ <FSCommentTileUI
28
+ v-for="comment in orderedComments"
29
+ :key="comment.id"
30
+ :timestamp="epochToLongTimeFormat(comment.timestamp)"
31
+ :userName="comment.userName"
32
+ :userImageId="comment.userImageId"
33
+ :canEditRemove="currentUser?.id === comment.userId"
34
+ :comment="comment.comment"
35
+ :edited="comment.edited"
36
+ :removing="removing"
37
+ :id="comment.id"
38
+ @edit="updateComment"
39
+ @remove="removeComment(comment.id)"
40
+ />
41
+ </FSCol>
42
+ </FSCol>
43
+ </template>
44
+
45
+ <script lang="ts">
46
+ import type { PropType} from "vue";
47
+ import { computed, defineComponent, onMounted, ref, watch } from "vue";
48
+ import _ from "lodash";
49
+
50
+ import { useDateFormat, useCurrentUser } from "@dative-gpi/foundation-shared-services/composables";
51
+ import { useCreateComment,useComments,useUpdateComment, useRemoveComment } from "@dative-gpi/foundation-core-services/composables";
52
+ import type { CommentFilters } from "@dative-gpi/foundation-core-domain/models";
53
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
54
+
55
+ import FSCommentField from "@dative-gpi/foundation-shared-components/components/fields/FSCommentField.vue";
56
+ import FSCommentTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSCommentTileUI.vue";
57
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
58
+ import FSCol from "@dative-gpi/foundation-shared-components/components/FSCol.vue";
59
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
60
+
61
+ export default defineComponent({
62
+ title: "FSBaseCommentsList",
63
+ components: {
64
+ FSText,
65
+ FSCol,
66
+ FSRow,
67
+ FSCommentTileUI,
68
+ FSCommentField
69
+ },
70
+ props: {
71
+ commentFilters: {
72
+ type: Object as PropType<CommentFilters>,
73
+ required: true
74
+ },
75
+ allowAlertComment: {
76
+ type: Boolean,
77
+ default: false
78
+ }
79
+ },
80
+ setup(props) {
81
+ const { fetch : fetchCurrentUser, entity: currentUser } = useCurrentUser();
82
+ const { create: createComment, creating : creatingComment } = useCreateComment();
83
+ const { getMany: fetchComments, entities: comments } = useComments();
84
+ const { update } = useUpdateComment();
85
+ const { remove, removing } = useRemoveComment();
86
+ const { epochToLongTimeFormat } = useDateFormat();
87
+
88
+ const error = ref<string | null>(null);
89
+
90
+ const orderedComments = computed(() => {
91
+ return _.orderBy(comments.value, ['timestamp'], ['desc']);
92
+ });
93
+
94
+ onMounted(() => {
95
+ fetchCurrentUser();
96
+ });
97
+
98
+ const createNewComment = (comment: string) => {
99
+ if(props.commentFilters.alertId && comment){
100
+ createComment({
101
+ comment,
102
+ alertId: props.commentFilters.alertId,
103
+ });
104
+ }
105
+ };
106
+
107
+ const updateComment = (payload : any) => {
108
+ update(payload.commentId, {comment : payload.comment})
109
+ }
110
+
111
+ const removeComment = async (commentId : string) => {
112
+ try {
113
+ error.value = null;
114
+ await remove(commentId);
115
+ }
116
+ catch (exception: any) {
117
+ error.value = exception.response.data;
118
+ }
119
+ }
120
+
121
+ watch(() => props.commentFilters, (next, previous) => {
122
+ if (!_.isEqual(next, previous)) {
123
+ fetchComments(props.commentFilters);
124
+ }
125
+ }, { immediate: true });
126
+
127
+ return {
128
+ creatingComment,
129
+ orderedComments,
130
+ currentUser,
131
+ ColorEnum,
132
+ comments,
133
+ removing,
134
+ error,
135
+ epochToLongTimeFormat,
136
+ createNewComment,
137
+ updateComment,
138
+ removeComment,
139
+
140
+ };
141
+ }
142
+ });
143
+ </script>
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <FSDataTable
3
+ :loading="fetchingConnectivityScenarios"
4
+ :modelValue="$props.modelValue"
5
+ :items="connectivityScenarios"
6
+ :tableCode="$props.tableCode"
7
+ @update:modelValue="$emit('update:modelValue', $event)"
8
+ v-bind="$attrs"
9
+ >
10
+ <template
11
+ v-for="(_, name) in $slots"
12
+ v-slot:[name]="slotData"
13
+ >
14
+ <slot
15
+ :name="name"
16
+ v-bind="slotData"
17
+ />
18
+ </template>
19
+
20
+ <template
21
+ #item.time="{ item }"
22
+ >
23
+ {{ getTimeBestString(item.time) }}
24
+ </template>
25
+
26
+ <template
27
+ #item.deviceOrganisationImageId="{ item }"
28
+ >
29
+ <FSImage
30
+ v-if="item.deviceOrganisationImageId"
31
+ height="32px"
32
+ width="32px"
33
+ :imageId="item.deviceOrganisationImageId"
34
+ :thumbnail="true"
35
+ />
36
+ </template>
37
+ <template
38
+ #item.deviceOrganisationConnectivity="{ item }"
39
+ >
40
+ <FSIcon
41
+ v-if="item.deviceOrganisationConnectivity"
42
+ :icon="item.deviceOrganisationConnectivity.icon"
43
+ :color="item.deviceOrganisationConnectivity.color"
44
+ />
45
+ </template>
46
+ <template
47
+ #item.warnDeviceManager="{ item }"
48
+ >
49
+ <FSIconCheck
50
+ :value="item.warnDeviceManager"
51
+ />
52
+ </template>
53
+ <template
54
+ #item.warnOnReconnection="{ item }"
55
+ >
56
+ <FSIconCheck
57
+ :value="item.warnOnReconnection"
58
+ />
59
+ </template>
60
+ </FSDataTable>
61
+ </template>
62
+
63
+ <script lang="ts">
64
+ import { defineComponent, type PropType, watch } from "vue";
65
+ import _ from "lodash";
66
+
67
+ import { ConnectivityStatus } from "@dative-gpi/foundation-shared-domain/enums";
68
+ import {ColorEnum } from "@dative-gpi/foundation-shared-components/models";
69
+ import { getTimeBestString } from "@dative-gpi/foundation-shared-components/utils"
70
+
71
+ import type { ConnectivityScenarioFilters } from "@dative-gpi/foundation-core-domain/models";
72
+ import { useConnectivityScenarios } from "@dative-gpi/foundation-core-services/composables";
73
+
74
+ import FSDataTable from "../FSDataTable.vue";
75
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
76
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
77
+ import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
78
+
79
+ export default defineComponent({
80
+ name: "FSBaseConnectivityScenariosList",
81
+ components: {
82
+ FSDataTable,
83
+ FSIconCheck,
84
+ FSImage,
85
+ FSIcon
86
+ },
87
+ props: {
88
+ tableCode: {
89
+ type: String as PropType<string | null>,
90
+ required: false,
91
+ default: null
92
+ },
93
+ modelValue: {
94
+ type: Array as PropType<string[]>,
95
+ default: () => [],
96
+ required: false
97
+ },
98
+ connectivityScenarioFilters: {
99
+ type: Object as PropType<ConnectivityScenarioFilters>,
100
+ required: false,
101
+ default: null
102
+ }
103
+ },
104
+ emits: ["update:modelValue"],
105
+ setup(props) {
106
+ const { entities: connectivityScenarios, fetching: fetchingConnectivityScenarios, getMany: getManyConnectivityScenarios } = useConnectivityScenarios();
107
+
108
+ const fetch = () =>{
109
+ getManyConnectivityScenarios(props.connectivityScenarioFilters);
110
+ }
111
+
112
+ watch(() => [props.connectivityScenarioFilters], (next, previous) => {
113
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
114
+ fetch();
115
+ }
116
+ }, { immediate: true });
117
+
118
+
119
+ return {
120
+ fetchingConnectivityScenarios,
121
+ connectivityScenarios,
122
+ ConnectivityStatus,
123
+ ColorEnum,
124
+ getTimeBestString
125
+ };
126
+ }
127
+ });
128
+ </script>
@@ -0,0 +1,168 @@
1
+ <template>
2
+ <FSDataTable
3
+ defaultMode="iterator"
4
+ :loading="fetchingDashboardOrganisationTypes"
5
+ :items="dashboardOrganisationTypes"
6
+ :itemTo="$props.itemTo"
7
+ :tableCode="$props.tableCode"
8
+ :modelValue="$props.modelValue"
9
+ @update:modelValue="$emit('update:modelValue', $event)"
10
+ v-bind="$attrs"
11
+ >
12
+ <template
13
+ v-for="(_, name) in $slots"
14
+ v-slot:[name]="slotData"
15
+ >
16
+ <slot
17
+ :name="name"
18
+ v-bind="slotData"
19
+ />
20
+ </template>
21
+ <template
22
+ #item.main="{ item }"
23
+ >
24
+ <FSRow>
25
+ <FSIcon
26
+ v-if="item.id === organisationMainDashboardId"
27
+ >
28
+ mdi-account-group-outline
29
+ </FSIcon>
30
+ <FSIcon
31
+ v-if="item.id === userOrganisationMainDashboardId"
32
+ >
33
+ mdi-home
34
+ </FSIcon>
35
+ </FSRow>
36
+ </template>
37
+ <template
38
+ #item.icon="{ item }"
39
+ >
40
+ <FSIcon>
41
+ {{ item.icon }}
42
+ </FSIcon>
43
+ </template>
44
+ <template
45
+ #item.organisationTypeLabel="{ item }"
46
+ >
47
+ <FSText
48
+ v-if="item.organisationTypeId"
49
+ :label="item.organisationTypeLabel"
50
+ />
51
+ <FSChip
52
+ v-else
53
+ variant="standard"
54
+ :label="$tr('ui.common.all', 'All')"
55
+ />
56
+ </template>
57
+ <template
58
+ #item.tile="{ item, toggleSelect }"
59
+ >
60
+ <FSDashboardOrganisationTypeTileUI
61
+ :bottomColor="item.colors"
62
+ :to="$props.itemTo && $props.itemTo(item)"
63
+ :modelValue="isSelected(item.id)"
64
+ @update:modelValue="toggleSelect(item)"
65
+ v-bind="item"
66
+ />
67
+ </template>
68
+ </FSDataTable>
69
+ </template>
70
+
71
+ <script lang="ts">
72
+ import type { PropType} from "vue";
73
+ import type { RouteLocation } from "vue-router";
74
+ import { computed, defineComponent, onMounted, watch } from "vue";
75
+ import _ from "lodash";
76
+
77
+ import { useAppOrganisationId, useCurrentUserOrganisation, useDashboardOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
78
+ import type { DashboardOrganisationTypeFilters, DashboardOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
79
+ import { useOrganisation } from "@dative-gpi/foundation-shared-services/composables";
80
+
81
+ import FSDataTable from "../FSDataTable.vue";
82
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
83
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
84
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
85
+ import FSChip from "@dative-gpi/foundation-shared-components/components/FSChip.vue";
86
+ import FSDashboardOrganisationTypeTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTypeTileUI.vue";
87
+
88
+ export default defineComponent({
89
+ name: "FSBaseDashboardOrganisationTypesList",
90
+ components: {
91
+ FSDataTable,
92
+ FSIcon,
93
+ FSRow,
94
+ FSText,
95
+ FSChip,
96
+ FSDashboardOrganisationTypeTileUI
97
+ },
98
+ props: {
99
+ tableCode: {
100
+ type: String as PropType<string | null>,
101
+ required: false,
102
+ default: null
103
+ },
104
+ dashboardOrganisationTypeFilters: {
105
+ type: Object as PropType<DashboardOrganisationTypeFilters>,
106
+ default: undefined,
107
+ required: false
108
+ },
109
+ itemTo: {
110
+ type: Function as PropType<(item: DashboardOrganisationTypeInfos) => Partial<RouteLocation>>,
111
+ required: false
112
+ },
113
+ modelValue: {
114
+ type: Array as PropType<string[]>,
115
+ required: false,
116
+ default: () => []
117
+ }
118
+ },
119
+ setup(props) {
120
+ const { getMany: getDashboardOrganisationTypes, fetching: fetchingDashboardOrganisationTypes, entities: dashboardOrganisationTypes } = useDashboardOrganisationTypes();
121
+ const { fetch: fetchUserOrganisation, entity: userOrganisation } = useCurrentUserOrganisation();
122
+ const { get: fetchOrganisation, entity: organisation } = useOrganisation();
123
+ const { organisationId } = useAppOrganisationId();
124
+
125
+ const userOrganisationMainDashboardId = computed((): string | null => {
126
+ if (userOrganisation.value) {
127
+ return userOrganisation.value.mainDashboardId;
128
+ }
129
+ return null;
130
+ });
131
+
132
+ const organisationMainDashboardId = computed((): string | null => {
133
+ if (organisation.value) {
134
+ return organisation.value.mainDashboardId;
135
+ }
136
+ return null;
137
+ });
138
+
139
+ const isSelected = (id: string): boolean => {
140
+ return props.modelValue.includes(id);
141
+ };
142
+
143
+ onMounted(() => {
144
+ fetchUserOrganisation();
145
+ });
146
+
147
+ watch(organisationId, () => {
148
+ if (organisationId.value) {
149
+ fetchOrganisation(organisationId.value);
150
+ }
151
+ }, { immediate: true });
152
+
153
+ watch(() => props.dashboardOrganisationTypeFilters, (next, previous) => {
154
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
155
+ getDashboardOrganisationTypes(props.dashboardOrganisationTypeFilters);
156
+ }
157
+ }, { immediate: true });
158
+
159
+ return {
160
+ fetchingDashboardOrganisationTypes,
161
+ userOrganisationMainDashboardId,
162
+ organisationMainDashboardId,
163
+ dashboardOrganisationTypes,
164
+ isSelected,
165
+ };
166
+ }
167
+ });
168
+ </script>