lesli_support 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,48 @@
|
|
|
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 LesliSupport
|
|
34
|
+
class Account < ApplicationRecord
|
|
35
|
+
belongs_to :account, class_name: "Lesli::Account"
|
|
36
|
+
has_many :catalog_workspaces
|
|
37
|
+
has_many :catalog_types
|
|
38
|
+
has_many :catalog_categories
|
|
39
|
+
has_many :catalog_priorities
|
|
40
|
+
has_many :tickets
|
|
41
|
+
|
|
42
|
+
after_create :initialize_account
|
|
43
|
+
|
|
44
|
+
def initialize_account
|
|
45
|
+
Dashboard.initialize_dashboard(self)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module LesliSupport
|
|
2
|
+
class Catalog < ApplicationRecord
|
|
3
|
+
has_ancestry
|
|
4
|
+
belongs_to :parent, class_name: "Catalog", optional: true
|
|
5
|
+
|
|
6
|
+
after_save :catalog_option_order
|
|
7
|
+
|
|
8
|
+
def catalog_option_order
|
|
9
|
+
return if self.parent_id.nil?
|
|
10
|
+
return unless self.order.nil?
|
|
11
|
+
self.order = self.id
|
|
12
|
+
self.save!
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module LesliSupport
|
|
2
|
+
class Dashboard::Component < ApplicationRecord
|
|
3
|
+
|
|
4
|
+
belongs_to :dashboard, inverse_of: :components
|
|
5
|
+
|
|
6
|
+
def self.component_ids
|
|
7
|
+
["version", "my-tasks"]
|
|
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,15 @@
|
|
|
1
|
+
|
|
2
|
+
module LesliSupport
|
|
3
|
+
class Dashboard < Lesli::Shared::Dashboard
|
|
4
|
+
self.table_name = "lesli_support_dashboards"
|
|
5
|
+
|
|
6
|
+
belongs_to :account
|
|
7
|
+
|
|
8
|
+
has_many :components, inverse_of: :dashboard, autosave: true, dependent: :destroy
|
|
9
|
+
accepts_nested_attributes_for :components, allow_destroy: true
|
|
10
|
+
|
|
11
|
+
def self.initialize_dashboard(account)
|
|
12
|
+
super(self, account, [])
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
module LesliSupport
|
|
2
|
+
class Ticket::Discussion < Lesli::CloudObject::Discussion
|
|
3
|
+
belongs_to :cloud_object, class_name: "LesliSupport::Ticket", foreign_key: "ticket_id"
|
|
4
|
+
belongs_to :parent, class_name: "Discussion", optional: true
|
|
5
|
+
has_many :children, class_name: "Discussion", foreign_key: "parent_id"
|
|
6
|
+
end
|
|
7
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
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 LesliSupport
|
|
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
|
+
|
|
39
|
+
belongs_to :catalog_workspace, optional: true
|
|
40
|
+
belongs_to :catalog_type, optional: true
|
|
41
|
+
belongs_to :catalog_category, optional: true
|
|
42
|
+
belongs_to :catalog_priority, optional: true
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,139 @@
|
|
|
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 LesliSupport
|
|
34
|
+
class CatalogService < 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.support.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_support_tickets.first_name, creators_lesli_support_tickets.last_name) as creator_name",
|
|
52
|
+
"lesli_support_tickets.updated_at",
|
|
53
|
+
"lesli_support_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_support_tickets.first_name, creators_lesli_support_tickets.last_name) as creator_name",
|
|
115
|
+
"lesli_support_tickets.updated_at",
|
|
116
|
+
"lesli_support_tickets.created_at"
|
|
117
|
+
).where("lesli_support_tickets.id = ?", self.resource.id).first
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def options()
|
|
121
|
+
catalogs = {}
|
|
122
|
+
|
|
123
|
+
# Retrieve all root nodes (nodes with no parent)
|
|
124
|
+
root_catalogs = current_user.account.support.catalogs
|
|
125
|
+
.where(ancestry: nil)
|
|
126
|
+
|
|
127
|
+
# Fetch all trees
|
|
128
|
+
root_catalogs.each do |catalog|
|
|
129
|
+
catalogs[catalog.name.downcase] = {
|
|
130
|
+
id: catalog.id,
|
|
131
|
+
name: catalog.name,
|
|
132
|
+
options: catalog.children
|
|
133
|
+
}
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
catalogs
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
@@ -0,0 +1,147 @@
|
|
|
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 LesliSupport
|
|
34
|
+
class TicketService < Lesli::ApplicationLesliService
|
|
35
|
+
|
|
36
|
+
def find ticket_id
|
|
37
|
+
super(current_user.account.support.tickets.find_by(id: ticket_id))
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def index
|
|
41
|
+
|
|
42
|
+
return current_user.account.support.tickets.left_joins(
|
|
43
|
+
:user,
|
|
44
|
+
:creator,
|
|
45
|
+
:catalog_priority
|
|
46
|
+
).select(
|
|
47
|
+
:id,
|
|
48
|
+
:subject,
|
|
49
|
+
:deadline,
|
|
50
|
+
:creator_id,
|
|
51
|
+
:user_id,
|
|
52
|
+
"CONCAT_WS(' ', lesli_users.first_name, lesli_users.last_name) as user_name",
|
|
53
|
+
"CONCAT_WS(' ', creators_lesli_support_tickets.first_name, creators_lesli_support_tickets.last_name) as creator_name",
|
|
54
|
+
"lesli_support_tickets.updated_at",
|
|
55
|
+
"lesli_support_tickets.created_at",
|
|
56
|
+
"lesli_support_catalog_priorities.name as priority_name"
|
|
57
|
+
).order(id: :desc)
|
|
58
|
+
.page(query[:pagination][:page])
|
|
59
|
+
.per(query[:pagination][:perPage])
|
|
60
|
+
|
|
61
|
+
current_user.account.help.tickets.left_joins(
|
|
62
|
+
:priority,
|
|
63
|
+
:type,
|
|
64
|
+
:workspace,
|
|
65
|
+
:category,
|
|
66
|
+
:status,
|
|
67
|
+
:assignments,
|
|
68
|
+
:assigned,
|
|
69
|
+
:user
|
|
70
|
+
).select(
|
|
71
|
+
:id,
|
|
72
|
+
:subject,
|
|
73
|
+
:deadline,
|
|
74
|
+
:assigned_id,
|
|
75
|
+
:user_id,
|
|
76
|
+
"CONCAT_WS(' ', users.first_name, users.last_name) as assigned_name",
|
|
77
|
+
"CONCAT_WS(' ', users_cloud_help_tickets.first_name, users_cloud_help_tickets.last_name) as user_name",
|
|
78
|
+
"cloud_help_tickets.updated_at",
|
|
79
|
+
"cloud_help_tickets.created_at"
|
|
80
|
+
)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def create(ticket_params)
|
|
84
|
+
|
|
85
|
+
ticket = current_user.account.support.tickets.new(ticket_params)
|
|
86
|
+
#ticket.source = Catalog::TicketSource.cloud_help_source(current_user.account.help)
|
|
87
|
+
ticket.creator = current_user
|
|
88
|
+
ticket.user = current_user
|
|
89
|
+
|
|
90
|
+
unless ticket_params.dig(:started_at)
|
|
91
|
+
#ticket.started_at = LC::Date2.new(Time.current).date.get
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if ticket.save
|
|
95
|
+
#Ticket.log_activity_create(current_user, ticket)
|
|
96
|
+
#Ticket::Subscriber.add_subscriber(ticket, current_user, "discussion_created", "email")
|
|
97
|
+
#Workflow::Action.execute_actions(current_user, ticket, {}, ticket.attributes)
|
|
98
|
+
self.resource = ticket
|
|
99
|
+
else
|
|
100
|
+
pp ticket.errors.full_messages
|
|
101
|
+
self.error(ticket.errors.full_messages.to_sentence)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
self
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def show()
|
|
108
|
+
return current_user.account.support.tickets.left_joins(
|
|
109
|
+
:user, :creator
|
|
110
|
+
).select(
|
|
111
|
+
:id,
|
|
112
|
+
:subject,
|
|
113
|
+
:description,
|
|
114
|
+
:reference_url,
|
|
115
|
+
:deadline,
|
|
116
|
+
:started_at,
|
|
117
|
+
:completed_at,
|
|
118
|
+
:hours_worked,
|
|
119
|
+
:creator_id,
|
|
120
|
+
:user_id,
|
|
121
|
+
:catalog_workspace_id,
|
|
122
|
+
:catalog_type_id,
|
|
123
|
+
:catalog_category_id,
|
|
124
|
+
:catalog_priority_id,
|
|
125
|
+
"CONCAT_WS(' ', lesli_users.first_name, lesli_users.last_name) as user_name",
|
|
126
|
+
"CONCAT_WS(' ', creators_lesli_support_tickets.first_name, creators_lesli_support_tickets.last_name) as creator_name",
|
|
127
|
+
"lesli_support_tickets.updated_at",
|
|
128
|
+
"lesli_support_tickets.created_at"
|
|
129
|
+
).where("lesli_support_tickets.id = ?", self.resource.id).first
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def update(params)
|
|
133
|
+
self.resource.update(params)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def with_deadline()
|
|
137
|
+
current_user.account.support.tickets
|
|
138
|
+
#.joins("left join cloud_help_ticket_assignments chta on chta.cloud_help_tickets_id = cloud_help_tickets.id and chta.users_id = #{current_user.id}")
|
|
139
|
+
.select(:id, :subject, :description, :deadline)
|
|
140
|
+
.where.not(:deadline => nil)
|
|
141
|
+
#.where("cloud_help_tickets.deadline >= ?", query[:filters][:start_date])
|
|
142
|
+
#.where("cloud_help_tickets.deadline <= ? ", query[:filters][:end_date])
|
|
143
|
+
#.where("cloud_help_tickets.users_id = ? or cloud_help_tickets.user_main_id = ? or chta.users_id = ?", current_user.id, current_user.id, current_user.id)
|
|
144
|
+
.order(:deadline)
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%= form_with(model: account) do |form| %>
|
|
2
|
+
<% if account.errors.any? %>
|
|
3
|
+
<div style="color: red">
|
|
4
|
+
<h2><%= pluralize(account.errors.count, "error") %> prohibited this account from being saved:</h2>
|
|
5
|
+
|
|
6
|
+
<ul>
|
|
7
|
+
<% account.errors.each do |error| %>
|
|
8
|
+
<li><%= error.full_message %></li>
|
|
9
|
+
<% end %>
|
|
10
|
+
</ul>
|
|
11
|
+
</div>
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
14
|
+
<div>
|
|
15
|
+
<%= form.submit %>
|
|
16
|
+
</div>
|
|
17
|
+
<% end %>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<p style="color: green"><%= notice %></p>
|
|
2
|
+
|
|
3
|
+
<h1>Accounts</h1>
|
|
4
|
+
|
|
5
|
+
<div id="accounts">
|
|
6
|
+
<% @accounts.each do |account| %>
|
|
7
|
+
<%= render account %>
|
|
8
|
+
<p>
|
|
9
|
+
<%= link_to "Show this account", account %>
|
|
10
|
+
</p>
|
|
11
|
+
<% end %>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<%= link_to "New account", new_account_path %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<p style="color: green"><%= notice %></p>
|
|
2
|
+
|
|
3
|
+
<%= render @account %>
|
|
4
|
+
|
|
5
|
+
<div>
|
|
6
|
+
<%= link_to "Edit this account", edit_account_path(@account) %> |
|
|
7
|
+
<%= link_to "Back to accounts", accounts_path %>
|
|
8
|
+
|
|
9
|
+
<%= button_to "Destroy this account", @account, method: :delete %>
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%= form_with(model: catalog_category) do |form| %>
|
|
2
|
+
<% if catalog_category.errors.any? %>
|
|
3
|
+
<div style="color: red">
|
|
4
|
+
<h2><%= pluralize(catalog_category.errors.count, "error") %> prohibited this catalog_category from being saved:</h2>
|
|
5
|
+
|
|
6
|
+
<ul>
|
|
7
|
+
<% catalog_category.errors.each do |error| %>
|
|
8
|
+
<li><%= error.full_message %></li>
|
|
9
|
+
<% end %>
|
|
10
|
+
</ul>
|
|
11
|
+
</div>
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
14
|
+
<div>
|
|
15
|
+
<%= form.submit %>
|
|
16
|
+
</div>
|
|
17
|
+
<% end %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<h1>Editing catalog category</h1>
|
|
2
|
+
|
|
3
|
+
<%= render "form", catalog_category: @catalog_category %>
|
|
4
|
+
|
|
5
|
+
<br>
|
|
6
|
+
|
|
7
|
+
<div>
|
|
8
|
+
<%= link_to "Show this catalog category", @catalog_category %> |
|
|
9
|
+
<%= link_to "Back to catalog categories", catalog_categories_path %>
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<p style="color: green"><%= notice %></p>
|
|
2
|
+
|
|
3
|
+
<h1>Catalog categories</h1>
|
|
4
|
+
|
|
5
|
+
<div id="catalog_categories">
|
|
6
|
+
<% @catalog_categories.each do |catalog_category| %>
|
|
7
|
+
<%= render catalog_category %>
|
|
8
|
+
<p>
|
|
9
|
+
<%= link_to "Show this catalog category", catalog_category %>
|
|
10
|
+
</p>
|
|
11
|
+
<% end %>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<%= link_to "New catalog category", new_catalog_category_path %>
|