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,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 lesli stores
|
20
|
+
import { useCalendar } from 'CloudDriver/stores/calendar'
|
21
|
+
import { useEvent } from 'CloudDriver/stores/event'
|
22
|
+
|
23
|
+
// · implement stores
|
24
|
+
const storeCalendar = useCalendar()
|
25
|
+
const storeEvent = useEvent()
|
26
|
+
|
27
|
+
const translations = {
|
28
|
+
events: I18n.t('driver.events'),
|
29
|
+
core: I18n.t('core.shared'),
|
30
|
+
}
|
31
|
+
|
32
|
+
const submitEvent = () => {
|
33
|
+
if (storeCalendar.event.id) {
|
34
|
+
storeCalendar.putEvent()
|
35
|
+
}
|
36
|
+
else {
|
37
|
+
storeCalendar.postEvent()
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
</script>
|
42
|
+
|
43
|
+
<template>
|
44
|
+
<form @submit.prevent="submitEvent">
|
45
|
+
<fieldset>
|
46
|
+
<div class="columns">
|
47
|
+
<div class="column">
|
48
|
+
<field label="column_user_main_id">
|
49
|
+
<p>{{ translations.events.column_user_main_id }}</p>
|
50
|
+
<input class="input is-default" type="text" name="organizer_name"
|
51
|
+
v-model="storeCalendar.event.organizer_name" readonly />
|
52
|
+
</field>
|
53
|
+
<field>
|
54
|
+
<p>{{ translations.events.column_title }}</p>
|
55
|
+
<input class="input is-default" type="text" name="title" v-model="storeCalendar.event.title"
|
56
|
+
required />
|
57
|
+
</field>
|
58
|
+
<field>
|
59
|
+
<p>{{ translations.events.column_time_start }}</p>
|
60
|
+
<lesli-calendar v-model="storeCalendar.event.time_start" mode="dateTime">
|
61
|
+
</lesli-calendar>
|
62
|
+
</field>
|
63
|
+
<field>
|
64
|
+
<p>{{ translations.events.column_budget }}
|
65
|
+
({{ storeCalendar.lesli.settings.currency.symbol }})</p>
|
66
|
+
<input class="input is-default" type="number" name="budget" min="0" step="0.01"
|
67
|
+
v-model="storeCalendar.event.budget" />
|
68
|
+
</field>
|
69
|
+
<field>
|
70
|
+
<p>{{ translations.events.column_showed_up_count }}</p>
|
71
|
+
<input class="input is-default" type="number" name="showed_up_count" min="0" step="1"
|
72
|
+
v-model="storeCalendar.event.showed_up_count" />
|
73
|
+
</field>
|
74
|
+
</div>
|
75
|
+
<div class="column">
|
76
|
+
<field>
|
77
|
+
<p>{{ translations.events.column_cloud_driver_catalog_event_types_id }}</p>
|
78
|
+
<lesli-select v-model="storeCalendar.event.cloud_driver_catalog_event_types_id" icon="public"
|
79
|
+
:options="storeEvent.options.event_types">
|
80
|
+
</lesli-select>
|
81
|
+
</field>
|
82
|
+
<field>
|
83
|
+
<p>{{ translations.events.column_location }}</p>
|
84
|
+
<input class="input is-default" type="text" name="address"
|
85
|
+
v-model="storeCalendar.event.location" />
|
86
|
+
</field>
|
87
|
+
<field>
|
88
|
+
<p>{{ translations.events.column_time_end }}</p>
|
89
|
+
<lesli-calendar v-model="storeCalendar.event.time_end" mode="dateTime">
|
90
|
+
</lesli-calendar>
|
91
|
+
</field>
|
92
|
+
<field>
|
93
|
+
<p>{{ translations.events.column_real_cost }}
|
94
|
+
({{ storeCalendar.lesli.settings.currency.symbol }})</p>
|
95
|
+
<input class="input is-default" type="number" name="real_cost" min="0" step="0.01"
|
96
|
+
v-model="storeCalendar.event.real_cost" />
|
97
|
+
</field>
|
98
|
+
<field>
|
99
|
+
<p>{{ translations.events.column_signed_up_count }}</p>
|
100
|
+
<input class="input is-default" type="number" name="signed_up_count" min="0" step="1"
|
101
|
+
v-model="storeCalendar.event.signed_up_count" />
|
102
|
+
</field>
|
103
|
+
</div>
|
104
|
+
</div>
|
105
|
+
<div class="columns">
|
106
|
+
<div class="column">
|
107
|
+
<field>
|
108
|
+
<p>{{ translations.events.column_description }}</p>
|
109
|
+
<div class="control">
|
110
|
+
<textarea v-model="storeCalendar.event.description" class="textarea"
|
111
|
+
name="description"></textarea>
|
112
|
+
</div>
|
113
|
+
</field>
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
<div class="columns">
|
117
|
+
<div class="column">
|
118
|
+
<field>
|
119
|
+
<label class="checkbox">
|
120
|
+
{{ translations.events.view_text_mark_as_public }}
|
121
|
+
<input type="checkbox" name="public" v-model="storeCalendar.event.public">
|
122
|
+
</label>
|
123
|
+
</field>
|
124
|
+
</div>
|
125
|
+
<div class="column">
|
126
|
+
<field>
|
127
|
+
<label class="checkbox">
|
128
|
+
{{ "Is proposal?" }}
|
129
|
+
<input type="checkbox" name="is_proposal" v-model="storeCalendar.event.is_proposal">
|
130
|
+
</label>
|
131
|
+
</field>
|
132
|
+
<field v-show="storeCalendar.event.is_proposal">
|
133
|
+
<p>{{ translations.events.column_estimated_duration }}</p>
|
134
|
+
<input class="input is-default" type="number" name="estimated_mins_durations" min="10" step="10"
|
135
|
+
v-model="storeCalendar.event.estimated_mins_durations" />
|
136
|
+
</field>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
<lesli-button type="submit" icon="save">{{ translations.core.view_btn_save }}</lesli-button>
|
140
|
+
</fieldset>
|
141
|
+
</form>
|
142
|
+
|
143
|
+
</template>
|
@@ -0,0 +1,148 @@
|
|
1
|
+
<script setup>
|
2
|
+
|
3
|
+
/*
|
4
|
+
Copyright (c) 2023, all rights reserved.
|
5
|
+
|
6
|
+
All the information provided by this platform is protected by international laws related to
|
7
|
+
industrial property, intellectual property, copyright and relative international laws.
|
8
|
+
All intellectual or industrial property rights of the code, texts, trade mark, design,
|
9
|
+
pictures and any other information belongs to the owner of this platform.
|
10
|
+
|
11
|
+
Without the written permission of the owner, any replication, modification,
|
12
|
+
transmission, publication is strictly forbidden.
|
13
|
+
|
14
|
+
For more information read the license file including with this software.
|
15
|
+
|
16
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
17
|
+
*/
|
18
|
+
|
19
|
+
// · Import components, libraries and tools
|
20
|
+
import { onMounted, inject } from "vue"
|
21
|
+
|
22
|
+
// · import lesli stores
|
23
|
+
import { useGuests } from 'CloudDriver/stores/guests'
|
24
|
+
import { useCalendar } from 'CloudDriver/stores/calendar'
|
25
|
+
|
26
|
+
// · implement stores
|
27
|
+
const storeGuests = useGuests()
|
28
|
+
const storeCalendar = useCalendar()
|
29
|
+
|
30
|
+
// · initialize/inject plugins
|
31
|
+
const date = inject("date")
|
32
|
+
const today = date.date(new Date())
|
33
|
+
|
34
|
+
onMounted(() => {
|
35
|
+
storeGuests.getAttendants()
|
36
|
+
storeGuests.getUsers()
|
37
|
+
})
|
38
|
+
|
39
|
+
function submitAttendant(user) {
|
40
|
+
user.checked = !user.checked;
|
41
|
+
if (user.checked) storeGuests.postAttendant(user)
|
42
|
+
else storeGuests.deleteInvite(user)
|
43
|
+
}
|
44
|
+
|
45
|
+
function confirmedInvitesCount() {
|
46
|
+
return storeGuests.attendants.filter(attendant => attendant.confirmed_at_string).length
|
47
|
+
}
|
48
|
+
|
49
|
+
function totalInvitesCount() {
|
50
|
+
return storeGuests.attendants.length
|
51
|
+
}
|
52
|
+
|
53
|
+
const translations = {
|
54
|
+
main: I18n.t('driver.events'),
|
55
|
+
core: I18n.t('core.shared'),
|
56
|
+
core_users: I18n.t('core.users'),
|
57
|
+
users: I18n.t('deutscheleibrenten.users'),
|
58
|
+
attendants: I18n.t('driver.event/attendants')
|
59
|
+
}
|
60
|
+
|
61
|
+
const usersTableColumns = [
|
62
|
+
{ field: 'name', label: translations.core.view_text_name },
|
63
|
+
{ field: 'email', label: translations.core.view_text_email }
|
64
|
+
]
|
65
|
+
|
66
|
+
const attendantsTableColumns = [
|
67
|
+
{ field: 'name', label: translations.core.view_text_name },
|
68
|
+
{ field: 'email', label: translations.core.view_text_email }
|
69
|
+
]
|
70
|
+
|
71
|
+
</script>
|
72
|
+
|
73
|
+
<template>
|
74
|
+
<h5 class="title is-5">
|
75
|
+
{{ translations.attendants.view_title_confirmed_invites_count }}: {{ confirmedInvitesCount() }} /
|
76
|
+
{{ translations.attendants.view_title_total_invites_count }}: {{ totalInvitesCount() }}
|
77
|
+
</h5>
|
78
|
+
<lesli-tabs v-model="tab">
|
79
|
+
|
80
|
+
<lesli-tab-item :title="translations.main.view_tab_title_users" icon="person_search">
|
81
|
+
<lesli-toolbar @search="a"></lesli-toolbar>
|
82
|
+
<lesli-table :columns="usersTableColumns" :records="storeGuests.attendant_options.users">
|
83
|
+
<template #buttons="{ record }">
|
84
|
+
<input type="checkbox" v-model="record.checked" @input="submitAttendant(record)"
|
85
|
+
:checked="storeGuests.attendant_options.users.checked">
|
86
|
+
</template>
|
87
|
+
</lesli-table>
|
88
|
+
</lesli-tab-item>
|
89
|
+
|
90
|
+
<lesli-tab-item :title="translations.main.view_tab_title_guests" icon="group_add">
|
91
|
+
<form @submit.prevent="storeGuests.postGuest">
|
92
|
+
<fieldset>
|
93
|
+
<div class="columns">
|
94
|
+
<div class="column">
|
95
|
+
<field label="column_user_main_id">
|
96
|
+
<p>{{ translations.core.view_text_name }}</p>
|
97
|
+
<input class="input is-default" type="text" name="guest_name"
|
98
|
+
v-model="storeGuests.guest.name" />
|
99
|
+
</field>
|
100
|
+
<field label="column_user_main_id">
|
101
|
+
<p>{{ translations.core.view_text_email }}</p>
|
102
|
+
<input class="input is-default" type="email" name="guest_email"
|
103
|
+
v-model="storeGuests.guest.email" />
|
104
|
+
</field>
|
105
|
+
<div class="buttons">
|
106
|
+
<button name="btn-save" type="submit" class="button is-primary is-fullwidth">
|
107
|
+
<span><span class="icon is-small"><i class="fas fa-save"></i></span> </span>
|
108
|
+
</button>
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
</fieldset>
|
113
|
+
</form>
|
114
|
+
</lesli-tab-item>
|
115
|
+
|
116
|
+
<lesli-tab-item :title="translations.main.view_tab_title_attendants_list" icon="groups">
|
117
|
+
<lesli-table :columns="attendantsTableColumns" :records="storeGuests.attendants">
|
118
|
+
<template #buttons="{ record }">
|
119
|
+
|
120
|
+
<button @click="storeGuests.confirmAttendance(record, today)" class="button is-success" :disabled="record.confirmed_at_string">
|
121
|
+
<span v-if="!record.confirmed_at_string && !storeGuests.loading.attendants">
|
122
|
+
{{ translations.main.view_text_click_to_confirm }}
|
123
|
+
</span>
|
124
|
+
<span v-if="storeGuests.loading.attendants">
|
125
|
+
<i class="fas fa-spin fa-circle-notch"></i>
|
126
|
+
</span>
|
127
|
+
<span v-if="record.confirmed_at_string && !storeGuests.loading.attendants">
|
128
|
+
{{ record.confirmed_at_string }}
|
129
|
+
</span>
|
130
|
+
</button>
|
131
|
+
|
132
|
+
<button @click="storeGuests.deleteInvite(record)"
|
133
|
+
class="button is-outlined is-danger">
|
134
|
+
<span v-if="storeGuests.submit.delete">
|
135
|
+
<i class="fas fa-spin fa-circle-notch"></i> {{
|
136
|
+
translations.core.view_btn_deleting
|
137
|
+
}}
|
138
|
+
</span>
|
139
|
+
<span v-else>
|
140
|
+
<i class="fas fa-trash-alt"></i> {{ translations.core.view_btn_delete }}
|
141
|
+
</span>
|
142
|
+
</button>
|
143
|
+
</template>
|
144
|
+
</lesli-table>
|
145
|
+
</lesli-tab-item>
|
146
|
+
|
147
|
+
</lesli-tabs>
|
148
|
+
</template>
|
@@ -0,0 +1,246 @@
|
|
1
|
+
/*
|
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
|
+
// ·
|
21
|
+
import { defineStore } from "pinia"
|
22
|
+
import dayjs from 'dayjs'
|
23
|
+
|
24
|
+
|
25
|
+
// · Import components, libraries and tools
|
26
|
+
import dayGridPlugin from '@fullcalendar/daygrid'
|
27
|
+
import timeGridPlugin from '@fullcalendar/timegrid'
|
28
|
+
import interactionPlugin from '@fullcalendar/interaction'
|
29
|
+
import listPlugin from '@fullcalendar/list';
|
30
|
+
|
31
|
+
|
32
|
+
// · import lesli stores
|
33
|
+
import { useEvent } from 'LesliDriver/stores/event'
|
34
|
+
//import { useGuests } from 'LesliDriver/stores/guests'
|
35
|
+
//import { useUser } from "LesliVue/stores/user"
|
36
|
+
|
37
|
+
|
38
|
+
// ·
|
39
|
+
export const useCalendar = defineStore("driver.calendar", {
|
40
|
+
state: () => {
|
41
|
+
|
42
|
+
return {
|
43
|
+
title: "",
|
44
|
+
calendar: {},
|
45
|
+
|
46
|
+
|
47
|
+
calendarData: {
|
48
|
+
driver_events: [],
|
49
|
+
focus_tasks: [],
|
50
|
+
help_tickets: [],
|
51
|
+
},
|
52
|
+
event_id: '',
|
53
|
+
event: {
|
54
|
+
cloud_driver_catalog_event_types_id: null,
|
55
|
+
title: null,
|
56
|
+
description: '',
|
57
|
+
event_date: new Date(),
|
58
|
+
time_start: null,
|
59
|
+
time_end: null,
|
60
|
+
location: '',
|
61
|
+
url: ''
|
62
|
+
},
|
63
|
+
submit: {
|
64
|
+
event: false,
|
65
|
+
delete: false
|
66
|
+
},
|
67
|
+
lesli: {
|
68
|
+
settings: {
|
69
|
+
currency: {
|
70
|
+
symbol: null
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
},
|
76
|
+
|
77
|
+
actions: {
|
78
|
+
|
79
|
+
setTitle() {
|
80
|
+
|
81
|
+
// if current month show the full date
|
82
|
+
if (this.calendar.getDate().getMonth() == (new Date()).getMonth()) {
|
83
|
+
this.title = this.date2().dateWords().toString()
|
84
|
+
} else {
|
85
|
+
this.title = dayjs(this.calendar.getDate()).locale(I18n.locale).format("MMMM, YYYY")
|
86
|
+
}
|
87
|
+
|
88
|
+
},
|
89
|
+
|
90
|
+
todayMonth() {
|
91
|
+
this.calendar.today()
|
92
|
+
this.setTitle()
|
93
|
+
},
|
94
|
+
|
95
|
+
prevMonth() {
|
96
|
+
this.calendar.prev()
|
97
|
+
this.setTitle()
|
98
|
+
},
|
99
|
+
|
100
|
+
nextMonth() {
|
101
|
+
this.calendar.next()
|
102
|
+
this.setTitle()
|
103
|
+
},
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
onDateClick() {
|
108
|
+
const storeEvent = useEvent()
|
109
|
+
this.reset()
|
110
|
+
storeEvent.showModal = !storeEvent.showModal
|
111
|
+
},
|
112
|
+
|
113
|
+
reset() {
|
114
|
+
const storeUser = useUser()
|
115
|
+
this.event = {
|
116
|
+
organizer_name: storeUser.user.full_name,
|
117
|
+
cloud_driver_catalog_event_types_id: null,
|
118
|
+
title: null,
|
119
|
+
description: '',
|
120
|
+
event_date: new Date(),
|
121
|
+
time_start: null,
|
122
|
+
time_end: null,
|
123
|
+
location: '',
|
124
|
+
url: ''
|
125
|
+
}
|
126
|
+
},
|
127
|
+
|
128
|
+
async getCalendarEvents() {
|
129
|
+
let url = this.url.driver('calendars/default')
|
130
|
+
try {
|
131
|
+
let result = await this.http.get(url);
|
132
|
+
this.calendarData = result;
|
133
|
+
this.calendarData.driver_events.forEach(event => {
|
134
|
+
event.dateStart = event.start
|
135
|
+
event.dateEnd = event.end || null
|
136
|
+
this.calendar.addEvent(event)
|
137
|
+
})
|
138
|
+
this.calendarData.help_tickets.forEach(event => {
|
139
|
+
event.dateStart = event.start
|
140
|
+
event.dateEnd = event.end || null
|
141
|
+
event.engine = "cloud_help"
|
142
|
+
this.calendar.addEvent(event)
|
143
|
+
})
|
144
|
+
} catch (error) {
|
145
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"));
|
146
|
+
}
|
147
|
+
},
|
148
|
+
|
149
|
+
onEventClick: function (arg) {
|
150
|
+
|
151
|
+
if (arg.event._def.extendedProps.engine == "cloud_help") {
|
152
|
+
console.log("redirect to cloud help")
|
153
|
+
return
|
154
|
+
}
|
155
|
+
|
156
|
+
const storeEvent = useEvent()
|
157
|
+
const storeGuests = useGuests()
|
158
|
+
arg.jsEvent.preventDefault()
|
159
|
+
this.event_id = parseInt(arg.event.id)
|
160
|
+
this.http.get(this.url.driver(`events/${this.event_id}`))
|
161
|
+
.then(result => {
|
162
|
+
this.event = result
|
163
|
+
storeEvent.showModal = !storeEvent.showModal
|
164
|
+
storeGuests.getAttendants()
|
165
|
+
storeGuests.getUsers()
|
166
|
+
})
|
167
|
+
|
168
|
+
|
169
|
+
},
|
170
|
+
|
171
|
+
async postEvent(url = this.url.driver('events')) {
|
172
|
+
const storeEvent = useEvent();
|
173
|
+
let data = { event: this.event};
|
174
|
+
this.submit.event = true
|
175
|
+
try {
|
176
|
+
const result = await this.http.post(url, data).then(event => {
|
177
|
+
this.event_id = event.id
|
178
|
+
let newEvent = {
|
179
|
+
...event,
|
180
|
+
date: event.event_date,
|
181
|
+
start: event.time_start,
|
182
|
+
end: event.time_end
|
183
|
+
}
|
184
|
+
this.calendarData.driver_events.push(newEvent);
|
185
|
+
this.calendarData.events.push(newEvent);
|
186
|
+
this.calendar.addEvent(newEvent)
|
187
|
+
});
|
188
|
+
storeEvent.showModal = !storeEvent.showModal;
|
189
|
+
this.msg.success(I18n.t("core.users.messages_success_operation"));
|
190
|
+
} catch (error) {
|
191
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"));
|
192
|
+
} finally {
|
193
|
+
this.submit.event = false
|
194
|
+
}
|
195
|
+
},
|
196
|
+
|
197
|
+
async putEvent(url = this.url.driver(`events/${this.event.id}`)) {
|
198
|
+
const storeEvent = useEvent()
|
199
|
+
let data = { event: this.event }
|
200
|
+
this.submit.event = true
|
201
|
+
try {
|
202
|
+
const result = await this.http.put(url, data)
|
203
|
+
let oldEvent = this.calendar.getEventById(this.event_id)
|
204
|
+
let updatedEvent = {
|
205
|
+
...this.event,
|
206
|
+
date: this.event.event_date,
|
207
|
+
start: this.event.time_start,
|
208
|
+
end: this.event.time_end,
|
209
|
+
}
|
210
|
+
oldEvent.remove()
|
211
|
+
this.calendar.addEvent(updatedEvent)
|
212
|
+
this.msg.success(I18n.t("core.users.messages_success_operation"))
|
213
|
+
storeEvent.showModal = !storeEvent.showModal
|
214
|
+
} catch (error) {
|
215
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
216
|
+
} finally {
|
217
|
+
this.submit.event = false
|
218
|
+
}
|
219
|
+
},
|
220
|
+
|
221
|
+
async deleteEvent() {
|
222
|
+
const storeEvent = useEvent()
|
223
|
+
const { isConfirmed } = await this.dialog.confirmation({
|
224
|
+
title: "Delete event",
|
225
|
+
text: "driver.events.view_text_delete_confirmation",
|
226
|
+
confirmText: I18n.t("core.shared.view_text_yes"),
|
227
|
+
cancelText: I18n.t("core.shared.view_text_no")
|
228
|
+
})
|
229
|
+
|
230
|
+
if (isConfirmed) {
|
231
|
+
try {
|
232
|
+
storeEvent.submit.delete = true
|
233
|
+
const result = await this.http.delete(this.url.driver(`events/${this.event_id}`))
|
234
|
+
let deletedEvent = this.calendar.getEventById(this.event_id)
|
235
|
+
deletedEvent.remove()
|
236
|
+
this.msg.success(I18n.t("core.users.messages_success_operation"))
|
237
|
+
storeEvent.showModal = !storeEvent.showModal
|
238
|
+
} catch (error) {
|
239
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
240
|
+
}
|
241
|
+
}
|
242
|
+
storeEvent.submit.delete = false
|
243
|
+
return { isConfirmed }
|
244
|
+
}
|
245
|
+
}
|
246
|
+
})
|
@@ -0,0 +1,53 @@
|
|
1
|
+
/*
|
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
|
+
// ·
|
21
|
+
import { defineStore } from "pinia"
|
22
|
+
|
23
|
+
// ·
|
24
|
+
export const useEvent = defineStore("driver.event", {
|
25
|
+
state: () => {
|
26
|
+
return {
|
27
|
+
showModal: false,
|
28
|
+
options: {
|
29
|
+
event_types: []
|
30
|
+
},
|
31
|
+
submit: {
|
32
|
+
event: false,
|
33
|
+
delete: false
|
34
|
+
},
|
35
|
+
}
|
36
|
+
},
|
37
|
+
|
38
|
+
actions: {
|
39
|
+
|
40
|
+
getOptions() {
|
41
|
+
let url = this.url.driver('events/options')
|
42
|
+
this.http.get(url).then(result => {
|
43
|
+
if (result) {
|
44
|
+
this.options.event_types = result.event_types.map(option => {
|
45
|
+
return { label: option.text, value: option.value };
|
46
|
+
});
|
47
|
+
}
|
48
|
+
}).catch(error => {
|
49
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
50
|
+
})
|
51
|
+
},
|
52
|
+
}
|
53
|
+
})
|