@escalated-dev/escalated 0.7.0 → 0.8.0

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 (181) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +36 -1
  3. package/package.json +16 -7
  4. package/src/components/ActiveChatsPanel.vue +246 -0
  5. package/src/components/ActivityTimeline.stories.js +55 -55
  6. package/src/components/ActivityTimeline.vue +83 -83
  7. package/src/components/AdminDashboard.stories.js +1423 -1095
  8. package/src/components/AgentLoadIndicator.stories.js +37 -37
  9. package/src/components/AgentLoadIndicator.vue +49 -49
  10. package/src/components/AgentPerformanceCard.vue +44 -44
  11. package/src/components/ArticleEditor.vue +82 -82
  12. package/src/components/AssigneeSelect.vue +37 -37
  13. package/src/components/AttachmentList.vue +13 -1
  14. package/src/components/AuditLogEntry.vue +95 -95
  15. package/src/components/BulkActionBar.vue +166 -166
  16. package/src/components/CategoryTree.vue +89 -89
  17. package/src/components/ChartWidget.vue +46 -46
  18. package/src/components/ChatActionBar.vue +226 -0
  19. package/src/components/ChatBubble.vue +162 -0
  20. package/src/components/ChatComposer.vue +308 -0
  21. package/src/components/ChatQueue.vue +222 -0
  22. package/src/components/ChatThread.vue +197 -0
  23. package/src/components/CollisionWarning.stories.js +30 -30
  24. package/src/components/CollisionWarning.vue +68 -68
  25. package/src/components/ConditionalFieldRules.vue +135 -135
  26. package/src/components/ContextPanel.vue +66 -66
  27. package/src/components/ContextPanelSection.vue +65 -65
  28. package/src/components/CustomFieldRenderer.vue +159 -159
  29. package/src/components/EscalatedLayout.vue +35 -6
  30. package/src/components/FileDropzone.vue +57 -57
  31. package/src/components/FollowButton.stories.js +30 -30
  32. package/src/components/FollowButton.vue +88 -88
  33. package/src/components/KeyboardShortcutHelp.vue +213 -213
  34. package/src/components/KnowledgePanel.vue +122 -122
  35. package/src/components/KpiCard.stories.js +32 -32
  36. package/src/components/KpiCard.vue +88 -88
  37. package/src/components/MacroDropdown.vue +150 -150
  38. package/src/components/MentionDropdown.vue +154 -0
  39. package/src/components/MetricComparison.vue +89 -0
  40. package/src/components/PercentileChart.vue +67 -0
  41. package/src/components/PeriodSelector.vue +98 -0
  42. package/src/components/PermissionMatrix.vue +107 -107
  43. package/src/components/PinnedNotes.vue +129 -129
  44. package/src/components/PluginSlot.vue +68 -62
  45. package/src/components/PresenceIndicator.vue +46 -2
  46. package/src/components/PriorityBadge.stories.js +33 -33
  47. package/src/components/PriorityBadge.vue +46 -46
  48. package/src/components/ReplyComposer.vue +81 -18
  49. package/src/components/ReplyThread.vue +40 -2
  50. package/src/components/ReportChart.vue +395 -0
  51. package/src/components/ReportExportButton.vue +108 -0
  52. package/src/components/SatisfactionRating.vue +180 -180
  53. package/src/components/SaveViewDialog.vue +172 -0
  54. package/src/components/SavedViewSidebar.vue +208 -0
  55. package/src/components/ScheduleEditor.vue +104 -104
  56. package/src/components/SideConversation.vue +165 -165
  57. package/src/components/SideConversationList.vue +147 -147
  58. package/src/components/SkillTagManager.vue +83 -79
  59. package/src/components/SlaComplianceChart.vue +46 -53
  60. package/src/components/SlaTimer.stories.js +35 -35
  61. package/src/components/SlaTimer.vue +62 -62
  62. package/src/components/SnoozeButton.vue +247 -0
  63. package/src/components/StatsCard.stories.js +24 -24
  64. package/src/components/StatsCard.vue +58 -58
  65. package/src/components/StatusBadge.stories.js +53 -53
  66. package/src/components/StatusBadge.vue +78 -78
  67. package/src/components/TagSelect.vue +84 -84
  68. package/src/components/TicketFilters.vue +270 -225
  69. package/src/components/TicketLinkPanel.vue +193 -193
  70. package/src/components/TicketList.vue +655 -594
  71. package/src/components/TicketMergeDialog.vue +157 -157
  72. package/src/components/TicketSplitDialog.vue +98 -0
  73. package/src/components/TotpInput.stories.js +9 -9
  74. package/src/components/TotpInput.vue +81 -81
  75. package/src/components/TwoFactorSetup.vue +113 -113
  76. package/src/components/VariableTokenInput.vue +111 -0
  77. package/src/components/WorkflowActionConfig.vue +287 -0
  78. package/src/components/WorkflowActionList.vue +350 -0
  79. package/src/components/WorkflowConditionBuilder.vue +265 -0
  80. package/src/components/WorkflowTriggerSelector.vue +125 -0
  81. package/src/composables/useChat.js +187 -0
  82. package/src/composables/useI18n.js +30 -8
  83. package/src/composables/useKeyboardShortcuts.js +46 -46
  84. package/src/composables/useMentions.js +134 -0
  85. package/src/composables/usePluginExtensions.js +159 -159
  86. package/src/composables/usePluginHooks.js +65 -65
  87. package/src/composables/useRealtime.js +182 -0
  88. package/src/defineEscalatedPlugin.js +76 -76
  89. package/src/index.js +84 -72
  90. package/src/locales/README.md +13 -0
  91. package/src/locales/ar.json +727 -0
  92. package/src/locales/de.json +678 -430
  93. package/src/locales/en.json +717 -455
  94. package/src/locales/es.json +679 -430
  95. package/src/locales/fr.json +680 -431
  96. package/src/locales/index.js +12 -2
  97. package/src/locales/it.json +727 -0
  98. package/src/locales/ja.json +727 -0
  99. package/src/locales/ko.json +727 -0
  100. package/src/locales/nl.json +727 -0
  101. package/src/locales/pl.json +727 -0
  102. package/src/locales/pt-BR.json +727 -0
  103. package/src/locales/ru.json +727 -0
  104. package/src/locales/tr.json +727 -0
  105. package/src/locales/zh-CN.json +727 -0
  106. package/src/pages/Admin/ApiTokens/Index.vue +381 -381
  107. package/src/pages/Admin/AuditLog/Index.vue +154 -154
  108. package/src/pages/Admin/BusinessHours/Form.vue +172 -172
  109. package/src/pages/Admin/BusinessHours/Index.vue +113 -113
  110. package/src/pages/Admin/CannedResponses/Index.vue +127 -127
  111. package/src/pages/Admin/Capacity/Index.vue +134 -134
  112. package/src/pages/Admin/CustomFields/Form.vue +195 -195
  113. package/src/pages/Admin/CustomFields/Index.vue +134 -134
  114. package/src/pages/Admin/CustomObjects/Form.vue +202 -202
  115. package/src/pages/Admin/CustomObjects/Index.vue +127 -127
  116. package/src/pages/Admin/CustomObjects/Records.vue +228 -228
  117. package/src/pages/Admin/Departments/Form.vue +75 -75
  118. package/src/pages/Admin/Departments/Index.vue +110 -109
  119. package/src/pages/Admin/EscalationRules/Form.vue +157 -157
  120. package/src/pages/Admin/EscalationRules/Index.vue +178 -178
  121. package/src/pages/Admin/Import/Connect.vue +0 -1
  122. package/src/pages/Admin/Import/Index.vue +1 -1
  123. package/src/pages/Admin/Import/Progress.vue +1 -1
  124. package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -142
  125. package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -195
  126. package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -193
  127. package/src/pages/Admin/Macros/Index.vue +448 -448
  128. package/src/pages/Admin/Plugins/Index.vue +327 -327
  129. package/src/pages/Admin/Reports/AgentDetail.vue +132 -0
  130. package/src/pages/Admin/Reports/AgentMetrics.vue +115 -115
  131. package/src/pages/Admin/Reports/AgentRanking.vue +246 -0
  132. package/src/pages/Admin/Reports/Cohorts.vue +180 -0
  133. package/src/pages/Admin/Reports/Comparison.vue +141 -0
  134. package/src/pages/Admin/Reports/CsatReport.vue +127 -127
  135. package/src/pages/Admin/Reports/Dashboard.vue +36 -21
  136. package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -0
  137. package/src/pages/Admin/Reports/ResponseTimes.vue +164 -0
  138. package/src/pages/Admin/Reports/SlaReport.vue +162 -166
  139. package/src/pages/Admin/Reports/SlaTrends.vue +183 -0
  140. package/src/pages/Admin/Reports.vue +206 -206
  141. package/src/pages/Admin/Roles/Form.vue +71 -71
  142. package/src/pages/Admin/Roles/Index.vue +122 -122
  143. package/src/pages/Admin/Settings/CsatSettings.vue +165 -165
  144. package/src/pages/Admin/Settings/DataRetention.vue +182 -182
  145. package/src/pages/Admin/Settings/EmailSettings.vue +243 -243
  146. package/src/pages/Admin/Settings/Sandbox.vue +135 -135
  147. package/src/pages/Admin/Settings/SsoSettings.vue +218 -218
  148. package/src/pages/Admin/Settings/TwoFactor.vue +110 -110
  149. package/src/pages/Admin/Settings.vue +1008 -468
  150. package/src/pages/Admin/Skills/Form.vue +193 -53
  151. package/src/pages/Admin/Skills/Index.vue +105 -94
  152. package/src/pages/Admin/SlaPolicies/Form.vue +118 -118
  153. package/src/pages/Admin/SlaPolicies/Index.vue +121 -120
  154. package/src/pages/Admin/Statuses/Form.vue +114 -114
  155. package/src/pages/Admin/Statuses/Index.vue +153 -153
  156. package/src/pages/Admin/Tags/Index.vue +191 -191
  157. package/src/pages/Admin/Tickets/Index.vue +126 -91
  158. package/src/pages/Admin/Tickets/Show.vue +29 -0
  159. package/src/pages/Admin/Users/Index.vue +145 -0
  160. package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -120
  161. package/src/pages/Admin/Webhooks/Form.vue +110 -110
  162. package/src/pages/Admin/Webhooks/Index.vue +136 -136
  163. package/src/pages/Admin/Workflows/Builder.vue +207 -0
  164. package/src/pages/Admin/Workflows/Index.vue +235 -0
  165. package/src/pages/Admin/Workflows/Logs.vue +286 -0
  166. package/src/pages/Agent/TicketIndex.vue +112 -88
  167. package/src/pages/Agent/TicketShow.vue +192 -60
  168. package/src/pages/Customer/Create.vue +1 -1
  169. package/src/pages/Customer/Index.vue +26 -1
  170. package/src/pages/Customer/KnowledgeBase/Article.vue +4 -2
  171. package/src/pages/Customer/KnowledgeBase/Index.vue +151 -151
  172. package/src/pages/Customer/Show.vue +69 -63
  173. package/src/pages/Guest/Create.vue +40 -15
  174. package/src/pages/Guest/Show.vue +124 -93
  175. package/src/plugin.js +26 -1
  176. package/src/utils/mentionHighlight.js +24 -0
  177. package/src/utils/sanitizeHtml.js +78 -64
  178. package/src/widget/EscalatedWidget.vue +804 -0
  179. package/src/widget/index.js +254 -0
  180. package/src/pages/Admin/Automations/Form.vue +0 -184
  181. package/src/pages/Admin/Automations/Index.vue +0 -129
@@ -1,225 +1,270 @@
1
- <script setup>
2
- import { inject, computed, reactive, ref, watch } from 'vue';
3
- import { router } from '@inertiajs/vue3';
4
- import { TICKET_STATUSES, TICKET_PRIORITIES } from '../utils/constants';
5
-
6
- const props = defineProps({
7
- statuses: {
8
- type: Array,
9
- default: () => TICKET_STATUSES,
10
- },
11
- priorities: { type: Array, default: () => TICKET_PRIORITIES },
12
- agents: { type: Array, default: () => [] },
13
- departments: { type: Array, default: () => [] },
14
- tags: { type: Array, default: () => [] },
15
- filters: { type: Object, default: () => ({}) },
16
- route: { type: String, required: true },
17
- modelValue: { type: Object, default: () => ({}) },
18
- showFollowing: { type: Boolean, default: false },
19
- showAssignee: { type: Boolean, default: false },
20
- });
21
-
22
- const emit = defineEmits(['update:modelValue']);
23
- const escDark = inject(
24
- 'esc-dark',
25
- computed(() => false),
26
- );
27
-
28
- const initial = { ...props.filters, ...props.modelValue };
29
-
30
- const filterData = reactive({
31
- status: initial.status || '',
32
- priority: initial.priority || '',
33
- assigned_to: initial.assigned_to || '',
34
- department_id: initial.department_id || '',
35
- search: initial.search || '',
36
- following: initial.following || '',
37
- created_after: initial.created_after || '',
38
- created_before: initial.created_before || '',
39
- tag: initial.tag || '',
40
- has_attachments: initial.has_attachments || '',
41
- requester: initial.requester || '',
42
- ticket_type: initial.ticket_type || '',
43
- });
44
-
45
- const showAdvanced = ref(
46
- !!(initial.created_after || initial.created_before || initial.tag || initial.has_attachments || initial.requester),
47
- );
48
-
49
- // Debounced watcher that navigates via Inertia router
50
- let debounceTimer = null;
51
-
52
- watch(
53
- filterData,
54
- (val) => {
55
- emit('update:modelValue', { ...val });
56
-
57
- if (debounceTimer) {
58
- clearTimeout(debounceTimer);
59
- }
60
- debounceTimer = setTimeout(() => {
61
- // Strip empty values to keep the URL clean
62
- const params = {};
63
- for (const [key, value] of Object.entries(val)) {
64
- if (value !== '' && value !== null && value !== undefined) {
65
- params[key] = value;
66
- }
67
- }
68
- router.get(props.route, params, { preserveState: true, preserveScroll: true });
69
- }, 300);
70
- },
71
- { deep: true },
72
- );
73
-
74
- const inputClass = computed(() =>
75
- escDark.value
76
- ? 'rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface)] px-3 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] placeholder-[var(--esc-panel-text-muted)] focus:border-[var(--esc-panel-border-input)] focus:outline-none focus:ring-1 focus:ring-[var(--esc-panel-border-input)]'
77
- : 'rounded-md border border-gray-300 px-3 py-1.5 text-sm focus:border-blue-500 focus:outline-none',
78
- );
79
-
80
- const selectClass = computed(() =>
81
- escDark.value
82
- ? 'rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface)] px-2 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] focus:border-[var(--esc-panel-border-input)] focus:outline-none focus:ring-1 focus:ring-[var(--esc-panel-border-input)]'
83
- : 'rounded-md border border-gray-300 px-2 py-1.5 text-sm',
84
- );
85
-
86
- const checkboxClass = computed(() =>
87
- escDark.value
88
- ? 'h-4 w-4 rounded border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] text-[var(--esc-panel-accent)] focus:ring-[var(--esc-panel-accent)]/20'
89
- : 'h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500',
90
- );
91
-
92
- const toggleBtnClass = computed(() =>
93
- escDark.value
94
- ? 'rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface)] px-3 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] hover:bg-[var(--esc-panel-surface-alt)] transition-colors'
95
- : 'rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-600 hover:bg-gray-50 transition-colors',
96
- );
97
-
98
- const labelClass = computed(() =>
99
- escDark.value ? 'text-xs font-medium text-[var(--esc-panel-text-tertiary)]' : 'text-xs font-medium text-gray-500',
100
- );
101
- </script>
102
-
103
- <template>
104
- <div class="space-y-3">
105
- <div class="flex flex-wrap items-center gap-3">
106
- <input
107
- v-model="filterData.search"
108
- type="text"
109
- placeholder="Search tickets..."
110
- aria-label="Search tickets"
111
- :class="inputClass"
112
- />
113
- <button type="button" :class="toggleBtnClass" @click="showAdvanced = !showAdvanced">
114
- {{ showAdvanced ? 'Simple' : 'Advanced' }}
115
- </button>
116
- <select v-model="filterData.status" aria-label="Filter by status" :class="selectClass">
117
- <option value="">All Statuses</option>
118
- <option v-for="s in statuses" :key="s" :value="s">{{ s.replace(/_/g, ' ') }}</option>
119
- </select>
120
- <select v-model="filterData.priority" aria-label="Filter by priority" :class="selectClass">
121
- <option value="">All Priorities</option>
122
- <option v-for="p in priorities" :key="p" :value="p">{{ p }}</option>
123
- </select>
124
- <select v-model="filterData.ticket_type" aria-label="Filter by type" :class="selectClass">
125
- <option value="">All Types</option>
126
- <option value="question">Question</option>
127
- <option value="problem">Problem</option>
128
- <option value="incident">Incident</option>
129
- <option value="task">Task</option>
130
- </select>
131
- <select
132
- v-if="agents.length"
133
- v-model="filterData.assigned_to"
134
- aria-label="Filter by agent"
135
- :class="selectClass"
136
- >
137
- <option value="">All Agents</option>
138
- <option v-for="a in agents" :key="a.id" :value="a.id">{{ a.name }}</option>
139
- </select>
140
- <select
141
- v-if="departments.length"
142
- v-model="filterData.department_id"
143
- aria-label="Filter by department"
144
- :class="selectClass"
145
- >
146
- <option value="">All Departments</option>
147
- <option v-for="d in departments" :key="d.id" :value="d.id">{{ d.name }}</option>
148
- </select>
149
- <label v-if="showFollowing" class="flex items-center gap-2">
150
- <input
151
- v-model="filterData.following"
152
- type="checkbox"
153
- true-value="1"
154
- false-value=""
155
- :class="checkboxClass"
156
- />
157
- <span :class="['text-sm', escDark ? 'text-[var(--esc-panel-text-tertiary)]' : 'text-gray-600']"
158
- >Following</span
159
- >
160
- </label>
161
- </div>
162
-
163
- <!-- Advanced filters -->
164
- <div
165
- v-if="showAdvanced"
166
- class="flex flex-wrap items-end gap-4 rounded-lg border p-3"
167
- :class="
168
- escDark
169
- ? 'border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)]'
170
- : 'border-gray-200 bg-gray-50'
171
- "
172
- >
173
- <div class="flex flex-col gap-1">
174
- <label :class="labelClass">Created after</label>
175
- <input
176
- v-model="filterData.created_after"
177
- type="date"
178
- aria-label="Created after date"
179
- :class="inputClass"
180
- />
181
- </div>
182
- <div class="flex flex-col gap-1">
183
- <label :class="labelClass">Created before</label>
184
- <input
185
- v-model="filterData.created_before"
186
- type="date"
187
- aria-label="Created before date"
188
- :class="inputClass"
189
- />
190
- </div>
191
- <div class="flex flex-col gap-1">
192
- <label :class="labelClass">Tag</label>
193
- <input
194
- v-model="filterData.tag"
195
- type="text"
196
- placeholder="Tag name..."
197
- aria-label="Filter by tag name"
198
- :class="inputClass"
199
- />
200
- </div>
201
- <div class="flex flex-col gap-1">
202
- <label :class="labelClass">Requester</label>
203
- <input
204
- v-model="filterData.requester"
205
- type="text"
206
- placeholder="Name or email..."
207
- aria-label="Filter by requester"
208
- :class="inputClass"
209
- />
210
- </div>
211
- <label class="flex items-center gap-2 self-center pt-4">
212
- <input
213
- v-model="filterData.has_attachments"
214
- type="checkbox"
215
- true-value="1"
216
- false-value=""
217
- :class="checkboxClass"
218
- />
219
- <span :class="['text-sm', escDark ? 'text-[var(--esc-panel-text-tertiary)]' : 'text-gray-600']"
220
- >Has attachments</span
221
- >
222
- </label>
223
- </div>
224
- </div>
225
- </template>
1
+ <script setup>
2
+ import { inject, computed, reactive, ref, watch } from 'vue';
3
+ import { router } from '@inertiajs/vue3';
4
+ import { TICKET_STATUSES, TICKET_PRIORITIES } from '../utils/constants';
5
+
6
+ const props = defineProps({
7
+ statuses: {
8
+ type: Array,
9
+ default: () => TICKET_STATUSES,
10
+ },
11
+ priorities: { type: Array, default: () => TICKET_PRIORITIES },
12
+ agents: { type: Array, default: () => [] },
13
+ departments: { type: Array, default: () => [] },
14
+ tags: { type: Array, default: () => [] },
15
+ filters: { type: Object, default: () => ({}) },
16
+ route: { type: String, required: true },
17
+ modelValue: { type: Object, default: () => ({}) },
18
+ showFollowing: { type: Boolean, default: false },
19
+ showAssignee: { type: Boolean, default: false },
20
+ });
21
+
22
+ const emit = defineEmits(['update:modelValue', 'save-view']);
23
+ const escDark = inject(
24
+ 'esc-dark',
25
+ computed(() => false),
26
+ );
27
+
28
+ const initial = { ...props.filters, ...props.modelValue };
29
+
30
+ const filterData = reactive({
31
+ status: initial.status || '',
32
+ priority: initial.priority || '',
33
+ assigned_to: initial.assigned_to || '',
34
+ department_id: initial.department_id || '',
35
+ search: initial.search || '',
36
+ following: initial.following || '',
37
+ created_after: initial.created_after || '',
38
+ created_before: initial.created_before || '',
39
+ tag: initial.tag || '',
40
+ has_attachments: initial.has_attachments || '',
41
+ requester: initial.requester || '',
42
+ ticket_type: initial.ticket_type || '',
43
+ snoozed: initial.snoozed || '',
44
+ live_chat: initial.live_chat || '',
45
+ });
46
+
47
+ const showAdvanced = ref(
48
+ !!(initial.created_after || initial.created_before || initial.tag || initial.has_attachments || initial.requester),
49
+ );
50
+
51
+ // Debounced watcher that navigates via Inertia router
52
+ let debounceTimer = null;
53
+
54
+ watch(
55
+ filterData,
56
+ (val) => {
57
+ emit('update:modelValue', { ...val });
58
+
59
+ if (debounceTimer) {
60
+ clearTimeout(debounceTimer);
61
+ }
62
+ debounceTimer = setTimeout(() => {
63
+ // Strip empty values to keep the URL clean
64
+ const params = {};
65
+ for (const [key, value] of Object.entries(val)) {
66
+ if (value !== '' && value !== null && value !== undefined) {
67
+ params[key] = value;
68
+ }
69
+ }
70
+ router.get(props.route, params, { preserveState: true, preserveScroll: true });
71
+ }, 300);
72
+ },
73
+ { deep: true },
74
+ );
75
+
76
+ const inputClass = computed(() =>
77
+ escDark.value
78
+ ? 'rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface)] px-3 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] placeholder-[var(--esc-panel-text-muted)] focus:border-[var(--esc-panel-border-input)] focus:outline-none focus:ring-1 focus:ring-[var(--esc-panel-border-input)]'
79
+ : 'rounded-md border border-gray-300 px-3 py-1.5 text-sm focus:border-blue-500 focus:outline-none',
80
+ );
81
+
82
+ const selectClass = computed(() =>
83
+ escDark.value
84
+ ? 'rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface)] px-2 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] focus:border-[var(--esc-panel-border-input)] focus:outline-none focus:ring-1 focus:ring-[var(--esc-panel-border-input)]'
85
+ : 'rounded-md border border-gray-300 px-2 py-1.5 text-sm',
86
+ );
87
+
88
+ const checkboxClass = computed(() =>
89
+ escDark.value
90
+ ? 'h-4 w-4 rounded border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] text-[var(--esc-panel-accent)] focus:ring-[var(--esc-panel-accent)]/20'
91
+ : 'h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500',
92
+ );
93
+
94
+ const toggleBtnClass = computed(() =>
95
+ escDark.value
96
+ ? 'rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface)] px-3 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] hover:bg-[var(--esc-panel-surface-alt)] transition-colors'
97
+ : 'rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-600 hover:bg-gray-50 transition-colors',
98
+ );
99
+
100
+ const labelClass = computed(() =>
101
+ escDark.value ? 'text-xs font-medium text-[var(--esc-panel-text-tertiary)]' : 'text-xs font-medium text-gray-500',
102
+ );
103
+
104
+ const hasActiveFilters = computed(() => {
105
+ return Object.values(filterData).some((v) => v !== '' && v !== null && v !== undefined);
106
+ });
107
+
108
+ defineExpose({ filterData });
109
+ </script>
110
+
111
+ <template>
112
+ <div class="space-y-3">
113
+ <div class="flex flex-wrap items-center gap-3">
114
+ <input
115
+ v-model="filterData.search"
116
+ type="text"
117
+ placeholder="Search tickets..."
118
+ aria-label="Search tickets"
119
+ :class="inputClass"
120
+ />
121
+ <button type="button" :class="toggleBtnClass" @click="showAdvanced = !showAdvanced">
122
+ {{ showAdvanced ? 'Simple' : 'Advanced' }}
123
+ </button>
124
+ <button
125
+ v-if="hasActiveFilters"
126
+ type="button"
127
+ :class="[
128
+ 'rounded-md px-3 py-1.5 text-sm font-medium transition-colors',
129
+ escDark
130
+ ? 'bg-cyan-600/20 text-cyan-400 hover:bg-cyan-600/30'
131
+ : 'bg-blue-50 text-blue-700 hover:bg-blue-100',
132
+ ]"
133
+ @click="emit('save-view')"
134
+ >
135
+ Save as View
136
+ </button>
137
+ <select v-model="filterData.status" aria-label="Filter by status" :class="selectClass">
138
+ <option value="">All Statuses</option>
139
+ <option v-for="s in statuses" :key="s" :value="s">{{ s.replace(/_/g, ' ') }}</option>
140
+ </select>
141
+ <select v-model="filterData.priority" aria-label="Filter by priority" :class="selectClass">
142
+ <option value="">All Priorities</option>
143
+ <option v-for="p in priorities" :key="p" :value="p">{{ p }}</option>
144
+ </select>
145
+ <select v-model="filterData.ticket_type" aria-label="Filter by type" :class="selectClass">
146
+ <option value="">All Types</option>
147
+ <option value="question">Question</option>
148
+ <option value="problem">Problem</option>
149
+ <option value="incident">Incident</option>
150
+ <option value="task">Task</option>
151
+ </select>
152
+ <select
153
+ v-if="agents.length"
154
+ v-model="filterData.assigned_to"
155
+ aria-label="Filter by agent"
156
+ :class="selectClass"
157
+ >
158
+ <option value="">All Agents</option>
159
+ <option v-for="a in agents" :key="a.id" :value="a.id">{{ a.name }}</option>
160
+ </select>
161
+ <select
162
+ v-if="departments.length"
163
+ v-model="filterData.department_id"
164
+ aria-label="Filter by department"
165
+ :class="selectClass"
166
+ >
167
+ <option value="">All Departments</option>
168
+ <option v-for="d in departments" :key="d.id" :value="d.id">{{ d.name }}</option>
169
+ </select>
170
+ <label v-if="showFollowing" class="flex items-center gap-2">
171
+ <input
172
+ v-model="filterData.following"
173
+ type="checkbox"
174
+ true-value="1"
175
+ false-value=""
176
+ :class="checkboxClass"
177
+ />
178
+ <span :class="['text-sm', escDark ? 'text-[var(--esc-panel-text-tertiary)]' : 'text-gray-600']"
179
+ >Following</span
180
+ >
181
+ </label>
182
+ </div>
183
+
184
+ <!-- Advanced filters -->
185
+ <div
186
+ v-if="showAdvanced"
187
+ class="flex flex-wrap items-end gap-4 rounded-lg border p-3"
188
+ :class="
189
+ escDark
190
+ ? 'border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)]'
191
+ : 'border-gray-200 bg-gray-50'
192
+ "
193
+ >
194
+ <div class="flex flex-col gap-1">
195
+ <label :class="labelClass">Created after</label>
196
+ <input
197
+ v-model="filterData.created_after"
198
+ type="date"
199
+ aria-label="Created after date"
200
+ :class="inputClass"
201
+ />
202
+ </div>
203
+ <div class="flex flex-col gap-1">
204
+ <label :class="labelClass">Created before</label>
205
+ <input
206
+ v-model="filterData.created_before"
207
+ type="date"
208
+ aria-label="Created before date"
209
+ :class="inputClass"
210
+ />
211
+ </div>
212
+ <div class="flex flex-col gap-1">
213
+ <label :class="labelClass">Tag</label>
214
+ <input
215
+ v-model="filterData.tag"
216
+ type="text"
217
+ placeholder="Tag name..."
218
+ aria-label="Filter by tag name"
219
+ :class="inputClass"
220
+ />
221
+ </div>
222
+ <div class="flex flex-col gap-1">
223
+ <label :class="labelClass">Requester</label>
224
+ <input
225
+ v-model="filterData.requester"
226
+ type="text"
227
+ placeholder="Name or email..."
228
+ aria-label="Filter by requester"
229
+ :class="inputClass"
230
+ />
231
+ </div>
232
+ <label class="flex items-center gap-2 self-center pt-4">
233
+ <input
234
+ v-model="filterData.has_attachments"
235
+ type="checkbox"
236
+ true-value="1"
237
+ false-value=""
238
+ :class="checkboxClass"
239
+ />
240
+ <span :class="['text-sm', escDark ? 'text-[var(--esc-panel-text-tertiary)]' : 'text-gray-600']"
241
+ >Has attachments</span
242
+ >
243
+ </label>
244
+ <label class="flex items-center gap-2 self-center pt-4">
245
+ <input
246
+ v-model="filterData.snoozed"
247
+ type="checkbox"
248
+ true-value="1"
249
+ false-value=""
250
+ :class="checkboxClass"
251
+ />
252
+ <span :class="['text-sm', escDark ? 'text-[var(--esc-panel-text-tertiary)]' : 'text-gray-600']"
253
+ >Snoozed</span
254
+ >
255
+ </label>
256
+ <label class="flex items-center gap-2 self-center pt-4">
257
+ <input
258
+ v-model="filterData.live_chat"
259
+ type="checkbox"
260
+ true-value="1"
261
+ false-value=""
262
+ :class="checkboxClass"
263
+ />
264
+ <span :class="['text-sm', escDark ? 'text-[var(--esc-panel-text-tertiary)]' : 'text-gray-600']"
265
+ >Live Chats</span
266
+ >
267
+ </label>
268
+ </div>
269
+ </div>
270
+ </template>