30
30
</Dropdown >
31
31
</template >
32
32
</LayoutHeader >
33
- <div v-if =" ticket.data" class =" flex h-full " >
33
+ <div v-if =" ticket.data" class =" flex h-screen overflow-hidden " >
34
34
<div class =" flex flex-col" >
35
- <Tabs
36
- v-slot =" { tab }"
37
- v-model =" tabIndex"
38
- :tabs =" tabs"
39
- class =" overflow-hidden"
35
+ <div
36
+ class =" pr-7.5 flex items-center justify-between border-b py-1 pl-10"
40
37
>
41
- <div v-if =" tab.label === 'Customer Tickets'" class =" py-2" >
42
- <TicketsAgentList
43
- :rows =" customerTickets?.data?.data"
44
- :columns =" customerTickets?.data?.columns"
45
- :options =" {
46
- selectable: false,
47
- openInNewTab: true,
48
- }"
49
- :paginate =" false"
50
- />
51
- </div >
52
- <TicketAgentActivities
53
- v-else
54
- :activities =" activities"
55
- :type =" tab.label === 'Emails' ? 'email' : 'all'"
38
+ <span class =" text-lg font-semibold" >Activity</span >
39
+ <Switch
40
+ v-model =" showFullActivity"
41
+ size =" sm"
42
+ label =" Show all activity"
56
43
/>
57
- </Tabs >
44
+ </div >
45
+ <TicketAgentActivities :activities =" activities" />
58
46
<CommunicationArea
59
47
v-model =" ticket.data"
60
48
v-model:reload =" reload_email"
73
61
74
62
<script setup lang="ts">
75
63
import { computed , ref , h } from " vue" ;
76
- import { Breadcrumbs , createResource , Dropdown , Tabs } from " frappe-ui" ;
64
+ import { Breadcrumbs , createResource , Dropdown , Switch } from " frappe-ui" ;
77
65
78
66
import { useTicketStatusStore } from " @/stores/ticketStatus" ;
79
67
import { createToast } from " @/utils" ;
@@ -87,32 +75,12 @@ import {
87
75
88
76
import { TicketAgentActivities , TicketAgentSidebar } from " @/components/ticket" ;
89
77
90
- import {
91
- ActivityIcon ,
92
- EmailIcon ,
93
- IndicatorIcon ,
94
- TicketIcon ,
95
- } from " @/components/icons" ;
78
+ import { IndicatorIcon } from " @/components/icons" ;
96
79
97
80
const ticketStatusStore = useTicketStatusStore ();
98
81
99
- const tabIndex = ref (0 );
100
- const tabs = [
101
- {
102
- label: " Activity" ,
103
- icon: ActivityIcon ,
104
- },
105
- {
106
- label: " Emails" ,
107
- icon: EmailIcon ,
108
- },
109
- {
110
- label: " Customer Tickets" ,
111
- icon: TicketIcon ,
112
- },
113
- ];
82
+ const showFullActivity = ref (true );
114
83
115
- const customerTickets = ref ([]);
116
84
const reload_email = ref (false );
117
85
118
86
const props = defineProps ({
@@ -149,30 +117,6 @@ const ticket = createResource({
149
117
];
150
118
return data ;
151
119
},
152
- onSuccess(data ) {
153
- customerTickets .value = createResource ({
154
- url: " helpdesk.api.doc.get_list_data" ,
155
- params: {
156
- doctype: " HD Ticket" ,
157
- filters: {
158
- customer: [" =" , data .customer ],
159
- name: [" !=" , props .ticketId ],
160
- },
161
- columns: [
162
- { label: " Name" , type: " Data" , key: " name" , width: " 5rem" },
163
- { label: " Subject" , type: " Data" , key: " subject" , width: " 25rem" },
164
- { label: " Status" , type: " Data" , key: " status" , width: " 8rem" },
165
- ],
166
- rows: [" name" , " subject" , " status" ],
167
- },
168
- auto: true ,
169
- transform(data ) {
170
- data .data .forEach ((row ) => {
171
- row .name = row .name .toString ();
172
- });
173
- },
174
- });
175
- },
176
120
});
177
121
178
122
const dropdownOptions = computed (() =>
@@ -203,10 +147,6 @@ const activities = computed(() => {
203
147
};
204
148
});
205
149
206
- if (tabIndex .value === 1 ) {
207
- return emailProps ;
208
- }
209
-
210
150
const commentProps = ticket .data .comments .map ((comment ) => {
211
151
return {
212
152
type: " comment" ,
@@ -217,6 +157,12 @@ const activities = computed(() => {
217
157
};
218
158
});
219
159
160
+ if (! showFullActivity .value ) {
161
+ return [... emailProps , ... commentProps ].sort (
162
+ (a , b ) => new Date (a .creation ) - new Date (b .creation )
163
+ );
164
+ }
165
+
220
166
const historyProps = [... ticket .data .history , ... ticket .data .views ].map (
221
167
(h ) => {
222
168
return {
0 commit comments