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.
- checksums.yaml +7 -0
- data/Rakefile +5 -0
- data/app/assets/config/lesli_driver_manifest.js +40 -0
- data/app/assets/images/lesli_driver/driver-logo.svg +101 -0
- data/app/assets/javascripts/lesli_driver/application.js +1 -0
- data/app/assets/stylesheets/lesli_driver/application.scss +96 -0
- data/app/controllers/lesli_driver/application_controller.rb +4 -0
- data/app/controllers/lesli_driver/dashboards_controller.rb +60 -0
- data/app/helpers/lesli_driver/application_helper.rb +4 -0
- data/app/helpers/lesli_driver/dashboards_helper.rb +4 -0
- data/app/jobs/lesli_driver/application_job.rb +4 -0
- data/app/mailers/lesli_driver/application_mailer.rb +6 -0
- data/app/models/lesli_driver/application_record.rb +5 -0
- data/app/models/lesli_driver/dashboard.rb +4 -0
- data/app/views/lesli_driver/dashboards/_dashboard.html.erb +2 -0
- data/app/views/lesli_driver/dashboards/_form.html.erb +17 -0
- data/app/views/lesli_driver/dashboards/edit.html.erb +10 -0
- data/app/views/lesli_driver/dashboards/index.html.erb +14 -0
- data/app/views/lesli_driver/dashboards/new.html.erb +9 -0
- data/app/views/lesli_driver/dashboards/show.html.erb +1 -0
- data/app/views/lesli_driver/partials/_engine-navigation.html.erb +37 -0
- data/config/routes.rb +36 -0
- data/db/migrate/20231007030328_create_lesli_driver_dashboards.rb +8 -0
- data/db/migrate/v1.0/0301000110_create_lesli_driver_accounts.rb +40 -0
- data/db/migrate/v1.0/0301100110_create_lesli_driver_calendars.rb +46 -0
- data/db/migrate/v1.0/0301110110_create_lesli_driver_events.rb +57 -0
- data/db/seed/development.rb +54 -0
- data/db/seed/production.rb +17 -0
- data/db/seed/test.rb +17 -0
- data/db/seeds.rb +25 -0
- data/db/tables/0301010210_create_lesli_driver_catalog_event_types.rb +14 -0
- data/db/tables/0301110310_create_lesli_driver_event_actions.rb +16 -0
- data/db/tables/0301110410_create_lesli_driver_event_activities.rb +15 -0
- data/db/tables/0301110510_create_lesli_driver_event_discussions.rb +17 -0
- data/db/tables/0301110610_create_lesli_driver_event_files.rb +16 -0
- data/db/tables/0301110710_create_lesli_driver_event_subscribers.rb +16 -0
- data/db/tables/0301111010_create_lesli_driver_event_attendants.rb +13 -0
- data/lib/lesli_driver/engine.rb +51 -0
- data/lib/lesli_driver/version.rb +4 -0
- data/lib/lesli_driver.rb +6 -0
- data/lib/tasks/lesli_driver_tasks.rake +4 -0
- data/lib/vue/application.js +46 -0
- data/lib/vue/apps/calendar/show.vue +34 -0
- data/lib/vue/components/agenda.vue +108 -0
- data/lib/vue/components/calendar.vue +143 -0
- data/lib/vue/components/event.vue +97 -0
- data/lib/vue/components/form.vue +143 -0
- data/lib/vue/components/guests.vue +148 -0
- data/lib/vue/stores/calendar.js +246 -0
- data/lib/vue/stores/event.js +53 -0
- data/lib/vue/stores/guests.js +213 -0
- data/license +674 -0
- data/readme.md +67 -0
- metadata +112 -0
@@ -0,0 +1,213 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2023, 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
|
+
import { defineStore } from "pinia"
|
20
|
+
import { useCalendar } from 'CloudDriver/stores/calendar'
|
21
|
+
|
22
|
+
// · import lesli stores
|
23
|
+
import { useUsers } from "LesliVue/stores/users"
|
24
|
+
|
25
|
+
// ·
|
26
|
+
export const useGuests = defineStore("driver.guests", {
|
27
|
+
state: () => {
|
28
|
+
return {
|
29
|
+
main_route: `/driver/events`,
|
30
|
+
attendant_options: {
|
31
|
+
users: []
|
32
|
+
},
|
33
|
+
attendants: [],
|
34
|
+
guest: {
|
35
|
+
name: "",
|
36
|
+
email: "",
|
37
|
+
},
|
38
|
+
lists_synched: false,
|
39
|
+
loading: {
|
40
|
+
attendants: false,
|
41
|
+
options: false
|
42
|
+
},
|
43
|
+
loaded: {
|
44
|
+
attendants: false,
|
45
|
+
attendant_options: false
|
46
|
+
},
|
47
|
+
submit: {
|
48
|
+
event: false,
|
49
|
+
delete: false,
|
50
|
+
guest: false
|
51
|
+
},
|
52
|
+
|
53
|
+
translations: {
|
54
|
+
main: I18n.t('driver.events'),
|
55
|
+
core: I18n.t('core.shared'),
|
56
|
+
core_users: I18n.t('core.users')
|
57
|
+
}
|
58
|
+
}
|
59
|
+
},
|
60
|
+
|
61
|
+
actions: {
|
62
|
+
|
63
|
+
getUsers() {
|
64
|
+
const storeUsers = useUsers()
|
65
|
+
try {
|
66
|
+
this.loading.attendants = false
|
67
|
+
this.attendant_options.users = storeUsers.list.map(user => {
|
68
|
+
const foundAttendant = this.attendants.find(attendant => attendant.email === user.email);
|
69
|
+
return {
|
70
|
+
id: user.id,
|
71
|
+
name: user.name,
|
72
|
+
email: user.email,
|
73
|
+
checked: !!foundAttendant
|
74
|
+
};
|
75
|
+
});
|
76
|
+
} catch (error) {
|
77
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
78
|
+
} finally {
|
79
|
+
this.loaded.attendant_options = true
|
80
|
+
}
|
81
|
+
},
|
82
|
+
|
83
|
+
getAttendants() {
|
84
|
+
const storeCalendar = useCalendar()
|
85
|
+
let url = `${this.main_route}/${storeCalendar.event.id}/attendants.json`
|
86
|
+
this.loading.attendants = true
|
87
|
+
this.http.get(url).then(result => {
|
88
|
+
this.loading.attendants = false
|
89
|
+
const filteredAttendant = result.filter((attendant, index, self) =>
|
90
|
+
self.findIndex(record => record.email === attendant.email) === index
|
91
|
+
)
|
92
|
+
this.attendants = filteredAttendant
|
93
|
+
}).catch(error => {
|
94
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
95
|
+
}).finally(() => {
|
96
|
+
this.loaded.attendants = true
|
97
|
+
})
|
98
|
+
},
|
99
|
+
|
100
|
+
|
101
|
+
postAttendant(user) {
|
102
|
+
const storeCalendar = useCalendar()
|
103
|
+
let url = this.url.driver("events/:event_id/attendants", { event_id: storeCalendar.event.id })
|
104
|
+
let data = {
|
105
|
+
event_attendant: {
|
106
|
+
users_id: user.id
|
107
|
+
}
|
108
|
+
}
|
109
|
+
this.http.post(url, data).then(result => {
|
110
|
+
this.attendants.push({
|
111
|
+
id: result.id,
|
112
|
+
type: 'attendant',
|
113
|
+
name: user.name || user.email,
|
114
|
+
email: user.email,
|
115
|
+
users_id: user.id,
|
116
|
+
confirmed_at_string: null
|
117
|
+
})
|
118
|
+
this.msg.success(this.translations.main.messages_success_attendant_created)
|
119
|
+
|
120
|
+
}).catch(error => {
|
121
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
122
|
+
})
|
123
|
+
},
|
124
|
+
|
125
|
+
postGuest() {
|
126
|
+
const storeCalendar = useCalendar()
|
127
|
+
let url = this.url.driver("events/:event_id/guests", { event_id: storeCalendar.event.id })
|
128
|
+
this.submit.guest = true
|
129
|
+
|
130
|
+
this.http.post(url, {
|
131
|
+
event_guest: this.guest
|
132
|
+
}).then(result => {
|
133
|
+
this.attendants.push({
|
134
|
+
...result,
|
135
|
+
type: 'guest',
|
136
|
+
name: result.name || result.email,
|
137
|
+
})
|
138
|
+
this.guest = {}
|
139
|
+
this.msg.success(this.translations.main.messages_success_attendant_created)
|
140
|
+
|
141
|
+
}).catch(error => {
|
142
|
+
this.msg.danger(this.translations.core.shared.messages_danger_internal_error);
|
143
|
+
}).finally(() => {
|
144
|
+
this.submit.guest = false
|
145
|
+
})
|
146
|
+
},
|
147
|
+
|
148
|
+
confirmAttendance(user, today) {
|
149
|
+
const storeCalendar = useCalendar();
|
150
|
+
let url, data;
|
151
|
+
|
152
|
+
this.loading.attendants = true;
|
153
|
+
|
154
|
+
if (user.users_id) {
|
155
|
+
url = this.url.driver("events/:event_id/attendants/:attendant_id", {
|
156
|
+
event_id: storeCalendar.event.id,
|
157
|
+
attendant_id: user.id
|
158
|
+
});
|
159
|
+
data = { event_attendant: user };
|
160
|
+
} else {
|
161
|
+
url = this.url.driver("events/:event_id/guests/:attendant_id", {
|
162
|
+
event_id: storeCalendar.event.id,
|
163
|
+
attendant_id: user.id
|
164
|
+
});
|
165
|
+
data = { event_guest: user };
|
166
|
+
}
|
167
|
+
|
168
|
+
this.http.put(url, data)
|
169
|
+
.then(result => {
|
170
|
+
const attendantIndex = this.attendants.findIndex(attendant => attendant.email === user.email);
|
171
|
+
this.attendants[attendantIndex].confirmed_at_string = today;
|
172
|
+
this.msg.success(this.translations.core_users.messages_success_operation);
|
173
|
+
})
|
174
|
+
.catch(error => {
|
175
|
+
this.msg.danger(this.translations.core.shared.messages_danger_internal_error);
|
176
|
+
})
|
177
|
+
.finally(() => {
|
178
|
+
this.loading.attendants = false;
|
179
|
+
});
|
180
|
+
},
|
181
|
+
|
182
|
+
deleteInvite(user) {
|
183
|
+
const storeCalendar = useCalendar()
|
184
|
+
|
185
|
+
const index = this.attendant_options.users.findIndex(attendant => attendant.email === user.email);
|
186
|
+
if (index !== -1) {
|
187
|
+
this.attendant_options.users[index].checked = false;
|
188
|
+
}
|
189
|
+
|
190
|
+
let attendant = this.attendants.find(attendant => {
|
191
|
+
return attendant.email === user.email
|
192
|
+
})
|
193
|
+
let url = `${this.main_route}/${storeCalendar.event.id}/attendants/${attendant.id}.json`
|
194
|
+
|
195
|
+
// If this is a guest, we have a different endpoint
|
196
|
+
if (user.type == 'guest') {
|
197
|
+
url = `${this.main_route}/${storeCalendar.event.id}/guests/${attendant.id}.json`
|
198
|
+
}
|
199
|
+
this.submit.delete = true
|
200
|
+
this.http.delete(url).then(result => {
|
201
|
+
this.attendants = this.attendants.filter((attendant) => {
|
202
|
+
return attendant.email !== user.email
|
203
|
+
})
|
204
|
+
|
205
|
+
this.msg.success(this.translations.main.messages_success_attendant_deleted)
|
206
|
+
}).catch(error => {
|
207
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
208
|
+
}).finally(() => {
|
209
|
+
this.submit.delete = false
|
210
|
+
})
|
211
|
+
},
|
212
|
+
}
|
213
|
+
})
|