diff --git a/calendar/src/components/Editor/Properties/PropertySelectAjax.vue b/calendar/src/components/Editor/Properties/PropertySelectAjax.vue index 4c8cefc..aab4f76 100644 --- a/calendar/src/components/Editor/Properties/PropertySelectAjax.vue +++ b/calendar/src/components/Editor/Properties/PropertySelectAjax.vue @@ -95,8 +95,6 @@ export default { values.push({ value: v, label: v }) } else if (result.description) { let v = decode(result.description) - console.log('description orig', result.description) - console.log('description dest', v) values.push({ value: v, label: v }) } else if (result.reference) { let v = decode(result.reference) diff --git a/calendar/src/mixins/EditorMixin.js b/calendar/src/mixins/EditorMixin.js index a558e93..bc938d2 100644 --- a/calendar/src/mixins/EditorMixin.js +++ b/calendar/src/mixins/EditorMixin.js @@ -109,6 +109,15 @@ export default { return this.calendarObjectInstance?.client ?? null }, + /** + * Returns the embalmer(Thanato) or null if the event is still loading + * + * @return {string|null} + */ + embalmer() { + return this.calendarObjectInstance?.embalmer ?? null + }, + /** * Returns the description or null if the event is still loading @@ -333,7 +342,7 @@ export default { * Returns an object with properties from RFCs including * their displayName, a description, options, etc. * - * @return {{geo, color, timeTransparency, description, resources, location, client, categories, accessClass, priority, status, locations, articles, clients}} + * @return {{geo, color, timeTransparency, description, resources, location, client, categories, accessClass, priority, status, locations, articles, clients,embalmer,embalmers}} */ rfcProps() { return getRFCProperties() @@ -487,7 +496,6 @@ export default { * @return {Promise} */ async save(thisAndAllFuture = false) { - console.log("MIDITRA ATO NY SAVE",this.calendarObject); if (!this.calendarObject) { logger.error('Calendar-object not found') return @@ -600,7 +608,6 @@ export default { * @param {string} location New location */ updateLocation(location) { - console.log("updateLocation", location) this.$store.commit('changeLocation', { calendarObjectInstance: this.calendarObjectInstance, location, @@ -619,6 +626,18 @@ export default { }) }, + /** + * Updates the embalmer(Thanatopracteur) of the event + * + * @param {string} embalmer New embalmer + */ + updateEmbalmer(embalmer) { + this.$store.commit('changeEmbalmer', { + calendarObjectInstance: this.calendarObjectInstance, + embalmer, + }) + }, + /** * Updates the start date of this event * diff --git a/calendar/src/models/calendarObject.js b/calendar/src/models/calendarObject.js index 84eb6af..7113df8 100644 --- a/calendar/src/models/calendarObject.js +++ b/calendar/src/models/calendarObject.js @@ -106,7 +106,6 @@ const mapCDavObjectToCalendarObject = (dav, calendarId) => { * @return {object} */ const mapCalendarJsToCalendarObject = (calendarComponent, calendarId = null) => { - console.log("Ary ato mapCalendarJsToCalendarObject"); const vObjectIterator = calendarComponent.getVObjectIterator() const firstVObject = vObjectIterator.next().value if (!firstVObject) { @@ -124,8 +123,30 @@ const mapCalendarJsToCalendarObject = (calendarComponent, calendarId = null) => }) } +const getKeyValueIcsProperty = (key,value) => { + return `${key}:${value}\r\n`; +} + +const setCustomKeyValueToIcsAndReturnIcs = (ics, key,value) => { + const property = getKeyValueIcsProperty(key,value); + ics = ics.replace('END:VEVENT', `${property}END:VEVENT`); + return ics; +} + +const setCustomKeyValuesArrayToIcsAndReturnIcs = (ics, keyValueArray) => { + debugger + for (var key in keyValueArray) { + const value = keyValueArray[key] ? keyValueArray[key] : ''; + ics = setCustomKeyValueToIcsAndReturnIcs(ics, key, value); + } + return ics; +} + export { getDefaultCalendarObjectObject, mapCDavObjectToCalendarObject, mapCalendarJsToCalendarObject, + setCustomKeyValuesArrayToIcsAndReturnIcs, + getKeyValueIcsProperty, + setCustomKeyValueToIcsAndReturnIcs } diff --git a/calendar/src/models/event.js b/calendar/src/models/event.js index c0e1a17..2fead22 100644 --- a/calendar/src/models/event.js +++ b/calendar/src/models/event.js @@ -58,6 +58,8 @@ const getDefaultEventObject = (props = {}) => Object.assign({}, { location: null, //client of the event client : null, + //embalmer(Thanato) of the event + embalmer : null, // description of the event description: null, // Access class of the event (PUBLIC, PRIVATE, CONFIDENTIAL) @@ -105,6 +107,7 @@ const mapEventComponentToEventObject = (eventComponent) => { canModifyAllDay: eventComponent.canModifyAllDay(), location: eventComponent.location, client : eventComponent.client, + embalmer : eventComponent.embalmer, description: eventComponent.description, accessClass: eventComponent.accessClass, status: eventComponent.status, @@ -203,6 +206,7 @@ const copyCalendarObjectInstanceIntoEventComponent = (eventObject, eventComponen eventComponent.title = eventObject.title eventComponent.location = eventObject.location eventComponent.client = eventObject.client + eventComponent.embalmer = eventObject.embalmer eventComponent.description = eventObject.description eventComponent.accessClass = eventObject.accessClass eventComponent.status = eventObject.status diff --git a/calendar/src/models/rfcProps.js b/calendar/src/models/rfcProps.js index 3144cce..855330d 100644 --- a/calendar/src/models/rfcProps.js +++ b/calendar/src/models/rfcProps.js @@ -139,6 +139,23 @@ const getRFCProperties = () => { client: { readableName: t('calendar', 'client'), placeholder: t('calendar', 'Add a client'), + icon: 'User', + }, + + embalmers: { + readableName: t('calendar', 'Embalmers'), + icon: 'User', + searchable: true, + multiple: false, + info: t('calendar', 'Thanatopracteur from Gestion'), + placeholder: t('calendar', 'Choose thanatopracteur'), + tagPlaceholder: t('calendar', 'Choose thanatopracteur'), + options: [], + }, + + embalmer: { + readableName: t('calendar', 'Embalmer'), + placeholder: t('calendar', 'Add a thanatopracteur'), icon: 'MapMarker', }, diff --git a/calendar/src/store/calendarObjectInstance.js b/calendar/src/store/calendarObjectInstance.js index 76ef030..4c9330a 100644 --- a/calendar/src/store/calendarObjectInstance.js +++ b/calendar/src/store/calendarObjectInstance.js @@ -321,12 +321,34 @@ const mutations = { calendarObjectInstance.location = location }, + /** + * Change the client of an event + * + * @param {object} state The Vuex state + * @param {object} data The destructuring object + * @param {object} data.calendarObjectInstance The calendarObjectInstance object + * @param {string} data.client New client to set + */ + changeClient(state, { calendarObjectInstance, client }) { - console.log("CHANGE CLIENT STORE", client); calendarObjectInstance.eventComponent.client = client calendarObjectInstance.client = client }, + /** + * Change the embalmer (Thanato) of an event + * + * @param {object} state The Vuex state + * @param {object} data The destructuring object + * @param {object} data.calendarObjectInstance The calendarObjectInstance object + * @param {string} data.embalmer New embalmer to set + */ + + changeEmbalmer(state, { calendarObjectInstance, embalmer }) { + calendarObjectInstance.eventComponent.embalmer = embalmer + calendarObjectInstance.embalmer = embalmer + }, + /** * Change the description of an event * @@ -1663,9 +1685,6 @@ const actions = { const eventComponent = state.calendarObjectInstance.eventComponent const calendarObject = state.calendarObject debugger - console.log("EVENNNNNNNTTT COMPONENTTTTT", eventComponent); - - console.log("CALEEEEENNNDDDARRRR OBJEEEEEEEECCCCC TTTTTTT",calendarObject); updateAlarms(eventComponent) updateTalkParticipants(eventComponent) @@ -1693,7 +1712,6 @@ const actions = { } if (calendarId !== state.calendarObject.calendarId) { - console.log("MIDITRA ATO AMIN NY MOVE CALENDAR"); await dispatch('moveCalendarObject', { calendarObject, newCalendarId: calendarId, diff --git a/calendar/src/store/calendarObjects.js b/calendar/src/store/calendarObjects.js index de40eb2..2d0e043 100644 --- a/calendar/src/store/calendarObjects.js +++ b/calendar/src/store/calendarObjects.js @@ -24,7 +24,7 @@ * */ import Vue from 'vue' -import { mapCalendarJsToCalendarObject } from '../models/calendarObject.js' +import { mapCalendarJsToCalendarObject, setClientValueToIcsAndReturnIcs, setCustomKeyValuesArrayToIcsAndReturnIcs } from '../models/calendarObject.js' import logger from '../utils/logger.js' import { createEvent, @@ -224,23 +224,26 @@ const actions = { * @return {Promise} */ async updateCalendarObject(context, { calendarObject }) { + debugger + let eventComponent = calendarObject.calendarComponent.getFirstComponent('VEVENT'); if (calendarObject.existsOnServer) { calendarObject.dav.data = calendarObject.calendarComponent.toICS() await calendarObject.dav.update() - context.commit('addCalendarObjectIdToAllTimeRangesOfCalendar', { calendarId: calendarObject.calendarId, calendarObjectId: calendarObject.id, }) context.commit('incrementModificationCount') - return - // TODO - catch conflicts } - const calendar = context.getters.getCalendarById(calendarObject.calendarId) - calendarObject.dav = await calendar.dav.createVObject(calendarObject.calendarComponent.toICS()) + let icsValue = calendarObject.calendarComponent.toICS(); + if(eventComponent != null){ + const customKeyValue = {"CLIENT": eventComponent.client, "EMBALMER": eventComponent.embalmer}; + icsValue = setCustomKeyValuesArrayToIcsAndReturnIcs(icsValue,customKeyValue); + } + calendarObject.dav = await calendar.dav.createVObject(icsValue); calendarObject.existsOnServer = true context.commit('updateCalendarObjectId', { calendarObject }) diff --git a/calendar/src/views/Calendar.vue b/calendar/src/views/Calendar.vue index 7476e72..112a13e 100644 --- a/calendar/src/views/Calendar.vue +++ b/calendar/src/views/Calendar.vue @@ -32,6 +32,7 @@ + diff --git a/calendar/src/views/EditSidebar.vue b/calendar/src/views/EditSidebar.vue index 3a23865..fbac41c 100644 --- a/calendar/src/views/EditSidebar.vue +++ b/calendar/src/views/EditSidebar.vue @@ -254,22 +254,13 @@ -
- -
- + 'page#ajaxGetArticles', 'url' => '/ajaxGetArticles', 'verb' => 'GET'], ['name' => 'page#ajaxGetProduits', 'url' => '/ajaxGetProduits', 'verb' => 'GET'], ['name' => 'page#ajaxGetClientsName', 'url' => '/ajaxGetClientsName', 'verb' => 'GET'], + ['name' => 'page#ajaxGetThanatopracteurs', 'url' => '/ajaxGetThanatopracteurs', 'verb' => 'GET'], + ['name' => 'page#getLieux', 'url' => '/getLieux', 'verb' => 'PROPFIND'], ['name' => 'page#insertLieu', 'url' => '/lieu/insert', 'verb' => 'POST'], diff --git a/gestion/lib/Controller/PageController.php b/gestion/lib/Controller/PageController.php index 32cf311..bc93052 100644 --- a/gestion/lib/Controller/PageController.php +++ b/gestion/lib/Controller/PageController.php @@ -379,6 +379,14 @@ class PageController extends Controller { return $this->myDb->getThanatopracteurs($this->idNextcloud); } + /** + * @NoAdminRequired + * @NoCSRFRequired + */ + public function ajaxGetThanatopracteurs() { + return $this->myDb->getThanatopracteurs($this->idNextcloud); + } + /** * @NoAdminRequired * @NoCSRFRequired