lesli_bell 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_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,124 @@
|
|
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 { ref, reactive, onMounted, watch, computed, inject } from "vue"
|
22
|
+
import { useRouter, useRoute } from 'vue-router'
|
23
|
+
|
24
|
+
// · import lesli stores
|
25
|
+
import { useBellAnnouncement } from "LesliBell/stores/announcement"
|
26
|
+
|
27
|
+
// · initialize/inject plugins
|
28
|
+
const router = useRouter()
|
29
|
+
const msg = inject("msg")
|
30
|
+
const url = inject("url")
|
31
|
+
const date = inject("date")
|
32
|
+
|
33
|
+
|
34
|
+
// · implement stores
|
35
|
+
const storeAnnouncement = useBellAnnouncement()
|
36
|
+
|
37
|
+
|
38
|
+
// ·
|
39
|
+
const translations = {
|
40
|
+
core: {
|
41
|
+
shared: I18n.t("core.shared")
|
42
|
+
},
|
43
|
+
bell: {
|
44
|
+
announcements: I18n.t("bell.announcements")
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
const columns = [{
|
49
|
+
field: "id",
|
50
|
+
label: translations.bell.announcements.column_id
|
51
|
+
}, {
|
52
|
+
field: "name",
|
53
|
+
label: translations.bell.announcements.column_name
|
54
|
+
}, {
|
55
|
+
field: "start_at",
|
56
|
+
label: translations.bell.announcements.column_start_at
|
57
|
+
}, {
|
58
|
+
field: "end_at",
|
59
|
+
label: translations.bell.announcements.column_end_at
|
60
|
+
}]
|
61
|
+
|
62
|
+
// · initializing
|
63
|
+
onMounted(() => {
|
64
|
+
storeAnnouncement.fetch()
|
65
|
+
})
|
66
|
+
|
67
|
+
</script>
|
68
|
+
<template>
|
69
|
+
<section class="application-component">
|
70
|
+
<lesli-header :title="translations.bell.announcements.view_title_notifications">
|
71
|
+
<lesli-button :to="url.bell('announcements/new')" icon="add">
|
72
|
+
{{ translations.core.shared.view_btn_add }}
|
73
|
+
</lesli-button>
|
74
|
+
</lesli-header>
|
75
|
+
|
76
|
+
<lesli-table
|
77
|
+
:columns="columns"
|
78
|
+
:records="storeAnnouncement.records"
|
79
|
+
:pagination="storeAnnouncement.pagination"
|
80
|
+
@paginate="storeAnnouncement.paginate">
|
81
|
+
<template #id="{ value, record }">
|
82
|
+
<span :class="['tag', 'is-medium', 'is-' + record.category]">
|
83
|
+
{{ value }}
|
84
|
+
</span>
|
85
|
+
</template>
|
86
|
+
<template #subject="{ column, value, record }">
|
87
|
+
<h4>{{ record.subject }}</h4>
|
88
|
+
<p>{{ record.body }}</p>
|
89
|
+
</template>
|
90
|
+
<template #url="{ value }">
|
91
|
+
<a :href="value" class="has-text-link hover">{{ value }}</a>
|
92
|
+
</template>
|
93
|
+
<template #start_at="{ value }">
|
94
|
+
<p>
|
95
|
+
<span class="icon-text">
|
96
|
+
<span class="icon">
|
97
|
+
<span class="has-text-grey material-icons">
|
98
|
+
calendar_month
|
99
|
+
</span>
|
100
|
+
</span>
|
101
|
+
<span>
|
102
|
+
{{ date.date(value) }}
|
103
|
+
</span>
|
104
|
+
</span>
|
105
|
+
</p>
|
106
|
+
</template>
|
107
|
+
<template #end_at="{ value }">
|
108
|
+
<p>
|
109
|
+
<span class="icon-text">
|
110
|
+
<span class="icon">
|
111
|
+
<span class="has-text-grey material-icons">
|
112
|
+
calendar_month
|
113
|
+
</span>
|
114
|
+
</span>
|
115
|
+
<span>
|
116
|
+
{{ date.date(value) }}
|
117
|
+
</span>
|
118
|
+
</span>
|
119
|
+
</p>
|
120
|
+
</template>
|
121
|
+
</lesli-table>
|
122
|
+
|
123
|
+
</section>
|
124
|
+
</template>
|
@@ -0,0 +1,48 @@
|
|
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 } from "vue"
|
21
|
+
|
22
|
+
// · import components
|
23
|
+
import ComponentAnnouncementForm from "LesliBell/apps/announcements/components/form.vue"
|
24
|
+
|
25
|
+
// ·
|
26
|
+
const translations = {
|
27
|
+
core: {
|
28
|
+
shared: I18n.t("core.shared")
|
29
|
+
},
|
30
|
+
bell: {
|
31
|
+
notifications: I18n.t("bell.notifications"),
|
32
|
+
announcements: I18n.t("bell.announcements")
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
// · initializing
|
37
|
+
onMounted(() => {})
|
38
|
+
|
39
|
+
</script>
|
40
|
+
<template>
|
41
|
+
<section class="application-component">
|
42
|
+
|
43
|
+
<lesli-header :title="translations.bell.announcements.view_title_new_announcement"></lesli-header>
|
44
|
+
|
45
|
+
<component-announcement-form></component-announcement-form>
|
46
|
+
|
47
|
+
</section>
|
48
|
+
</template>
|
@@ -0,0 +1,149 @@
|
|
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, inject } from "vue"
|
21
|
+
|
22
|
+
// · import store
|
23
|
+
import { useBellNotification } from "LesliBell/stores/notification"
|
24
|
+
|
25
|
+
// · import vue router composable
|
26
|
+
import { useRouter, useRoute } from "vue-router"
|
27
|
+
|
28
|
+
// · implement store
|
29
|
+
const notificationStore = useBellNotification()
|
30
|
+
|
31
|
+
// . Defining translations
|
32
|
+
const translations = {
|
33
|
+
core: {
|
34
|
+
shared: I18n.t("core.shared")
|
35
|
+
},
|
36
|
+
bell: {
|
37
|
+
notifications: I18n.t("bell.notifications")
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
// · initialize/inject plugins
|
42
|
+
const router = useRouter()
|
43
|
+
|
44
|
+
// · initializing
|
45
|
+
onMounted(() => {
|
46
|
+
notificationStore.getUsers()
|
47
|
+
notificationStore.getRoles()
|
48
|
+
})
|
49
|
+
|
50
|
+
/**
|
51
|
+
* @description This function is used to create a new notification
|
52
|
+
*/
|
53
|
+
const onCreate = () => {
|
54
|
+
notificationStore.createNotification().then(() => {
|
55
|
+
router.push(notificationStore.url.bell('notifications').toString())
|
56
|
+
})
|
57
|
+
}
|
58
|
+
|
59
|
+
</script>
|
60
|
+
|
61
|
+
<template>
|
62
|
+
<lesli-loading v-if="notificationStore.loading"></lesli-loading>
|
63
|
+
<form @submit.prevent="onCreate" class="card py-4" v-else>
|
64
|
+
<div class="columns is-marginless has-border-bottom">
|
65
|
+
<div class="column is-4">
|
66
|
+
<label class="label">
|
67
|
+
{{ translations.bell.notifications.column_subject }}
|
68
|
+
<sup class="has-text-danger">*</sup>
|
69
|
+
</label>
|
70
|
+
</div>
|
71
|
+
<div class="column">
|
72
|
+
<div class="control is-clearfix">
|
73
|
+
<input
|
74
|
+
type="text"
|
75
|
+
autocomplete="on"
|
76
|
+
name="subject"
|
77
|
+
required
|
78
|
+
class="input"
|
79
|
+
v-model="notificationStore.record.subject"
|
80
|
+
/>
|
81
|
+
</div>
|
82
|
+
</div>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div class="columns is-marginless has-border-bottom">
|
86
|
+
<div class="column is-4">
|
87
|
+
<label class="label">
|
88
|
+
{{ translations.bell.notifications.column_body }}
|
89
|
+
</label>
|
90
|
+
</div>
|
91
|
+
<div class="column">
|
92
|
+
<textarea
|
93
|
+
name="body"
|
94
|
+
rows="3"
|
95
|
+
maxlength="500"
|
96
|
+
class="textarea"
|
97
|
+
v-model="notificationStore.record.body"
|
98
|
+
></textarea>
|
99
|
+
</div>
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div class="columns is-marginless has-border-bottom">
|
103
|
+
<div class="column is-4">
|
104
|
+
<label class="label">
|
105
|
+
{{ translations.bell.notifications.view_text_receiver_users }}
|
106
|
+
</label>
|
107
|
+
</div>
|
108
|
+
<div class="column">
|
109
|
+
<div class="control is-clearfix">
|
110
|
+
<lesli-input-tag
|
111
|
+
v-model="notificationStore.receiverUsers"
|
112
|
+
:placeholder="translations.core.shared.view_placeholder_search"
|
113
|
+
:options="notificationStore.users"
|
114
|
+
:filterFields="['name', 'email']"
|
115
|
+
showField="email"
|
116
|
+
/>
|
117
|
+
</div>
|
118
|
+
</div>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
<div class="columns is-marginless has-border-bottom">
|
122
|
+
<div class="column is-4">
|
123
|
+
<label class="label">
|
124
|
+
{{ translations.bell.notifications.view_text_receiver_roles }}
|
125
|
+
</label>
|
126
|
+
</div>
|
127
|
+
<div class="column">
|
128
|
+
<div class="control is-clearfix">
|
129
|
+
<lesli-input-tag
|
130
|
+
v-model="notificationStore.receiverRoles"
|
131
|
+
:placeholder="translations.core.shared.view_placeholder_search"
|
132
|
+
:options="notificationStore.roles"
|
133
|
+
:filterFields="['name']"
|
134
|
+
showField="name"
|
135
|
+
/>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
<div class="px-3 ql-bg-blue">
|
141
|
+
<button
|
142
|
+
type="submit"
|
143
|
+
class="button is-fullwidth has-text-centered submit-button is-primary"
|
144
|
+
>
|
145
|
+
{{ translations.core.shared.view_btn_save }}
|
146
|
+
</button>
|
147
|
+
</div>
|
148
|
+
</form>
|
149
|
+
</template>
|
@@ -0,0 +1,129 @@
|
|
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 { ref, reactive, onMounted, watch, computed, inject } from "vue"
|
22
|
+
import { useRouter, useRoute } from 'vue-router'
|
23
|
+
|
24
|
+
|
25
|
+
// · initialize/inject plugins
|
26
|
+
const router = useRouter()
|
27
|
+
const msg = inject("msg")
|
28
|
+
const url = inject("url")
|
29
|
+
const date = inject("date")
|
30
|
+
|
31
|
+
|
32
|
+
// · import lesli stores
|
33
|
+
import { useBellNotification } from "LesliBell/stores/notification"
|
34
|
+
|
35
|
+
|
36
|
+
// · implement stores
|
37
|
+
const storeNotification = useBellNotification()
|
38
|
+
|
39
|
+
|
40
|
+
// ·
|
41
|
+
const translations = {
|
42
|
+
core: {
|
43
|
+
shared: I18n.t("core.shared")
|
44
|
+
},
|
45
|
+
bell: {
|
46
|
+
notifications: I18n.t("bell.notifications")
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
const columns = [{
|
51
|
+
field: "id",
|
52
|
+
label: "ID"
|
53
|
+
}, {
|
54
|
+
field: "subject",
|
55
|
+
label: "Notification"
|
56
|
+
}, {
|
57
|
+
field: "url",
|
58
|
+
label: "Link"
|
59
|
+
}, {
|
60
|
+
field: "status",
|
61
|
+
label: "Status",
|
62
|
+
align: "center"
|
63
|
+
}, {
|
64
|
+
field: "created_at",
|
65
|
+
label: "Sent at"
|
66
|
+
}]
|
67
|
+
|
68
|
+
// · initializing
|
69
|
+
onMounted(() => {
|
70
|
+
storeNotification.fetch()
|
71
|
+
})
|
72
|
+
|
73
|
+
</script>
|
74
|
+
<template>
|
75
|
+
<section class="application-component">
|
76
|
+
|
77
|
+
<lesli-header :title="translations.bell.notifications.view_title_notifications">
|
78
|
+
<lesli-button :to="url.bell('notifications/new')" icon="add">
|
79
|
+
{{ translations.core.shared.view_btn_add }}
|
80
|
+
</lesli-button>
|
81
|
+
</lesli-header>
|
82
|
+
|
83
|
+
<lesli-table
|
84
|
+
:columns="columns"
|
85
|
+
:records="storeNotification.records"
|
86
|
+
:pagination="storeNotification.pagination"
|
87
|
+
@paginate="storeNotification.paginate">
|
88
|
+
<template #id="{ value, record }">
|
89
|
+
<span :class="['tag', 'is-medium', 'is-' + record.category]">
|
90
|
+
{{ value }}
|
91
|
+
</span>
|
92
|
+
</template>
|
93
|
+
<template #subject="{ column, value, record }">
|
94
|
+
<h4>{{ record.subject }}</h4>
|
95
|
+
<p>{{ record.body }}</p>
|
96
|
+
</template>
|
97
|
+
<template #url="{ value }">
|
98
|
+
<a :href="value" class="has-text-link hover">{{ value }}</a>
|
99
|
+
</template>
|
100
|
+
<template #created_at="{ value }">
|
101
|
+
<p>
|
102
|
+
<span class="icon-text">
|
103
|
+
<span class="icon">
|
104
|
+
<span class="has-text-grey material-icons">
|
105
|
+
calendar_month
|
106
|
+
</span>
|
107
|
+
</span>
|
108
|
+
<span>
|
109
|
+
{{ date.date(value) }}
|
110
|
+
</span>
|
111
|
+
</span>
|
112
|
+
</p>
|
113
|
+
<p>
|
114
|
+
<span class="icon-text">
|
115
|
+
<span class="icon">
|
116
|
+
<span class="has-text-grey material-icons">
|
117
|
+
schedule
|
118
|
+
</span>
|
119
|
+
</span>
|
120
|
+
<span>
|
121
|
+
{{ date.time(value) }}
|
122
|
+
</span>
|
123
|
+
</span>
|
124
|
+
</p>
|
125
|
+
</template>
|
126
|
+
</lesli-table>
|
127
|
+
|
128
|
+
</section>
|
129
|
+
</template>
|
@@ -0,0 +1,45 @@
|
|
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 } from "vue"
|
21
|
+
|
22
|
+
// · import components and lazy loading implementation
|
23
|
+
import ComponentNotificationForm from "LesliBell/apps/notifications/components/notification-form.vue"
|
24
|
+
|
25
|
+
|
26
|
+
// ·
|
27
|
+
const translations = {
|
28
|
+
core: {
|
29
|
+
shared: I18n.t("core.shared")
|
30
|
+
},
|
31
|
+
bell: {
|
32
|
+
notifications: I18n.t("bell.notifications")
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
</script>
|
37
|
+
<template>
|
38
|
+
<section class="application-component">
|
39
|
+
|
40
|
+
<lesli-header :title="translations.bell.notifications.view_title_new_notification"></lesli-header>
|
41
|
+
|
42
|
+
<component-notification-form></component-notification-form>
|
43
|
+
|
44
|
+
</section>
|
45
|
+
</template>
|
@@ -0,0 +1,142 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2022, all rights reserved.
|
3
|
+
|
4
|
+
All the information provided by this platform is protected by international laws related to
|
5
|
+
industrial property, intellectual property, copyright and relative international laws.
|
6
|
+
All intellectual or industrial property rights of the code, texts, trade mark, design,
|
7
|
+
pictures and any other information belongs to the owner of this platform.
|
8
|
+
|
9
|
+
Without the written permission of the owner, any replication, modification,
|
10
|
+
transmission, publication is strictly forbidden.
|
11
|
+
|
12
|
+
For more information read the license file including with this software.
|
13
|
+
|
14
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
15
|
+
// ·
|
16
|
+
*/
|
17
|
+
|
18
|
+
|
19
|
+
// ·
|
20
|
+
import { defineStore } from "pinia"
|
21
|
+
import { useRouter } from 'vue-router'
|
22
|
+
|
23
|
+
const translations = {
|
24
|
+
core: {
|
25
|
+
shared: I18n.t("core.shared")
|
26
|
+
},
|
27
|
+
bell: {
|
28
|
+
notifications: I18n.t("bell.announcements")
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
|
33
|
+
export const useBellAnnouncement = defineStore("bell.Announcement", {
|
34
|
+
state: () => {
|
35
|
+
return {
|
36
|
+
router: useRouter(),
|
37
|
+
loading: false,
|
38
|
+
users: [],
|
39
|
+
roles: [],
|
40
|
+
filteredUsers: [],
|
41
|
+
filteredRoles: [],
|
42
|
+
record: {
|
43
|
+
name: null,
|
44
|
+
category: null,
|
45
|
+
url: null,
|
46
|
+
base_path: null,
|
47
|
+
message: null,
|
48
|
+
status: null,
|
49
|
+
start_at: null,
|
50
|
+
end_at: null,
|
51
|
+
can_be_closed: null,
|
52
|
+
},
|
53
|
+
receiverUsers: [],
|
54
|
+
receiverRoles: [],
|
55
|
+
records: [],
|
56
|
+
pagination: {
|
57
|
+
page: 1
|
58
|
+
},
|
59
|
+
index: {
|
60
|
+
pagination: {},
|
61
|
+
records: []
|
62
|
+
}
|
63
|
+
}
|
64
|
+
},
|
65
|
+
actions: {
|
66
|
+
|
67
|
+
/**
|
68
|
+
* @description This action is used to add pagination to announcement index
|
69
|
+
* @param {Integer} page the actual page showing in the index
|
70
|
+
*/
|
71
|
+
paginate(page) {
|
72
|
+
this.pagination.page = page
|
73
|
+
this.fetch()
|
74
|
+
},
|
75
|
+
|
76
|
+
/**
|
77
|
+
* @description This action is used to fetch all the announcements for the current user
|
78
|
+
*/
|
79
|
+
fetch() {
|
80
|
+
this.http.get(
|
81
|
+
this.url.bell("announcements")
|
82
|
+
.paginate(this.pagination.page)
|
83
|
+
).then(result => {
|
84
|
+
this.pagination = result.pagination
|
85
|
+
this.records = result.records
|
86
|
+
})
|
87
|
+
},
|
88
|
+
|
89
|
+
/**
|
90
|
+
* @description This action is used to create a new announcement
|
91
|
+
*/
|
92
|
+
post() {
|
93
|
+
this.loading = true
|
94
|
+
this.http.post(this.url.bell("announcements"), {
|
95
|
+
announcement: {
|
96
|
+
...this.record,
|
97
|
+
user_receiver_emails: this.receiverUsers.map(user => user.email),
|
98
|
+
role_receiver_names: this.receiverRoles.map(role => role.name),
|
99
|
+
}
|
100
|
+
}).then(() => {
|
101
|
+
this.msg.success(I18n.t("core.users.messages_success_operation"))
|
102
|
+
this.router.push(this.url.bell("announcements").s)
|
103
|
+
}).catch(error => {
|
104
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
105
|
+
}).finally(() => {
|
106
|
+
this.record = {}
|
107
|
+
this.receiverUsers = []
|
108
|
+
this.receiverRoles = []
|
109
|
+
this.loading = false
|
110
|
+
})
|
111
|
+
},
|
112
|
+
|
113
|
+
/**
|
114
|
+
* @description This action is used to get the list of users
|
115
|
+
*/
|
116
|
+
getUsers() {
|
117
|
+
this.loading = true
|
118
|
+
this.http.get(this.url.admin('users/list')).then(result => {
|
119
|
+
this.users = result
|
120
|
+
}).catch(error => {
|
121
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
122
|
+
}).finally(() => {
|
123
|
+
this.loading = false
|
124
|
+
})
|
125
|
+
},
|
126
|
+
|
127
|
+
/**
|
128
|
+
* @description This action is used to get the list of roles
|
129
|
+
*/
|
130
|
+
getRoles() {
|
131
|
+
this.loading = true
|
132
|
+
this.http.get(this.url.admin('roles/list')).then(result => {
|
133
|
+
this.roles = result
|
134
|
+
}).catch(error => {
|
135
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
136
|
+
}).finally(() => {
|
137
|
+
this.loading = false
|
138
|
+
})
|
139
|
+
},
|
140
|
+
|
141
|
+
}
|
142
|
+
})
|