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