lesli_driver 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 (54) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +5 -0
  3. data/app/assets/config/lesli_driver_manifest.js +40 -0
  4. data/app/assets/images/lesli_driver/driver-logo.svg +101 -0
  5. data/app/assets/javascripts/lesli_driver/application.js +1 -0
  6. data/app/assets/stylesheets/lesli_driver/application.scss +96 -0
  7. data/app/controllers/lesli_driver/application_controller.rb +4 -0
  8. data/app/controllers/lesli_driver/dashboards_controller.rb +60 -0
  9. data/app/helpers/lesli_driver/application_helper.rb +4 -0
  10. data/app/helpers/lesli_driver/dashboards_helper.rb +4 -0
  11. data/app/jobs/lesli_driver/application_job.rb +4 -0
  12. data/app/mailers/lesli_driver/application_mailer.rb +6 -0
  13. data/app/models/lesli_driver/application_record.rb +5 -0
  14. data/app/models/lesli_driver/dashboard.rb +4 -0
  15. data/app/views/lesli_driver/dashboards/_dashboard.html.erb +2 -0
  16. data/app/views/lesli_driver/dashboards/_form.html.erb +17 -0
  17. data/app/views/lesli_driver/dashboards/edit.html.erb +10 -0
  18. data/app/views/lesli_driver/dashboards/index.html.erb +14 -0
  19. data/app/views/lesli_driver/dashboards/new.html.erb +9 -0
  20. data/app/views/lesli_driver/dashboards/show.html.erb +1 -0
  21. data/app/views/lesli_driver/partials/_engine-navigation.html.erb +37 -0
  22. data/config/routes.rb +36 -0
  23. data/db/migrate/20231007030328_create_lesli_driver_dashboards.rb +8 -0
  24. data/db/migrate/v1.0/0301000110_create_lesli_driver_accounts.rb +40 -0
  25. data/db/migrate/v1.0/0301100110_create_lesli_driver_calendars.rb +46 -0
  26. data/db/migrate/v1.0/0301110110_create_lesli_driver_events.rb +57 -0
  27. data/db/seed/development.rb +54 -0
  28. data/db/seed/production.rb +17 -0
  29. data/db/seed/test.rb +17 -0
  30. data/db/seeds.rb +25 -0
  31. data/db/tables/0301010210_create_lesli_driver_catalog_event_types.rb +14 -0
  32. data/db/tables/0301110310_create_lesli_driver_event_actions.rb +16 -0
  33. data/db/tables/0301110410_create_lesli_driver_event_activities.rb +15 -0
  34. data/db/tables/0301110510_create_lesli_driver_event_discussions.rb +17 -0
  35. data/db/tables/0301110610_create_lesli_driver_event_files.rb +16 -0
  36. data/db/tables/0301110710_create_lesli_driver_event_subscribers.rb +16 -0
  37. data/db/tables/0301111010_create_lesli_driver_event_attendants.rb +13 -0
  38. data/lib/lesli_driver/engine.rb +51 -0
  39. data/lib/lesli_driver/version.rb +4 -0
  40. data/lib/lesli_driver.rb +6 -0
  41. data/lib/tasks/lesli_driver_tasks.rake +4 -0
  42. data/lib/vue/application.js +46 -0
  43. data/lib/vue/apps/calendar/show.vue +34 -0
  44. data/lib/vue/components/agenda.vue +108 -0
  45. data/lib/vue/components/calendar.vue +143 -0
  46. data/lib/vue/components/event.vue +97 -0
  47. data/lib/vue/components/form.vue +143 -0
  48. data/lib/vue/components/guests.vue +148 -0
  49. data/lib/vue/stores/calendar.js +246 -0
  50. data/lib/vue/stores/event.js +53 -0
  51. data/lib/vue/stores/guests.js +213 -0
  52. data/license +674 -0
  53. data/readme.md +67 -0
  54. metadata +112 -0
@@ -0,0 +1,17 @@
1
+ class CreateCloudDriverEventDiscussions < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :cloud_driver_event_discussions do |t|
4
+ table_base_structure = JSON.parse(File.read(Rails.root.join('db','structure','00000005_discussions.json')))
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
+ add_reference :cloud_driver_event_discussions, :users, foreign_key: true
14
+ add_reference :cloud_driver_event_discussions, :cloud_driver_event_discussions, foreign_key: true, index: { name: "driver_event_discussions_event_discussions" }
15
+ add_reference :cloud_driver_event_discussions, :cloud_driver_events, foreign_key: true, index: { name: "driver_event_discussions_events" }
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ class CreateCloudDriverEventFiles < ActiveRecord::Migration[6.0]
2
+ def change
3
+ table_base_structure = JSON.parse(File.read(Rails.root.join('db','structure','00000006_files.json')))
4
+ create_table :cloud_driver_event_files 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
+ add_reference :cloud_driver_event_files, :users, foreign_key: true
14
+ add_reference :cloud_driver_event_files, :cloud_driver_events, foreign_key: true
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ class CreateCloudDriverEventSubscribers < ActiveRecord::Migration[6.0]
2
+ def change
3
+ table_base_structure = JSON.parse(File.read(Rails.root.join('db','structure','00000007_subscribers.json')))
4
+ create_table :cloud_driver_event_subscribers 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
+ add_reference :cloud_driver_event_subscribers, :users, foreign_key: true, index: { name: 'driver_event_subscribers_users' }
14
+ add_reference :cloud_driver_event_subscribers, :cloud_driver_events, foreign_key: true, index: { name: 'driver_event_subscribers_events' }
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ class CreateCloudDriverEventAttendants < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :cloud_driver_event_attendants do |t|
4
+ t.datetime :confirmed_at
5
+
6
+ # acts_as_paranoid
7
+ t.datetime :deleted_at, index: true
8
+ t.timestamps
9
+ end
10
+ add_reference(:cloud_driver_event_attendants, :user, foreign_key: { to_table: :users })
11
+ add_reference(:cloud_driver_event_attendants, :event, foreign_key: { to_table: :cloud_driver_events })
12
+ end
13
+ end
@@ -0,0 +1,51 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.dev
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+
33
+ module LesliDriver
34
+ class Engine < ::Rails::Engine
35
+ isolate_namespace LesliDriver
36
+
37
+ initializer :lesli_driver do |app|
38
+
39
+ # register assets manifest
40
+ config.assets.precompile += %w[lesli_driver_manifest.js]
41
+
42
+ # register engine migrations path
43
+ unless app.root.to_s.match root.to_s
44
+ config.paths["db/migrate"].expanded.each do |expanded_path|
45
+ app.config.paths["db/migrate"] << expanded_path
46
+ end
47
+ end
48
+
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,4 @@
1
+ module LesliDriver
2
+ VERSION = "0.1.0"
3
+ BUILD = "1696656474"
4
+ end
@@ -0,0 +1,6 @@
1
+ require "lesli_driver/version"
2
+ require "lesli_driver/engine"
3
+
4
+ module LesliDriver
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :lesli_driver do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,46 @@
1
+ /*
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ */
32
+
33
+
34
+ // ·
35
+ import application from "Lesli/application"
36
+
37
+
38
+ // · Import apps and components
39
+ import appCalendarShow from "LesliDriver/apps/calendar/show.vue"
40
+
41
+
42
+ // ·
43
+ application("LesliDriver", [{
44
+ path: "/dashboard",
45
+ component: appCalendarShow
46
+ }])
@@ -0,0 +1,34 @@
1
+ <script setup>
2
+ /*
3
+ Copyright (c) 2023, 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
+ // · Import components
26
+ import componentCalendar from "LesliDriver/components/calendar.vue"
27
+
28
+ </script>
29
+ <template>
30
+ <lesli-application-container dashboard>
31
+ <component-calendar class="mt-4">
32
+ </component-calendar>
33
+ </lesli-application-container>
34
+ </template>
@@ -0,0 +1,108 @@
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
+ // ·
21
+ import { onMounted, watch, ref } from "vue"
22
+
23
+
24
+ // ·
25
+ import dayjs from "dayjs"
26
+
27
+
28
+ // · import lesli stores
29
+ import { useCalendar } from 'CloudDriver/stores/calendar'
30
+
31
+
32
+ // · implement stores
33
+ const storeCalendar = useCalendar()
34
+
35
+
36
+ // ·
37
+ const agenda = ref([])
38
+ const today_iso = dayjs().format('YYYY-MM-DD')
39
+
40
+
41
+ // ·
42
+ function merge() {
43
+
44
+ let events = [
45
+ ...storeCalendar.calendarData.driver_events,
46
+ ...storeCalendar.calendarData.help_tickets
47
+ ]
48
+
49
+ let count = 0
50
+
51
+ events = events.filter(event => {
52
+
53
+ if (count >= 6) {
54
+ return
55
+ }
56
+
57
+ let event_date = dayjs(event.date).format('YYYY-MM-DD')
58
+
59
+ if (event_date < today_iso) {
60
+ return
61
+ }
62
+
63
+ let format = "DD MMM"
64
+
65
+ event.time = event.start
66
+
67
+ if (event_date == today_iso) {
68
+ format = "HH:mm"
69
+ }
70
+
71
+ if (event.start) { event['start'] = dayjs(event.start).format(format) }
72
+ if (event.description) { event['description'] = event.description.substring(0, 40) + '...' }
73
+
74
+ event.classNames = event.classNames
75
+
76
+ count++
77
+
78
+ return event
79
+
80
+ })
81
+
82
+ events = events.sort((a,b) => a.time > b.time)
83
+
84
+ agenda.value = events
85
+ }
86
+
87
+
88
+ // ·
89
+ watch(() => storeCalendar.calendarData.driver_events, () => merge())
90
+
91
+ </script>
92
+ <template>
93
+ <div class="driver-agenda">
94
+ <h3>Upcoming events</h3>
95
+ <div
96
+ class="is-flex is-align-items-center event"
97
+ v-for="(event, index) in agenda"
98
+ :key="index">
99
+ <span class="date">
100
+ {{ event.start }}
101
+ </span>
102
+ <div :class="['description', event.classNames]">
103
+ <p>{{ event.title }}</p>
104
+ <p>{{ event.description }}</p>
105
+ </div>
106
+ </div>
107
+ </div>
108
+ </template>
@@ -0,0 +1,143 @@
1
+ <script setup>
2
+ /*
3
+ Copyright (c) 2023, 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 components, libraries and tools
20
+ import { onMounted, inject, ref } from "vue"
21
+ import { Calendar } from '@fullcalendar/core'
22
+ import dayGridPlugin from '@fullcalendar/daygrid'
23
+ import timeGridPlugin from '@fullcalendar/timegrid'
24
+ import interactionPlugin from '@fullcalendar/interaction'
25
+ import listPlugin from '@fullcalendar/list';
26
+
27
+
28
+ // ·
29
+ const date = inject("date")
30
+
31
+ const storeCalendar = ref({ calendar: null })
32
+
33
+
34
+ // ·
35
+ function initCalendar() {
36
+ storeCalendar.calendar = new Calendar(document.getElementById("driver-calendar"), {
37
+ plugins: [
38
+ dayGridPlugin,
39
+ interactionPlugin,
40
+ timeGridPlugin,
41
+ listPlugin
42
+ ],
43
+ headerToolbar: false,
44
+ firstDay: 1,
45
+ locale: I18n.currentLocale(),
46
+ initialView: 'dayGridMonth',
47
+ showNonCurrentDates: true,
48
+ events: [],
49
+ eventClick: storeCalendar.onEventClick,
50
+ dateClick: storeCalendar.onDateClick,
51
+ eventContent: function (args) {
52
+
53
+ let title = document.createElement('span')
54
+ let time = document.createElement('span')
55
+ title.innerHTML = args.event.title
56
+ time.innerHTML = date.time(args.event._def.extendedProps.dateStart)
57
+
58
+ if (args.event._def.extendedProps.dateEnd) {
59
+ time.innerHTML += (" - " + date.time(args.event._def.extendedProps.dateEnd))
60
+ }
61
+
62
+ title.classList.add('event-title')
63
+ time.classList.add('event-time')
64
+ return { domNodes: [title, time] }
65
+ }
66
+ })
67
+ storeCalendar.calendar.render()
68
+ }
69
+
70
+
71
+ onMounted(() => {
72
+ let calendar = new Calendar(document.getElementById("driver-calendar"), {
73
+ plugins: [
74
+ dayGridPlugin,
75
+ interactionPlugin,
76
+ timeGridPlugin,
77
+ listPlugin
78
+ ],
79
+ headerToolbar: {
80
+ left: '',
81
+ center: 'title',
82
+ right: ''
83
+ },
84
+ firstDay: 1,
85
+ initialView: 'dayGridMonth',
86
+ showNonCurrentDates: true,
87
+ dayMaxEvents: true, // allow "more" link when too many events
88
+ editable: true,
89
+ events: [{
90
+ title: 'All Day Event',
91
+ start: '2023-10-01',
92
+ classNames: "ldonis"
93
+ }, {
94
+ title: 'Long Event',
95
+ start: '2023-10-07',
96
+ end: '2023-10-10'
97
+ }, {
98
+ groupId: 999,
99
+ title: 'Repeating Event',
100
+ start: '2023-10-09T16:00:00'
101
+ }, {
102
+ groupId: 999,
103
+ title: 'Repeating Event',
104
+ start: '2023-10-16T16:00:00'
105
+ }, {
106
+ title: 'Conference',
107
+ start: '2023-10-11',
108
+ end: '2023-10-13'
109
+ }, {
110
+ title: 'Meeting',
111
+ start: '2023-10-12T10:30:00',
112
+ end: '2023-10-12T12:30:00'
113
+ }, {
114
+ title: 'Lunch',
115
+ start: '2023-10-12T12:00:00'
116
+ }, {
117
+ title: 'Meeting',
118
+ start: '2023-10-15T14:30:00'
119
+ }, {
120
+ title: 'Happy Hour',
121
+ start: '2023-10-15T17:30:00'
122
+ }, {
123
+ title: 'Dinner',
124
+ start: '2023-10-12T20:00:00'
125
+ }, {
126
+ title: 'Birthday Party',
127
+ start: '2023-10-13T07:00:00'
128
+ }, {
129
+ title: 'Click for Google',
130
+ url: 'http://google.com/',
131
+ start: '2023-10-28'
132
+ }]
133
+ });
134
+
135
+ setTimeout(() => { calendar.render(); }, 100)
136
+
137
+ })
138
+
139
+ </script>
140
+
141
+ <template>
142
+ <div id="driver-calendar"></div>
143
+ </template>
@@ -0,0 +1,97 @@
1
+ <script setup>
2
+ /*
3
+ Copyright (c) 2023, 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 components, libraries and tools
20
+ import { onMounted } from 'vue'
21
+ import ComponentDiscussions from "LesliVue/cloud-objects/discussion.vue"
22
+ import ComponentFiles from "LesliVue/cloud-objects/file.vue"
23
+ import ComponentGuests from './guests.vue'
24
+ import ComponentForm from './form.vue'
25
+
26
+ // · import lesli stores
27
+ import { useEvent } from 'CloudDriver/stores/event'
28
+ import { useCalendar } from 'CloudDriver/stores/calendar'
29
+ import { useUsers } from "LesliVue/stores/users"
30
+
31
+ // · implement stores
32
+ const storeEvent = useEvent()
33
+ const storeCalendar = useCalendar()
34
+ const storeUsers = useUsers()
35
+
36
+ onMounted(() => {
37
+ storeEvent.getOptions()
38
+ storeUsers.fetchList()
39
+ })
40
+
41
+ const translations = {
42
+ events: I18n.t('driver.events'),
43
+ core: I18n.t('core.shared'),
44
+ }
45
+
46
+ const deleteEvent = async () => {
47
+ await storeCalendar.deleteEvent()
48
+ }
49
+
50
+ </script>
51
+
52
+ <template>
53
+
54
+ <lesli-panel v-model:open="storeEvent.showModal">
55
+ <template #header>
56
+ </template>
57
+
58
+ <template #default>
59
+ <lesli-tabs v-if="storeCalendar.event.id" v-model="tab">
60
+
61
+ <lesli-tab-item :title="translations.core.view_tab_title_general_information" icon="info">
62
+ <ComponentForm />
63
+ </lesli-tab-item>
64
+
65
+ <lesli-tab-item :title="translations.core.view_btn_discussions" icon="forum">
66
+ <ComponentDiscussions cloud-module="driver" cloud-object="events"
67
+ :cloud-object-id="storeCalendar.event.id" :onlyDiscussions="true">
68
+ </ComponentDiscussions>
69
+ </lesli-tab-item>
70
+
71
+ <lesli-tab-item :title="translations.core.view_btn_files" icon="attach_file">
72
+ <ComponentFiles cloud-module="driver" cloud-object="events"
73
+ :cloud-object-id="storeCalendar.event.id"
74
+ :accepted-files="['images', 'documents', 'plaintext']">
75
+ </ComponentFiles>
76
+ </lesli-tab-item>
77
+
78
+ <lesli-tab-item :title="translations.events.view_tab_title_assignments" icon="group">
79
+ <ComponentGuests />
80
+ </lesli-tab-item>
81
+
82
+ <lesli-tab-item :title="translations.events.view_tab_title_delete_section" icon="delete">
83
+ <button @click="deleteEvent()" class="button is-fullwidth has-text-centered is-danger"
84
+ :disabled="storeEvent.submit.delete">
85
+ <span class="delete">{{ translations.core.view_btn_delete }}
86
+ </span>
87
+ {{ translations.core.view_btn_delete }}
88
+ </button>
89
+ </lesli-tab-item>
90
+ </lesli-tabs>
91
+
92
+ <ComponentForm v-else />
93
+
94
+ </template>
95
+ </lesli-panel>
96
+
97
+ </template>