lesli_help 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +5 -0
  3. data/app/assets/config/lesli_help_manifest.js +38 -0
  4. data/app/assets/images/lesli_help/help-logo.svg +9 -0
  5. data/app/assets/javascripts/lesli_help/application.js +6203 -0
  6. data/app/assets/stylesheets/lesli_help/application.css +15 -0
  7. data/app/controllers/lesli_help/accounts_controller.rb +60 -0
  8. data/app/controllers/lesli_help/application_controller.rb +4 -0
  9. data/app/controllers/lesli_help/dashboard/components_controller.rb +92 -0
  10. data/app/controllers/lesli_help/dashboards_controller.rb +36 -0
  11. data/app/controllers/lesli_help/tickets_controller.rb +171 -0
  12. data/app/helpers/lesli_help/accounts_helper.rb +4 -0
  13. data/app/helpers/lesli_help/application_helper.rb +4 -0
  14. data/app/helpers/lesli_help/dashboards_helper.rb +4 -0
  15. data/app/jobs/lesli_help/application_job.rb +4 -0
  16. data/app/mailers/lesli_help/application_mailer.rb +6 -0
  17. data/app/models/lesli_help/account.rb +38 -0
  18. data/app/models/lesli_help/application_record.rb +5 -0
  19. data/app/models/lesli_help/dashboard/component.rb +18 -0
  20. data/app/models/lesli_help/dashboard.rb +28 -0
  21. data/app/models/lesli_help/ticket.rb +39 -0
  22. data/app/services/lesli_help/ticket_service.rb +120 -0
  23. data/app/views/layouts/lesli_help/application.html.erb +15 -0
  24. data/app/views/lesli_help/accounts/_account.html.erb +2 -0
  25. data/app/views/lesli_help/accounts/_form.html.erb +17 -0
  26. data/app/views/lesli_help/accounts/edit.html.erb +10 -0
  27. data/app/views/lesli_help/accounts/index.html.erb +14 -0
  28. data/app/views/lesli_help/accounts/new.html.erb +9 -0
  29. data/app/views/lesli_help/accounts/show.html.erb +10 -0
  30. data/app/views/lesli_help/dashboards/edit.html.erb +1 -0
  31. data/app/views/lesli_help/dashboards/index.html.erb +1 -0
  32. data/app/views/lesli_help/dashboards/new.html.erb +1 -0
  33. data/app/views/lesli_help/dashboards/show.html.erb +1 -0
  34. data/app/views/lesli_help/partials/_engine-navigation.html.erb +39 -0
  35. data/app/views/lesli_help/tickets/edit.html.erb +20 -0
  36. data/app/views/lesli_help/tickets/index.html.erb +34 -0
  37. data/app/views/lesli_help/tickets/new.html.erb +20 -0
  38. data/app/views/lesli_help/tickets/show.html.erb +20 -0
  39. data/config/locales/translations.en.yml +23 -0
  40. data/config/locales/translations.es.yml +23 -0
  41. data/config/routes.rb +51 -0
  42. data/db/migrate/v1/0702000110_create_lesli_help_accounts.rb +42 -0
  43. data/db/migrate/v1/0702000210_create_lesli_help_account_settings.rb +46 -0
  44. data/db/migrate/v1/0702050110_create_lesli_help_dashboards.rb +50 -0
  45. data/db/migrate/v1/0702050210_create_lesli_help_dashboard_components.rb +50 -0
  46. data/db/migrate/v1/0702100110_create_lesli_help_slas.rb +59 -0
  47. data/db/migrate/v1/0702110110_create_lesli_help_tickets.rb +93 -0
  48. data/db/seed/development.rb +43 -0
  49. data/db/seed/production.rb +31 -0
  50. data/db/seed/test.rb +31 -0
  51. data/db/seeds.rb +43 -0
  52. data/db/tables/0702010110_create_cloud_help_catalogs.rb +8 -0
  53. data/db/tables/0702010210_create_cloud_help_catalog_ticket_categories.rb +44 -0
  54. data/db/tables/0702010310_create_cloud_help_catalog_ticket_priorities.rb +46 -0
  55. data/db/tables/0702010410_create_cloud_help_catalog_ticket_types.rb +44 -0
  56. data/db/tables/0702010510_create_cloud_help_catalog_ticket_sources.rb +44 -0
  57. data/db/tables/0702010610_create_cloud_help_catalog_ticket_workspaces.rb +38 -0
  58. data/db/tables/0702020110_create_cloud_help_workflows.rb +47 -0
  59. data/db/tables/0702020210_create_cloud_help_workflow_statuses.rb +47 -0
  60. data/db/tables/0702020310_create_cloud_help_workflow_associations.rb +29 -0
  61. data/db/tables/0702020410_create_cloud_help_workflow_actions.rb +18 -0
  62. data/db/tables/0702020510_create_cloud_help_workflow_checks.rb +20 -0
  63. data/db/tables/0702030110_create_cloud_help_custom_fields.rb +15 -0
  64. data/db/tables/0702040110_create_cloud_help_custom_validations.rb +16 -0
  65. data/db/tables/0702040210_create_cloud_help_custom_validation_rules.rb +16 -0
  66. data/db/tables/0702040310_create_cloud_help_custom_validation_fields.rb +16 -0
  67. data/db/tables/0702100310_create_cloud_help_ticket_actions.rb +16 -0
  68. data/db/tables/0702100410_create_cloud_help_ticket_activities.rb +15 -0
  69. data/db/tables/0702100510_create_cloud_help_ticket_discussions.rb +17 -0
  70. data/db/tables/0702100610_create_cloud_help_ticket_files.rb +16 -0
  71. data/db/tables/0702100710_create_cloud_help_ticket_subscribers.rb +16 -0
  72. data/db/tables/0702101010_create_cloud_help_ticket_timelines.rb +14 -0
  73. data/db/tables/0702101110_create_cloud_help_ticket_assignments.rb +15 -0
  74. data/db/tables/0702101210_create_cloud_help_ticket_histories.rb +15 -0
  75. data/db/tables/0702110310_create_cloud_help_sla_actions.rb +17 -0
  76. data/db/tables/0702110410_create_cloud_help_sla_activities.rb +15 -0
  77. data/db/tables/0702110510_create_cloud_help_sla_discussions.rb +17 -0
  78. data/db/tables/0702110610_create_cloud_help_sla_files.rb +16 -0
  79. data/db/tables/0702110710_create_cloud_help_sla_subscribers.rb +16 -0
  80. data/db/tables/0702111010_create_cloud_help_sla_associations.rb +13 -0
  81. data/lib/lesli_help/engine.rb +50 -0
  82. data/lib/lesli_help/version.rb +4 -0
  83. data/lib/lesli_help.rb +6 -0
  84. data/lib/tasks/lesli_help_tasks.rake +4 -0
  85. data/lib/vue/application.js +85 -0
  86. data/lib/vue/apps/dashboard/show.vue +43 -0
  87. data/lib/vue/apps/tickets/components/assignments.vue +93 -0
  88. data/lib/vue/apps/tickets/components/form.vue +252 -0
  89. data/lib/vue/apps/tickets/components/internal-comments.vue +107 -0
  90. data/lib/vue/apps/tickets/components/sla-info.vue +115 -0
  91. data/lib/vue/apps/tickets/index.vue +171 -0
  92. data/lib/vue/apps/tickets/new.vue +92 -0
  93. data/lib/vue/apps/tickets/show.vue +177 -0
  94. data/lib/vue/stores/tickets.js +275 -0
  95. data/lib/vue/stores/translations.json +56 -0
  96. data/readme.md +71 -0
  97. metadata +155 -0
@@ -0,0 +1,252 @@
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 { inject, onMounted, ref, onUnmounted } from "vue"
36
+
37
+
38
+ // · import vue router composable
39
+ import { useRouter, useRoute } from "vue-router"
40
+
41
+
42
+ // · initialize/inject plugins
43
+ const router = useRouter()
44
+ const route = useRoute()
45
+ const date = inject("date")
46
+ const url = inject("url")
47
+
48
+
49
+ // ·
50
+ import { editorRichText } from "lesli-vue/components"
51
+
52
+
53
+ // · import lesli stores
54
+ import { useTickets } from "LesliHelp/stores/tickets"
55
+ //import { useAssignments } from "LesliHelp/stores/tickets/assignment"
56
+
57
+
58
+ // · implement stores
59
+ const storeTickets = useTickets()
60
+ //const storeAssignments = useAssignments()
61
+
62
+
63
+ // · defining props
64
+ const props = defineProps({
65
+ editable: {
66
+ type: Boolean,
67
+ required: false,
68
+ default: false,
69
+ },
70
+ path: {
71
+ type: String,
72
+ required: false,
73
+ default: "help/tickets",
74
+ }
75
+ })
76
+
77
+
78
+ // ·
79
+ const translations = {
80
+ tickets: i18n.t("lesli_help.tickets"),
81
+ lesli: { shared: i18n.t("lesli.shared") },
82
+
83
+ users: I18n.t("core.users"),
84
+ shared: I18n.t("core.shared"),
85
+ main: I18n.t('help.tickets')
86
+ }
87
+
88
+
89
+ // ·
90
+ const onUpdate = () => {
91
+ storeTickets.updateTicket()
92
+ }
93
+
94
+
95
+ // ·
96
+ const onCreate = () => {
97
+ storeTickets.postTicket().then(result => {
98
+ this.msg.success(I18n.t("core.users.messages_success_operation"))
99
+ //router.push(url.root(props.path).toString())
100
+ }).catch(error => {
101
+ this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
102
+ })
103
+ }
104
+
105
+
106
+ // ·
107
+ if (props.isEditable) {
108
+ storeTickets.ticket = {}
109
+ storeTickets.getOptions().then(() => {
110
+ storeTickets.fetchTicket(route.params.id)
111
+ })
112
+ } else {
113
+ storeTickets.getOptions() // get options for ticket form
114
+ storeTickets.ticket = {}
115
+ storeTickets.tags = []
116
+ }
117
+
118
+ </script>
119
+ <template>
120
+ <lesli-form
121
+ :editable="editable"
122
+ @submit="isEditable ? onUpdate() : onCreate()"
123
+ disabled="storeTickets.ticket.status=='closed'">
124
+
125
+ <p>Ticket information</p>
126
+
127
+ <!-- Ticket creator name -->
128
+ <div class="field is-horizontal" v-if="!editable">
129
+ <div class="field-label is-normal">
130
+ <label class="label">
131
+ {{ translations.tickets.column_id }}
132
+ </label>
133
+ </div>
134
+ <div class="field-body">
135
+ <div class="field">
136
+ <div class="control">
137
+ <input class="input" disabled v-model="storeTickets.ticket.user_creator_name">
138
+ </div>
139
+ </div>
140
+ </div>
141
+ </div>
142
+
143
+ <!-- Ticket reference url -->
144
+ <div class="field is-horizontal" v-if="!editable">
145
+ <div class="field-label is-normal">
146
+ <label class="label">
147
+ {{ translations.main.column_reference_url }}
148
+ </label>
149
+ </div>
150
+ <div class="field-body">
151
+ <div class="field">
152
+ <div class="control">
153
+ <input name="reference_url" disabled type="text" class="input" v-model="storeTickets.ticket.reference_url">
154
+ </div>
155
+ </div>
156
+ </div>
157
+ </div>
158
+
159
+ <!-- Ticket assigned users -->
160
+ <div class="field is-horizontal" v-if="editable">
161
+ <div class="field-label is-normal">
162
+ <label class="label"> {{translations.main.view_title_assigned_users}} </label>
163
+ </div>
164
+ <div class="field-body">
165
+ <div class="field">
166
+ <div class="control">
167
+ <div v-for="assignment in storeTickets.ticket.assignment_attributes" :key="assignment">
168
+ <span class="tag is-success">{{assignment.assignable_name}}
169
+ <button class="delete is-small" @click="storeAssignments.deleteAssignment(assignment.id)" type="button"></button>
170
+ </span>
171
+ </div>
172
+ </div>
173
+ </div>
174
+ </div>
175
+ </div>
176
+
177
+ <!-- Ticket subject -->
178
+ <div class="field is-horizontal">
179
+ <div class="field-label is-normal">
180
+ <label class="label">
181
+ {{ translations.tickets.column_subject }}
182
+ <span class="is-danger">*</span>
183
+ </label>
184
+ </div>
185
+ <div class="field-body">
186
+ <div class="field">
187
+ <div class="control">
188
+ <input name="subject" class="input" required v-model="storeTickets.ticket.subject">
189
+ </div>
190
+ </div>
191
+ </div>
192
+ </div>
193
+
194
+ <!-- Ticket deadline -->
195
+ <div class="field is-horizontal">
196
+ <div class="field-label is-normal">
197
+ <label class="label"> {{ translations.tickets.column_deadline }} </label>
198
+ </div>
199
+ <div class="field-body">
200
+ <div class="field">
201
+ <div class="control">
202
+ <input name="deadline" class="input" type="date" v-model="storeTickets.ticket.deadline">
203
+ </div>
204
+ </div>
205
+ </div>
206
+ </div>
207
+
208
+ <!-- Ticket started at date -->
209
+ <div class="field is-horizontal">
210
+ <div class="field-label is-normal">
211
+ <label class="label">{{ translations.main.column_started_at }}</label>
212
+ </div>
213
+ <div class="field-body">
214
+ <div class="field">
215
+ <div class="control">
216
+
217
+ </div>
218
+ </div>
219
+ </div>
220
+ </div>
221
+
222
+ <!-- Ticket description -->
223
+ <div class="field is-horizontal">
224
+ <div class="field-label is-normal">
225
+ <label class="label">{{ translations.tickets.column_description }}</label>
226
+ </div>
227
+ <div class="field-body">
228
+ <div class="field">
229
+ <div class="control">
230
+ <editor-rich-text mode="small" v-model="storeTickets.ticket.description">
231
+ </editor-rich-text>
232
+ </div>
233
+ </div>
234
+ </div>
235
+ </div>
236
+
237
+ <div class="field is-horizontal" v-if="editable">
238
+ <div class="field-label is-normal">
239
+ <label class="label"></label>
240
+ </div>
241
+ <div class="field-body">
242
+ <div class="field">
243
+ <div class="control">
244
+ <lesli-button icon="save">
245
+ {{ translations.lesli.shared.button_save }}
246
+ </lesli-button>
247
+ </div>
248
+ </div>
249
+ </div>
250
+ </div>
251
+ </lesli-form>
252
+ </template>
@@ -0,0 +1,107 @@
1
+ <script setup>
2
+ /*
3
+ Copyright (c) 2022, all rights reserved.
4
+
5
+ All the information provided by this platform is protected by international laws related to
6
+ industrial property, intellectual property, copyright and relative international laws.
7
+ All intellectual or industrial property rights of the code, texts, trade mark, design,
8
+ pictures and any other information belongs to the owner of this platform.
9
+
10
+ Without the written permission of the owner, any replication, modification,
11
+ transmission, publication is strictly forbidden.
12
+
13
+ For more information read the license file including with this software.
14
+
15
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
16
+ // ·
17
+ */
18
+
19
+
20
+ // · import vue tools
21
+ import { onMounted } from "vue"
22
+
23
+ // · import lesli stores
24
+ import { useHistory } from "CloudHelp/stores/tickets/history"
25
+
26
+ // · import vue router composable
27
+ import { useRoute } from "vue-router"
28
+
29
+ // · implement stores
30
+ const storeHistories = useHistory()
31
+
32
+ // · initialize/inject plugins
33
+ const route = useRoute()
34
+
35
+ // ·
36
+ const translations = {
37
+ shared: I18n.t("core.shared"),
38
+ histories: I18n.t('help.ticket/histories'),
39
+ help:{
40
+ shared: I18n.t('help.shared')
41
+ },
42
+ core: I18n.t('core.shared'),
43
+ main: I18n.t('help.ticket/histories')
44
+ }
45
+
46
+ const columns = [{
47
+ field: "created_at",
48
+ label: translations.core.column_created_at,
49
+ }, {
50
+ field: "user_creator_name",
51
+ label: translations.main.column_users_id,
52
+ }, {
53
+ field: "content",
54
+ label: translations.main.column_content
55
+ }]
56
+
57
+ onMounted(() => {
58
+ storeHistories.getHistories(route.params.id)
59
+ storeHistories.ticket_id = route.params.id
60
+ })
61
+
62
+ /**
63
+ * @description This function is used to create a new internal comment
64
+ */
65
+ const onCreate = () => {
66
+ storeHistories.createHistory()
67
+
68
+ }
69
+
70
+
71
+ </script>
72
+ <template>
73
+
74
+ <h2>{{translations.histories.view_title_main}}</h2>
75
+
76
+ <div class="block">
77
+ <form @submit.prevent="onCreate()">
78
+ <div class="columns">
79
+ <div class="column is-6">
80
+ <input name="comment" type="text" :placeholder="translations.histories.view_placeholder_add_history" class="input" v-model="storeHistories.history">
81
+ </div>
82
+ <div class="column is-6">
83
+ <lesli-button icon="save">{{ translations.shared.view_btn_save }}</lesli-button>
84
+ </div>
85
+ </div>
86
+
87
+ </form>
88
+ </div>
89
+
90
+ <lesli-table
91
+ :records="storeHistories.histories"
92
+ :columns="columns"
93
+ :loading="storeHistories.loading"
94
+ >
95
+ <template #options="{ record, value }">
96
+ <a class="dropdown-item" @click="storeHistories.deleteHistory(record)">
97
+ <span class="material-icons">
98
+ delete
99
+ </span>
100
+ <span>
101
+ {{translations.help.shared.view_tab_title_delete_section}}
102
+ </span>
103
+ </a>
104
+ </template>
105
+ </lesli-table>
106
+
107
+ </template>
@@ -0,0 +1,115 @@
1
+ <script setup>
2
+ /*
3
+ Copyright (c) 2022, all rights reserved.
4
+
5
+ All the information provided by this platform is protected by international laws related to
6
+ industrial property, intellectual property, copyright and relative international laws.
7
+ All intellectual or industrial property rights of the code, texts, trade mark, design,
8
+ pictures and any other information belongs to the owner of this platform.
9
+
10
+ Without the written permission of the owner, any replication, modification,
11
+ transmission, publication is strictly forbidden.
12
+
13
+ For more information read the license file including with this software.
14
+
15
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
16
+ // ·
17
+ */
18
+
19
+
20
+ // · import vue tools
21
+ import { onMounted } from "vue"
22
+
23
+ // · import lesli stores
24
+ import { useTickets } from "CloudHelp/stores/tickets"
25
+
26
+ // · import vue router composable
27
+ import { useRoute } from "vue-router"
28
+
29
+ // · implement stores
30
+ const storeTickets = useTickets()
31
+
32
+ // · initialize/inject plugins
33
+ const route = useRoute()
34
+
35
+ // ·
36
+ const translations = {
37
+ users: I18n.t("core.users"),
38
+ shared: I18n.t("core.shared"),
39
+ sla: I18n.t('help.slas')
40
+ }
41
+
42
+
43
+ </script>
44
+ <template>
45
+ <h2>SLA</h2>
46
+ <div class="box" v-if="!storeTickets.loading">
47
+ <div class="columns">
48
+ <div class="column">
49
+ <label>{{translations.sla.column_name}}</label>
50
+ <p>{{storeTickets.ticket.sla?.name}}</p>
51
+ </div>
52
+
53
+ <div class="column">
54
+ <label>{{translations.sla.column_default}}</label>
55
+ <p v-if="storeTickets.ticket.sla?.default">yes</p>
56
+ <p v-else> no </p>
57
+ </div>
58
+ </div>
59
+
60
+ <div class="columns">
61
+ <div class="column">
62
+ <label>{{translations.sla.column_expected_response_time}}</label>
63
+ <p>{{storeTickets.ticket.sla?.expected_response_time}}</p>
64
+ </div>
65
+
66
+ <div class="column">
67
+ <label>{{translations.sla.column_expected_resolution_time}}</label>
68
+ <p>{{storeTickets.ticket.sla?.expected_resolution_time}}</p>
69
+ </div>
70
+
71
+ <div class="column">
72
+ <label>{{translations.sla.column_price_per_hour}}</label>
73
+ <p> {{storeTickets.ticket.sla?.price_per_hour}}</p>
74
+ </div>
75
+ </div>
76
+
77
+ <div class="colums">
78
+ <div class="column">
79
+ <label>{{translations.sla.view_tab_title_associations}}</label>
80
+ <div v-for="association in storeTickets.ticket.sla?.association_attributes" :key="association.id">
81
+ <span class="tag is-info">{{association.ticket_type_name}}</span>
82
+ </div>
83
+ </div>
84
+ </div>
85
+
86
+ <div class="field">
87
+ <label class="label">{{translations.sla.column_body}}</label>
88
+ <div class="control">
89
+ <textarea class="textarea is-small" :v-model="storeTickets.ticket.sla?.body" disabled></textarea>
90
+ </div>
91
+ </div>
92
+
93
+ <div class="field">
94
+ <label class="label">{{translations.sla.column_client_repercussions}}</label>
95
+ <div class="control">
96
+ <textarea class="textarea is-small" :v-model="storeTickets.ticket.sla?.client_repercussions" disabled></textarea>
97
+ </div>
98
+ </div>
99
+
100
+ <div class="field">
101
+ <label class="label">{{translations.sla.column_provider_repercussions}}</label>
102
+ <div class="control">
103
+ <textarea class="textarea is-small" :v-model="storeTickets.ticket.sla?.provider_repercussions" disabled></textarea>
104
+ </div>
105
+ </div>
106
+
107
+ <div class="field">
108
+ <label class="label">{{translations.sla.column_exceptions}}</label>
109
+ <div class="control">
110
+ <textarea class="textarea is-small" :v-model="storeTickets.ticket.sla?.exceptions" disabled></textarea>
111
+ </div>
112
+ </div>
113
+ </div>
114
+
115
+ </template>
@@ -0,0 +1,171 @@
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
+
38
+
39
+ // · import lesli stores
40
+ import { useTickets } from "LesliHelp/stores/tickets"
41
+
42
+
43
+ // · initialize/inject plugins
44
+ const router = useRouter()
45
+ const url = inject("url")
46
+ const date = inject("date")
47
+
48
+
49
+ // · implement stores
50
+ const storeTickets = useTickets()
51
+
52
+
53
+ //·
54
+ const translations = {
55
+ lesli: {
56
+ shared: i18n.t("lesli.shared")
57
+ },
58
+ tickets: i18n.t("lesli_help.tickets"),
59
+ main: I18n.t('help.tickets'),
60
+ core: {
61
+ shared: I18n.t('core.shared')
62
+ }
63
+ }
64
+
65
+
66
+ // · initializing
67
+ onMounted(() => {
68
+ storeTickets.getTickets()
69
+ })
70
+
71
+
72
+ // ·
73
+ const columns = [{
74
+ field: "id",
75
+ label: translations.tickets.column_id,
76
+ sort: true
77
+ }, {
78
+ field: "subject",
79
+ label: translations.tickets.column_subject,
80
+ sort: true
81
+ }, {
82
+ field: "deadline",
83
+ label: translations.tickets.column_deadline,
84
+ sort: true
85
+ }, {
86
+ field: "status_name",
87
+ label: translations.main.column_cloud_help_workflow_statuses_id,
88
+ align: "center",
89
+ sort: true
90
+ },{
91
+ field: "priority_name",
92
+ label: translations.main.column_cloud_help_catalog_ticket_priorities_id,
93
+ align: "center",
94
+ sort: true
95
+ }, {
96
+ field: "workspace_name",
97
+ label: translations.main.column_cloud_help_catalog_ticket_workspaces_id,
98
+ sort: true
99
+ }, {
100
+ field: "user_name",
101
+ label: translations.tickets.column_creator,
102
+ sort: true
103
+ }, {
104
+ field: "assigned_name",
105
+ label: translations.tickets.column_creator,
106
+ align: "center"
107
+ }]
108
+
109
+
110
+ /**
111
+ * @description Function that extract the initials from the name of the users assigned to a ticket
112
+ * @param {string} name name of the user assigned to the ticket
113
+ */
114
+ function extractInitials(name){
115
+ return name.split(" ").map((word)=>{
116
+ if(word){
117
+ return word[0].toUpperCase()
118
+ }else{
119
+ return ''
120
+ }
121
+ }).join("")
122
+ }
123
+ </script>
124
+ <template>
125
+ <lesli-application-container>
126
+ <lesli-header title="Tickets">
127
+ <lesli-link :to="url.help('tickets/new')" icon="add">
128
+ {{ translations.lesli.shared.button_add_new }}
129
+ </lesli-link>
130
+ <lesli-button @click="storeTickets.reloadTickets" icon="refresh" :loading="storeTickets.loading">
131
+ {{ translations.lesli.shared.button_reload }}
132
+ </lesli-button>
133
+ </lesli-header>
134
+
135
+ <lesli-toolbar @search="storeTickets.search" :placeholder="translations.main.view_placeholder_text_filter">
136
+ <lesli-select
137
+ :options="[{
138
+ label: translations.main.view_text_filter_everyones_tickets,
139
+ value: null
140
+ }, {
141
+ label: translations.main.view_text_filter_own_tickets,
142
+ value: 'own'
143
+ }]"
144
+ v-model="storeTickets.filters.user_type"
145
+ @change="storeTickets.getTickets()">
146
+ </lesli-select>
147
+ <lesli-select
148
+ :options="[{
149
+ label: translations.main.view_text_filter_all_tickets,
150
+ value: null
151
+ }, {
152
+ label: translations.main.view_text_filter_active_tickets,
153
+ value: 'active'
154
+ }, {
155
+ label: translations.main.view_text_filter_inactive_tickets,
156
+ value: 'inactive'
157
+ }]"
158
+ v-model="storeTickets.filters.search_type"
159
+ @change="storeTickets.getTickets()">
160
+ </lesli-select>
161
+ </lesli-toolbar>
162
+
163
+ <lesli-table
164
+ :columns="columns"
165
+ :records="storeTickets.index.records"
166
+ :loading="storeTickets.index.loading"
167
+ :pagination="storeTickets.index.pagination"
168
+ :link="(ticket) => url.help('tickets/:id', ticket.id)">
169
+ </lesli-table>
170
+ </lesli-application-container>
171
+ </template>