lesli_bell 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_bell_manifest.js +40 -0
- data/app/assets/javascripts/lesli_bell/application.js +2848 -0
- data/app/assets/stylesheets/lesli_bell/application.css +15 -0
- data/app/controllers/lesli_bell/accounts_controller.rb +4 -0
- data/app/controllers/lesli_bell/announcements_controller.rb +60 -0
- data/app/controllers/lesli_bell/application_controller.rb +4 -0
- data/app/controllers/lesli_bell/dashboards_controller.rb +59 -0
- data/app/controllers/lesli_bell/notifications_controller.rb +60 -0
- data/app/helpers/lesli_bell/accounts_helper.rb +4 -0
- data/app/helpers/lesli_bell/announcements_helper.rb +4 -0
- data/app/helpers/lesli_bell/application_helper.rb +4 -0
- data/app/helpers/lesli_bell/dashboards_helper.rb +4 -0
- data/app/helpers/lesli_bell/notifications_helper.rb +4 -0
- data/app/jobs/lesli_bell/application_job.rb +4 -0
- data/app/mailers/lesli_bell/application_mailer.rb +6 -0
- data/app/models/lesli_bell/account.rb +7 -0
- data/app/models/lesli_bell/announcement.rb +4 -0
- data/app/models/lesli_bell/application_record.rb +5 -0
- data/app/models/lesli_bell/dashboard.rb +4 -0
- data/app/models/lesli_bell/notification.rb +28 -0
- data/app/services/lesli_bell/notification_service.rb +87 -0
- data/app/views/lesli_bell/accounts/_account.html.erb +2 -0
- data/app/views/lesli_bell/accounts/_form.html.erb +17 -0
- data/app/views/lesli_bell/accounts/edit.html.erb +10 -0
- data/app/views/lesli_bell/accounts/index.html.erb +14 -0
- data/app/views/lesli_bell/accounts/new.html.erb +9 -0
- data/app/views/lesli_bell/accounts/show.html.erb +10 -0
- data/app/views/lesli_bell/announcements/_announcement.html.erb +2 -0
- data/app/views/lesli_bell/announcements/_form.html.erb +17 -0
- data/app/views/lesli_bell/announcements/edit.html.erb +10 -0
- data/app/views/lesli_bell/announcements/index.html.erb +14 -0
- data/app/views/lesli_bell/announcements/new.html.erb +9 -0
- data/app/views/lesli_bell/announcements/show.html.erb +10 -0
- data/app/views/lesli_bell/dashboards/_dashboard.html.erb +2 -0
- data/app/views/lesli_bell/dashboards/_form.html.erb +17 -0
- data/app/views/lesli_bell/dashboards/edit.html.erb +10 -0
- data/app/views/lesli_bell/dashboards/index.html.erb +14 -0
- data/app/views/lesli_bell/dashboards/new.html.erb +9 -0
- data/app/views/lesli_bell/dashboards/show.html.erb +1 -0
- data/app/views/lesli_bell/notifications/edit.html.erb +10 -0
- data/app/views/lesli_bell/notifications/index.html.erb +33 -0
- data/app/views/lesli_bell/notifications/new.html.erb +9 -0
- data/app/views/lesli_bell/notifications/show.html.erb +10 -0
- data/app/views/lesli_bell/partials/_engine-navigation.html.erb +24 -0
- data/config/routes.rb +6 -0
- data/db/migrate/v1.0/0308000110_create_lesli_bell_accounts.rb +28 -0
- data/db/migrate/v1.0/0308100110_create_lesli_bell_notifications.rb +41 -0
- data/db/migrate/v1.0/0308100210_create_lesli_bell_notification_activities.rb +17 -0
- data/db/migrate/v1.0/0308110110_create_lesli_bell_announcements.rb +40 -0
- data/db/migrate/v1.0/0308110210_create_lesli_bell_announcement_activities.rb +17 -0
- data/db/migrate/v1.0/0308110310_create_lesli_bell_announcement_users.rb +12 -0
- data/db/seed/development.rb +36 -0
- data/db/seed/production.rb +0 -0
- data/db/seed/test.rb +0 -0
- data/db/seeds.rb +25 -0
- data/lib/lesli_bell/engine.rb +18 -0
- data/lib/lesli_bell/version.rb +4 -0
- data/lib/lesli_bell.rb +6 -0
- data/lib/tasks/lesli_bell_tasks.rake +4 -0
- data/lib/vue/application.js +51 -0
- data/lib/vue/apps/announcements/components/form.vue +237 -0
- data/lib/vue/apps/announcements/index.vue +124 -0
- data/lib/vue/apps/announcements/new.vue +48 -0
- data/lib/vue/apps/notifications/components/notification-form.vue +149 -0
- data/lib/vue/apps/notifications/index.vue +129 -0
- data/lib/vue/apps/notifications/new.vue +45 -0
- data/lib/vue/stores/announcement.js +142 -0
- data/lib/vue/stores/notification.js +115 -0
- data/readme.md +28 -0
- metadata +116 -0
@@ -0,0 +1,10 @@
|
|
1
|
+
<p style="color: green"><%= notice %></p>
|
2
|
+
|
3
|
+
<%= render @notification %>
|
4
|
+
|
5
|
+
<div>
|
6
|
+
<%= link_to "Edit this notification", edit_notification_path(@notification) %> |
|
7
|
+
<%= link_to "Back to notifications", notifications_path %>
|
8
|
+
|
9
|
+
<%= button_to "Destroy this notification", @notification, method: :delete %>
|
10
|
+
</div>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<%#
|
2
|
+
|
3
|
+
Copyright (c) 2020, 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
|
+
|
21
|
+
<%= navigation_item(lesli_bell.dashboard_path, "Dashboard", "ri-dashboard-3-line") %>
|
22
|
+
<%= navigation_item(lesli_bell.notifications_path, "Notifications", "ri-notification-3-line") %>
|
23
|
+
<%= navigation_item(lesli_bell.announcements_path, "Announcements", "ri-feedback-line") %>
|
24
|
+
<%= navigation_item(lesli_bell.dashboard_path, "Settings", "ri-settings-3-line") %>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
Copyright (c) 2020, 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
|
+
=end
|
19
|
+
|
20
|
+
class CreateLesliBellAccounts < ActiveRecord::Migration[7.0]
|
21
|
+
def change
|
22
|
+
create_table :lesli_bell_accounts do |t|
|
23
|
+
t.timestamps
|
24
|
+
t.datetime :deleted_at, index: true
|
25
|
+
end
|
26
|
+
add_reference(:lesli_bell_accounts, :account, foreign_key: { to_table: :lesli_accounts })
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
Copyright (c) 2020, 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
|
+
=end
|
19
|
+
|
20
|
+
class CreateLesliBellNotifications < ActiveRecord::Migration[7.0]
|
21
|
+
|
22
|
+
def change
|
23
|
+
create_table :lesli_bell_notifications do |t|
|
24
|
+
t.string :subject
|
25
|
+
t.text :body
|
26
|
+
t.string :url
|
27
|
+
t.string :status
|
28
|
+
t.string :category
|
29
|
+
t.string :channel
|
30
|
+
t.string :notification_type
|
31
|
+
t.string :media
|
32
|
+
t.json :payload
|
33
|
+
|
34
|
+
t.timestamps
|
35
|
+
t.datetime :deleted_at, index: true
|
36
|
+
end
|
37
|
+
|
38
|
+
add_reference(:lesli_bell_notifications, :user, foreign_key: { to_table: :lesli_users })
|
39
|
+
add_reference(:lesli_bell_notifications, :account, foreign_key: { to_table: :lesli_accounts })
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateLesliBellNotificationActivities < ActiveRecord::Migration[7.0]
|
2
|
+
#def change
|
3
|
+
# table_base_structure = JSON.parse(File.read(Rails.root.join('db','structure','00000004_activities.json')))
|
4
|
+
# create_table :cloud_bell_notification_activities do |t|
|
5
|
+
# table_base_structure.each do |column|
|
6
|
+
# t.send(
|
7
|
+
# column["type"].parameterize.underscore.to_sym,
|
8
|
+
# column["name"].parameterize.underscore.to_sym
|
9
|
+
# )
|
10
|
+
# end
|
11
|
+
# t.timestamps
|
12
|
+
# end
|
13
|
+
|
14
|
+
# add_reference :cloud_bell_notification_activities, :cloud_bell_notifications, foreign_key: true, index: { name: "cloud_bell_activities_notifications" }
|
15
|
+
# add_foreign_key :cloud_bell_notification_activities, :users, column: :users_id
|
16
|
+
#end
|
17
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
Copyright (c) 2020, 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
|
+
=end
|
19
|
+
|
20
|
+
class CreateLesliBellAnnouncements < ActiveRecord::Migration[6.0]
|
21
|
+
def change
|
22
|
+
create_table :lesli_bell_announcements do |t|
|
23
|
+
t.string :url, index: true
|
24
|
+
t.string :name
|
25
|
+
t.string :category
|
26
|
+
t.string :base_path
|
27
|
+
t.text :message
|
28
|
+
t.boolean :status
|
29
|
+
t.datetime :start_at
|
30
|
+
t.datetime :end_at
|
31
|
+
t.boolean :can_be_closed, :default => true
|
32
|
+
t.datetime :deleted_at, index: true
|
33
|
+
t.timestamps
|
34
|
+
end
|
35
|
+
|
36
|
+
add_reference(:lesli_bell_announcements, :user, foreign_key: { to_table: :lesli_users })
|
37
|
+
add_reference(:lesli_bell_announcements, :role, foreign_key: { to_table: :lesli_roles })
|
38
|
+
add_reference(:lesli_bell_announcements, :account, foreign_key: { to_table: :lesli_accounts })
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateLesliBellAnnouncementActivities < ActiveRecord::Migration[7.0]
|
2
|
+
def change
|
3
|
+
# table_base_structure = JSON.parse(File.read(Rails.root.join('db','structure','00000004_activities.json')))
|
4
|
+
# create_table :cloud_bell_announcement_activities do |t|
|
5
|
+
# table_base_structure.each do |column|
|
6
|
+
# t.send(
|
7
|
+
# column["type"].parameterize.underscore.to_sym,
|
8
|
+
# column["name"].parameterize.underscore.to_sym
|
9
|
+
# )
|
10
|
+
# end
|
11
|
+
# t.timestamps
|
12
|
+
# end
|
13
|
+
|
14
|
+
# add_reference :cloud_bell_announcement_activities, :cloud_bell_announcements, foreign_key: true, index: { name: "cloud_bell_activities_announcements" }
|
15
|
+
# add_foreign_key :cloud_bell_announcement_activities, :users, column: :users_id
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateLesliBellAnnouncementUsers < ActiveRecord::Migration[7.0]
|
2
|
+
def change
|
3
|
+
# create_table :cloud_bell_announcement_users do |t|
|
4
|
+
# t.string :status
|
5
|
+
# t.timestamps
|
6
|
+
# t.datetime :deleted_at, index: true
|
7
|
+
# end
|
8
|
+
|
9
|
+
# add_reference :cloud_bell_announcement_users, :users, foreign_key: true
|
10
|
+
# add_reference :cloud_bell_announcement_users, :cloud_bell_announcements, foreign_key: true, index: { name: "cloud_bell_announcements_users" }
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
=begin
|
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
|
+
=end
|
18
|
+
|
19
|
+
current_user = ::Lesli::User.first
|
20
|
+
LesliBell::NotificationService.new(current_user).create("New notification created")
|
21
|
+
# Courier::Bell::Notification.new(current_user, "New notification created")
|
22
|
+
# Courier::Bell::Notification.new(current_user, "New info notification created", category: "info")
|
23
|
+
# Courier::Bell::Notification.new(current_user, "New success notification created", category: "success")
|
24
|
+
# Courier::Bell::Notification.new(current_user, "New warning notification created", category: "warning")
|
25
|
+
# Courier::Bell::Notification.new(current_user, "New danger notification created", category: "danger")
|
26
|
+
|
27
|
+
# Courier::Bell::Notification.new(current_user, "New notification created with body", body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
|
28
|
+
# Courier::Bell::Notification.new(current_user, "New notification info created with body", body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", category: "info")
|
29
|
+
# Courier::Bell::Notification.new(current_user, "New notification success created with body", body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", category: "success")
|
30
|
+
# Courier::Bell::Notification.new(current_user, "New notification warning created with body", body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", category: "warning")
|
31
|
+
# Courier::Bell::Notification.new(current_user, "New notification danger created with body", body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", category: "danger")
|
32
|
+
|
33
|
+
# Courier::Bell::Notification.new(current_user, "New notification created with body and link", body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", url:"/bell")
|
34
|
+
# Courier::Bell::Notification.new(current_user, "New notification info created with body and link", body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", url:"/bell", category: "info")
|
35
|
+
# Courier::Bell::Notification.new(current_user, "New notification success created with body and link", body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", url:"/bell", category: "success")
|
36
|
+
# Courier::Bell::Notification.new(current_user, "New notification warning created with body and link", body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", url:"/bell", category: "warning")
|
File without changes
|
data/db/seed/test.rb
ADDED
File without changes
|
data/db/seeds.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
=begin
|
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
|
+
=end
|
18
|
+
|
19
|
+
|
20
|
+
# IMPORTANT: Seed files are only for development, if you need to create default resources for production
|
21
|
+
# you must use the initializer method in the Engine account model
|
22
|
+
if Rails.env.development?
|
23
|
+
L2.msg("Loading seeds for CloudBell environment", "Version: #{LesliBell::VERSION}", "Build: #{LesliBell::BUILD}")
|
24
|
+
load LesliBell::Engine.root.join("db", "seed", "#{ Rails.env.downcase }.rb")
|
25
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module LesliBell
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace LesliBell
|
4
|
+
|
5
|
+
initializer :lesli_bell do |app|
|
6
|
+
|
7
|
+
# register assets manifest
|
8
|
+
config.assets.precompile += %w[lesli_bell_manifest.js]
|
9
|
+
|
10
|
+
# register engine migrations path
|
11
|
+
unless app.root.to_s.match root.to_s
|
12
|
+
config.paths["db/migrate"].expanded.each do |expanded_path|
|
13
|
+
app.config.paths["db/migrate"] << expanded_path
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/lesli_bell.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
/*
|
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
|
+
|
21
|
+
// · Import main app
|
22
|
+
import application from "Lesli/application"
|
23
|
+
|
24
|
+
|
25
|
+
// · Import apps and components
|
26
|
+
// import appDashboard from "Lesli/cloud-objects/dashboards/apps/show.vue"
|
27
|
+
|
28
|
+
// import appNotificationsIndex from "./apps/notifications/index.vue"
|
29
|
+
// import appNotificationsNew from "./apps/notifications/new.vue"
|
30
|
+
|
31
|
+
// import appAnnouncementsIndex from "./apps/announcements/index.vue"
|
32
|
+
// import appAnnouncementsNew from "./apps/announcements/new.vue"
|
33
|
+
|
34
|
+
|
35
|
+
// · Cloud app
|
36
|
+
application("LesliBell", [/*{
|
37
|
+
path: "/",
|
38
|
+
component: appDashboard
|
39
|
+
}, {
|
40
|
+
path: "/notifications",
|
41
|
+
component: appNotificationsIndex
|
42
|
+
}, {
|
43
|
+
path: "/notifications/new",
|
44
|
+
component: appNotificationsNew
|
45
|
+
}, {
|
46
|
+
path: "/announcements",
|
47
|
+
component: appAnnouncementsIndex
|
48
|
+
}, {
|
49
|
+
path: "/announcements/new",
|
50
|
+
component: appAnnouncementsNew
|
51
|
+
}*/])
|
@@ -0,0 +1,237 @@
|
|
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
|
+
// · import vue tools
|
20
|
+
import { onMounted, ref, watch } from "vue"
|
21
|
+
|
22
|
+
// · import store
|
23
|
+
import { useBellAnnouncement } from "LesliBell/stores/announcement"
|
24
|
+
|
25
|
+
import editorRichText from "Lesli/components/editors/richtext.vue"
|
26
|
+
import RichtextViewer from "Lesli/components/editors/richtext-viewer.vue"
|
27
|
+
|
28
|
+
|
29
|
+
// · implement store
|
30
|
+
const announcementStore = useBellAnnouncement()
|
31
|
+
|
32
|
+
// . Defining translations
|
33
|
+
const translations = {
|
34
|
+
core: {
|
35
|
+
shared: I18n.t("core.shared")
|
36
|
+
},
|
37
|
+
bell: {
|
38
|
+
notifications: I18n.t("bell.notifications"),
|
39
|
+
announcements: I18n.t("bell.announcements")
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
const closeOptions = {
|
44
|
+
yes: {
|
45
|
+
label: "yes",
|
46
|
+
value: true
|
47
|
+
},
|
48
|
+
no: {
|
49
|
+
label: "no",
|
50
|
+
value: false
|
51
|
+
}
|
52
|
+
|
53
|
+
}
|
54
|
+
|
55
|
+
const selectOptions = [
|
56
|
+
{ label: "Info", value: "info"},
|
57
|
+
{ label: "Alert", value: "danger"},
|
58
|
+
{ label: "Primary", value: "primary"},
|
59
|
+
{ label: "Link", value: "link"},
|
60
|
+
{ label: "Success", value: "success"},
|
61
|
+
{ label: "Warning", value: "warning"}
|
62
|
+
]
|
63
|
+
|
64
|
+
/**
|
65
|
+
* @description This function is used to verify that the start date is before the end date
|
66
|
+
*/
|
67
|
+
function updateDates(){
|
68
|
+
if (announcementStore.record.start_at != "" && announcementStore.record.end_at != "") {
|
69
|
+
if (announcementStore.record.start_at >= announcementStore.record.end_at){
|
70
|
+
announcementStore.record.start_at = ""
|
71
|
+
announcementStore.msg.danger("Select valid range for date")
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
|
77
|
+
// · initializing
|
78
|
+
onMounted(() => {
|
79
|
+
announcementStore.getUsers()
|
80
|
+
announcementStore.getRoles()
|
81
|
+
})
|
82
|
+
</script>
|
83
|
+
|
84
|
+
<template>
|
85
|
+
<form @submit.prevent="announcementStore.post()" class="card py-4">
|
86
|
+
<div class="columns is-marginless has-border-bottom">
|
87
|
+
<div class="column is-4">
|
88
|
+
<label class="label">
|
89
|
+
{{ translations.bell.announcements.column_name }}
|
90
|
+
<sup class="has-text-danger">*</sup>
|
91
|
+
</label>
|
92
|
+
</div>
|
93
|
+
<div class="column">
|
94
|
+
<div class="control is-clearfix">
|
95
|
+
<input
|
96
|
+
type="text"
|
97
|
+
autocomplete="on"
|
98
|
+
name="subject"
|
99
|
+
required
|
100
|
+
class="input"
|
101
|
+
v-model="announcementStore.record.name"
|
102
|
+
/>
|
103
|
+
</div>
|
104
|
+
</div>
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<div class="columns is-marginless has-border-bottom">
|
108
|
+
<div class="column is-4">
|
109
|
+
<label class="label">
|
110
|
+
{{ translations.bell.announcements.view_text_triggered_on }}
|
111
|
+
</label>
|
112
|
+
</div>
|
113
|
+
<div class="column">
|
114
|
+
<div class="control is-clearfix">
|
115
|
+
<input
|
116
|
+
type="text"
|
117
|
+
autocomplete="on"
|
118
|
+
name="subject"
|
119
|
+
class="input"
|
120
|
+
v-model="announcementStore.record.base_path"
|
121
|
+
/>
|
122
|
+
</div>
|
123
|
+
</div>
|
124
|
+
</div>
|
125
|
+
|
126
|
+
<div class="columns is-marginless has-border-bottom">
|
127
|
+
<div class="column is-4">
|
128
|
+
<label class="label">
|
129
|
+
{{translations.bell.announcements.column_message}}
|
130
|
+
<sup class="has-text-danger">*</sup>
|
131
|
+
</label>
|
132
|
+
</div>
|
133
|
+
<div class="column">
|
134
|
+
<div class="control is-clearfix">
|
135
|
+
<editor-rich-text mode="small" v-model="announcementStore.record.message"></editor-rich-text>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
<div class="columns is-marginless has-border-bottom">
|
141
|
+
<div class="column is-4">
|
142
|
+
<label class="label">{{translations.bell.announcements.column_start_at}}</label>
|
143
|
+
</div>
|
144
|
+
<div class="column">
|
145
|
+
<input class="input is-info" type="date" v-model="announcementStore.record.start_at" @change="updateDates">
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
<div class="columns is-marginless has-border-bottom">
|
150
|
+
<div class="column is-4">
|
151
|
+
<label class="label">{{translations.bell.announcements.column_end_at}}</label>
|
152
|
+
</div>
|
153
|
+
<div class="column">
|
154
|
+
<input class="input is-info" type="date" v-model="announcementStore.record.end_at" @change="updateDates">
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
|
159
|
+
<div class="columns is-marginless has-border-bottom">
|
160
|
+
<div class="column is-4">
|
161
|
+
<label class="label">
|
162
|
+
{{translations.bell.announcements.column_kind}}
|
163
|
+
</label>
|
164
|
+
</div>
|
165
|
+
<div class="column">
|
166
|
+
<div class="control is-clearfix">
|
167
|
+
<lesli-select
|
168
|
+
v-model = "announcementStore.record.category"
|
169
|
+
:options="selectOptions">
|
170
|
+
</lesli-select>
|
171
|
+
</div>
|
172
|
+
</div>
|
173
|
+
</div>
|
174
|
+
|
175
|
+
<div class="columns is-marginless has-border-bottom">
|
176
|
+
<div class="column is-4">
|
177
|
+
<label class="label">
|
178
|
+
{{translations.bell.announcements.column_can_be_closed}}
|
179
|
+
<sup class="has-text-danger">*</sup>
|
180
|
+
</label>
|
181
|
+
</div>
|
182
|
+
<div class="column">
|
183
|
+
<label :for="option.label" class="radio" v-for="option in closeOptions" :key="option">
|
184
|
+
<input name="user_salutation" type="radio" :id="option.label" :value="option.value" v-model="announcementStore.record.can_be_closed" required/>
|
185
|
+
{{option.label}}
|
186
|
+
</label>
|
187
|
+
</div>
|
188
|
+
</div>
|
189
|
+
|
190
|
+
<div class="columns is-marginless has-border-bottom">
|
191
|
+
<div class="column is-4">
|
192
|
+
<label class="label">
|
193
|
+
{{ translations.bell.notifications.view_text_receiver_users }}
|
194
|
+
</label>
|
195
|
+
</div>
|
196
|
+
<div class="column">
|
197
|
+
<div class="control is-clearfix">
|
198
|
+
<lesli-input-tag
|
199
|
+
v-model="announcementStore.receiverUsers"
|
200
|
+
:placeholder="translations.core.shared.view_placeholder_search"
|
201
|
+
:options="announcementStore.users"
|
202
|
+
:filterFields="['name', 'email']"
|
203
|
+
showField="email"
|
204
|
+
/>
|
205
|
+
</div>
|
206
|
+
</div>
|
207
|
+
</div>
|
208
|
+
|
209
|
+
<div class="columns is-marginless has-border-bottom">
|
210
|
+
<div class="column is-4">
|
211
|
+
<label class="label">
|
212
|
+
{{ translations.bell.notifications.view_text_receiver_roles }}
|
213
|
+
</label>
|
214
|
+
</div>
|
215
|
+
<div class="column">
|
216
|
+
<div class="control is-clearfix">
|
217
|
+
<lesli-input-tag
|
218
|
+
v-model="announcementStore.receiverRoles"
|
219
|
+
:placeholder="translations.core.shared.view_placeholder_search"
|
220
|
+
:options="announcementStore.roles"
|
221
|
+
:filterFields="['name']"
|
222
|
+
showField="name"
|
223
|
+
/>
|
224
|
+
</div>
|
225
|
+
</div>
|
226
|
+
</div>
|
227
|
+
|
228
|
+
<div class="px-3 ql-bg-blue">
|
229
|
+
<button
|
230
|
+
type="submit"
|
231
|
+
class="button is-fullwidth has-text-centered submit-button is-primary"
|
232
|
+
>
|
233
|
+
{{ translations.core.shared.view_btn_save }}
|
234
|
+
</button>
|
235
|
+
</div>
|
236
|
+
</form>
|
237
|
+
</template>
|