lesli_audit 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.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +5 -0
  3. data/app/assets/config/lesli_audit_manifest.js +38 -0
  4. data/app/assets/images/lesli_audit/audit-logo.svg +72 -0
  5. data/app/assets/javascripts/lesli_audit/application.js +3592 -0
  6. data/app/assets/stylesheets/lesli_audit/application.scss +35 -0
  7. data/app/assets/stylesheets/lesli_audit/dashboard.scss +0 -0
  8. data/app/controllers/lesli_audit/analytics_controller.rb +36 -0
  9. data/app/controllers/lesli_audit/application_controller.rb +4 -0
  10. data/app/controllers/lesli_audit/dashboards_controller.rb +59 -0
  11. data/app/helpers/lesli_audit/analytics_helper.rb +4 -0
  12. data/app/helpers/lesli_audit/application_helper.rb +4 -0
  13. data/app/helpers/lesli_audit/dashboards_helper.rb +4 -0
  14. data/app/jobs/lesli_audit/application_job.rb +4 -0
  15. data/app/mailers/lesli_audit/application_mailer.rb +6 -0
  16. data/app/models/lesli_audit/analytic.rb +4 -0
  17. data/app/models/lesli_audit/application_record.rb +5 -0
  18. data/app/models/lesli_audit/dashboard.rb +4 -0
  19. data/app/services/lesli_audit/account/activity_services.rb +69 -0
  20. data/app/services/lesli_audit/analytic_service.rb +151 -0
  21. data/app/services/lesli_audit/analytics/trend_services.rb +84 -0
  22. data/app/services/lesli_audit/analytics/visitor_service.rb +166 -0
  23. data/app/services/lesli_audit/request_services.rb +71 -0
  24. data/app/services/lesli_audit/users/activity_services.rb +61 -0
  25. data/app/services/lesli_audit/users/log_services.rb +62 -0
  26. data/app/services/lesli_audit/users/registration_services.rb +62 -0
  27. data/app/services/lesli_audit/users/role_services.rb +61 -0
  28. data/app/services/lesli_audit/users/working_hour_services.rb +78 -0
  29. data/app/views/lesli_audit/analytics/_analytic.html.erb +2 -0
  30. data/app/views/lesli_audit/analytics/_form.html.erb +17 -0
  31. data/app/views/lesli_audit/analytics/edit.html.erb +10 -0
  32. data/app/views/lesli_audit/analytics/index.html.erb +1 -0
  33. data/app/views/lesli_audit/analytics/new.html.erb +9 -0
  34. data/app/views/lesli_audit/analytics/show.html.erb +10 -0
  35. data/app/views/lesli_audit/dashboards/_dashboard.html.erb +2 -0
  36. data/app/views/lesli_audit/dashboards/_form.html.erb +17 -0
  37. data/app/views/lesli_audit/dashboards/edit.html.erb +10 -0
  38. data/app/views/lesli_audit/dashboards/index.html.erb +14 -0
  39. data/app/views/lesli_audit/dashboards/new.html.erb +9 -0
  40. data/app/views/lesli_audit/dashboards/show.html.erb +1 -0
  41. data/app/views/lesli_audit/partials/_engine-navigation.html.erb +39 -0
  42. data/config/routes.rb +45 -0
  43. data/db/migrate/v1.0/0803000110_create_lesli_audit_accounts.rb +42 -0
  44. data/db/migrate/v1.0/0803050110_create_lesli_audit_dashboards.rb +51 -0
  45. data/db/migrate/v1.0/0803050210_create_lesli_audit_dashboard_components.rb +53 -0
  46. data/lib/lesli_audit/engine.rb +18 -0
  47. data/lib/lesli_audit/version.rb +3 -0
  48. data/lib/lesli_audit.rb +6 -0
  49. data/lib/tasks/lesli_audit_tasks.rake +4 -0
  50. data/lib/vue/application.js +102 -0
  51. data/lib/vue/apps/accounts/activities.vue +48 -0
  52. data/lib/vue/apps/analytics/index.vue +18 -0
  53. data/lib/vue/apps/analytics/requests.vue +67 -0
  54. data/lib/vue/apps/analytics/trends.vue +149 -0
  55. data/lib/vue/apps/analytics/visitors.vue +91 -0
  56. data/lib/vue/apps/requests/index.vue +123 -0
  57. data/lib/vue/apps/security/passwords.vue +52 -0
  58. data/lib/vue/apps/security/sessions.vue +63 -0
  59. data/lib/vue/apps/users/activities.vue +49 -0
  60. data/lib/vue/apps/users/logs.vue +49 -0
  61. data/lib/vue/apps/users/registrations.vue +98 -0
  62. data/lib/vue/apps/users/roles.vue +70 -0
  63. data/lib/vue/apps/users/workingHours.vue +52 -0
  64. data/lib/vue/stores/accounts/activities.js +87 -0
  65. data/lib/vue/stores/analytics/visitors.js +130 -0
  66. data/lib/vue/stores/request.js +70 -0
  67. data/lib/vue/stores/security/password.js +75 -0
  68. data/lib/vue/stores/security/session.js +78 -0
  69. data/lib/vue/stores/users/activities.js +76 -0
  70. data/lib/vue/stores/users/logs.js +74 -0
  71. data/lib/vue/stores/users/registrations.js +61 -0
  72. data/lib/vue/stores/users/roles.js +52 -0
  73. data/lib/vue/stores/users/working_hours.js +92 -0
  74. data/license +674 -0
  75. data/readme.md +120 -0
  76. metadata +134 -0
@@ -0,0 +1,123 @@
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 } from "vue"
22
+
23
+
24
+ // · import lesli stores
25
+ import { useLogRequest } from "CloudAudit/stores/request"
26
+
27
+
28
+ // · implement stores
29
+ const store = useLogRequest()
30
+
31
+
32
+ // · define variables
33
+ const columns = [{
34
+ field: "id",
35
+ label: "ID"
36
+ }, {
37
+ field: "email",
38
+ label: "Email",
39
+ sort: true
40
+ }, {
41
+ field: "request_agent",
42
+ label: "Device"
43
+ }, {
44
+ field: "request_method",
45
+ label: "Method"
46
+ }, {
47
+ field: "request_controller",
48
+ label: "Controller",
49
+ sort: true
50
+ }, {
51
+ field: "request_action",
52
+ label: "Action"
53
+ }, {
54
+ field: "created_at_date",
55
+ label: "Date"
56
+ }]
57
+
58
+
59
+ // · initializing
60
+ onMounted(() => {
61
+ store.fetchLogsIfEmpty()
62
+ })
63
+
64
+
65
+ function itemProjection(item){ console.log("itemprojection", item) }
66
+ function selectItemEventHandler(item){ console.log("selectItem", item) }
67
+ function onInputEventHandler(item){ console.log("onInput", item) }
68
+ function onFocusEventHandler(item){ console.log("onFocus", item) }
69
+ function onBlurEventHandler(item){ console.log("onBlur", item) }
70
+
71
+ </script>
72
+ <script>
73
+ export default {
74
+ methods: {
75
+ showUser(user) {
76
+ this.url.admin("users/:id", user.id).go()
77
+ }
78
+ }
79
+ }
80
+ </script>
81
+ <template>
82
+ <section class="application-component">
83
+ <lesli-header
84
+ title="Users activity"
85
+ @reload="store.fetchLogs()">
86
+ </lesli-header>
87
+ <lesli-toolbar @search="store.search">
88
+ <!--
89
+ <Autocomplete
90
+ id="typeahead_id"
91
+ placeholder="Start writing..."
92
+ :items="[{
93
+ 'id': 1,
94
+ 'first_name': 'Geneva',
95
+ 'last_name': 'Baniard',
96
+ 'email': 'gbaniard0@tiny.cc',
97
+ 'gender': 'Male',
98
+ 'ip_address': '173.141.4.168'
99
+ }]"
100
+ :minInputLength="1"
101
+ :itemProjection="
102
+ (item) => {
103
+ return item.email;
104
+ }
105
+ "
106
+ @selectItem="selectItemEventHandler"
107
+ @onInput="onInputEventHandler"
108
+ @onFocus="onFocusEventHandler"
109
+ @onBlur="onBlurEventHandler">
110
+ </Autocomplete>
111
+ -->
112
+ </lesli-toolbar>
113
+ <lesli-table
114
+ @sort="store.sort"
115
+ @paginate="store.paginate"
116
+ :pagination="store.pagination"
117
+ :loading="store.loading"
118
+ :columns="columns"
119
+ :records="store.records"
120
+ @click="showUser">
121
+ </lesli-table>
122
+ </section>
123
+ </template>
@@ -0,0 +1,52 @@
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 { onMounted } from "vue"
22
+
23
+
24
+ // · import lesli stores
25
+ import { useSecurityPassword } from "CloudAudit/stores/security/password"
26
+
27
+
28
+ // · implement lesli stores
29
+ const store = useSecurityPassword()
30
+
31
+
32
+ // · initializing
33
+ onMounted(() => {
34
+ store.fetchIfEmpty()
35
+ })
36
+
37
+ </script>
38
+ <template>
39
+ <section class="application-component">
40
+ <lesli-header
41
+ title="Restore password emails"
42
+ @reload="store.fetch()">
43
+ </lesli-header>
44
+ <lesli-toolbar @search="store.search"></lesli-toolbar>
45
+ <lesli-table
46
+ :pagination="store.pagination"
47
+ :loading="store.loading"
48
+ :columns="store.columns"
49
+ :records="store.records">
50
+ </lesli-table>
51
+ </section>
52
+ </template>
@@ -0,0 +1,63 @@
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 } from "vue"
22
+
23
+
24
+ // · import lesli stores
25
+ import { useSecuritySession } from "CloudAudit/stores/security/session"
26
+
27
+
28
+ // · implement lesli stores
29
+ const store = useSecuritySession()
30
+
31
+
32
+ // · initializing
33
+ onMounted(() => {
34
+ store.fetchIfEmpty()
35
+ })
36
+
37
+ </script>
38
+ <script>
39
+ export default {
40
+ methods: {
41
+ // Method that allow to go to a user profile from the sessions table
42
+ showUser(user) {
43
+ this.url.admin("users/:id", user.id).go()
44
+ }
45
+ }
46
+ }
47
+ </script>
48
+ <template>
49
+ <section class="application-component">
50
+ <lesli-header
51
+ title="User sessions"
52
+ @reload="store.fetch()">
53
+ </lesli-header>
54
+ <lesli-toolbar @search="store.search"></lesli-toolbar>
55
+ <lesli-table
56
+ :pagination="store.pagination"
57
+ :loading="store.loading"
58
+ :columns="store.columns"
59
+ :records="store.records"
60
+ @click="showUser">
61
+ </lesli-table>
62
+ </section>
63
+ </template>
@@ -0,0 +1,49 @@
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 } from "vue"
22
+
23
+
24
+ // · import stores
25
+ import { useUsersActivities } from "CloudAudit/stores/users/activities"
26
+
27
+
28
+ // · implement stores
29
+ const storeUsersActivities = useUsersActivities()
30
+
31
+
32
+ // · initializing
33
+ onMounted(() => {
34
+ storeUsersActivities.fetchIfEmpty()
35
+ })
36
+
37
+ </script>
38
+ <template>
39
+ <application-component>
40
+ <lesli-header title="Working hours"></lesli-header>
41
+ <lesli-toolbar @search="storeUsersActivities.search"></lesli-toolbar>
42
+ <lesli-table
43
+ :pagination="storeUsersActivities.pagination"
44
+ :columns="storeUsersActivities.columns"
45
+ :records="storeUsersActivities.records"
46
+ @sort="storeUsersActivities.sort">
47
+ </lesli-table>
48
+ </application-component>
49
+ </template>
@@ -0,0 +1,49 @@
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 } from "vue"
22
+
23
+
24
+ // · import stores
25
+ import { useUsersLogs } from "CloudAudit/stores/users/logs"
26
+
27
+
28
+ // · implement stores
29
+ const storeUsersLogs = useUsersLogs()
30
+
31
+
32
+ // · initializing
33
+ onMounted(() => {
34
+ storeUsersLogs.fetchIfEmpty()
35
+ })
36
+
37
+ </script>
38
+ <template>
39
+ <application-component>
40
+ <lesli-header title="User logs"></lesli-header>
41
+ <lesli-toolbar @search="storeUsersLogs.search"></lesli-toolbar>
42
+ <lesli-table
43
+ :pagination="storeUsersLogs.pagination"
44
+ :columns="storeUsersLogs.columns"
45
+ :records="storeUsersLogs.records"
46
+ @sort="storeUsersLogs.sort">
47
+ </lesli-table>
48
+ </application-component>
49
+ </template>
@@ -0,0 +1,98 @@
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 } from "vue"
22
+
23
+
24
+ // · import Lesli components
25
+ import chartLine from "Lesli/components/charts/line.vue"
26
+
27
+
28
+ // · import stores
29
+ import { useUsersRegistrations } from "CloudAudit/stores/users/registrations"
30
+
31
+
32
+ // · implement stores
33
+ const storeUsersRegistrations = useUsersRegistrations()
34
+
35
+
36
+ // · define variables
37
+ var registrationSeries = ref([]);
38
+ var registrationLabels = ref([]);
39
+ var selectedPeriod = ref("month");
40
+ var filterPeriod = ref("");
41
+ var selectOptions = ref([]);
42
+
43
+
44
+ // · initializing
45
+ onMounted(() => {
46
+ storeUsersRegistrations.fetchIfEmpty()
47
+ storeUsersRegistrations.getOptions()
48
+ })
49
+
50
+
51
+ // ·
52
+ watch(() => storeUsersRegistrations.periods, () => {
53
+ selectOptions.value = storeUsersRegistrations.periods
54
+ })
55
+
56
+
57
+ // ·
58
+ watch(() => storeUsersRegistrations.records, () => {
59
+ registrationLabels.value = storeUsersRegistrations.records.map(visit => visit.date)
60
+ registrationSeries.value = [{
61
+ name: "Users",
62
+ data: storeUsersRegistrations.records.map(visit => visit.count)
63
+ }]
64
+ })
65
+
66
+
67
+ // ·
68
+ function updateDate(){
69
+ filterPeriod = selectedPeriod.value;
70
+ storeUsersRegistrations.fetch(filterPeriod)
71
+ }
72
+
73
+ </script>
74
+ <template>
75
+ <section class="application-component">
76
+ <lesli-header title="User registered by date" @reload="storeUsersRegistrations.reload()">
77
+ </lesli-header>
78
+
79
+ <div class="block">
80
+ <lesli-select
81
+ id = "selectPeriod"
82
+ @change="updateDate"
83
+ v-model = "selectedPeriod"
84
+ :options="selectOptions">
85
+ </lesli-select>
86
+ </div>
87
+ <div class="card">
88
+ <div class="card-content">
89
+ <chartLine
90
+ :series="registrationSeries"
91
+ :labels="registrationLabels"
92
+ @marker-click="markerClick">
93
+ </chartLine>
94
+ </div>
95
+ </div>
96
+ </section>
97
+ </template>
98
+
@@ -0,0 +1,70 @@
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 } from "vue"
22
+
23
+
24
+ // · import Lesli components
25
+ import chartBar from "Lesli/components/charts/bar.vue"
26
+
27
+
28
+ // · import stores
29
+ import { useUsersRoles } from "CloudAudit/stores/users/roles"
30
+
31
+
32
+ // · implement stores
33
+ const storeUsersRoles = useUsersRoles()
34
+
35
+
36
+ // · define variables
37
+ const usersByRole = ref([]);
38
+
39
+
40
+ // · initializing
41
+ onMounted(() => {
42
+ storeUsersRoles.fetchIfEmpty()
43
+ })
44
+
45
+
46
+ // · users by role
47
+ watch(() => storeUsersRoles.records, () => {
48
+ usersByRole.value = []
49
+ storeUsersRoles.records.forEach(role => {
50
+ usersByRole.value.push({
51
+ x: role.name,
52
+ y: role.users
53
+ })
54
+ })
55
+ })
56
+
57
+ </script>
58
+ <template>
59
+ <section class="application-component">
60
+ <lesli-header title="Users by role" @reload="storeRegistration.reload()">
61
+ </lesli-header>
62
+ <div class="card">
63
+ <div class="card-content">
64
+ <chartBar :series="usersByRole">
65
+ </chartBar>
66
+ </div>
67
+ </div>
68
+ </section>
69
+ </template>
70
+
@@ -0,0 +1,52 @@
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 } from "vue"
22
+
23
+
24
+ // · import Lesli components
25
+ import chartLine from "Lesli/components/charts/line.vue"
26
+
27
+
28
+ // · import stores
29
+ import { useUsersWorkingHours } from "CloudAudit/stores/users/working_hours"
30
+
31
+
32
+ // · implement stores
33
+ const storeUsersWorkingHours = useUsersWorkingHours()
34
+
35
+
36
+ // · initializing
37
+ onMounted(() => {
38
+ storeUsersWorkingHours.fetch()
39
+ })
40
+
41
+ </script>
42
+ <template>
43
+ <application-component>
44
+ <lesli-header title="Working hours"></lesli-header>
45
+ <lesli-toolbar @search="storeUsersWorkingHours.search"></lesli-toolbar>
46
+ <lesli-table
47
+ :columns="storeUsersWorkingHours.columns"
48
+ :records="storeUsersWorkingHours.records"
49
+ @sort="storeUsersWorkingHours.sort">
50
+ </lesli-table>
51
+ </application-component>
52
+ </template>
@@ -0,0 +1,87 @@
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
+
22
+
23
+ // ·
24
+ export const useAccountsActivities = defineStore("accountsActivities", {
25
+ state: () => {
26
+ return {
27
+ loading: false,
28
+ pagination: {},
29
+ records: [],
30
+ columns: [{
31
+ field: "id",
32
+ label: "ID"
33
+ }, {
34
+ field: "title",
35
+ label: "Title"
36
+ }, {
37
+ field: "description",
38
+ label: "Description"
39
+ }, {
40
+ field: "system_process",
41
+ label: "Process"
42
+ }, {
43
+ field: "system_module",
44
+ label: "Module"
45
+ }, {
46
+ field: "created_at_date",
47
+ label: "Date"
48
+ },{
49
+ field: "send_to",
50
+ label: "Send to"
51
+ }]
52
+ }
53
+ },
54
+ actions: {
55
+
56
+ fetchIfEmpty() {
57
+ if (this.records.length <= 0) {
58
+ this.fetch()
59
+ }
60
+ },
61
+
62
+ search(string) {
63
+ this.http.get(this.url.audit("accounts/activities").search(string)).then(result => {
64
+ this.records = result.records
65
+ this.pagination = result.pagination
66
+ }).catch(error => {
67
+ this.msg.danger("Error while trying to fetch data")
68
+ }).finally(() => {
69
+ this.loading = false
70
+ })
71
+ },
72
+
73
+ fetch() {
74
+ this.$reset()
75
+ this.loading = true
76
+ this.http.get(this.url.audit("accounts/activities")).then(result => {
77
+ this.records = result.records
78
+ this.pagination = result.pagination
79
+ }).catch(error => {
80
+
81
+ }).finally(() => {
82
+ this.loading = false
83
+ })
84
+ }
85
+
86
+ }
87
+ })