@saooti/octopus-sdk 1.0.0 → 29.0.2

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 (230) hide show
  1. package/README.md +73 -0
  2. package/index.d.ts +4 -0
  3. package/index.ts +12 -0
  4. package/package.json +61 -39
  5. package/public/css/fonts/saooti-ui.eot +0 -0
  6. package/public/css/fonts/saooti-ui.svg +30 -19
  7. package/public/css/fonts/saooti-ui.ttf +0 -0
  8. package/public/css/fonts/saooti-ui.woff +0 -0
  9. package/public/css/fonts/style.css +48 -5
  10. package/public/img/ACPM.png +0 -0
  11. package/public/img/article.png +0 -0
  12. package/src/App.vue +97 -31
  13. package/src/api/comments.ts +3 -1
  14. package/src/api/emissions.ts +5 -2
  15. package/src/api/initialize.ts +3 -2
  16. package/src/api/podcasts.ts +5 -2
  17. package/src/api/profile.ts +4 -2
  18. package/src/api/studio.ts +12 -1
  19. package/src/assets/bootstrap-diff.scss +265 -0
  20. package/src/assets/form.scss +23 -0
  21. package/src/assets/general.scss +47 -20
  22. package/src/assets/modal.scss +9 -10
  23. package/src/assets/multiselect.scss +19 -2
  24. package/src/assets/octopus-library.scss +16 -4
  25. package/src/assets/share.scss +343 -0
  26. package/src/components/display/aggregator/RssSection.vue +4 -4
  27. package/src/components/display/categories/CategoryChooser.vue +152 -105
  28. package/src/components/display/categories/CategoryFilter.vue +108 -0
  29. package/src/components/display/categories/CategoryList.vue +138 -109
  30. package/src/components/display/comments/AddCommentModal.vue +104 -87
  31. package/src/components/display/comments/CommentInput.vue +137 -118
  32. package/src/components/display/comments/CommentItem.vue +155 -137
  33. package/src/components/display/comments/CommentList.vue +142 -120
  34. package/src/components/display/comments/CommentParentInfo.vue +39 -35
  35. package/src/components/display/comments/CommentPlayer.vue +54 -48
  36. package/src/components/display/comments/CommentSection.vue +57 -58
  37. package/src/components/display/edit/EditBox.vue +4 -4
  38. package/src/components/display/edit/EditCommentBox.vue +25 -31
  39. package/src/components/display/emission/EmissionChooser.vue +82 -80
  40. package/src/components/display/emission/EmissionInlineList.vue +118 -105
  41. package/src/components/display/emission/EmissionItem.vue +66 -167
  42. package/src/components/display/emission/EmissionList.vue +96 -122
  43. package/src/components/display/emission/EmissionPlayerItem.vue +131 -126
  44. package/src/components/display/filter/AdvancedSearch.vue +306 -372
  45. package/src/components/display/filter/CategoryFilter.vue +117 -0
  46. package/src/components/display/filter/MonetizableFilter.vue +24 -10
  47. package/src/components/display/filter/ProductorSearch.vue +131 -135
  48. package/src/components/display/filter/RubriqueChoice.vue +104 -0
  49. package/src/components/display/filter/RubriqueFilter.vue +235 -0
  50. package/src/components/display/live/CountDown.vue +30 -29
  51. package/src/components/display/live/LiveHorizontalList.vue +40 -34
  52. package/src/components/display/live/LiveItem.vue +146 -158
  53. package/src/components/display/live/LiveList.vue +167 -154
  54. package/src/components/display/organisation/OrganisationChooser.vue +125 -124
  55. package/src/components/display/organisation/OrganisationChooserLight.vue +40 -47
  56. package/src/components/display/participant/ParticipantItem.vue +92 -108
  57. package/src/components/display/participant/ParticipantList.vue +76 -69
  58. package/src/components/display/playlist/PlaylistItem.vue +45 -56
  59. package/src/components/display/playlist/PlaylistList.vue +57 -48
  60. package/src/components/display/playlist/PodcastList.vue +94 -70
  61. package/src/components/display/podcasts/AnimatorsItem.vue +26 -23
  62. package/src/components/display/podcasts/ParticipantDescription.vue +115 -0
  63. package/src/components/display/podcasts/PodcastFilterList.vue +84 -85
  64. package/src/components/display/podcasts/PodcastImage.vue +244 -208
  65. package/src/components/display/podcasts/PodcastInlineList.vue +145 -207
  66. package/src/components/display/podcasts/PodcastItem.vue +150 -132
  67. package/src/components/display/podcasts/PodcastList.vue +89 -110
  68. package/src/components/display/podcasts/TagList.vue +23 -16
  69. package/src/components/display/rubriques/RubriqueChooser.vue +137 -123
  70. package/src/components/display/rubriques/RubriqueList.vue +227 -0
  71. package/src/components/display/sharing/PlayerParameters.vue +154 -106
  72. package/src/components/display/sharing/QrCode.vue +58 -0
  73. package/src/components/display/sharing/ShareButtons.vue +214 -92
  74. package/src/components/display/sharing/ShareDistribution.vue +110 -121
  75. package/src/components/display/sharing/SharePlayer.vue +245 -190
  76. package/src/components/display/sharing/SubscribeButtons.vue +130 -66
  77. package/src/components/display/studio/RecordingItemButton.vue +4 -4
  78. package/src/components/misc/ErrorMessage.vue +21 -16
  79. package/src/components/misc/Footer.vue +131 -66
  80. package/src/components/misc/HomeDropdown.vue +166 -123
  81. package/src/components/misc/LeftMenu.vue +151 -134
  82. package/src/components/misc/Player.vue +332 -328
  83. package/src/components/misc/Snackbar.vue +27 -29
  84. package/src/components/misc/TopBar.vue +204 -174
  85. package/src/components/misc/modal/ClipboardModal.vue +46 -26
  86. package/src/components/misc/modal/MessageModal.vue +67 -51
  87. package/src/components/misc/modal/NewsletterModal.vue +179 -136
  88. package/src/components/misc/modal/QrCodeModal.vue +83 -0
  89. package/src/components/misc/modal/ShareModalPlayer.vue +133 -74
  90. package/src/components/mixins/functions.ts +21 -18
  91. package/src/components/mixins/init.ts +24 -0
  92. package/src/components/mixins/organisationFilter.ts +24 -0
  93. package/src/components/pages/Category.vue +26 -26
  94. package/src/components/pages/Emission.vue +120 -92
  95. package/src/components/pages/Emissions.vue +109 -86
  96. package/src/components/pages/Home.vue +70 -16
  97. package/src/components/pages/Lives.vue +57 -47
  98. package/src/components/pages/Participant.vue +93 -77
  99. package/src/components/pages/Participants.vue +44 -31
  100. package/src/components/pages/Playlist.vue +63 -52
  101. package/src/components/pages/Playlists.vue +41 -39
  102. package/src/components/pages/Podcast.vue +265 -251
  103. package/src/components/pages/Podcasts.vue +135 -104
  104. package/src/components/pages/Rubrique.vue +25 -19
  105. package/src/components/pages/Search.vue +71 -67
  106. package/src/helper/dom.ts +2 -2
  107. package/src/helper/duration.ts +18 -8
  108. package/src/locale/educationen.ts +14 -0
  109. package/src/locale/en.ts +299 -1
  110. package/src/locale/fr.ts +25 -10
  111. package/src/locale/messages.ts +3 -2
  112. package/src/main.ts +54 -32
  113. package/src/router/router.ts +184 -159
  114. package/src/shims-tsx.d.ts +13 -0
  115. package/src/shims-vue-recaptcha-v3.d.ts +9 -0
  116. package/src/shims-vue.d.ts +5 -6
  117. package/src/store/AppStore.ts +36 -171
  118. package/src/store/class/category.ts +8 -0
  119. package/src/store/class/comment.ts +17 -0
  120. package/src/store/class/conference.ts +27 -0
  121. package/src/store/class/customPlayer.ts +8 -0
  122. package/src/store/class/emission.ts +20 -0
  123. package/src/store/class/fetchParam.ts +16 -0
  124. package/src/store/class/media.ts +13 -0
  125. package/src/store/class/organisation.ts +19 -0
  126. package/src/store/class/participant.ts +12 -0
  127. package/src/store/class/person.ts +13 -0
  128. package/src/store/class/player.ts +12 -0
  129. package/src/store/class/playlist.ts +15 -0
  130. package/src/store/class/podcast.ts +37 -0
  131. package/src/store/class/rubriquage.ts +9 -0
  132. package/src/store/class/rubriquageFilter.ts +5 -0
  133. package/src/store/class/rubrique.ts +8 -0
  134. package/src/store/paramStore.ts +70 -29
  135. package/src/store/typeAppStore.ts +171 -237
  136. package/src/vuex-shim.d.ts +8 -0
  137. package/tsconfig.json +4 -0
  138. package/vue.config.js +14 -0
  139. package/public/img/ACPM.PNG +0 -0
  140. package/src/assets/bootstrap_scss/_alert.scss +0 -51
  141. package/src/assets/bootstrap_scss/_badge.scss +0 -54
  142. package/src/assets/bootstrap_scss/_breadcrumb.scss +0 -42
  143. package/src/assets/bootstrap_scss/_button-group.scss +0 -164
  144. package/src/assets/bootstrap_scss/_buttons.scss +0 -291
  145. package/src/assets/bootstrap_scss/_card.scss +0 -278
  146. package/src/assets/bootstrap_scss/_carousel.scss +0 -197
  147. package/src/assets/bootstrap_scss/_close.scss +0 -41
  148. package/src/assets/bootstrap_scss/_code.scss +0 -48
  149. package/src/assets/bootstrap_scss/_custom-forms.scss +0 -522
  150. package/src/assets/bootstrap_scss/_dropdown.scss +0 -201
  151. package/src/assets/bootstrap_scss/_forms.scss +0 -352
  152. package/src/assets/bootstrap_scss/_functions.scss +0 -134
  153. package/src/assets/bootstrap_scss/_grid.scss +0 -69
  154. package/src/assets/bootstrap_scss/_images.scss +0 -42
  155. package/src/assets/bootstrap_scss/_input-group.scss +0 -191
  156. package/src/assets/bootstrap_scss/_jumbotron.scss +0 -17
  157. package/src/assets/bootstrap_scss/_list-group.scss +0 -158
  158. package/src/assets/bootstrap_scss/_media.scss +0 -8
  159. package/src/assets/bootstrap_scss/_mixins.scss +0 -47
  160. package/src/assets/bootstrap_scss/_modal.scss +0 -243
  161. package/src/assets/bootstrap_scss/_nav.scss +0 -120
  162. package/src/assets/bootstrap_scss/_navbar.scss +0 -324
  163. package/src/assets/bootstrap_scss/_pagination.scss +0 -74
  164. package/src/assets/bootstrap_scss/_popover.scss +0 -170
  165. package/src/assets/bootstrap_scss/_print.scss +0 -141
  166. package/src/assets/bootstrap_scss/_progress.scss +0 -46
  167. package/src/assets/bootstrap_scss/_reboot.scss +0 -482
  168. package/src/assets/bootstrap_scss/_root.scss +0 -20
  169. package/src/assets/bootstrap_scss/_spinners.scss +0 -55
  170. package/src/assets/bootstrap_scss/_tables.scss +0 -185
  171. package/src/assets/bootstrap_scss/_toasts.scss +0 -44
  172. package/src/assets/bootstrap_scss/_tooltip.scss +0 -115
  173. package/src/assets/bootstrap_scss/_transitions.scss +0 -20
  174. package/src/assets/bootstrap_scss/_type.scss +0 -125
  175. package/src/assets/bootstrap_scss/_utilities.scss +0 -17
  176. package/src/assets/bootstrap_scss/_variables.scss +0 -1145
  177. package/src/assets/bootstrap_scss/bootstrap-grid.scss +0 -29
  178. package/src/assets/bootstrap_scss/bootstrap-reboot.scss +0 -12
  179. package/src/assets/bootstrap_scss/bootstrap.scss +0 -44
  180. package/src/assets/bootstrap_scss/mixins/_alert.scss +0 -13
  181. package/src/assets/bootstrap_scss/mixins/_background-variant.scss +0 -22
  182. package/src/assets/bootstrap_scss/mixins/_badge.scss +0 -17
  183. package/src/assets/bootstrap_scss/mixins/_border-radius.scss +0 -63
  184. package/src/assets/bootstrap_scss/mixins/_box-shadow.scss +0 -20
  185. package/src/assets/bootstrap_scss/mixins/_breakpoints.scss +0 -123
  186. package/src/assets/bootstrap_scss/mixins/_buttons.scss +0 -110
  187. package/src/assets/bootstrap_scss/mixins/_caret.scss +0 -62
  188. package/src/assets/bootstrap_scss/mixins/_clearfix.scss +0 -7
  189. package/src/assets/bootstrap_scss/mixins/_deprecate.scss +0 -10
  190. package/src/assets/bootstrap_scss/mixins/_float.scss +0 -14
  191. package/src/assets/bootstrap_scss/mixins/_forms.scss +0 -177
  192. package/src/assets/bootstrap_scss/mixins/_gradients.scss +0 -45
  193. package/src/assets/bootstrap_scss/mixins/_grid-framework.scss +0 -71
  194. package/src/assets/bootstrap_scss/mixins/_grid.scss +0 -69
  195. package/src/assets/bootstrap_scss/mixins/_hover.scss +0 -37
  196. package/src/assets/bootstrap_scss/mixins/_image.scss +0 -36
  197. package/src/assets/bootstrap_scss/mixins/_list-group.scss +0 -21
  198. package/src/assets/bootstrap_scss/mixins/_lists.scss +0 -7
  199. package/src/assets/bootstrap_scss/mixins/_nav-divider.scss +0 -11
  200. package/src/assets/bootstrap_scss/mixins/_pagination.scss +0 -22
  201. package/src/assets/bootstrap_scss/mixins/_reset-text.scss +0 -17
  202. package/src/assets/bootstrap_scss/mixins/_resize.scss +0 -6
  203. package/src/assets/bootstrap_scss/mixins/_screen-reader.scss +0 -34
  204. package/src/assets/bootstrap_scss/mixins/_size.scss +0 -7
  205. package/src/assets/bootstrap_scss/mixins/_table-row.scss +0 -39
  206. package/src/assets/bootstrap_scss/mixins/_text-emphasis.scss +0 -17
  207. package/src/assets/bootstrap_scss/mixins/_text-hide.scss +0 -11
  208. package/src/assets/bootstrap_scss/mixins/_text-truncate.scss +0 -8
  209. package/src/assets/bootstrap_scss/mixins/_transition.scss +0 -16
  210. package/src/assets/bootstrap_scss/mixins/_visibility.scss +0 -8
  211. package/src/assets/bootstrap_scss/utilities/_align.scss +0 -8
  212. package/src/assets/bootstrap_scss/utilities/_background.scss +0 -19
  213. package/src/assets/bootstrap_scss/utilities/_borders.scss +0 -75
  214. package/src/assets/bootstrap_scss/utilities/_clearfix.scss +0 -3
  215. package/src/assets/bootstrap_scss/utilities/_display.scss +0 -26
  216. package/src/assets/bootstrap_scss/utilities/_embed.scss +0 -39
  217. package/src/assets/bootstrap_scss/utilities/_flex.scss +0 -51
  218. package/src/assets/bootstrap_scss/utilities/_float.scss +0 -11
  219. package/src/assets/bootstrap_scss/utilities/_overflow.scss +0 -5
  220. package/src/assets/bootstrap_scss/utilities/_position.scss +0 -32
  221. package/src/assets/bootstrap_scss/utilities/_screenreaders.scss +0 -11
  222. package/src/assets/bootstrap_scss/utilities/_shadows.scss +0 -6
  223. package/src/assets/bootstrap_scss/utilities/_sizing.scss +0 -20
  224. package/src/assets/bootstrap_scss/utilities/_spacing.scss +0 -73
  225. package/src/assets/bootstrap_scss/utilities/_stretched-link.scss +0 -19
  226. package/src/assets/bootstrap_scss/utilities/_text.scss +0 -72
  227. package/src/assets/bootstrap_scss/utilities/_visibility.scss +0 -13
  228. package/src/assets/bootstrap_scss/vendor/_rfs.scss +0 -204
  229. package/src/shims-vuex.d.ts +0 -7
  230. package/src/views/Home.vue +0 -18
@@ -1,22 +1,22 @@
1
1
  <template>
2
2
  <div
3
+ v-if="!value || init"
3
4
  class="default-multiselect-width"
4
5
  :style="{ width: width }"
5
6
  :class="{ 'multiselect-hide-arrow': !displayArrow }"
6
- v-if="!value || init"
7
7
  >
8
8
  <label
9
9
  for="organisationChooser"
10
10
  class="d-inline"
11
11
  aria-label="select productor"
12
- ></label>
13
- <Multiselect
14
- v-model="organisation"
12
+ />
13
+ <VueMultiselect
15
14
  id="organisationChooser"
15
+ ref="multiselectRef"
16
+ v-model="organisation"
16
17
  label="name"
17
18
  track-by="organisationId"
18
19
  :placeholder="$t('Type string to filter by organisation')"
19
- ref="multiselectRef"
20
20
  :options="organisations"
21
21
  :multiple="false"
22
22
  :searchable="true"
@@ -29,57 +29,64 @@
29
29
  :show-no-results="true"
30
30
  :hide-selected="true"
31
31
  :show-labels="false"
32
+ :class="{ 'light-multiselect': stats }"
32
33
  @search-change="onSearchOrganisation"
33
34
  @open="onOpen"
34
35
  @close="onClose"
35
- @select="onEmissionSelected"
36
- :class="{ 'light-multiselect': stats }"
36
+ @select="onOrganisationSelected"
37
37
  >
38
- <template v-slot:clear="props" >
38
+ <template #clear="{ props }">
39
39
  <div
40
+ v-if="organisation"
40
41
  class="multiselect__clear"
41
- v-if="organisation.length"
42
42
  @mousedown.prevent.stop="clearAll(props.search)"
43
- ></div>
43
+ />
44
44
  </template>
45
- <template v-slot:singleLabel="props" >
45
+ <template #singleLabel="{ option }">
46
46
  <div class="multiselect-octopus-proposition">
47
47
  <img
48
- v-if="!light"
48
+ v-if="!light &&!stats"
49
49
  class="option__image"
50
- :src="props.option.imageUrl"
51
- :alt="props.option.name"
52
- />
53
- <span class="option__title" :class="{ descriptionText: light }">
54
- {{ props.option.name }}
50
+ :src="option.imageUrl"
51
+ :alt="option.name"
52
+ >
53
+ <span
54
+ class="option__title"
55
+ :class="{ descriptionText: light }"
56
+ >
57
+ {{ option.name }}
55
58
  </span>
56
59
  </div>
57
60
  </template>
58
- <template v-slot:option="props" >
61
+ <template #option="{ option }">
59
62
  <div
60
63
  class="multiselect-octopus-proposition"
61
64
  :data-selenium="
62
- 'organisation-chooser-' + seleniumFormat(props.option.name)
65
+ 'organisation-chooser-' + seleniumFormat(option.name)
63
66
  "
64
67
  >
65
68
  <img
66
- v-if="!light"
69
+ v-if="!light &&!stats"
67
70
  class="option__image"
68
- :src="props.option.imageUrl"
69
- :alt="props.option.name"
70
- />
71
- <span class="option__title" :class="{ descriptionText: light }">
72
- {{ props.option.name }}
71
+ :src="option.imageUrl"
72
+ :alt="option.name"
73
+ >
74
+ <span
75
+ class="option__title"
76
+ :class="{ descriptionText: light }"
77
+ >
78
+ {{ option.name }}
73
79
  </span>
74
80
  </div>
75
81
  </template>
76
- <template v-slot:noResult>
77
- <span>
78
- {{ $t('No elements found. Consider changing the search query.') }}
79
- </span>
82
+ <template #noResult="">
83
+ <span>{{ $t('No elements found. Consider changing the search query.') }}</span>
80
84
  </template>
81
- <template v-slot:afterList>
82
- <div v-if="remainingElements" class="multiselect-remaining-elements">
85
+ <template #afterList="">
86
+ <div
87
+ v-if="remainingElements"
88
+ class="multiselect-remaining-elements"
89
+ >
83
90
  {{
84
91
  $t(
85
92
  'Count more elements matched your query, please make a more specific search.',
@@ -88,32 +95,40 @@
88
95
  }}
89
96
  </div>
90
97
  </template>
91
- <template v-slot:noOptions>{{ $t('List is empty') }}</template>
92
- <template v-slot:caret>
93
- <div class="position-relative" v-if="!light">
94
- <span
95
- class="saooti-arrow_down octopus-arrow-down-2"
96
- :class="{ 'octopus-arrow-down-top': stats }"
97
- ></span>
98
- </div>
98
+ <template #noOptions="">
99
+ {{ $t('List is empty') }}
99
100
  </template>
100
- </Multiselect>
101
+ <template #caret="">
102
+ <div
103
+ v-if="!light"
104
+ class="position-relative"
105
+ >
106
+ <span
107
+ class="saooti-arrow_down octopus-arrow-down-2"
108
+ :class="{ 'octopus-arrow-down-top': stats }"
109
+ />
110
+ </div>
111
+ </template>
112
+ </VueMultiselect>
101
113
  </div>
102
114
  </template>
103
115
 
104
- <style lang="scss"></style>
105
-
106
116
  <script lang="ts">
107
117
  import { selenium } from '../../mixins/functions';
108
- import Multiselect from 'vue-multiselect';
118
+ //@ts-ignore
119
+ import VueMultiselect from 'vue-multiselect';
109
120
  const octopusApi = require('@saooti/octopus-api');
110
121
  import { state } from '../../../store/paramStore';
122
+ import { Organisation } from '@/store/class/organisation';
111
123
 
112
124
  const ELEMENTS_COUNT = 50;
113
- const DEFAULT_ORGANISATION_ID = 0;
125
+ const DEFAULT_ORGANISATION_ID = "";
114
126
  const DEFAULT_ORGANISATION_IMAGE = '/img/emptypodcast.png';
115
127
 
116
- const getDefaultOrganistion = (defaultName: any) => {
128
+ const getDefaultOrganistion = (defaultName: string) => {
129
+ if(''===defaultName){
130
+ return undefined;
131
+ }
117
132
  return {
118
133
  name: defaultName,
119
134
  id: DEFAULT_ORGANISATION_ID,
@@ -124,59 +139,39 @@ const getDefaultOrganistion = (defaultName: any) => {
124
139
  import { defineComponent } from 'vue'
125
140
  export default defineComponent({
126
141
  components: {
127
- Multiselect,
128
- },
129
-
130
- async created() {
131
- if (
132
- this.authenticated &&
133
- undefined === this.$store.state.organisation.imageUrl
134
- ) {
135
- const data = await octopusApi.fetchOrganisation(this.organisationId);
136
- this.myImage = data.imageUrl;
137
- }
138
- if (this.value) {
139
- this.fetchOrganisation();
140
- }
142
+ VueMultiselect,
141
143
  },
142
-
144
+ mixins:[selenium],
143
145
  props: {
144
- width: { default: '100%' },
145
- defaultanswer: { default: false },
146
- stats: { default: false },
147
- displayArrow: { default: true },
148
- value: { default: null },
149
- light: { default: false },
150
- reset: { default: false },
151
- all: { default: false },
146
+ width: { default: '100%', type: String },
147
+ defaultanswer: { default: '', type: String},
148
+ stats: { default: false, type: Boolean},
149
+ displayArrow: { default: true, type: Boolean},
150
+ value: { default: undefined, type: Object as ()=>Organisation},
151
+ light: { default: false, type: Boolean},
152
+ reset: { default: false, type: Boolean},
153
+ all: { default: false, type: Boolean},
152
154
  },
153
155
  emits: ['selected'],
154
-
155
- mixins: [selenium],
156
-
157
156
  data() {
158
- let _return:any = {
159
- organisation: '',
160
- organisations: [] as any,
161
- remainingElements: 0,
162
- isLoading: false,
163
- init: false,
164
- myImage: state.organisation.imageUrl,
157
+ return {
158
+ organisations: [] as Array<Organisation>,
159
+ remainingElements: 0 as number,
160
+ isLoading: false as boolean,
161
+ init: false as boolean,
162
+ myImage: state.organisation.imageUrl as string,
163
+ organisation: getDefaultOrganistion(this.defaultanswer) as Organisation | undefined
165
164
  };
166
- if (this.defaultanswer) {
167
- _return['organisation'] = getDefaultOrganistion(this.defaultanswer);
168
- }
169
- return _return;
170
165
  },
171
-
166
+
172
167
  computed: {
173
- organisationId() {
168
+ organisationId(): string {
174
169
  return state.generalParameters.organisationId;
175
170
  },
176
- authenticated():boolean {
171
+ authenticated(): boolean {
177
172
  return state.generalParameters.authenticated;
178
173
  },
179
- myOrganisation():any {
174
+ myOrganisation(): Organisation|undefined {
180
175
  if (!this.authenticated) return undefined;
181
176
  return {
182
177
  id: this.organisationId,
@@ -189,31 +184,51 @@ export default defineComponent({
189
184
  };
190
185
  },
191
186
  },
187
+ watch: {
188
+ value(): void {
189
+ if (!this.init || this.value) {
190
+ this.fetchOrganisation();
191
+ }
192
+ },
193
+ reset(): void {
194
+ this.organisation = this.defaultanswer
195
+ ? getDefaultOrganistion(this.defaultanswer)
196
+ : undefined;
197
+ },
198
+ },
192
199
 
200
+ async created() {
201
+ if (
202
+ this.authenticated &&
203
+ undefined === this.$store.state.organisation.imageUrl
204
+ ) {
205
+ const data = await octopusApi.fetchOrganisation(this.organisationId);
206
+ this.myImage = data.imageUrl;
207
+ }
208
+ if (this.value) {
209
+ this.fetchOrganisation();
210
+ }
211
+ },
193
212
  methods: {
194
- onOpen() {
195
- this.$refs.multiselectRef.$refs.search.setAttribute(
213
+ onOpen(): void {
214
+ (this.$refs.multiselectRef as any).$refs.search.setAttribute(
196
215
  'autocomplete',
197
216
  'off'
198
217
  );
199
218
  this.clearAll();
200
219
  this.onSearchOrganisation();
201
220
  },
202
-
203
- onClose() {
221
+ onClose(): void {
204
222
  if (this.organisation) return;
205
-
206
223
  this.organisation = this.defaultanswer
207
224
  ? getDefaultOrganistion(this.defaultanswer)
208
- : '';
225
+ : undefined;
209
226
  this.$emit('selected', this.organisation);
210
227
  },
211
-
212
- onEmissionSelected(organisation: any) {
228
+ onOrganisationSelected(organisation: Organisation|undefined): void {
213
229
  this.$emit('selected', organisation);
214
230
  },
215
-
216
- async onSearchOrganisation(query: undefined) {
231
+ async onSearchOrganisation(query?: string): Promise<void> {
217
232
  this.isLoading = true;
218
233
  const response = await octopusApi.fetchOrganisations({
219
234
  query: query,
@@ -234,27 +249,26 @@ export default defineComponent({
234
249
  orga = orga.concat(other.result);
235
250
  }
236
251
  }
237
-
238
- let notNull = orga.filter((o: null) => {
252
+ const notNull = orga.filter((o: Organisation|null) => {
239
253
  return null !== o;
240
254
  });
241
-
242
255
  if (this.defaultanswer) {
243
- this.organisations = [getDefaultOrganistion(this.defaultanswer)].concat(
244
- notNull
245
- );
256
+ const defaultOrganisation = getDefaultOrganistion(this.defaultanswer);
257
+ if(defaultOrganisation){
258
+ this.organisations =[defaultOrganisation].concat(notNull);
259
+ }
246
260
  } else {
247
261
  this.organisations = notNull;
248
262
  }
249
263
  if (this.myOrganisation) {
250
264
  if (undefined === query) {
251
- this.organisations = this.organisations.filter((obj: { id: any; }) => {
265
+ this.organisations = this.organisations.filter((obj: Organisation) => {
252
266
  return obj.id !== this.organisationId;
253
267
  });
254
268
  this.organisations.splice(1, 0, this.myOrganisation);
255
269
  } else {
256
- let foundIndex = this.organisations.findIndex(
257
- ( obj: { id: any; }) => obj.id === this.organisationId
270
+ const foundIndex = this.organisations.findIndex(
271
+ (obj: Organisation) => obj.id === this.organisationId
258
272
  );
259
273
  if (foundIndex) {
260
274
  this.organisations[foundIndex] = this.myOrganisation;
@@ -264,8 +278,7 @@ export default defineComponent({
264
278
  this.isLoading = false;
265
279
  this.remainingElements = Math.max(0, response.count - orga.length);
266
280
  },
267
-
268
- async fetchOrganisation() {
281
+ async fetchOrganisation(): Promise<void> {
269
282
  if (0 === this.organisations.length) {
270
283
  this.onSearchOrganisation();
271
284
  }
@@ -273,24 +286,12 @@ export default defineComponent({
273
286
  this.organisation = data;
274
287
  this.init = true;
275
288
  },
276
-
277
- clearAll() {
278
- this.organisation = '';
289
+ clearAll(): void {
290
+ this.organisation = undefined;
279
291
  this.organisations.length = 0;
280
292
  },
281
293
  },
282
-
283
- watch: {
284
- value(newVal) {
285
- if (!this.init || newVal) {
286
- this.fetchOrganisation();
287
- }
288
- },
289
- reset() {
290
- this.organisation = this.defaultanswer
291
- ? getDefaultOrganistion(this.defaultanswer)
292
- : '';
293
- },
294
- },
295
- });
294
+ })
296
295
  </script>
296
+
297
+ <style lang="scss"></style>
@@ -1,92 +1,85 @@
1
1
  <template>
2
2
  <div
3
+ v-if="(!value || init) && organisation"
3
4
  class="default-multiselect-width"
4
5
  :style="{ width: width }"
5
- v-if="(!value || init) && '' !== organisation"
6
6
  >
7
7
  <select
8
8
  :id="'organisation_chooser_light' + page"
9
- class="basic-select mb-0 c-hand"
10
9
  v-model="actual"
10
+ class="basic-select mb-0 c-hand"
11
11
  @change="onOrganisationSelected"
12
12
  >
13
- <option :value="organisation.id">{{ organisation.name }}</option>
14
- <option :value="-1">{{ $t('No organisation filter') }}</option>
13
+ <option :value="organisation.id">
14
+ {{ organisation.name }}
15
+ </option>
16
+ <option :value="-1">
17
+ {{ $t('No organisation filter') }}
18
+ </option>
15
19
  </select>
16
20
  <label
17
21
  :for="'organisation_chooser_light' + page"
18
22
  class="d-inline"
19
23
  :aria-label="$t('select productor')"
20
- ></label>
24
+ />
21
25
  </div>
22
26
  </template>
23
27
 
24
- <style lang="scss">
25
- .default-multiselect-width .basic-select {
26
- width: auto;
27
- -webkit-appearance: none;
28
- -moz-appearance: none;
29
- text-indent: 1px;
30
- text-overflow: '';
31
- font-size: 1rem;
32
- }
33
- </style>
34
-
35
28
  <script lang="ts">
36
29
  const octopusApi = require('@saooti/octopus-api');
37
30
 
31
+ import { Organisation } from '@/store/class/organisation';
38
32
  import { defineComponent } from 'vue'
39
33
  export default defineComponent({
40
- components: {},
41
-
42
- created() {
43
- if (this.value) {
44
- this.fetchOrganisation();
45
- }
46
- },
47
-
48
34
  props: {
49
- width: { default: '100%' },
50
- value: { default: null },
51
- reset: { default: false },
52
- page: { default: '' },
35
+ width: { default: '100%', type: String},
36
+ value: { default: undefined, type: String},
37
+ reset: { default: false, type: Boolean},
38
+ page: { default: '', type: String},
53
39
  },
54
40
  emits: ['selected'],
55
41
 
56
42
  data() {
57
- let _return = {
58
- actual: -1,
59
- organisation: '',
60
- init: false,
43
+ return {
44
+ actual: -1 as number,
45
+ organisation: undefined as Organisation|undefined,
46
+ init: false as boolean,
61
47
  };
62
- return _return;
48
+ },
49
+
50
+ watch: {
51
+ value(): void {
52
+ if (!this.init || this.value) {
53
+ this.fetchOrganisation();
54
+ }
55
+ },
56
+ reset(): void {
57
+ this.actual = -1;
58
+ },
59
+ },
60
+
61
+ created() {
62
+ if (this.value) {
63
+ this.fetchOrganisation();
64
+ }
63
65
  },
64
66
 
65
67
  methods: {
66
- onOrganisationSelected() {
68
+ onOrganisationSelected(): void{
67
69
  if (-1 === this.actual) {
68
70
  this.$emit('selected', undefined);
69
71
  } else {
70
72
  this.$emit('selected', this.organisation);
71
73
  }
72
74
  },
73
- async fetchOrganisation() {
75
+ async fetchOrganisation(): Promise<void> {
74
76
  const data = await octopusApi.fetchOrganisation(this.value);
75
77
  this.organisation = data;
76
78
  this.actual = data.id;
77
79
  this.init = true;
78
80
  },
79
81
  },
80
-
81
- watch: {
82
- value(newVal) {
83
- if (!this.init || newVal) {
84
- this.fetchOrganisation();
85
- }
86
- },
87
- reset() {
88
- this.actual = -1;
89
- },
90
- },
91
- });
82
+ })
92
83
  </script>
84
+
85
+ <style lang="scss"></style>