congé+repos+arrat-maladie : OK
This commit is contained in:
parent
b6f363829e
commit
b6a3a3a55b
@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="property-select">
|
<div class="property-select">
|
||||||
<div class="property-select__input">
|
<div class="property-select__input"
|
||||||
|
:class="{ 'property-select__input--readonly': isReadOnly }">
|
||||||
<NcSelect v-if="!isReadOnly"
|
<NcSelect v-if="!isReadOnly"
|
||||||
:options="options"
|
:options="options"
|
||||||
:searchable="true"
|
:searchable="true"
|
||||||
@ -8,7 +9,8 @@
|
|||||||
:taggable="false"
|
:taggable="false"
|
||||||
:name="readableName"
|
:name="readableName"
|
||||||
:value="selectedValue"
|
:value="selectedValue"
|
||||||
:clearable="false"
|
:placeholder="placeholder"
|
||||||
|
:clearable="true"
|
||||||
:labelOutside="true"
|
:labelOutside="true"
|
||||||
input-id="value"
|
input-id="value"
|
||||||
label="label"
|
label="label"
|
||||||
@ -20,52 +22,42 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { NcSelect } from '@nextcloud/vue';
|
import { NcSelect } from '@nextcloud/vue';
|
||||||
|
import PropertyMixin from '../../../mixins/PropertyMixin.js'
|
||||||
export default {
|
export default {
|
||||||
name: 'PropertySelectAbsenceType',
|
name: 'PropertySelectAbsenceType',
|
||||||
components: {
|
components: {
|
||||||
NcSelect,
|
NcSelect,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
value: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: 'conge',
|
|
||||||
},
|
|
||||||
isReadOnly: {
|
isReadOnly: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false, // Par défaut, on permet la modification
|
default: false, // Par défaut, on permet la modification
|
||||||
},
|
}
|
||||||
hasInfo: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
info: {
|
|
||||||
type: String,
|
|
||||||
default: 'Sélectionnez un type d\'absence pour le projet',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
properties: [
|
properties: [
|
||||||
{ value: 'conge', label: 'Congé' },
|
{ value: 'LEAVE', label: 'Congé' },
|
||||||
{ value: 'repos', label: 'Repos' },
|
{ value: 'REST', label: 'Repos' },
|
||||||
{ value: 'maladie', label: 'Maladie' },
|
{ value: 'DISEASE', label: 'Maladie' },
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
mixins: [
|
||||||
|
PropertyMixin,
|
||||||
|
],
|
||||||
computed: {
|
computed: {
|
||||||
options() {
|
options() {
|
||||||
return this.properties;
|
return this.properties;
|
||||||
},
|
},
|
||||||
selectedValue() {
|
selectedValue() {
|
||||||
return this.properties.find(option => option.value === this.value) || null;
|
const value = this.value
|
||||||
|
return this.properties.find((option) => option.value == value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeValue(selectedOption) {
|
changeValue(selectedOption) {
|
||||||
if (selectedOption) {
|
this.$emit('update:value', selectedOption.value ?? null);
|
||||||
this.$emit('update:value', selectedOption.value);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -75,13 +75,13 @@
|
|||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="!isReadOnly" class="property-title-time-picker__all-day">
|
<!-- <div v-if="!isReadOnly" class="property-title-time-picker__all-day">
|
||||||
<NcCheckboxRadioSwitch :checked="isAllDay"
|
<NcCheckboxRadioSwitch :checked="isAllDay"
|
||||||
:disabled="!canModifyAllDay"
|
:disabled="!canModifyAllDay"
|
||||||
@update:checked="toggleAllDay">
|
@update:checked="toggleAllDay">
|
||||||
{{ $t('calendar', 'All day') }}
|
{{ $t('calendar', 'All day') }}
|
||||||
</NcCheckboxRadioSwitch>
|
</NcCheckboxRadioSwitch>
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@ -360,7 +360,7 @@ export default {
|
|||||||
* Returns an object with properties from RFCs including
|
* Returns an object with properties from RFCs including
|
||||||
* their displayName, a description, options, etc.
|
* their displayName, a description, options, etc.
|
||||||
*
|
*
|
||||||
* @return {{comment, geo, color, timeTransparency, description, resources, location, client, categories, accessClass, priority, status, locations, articles, clients,embalmer,embalmers}}
|
* @return {{absenceType, comment, geo, color, timeTransparency, description, resources, location, client, categories, accessClass, priority, status, locations, articles, clients,embalmer,embalmers}}
|
||||||
*/
|
*/
|
||||||
rfcProps() {
|
rfcProps() {
|
||||||
return getRFCProperties()
|
return getRFCProperties()
|
||||||
@ -419,7 +419,7 @@ export default {
|
|||||||
* @return {string|null}
|
* @return {string|null}
|
||||||
*/
|
*/
|
||||||
absenceType() {
|
absenceType() {
|
||||||
return this.calendarObjectInstance?.absenceType ?? 'conge'
|
return this.calendarObjectInstance?.absenceType ?? ''
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -786,14 +786,10 @@ export default {
|
|||||||
* @param {string} absenceType New absence type
|
* @param {string} absenceType New absence type
|
||||||
*/
|
*/
|
||||||
updateAbsenceType(absenceType) {
|
updateAbsenceType(absenceType) {
|
||||||
if (!absenceType) {
|
this.$store.commit('changeAbsenceType', {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$store.dispatch('changeAbsenceType', {
|
|
||||||
calendarObjectInstance: this.calendarObjectInstance,
|
calendarObjectInstance: this.calendarObjectInstance,
|
||||||
absenceType,
|
absenceType,
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@ -60,6 +60,8 @@ const getDefaultEventObject = (props = {}) => Object.assign({}, {
|
|||||||
client : null,
|
client : null,
|
||||||
//embalmer(Thanato) of the event
|
//embalmer(Thanato) of the event
|
||||||
embalmer : null,
|
embalmer : null,
|
||||||
|
//absenceType
|
||||||
|
absenceType : null,
|
||||||
//Private
|
//Private
|
||||||
isPrivate: false,
|
isPrivate: false,
|
||||||
//comment of the event
|
//comment of the event
|
||||||
@ -114,6 +116,7 @@ const mapEventComponentToEventObject = (eventComponent) => {
|
|||||||
client : "CLIENT",
|
client : "CLIENT",
|
||||||
embalmer : "TEST",
|
embalmer : "TEST",
|
||||||
comment : "",
|
comment : "",
|
||||||
|
absenceType : "",
|
||||||
description: eventComponent.description,
|
description: eventComponent.description,
|
||||||
accessClass: eventComponent.accessClass,
|
accessClass: eventComponent.accessClass,
|
||||||
status: eventComponent.status,
|
status: eventComponent.status,
|
||||||
@ -215,6 +218,10 @@ const mapEventComponentToEventObject = (eventComponent) => {
|
|||||||
eventObject.comment = eventComponent.getFirstPropertyFirstValue('COMMENT');
|
eventObject.comment = eventComponent.getFirstPropertyFirstValue('COMMENT');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(eventComponent.hasProperty('ABSENCETYPE')){
|
||||||
|
eventObject.absenceType = eventComponent.getFirstPropertyFirstValue('ABSENCETYPE');
|
||||||
|
}
|
||||||
|
|
||||||
return eventObject;
|
return eventObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -141,6 +141,10 @@ const getRFCProperties = () => {
|
|||||||
placeholder: t('calendar', 'Choisir un client'),
|
placeholder: t('calendar', 'Choisir un client'),
|
||||||
icon: 'Human',
|
icon: 'Human',
|
||||||
},
|
},
|
||||||
|
absenceType: {
|
||||||
|
readableName: t('calendar', 'Type d\'absence'),
|
||||||
|
placeholder: t('calendar', 'Type d\'absence'),
|
||||||
|
},
|
||||||
|
|
||||||
embalmers: {
|
embalmers: {
|
||||||
readableName: t('calendar', 'Embalmers'),
|
readableName: t('calendar', 'Embalmers'),
|
||||||
|
|||||||
@ -377,6 +377,44 @@ const mutations = {
|
|||||||
calendarObjectInstance.embalmer = embalmer
|
calendarObjectInstance.embalmer = embalmer
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the absence type 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
changeAbsenceType(state, { calendarObjectInstance, absenceType }) {
|
||||||
|
calendarObjectInstance.eventComponent.absenceType = absenceType ?? null
|
||||||
|
calendarObjectInstance.absenceType = absenceType ?? null
|
||||||
|
if(absenceType){
|
||||||
|
const types = [
|
||||||
|
{ value: 'LEAVE', label: 'Congé' },
|
||||||
|
{ value: 'REST', label: 'Repos' },
|
||||||
|
{ value: 'DISEASE', label: 'Arret maladie' },
|
||||||
|
];
|
||||||
|
|
||||||
|
types.forEach((element) => {
|
||||||
|
if(element.value == absenceType){
|
||||||
|
calendarObjectInstance.title = element.label
|
||||||
|
calendarObjectInstance.eventComponent.title = element.label
|
||||||
|
|
||||||
|
if(absenceType == 'LEAVE'){
|
||||||
|
const startDate = calendarObjectInstance.eventComponent.startDate
|
||||||
|
const endDate = calendarObjectInstance.eventComponent.endDate
|
||||||
|
|
||||||
|
startDate.hour = 8 ; endDate.hour = 17
|
||||||
|
|
||||||
|
calendarObjectInstance.startDate = getDateFromDateTimeValue(startDate)
|
||||||
|
calendarObjectInstance.endDate = getDateFromDateTimeValue(endDate)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the description of an event
|
* Change the description of an event
|
||||||
*
|
*
|
||||||
@ -1723,6 +1761,7 @@ const actions = {
|
|||||||
let additionalFieldWasUpdated =
|
let additionalFieldWasUpdated =
|
||||||
eventComponent.client != null ||
|
eventComponent.client != null ||
|
||||||
eventComponent.isPrivate != null ||
|
eventComponent.isPrivate != null ||
|
||||||
|
eventComponent.absenceType ||
|
||||||
eventComponent.comment != null ;
|
eventComponent.comment != null ;
|
||||||
if (eventComponent.isDirty() || additionalFieldWasUpdated) {
|
if (eventComponent.isDirty() || additionalFieldWasUpdated) {
|
||||||
const isForkedItem = eventComponent.primaryItem !== null
|
const isForkedItem = eventComponent.primaryItem !== null
|
||||||
@ -2143,13 +2182,13 @@ const actions = {
|
|||||||
commit('changeTimeToDefaultForTimedEvents', { calendarObjectInstance })
|
commit('changeTimeToDefaultForTimedEvents', { calendarObjectInstance })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async changeAbsenceType({ commit }, { calendarObjectInstance, absenceType }) {
|
// async changeAbsenceType({ commit }, { calendarObjectInstance, absenceType }) {
|
||||||
try {
|
// try {
|
||||||
commit('setAbsenceType', { calendarObjectInstance, absenceType });
|
// commit('setAbsenceType', { calendarObjectInstance, absenceType });
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
console.error('Erreur lors de la mise à jour du type d\'absence:', error);
|
// console.error('Erreur lors de la mise à jour du type d\'absence:', error);
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -273,6 +273,20 @@ const actions = {
|
|||||||
icsValue = setCustomKeyValuesArrayToIcsAndReturnIcs(icsValue,customKeyValue);
|
icsValue = setCustomKeyValuesArrayToIcsAndReturnIcs(icsValue,customKeyValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(eventComponent.absenceType != null && eventComponent.absenceType != ''){
|
||||||
|
let absenceTypeValue = eventComponent.absenceType;
|
||||||
|
let key = "ABSENCETYPE:"+absenceTypeValue;
|
||||||
|
let regex = /^ABSENCETYPE:.*$/m;
|
||||||
|
if(regex.test(icsValue)){
|
||||||
|
icsValue = icsValue.replace(regex, key);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
const customKeyValue = {
|
||||||
|
"ABSENCETYPE": absenceTypeValue
|
||||||
|
};
|
||||||
|
icsValue = setCustomKeyValuesArrayToIcsAndReturnIcs(icsValue,customKeyValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
calendarObject.dav.data = icsValue;
|
calendarObject.dav.data = icsValue;
|
||||||
@ -293,7 +307,8 @@ const actions = {
|
|||||||
"CLIENT": eventComponent.client,
|
"CLIENT": eventComponent.client,
|
||||||
"EMBALMER": eventComponent.embalmer ,
|
"EMBALMER": eventComponent.embalmer ,
|
||||||
"ISPRIVATE": eventComponent.isPrivate ? "1" : "0",
|
"ISPRIVATE": eventComponent.isPrivate ? "1" : "0",
|
||||||
"COMMENT": eventComponent.comment
|
"COMMENT": eventComponent.comment,
|
||||||
|
"ABSENCETYPE": eventComponent.absenceType ?? ''
|
||||||
};
|
};
|
||||||
icsValue = setCustomKeyValuesArrayToIcsAndReturnIcs(icsValue,customKeyValue);
|
icsValue = setCustomKeyValuesArrayToIcsAndReturnIcs(icsValue,customKeyValue);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,11 +103,26 @@
|
|||||||
@update-end-timezone="updateEndTimezone"
|
@update-end-timezone="updateEndTimezone"
|
||||||
@toggle-all-day="toggleAllDay" />
|
@toggle-all-day="toggleAllDay" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div style='display:flex ;margin-left: 8px;'>
|
||||||
|
<div style='width:70%'>
|
||||||
|
<PropertySelectAbsenceType
|
||||||
|
:value="absenceType"
|
||||||
|
:is-read-only="isReadOnly"
|
||||||
|
:prop-model="rfcProps.absenceType"
|
||||||
|
:noWrap='true'
|
||||||
|
@update:value="updateAbsenceType" />
|
||||||
|
</div>
|
||||||
|
<div style='width:30% ;margin-top: -11px;'>
|
||||||
<PropertyIsPrivate
|
<PropertyIsPrivate
|
||||||
:is-read-only="isReadOnly"
|
:is-read-only="isReadOnly"
|
||||||
:is-private="isPrivate"
|
:is-private="isPrivate"
|
||||||
@toggle-is-private="toggleIsPrivate"
|
@toggle-is-private="toggleIsPrivate"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<PropertySelectClient class="property-location"
|
<PropertySelectClient class="property-location"
|
||||||
url="/apps/gestion/ajaxGetClientsName"
|
url="/apps/gestion/ajaxGetClientsName"
|
||||||
@ -361,6 +376,7 @@ import PropertySelectLieu from "../components/Editor/Properties/PropertySelectLi
|
|||||||
import PropertySelectClient from "../components/Editor/Properties/PropertySelectClient.vue";
|
import PropertySelectClient from "../components/Editor/Properties/PropertySelectClient.vue";
|
||||||
import PropertySelectArticle from "../components/Editor/Properties/PropertySelectArticle.vue";
|
import PropertySelectArticle from "../components/Editor/Properties/PropertySelectArticle.vue";
|
||||||
import PropertyIsPrivate from "../components/Editor/Properties/PropertyIsPrivate.vue";
|
import PropertyIsPrivate from "../components/Editor/Properties/PropertyIsPrivate.vue";
|
||||||
|
import PropertySelectAbsenceType from "../components/Editor/Properties/PropertySelectAbsenceType.vue";
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -402,6 +418,7 @@ export default {
|
|||||||
AttachmentsList,
|
AttachmentsList,
|
||||||
CalendarPickerHeader,
|
CalendarPickerHeader,
|
||||||
PropertyTitle,
|
PropertyTitle,
|
||||||
|
PropertySelectAbsenceType
|
||||||
},
|
},
|
||||||
mixins: [
|
mixins: [
|
||||||
EditorMixin,
|
EditorMixin,
|
||||||
|
|||||||
@ -107,11 +107,6 @@
|
|||||||
:is-read-only="isReadOnlyOrViewing"
|
:is-read-only="isReadOnlyOrViewing"
|
||||||
@update:value="updateTitle" />
|
@update:value="updateTitle" />
|
||||||
|
|
||||||
<PropertySelectAbsenceType :value="absenceType"
|
|
||||||
:hasInfo="true"
|
|
||||||
:info="'Sélectionnez un type d\'absence pour le projet'"
|
|
||||||
@update:value="updateAbsenceType" />
|
|
||||||
|
|
||||||
<PropertyTitleTimePicker :start-date="startDate"
|
<PropertyTitleTimePicker :start-date="startDate"
|
||||||
:start-timezone="startTimezone"
|
:start-timezone="startTimezone"
|
||||||
:end-date="endDate"
|
:end-date="endDate"
|
||||||
@ -126,11 +121,27 @@
|
|||||||
@update-end-timezone="updateEndTimezone"
|
@update-end-timezone="updateEndTimezone"
|
||||||
@toggle-all-day="toggleAllDay" />
|
@toggle-all-day="toggleAllDay" />
|
||||||
|
|
||||||
|
|
||||||
|
<div style='display:flex ;margin-left: 7%;'>
|
||||||
|
<div style='width:70%'>
|
||||||
|
<PropertySelectAbsenceType
|
||||||
|
:value="absenceType"
|
||||||
|
:is-read-only="isReadOnly"
|
||||||
|
:prop-model="rfcProps.absenceType"
|
||||||
|
:noWrap='true'
|
||||||
|
@update:value="updateAbsenceType" />
|
||||||
|
</div>
|
||||||
|
<div style='width:30% ;margin-top: -11px;'>
|
||||||
<PropertyIsPrivate
|
<PropertyIsPrivate
|
||||||
:is-read-only="isReadOnly"
|
:is-read-only="isReadOnly"
|
||||||
:is-private="isPrivate"
|
:is-private="isPrivate"
|
||||||
@toggle-is-private="toggleIsPrivate"
|
@toggle-is-private="toggleIsPrivate"/>
|
||||||
/>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<PropertySelectClient class="property-location"
|
<PropertySelectClient class="property-location"
|
||||||
url="/apps/gestion/ajaxGetClientsName"
|
url="/apps/gestion/ajaxGetClientsName"
|
||||||
|
|||||||
@ -9,7 +9,7 @@ use Exception;
|
|||||||
class VCalendarHelpers
|
class VCalendarHelpers
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function GetValueFromKeyInVCalendarString(string $key, string $vCalendarString): string
|
public static function GetValueFromKeyInVCalendarString(string $key, string $vCalendarString , ): string
|
||||||
{
|
{
|
||||||
$value = "";
|
$value = "";
|
||||||
preg_match("/$key:(.*)\r\n/", $vCalendarString, $matches);
|
preg_match("/$key:(.*)\r\n/", $vCalendarString, $matches);
|
||||||
|
|||||||
@ -209,7 +209,8 @@ class GestionService {
|
|||||||
try{
|
try{
|
||||||
|
|
||||||
$isPrivate = $this->GetIsPivateFromVCalendarString($vCalendarString);
|
$isPrivate = $this->GetIsPivateFromVCalendarString($vCalendarString);
|
||||||
if($isPrivate){
|
$absenceType = VCalendarHelpers::GetValueFromKeyInVCalendarString('ABSENCETYPE',$vCalendarString);
|
||||||
|
if($isPrivate || $absenceType){
|
||||||
//Nothing to do manage fo a private calendar
|
//Nothing to do manage fo a private calendar
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -412,10 +413,12 @@ class GestionService {
|
|||||||
public function HandleUpdatedCalendarObject(string $vCalendarString , $cookie){
|
public function HandleUpdatedCalendarObject(string $vCalendarString , $cookie){
|
||||||
try{
|
try{
|
||||||
$isPrivate = $this->GetIsPivateFromVCalendarString($vCalendarString);
|
$isPrivate = $this->GetIsPivateFromVCalendarString($vCalendarString);
|
||||||
if($isPrivate){
|
$absenceType = VCalendarHelpers::GetValueFromKeyInVCalendarString('ABSENCETYPE',$vCalendarString);
|
||||||
|
if($isPrivate || $absenceType){
|
||||||
//Nothing to do manage fo a private calendar
|
//Nothing to do manage fo a private calendar
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
||||||
$devis = $this->gestionBdd->getDevisByCalendarUuid($calendarUuid);
|
$devis = $this->gestionBdd->getDevisByCalendarUuid($calendarUuid);
|
||||||
if($devis != null){
|
if($devis != null){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user