fix calendar input to send id from client and location, and reference from article

This commit is contained in:
Tiavina 2024-12-31 13:01:42 +03:00
parent 8c2a9017cf
commit d10152649a
59 changed files with 2437 additions and 84 deletions

View File

@ -164570,7 +164570,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"compressed":true,"categories":[{"id"
/******/ // This function allow to reference async chunks
/******/ __webpack_require__.u = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return "calendar-" + chunkId + ".js?v=" + {"vendors-node_modules_nextcloud_capabilities_dist_index_js-node_modules_nextcloud_vue-select_d-877981":"3533c597c61a45709c85","vendors-node_modules_vue-material-design-icons_CalendarBlank_vue-node_modules_vue-material-de-e2c1f8":"aa18371467d4d17269b3","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"6c303f18660c1428dc28","node_modules_nextcloud_dialogs_dist_legacy_mjs":"8be838e4c6e9aae56c87","vendors-node_modules_webdav_dist_web_index_js":"454da8f908d41b47c607","vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-8ibBgPg__mjs":"ea54a36450de178d1141"}[chunkId] + "";
/******/ return "calendar-" + chunkId + ".js?v=" + {"vendors-node_modules_nextcloud_capabilities_dist_index_js-node_modules_nextcloud_vue-select_d-877981":"b70c315d43924cf28e02","vendors-node_modules_vue-material-design-icons_CalendarBlank_vue-node_modules_vue-material-de-e2c1f8":"290f7a6dcecead54b4db","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"57f3e24b6f63561c43e0","node_modules_nextcloud_dialogs_dist_legacy_mjs":"8be838e4c6e9aae56c87","vendors-node_modules_webdav_dist_web_index_js":"454da8f908d41b47c607","vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-8ibBgPg__mjs":"ea54a36450de178d1141"}[chunkId] + "";
/******/ };
/******/ })();
/******/
@ -164827,4 +164827,4 @@ const visitorInfo = (0,_nextcloud_initial_state__WEBPACK_IMPORTED_MODULE_1__.loa
/******/ })()
;
//# sourceMappingURL=calendar-appointments-booking.js.map?v=3b392047fd2d6b19f965
//# sourceMappingURL=calendar-appointments-booking.js.map?v=33645c11c83fb0efebcb

File diff suppressed because one or more lines are too long

View File

@ -37516,4 +37516,4 @@ const booking = (0,_nextcloud_initial_state__WEBPACK_IMPORTED_MODULE_1__.loadSta
/******/ })()
;
//# sourceMappingURL=calendar-appointments-confirmation.js.map?v=a568b091a90b74e53b2f
//# sourceMappingURL=calendar-appointments-confirmation.js.map?v=7972917bd202ca1f10b9

File diff suppressed because one or more lines are too long

View File

@ -37552,4 +37552,4 @@ const booking = (0,_nextcloud_initial_state__WEBPACK_IMPORTED_MODULE_1__.loadSta
/******/ })()
;
//# sourceMappingURL=calendar-appointments-conflict.js.map?v=a4d9e55753dbd82cbb68
//# sourceMappingURL=calendar-appointments-conflict.js.map?v=5598f906629cead96b94

File diff suppressed because one or more lines are too long

View File

@ -160605,4 +160605,4 @@ vue__WEBPACK_IMPORTED_MODULE_5__["default"].prototype.$n = _nextcloud_l10n__WEBP
/******/ })()
;
//# sourceMappingURL=calendar-appointments-overview.js.map?v=76965549ab6ab40d3988
//# sourceMappingURL=calendar-appointments-overview.js.map?v=083cf88f751169dcba78

File diff suppressed because one or more lines are too long

View File

@ -500,4 +500,4 @@ if(false) {}
/***/ })
}]);
//# sourceMappingURL=calendar-dashboard-lazy.js.map?v=c10558ce90cd32800f78
//# sourceMappingURL=calendar-dashboard-lazy.js.map?v=173cc8b933d97acb8d15

File diff suppressed because one or more lines are too long

View File

@ -1322,7 +1322,7 @@ function b(n) {
/******/ // This function allow to reference async chunks
/******/ __webpack_require__.u = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return "calendar-" + chunkId + ".js?v=" + {"vendors-node_modules_nextcloud_capabilities_dist_index_js-node_modules_nextcloud_vue-select_d-877981":"3533c597c61a45709c85","vendors-node_modules_vue_dist_vue_runtime_esm_js":"7e3171593bdc0f62040b","vendors-node_modules_nextcloud_cdav-library_dist_dist_js-node_modules_nextcloud_logger_dist_i-36c16b":"c3b3db23da041c717fc1","vendors-node_modules_webdav_dist_web_index_js":"454da8f908d41b47c607","vendors-node_modules_vue-material-design-icons_CalendarBlankOutline_vue-node_modules_nextclou-4adead":"e4ffc04ac1c7ab0c5950","vendors-node_modules_nextcloud_vue-dashboard_dist_vue-dashboard_js-node_modules_css-loader_di-9e6f3d":"6717f0bb504201e731c9","src_models_rfcProps_js-src_services_caldavService_js-src_services_talkService_js-src_services-8a2790":"76fe084ed502c638c2e4","src_store_index_js":"35fe7fb5d199fb22a689","src_fullcalendar_eventSources_eventSourceFunction_js-src_utils_moment_js-data_image_svg_xml_3-b73258":"740a2859d1f364b508c1","dashboard-lazy":"c10558ce90cd32800f78","vendors-node_modules_vue-material-design-icons_CalendarBlank_vue-node_modules_vue-material-de-e2c1f8":"aa18371467d4d17269b3","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"6c303f18660c1428dc28","node_modules_nextcloud_dialogs_dist_legacy_mjs":"8be838e4c6e9aae56c87","vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-8ibBgPg__mjs":"ea54a36450de178d1141","vendors-node_modules_moment_locale_af_js-node_modules_moment_locale_ar-dz_js-node_modules_mom-582c96":"ce1bed825f57dd1d117a","node_modules_moment_locale_sync_recursive_":"4bc2c39c5e0ff182c2e3"}[chunkId] + "";
/******/ return "calendar-" + chunkId + ".js?v=" + {"vendors-node_modules_nextcloud_capabilities_dist_index_js-node_modules_nextcloud_vue-select_d-877981":"b70c315d43924cf28e02","vendors-node_modules_vue_dist_vue_runtime_esm_js":"7e3171593bdc0f62040b","vendors-node_modules_nextcloud_cdav-library_dist_dist_js-node_modules_nextcloud_logger_dist_i-36c16b":"c3b3db23da041c717fc1","vendors-node_modules_webdav_dist_web_index_js":"454da8f908d41b47c607","vendors-node_modules_vue-material-design-icons_CalendarBlankOutline_vue-node_modules_nextclou-4adead":"a05d4be7db8074129155","vendors-node_modules_nextcloud_vue-dashboard_dist_vue-dashboard_js-node_modules_css-loader_di-9e6f3d":"ce406a3daa36b3f00bbd","src_models_rfcProps_js-src_services_caldavService_js-src_services_talkService_js-src_services-8a2790":"76fe084ed502c638c2e4","src_store_index_js":"35fe7fb5d199fb22a689","src_fullcalendar_eventSources_eventSourceFunction_js-src_utils_moment_js-data_image_svg_xml_3-b73258":"740a2859d1f364b508c1","dashboard-lazy":"173cc8b933d97acb8d15","vendors-node_modules_vue-material-design-icons_CalendarBlank_vue-node_modules_vue-material-de-e2c1f8":"290f7a6dcecead54b4db","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"57f3e24b6f63561c43e0","node_modules_nextcloud_dialogs_dist_legacy_mjs":"8be838e4c6e9aae56c87","vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-8ibBgPg__mjs":"ea54a36450de178d1141","vendors-node_modules_moment_locale_af_js-node_modules_moment_locale_ar-dz_js-node_modules_mom-582c96":"ce1bed825f57dd1d117a","node_modules_moment_locale_sync_recursive_":"4bc2c39c5e0ff182c2e3"}[chunkId] + "";
/******/ };
/******/ })();
/******/
@ -1580,4 +1580,4 @@ document.addEventListener('DOMContentLoaded', function () {
/******/ })()
;
//# sourceMappingURL=calendar-dashboard.js.map?v=7ca80985f24d1eef7d61
//# sourceMappingURL=calendar-dashboard.js.map?v=5b9dabfc5787978f7822

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -369,4 +369,4 @@ module.exports = /*#__PURE__*/JSON.parse('[{"country":"Algeria","filename":"Alge
/***/ })
}]);
//# sourceMappingURL=calendar-public-calendar-subscription-picker.js.map?v=4c85129ecec907c712f8
//# sourceMappingURL=calendar-public-calendar-subscription-picker.js.map?v=3abddc6cf2aada41095d

File diff suppressed because one or more lines are too long

View File

@ -8865,7 +8865,7 @@ window._registerCustomPickerElement = _;
/******/ // This function allow to reference async chunks
/******/ __webpack_require__.u = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return "calendar-" + chunkId + ".js?v=" + {"vendors-node_modules_vue_dist_vue_runtime_esm_js":"7e3171593bdc0f62040b","vendors-node_modules_nextcloud_capabilities_dist_index_js-node_modules_nextcloud_vue-select_d-877981":"3533c597c61a45709c85","vendors-node_modules_nextcloud_cdav-library_dist_dist_js-node_modules_nextcloud_logger_dist_i-36c16b":"c3b3db23da041c717fc1","vendors-node_modules_vue-material-design-icons_CalendarBlank_vue-node_modules_vue-material-de-e2c1f8":"aa18371467d4d17269b3","vendors-node_modules_vue-material-design-icons_CalendarBlankOutline_vue-node_modules_nextclou-4adead":"e4ffc04ac1c7ab0c5950","vendors-node_modules_autosize_dist_autosize_esm_js-node_modules_html-entities_lib_index_js-no-4072c5":"60939d15b29e9da9693b","src_models_rfcProps_js-src_services_caldavService_js-src_services_talkService_js-src_services-8a2790":"76fe084ed502c638c2e4","src_fullcalendar_eventSources_eventSourceFunction_js-src_utils_moment_js-data_image_svg_xml_3-b73258":"740a2859d1f364b508c1","src_views_Calendar_vue-data_image_svg_xml_3csvg_20xmlns_27http_www_w3_org_2000_svg_27_20heigh-4a4254":"c0345fc5d36ec858deb6","vendors-node_modules_webdav_dist_web_index_js":"454da8f908d41b47c607","src_store_index_js":"35fe7fb5d199fb22a689","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"6c303f18660c1428dc28","node_modules_nextcloud_dialogs_dist_legacy_mjs":"8be838e4c6e9aae56c87","vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-8ibBgPg__mjs":"ea54a36450de178d1141","public-calendar-subscription-picker":"4c85129ecec907c712f8","vendors-node_modules_moment_locale_af_js-node_modules_moment_locale_ar-dz_js-node_modules_mom-582c96":"ce1bed825f57dd1d117a","node_modules_moment_locale_sync_recursive_":"4bc2c39c5e0ff182c2e3"}[chunkId] + "";
/******/ return "calendar-" + chunkId + ".js?v=" + {"vendors-node_modules_vue_dist_vue_runtime_esm_js":"7e3171593bdc0f62040b","vendors-node_modules_nextcloud_capabilities_dist_index_js-node_modules_nextcloud_vue-select_d-877981":"b70c315d43924cf28e02","vendors-node_modules_nextcloud_cdav-library_dist_dist_js-node_modules_nextcloud_logger_dist_i-36c16b":"c3b3db23da041c717fc1","vendors-node_modules_vue-material-design-icons_CalendarBlank_vue-node_modules_vue-material-de-e2c1f8":"290f7a6dcecead54b4db","vendors-node_modules_vue-material-design-icons_CalendarBlankOutline_vue-node_modules_nextclou-4adead":"a05d4be7db8074129155","vendors-node_modules_autosize_dist_autosize_esm_js-node_modules_html-entities_lib_index_js-no-4072c5":"2d0f50875cdbabc38e4b","src_models_rfcProps_js-src_services_caldavService_js-src_services_talkService_js-src_services-8a2790":"76fe084ed502c638c2e4","src_fullcalendar_eventSources_eventSourceFunction_js-src_utils_moment_js-data_image_svg_xml_3-b73258":"740a2859d1f364b508c1","src_views_Calendar_vue-data_image_svg_xml_3csvg_20xmlns_27http_www_w3_org_2000_svg_27_20heigh-4a4254":"6098d4a3cbb73e6cd93d","vendors-node_modules_webdav_dist_web_index_js":"454da8f908d41b47c607","src_store_index_js":"35fe7fb5d199fb22a689","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"57f3e24b6f63561c43e0","node_modules_nextcloud_dialogs_dist_legacy_mjs":"8be838e4c6e9aae56c87","vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-8ibBgPg__mjs":"ea54a36450de178d1141","public-calendar-subscription-picker":"3abddc6cf2aada41095d","vendors-node_modules_moment_locale_af_js-node_modules_moment_locale_ar-dz_js-node_modules_mom-582c96":"ce1bed825f57dd1d117a","node_modules_moment_locale_sync_recursive_":"4bc2c39c5e0ff182c2e3"}[chunkId] + "";
/******/ };
/******/ })();
/******/
@ -9115,4 +9115,4 @@ __webpack_require__.p = (0,_nextcloud_router__WEBPACK_IMPORTED_MODULE_1__.linkTo
/******/ })()
;
//# sourceMappingURL=calendar-reference.js.map?v=5d70d68bd12bb499654e
//# sourceMappingURL=calendar-reference.js.map?v=05f12134fbdb4957240e

File diff suppressed because one or more lines are too long

View File

@ -42554,4 +42554,4 @@ function hasInjectionContext() {
/***/ })
}]);
//# sourceMappingURL=calendar-vendors-node_modules_autosize_dist_autosize_esm_js-node_modules_html-entities_lib_index_js-no-4072c5.js.map?v=60939d15b29e9da9693b
//# sourceMappingURL=calendar-vendors-node_modules_autosize_dist_autosize_esm_js-node_modules_html-entities_lib_index_js-no-4072c5.js.map?v=2d0f50875cdbabc38e4b

View File

@ -21864,4 +21864,4 @@ const webNamespaces = {
/***/ })
}]);
//# sourceMappingURL=calendar-vendors-node_modules_nextcloud_capabilities_dist_index_js-node_modules_nextcloud_vue-select_d-877981.js.map?v=3533c597c61a45709c85
//# sourceMappingURL=calendar-vendors-node_modules_nextcloud_capabilities_dist_index_js-node_modules_nextcloud_vue-select_d-877981.js.map?v=b70c315d43924cf28e02

View File

@ -27285,4 +27285,4 @@ window._registerCustomPickerElement = _;
/***/ })
}]);
//# sourceMappingURL=calendar-vendors-node_modules_nextcloud_vue-dashboard_dist_vue-dashboard_js-node_modules_css-loader_di-9e6f3d.js.map?v=6717f0bb504201e731c9
//# sourceMappingURL=calendar-vendors-node_modules_nextcloud_vue-dashboard_dist_vue-dashboard_js-node_modules_css-loader_di-9e6f3d.js.map?v=ce406a3daa36b3f00bbd

View File

@ -80146,4 +80146,4 @@ module.exports = /*#__PURE__*/JSON.parse('{"compressed":true,"categories":[{"id"
/***/ })
}]);
//# sourceMappingURL=calendar-vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f.js.map?v=6c303f18660c1428dc28
//# sourceMappingURL=calendar-vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f.js.map?v=57f3e24b6f63561c43e0

View File

@ -102420,4 +102420,4 @@ module.exports = /*#__PURE__*/JSON.parse('{"compressed":true,"categories":[{"id"
/***/ })
}]);
//# sourceMappingURL=calendar-vendors-node_modules_vue-material-design-icons_CalendarBlankOutline_vue-node_modules_nextclou-4adead.js.map?v=e4ffc04ac1c7ab0c5950
//# sourceMappingURL=calendar-vendors-node_modules_vue-material-design-icons_CalendarBlankOutline_vue-node_modules_nextclou-4adead.js.map?v=a05d4be7db8074129155

View File

@ -2030,4 +2030,4 @@ render._withStripped = true
/***/ })
}]);
//# sourceMappingURL=calendar-vendors-node_modules_vue-material-design-icons_CalendarBlank_vue-node_modules_vue-material-de-e2c1f8.js.map?v=aa18371467d4d17269b3
//# sourceMappingURL=calendar-vendors-node_modules_vue-material-design-icons_CalendarBlank_vue-node_modules_vue-material-de-e2c1f8.js.map?v=290f7a6dcecead54b4db

View File

@ -0,0 +1,177 @@
<template>
<div v-if="display" class="property-select-multiple">
<component :is="icon"
:size="20"
:name="readableName"
class="property-select-multiple__icon"
:class="{ 'property-select-multiple__icon--hidden': !showIcon }" />
<div class="property-select-multiple__input"
:class="{ 'property-select-multiple__input--readonly': isReadOnly }">
<NcSelect v-if="!isReadOnly"
:value="selectionData"
:options="options"
:searchable="true"
:placeholder="placeholder"
:name="readableName"
:multiple="true"
:taggable="true"
:labelOutside="true"
:no-wrap="false"
:deselect-from-dropdown="true"
:create-option="(label) => ({ value: label, label })"
input-id="label"
label="label"
@option:selecting="tag"
@option:deselected="unselectValue">
<template v-if="coloredOptions" #option="scope">
<PropertySelectMultipleColoredOption :option="scope" />
</template>
<template v-if="coloredOptions" #selected-option-container="scope">
<PropertySelectMultipleColoredOption :option="scope.option" :closeable="true" @deselect="unselectValue" />
</template>
</NcSelect>
<!-- eslint-disable-next-line vue/singleline-html-element-content-newline -->
<div v-else class="property-select-multiple-colored-tag-wrapper">
<PropertySelectMultipleColoredTag v-for="singleValue in this.selectionData"
:key="singleValue.value"
:option="singleValue" />
</div>
</div>
<div v-if="hasInfo"
v-tooltip="info"
class="property-select__info">
<InformationVariant :size="20"
decorative />
</div>
</div>
</template>
<script>
import PropertyMixin from '../../../mixins/PropertyMixin.js'
import { NcSelect } from '@nextcloud/vue'
import PropertySelectMultipleColoredTag from './PropertySelectMultipleColoredTag.vue'
import PropertySelectMultipleColoredOption from './PropertySelectMultipleColoredOption.vue'
import { getLocale } from '@nextcloud/l10n'
import InformationVariant from 'vue-material-design-icons/InformationVariant.vue'
import {generateUrl} from "@nextcloud/router";
import axios from "@nextcloud/axios";
import {decode} from "html-entities";
export default {
name: 'PropertySelectArticle',
components: {
PropertySelectMultipleColoredOption,
PropertySelectMultipleColoredTag,
// eslint-disable-next-line vue/no-reserved-component-names
NcSelect,
InformationVariant,
},
mixins: [
PropertyMixin,
],
props: {
url: {
type: String,
required: false,
},
coloredOptions: {
type: Boolean,
default: false,
},
closeOnSelect: {
type: Boolean,
default: false,
},
},
data() {
return {
properties: [],
selectionData: [],
}
},
computed: {
display() {
return !(this.isReadOnly && this.selectionData.length === 0)
},
options() {
return this.properties
},
},
mounted() {
this.fetchProperties();
},
created() {
if(this.value && (typeof this.value === 'string')) {
let items = this.value.split(';')
for (const category of items) {
// Create and select pseudo option if is not yet known
const option = this.options.find(option => option.value == category) ?? { label: category, value: category }
this.selectionData.push(option)
}
} else if (Symbol.iterator in Object(this.value)) {
for (const category of this.value) {
// Create and select pseudo option if is not yet known
const option = this.options.find(option => option.value == category) ?? { label: category, value: category }
this.selectionData.push(option)
}
}
},
methods: {
fetchProperties() {
const ajaxUrl = generateUrl(this.url)
axios.get(ajaxUrl)
.then((response) => {
let results = JSON.parse(response.data)
let values = []
results.forEach(result => {
let inputValue = decode(result.reference)
let inputLabel = decode(result.reference)
values.push({
value : inputValue.toString(),
label :inputLabel
})
})
this.properties = values
})
.catch(error => {
console.error('Error fetching properties:', error);
});
},
unselectValue(value) {
if (!value) {
return
}
this.$emit('remove-single-value', value.value)
this.selectionData.splice(this.selectionData.findIndex(option => option.value == value.value), 1)
// store removed custom options to keep it in the option list
const options = this.propModel.options.slice()
if (!options.find(option => option.value == value.value)) {
if (!this.customLabelBuffer) {
this.customLabelBuffer = []
}
this.customLabelBuffer.push(value)
}
},
tag(value) {
if (!value) {
return
}
// budget deselectFromDropdown since the vue-select implementation doesn't work
if (this.selectionData.find(option => option.value == value.value)) {
this.selectionData.splice(this.selectionData.findIndex(option => option.value == value.value), 1)
}
this.selectionData.push(value)
this.$emit('add-single-value', value.value)
},
},
}
</script>

View File

@ -0,0 +1,126 @@
<template>
<div v-if="display"
class="property-select"
:class="{ 'property-select--readonly': isReadOnly }">
<component :is="icon"
:size="20"
:name="readableName"
class="property-select__icon"
:class="{ 'property-select__icon--hidden': !showIcon }" />
<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"
:value="selectedValue"
:placeholder="placeholder"
:clearable="true"
:labelOutside="true"
input-id="value"
label="label"
@input="changeValue" />
<!-- eslint-disable-next-line vue/singleline-html-element-content-newline -->
<div v-else>{{ selectedValue.label }}</div>
</div>
<div v-if="hasInfo"
v-tooltip="info"
class="property-select__info">
<InformationVariant :size="20"
decorative />
</div>
</div>
</template>
<script>
import PropertyMixin from '../../../mixins/PropertyMixin.js'
import { NcSelect } from '@nextcloud/vue'
import InformationVariant from 'vue-material-design-icons/InformationVariant.vue'
import {generateUrl} from "@nextcloud/router";
import axios from "@nextcloud/axios";
import {decode} from 'html-entities';
export default {
name: 'PropertySelectClient',
components: {
NcSelect,
InformationVariant,
},
props: {
url: {
type: String,
required: false,
},
},
data() {
return {
properties: [], // Data to populate the dropdown
selectedProperty: null, // Currently selected property
};
},
mixins: [
PropertyMixin,
],
computed: {
display() {
return true
},
options() {
return this.properties
},
selectedValue() {
const value = this.value || this.propModel.defaultValue
return this.properties.find((option) => option.value.toString() === value)
},
},
mounted() {
this.fetchProperties(); // Fetch data when the component is mounted
},
methods: {
fetchProperties() {
const ajaxUrl = generateUrl(this.url)
axios.get(ajaxUrl)
.then((response) => {
let results = JSON.parse(response.data)
let values = []
results.forEach(result => {
let inputValue = decode(result.id)
let inputLabel = decode(result.nom)
values.push({
value : inputValue.toString(),
label :inputLabel
})
})
this.properties = values
})
.catch(error => {
console.error('Error fetching properties:', error);
});
},
changeValue(selectedOption) {
if (!selectedOption) {
return
}
this.$emit('update:value', selectedOption.value)
},
},
}
</script>
<style lang="scss" scoped>
.property-select {
&__input {
// 34px left and right need to be subtracted. See https://github.com/nextcloud/calendar/pull/3361
width: calc(100% - 34px - 34px);
}
}
</style>

View File

@ -0,0 +1,126 @@
<template>
<div v-if="display"
class="property-select"
:class="{ 'property-select--readonly': isReadOnly }">
<component :is="icon"
:size="20"
:name="readableName"
class="property-select__icon"
:class="{ 'property-select__icon--hidden': !showIcon }" />
<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"
:value="selectedValue"
:placeholder="placeholder"
:clearable="true"
:labelOutside="true"
input-id="value"
label="label"
@input="changeValue" />
<!-- eslint-disable-next-line vue/singleline-html-element-content-newline -->
<div v-else>{{ selectedValue.label }}</div>
</div>
<div v-if="hasInfo"
v-tooltip="info"
class="property-select__info">
<InformationVariant :size="20"
decorative />
</div>
</div>
</template>
<script>
import PropertyMixin from '../../../mixins/PropertyMixin.js'
import { NcSelect } from '@nextcloud/vue'
import InformationVariant from 'vue-material-design-icons/InformationVariant.vue'
import {generateUrl} from "@nextcloud/router";
import axios from "@nextcloud/axios";
import {decode} from 'html-entities';
export default {
name: 'PropertySelectLieu',
components: {
NcSelect,
InformationVariant,
},
props: {
url: {
type: String,
required: false,
},
},
data() {
return {
properties: [], // Data to populate the dropdown
selectedProperty: null, // Currently selected property
};
},
mixins: [
PropertyMixin,
],
computed: {
display() {
return true
},
options() {
return this.properties
},
selectedValue() {
const value = this.value || this.propModel.defaultValue
return this.properties.find((option) => option.value.toString() === value)
},
},
mounted() {
this.fetchProperties(); // Fetch data when the component is mounted
},
methods: {
fetchProperties() {
const ajaxUrl = generateUrl(this.url)
axios.get(ajaxUrl)
.then((response) => {
let results = JSON.parse(response.data)
let values = []
results.forEach(result => {
let inputValue = decode(result.id)
let inputLabel = decode(result.nom)
values.push({
value : inputValue.toString(),
label :inputLabel
})
})
this.properties = values
})
.catch(error => {
console.error('Error fetching properties:', error);
});
},
changeValue(selectedOption) {
if (!selectedOption) {
return
}
this.$emit('update:value', selectedOption.value)
},
},
}
</script>
<style lang="scss" scoped>
.property-select {
&__input {
// 34px left and right need to be subtracted. See https://github.com/nextcloud/calendar/pull/3361
width: calc(100% - 34px - 34px);
}
}
</style>

View File

@ -103,7 +103,7 @@
@update-end-timezone="updateEndTimezone"
@toggle-all-day="toggleAllDay" />
<PropertySelectAjax class="property-location"
<PropertySelectClient class="property-location"
url="/apps/gestion/ajaxGetClientsName"
:is-read-only="isReadOnly"
:prop-model="rfcProps.clients"
@ -111,7 +111,7 @@
:linkify-links="true"
@update:value="updateClient" />
<PropertySelectAjax class="property-location"
<PropertySelectLieu class="property-location"
url="/apps/gestion/ajaxGetLieux"
:is-read-only="isReadOnly"
:prop-model="rfcProps.locations"
@ -119,7 +119,7 @@
:linkify-links="true"
@update:value="updateLocation" />
<PropertySelectAjaxMultiple
<PropertySelectArticle
class="property-description"
url="/apps/gestion/ajaxGetProduits"
:is-read-only="isReadOnly"
@ -344,12 +344,18 @@ import getTimezoneManager from '../services/timezoneDataProviderService.js'
import logger from '../utils/logger.js'
import PropertySelectAjax from "../components/Editor/Properties/PropertySelectAjax.vue";
import PropertySelectAjaxMultiple from "../components/Editor/Properties/PropertySelectAjaxMultiple.vue";
import PropertySelectLieu from "../components/Editor/Properties/PropertySelectLieu.vue";
import PropertySelectClient from "../components/Editor/Properties/PropertySelectClient.vue";
import PropertySelectArticle from "../components/Editor/Properties/PropertySelectArticle.vue";
export default {
name: 'EditSidebar',
components: {
PropertySelectAjaxMultiple,
PropertySelectAjax,
PropertySelectLieu,
PropertySelectClient,
PropertySelectArticle,
ResourceList,
PropertyColor,
PropertySelectMultiple,

View File

@ -121,7 +121,7 @@
@update-end-timezone="updateEndTimezone"
@toggle-all-day="toggleAllDay" />
<PropertySelectAjax class="property-location"
<PropertySelectClient class="property-location"
url="/apps/gestion/ajaxGetClientsName"
:is-read-only="isReadOnly"
:prop-model="rfcProps.clients"
@ -129,7 +129,7 @@
:linkify-links="true"
@update:value="updateClient" />
<PropertySelectAjax class="property-location"
<PropertySelectLieu class="property-location"
url="/apps/gestion/ajaxGetLieux"
:is-read-only="isReadOnly"
:prop-model="rfcProps.locations"
@ -137,7 +137,7 @@
:linkify-links="true"
@update:value="updateLocation" />
<PropertySelectAjaxMultiple
<PropertySelectArticle
:is-read-only="isReadOnlyOrViewing"
url="/apps/gestion/ajaxGetProduits"
:prop-model="rfcProps.articles"
@ -222,12 +222,18 @@ import {showError} from "@nextcloud/dialogs";
import PropertySelect from "../components/Editor/Properties/PropertySelect.vue";
import PropertySelectAjax from "../components/Editor/Properties/PropertySelectAjax.vue";
import PropertySelectAjaxMultiple from "../components/Editor/Properties/PropertySelectAjaxMultiple.vue";
import PropertySelectLieu from "../components/Editor/Properties/PropertySelectLieu.vue";
import PropertySelectClient from "../components/Editor/Properties/PropertySelectClient.vue";
import PropertySelectArticle from "../components/Editor/Properties/PropertySelectArticle.vue";
export default {
name: 'EditSimple',
components: {
PropertySelectAjaxMultiple,
PropertySelectAjax,
PropertySelectLieu,
PropertySelectClient,
PropertySelectArticle,
PropertySelect,
PopoverLoadingIndicator,
SaveButtons,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2193,4 +2193,17 @@ class Bdd {
return $produitList;
}
public function getArticleIdsByArticleReferences(array $articleReferences){
$articleIds = [];
foreach ($articleReferences as $reference) {
$reference = trim($reference);
$sql = "SELECT id FROM ".$this->tableprefix."produit WHERE reference = ?";
$res = $this->execSQLNoJsonReturn($sql, array($reference));
if ($res) {
$articleIds[] = $res[0]['id'];
}
}
return $articleIds;
}
}

View File

@ -120,6 +120,7 @@ class GestionService {
$locationId = $this->GetLocationIdFromVCalendarString($vCalendarString);
$thanatoId = $this->GetThanatoIdFromVCalendarString($vCalendarString);
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
$userName = $this->GetThanatoNameFromVCalendarString($vCalendarString);
$devisAlreadyCreated = $this->IsDevisAlreadyCreated($clientId,$locationId,$thanatoId,$calendarSummary,$calendarUuid);
if($devisAlreadyCreated){
return;
@ -129,10 +130,9 @@ class GestionService {
$devisId = $this->gestionBdd->insertDevisFromVCalendarAndReturnId($thanatoId,$clientId,$locationId,$defuntId,$calendarUuid,$calendarStartDate);
$articlesValue = $this->GetArticlesNameFromVCalendarString($vCalendarString);
if(!empty($articlesValue)){
$articlesId = $this->gestionBdd->getArticlesIdFromArticlesNameArray($articlesValue);
$this->gestionBdd->insertDevisArticleFromDevisIdAndArticlesIdArray($devisId, $articlesId);
$articleIds = $this->gestionBdd->getArticleIdsByArticleReferences($articlesValue);
$this->gestionBdd->insertDevisArticleFromDevisIdAndArticlesIdArray($devisId, $articleIds);
}
$userName = $this->GetThanatoNameFromVCalendarString($vCalendarString);
$this->gestionBdd->createDevisTrajetFromVCalendar($devisId,$userName);
}
@ -150,15 +150,20 @@ class GestionService {
}
private function GetClientIdFromVCalendarString(string $vCalendarString){
$this->logger->debug($vCalendarString);
$clientValue = VCalendarHelpers::GetValueFromKeyInVCalendarString("CLIENT", $vCalendarString);
$clientId = $this->gestionBdd->getLastClientIdByName(name: $clientValue) ?? 0;
return $clientId;
if($clientValue == null || $clientValue == ""){
$clientValue = 0;
}
return (int)$clientValue;
}
private function GetLocationIdFromVCalendarString(string $vCalendarString){
$locationValue = VCalendarHelpers::GetValueFromKeyInVCalendarString("LOCATION", $vCalendarString);
$locationId = $this->gestionBdd->getLastLocationIdByName($locationValue)?? 0;
return $locationId;
if($locationValue == null || $locationValue == ""){
$locationValue = 0;
}
return (int)$locationValue;
}
private function GetArticlesNameFromVCalendarString(string $vCalendarString): array {

View File

@ -9,6 +9,7 @@ export class TrajetDetails {
* @param myresp instantiate trajet object
*/
constructor(myresp) {
console.log(myresp);
this.id = myresp.id;
this.user_id = myresp.user_id;
this.id_nextcloud = myresp.id_nextcloud;
@ -37,7 +38,7 @@ export class TrajetDetails {
(this.source.toLowerCase() == 'devis' || this.source.toLowerCase() == 'h2f')?('<div>'+this.rang+'</div>'):'<div class="editableNumber" data-table="ligne_trajet" data-column="rang" data-id="' + this.id + '" style="display:inline">' + this.rang + '</div>',
(this.source.toLowerCase() == 'devis' || this.source.toLowerCase() == 'h2f')?('<div>'+TrajetDetails.convert_date(this.date)+'</div>'):'<input style="margin:0;padding:0;" class="inputDate" type="date" value=' + this.date + ' data-table="ligne_trajet" data-column="date" data-id="' + this.id + '"/>',
(this.source.toLowerCase() == 'devis' || this.source.toLowerCase() == 'h2f')?('<div>'+this.cprenoms+' '+this.cnom+'</div>'):'<div class="loadSelect_listclient"' +' data-table="ligne_trajet" data-column="id_client" data-id="' + this.id + '" data-current="' + this.cid + '">'+ this.cid + ' (' + this.cprenoms + ' ' + this.cnom + ')</div>',
(this.source.toLowerCase() == 'devis' || this.source.toLowerCase() == 'h2f')?('<div>' + this.nom_defunt + ' | <span style="font-size: 0.7rem">' + this.dprenoms + ' ' + this.dnom + '</span></div>'):'<div class="loadSelect_listDelphineDevis"' +' data-table="ligne_trajet" data-column="id_devis" data-id="' + this.id + '" data-current="' + this.did + '">' + this.dnum + ' | <span style="font-size: 0.7rem">' + this.dprenoms + ' ' + this.dnom + '</span></div>',
(this.source.toLowerCase() == 'devis' || this.source.toLowerCase() == 'h2f')?('<div>' + this.nom_defunt + ' | <span style="font-size: 0.7rem">' + this.dprenoms + ' ' + this.dnom + '</span></div>'):('<div><span>-</span></div>'),
(this.source.toLowerCase() == 'devis' || this.source.toLowerCase() == 'h2f')?('<div>'+this.lieu+'</div>'):'<div class="loadSelect_listlieu"' +' data-table="ligne_trajet" data-column="id_lieu" data-id="' + this.id + '" data-current="' + this.lid + '">' + this.lieu + '</div>',
'<div class="editable" data-table="ligne_trajet" data-column="commentaire" data-id="' + this.id + '" style="display:inline">' + this.commentaire + '</div>',
'<div data-table="ligne_trajet" data-column="user_id" data-id="' + this.id + '" style="display:inline">' + this.didnextcloud + '</div>',