lesli_bell 1.0.1 → 1.1.2
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 +4 -4
- data/Rakefile +5 -1
- data/app/assets/stylesheets/lesli_bell/application.css +476 -4
- data/app/controllers/lesli_bell/notifications_controller.rb +6 -0
- data/app/models/lesli_bell/account.rb +4 -1
- data/app/models/lesli_bell/announcement/user.rb +2 -2
- data/app/services/lesli_bell/notification_service.rb +8 -0
- data/app/views/lesli_bell/dashboards/show.html.erb +1 -1
- data/app/views/lesli_bell/notifications/index.html.erb +137 -57
- data/config/routes.rb +3 -1
- data/db/migrate/v1.0/0308100110_create_lesli_bell_notifications.rb +6 -1
- data/db/migrate/v1.0/0308110110_create_lesli_bell_announcements.rb +1 -1
- data/db/seeds.rb +1 -1
- data/lib/lesli_bell/engine.rb +0 -3
- data/lib/lesli_bell/version.rb +2 -2
- data/readme.md +165 -48
- metadata +8 -17
- data/app/assets/config/lesli_bell_manifest.js +0 -40
- data/lib/scss/application.scss +0 -0
- data/lib/vue/application.js +0 -73
- data/lib/vue/apps/announcements/components/form.vue +0 -237
- data/lib/vue/apps/announcements/index.vue +0 -145
- data/lib/vue/apps/announcements/new.vue +0 -48
- data/lib/vue/apps/notifications/components/notification-form.vue +0 -171
- data/lib/vue/apps/notifications/index.vue +0 -144
- data/lib/vue/apps/notifications/new.vue +0 -56
- data/lib/vue/stores/announcement.js +0 -147
- data/lib/vue/stores/notification.js +0 -148
- data/lib/vue/stores/translations.json +0 -232
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
/*
|
|
3
|
-
Lesli
|
|
4
|
-
|
|
5
|
-
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
6
|
-
|
|
7
|
-
This program is free software: you can redistribute it and/or modify
|
|
8
|
-
it under the terms of the GNU General Public License as published by
|
|
9
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
10
|
-
(at your option) any later version.
|
|
11
|
-
|
|
12
|
-
This program is distributed in the hope that it will be useful,
|
|
13
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
GNU General Public License for more details.
|
|
16
|
-
|
|
17
|
-
You should have received a copy of the GNU General Public License
|
|
18
|
-
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
19
|
-
|
|
20
|
-
Lesli · Ruby on Rails SaaS Development Framework.
|
|
21
|
-
|
|
22
|
-
Made with ♥ by LesliTech
|
|
23
|
-
Building a better future, one line of code at a time.
|
|
24
|
-
|
|
25
|
-
@contact hello@lesli.tech
|
|
26
|
-
@website https://www.lesli.tech
|
|
27
|
-
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
28
|
-
|
|
29
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
30
|
-
// ·
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// · import vue tools
|
|
35
|
-
import { onMounted, inject } from "vue"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// · import store
|
|
39
|
-
import { useBellNotification } from "LesliBell/vue/stores/notification"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// · import vue router composable
|
|
43
|
-
import { useRouter, useRoute } from "vue-router"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// · implement store
|
|
47
|
-
const notificationStore = useBellNotification()
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// . Defining translations
|
|
51
|
-
const translations = {
|
|
52
|
-
lesli: {
|
|
53
|
-
shared: i18n.t("lesli.shared")
|
|
54
|
-
},
|
|
55
|
-
bell: {
|
|
56
|
-
notifications: i18n.t("lesli_bell.notifications")
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
core: {
|
|
60
|
-
shared: I18n.t("core.shared")
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// · initialize/inject plugins
|
|
66
|
-
const router = useRouter()
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
// · initializing
|
|
70
|
-
onMounted(() => {
|
|
71
|
-
notificationStore.getUsers()
|
|
72
|
-
notificationStore.getRoles()
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
// ·
|
|
77
|
-
function onCreate() {
|
|
78
|
-
notificationStore.createNotification().then(() => {
|
|
79
|
-
router.push(notificationStore.url.bell('notifications').toString())
|
|
80
|
-
})
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
</script>
|
|
84
|
-
<template>
|
|
85
|
-
<lesli-form @submit="onCreate">
|
|
86
|
-
<div class="columns is-marginless has-border-bottom">
|
|
87
|
-
<div class="column is-4">
|
|
88
|
-
<label class="label">
|
|
89
|
-
{{ translations.bell.notifications.column_subject }}
|
|
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="notificationStore.record.subject"
|
|
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.notifications.column_body }}
|
|
111
|
-
</label>
|
|
112
|
-
</div>
|
|
113
|
-
<div class="column">
|
|
114
|
-
<textarea
|
|
115
|
-
name="body"
|
|
116
|
-
rows="3"
|
|
117
|
-
maxlength="500"
|
|
118
|
-
class="textarea"
|
|
119
|
-
v-model="notificationStore.record.body"
|
|
120
|
-
></textarea>
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
|
|
124
|
-
<div class="columns is-marginless has-border-bottom">
|
|
125
|
-
<div class="column is-4">
|
|
126
|
-
<label class="label">
|
|
127
|
-
{{ translations.bell.notifications.view_text_receiver_users }}
|
|
128
|
-
</label>
|
|
129
|
-
</div>
|
|
130
|
-
<div class="column">
|
|
131
|
-
<div class="control is-clearfix">
|
|
132
|
-
<lesli-input-tag
|
|
133
|
-
v-model="notificationStore.receiverUsers"
|
|
134
|
-
:placeholder="translations.core.shared.view_placeholder_search"
|
|
135
|
-
:options="notificationStore.users"
|
|
136
|
-
:filterFields="['name', 'email']"
|
|
137
|
-
showField="email"
|
|
138
|
-
/>
|
|
139
|
-
</div>
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
|
-
|
|
143
|
-
<div class="columns is-marginless has-border-bottom">
|
|
144
|
-
<div class="column is-4">
|
|
145
|
-
<label class="label">
|
|
146
|
-
{{ translations.bell.notifications.view_text_receiver_roles }}
|
|
147
|
-
</label>
|
|
148
|
-
</div>
|
|
149
|
-
<div class="column">
|
|
150
|
-
<div class="control is-clearfix">
|
|
151
|
-
<lesli-input-tag
|
|
152
|
-
v-model="notificationStore.receiverRoles"
|
|
153
|
-
:placeholder="translations.core.shared.view_placeholder_search"
|
|
154
|
-
:options="notificationStore.roles"
|
|
155
|
-
:filterFields="['name']"
|
|
156
|
-
showField="name"
|
|
157
|
-
/>
|
|
158
|
-
</div>
|
|
159
|
-
</div>
|
|
160
|
-
</div>
|
|
161
|
-
|
|
162
|
-
<div class="px-3 ql-bg-blue">
|
|
163
|
-
<button
|
|
164
|
-
type="submit"
|
|
165
|
-
class="button is-fullwidth has-text-centered submit-button is-primary"
|
|
166
|
-
>
|
|
167
|
-
{{ translations.lesli.shared.button_save }}
|
|
168
|
-
</button>
|
|
169
|
-
</div>
|
|
170
|
-
</lesli-form>
|
|
171
|
-
</template>
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
/*
|
|
3
|
-
Lesli
|
|
4
|
-
|
|
5
|
-
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
6
|
-
|
|
7
|
-
This program is free software: you can redistribute it and/or modify
|
|
8
|
-
it under the terms of the GNU General Public License as published by
|
|
9
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
10
|
-
(at your option) any later version.
|
|
11
|
-
|
|
12
|
-
This program is distributed in the hope that it will be useful,
|
|
13
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
GNU General Public License for more details.
|
|
16
|
-
|
|
17
|
-
You should have received a copy of the GNU General Public License
|
|
18
|
-
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
19
|
-
|
|
20
|
-
Lesli · Ruby on Rails SaaS Development Framework.
|
|
21
|
-
|
|
22
|
-
Made with ♥ by LesliTech
|
|
23
|
-
Building a better future, one line of code at a time.
|
|
24
|
-
|
|
25
|
-
@contact hello@lesli.tech
|
|
26
|
-
@website https://www.lesli.tech
|
|
27
|
-
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
28
|
-
|
|
29
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
30
|
-
// ·
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// · import vue tools
|
|
35
|
-
import { ref, reactive, onMounted, watch, computed, inject } from "vue"
|
|
36
|
-
import { useRouter, useRoute } from "vue-router"
|
|
37
|
-
|
|
38
|
-
import dayjs from "dayjs"
|
|
39
|
-
import relativeTime from 'dayjs/plugin/relativeTime'
|
|
40
|
-
|
|
41
|
-
dayjs.extend(relativeTime)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// · initialize/inject plugins
|
|
45
|
-
const router = useRouter()
|
|
46
|
-
const msg = inject("msg")
|
|
47
|
-
const url = inject("url")
|
|
48
|
-
const date = inject("date")
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// · import lesli stores
|
|
52
|
-
import { useBellNotification } from "LesliBell/vue/stores/notification"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
// · implement stores
|
|
56
|
-
const storeNotification = useBellNotification()
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// ·
|
|
60
|
-
const translations = {
|
|
61
|
-
shared: i18n.t("lesli.shared"),
|
|
62
|
-
bell: {
|
|
63
|
-
notifications: i18n.t("lesli_bell.notifications")
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
core: {
|
|
67
|
-
shared: I18n.t("core.shared")
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const columns = [{
|
|
72
|
-
field: "id",
|
|
73
|
-
label: ""
|
|
74
|
-
}, {
|
|
75
|
-
field: "subject",
|
|
76
|
-
label: "Notification"
|
|
77
|
-
}, {
|
|
78
|
-
field: "url",
|
|
79
|
-
label: "Link"
|
|
80
|
-
}, {
|
|
81
|
-
field: "status",
|
|
82
|
-
label: "Status",
|
|
83
|
-
align: "center"
|
|
84
|
-
}, {
|
|
85
|
-
field: "created_at",
|
|
86
|
-
label: "Sent at"
|
|
87
|
-
}]
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// · initializing
|
|
91
|
-
onMounted(() => {
|
|
92
|
-
storeNotification.fetch()
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
</script>
|
|
97
|
-
<template>
|
|
98
|
-
<lesli-application-container>
|
|
99
|
-
<lesli-header :title="translations.bell.notifications.view_title">
|
|
100
|
-
<lesli-button icon="refresh">
|
|
101
|
-
{{ translations.shared.button_reload }}
|
|
102
|
-
</lesli-button>
|
|
103
|
-
<!--
|
|
104
|
-
<lesli-link button solid icon="add" :to="url.bell('notifications/new')">
|
|
105
|
-
{{ translations.shared.button_add_new }}
|
|
106
|
-
</lesli-link>
|
|
107
|
-
-->
|
|
108
|
-
</lesli-header>
|
|
109
|
-
|
|
110
|
-
<lesli-table
|
|
111
|
-
:columns="columns"
|
|
112
|
-
:records="storeNotification.index.records"
|
|
113
|
-
:pagination="storeNotification.index.pagination"
|
|
114
|
-
@paginate="storeNotification.paginate">
|
|
115
|
-
<template #id="{ value, record }" class="ldonis">
|
|
116
|
-
<span :class="['material-icons', 'has-text-' + record.category]">
|
|
117
|
-
info
|
|
118
|
-
</span>
|
|
119
|
-
</template>
|
|
120
|
-
<template #subject="{ column, value, record }">
|
|
121
|
-
<h4>{{ record.subject }}</h4>
|
|
122
|
-
<p>{{ record.body }}</p>
|
|
123
|
-
</template>
|
|
124
|
-
<template #url="{ value }">
|
|
125
|
-
<a :href="value" class="has-text-link hover">{{ value }}</a>
|
|
126
|
-
</template>
|
|
127
|
-
<template #created_at="{ value }">
|
|
128
|
-
<p>
|
|
129
|
-
<span class="icon-text">
|
|
130
|
-
<span class="icon">
|
|
131
|
-
<span class="has-text-grey material-icons">
|
|
132
|
-
calendar_month
|
|
133
|
-
</span>
|
|
134
|
-
</span>
|
|
135
|
-
<span>
|
|
136
|
-
{{ date.dateTime(value) }}
|
|
137
|
-
</span>
|
|
138
|
-
</span>
|
|
139
|
-
</p>
|
|
140
|
-
</template>
|
|
141
|
-
</lesli-table>
|
|
142
|
-
|
|
143
|
-
</lesli-application-container>
|
|
144
|
-
</template>
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
/*
|
|
3
|
-
Lesli
|
|
4
|
-
|
|
5
|
-
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
6
|
-
|
|
7
|
-
This program is free software: you can redistribute it and/or modify
|
|
8
|
-
it under the terms of the GNU General Public License as published by
|
|
9
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
10
|
-
(at your option) any later version.
|
|
11
|
-
|
|
12
|
-
This program is distributed in the hope that it will be useful,
|
|
13
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
GNU General Public License for more details.
|
|
16
|
-
|
|
17
|
-
You should have received a copy of the GNU General Public License
|
|
18
|
-
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
19
|
-
|
|
20
|
-
Lesli · Ruby on Rails SaaS Development Framework.
|
|
21
|
-
|
|
22
|
-
Made with ♥ by LesliTech
|
|
23
|
-
Building a better future, one line of code at a time.
|
|
24
|
-
|
|
25
|
-
@contact hello@lesli.tech
|
|
26
|
-
@website https://www.lesli.tech
|
|
27
|
-
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
28
|
-
|
|
29
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
30
|
-
// ·
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// · import vue tools
|
|
35
|
-
import { onMounted } from "vue"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// ·
|
|
39
|
-
import ComponentNotificationForm from "./components/notification-form.vue"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// ·
|
|
43
|
-
const translations = {
|
|
44
|
-
bell: {
|
|
45
|
-
notifications: i18n.t("lesli_bell.notifications")
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
</script>
|
|
50
|
-
<template>
|
|
51
|
-
<lesli-application-container>
|
|
52
|
-
<lesli-header :title="translations.bell.notifications.view_create_notification">
|
|
53
|
-
</lesli-header>
|
|
54
|
-
<component-notification-form></component-notification-form>
|
|
55
|
-
</lesli-application-container>
|
|
56
|
-
</template>
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Lesli
|
|
3
|
-
|
|
4
|
-
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
5
|
-
|
|
6
|
-
This program is free software: you can redistribute it and/or modify
|
|
7
|
-
it under the terms of the GNU General Public License as published by
|
|
8
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
(at your option) any later version.
|
|
10
|
-
|
|
11
|
-
This program is distributed in the hope that it will be useful,
|
|
12
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
GNU General Public License for more details.
|
|
15
|
-
|
|
16
|
-
You should have received a copy of the GNU General Public License
|
|
17
|
-
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
|
|
19
|
-
Lesli · Ruby on Rails SaaS Development Framework.
|
|
20
|
-
|
|
21
|
-
Made with ♥ by LesliTech
|
|
22
|
-
Building a better future, one line of code at a time.
|
|
23
|
-
|
|
24
|
-
@contact hello@lesli.tech
|
|
25
|
-
@website https://www.lesli.tech
|
|
26
|
-
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
27
|
-
|
|
28
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
29
|
-
// ·
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// ·
|
|
34
|
-
import { defineStore } from "pinia"
|
|
35
|
-
import { useRouter } from 'vue-router'
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// ·
|
|
39
|
-
const translations = {
|
|
40
|
-
core: {
|
|
41
|
-
shared: I18n.t("core.shared")
|
|
42
|
-
},
|
|
43
|
-
bell: {
|
|
44
|
-
notifications: I18n.t("bell.announcements")
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
export const useBellAnnouncement = defineStore("bell.Announcement", {
|
|
50
|
-
state: () => {
|
|
51
|
-
return {
|
|
52
|
-
announcements: {
|
|
53
|
-
pagination: {},
|
|
54
|
-
records: []
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
router: useRouter(),
|
|
58
|
-
loading: false,
|
|
59
|
-
users: [],
|
|
60
|
-
roles: [],
|
|
61
|
-
filteredUsers: [],
|
|
62
|
-
filteredRoles: [],
|
|
63
|
-
record: {
|
|
64
|
-
name: null,
|
|
65
|
-
category: null,
|
|
66
|
-
url: null,
|
|
67
|
-
base_path: null,
|
|
68
|
-
message: null,
|
|
69
|
-
status: null,
|
|
70
|
-
start_at: null,
|
|
71
|
-
end_at: null,
|
|
72
|
-
can_be_closed: null,
|
|
73
|
-
},
|
|
74
|
-
receiverUsers: [],
|
|
75
|
-
receiverRoles: [],
|
|
76
|
-
records: [],
|
|
77
|
-
pagination: {
|
|
78
|
-
page: 1
|
|
79
|
-
},
|
|
80
|
-
index: {
|
|
81
|
-
pagination: {},
|
|
82
|
-
records: []
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
actions: {
|
|
87
|
-
|
|
88
|
-
paginate(page) {
|
|
89
|
-
this.announcements.pagination.page = page
|
|
90
|
-
this.fetch()
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
fetch() {
|
|
94
|
-
this.http.get(
|
|
95
|
-
this.url.bell("announcements")
|
|
96
|
-
.paginate(this.announcements.pagination.page)
|
|
97
|
-
).then(result => {
|
|
98
|
-
this.announcements = result
|
|
99
|
-
}).catch(error => {
|
|
100
|
-
console.log(error)
|
|
101
|
-
})
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
post() {
|
|
105
|
-
this.loading = true
|
|
106
|
-
this.http.post(this.url.bell("announcements"), {
|
|
107
|
-
announcement: {
|
|
108
|
-
...this.record,
|
|
109
|
-
user_receiver_emails: this.receiverUsers.map(user => user.email),
|
|
110
|
-
role_receiver_names: this.receiverRoles.map(role => role.name),
|
|
111
|
-
}
|
|
112
|
-
}).then(() => {
|
|
113
|
-
this.msg.success(I18n.t("core.users.messages_success_operation"))
|
|
114
|
-
this.router.push(this.url.bell("announcements").s)
|
|
115
|
-
}).catch(error => {
|
|
116
|
-
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
|
117
|
-
}).finally(() => {
|
|
118
|
-
this.record = {}
|
|
119
|
-
this.receiverUsers = []
|
|
120
|
-
this.receiverRoles = []
|
|
121
|
-
this.loading = false
|
|
122
|
-
})
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
getUsers() {
|
|
126
|
-
this.loading = true
|
|
127
|
-
this.http.get(this.url.admin('users/list')).then(result => {
|
|
128
|
-
this.users = result
|
|
129
|
-
}).catch(error => {
|
|
130
|
-
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
|
131
|
-
}).finally(() => {
|
|
132
|
-
this.loading = false
|
|
133
|
-
})
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
getRoles() {
|
|
137
|
-
this.loading = true
|
|
138
|
-
this.http.get(this.url.admin('roles/list')).then(result => {
|
|
139
|
-
this.roles = result
|
|
140
|
-
}).catch(error => {
|
|
141
|
-
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
|
142
|
-
}).finally(() => {
|
|
143
|
-
this.loading = false
|
|
144
|
-
})
|
|
145
|
-
},
|
|
146
|
-
}
|
|
147
|
-
})
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Lesli
|
|
3
|
-
|
|
4
|
-
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
5
|
-
|
|
6
|
-
This program is free software: you can redistribute it and/or modify
|
|
7
|
-
it under the terms of the GNU General Public License as published by
|
|
8
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
(at your option) any later version.
|
|
10
|
-
|
|
11
|
-
This program is distributed in the hope that it will be useful,
|
|
12
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
GNU General Public License for more details.
|
|
15
|
-
|
|
16
|
-
You should have received a copy of the GNU General Public License
|
|
17
|
-
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
|
|
19
|
-
Lesli · Ruby on Rails SaaS Development Framework.
|
|
20
|
-
|
|
21
|
-
Made with ♥ by LesliTech
|
|
22
|
-
Building a better future, one line of code at a time.
|
|
23
|
-
|
|
24
|
-
@contact hello@lesli.tech
|
|
25
|
-
@website https://www.lesli.tech
|
|
26
|
-
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
27
|
-
|
|
28
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
29
|
-
// ·
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// ·
|
|
34
|
-
import { defineStore } from "pinia"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// ·
|
|
38
|
-
export const useBellNotification = defineStore("bell.Notification", {
|
|
39
|
-
state: () => {
|
|
40
|
-
return {
|
|
41
|
-
index: {
|
|
42
|
-
loading: false,
|
|
43
|
-
records: [],
|
|
44
|
-
pagination: {}
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
loading: false,
|
|
49
|
-
users: [],
|
|
50
|
-
roles: [],
|
|
51
|
-
filteredUsers: [],
|
|
52
|
-
filteredRoles: [],
|
|
53
|
-
record: {
|
|
54
|
-
subject: null,
|
|
55
|
-
body: null,
|
|
56
|
-
url: null,
|
|
57
|
-
status: null,
|
|
58
|
-
notification_type: null,
|
|
59
|
-
category: null,
|
|
60
|
-
},
|
|
61
|
-
receiverUsers: [],
|
|
62
|
-
receiverRoles: [],
|
|
63
|
-
pagination: {},
|
|
64
|
-
records: []
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
actions: {
|
|
68
|
-
|
|
69
|
-
paginate(page) {
|
|
70
|
-
this.pagination.page = page
|
|
71
|
-
this.fetch()
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
fetch() {
|
|
75
|
-
if (this.index.records.length <= 0) {
|
|
76
|
-
this.get()
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
get() {
|
|
81
|
-
this.index.loading = true
|
|
82
|
-
let url = this.url.bell("notifications").paginate(this.pagination.page)
|
|
83
|
-
|
|
84
|
-
this.http.get(url).then(result => {
|
|
85
|
-
this.index.pagination = result.pagination
|
|
86
|
-
this.index.records = result.records
|
|
87
|
-
}).catch(error => {
|
|
88
|
-
console.log(error)
|
|
89
|
-
}).finally(() => {
|
|
90
|
-
this.index.loading = false
|
|
91
|
-
})
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* @description This action is used to create a new notification
|
|
99
|
-
*/
|
|
100
|
-
async createNotification() {
|
|
101
|
-
this.loading = true
|
|
102
|
-
this.msg.info(I18n.t("bell.notifications.messages_info_creating_notifications"))
|
|
103
|
-
return this.http.post(this.url.bell("notifications"), {
|
|
104
|
-
notification: {
|
|
105
|
-
...this.record,
|
|
106
|
-
user_receiver_emails: this.receiverUsers.map(user => user.email),
|
|
107
|
-
role_receiver_names: this.receiverRoles.map(role => role.name),
|
|
108
|
-
}
|
|
109
|
-
}).then(() => {
|
|
110
|
-
this.msg.success(I18n.t("bell.notifications.messages_success_notification_created_successfully"))
|
|
111
|
-
}).catch(error => {
|
|
112
|
-
this.msg.danger(error)
|
|
113
|
-
}).finally(() => {
|
|
114
|
-
this.record = {}
|
|
115
|
-
this.receiverUsers = []
|
|
116
|
-
this.receiverRoles = []
|
|
117
|
-
this.loading = false
|
|
118
|
-
})
|
|
119
|
-
},
|
|
120
|
-
/**
|
|
121
|
-
* @description This action is used to get the list of users for showing them on the autocomplete field in the form
|
|
122
|
-
*/
|
|
123
|
-
getUsers() {
|
|
124
|
-
this.loading = true
|
|
125
|
-
this.http.get(this.url.admin('users/list')).then(result => {
|
|
126
|
-
this.users = result
|
|
127
|
-
}).catch(error => {
|
|
128
|
-
this.msg.danger(error)
|
|
129
|
-
}).finally(() => {
|
|
130
|
-
this.loading = false
|
|
131
|
-
})
|
|
132
|
-
},
|
|
133
|
-
/**
|
|
134
|
-
* @description This action is used to get the list of roles for showing them on the autocomplete field in the form
|
|
135
|
-
*/
|
|
136
|
-
getRoles() {
|
|
137
|
-
this.loading = true
|
|
138
|
-
this.http.get(this.url.admin('roles/list')).then(result => {
|
|
139
|
-
this.roles = result
|
|
140
|
-
}).catch(error => {
|
|
141
|
-
this.msg.danger(error)
|
|
142
|
-
}).finally(() => {
|
|
143
|
-
this.loading = false
|
|
144
|
-
})
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
})
|