@@ -3,6 +3,8 @@ q-card(style="height: 100%").column
33 q-toolbar.col-1
44 q-toolbar-title {{ sequence }} | {{ subject }}
55 q-scroll-area.col-8 ( ref ="chatScroll" )
6+ div( v-if ="threads.total === 0" ) .flex.items-center.justify-center
7+ span Aucun message
68 div( v-for ='(value, key) in getMessageByDay' : key= 'key' )
79 q-chat-message
810 template( v-slot:label )
@@ -19,39 +21,39 @@ q-card(style="height: 100%").column
1921 q-tooltip.text-body2 {{ getHour(message.metadata.createdAt) }}
2022 template( v-slot:default )
2123 div
22- q-chip( v-for ='file in message.fragments.file ' : key= 'file.id' icon ="mdi-paperclip" dense size ='md' : label= "file.message" )
24+ q-chip( v-for ='file in message.attachement ' : key= 'file.id' icon ="mdi-paperclip" dense size ='md' : label= "file.message" )
2325 q-separator.q-my-xs ( v-if ="message.fragments.file" )
2426 div( v-for ='raw in message.fragments.raw' v-html ="raw.message" )
25-
27+ tk-SearchfiltersThreads
2628 q-editor(
2729 v-model ="message" placeholder ="Votre message ..." v-model:fullscreen ="isFullscreen"
28- :definitions ="{ send: { tip: 'Envoyer', icon: 'mdi-send', label: 'Envoyer', handler: sendMessage }, attach:{ tip: 'Joindre un fichier', icon: 'mdi-paperclip', label: 'Joindre un fichier', handler: () => {console.log('joindre')} }} "
29- :toolbar ="[['left','center','right','justify'],['bold','italic','underline','strike'],['undo','redo'],['attach','send']]"
30+ :definitions ="editorDefinitions" ref = "dropZoneRef "
31+ :toolbar ="[['left','center','right','justify'],['bold','italic','underline','strike'],['undo','redo'],['attach','send'],['fullscreen'] ]"
3032 ) .col
31- .col-1 ( ref ="dropZoneRef" ) .bg-grey-3.items-center.justify-center.q-pa-md
32- q-icon( name ="mdi-paperclip" size ="md" : class = "isOverDropZone ? 'text-primary' : 'text-grey-5'" )
33- span.q-ml-md ( :class ="isOverDropZone ? 'text-primary' : 'text-grey-5'" ) Déposer un fichier
33+ //- .col-1(ref="dropZoneRef").bg-grey-3.items-center.justify-center.q-pa-md
34+ //- q-icon(name="mdi-paperclip" size="md" :class="isOverDropZone ? 'text-primary' : 'text-grey-5'")
35+ //- span.q-ml-md(:class="isOverDropZone ? 'text-primary' : 'text-grey-5'") Déposer un fichier
3436
3537 </template >
3638
3739<script lang="ts" setup>
3840import { ref , onMounted , computed } from ' vue'
39- import { useRoute } from ' nuxt/app' ;
40- import { useHttpApi } from ' ~/composables/useHttpApi ' ;
41+ import { useRoute , useRouter } from ' nuxt/app' ;
42+ import { useHttpApi } from ' ~/composables' ;
4143import { useDayjs , usePinia } from " #imports" ;
4244import { generateMongoId } from ' ~/utils' ;
4345import type { Fragments , Threads } from ' ~/types' ;
4446import type { components } from ' #build/types/service-api'
45- import { ThreadType } from ' ~/utils' ;
47+ import { ThreadType , threadTypes } from ' ~/utils' ;
4648import { useDropZone } from ' @vueuse/core'
4749
4850type ThreadDto = components [' schemas' ][' ThreadDto' ]
4951type FragmentPartDto = components [" schemas" ][" FragmentPartDto" ]
5052type ThreadCreateDto = components [' schemas' ][' ThreadCreateDto' ]
5153
5254const dayjs = useDayjs ()
53-
5455const store = usePinia ()
56+ const route = useRoute ()
5557const user = store .state .value .auth .user
5658const props = defineProps ({
5759 sequence: {
@@ -64,25 +66,31 @@ const props = defineProps({
6466 }
6567})
6668
67- const chatScroll = ref (null )
6869onMounted (() => {
6970 scroll ()
7071})
7172
72- const route = useRoute ( )
73- const query = ref ({
73+ const chatScroll = ref ( null )
74+ const baseQuery = ref ({
7475 " filters[ticketId]" : ` ${route .params .id } ` ,
7576 " sort[metadata.createdAt]" : ' asc' ,
76- " limit" : 100 ,
77+ " limit" : 999 ,
7778})
7879
7980const isFullscreen = ref (false )
80-
81+ const message = ref ( ' ' )
8182const dropZoneRef = ref <HTMLDivElement >()
8283const { data : threads } = await useHttpApi (` tickets/thread ` , {
8384 method: ' get' ,
84- query
85+ query: computed (() => {
86+ return {
87+ ... baseQuery .value ,
88+ ... route .query
89+ }
90+ })
8591})
92+
93+
8694const onDrop = (files : File [] | null ) => {
8795 console .log (' drop' )
8896 console .log (files )
@@ -138,6 +146,31 @@ const sendMessage = async () => {
138146 scroll ()
139147}
140148
149+ const editorDefinitions = ref ({
150+ send: {
151+ tip: ' Envoyer' ,
152+ icon: ' mdi-send' ,
153+ label: ' Envoyer' ,
154+ handler: sendMessage
155+ },
156+ attach: {
157+ tip: ' Joindre un fichier' ,
158+ icon: ' mdi-paperclip' ,
159+ label: ' Joindre un fichier' ,
160+ handler : () => {
161+ console .log (' joindre' )
162+ }
163+ },
164+ fullscreen: {
165+ tip: ' Plein écran' ,
166+ icon: ' mdi-fullscreen' ,
167+ label: ' Plein écran' ,
168+ handler : () => {
169+ isFullscreen .value = ! isFullscreen .value
170+ }
171+ }
172+ })
173+
141174const getMessageByDay = computed ((): Threads => {
142175 return threads .value ?.data .reduce ((acc : Threads , thread : ThreadDto ) => {
143176 const day = dayjs (thread .metadata .createdAt ).format (' DD-MM-YYYY' )
@@ -151,11 +184,4 @@ const getMessageByDay = computed((): Threads => {
151184 }, {})
152185})
153186
154- const message = ref (' ' )
155- </script >
156-
157- <style lang="css" scoped>
158- .mainContent {
159- height : calc (100% - 50px );
160- }
161- </style >
187+ </script >
0 commit comments