@escalated-dev/escalated 0.2.1
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.
- package/LICENSE +21 -0
- package/README.md +190 -0
- package/package.json +37 -0
- package/src/components/ActivityTimeline.vue +62 -0
- package/src/components/AssigneeSelect.vue +19 -0
- package/src/components/AttachmentList.vue +31 -0
- package/src/components/EscalatedLayout.vue +213 -0
- package/src/components/FileDropzone.vue +36 -0
- package/src/components/PriorityBadge.vue +21 -0
- package/src/components/ReplyComposer.vue +110 -0
- package/src/components/ReplyThread.vue +30 -0
- package/src/components/SlaTimer.vue +43 -0
- package/src/components/StatsCard.vue +26 -0
- package/src/components/StatusBadge.vue +24 -0
- package/src/components/TagSelect.vue +49 -0
- package/src/components/TicketFilters.vue +52 -0
- package/src/components/TicketList.vue +51 -0
- package/src/components/TicketSidebar.vue +70 -0
- package/src/index.js +19 -0
- package/src/pages/Admin/CannedResponses/Index.vue +58 -0
- package/src/pages/Admin/Departments/Form.vue +50 -0
- package/src/pages/Admin/Departments/Index.vue +49 -0
- package/src/pages/Admin/EscalationRules/Form.vue +95 -0
- package/src/pages/Admin/EscalationRules/Index.vue +49 -0
- package/src/pages/Admin/Reports.vue +52 -0
- package/src/pages/Admin/SlaPolicies/Form.vue +74 -0
- package/src/pages/Admin/SlaPolicies/Index.vue +51 -0
- package/src/pages/Admin/Tags/Index.vue +80 -0
- package/src/pages/Agent/Dashboard.vue +51 -0
- package/src/pages/Agent/TicketIndex.vue +21 -0
- package/src/pages/Agent/TicketShow.vue +108 -0
- package/src/pages/Customer/Create.vue +66 -0
- package/src/pages/Customer/Index.vue +24 -0
- package/src/pages/Customer/Show.vue +55 -0
- package/src/plugin.js +65 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import EscalatedLayout from '../../components/EscalatedLayout.vue';
|
|
3
|
+
import FileDropzone from '../../components/FileDropzone.vue';
|
|
4
|
+
import { useForm } from '@inertiajs/vue3';
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
departments: Array,
|
|
8
|
+
priorities: Array,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const form = useForm({
|
|
12
|
+
subject: '',
|
|
13
|
+
description: '',
|
|
14
|
+
priority: 'medium',
|
|
15
|
+
department_id: '',
|
|
16
|
+
attachments: [],
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
function submit() {
|
|
20
|
+
form.post(route('escalated.customer.tickets.store'));
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<EscalatedLayout title="Create Ticket">
|
|
26
|
+
<form @submit.prevent="submit" class="mx-auto max-w-2xl space-y-6 rounded-lg border border-gray-200 bg-white p-6">
|
|
27
|
+
<div>
|
|
28
|
+
<label class="block text-sm font-medium text-gray-700">Subject</label>
|
|
29
|
+
<input v-model="form.subject" type="text" required
|
|
30
|
+
class="mt-1 w-full rounded-lg border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" />
|
|
31
|
+
<div v-if="form.errors.subject" class="mt-1 text-sm text-red-600">{{ form.errors.subject }}</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div>
|
|
34
|
+
<label class="block text-sm font-medium text-gray-700">Description</label>
|
|
35
|
+
<textarea v-model="form.description" rows="6" required
|
|
36
|
+
class="mt-1 w-full rounded-lg border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500"></textarea>
|
|
37
|
+
<div v-if="form.errors.description" class="mt-1 text-sm text-red-600">{{ form.errors.description }}</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="grid grid-cols-2 gap-4">
|
|
40
|
+
<div>
|
|
41
|
+
<label class="block text-sm font-medium text-gray-700">Priority</label>
|
|
42
|
+
<select v-model="form.priority" class="mt-1 w-full rounded-lg border-gray-300 shadow-sm">
|
|
43
|
+
<option v-for="p in priorities" :key="p" :value="p" class="capitalize">{{ p }}</option>
|
|
44
|
+
</select>
|
|
45
|
+
</div>
|
|
46
|
+
<div>
|
|
47
|
+
<label class="block text-sm font-medium text-gray-700">Department</label>
|
|
48
|
+
<select v-model="form.department_id" class="mt-1 w-full rounded-lg border-gray-300 shadow-sm">
|
|
49
|
+
<option value="">None</option>
|
|
50
|
+
<option v-for="d in departments" :key="d.id" :value="d.id">{{ d.name }}</option>
|
|
51
|
+
</select>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
<div>
|
|
55
|
+
<label class="block text-sm font-medium text-gray-700 mb-1">Attachments</label>
|
|
56
|
+
<FileDropzone v-model="form.attachments" />
|
|
57
|
+
</div>
|
|
58
|
+
<div class="flex justify-end">
|
|
59
|
+
<button type="submit" :disabled="form.processing"
|
|
60
|
+
class="rounded-lg bg-indigo-600 px-6 py-2 text-sm font-medium text-white hover:bg-indigo-700 disabled:opacity-50">
|
|
61
|
+
{{ form.processing ? 'Creating...' : 'Create Ticket' }}
|
|
62
|
+
</button>
|
|
63
|
+
</div>
|
|
64
|
+
</form>
|
|
65
|
+
</EscalatedLayout>
|
|
66
|
+
</template>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import EscalatedLayout from '../../components/EscalatedLayout.vue';
|
|
3
|
+
import TicketList from '../../components/TicketList.vue';
|
|
4
|
+
import TicketFilters from '../../components/TicketFilters.vue';
|
|
5
|
+
import { Link } from '@inertiajs/vue3';
|
|
6
|
+
|
|
7
|
+
defineProps({
|
|
8
|
+
tickets: Object,
|
|
9
|
+
filters: Object,
|
|
10
|
+
});
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<EscalatedLayout title="My Tickets">
|
|
15
|
+
<div class="mb-6 flex items-center justify-between">
|
|
16
|
+
<TicketFilters :filters="filters" :route="route('escalated.customer.tickets.index')" />
|
|
17
|
+
<Link :href="route('escalated.customer.tickets.create')"
|
|
18
|
+
class="rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700">
|
|
19
|
+
New Ticket
|
|
20
|
+
</Link>
|
|
21
|
+
</div>
|
|
22
|
+
<TicketList :tickets="tickets" route-prefix="escalated.customer.tickets" />
|
|
23
|
+
</EscalatedLayout>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import EscalatedLayout from '../../components/EscalatedLayout.vue';
|
|
3
|
+
import StatusBadge from '../../components/StatusBadge.vue';
|
|
4
|
+
import PriorityBadge from '../../components/PriorityBadge.vue';
|
|
5
|
+
import ReplyThread from '../../components/ReplyThread.vue';
|
|
6
|
+
import ReplyComposer from '../../components/ReplyComposer.vue';
|
|
7
|
+
import AttachmentList from '../../components/AttachmentList.vue';
|
|
8
|
+
import { router, usePage } from '@inertiajs/vue3';
|
|
9
|
+
|
|
10
|
+
const props = defineProps({ ticket: Object });
|
|
11
|
+
const page = usePage();
|
|
12
|
+
|
|
13
|
+
function closeTicket() {
|
|
14
|
+
router.post(route('escalated.customer.tickets.close', props.ticket.reference));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function reopenTicket() {
|
|
18
|
+
router.post(route('escalated.customer.tickets.reopen', props.ticket.reference));
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<EscalatedLayout :title="ticket.subject">
|
|
24
|
+
<div class="mb-4 flex flex-wrap items-center gap-3">
|
|
25
|
+
<span class="text-sm font-medium text-gray-500">{{ ticket.reference }}</span>
|
|
26
|
+
<StatusBadge :status="ticket.status" />
|
|
27
|
+
<PriorityBadge :priority="ticket.priority" />
|
|
28
|
+
<span v-if="ticket.department" class="text-sm text-gray-500">{{ ticket.department.name }}</span>
|
|
29
|
+
<div class="ml-auto flex gap-2">
|
|
30
|
+
<button v-if="ticket.status === 'resolved' || ticket.status === 'closed'"
|
|
31
|
+
@click="reopenTicket"
|
|
32
|
+
class="rounded-lg border border-gray-300 px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50">
|
|
33
|
+
Reopen
|
|
34
|
+
</button>
|
|
35
|
+
<button v-if="ticket.status !== 'closed' && ticket.status !== 'resolved'"
|
|
36
|
+
@click="closeTicket"
|
|
37
|
+
class="rounded-lg border border-red-300 px-3 py-1.5 text-sm text-red-600 hover:bg-red-50">
|
|
38
|
+
Close Ticket
|
|
39
|
+
</button>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="mb-6 rounded-lg border border-gray-200 bg-white p-4">
|
|
43
|
+
<p class="whitespace-pre-wrap text-sm text-gray-700">{{ ticket.description }}</p>
|
|
44
|
+
<AttachmentList v-if="ticket.attachments?.length" :attachments="ticket.attachments" class="mt-3" />
|
|
45
|
+
</div>
|
|
46
|
+
<div class="mb-6">
|
|
47
|
+
<h2 class="mb-4 text-lg font-semibold text-gray-900">Replies</h2>
|
|
48
|
+
<ReplyThread :replies="ticket.replies || []" :current-user-id="page.props.auth?.user?.id" />
|
|
49
|
+
</div>
|
|
50
|
+
<div v-if="ticket.status !== 'closed'" class="rounded-lg border border-gray-200 bg-white p-4">
|
|
51
|
+
<h2 class="mb-4 text-lg font-semibold text-gray-900">Reply</h2>
|
|
52
|
+
<ReplyComposer :action="route('escalated.customer.tickets.reply', ticket.reference)" />
|
|
53
|
+
</div>
|
|
54
|
+
</EscalatedLayout>
|
|
55
|
+
</template>
|
package/src/plugin.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { markRaw } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* EscalatedPlugin — Vue plugin for integrating Escalated into your app's design system.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* import { EscalatedPlugin } from '@escalated-dev/escalated'
|
|
8
|
+
* import AppLayout from '@/Layouts/AppLayout.vue'
|
|
9
|
+
*
|
|
10
|
+
* app.use(EscalatedPlugin, {
|
|
11
|
+
* layout: AppLayout,
|
|
12
|
+
* theme: {
|
|
13
|
+
* primary: '#3b82f6',
|
|
14
|
+
* radius: '0.75rem',
|
|
15
|
+
* }
|
|
16
|
+
* })
|
|
17
|
+
*/
|
|
18
|
+
export const EscalatedPlugin = {
|
|
19
|
+
install(app, options = {}) {
|
|
20
|
+
if (options.layout) {
|
|
21
|
+
app.provide('escalated-layout', markRaw(options.layout));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (options.theme) {
|
|
25
|
+
app.provide('escalated-theme', options.theme);
|
|
26
|
+
applyTheme(options.theme);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const themeDefaults = {
|
|
32
|
+
primary: '#4f46e5',
|
|
33
|
+
primaryHover: null,
|
|
34
|
+
radius: '0.5rem',
|
|
35
|
+
radiusLg: null,
|
|
36
|
+
fontFamily: null,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
function applyTheme(theme) {
|
|
40
|
+
const merged = { ...themeDefaults, ...theme };
|
|
41
|
+
const style = document.documentElement.style;
|
|
42
|
+
|
|
43
|
+
style.setProperty('--esc-primary', merged.primary);
|
|
44
|
+
style.setProperty('--esc-primary-hover', merged.primaryHover || darken(merged.primary, 10));
|
|
45
|
+
style.setProperty('--esc-radius', merged.radius);
|
|
46
|
+
style.setProperty('--esc-radius-lg', merged.radiusLg || scaleBorderRadius(merged.radius, 1.5));
|
|
47
|
+
|
|
48
|
+
if (merged.fontFamily) {
|
|
49
|
+
style.setProperty('--esc-font-family', merged.fontFamily);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function darken(hex, percent) {
|
|
54
|
+
const num = parseInt(hex.replace('#', ''), 16);
|
|
55
|
+
const r = Math.max(0, (num >> 16) - Math.round(2.55 * percent));
|
|
56
|
+
const g = Math.max(0, ((num >> 8) & 0x00ff) - Math.round(2.55 * percent));
|
|
57
|
+
const b = Math.max(0, (num & 0x0000ff) - Math.round(2.55 * percent));
|
|
58
|
+
return `#${(r << 16 | g << 8 | b).toString(16).padStart(6, '0')}`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function scaleBorderRadius(radius, factor) {
|
|
62
|
+
const match = radius.match(/^([\d.]+)(.*)$/);
|
|
63
|
+
if (!match) return radius;
|
|
64
|
+
return `${(parseFloat(match[1]) * factor).toFixed(2)}${match[2] || 'rem'}`;
|
|
65
|
+
}
|