lesli_support 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +5 -0
- data/app/assets/config/lesli_support_manifest.js +38 -0
- data/app/assets/images/lesli_support/support-logo.svg +9 -0
- data/app/assets/javascripts/lesli_support/application.js +5011 -0
- data/app/assets/stylesheets/lesli_support/application.css +9 -0
- data/app/controllers/lesli_support/accounts_controller.rb +60 -0
- data/app/controllers/lesli_support/application_controller.rb +4 -0
- data/app/controllers/lesli_support/catalog_categories_controller.rb +60 -0
- data/app/controllers/lesli_support/catalog_priorities_controller.rb +60 -0
- data/app/controllers/lesli_support/catalog_types_controller.rb +60 -0
- data/app/controllers/lesli_support/catalog_workspaces_controller.rb +60 -0
- data/app/controllers/lesli_support/catalogs_controller.rb +12 -0
- data/app/controllers/lesli_support/dashboard/components_controller.rb +92 -0
- data/app/controllers/lesli_support/dashboards_controller.rb +36 -0
- data/app/controllers/lesli_support/options_controller.rb +23 -0
- data/app/controllers/lesli_support/ticket/discussions_controller.rb +5 -0
- data/app/controllers/lesli_support/tickets_controller.rb +169 -0
- data/app/helpers/lesli_support/accounts_helper.rb +4 -0
- data/app/helpers/lesli_support/application_helper.rb +4 -0
- data/app/helpers/lesli_support/catalog_categories_helper.rb +4 -0
- data/app/helpers/lesli_support/catalog_priorities_helper.rb +4 -0
- data/app/helpers/lesli_support/catalog_types_helper.rb +4 -0
- data/app/helpers/lesli_support/catalog_workspaces_helper.rb +4 -0
- data/app/helpers/lesli_support/catalogs_helper.rb +4 -0
- data/app/helpers/lesli_support/dashboards_helper.rb +4 -0
- data/app/helpers/lesli_support/options_helper.rb +4 -0
- data/app/helpers/lesli_support/ticket/discussions_helper.rb +4 -0
- data/app/jobs/lesli_support/application_job.rb +4 -0
- data/app/mailers/lesli_support/application_mailer.rb +6 -0
- data/app/models/lesli_support/account.rb +48 -0
- data/app/models/lesli_support/application_record.rb +5 -0
- data/app/models/lesli_support/catalog.rb +15 -0
- data/app/models/lesli_support/catalog_category.rb +5 -0
- data/app/models/lesli_support/catalog_priority.rb +5 -0
- data/app/models/lesli_support/catalog_type.rb +5 -0
- data/app/models/lesli_support/catalog_workspace.rb +5 -0
- data/app/models/lesli_support/dashboard/component.rb +18 -0
- data/app/models/lesli_support/dashboard.rb +15 -0
- data/app/models/lesli_support/option.rb +4 -0
- data/app/models/lesli_support/ticket/discussion.rb +7 -0
- data/app/models/lesli_support/ticket.rb +44 -0
- data/app/services/lesli_support/catalog_service.rb +139 -0
- data/app/services/lesli_support/ticket_service.rb +147 -0
- data/app/views/layouts/lesli_support/application.html.erb +15 -0
- data/app/views/lesli_support/accounts/_account.html.erb +2 -0
- data/app/views/lesli_support/accounts/_form.html.erb +17 -0
- data/app/views/lesli_support/accounts/edit.html.erb +10 -0
- data/app/views/lesli_support/accounts/index.html.erb +14 -0
- data/app/views/lesli_support/accounts/new.html.erb +9 -0
- data/app/views/lesli_support/accounts/show.html.erb +10 -0
- data/app/views/lesli_support/catalog_categories/_catalog_category.html.erb +2 -0
- data/app/views/lesli_support/catalog_categories/_form.html.erb +17 -0
- data/app/views/lesli_support/catalog_categories/edit.html.erb +10 -0
- data/app/views/lesli_support/catalog_categories/index.html.erb +14 -0
- data/app/views/lesli_support/catalog_categories/new.html.erb +9 -0
- data/app/views/lesli_support/catalog_categories/show.html.erb +10 -0
- data/app/views/lesli_support/catalog_priorities/_catalog_priority.html.erb +2 -0
- data/app/views/lesli_support/catalog_priorities/_form.html.erb +17 -0
- data/app/views/lesli_support/catalog_priorities/edit.html.erb +10 -0
- data/app/views/lesli_support/catalog_priorities/index.html.erb +14 -0
- data/app/views/lesli_support/catalog_priorities/new.html.erb +9 -0
- data/app/views/lesli_support/catalog_priorities/show.html.erb +10 -0
- data/app/views/lesli_support/catalog_types/_catalog_type.html.erb +2 -0
- data/app/views/lesli_support/catalog_types/_form.html.erb +17 -0
- data/app/views/lesli_support/catalog_types/edit.html.erb +10 -0
- data/app/views/lesli_support/catalog_types/index.html.erb +14 -0
- data/app/views/lesli_support/catalog_types/new.html.erb +9 -0
- data/app/views/lesli_support/catalog_types/show.html.erb +10 -0
- data/app/views/lesli_support/catalog_workspaces/_catalog_workspace.html.erb +2 -0
- data/app/views/lesli_support/catalog_workspaces/_form.html.erb +17 -0
- data/app/views/lesli_support/catalog_workspaces/edit.html.erb +10 -0
- data/app/views/lesli_support/catalog_workspaces/index.html.erb +14 -0
- data/app/views/lesli_support/catalog_workspaces/new.html.erb +9 -0
- data/app/views/lesli_support/catalog_workspaces/show.html.erb +10 -0
- data/app/views/lesli_support/catalogs/_catalog.html.erb +2 -0
- data/app/views/lesli_support/catalogs/_form.html.erb +17 -0
- data/app/views/lesli_support/catalogs/edit.html.erb +10 -0
- data/app/views/lesli_support/catalogs/index.html.erb +14 -0
- data/app/views/lesli_support/catalogs/new.html.erb +9 -0
- data/app/views/lesli_support/catalogs/show.html.erb +10 -0
- data/app/views/lesli_support/dashboards/edit.html.erb +1 -0
- data/app/views/lesli_support/dashboards/index.html.erb +1 -0
- data/app/views/lesli_support/dashboards/new.html.erb +1 -0
- data/app/views/lesli_support/dashboards/show.html.erb +1 -0
- data/app/views/lesli_support/options/_form.html.erb +17 -0
- data/app/views/lesli_support/options/_option.html.erb +2 -0
- data/app/views/lesli_support/options/edit.html.erb +10 -0
- data/app/views/lesli_support/options/index.html.erb +14 -0
- data/app/views/lesli_support/options/new.html.erb +9 -0
- data/app/views/lesli_support/options/show.html.erb +10 -0
- data/app/views/lesli_support/partials/_engine-navigation.html.erb +39 -0
- data/app/views/lesli_support/ticket/discussions/_discussion.html.erb +2 -0
- data/app/views/lesli_support/ticket/discussions/_form.html.erb +17 -0
- data/app/views/lesli_support/ticket/discussions/edit.html.erb +10 -0
- data/app/views/lesli_support/ticket/discussions/index.html.erb +14 -0
- data/app/views/lesli_support/ticket/discussions/new.html.erb +9 -0
- data/app/views/lesli_support/ticket/discussions/show.html.erb +10 -0
- data/app/views/lesli_support/tickets/edit.html.erb +20 -0
- data/app/views/lesli_support/tickets/index.html.erb +34 -0
- data/app/views/lesli_support/tickets/new.html.erb +20 -0
- data/app/views/lesli_support/tickets/show.html.erb +20 -0
- data/config/locales/translations.en.yml +43 -0
- data/config/locales/translations.es.yml +43 -0
- data/config/locales/translations.fr.yml +43 -0
- data/config/locales/translations.it.yml +43 -0
- data/config/locales/translations.pt.yml +43 -0
- data/config/routes.rb +61 -0
- data/db/migrate/v1/0702000110_create_lesli_support_accounts.rb +42 -0
- data/db/migrate/v1/0702000210_create_lesli_support_account_settings.rb +46 -0
- data/db/migrate/v1/0702010110_create_lesli_support_catalog_workspaces.rb +43 -0
- data/db/migrate/v1/0702010210_create_lesli_support_catalog_types.rb +42 -0
- data/db/migrate/v1/0702010310_create_lesli_support_catalog_categories.rb +43 -0
- data/db/migrate/v1/0702010410_create_lesli_support_catalog_priorities.rb +43 -0
- data/db/migrate/v1/0702050110_create_lesli_support_dashboards.rb +50 -0
- data/db/migrate/v1/0702050210_create_lesli_support_dashboard_components.rb +50 -0
- data/db/migrate/v1/0702100110_create_lesli_support_slas.rb +59 -0
- data/db/migrate/v1/0702110110_create_lesli_support_tickets.rb +99 -0
- data/db/migrate/v1/0702110510_create_lesli_support_ticket_discussions.rb +52 -0
- data/db/seed/development.rb +62 -0
- data/db/seed/production.rb +31 -0
- data/db/seed/test.rb +31 -0
- data/db/seeds.rb +45 -0
- data/db/tables/0702010510_create_cloud_help_catalog_ticket_sources.rb +44 -0
- data/db/tables/0702020110_create_cloud_help_workflows.rb +47 -0
- data/db/tables/0702020210_create_cloud_help_workflow_statuses.rb +47 -0
- data/db/tables/0702020310_create_cloud_help_workflow_associations.rb +29 -0
- data/db/tables/0702020410_create_cloud_help_workflow_actions.rb +18 -0
- data/db/tables/0702020510_create_cloud_help_workflow_checks.rb +20 -0
- data/db/tables/0702030110_create_cloud_help_custom_fields.rb +15 -0
- data/db/tables/0702040110_create_cloud_help_custom_validations.rb +16 -0
- data/db/tables/0702040210_create_cloud_help_custom_validation_rules.rb +16 -0
- data/db/tables/0702040310_create_cloud_help_custom_validation_fields.rb +16 -0
- data/db/tables/0702100310_create_cloud_help_ticket_actions.rb +16 -0
- data/db/tables/0702100410_create_cloud_help_ticket_activities.rb +15 -0
- data/db/tables/0702100610_create_cloud_help_ticket_files.rb +16 -0
- data/db/tables/0702100710_create_cloud_help_ticket_subscribers.rb +16 -0
- data/db/tables/0702101010_create_cloud_help_ticket_timelines.rb +14 -0
- data/db/tables/0702101110_create_cloud_help_ticket_assignments.rb +15 -0
- data/db/tables/0702101210_create_cloud_help_ticket_histories.rb +15 -0
- data/db/tables/0702110310_create_cloud_help_sla_actions.rb +17 -0
- data/db/tables/0702110410_create_cloud_help_sla_activities.rb +15 -0
- data/db/tables/0702110510_create_cloud_help_sla_discussions.rb +17 -0
- data/db/tables/0702110610_create_cloud_help_sla_files.rb +16 -0
- data/db/tables/0702110710_create_cloud_help_sla_subscribers.rb +16 -0
- data/db/tables/0702111010_create_cloud_help_sla_associations.rb +13 -0
- data/lib/lesli_support/engine.rb +50 -0
- data/lib/lesli_support/version.rb +4 -0
- data/lib/lesli_support.rb +6 -0
- data/lib/scss/application.scss +11 -0
- data/lib/tasks/lesli_support_tasks.rake +4 -0
- data/lib/vue/application.js +93 -0
- data/lib/vue/apps/dashboard/components/engine-version.vue +71 -0
- data/lib/vue/apps/dashboard/components/my-tasks.vue +77 -0
- data/lib/vue/apps/tickets/components/assignments.vue +93 -0
- data/lib/vue/apps/tickets/components/form.vue +305 -0
- data/lib/vue/apps/tickets/components/internal-comments.vue +107 -0
- data/lib/vue/apps/tickets/components/sla-info.vue +115 -0
- data/lib/vue/apps/tickets/index.vue +145 -0
- data/lib/vue/apps/tickets/new.vue +78 -0
- data/lib/vue/apps/tickets/show.vue +183 -0
- data/lib/vue/stores/tickets.js +276 -0
- data/lib/vue/stores/translations.json +272 -0
- data/readme.md +72 -0
- metadata +223 -0
@@ -0,0 +1,78 @@
|
|
1
|
+
<script setup>
|
2
|
+
/*
|
3
|
+
Lesli
|
4
|
+
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
6
|
+
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
This program is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU General Public License
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
19
|
+
|
20
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
21
|
+
|
22
|
+
Made with ♥ by https://www.lesli.tech
|
23
|
+
Building a better future, one line of code at a time.
|
24
|
+
|
25
|
+
@contact hello@lesli.tech
|
26
|
+
@website https://www.lesli.tech
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
28
|
+
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
30
|
+
// ·
|
31
|
+
*/
|
32
|
+
|
33
|
+
|
34
|
+
// · import vue tools
|
35
|
+
import { onMounted, inject } from "vue"
|
36
|
+
import { useRouter } from "vue-router"
|
37
|
+
import { useLesliMsg } from "/Users/ldonis/code/Lesli/lesli-vue/source/composables/msg/msg.js"
|
38
|
+
|
39
|
+
const msg = useLesliMsg()
|
40
|
+
|
41
|
+
|
42
|
+
// .
|
43
|
+
const url = inject("url")
|
44
|
+
|
45
|
+
|
46
|
+
// . import components
|
47
|
+
import formTicket from "./components/form.vue"
|
48
|
+
|
49
|
+
|
50
|
+
// · import lesli stores
|
51
|
+
import { useTickets } from "LesliSupport/vue/stores/tickets"
|
52
|
+
|
53
|
+
|
54
|
+
// · initialize/inject plugins
|
55
|
+
const router = useRouter()
|
56
|
+
|
57
|
+
|
58
|
+
// · implement stores
|
59
|
+
const storeTickets = useTickets()
|
60
|
+
|
61
|
+
|
62
|
+
//·
|
63
|
+
const translations = {
|
64
|
+
lesli: i18n.t("lesli"),
|
65
|
+
tickets: i18n.t("lesli_support.tickets"),
|
66
|
+
}
|
67
|
+
|
68
|
+
</script>
|
69
|
+
<template>
|
70
|
+
<lesli-application-container>
|
71
|
+
<lesli-header title="Create new ticket">
|
72
|
+
<lesli-button :to="url.support('list')" icon="list">
|
73
|
+
{{ translations.lesli.shared.button_list }}
|
74
|
+
</lesli-button>
|
75
|
+
</lesli-header>
|
76
|
+
<form-ticket editable></form-ticket>
|
77
|
+
</lesli-application-container>
|
78
|
+
</template>
|
@@ -0,0 +1,183 @@
|
|
1
|
+
<script setup>
|
2
|
+
/*
|
3
|
+
Lesli
|
4
|
+
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
6
|
+
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
This program is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU General Public License
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
19
|
+
|
20
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
21
|
+
|
22
|
+
Made with ♥ by https://www.lesli.tech
|
23
|
+
Building a better future, one line of code at a time.
|
24
|
+
|
25
|
+
@contact hello@lesli.tech
|
26
|
+
@website https://www.lesli.tech
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
28
|
+
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
30
|
+
// ·
|
31
|
+
*/
|
32
|
+
|
33
|
+
|
34
|
+
// · import vue tools
|
35
|
+
import { onMounted, computed, inject } from "vue"
|
36
|
+
import { useRouter, useRoute } from "vue-router"
|
37
|
+
|
38
|
+
|
39
|
+
// . import components
|
40
|
+
import formTicket from "./components/form.vue"
|
41
|
+
// import slaInfo from './components/sla-info.vue'
|
42
|
+
// import internalComments from './components/internal-comments.vue'
|
43
|
+
// import assignments from './components/assignments.vue'
|
44
|
+
|
45
|
+
|
46
|
+
import ComponentDiscussions from "Lesli/vue/cloudobjects/discussion.vue"
|
47
|
+
//import ComponentFiles from "Lesli/cloudobjects/components/file.vue"
|
48
|
+
//import ComponentWorkflowStatusDropdown from "Lesli/shared/workflows/components/workflow-status-dropdown.vue"
|
49
|
+
//import ComponentActions from "Lesli/cloudobjects/components/action.vue"
|
50
|
+
|
51
|
+
|
52
|
+
// · import lesli stores
|
53
|
+
import { useTickets } from "LesliSupport/vue/stores/tickets"
|
54
|
+
|
55
|
+
|
56
|
+
// · initialize/inject plugins
|
57
|
+
const route = useRoute()
|
58
|
+
const router = useRouter()
|
59
|
+
const url = inject("url")
|
60
|
+
|
61
|
+
|
62
|
+
// · implement stores
|
63
|
+
const storeTickets = useTickets()
|
64
|
+
|
65
|
+
|
66
|
+
//·
|
67
|
+
const translations = {
|
68
|
+
tickets: i18n.t("lesli_support.tickets"),
|
69
|
+
lesli: {
|
70
|
+
shared: i18n.t("lesli.shared")
|
71
|
+
},
|
72
|
+
|
73
|
+
|
74
|
+
main: I18n.t('help.tickets'),
|
75
|
+
sla: I18n.t('help.slas'),
|
76
|
+
core: {
|
77
|
+
shared: I18n.t('core.shared')
|
78
|
+
},
|
79
|
+
shared: I18n.t('help.shared')
|
80
|
+
}
|
81
|
+
|
82
|
+
|
83
|
+
//·
|
84
|
+
const props = defineProps({
|
85
|
+
editable: {
|
86
|
+
type: Boolean,
|
87
|
+
required: false,
|
88
|
+
default: false,
|
89
|
+
},
|
90
|
+
appMountPath: {
|
91
|
+
type: String,
|
92
|
+
required: false,
|
93
|
+
default: "help/tickets",
|
94
|
+
}
|
95
|
+
})
|
96
|
+
|
97
|
+
|
98
|
+
//·
|
99
|
+
onMounted(() => {
|
100
|
+
if (route.params.id) {
|
101
|
+
storeTickets.fetchTicket(route.params.id)
|
102
|
+
}
|
103
|
+
})
|
104
|
+
|
105
|
+
|
106
|
+
//·
|
107
|
+
const onUpdatedStatus = () => {
|
108
|
+
//storeTickets.getTicket(route.params.id)
|
109
|
+
}
|
110
|
+
|
111
|
+
|
112
|
+
//·
|
113
|
+
const onDelete = () => {
|
114
|
+
storeTickets.deleteTicket().then(()=>{
|
115
|
+
router.push(url.root(`${props.appMountPath}`).s)
|
116
|
+
})
|
117
|
+
}
|
118
|
+
|
119
|
+
</script>
|
120
|
+
<template>
|
121
|
+
<lesli-application-container>
|
122
|
+
<lesli-header :title="`${storeTickets.ticket.subject} (${storeTickets.ticket.status || 'open'})`">
|
123
|
+
<lesli-link button icon="list" :to="url.support('tickets')">
|
124
|
+
{{ translations.lesli.shared.button_list }}
|
125
|
+
</lesli-link>
|
126
|
+
<lesli-link v-if="!props.editable" button warning :to="url.support('tickets/:id/edit', route.params.id)" icon="edit">
|
127
|
+
{{ translations.lesli.shared.button_edit }}
|
128
|
+
</lesli-link>
|
129
|
+
<lesli-link v-if="props.editable" button info :to="url.support('tickets/:id', route.params.id)" icon="visibility">
|
130
|
+
{{ translations.lesli.shared.button_show }}
|
131
|
+
</lesli-link>
|
132
|
+
<lesli-button danger @click="onDelete" icon="delete">
|
133
|
+
{{ translations.lesli.shared.button_delete }}
|
134
|
+
</lesli-button>
|
135
|
+
</lesli-header>
|
136
|
+
|
137
|
+
<lesli-tabs v-model="tab">
|
138
|
+
<lesli-tab-item title="Information" icon="info" paddingless>
|
139
|
+
<form-ticket :path="props.appMountPath" :editable="props.editable"></form-ticket>
|
140
|
+
</lesli-tab-item>
|
141
|
+
<lesli-tab-item title="Discussions" icon="forum">
|
142
|
+
<component-discussions
|
143
|
+
cloud-module="support"
|
144
|
+
cloud-object="tickets"
|
145
|
+
:cloud-object-id="storeTickets.ticket.id"
|
146
|
+
:onlyDiscussions="false">
|
147
|
+
</component-discussions>
|
148
|
+
</lesli-tab-item>
|
149
|
+
</lesli-tabs>
|
150
|
+
<!--
|
151
|
+
<lesli-tab-item title="Information" icon="info" paddingless>
|
152
|
+
<form-ticket :path="props.appMountPath" :editable="props.editable"></form-ticket>
|
153
|
+
</lesli-tab-item>
|
154
|
+
<lesli-tab-item :title="translations.tickets.tab_assignments" icon="group">
|
155
|
+
<assignments></assignments>
|
156
|
+
</lesli-tab-item>
|
157
|
+
<lesli-tab-item :title="translations.lesli.shared.view_files" icon="attach_file">
|
158
|
+
<component-files
|
159
|
+
cloud-module="help"
|
160
|
+
cloud-object="tickets"
|
161
|
+
:cloud-object-id="storeTickets.ticket.id"
|
162
|
+
:accepted-files="['images', 'documents', 'plaintext']">
|
163
|
+
</component-files>
|
164
|
+
</lesli-tab-item>
|
165
|
+
|
166
|
+
<lesli-tab-item :title="translations.main.view_tab_title_histories" icon="comment">
|
167
|
+
<internal-comments></internal-comments>
|
168
|
+
</lesli-tab-item>
|
169
|
+
|
170
|
+
<lesli-tab-item :title="translations.lesli.shared.view_quick_actions" icon="playlist_add_check">
|
171
|
+
<component-actions
|
172
|
+
cloud-module="help"
|
173
|
+
cloud-object="tickets"
|
174
|
+
:cloud-object-id="storeTickets.ticket.id">
|
175
|
+
</component-actions>
|
176
|
+
</lesli-tab-item>
|
177
|
+
|
178
|
+
<lesli-tab-item :title="translations.main.view_tab_title_sla" icon="article" v-if="storeTickets.ticket.sla">
|
179
|
+
<sla-info></sla-info>
|
180
|
+
</lesli-tab-item>
|
181
|
+
-->
|
182
|
+
</lesli-application-container>
|
183
|
+
</template>
|
@@ -0,0 +1,276 @@
|
|
1
|
+
/*
|
2
|
+
Lesli
|
3
|
+
|
4
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
5
|
+
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU General Public License as published by
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
This program is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU General Public License
|
17
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
18
|
+
|
19
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
20
|
+
|
21
|
+
Made with ♥ by https://www.lesli.tech
|
22
|
+
Building a better future, one line of code at a time.
|
23
|
+
|
24
|
+
@contact hello@lesli.tech
|
25
|
+
@website https://www.lesli.tech
|
26
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
27
|
+
|
28
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
29
|
+
// ·
|
30
|
+
*/
|
31
|
+
|
32
|
+
|
33
|
+
// ·
|
34
|
+
import { defineStore } from "pinia"
|
35
|
+
import dayjs from "dayjs"
|
36
|
+
|
37
|
+
|
38
|
+
// ·
|
39
|
+
export const useTickets = defineStore("support.tickets", {
|
40
|
+
state: () => {
|
41
|
+
return {
|
42
|
+
index: {
|
43
|
+
loading: false,
|
44
|
+
records: [],
|
45
|
+
pagination: { page: 1 }
|
46
|
+
},
|
47
|
+
ticket: {
|
48
|
+
id: null,
|
49
|
+
subject: null,
|
50
|
+
description: '',
|
51
|
+
deadline: new Date(),
|
52
|
+
started_at: new Date(),
|
53
|
+
finished_at: new Date(),
|
54
|
+
hours_worked: 0,
|
55
|
+
|
56
|
+
catalog_type_id: null,
|
57
|
+
catalog_source_id: null,
|
58
|
+
catalog_category_id: null,
|
59
|
+
catalog_priority_id: null,
|
60
|
+
catalog_workspace_id: null
|
61
|
+
},
|
62
|
+
|
63
|
+
|
64
|
+
loading: false,
|
65
|
+
tickets: [],
|
66
|
+
options: {},
|
67
|
+
tags: [],
|
68
|
+
workspaces_options: 0,
|
69
|
+
|
70
|
+
filters: {
|
71
|
+
cloud_support_catalog_ticket_workspaces_id: null,
|
72
|
+
search_type: 'active',
|
73
|
+
user_type: null,
|
74
|
+
per_page: 10
|
75
|
+
}
|
76
|
+
}
|
77
|
+
},
|
78
|
+
actions: {
|
79
|
+
|
80
|
+
// Get all the available tickets
|
81
|
+
getTickets() {
|
82
|
+
this.index.records = []
|
83
|
+
this.index.loading = true
|
84
|
+
|
85
|
+
var endpoint = this.url.support("tickets")
|
86
|
+
.paginate(this.index.pagination.page)
|
87
|
+
|
88
|
+
this.http.get(endpoint).then(result => {
|
89
|
+
this.index.records = result.records.map(ticket => {
|
90
|
+
if (ticket.deadline != null){
|
91
|
+
ticket.deadline = this.date(ticket.deadline).date()
|
92
|
+
}
|
93
|
+
return ticket
|
94
|
+
})
|
95
|
+
}).catch(error => {
|
96
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
97
|
+
}).finally(() => {
|
98
|
+
this.index.loading = false
|
99
|
+
})
|
100
|
+
},
|
101
|
+
|
102
|
+
|
103
|
+
// Create a new ticket
|
104
|
+
postTicket() {
|
105
|
+
return this.http.post(this.url.support('tickets'), {
|
106
|
+
ticket: {
|
107
|
+
...this.ticket
|
108
|
+
}
|
109
|
+
})
|
110
|
+
},
|
111
|
+
|
112
|
+
// Ticket options
|
113
|
+
getOptions() {
|
114
|
+
this.loading = true
|
115
|
+
this.options = {}
|
116
|
+
this.http.get(this.url.support("options")).then(result => {
|
117
|
+
|
118
|
+
this.options.types = result.types.map((type)=> {
|
119
|
+
return {
|
120
|
+
label: type.name,
|
121
|
+
value: type.id
|
122
|
+
}
|
123
|
+
})
|
124
|
+
|
125
|
+
this.options.categories = result.categories.map((category)=> {
|
126
|
+
return {
|
127
|
+
label: category.name,
|
128
|
+
value: category.id
|
129
|
+
}
|
130
|
+
})
|
131
|
+
|
132
|
+
this.options.priorities = result.priorities.map((priority)=> {
|
133
|
+
return {
|
134
|
+
label: priority.name,
|
135
|
+
value: priority.id
|
136
|
+
}
|
137
|
+
})
|
138
|
+
|
139
|
+
this.options.workspaces = result.workspaces.map((workspace)=> {
|
140
|
+
return {
|
141
|
+
label: workspace.name,
|
142
|
+
value: workspace.id
|
143
|
+
}
|
144
|
+
})
|
145
|
+
}).catch(error => {
|
146
|
+
console.log(error)
|
147
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
148
|
+
}).finally(() => {
|
149
|
+
this.loading = false
|
150
|
+
})
|
151
|
+
|
152
|
+
},
|
153
|
+
|
154
|
+
updateTicket(){
|
155
|
+
|
156
|
+
//Veriy if tags in tickets were selected
|
157
|
+
let selected_tags = null
|
158
|
+
if (this.tags.length > 0) {
|
159
|
+
selected_tags = this.tags.map(tag => tag.name).join(',')
|
160
|
+
} else{
|
161
|
+
selected_tags = null
|
162
|
+
}
|
163
|
+
|
164
|
+
this.http.put(this.url.support('tickets/:id', this.ticket.id), {
|
165
|
+
ticket: {
|
166
|
+
//tags: selected_tags
|
167
|
+
subject: this.ticket.subject,
|
168
|
+
description: this.ticket.description,
|
169
|
+
hours_worked: this.ticket.hours_worked,
|
170
|
+
deadline: this.ticket.deadline,
|
171
|
+
started_at: this.ticket.started_at,
|
172
|
+
completed_at: this.ticket.completed_at,
|
173
|
+
catalog_workspace_id: this.ticket.catalog_workspace_id,
|
174
|
+
catalog_type_id: this.ticket.catalog_type_id,
|
175
|
+
catalog_category_id: this.ticket.catalog_category_id,
|
176
|
+
catalog_priority_id: this.ticket.catalog_priority_id
|
177
|
+
}
|
178
|
+
}).then(result => {
|
179
|
+
this.msg.success(I18n.t("core.users.messages_success_operation"))
|
180
|
+
}).catch(error => {
|
181
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
182
|
+
})
|
183
|
+
},
|
184
|
+
|
185
|
+
fetchTicket(id) {
|
186
|
+
if (!this.ticket.id) {
|
187
|
+
this.getTicket(id)
|
188
|
+
}
|
189
|
+
},
|
190
|
+
|
191
|
+
getTicket(id) {
|
192
|
+
|
193
|
+
this.loading = true
|
194
|
+
this.ticket = {}
|
195
|
+
const url = this.url.support('tickets/:id', id)
|
196
|
+
|
197
|
+
this.http.get(url).then(result => {
|
198
|
+
this.ticket = result
|
199
|
+
|
200
|
+
// Get the list of tags from a ticket and parse to a format used by the input tag component
|
201
|
+
// this.tags = []
|
202
|
+
// if (this.ticket.tags != null) {
|
203
|
+
// this.ticket.tags.split(',').forEach((tag)=>{
|
204
|
+
// this.tags.push({name: tag})
|
205
|
+
// })
|
206
|
+
// }
|
207
|
+
|
208
|
+
//this.ticket.deadline= dayjs(this.ticket.deadline).format('YYYY-MM-DD') //Change date format to show in date selector
|
209
|
+
|
210
|
+
}).catch(error => {
|
211
|
+
console.log(error)
|
212
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
213
|
+
}).finally(() => {
|
214
|
+
this.loading = false
|
215
|
+
})
|
216
|
+
},
|
217
|
+
|
218
|
+
/**
|
219
|
+
* @description This action is used to delete a ticket
|
220
|
+
*/
|
221
|
+
async deleteTicket(){
|
222
|
+
this.dialog
|
223
|
+
.confirmation({
|
224
|
+
title: "Delete ticket",
|
225
|
+
text: "Are you sure you want to delete this ticket?",
|
226
|
+
confirmText: "yes",
|
227
|
+
cancelText: "no"
|
228
|
+
})
|
229
|
+
.then(({ isConfirmed }) => {
|
230
|
+
if (isConfirmed) {
|
231
|
+
return this.http.delete(this.url.support('tickets/:id', this.ticket.id)).then(result => {
|
232
|
+
this.msg.success(I18n.t("core.users.messages_success_operation"))
|
233
|
+
}).catch(error => {
|
234
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
235
|
+
})
|
236
|
+
}
|
237
|
+
})
|
238
|
+
},
|
239
|
+
|
240
|
+
/**
|
241
|
+
* @description This action is used to reload tickets
|
242
|
+
*/
|
243
|
+
reloadTickets(){
|
244
|
+
this.tickets = []
|
245
|
+
this.getTickets()
|
246
|
+
},
|
247
|
+
|
248
|
+
/**
|
249
|
+
* @description This action is used to paginate tickets from index
|
250
|
+
* @param {String} page The actual page showing.
|
251
|
+
*/
|
252
|
+
paginateIndex(page) {
|
253
|
+
this.pagination.page = page
|
254
|
+
this.getTickets()
|
255
|
+
},
|
256
|
+
|
257
|
+
/**
|
258
|
+
* @description This action is used to sort the list of tickets.
|
259
|
+
* @param {String} column The column to sort the list of tickets
|
260
|
+
* @param {String} direction The direction to sort the list of tickets (asc or desc)
|
261
|
+
*/
|
262
|
+
sort(column, direction){
|
263
|
+
this.getTickets(this.url.support('tickets').order(column, direction), false)
|
264
|
+
},
|
265
|
+
|
266
|
+
/**
|
267
|
+
* @description This action is used to fetch with search results.
|
268
|
+
* @param {String} string The string to search for.
|
269
|
+
*/
|
270
|
+
search(string) {
|
271
|
+
this.pagination.page = 1
|
272
|
+
this.getTickets(this.url.support('tickets').search(string))
|
273
|
+
}
|
274
|
+
}
|
275
|
+
})
|
276
|
+
|