lesli_help 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_help_manifest.js +38 -0
- data/app/assets/images/lesli_help/help-logo.svg +9 -0
- data/app/assets/javascripts/lesli_help/application.js +6203 -0
- data/app/assets/stylesheets/lesli_help/application.css +15 -0
- data/app/controllers/lesli_help/accounts_controller.rb +60 -0
- data/app/controllers/lesli_help/application_controller.rb +4 -0
- data/app/controllers/lesli_help/dashboard/components_controller.rb +92 -0
- data/app/controllers/lesli_help/dashboards_controller.rb +36 -0
- data/app/controllers/lesli_help/tickets_controller.rb +171 -0
- data/app/helpers/lesli_help/accounts_helper.rb +4 -0
- data/app/helpers/lesli_help/application_helper.rb +4 -0
- data/app/helpers/lesli_help/dashboards_helper.rb +4 -0
- data/app/jobs/lesli_help/application_job.rb +4 -0
- data/app/mailers/lesli_help/application_mailer.rb +6 -0
- data/app/models/lesli_help/account.rb +38 -0
- data/app/models/lesli_help/application_record.rb +5 -0
- data/app/models/lesli_help/dashboard/component.rb +18 -0
- data/app/models/lesli_help/dashboard.rb +28 -0
- data/app/models/lesli_help/ticket.rb +39 -0
- data/app/services/lesli_help/ticket_service.rb +120 -0
- data/app/views/layouts/lesli_help/application.html.erb +15 -0
- data/app/views/lesli_help/accounts/_account.html.erb +2 -0
- data/app/views/lesli_help/accounts/_form.html.erb +17 -0
- data/app/views/lesli_help/accounts/edit.html.erb +10 -0
- data/app/views/lesli_help/accounts/index.html.erb +14 -0
- data/app/views/lesli_help/accounts/new.html.erb +9 -0
- data/app/views/lesli_help/accounts/show.html.erb +10 -0
- data/app/views/lesli_help/dashboards/edit.html.erb +1 -0
- data/app/views/lesli_help/dashboards/index.html.erb +1 -0
- data/app/views/lesli_help/dashboards/new.html.erb +1 -0
- data/app/views/lesli_help/dashboards/show.html.erb +1 -0
- data/app/views/lesli_help/partials/_engine-navigation.html.erb +39 -0
- data/app/views/lesli_help/tickets/edit.html.erb +20 -0
- data/app/views/lesli_help/tickets/index.html.erb +34 -0
- data/app/views/lesli_help/tickets/new.html.erb +20 -0
- data/app/views/lesli_help/tickets/show.html.erb +20 -0
- data/config/locales/translations.en.yml +23 -0
- data/config/locales/translations.es.yml +23 -0
- data/config/routes.rb +51 -0
- data/db/migrate/v1/0702000110_create_lesli_help_accounts.rb +42 -0
- data/db/migrate/v1/0702000210_create_lesli_help_account_settings.rb +46 -0
- data/db/migrate/v1/0702050110_create_lesli_help_dashboards.rb +50 -0
- data/db/migrate/v1/0702050210_create_lesli_help_dashboard_components.rb +50 -0
- data/db/migrate/v1/0702100110_create_lesli_help_slas.rb +59 -0
- data/db/migrate/v1/0702110110_create_lesli_help_tickets.rb +93 -0
- data/db/seed/development.rb +43 -0
- data/db/seed/production.rb +31 -0
- data/db/seed/test.rb +31 -0
- data/db/seeds.rb +43 -0
- data/db/tables/0702010110_create_cloud_help_catalogs.rb +8 -0
- data/db/tables/0702010210_create_cloud_help_catalog_ticket_categories.rb +44 -0
- data/db/tables/0702010310_create_cloud_help_catalog_ticket_priorities.rb +46 -0
- data/db/tables/0702010410_create_cloud_help_catalog_ticket_types.rb +44 -0
- data/db/tables/0702010510_create_cloud_help_catalog_ticket_sources.rb +44 -0
- data/db/tables/0702010610_create_cloud_help_catalog_ticket_workspaces.rb +38 -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/0702100510_create_cloud_help_ticket_discussions.rb +17 -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_help/engine.rb +50 -0
- data/lib/lesli_help/version.rb +4 -0
- data/lib/lesli_help.rb +6 -0
- data/lib/tasks/lesli_help_tasks.rake +4 -0
- data/lib/vue/application.js +85 -0
- data/lib/vue/apps/dashboard/show.vue +43 -0
- data/lib/vue/apps/tickets/components/assignments.vue +93 -0
- data/lib/vue/apps/tickets/components/form.vue +252 -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 +171 -0
- data/lib/vue/apps/tickets/new.vue +92 -0
- data/lib/vue/apps/tickets/show.vue +177 -0
- data/lib/vue/stores/tickets.js +275 -0
- data/lib/vue/stores/translations.json +56 -0
- data/readme.md +71 -0
- metadata +155 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module LesliHelp
|
2
|
+
class AccountsController < ApplicationController
|
3
|
+
before_action :set_account, only: %i[ show edit update destroy ]
|
4
|
+
|
5
|
+
# GET /accounts
|
6
|
+
def index
|
7
|
+
@accounts = Account.all
|
8
|
+
end
|
9
|
+
|
10
|
+
# GET /accounts/1
|
11
|
+
def show
|
12
|
+
end
|
13
|
+
|
14
|
+
# GET /accounts/new
|
15
|
+
def new
|
16
|
+
@account = Account.new
|
17
|
+
end
|
18
|
+
|
19
|
+
# GET /accounts/1/edit
|
20
|
+
def edit
|
21
|
+
end
|
22
|
+
|
23
|
+
# POST /accounts
|
24
|
+
def create
|
25
|
+
@account = Account.new(account_params)
|
26
|
+
|
27
|
+
if @account.save
|
28
|
+
redirect_to @account, notice: "Account was successfully created."
|
29
|
+
else
|
30
|
+
render :new, status: :unprocessable_entity
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# PATCH/PUT /accounts/1
|
35
|
+
def update
|
36
|
+
if @account.update(account_params)
|
37
|
+
redirect_to @account, notice: "Account was successfully updated.", status: :see_other
|
38
|
+
else
|
39
|
+
render :edit, status: :unprocessable_entity
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# DELETE /accounts/1
|
44
|
+
def destroy
|
45
|
+
@account.destroy
|
46
|
+
redirect_to accounts_url, notice: "Account was successfully destroyed.", status: :see_other
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
# Use callbacks to share common setup or constraints between actions.
|
51
|
+
def set_account
|
52
|
+
@account = Account.find(params[:id])
|
53
|
+
end
|
54
|
+
|
55
|
+
# Only allow a list of trusted parameters through.
|
56
|
+
def account_params
|
57
|
+
params.fetch(:account, {})
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
=begin
|
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
|
+
=end
|
32
|
+
|
33
|
+
module LesliHelp
|
34
|
+
class Dashboard::ComponentsController < ApplicationController
|
35
|
+
before_action :set_dashboard_component, only: %i[ show edit update destroy ]
|
36
|
+
|
37
|
+
# GET /dashboard/components
|
38
|
+
def index
|
39
|
+
@dashboard_components = Dashboard::Component.all
|
40
|
+
end
|
41
|
+
|
42
|
+
# GET /dashboard/components/1
|
43
|
+
def show
|
44
|
+
end
|
45
|
+
|
46
|
+
# GET /dashboard/components/new
|
47
|
+
def new
|
48
|
+
@dashboard_component = Dashboard::Component.new
|
49
|
+
end
|
50
|
+
|
51
|
+
# GET /dashboard/components/1/edit
|
52
|
+
def edit
|
53
|
+
end
|
54
|
+
|
55
|
+
# POST /dashboard/components
|
56
|
+
def create
|
57
|
+
@dashboard_component = Dashboard::Component.new(dashboard_component_params)
|
58
|
+
|
59
|
+
if @dashboard_component.save
|
60
|
+
redirect_to @dashboard_component, notice: "Component was successfully created."
|
61
|
+
else
|
62
|
+
render :new, status: :unprocessable_entity
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# PATCH/PUT /dashboard/components/1
|
67
|
+
def update
|
68
|
+
if @dashboard_component.update(dashboard_component_params)
|
69
|
+
redirect_to @dashboard_component, notice: "Component was successfully updated.", status: :see_other
|
70
|
+
else
|
71
|
+
render :edit, status: :unprocessable_entity
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# DELETE /dashboard/components/1
|
76
|
+
def destroy
|
77
|
+
@dashboard_component.destroy
|
78
|
+
redirect_to dashboard_components_url, notice: "Component was successfully destroyed.", status: :see_other
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
# Use callbacks to share common setup or constraints between actions.
|
83
|
+
def set_dashboard_component
|
84
|
+
@dashboard_component = Dashboard::Component.find(params[:id])
|
85
|
+
end
|
86
|
+
|
87
|
+
# Only allow a list of trusted parameters through.
|
88
|
+
def dashboard_component_params
|
89
|
+
params.fetch(:dashboard_component, {})
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
=begin
|
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
|
+
=end
|
32
|
+
|
33
|
+
module LesliHelp
|
34
|
+
class DashboardsController < Lesli::Shared::DashboardsController
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,171 @@
|
|
1
|
+
=begin
|
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
|
+
=end
|
32
|
+
|
33
|
+
module LesliHelp
|
34
|
+
class TicketsController < ApplicationController
|
35
|
+
before_action :set_ticket, only: [:show, :update, :destroy, :images]
|
36
|
+
|
37
|
+
def index
|
38
|
+
respond_to do |format|
|
39
|
+
format.html { }
|
40
|
+
format.json do
|
41
|
+
#respond_with_successful(TicketService.new(current_user, query).index)
|
42
|
+
respond_with_pagination(TicketService.new(current_user, query).index)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def show
|
48
|
+
respond_to do |format|
|
49
|
+
format.html { }
|
50
|
+
format.json do
|
51
|
+
respond_with_successful(@ticket.show)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def new
|
57
|
+
end
|
58
|
+
|
59
|
+
def edit
|
60
|
+
end
|
61
|
+
|
62
|
+
def create
|
63
|
+
ticket = TicketService.new(current_user, query).create(ticket_params)
|
64
|
+
|
65
|
+
if ticket.successful?
|
66
|
+
respond_with_successful(ticket.result)
|
67
|
+
else
|
68
|
+
respond_with_error(ticket.errors)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def update
|
73
|
+
return respond_with_not_found unless @ticket
|
74
|
+
return respond_with_unauthorized unless @ticket.is_editable_by?(current_user, bypass_status: true)
|
75
|
+
|
76
|
+
# When the ticket is closed, the only available field for update is the status
|
77
|
+
update_params = ticket_params
|
78
|
+
if ["completed_successfully", "completed_unsuccessfully"].include? @ticket.status&.status_type
|
79
|
+
update_params = completed_ticket_params
|
80
|
+
end
|
81
|
+
|
82
|
+
if @ticket.check_workflow_transitions(current_user, update_params)
|
83
|
+
ticket_update_response = TicketServices.update(current_user, @ticket, update_params)
|
84
|
+
|
85
|
+
@ticket = ticket_update_response.payload
|
86
|
+
if ticket_update_response.successful?
|
87
|
+
respond_with_successful(@ticket.show(current_user, @query))
|
88
|
+
else
|
89
|
+
respond_with_error(@ticket.errors.full_messages.to_sentence)
|
90
|
+
end
|
91
|
+
else
|
92
|
+
respond_with_error(@ticket.errors.full_messages.to_sentence)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def options
|
97
|
+
#respond_with_successful(Ticket.options(current_user, @query))
|
98
|
+
respond_with_successful({})
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
def destroy
|
103
|
+
return respond_with_not_found unless @ticket
|
104
|
+
return respond_with_unauthorized unless @ticket.is_editable_by?(current_user)
|
105
|
+
|
106
|
+
ticket_destroy_response = TicketServices.destroy(current_user, @ticket)
|
107
|
+
|
108
|
+
if ticket_destroy_response.successful?
|
109
|
+
respond_with_successful
|
110
|
+
else
|
111
|
+
respond_with_error(ticket_destroy_response.payload.errors.full_messages.to_sentence)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def images
|
116
|
+
return respond_with_not_found unless @ticket
|
117
|
+
|
118
|
+
images = @ticket.files.filter do |file|
|
119
|
+
file_name = ""
|
120
|
+
file_name = file.attachment_s3_identifier.downcase if file.attachment_s3_identifier
|
121
|
+
file_name = file.attachment_identifier.downcase if file.attachment_identifier
|
122
|
+
|
123
|
+
file_name.end_with?('png') || file_name.end_with?('jpg') || file_name.end_with?('jpeg')
|
124
|
+
end
|
125
|
+
|
126
|
+
images = images.map do |image|
|
127
|
+
{
|
128
|
+
id: image.id,
|
129
|
+
name: image.name,
|
130
|
+
src: "/help/tickets/#{@ticket.id}/files/#{image.id}",
|
131
|
+
href: "/help/tickets/#{@ticket.id}/files/#{image.id}?view=true"
|
132
|
+
}
|
133
|
+
end
|
134
|
+
|
135
|
+
respond_with_successful(images)
|
136
|
+
end
|
137
|
+
|
138
|
+
private
|
139
|
+
|
140
|
+
def set_ticket
|
141
|
+
ticket_id = params[:id] unless params[:id].blank?
|
142
|
+
ticket_id = params[:ticket_id] unless params[:ticket_id].blank?
|
143
|
+
@ticket = TicketService.new(current_user, query).find(ticket_id)
|
144
|
+
return respond_with_not_found unless @ticket.found?
|
145
|
+
end
|
146
|
+
|
147
|
+
def ticket_params
|
148
|
+
params.require(:ticket).permit(
|
149
|
+
# :cloud_help_catalog_ticket_types_id,
|
150
|
+
# :cloud_help_catalog_ticket_priorities_id,
|
151
|
+
# :cloud_help_catalog_ticket_categories_id,
|
152
|
+
# :cloud_help_catalog_ticket_workspaces_id,
|
153
|
+
# :cloud_help_workflow_statuses_id,
|
154
|
+
:subject,
|
155
|
+
:description,
|
156
|
+
:reference_url,
|
157
|
+
:tags,
|
158
|
+
:hours_worked,
|
159
|
+
:deadline,
|
160
|
+
:started_at,
|
161
|
+
#:finished_at
|
162
|
+
)
|
163
|
+
end
|
164
|
+
|
165
|
+
def completed_ticket_params
|
166
|
+
params.require(:ticket).permit(
|
167
|
+
:cloud_help_workflow_statuses_id
|
168
|
+
)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
=begin
|
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
|
+
=end
|
32
|
+
|
33
|
+
module LesliHelp
|
34
|
+
class Account < ApplicationRecord
|
35
|
+
belongs_to :account, class_name: "Lesli::Account"
|
36
|
+
has_many :tickets
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module LesliHelp
|
2
|
+
class Dashboard::Component < ApplicationRecord
|
3
|
+
|
4
|
+
belongs_to :dashboard, inverse_of: :components
|
5
|
+
|
6
|
+
def self.component_ids
|
7
|
+
["users", "active_roles"]
|
8
|
+
end
|
9
|
+
# components_ids: {
|
10
|
+
# list_new_tickets: "list_new_tickets",
|
11
|
+
# list_my_tickets: "list_my_tickets",
|
12
|
+
# list_unassigned_tickets: "list_unassigned_tickets",
|
13
|
+
# chart_tickets_by_type: "chart_tickets_by_type",
|
14
|
+
# chart_tickets_by_category: "chart_tickets_by_category",
|
15
|
+
# hours_worked: "hours_worked"
|
16
|
+
# }
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
module LesliHelp
|
3
|
+
class Dashboard < Lesli::Shared::Dashboard
|
4
|
+
self.table_name = "lesli_help_dashboards"
|
5
|
+
belongs_to :account
|
6
|
+
|
7
|
+
has_many :components, inverse_of: :dashboard, autosave: true, dependent: :destroy
|
8
|
+
accepts_nested_attributes_for :components, allow_destroy: true
|
9
|
+
|
10
|
+
def self.initialize_data(account)
|
11
|
+
=begin
|
12
|
+
self.create!(
|
13
|
+
account: account,
|
14
|
+
name: "Audit Default Dashboard",
|
15
|
+
default: true,
|
16
|
+
main: false,
|
17
|
+
components_attributes: [{
|
18
|
+
name: "Total users",
|
19
|
+
component_id: "users",
|
20
|
+
layout: 4,
|
21
|
+
query_configuration: {},
|
22
|
+
custom_configuration: {}
|
23
|
+
}]
|
24
|
+
)
|
25
|
+
=end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
=begin
|
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
|
+
=end
|
32
|
+
|
33
|
+
module LesliHelp
|
34
|
+
class Ticket < Lesli::ApplicationLesliRecord
|
35
|
+
belongs_to :account
|
36
|
+
belongs_to :user, class_name: "Lesli::User"
|
37
|
+
belongs_to :creator, class_name: "Lesli::User"
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
=begin
|
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
|
+
=end
|
32
|
+
|
33
|
+
module LesliHelp
|
34
|
+
class TicketService < Lesli::ApplicationLesliService
|
35
|
+
|
36
|
+
def find ticket_id
|
37
|
+
super(current_user.account.help.tickets.find_by(id: ticket_id))
|
38
|
+
end
|
39
|
+
|
40
|
+
def index
|
41
|
+
|
42
|
+
return current_user.account.help.tickets.left_joins(
|
43
|
+
:user, :creator
|
44
|
+
).select(
|
45
|
+
:id,
|
46
|
+
:subject,
|
47
|
+
:deadline,
|
48
|
+
:creator_id,
|
49
|
+
:user_id,
|
50
|
+
"CONCAT_WS(' ', lesli_users.first_name, lesli_users.last_name) as user_name",
|
51
|
+
"CONCAT_WS(' ', creators_lesli_help_tickets.first_name, creators_lesli_help_tickets.last_name) as creator_name",
|
52
|
+
"lesli_help_tickets.updated_at",
|
53
|
+
"lesli_help_tickets.created_at"
|
54
|
+
).order(id: :desc)
|
55
|
+
.page(query[:pagination][:page])
|
56
|
+
.per(query[:pagination][:perPage])
|
57
|
+
|
58
|
+
current_user.account.help.tickets.left_joins(
|
59
|
+
:priority,
|
60
|
+
:type,
|
61
|
+
:workspace,
|
62
|
+
:category,
|
63
|
+
:status,
|
64
|
+
:assignments,
|
65
|
+
:assigned,
|
66
|
+
:user
|
67
|
+
).select(
|
68
|
+
:id,
|
69
|
+
:subject,
|
70
|
+
:deadline,
|
71
|
+
:assigned_id,
|
72
|
+
:user_id,
|
73
|
+
"CONCAT_WS(' ', users.first_name, users.last_name) as assigned_name",
|
74
|
+
"CONCAT_WS(' ', users_cloud_help_tickets.first_name, users_cloud_help_tickets.last_name) as user_name",
|
75
|
+
"cloud_help_tickets.updated_at",
|
76
|
+
"cloud_help_tickets.created_at"
|
77
|
+
)
|
78
|
+
end
|
79
|
+
|
80
|
+
def create(ticket_params)
|
81
|
+
|
82
|
+
ticket = current_user.account.help.tickets.new(ticket_params)
|
83
|
+
#ticket.source = Catalog::TicketSource.cloud_help_source(current_user.account.help)
|
84
|
+
ticket.creator = current_user
|
85
|
+
ticket.user = current_user
|
86
|
+
|
87
|
+
unless ticket_params.dig(:started_at)
|
88
|
+
#ticket.started_at = LC::Date2.new(Time.current).date.get
|
89
|
+
end
|
90
|
+
|
91
|
+
if ticket.save
|
92
|
+
#Ticket.log_activity_create(current_user, ticket)
|
93
|
+
#Ticket::Subscriber.add_subscriber(ticket, current_user, "discussion_created", "email")
|
94
|
+
#Workflow::Action.execute_actions(current_user, ticket, {}, ticket.attributes)
|
95
|
+
self.resource = ticket
|
96
|
+
else
|
97
|
+
pp ticket.errors.full_messages
|
98
|
+
self.error(ticket.errors.full_messages.to_sentence)
|
99
|
+
end
|
100
|
+
|
101
|
+
self
|
102
|
+
end
|
103
|
+
|
104
|
+
def show()
|
105
|
+
return current_user.account.help.tickets.left_joins(
|
106
|
+
:user, :creator
|
107
|
+
).select(
|
108
|
+
:id,
|
109
|
+
:subject,
|
110
|
+
:deadline,
|
111
|
+
:creator_id,
|
112
|
+
:user_id,
|
113
|
+
"CONCAT_WS(' ', lesli_users.first_name, lesli_users.last_name) as user_name",
|
114
|
+
"CONCAT_WS(' ', creators_lesli_help_tickets.first_name, creators_lesli_help_tickets.last_name) as creator_name",
|
115
|
+
"lesli_help_tickets.updated_at",
|
116
|
+
"lesli_help_tickets.created_at"
|
117
|
+
).where("lesli_help_tickets.id = ?", self.resource.id).first
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|