Merge branch 'features/feature-order-from-agenda' into releases/release-h2f
This commit is contained in:
commit
d153ea598e
@ -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":"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] + "";
|
||||
/******/ return "calendar-" + chunkId + ".js?v=" + {"vendors-node_modules_nextcloud_capabilities_dist_index_js-node_modules_nextcloud_vue-select_d-877981":"7bde6f386631234ba146","vendors-node_modules_vue-material-design-icons_CalendarBlank_vue-node_modules_vue-material-de-e2c1f8":"2e0b0e8bc0e8488c397c","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"728c782d2751f8e6150a","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=33645c11c83fb0efebcb
|
||||
//# sourceMappingURL=calendar-appointments-booking.js.map?v=b7719d864afe6419c183
|
||||
File diff suppressed because one or more lines are too long
@ -37516,4 +37516,4 @@ const booking = (0,_nextcloud_initial_state__WEBPACK_IMPORTED_MODULE_1__.loadSta
|
||||
|
||||
/******/ })()
|
||||
;
|
||||
//# sourceMappingURL=calendar-appointments-confirmation.js.map?v=7972917bd202ca1f10b9
|
||||
//# sourceMappingURL=calendar-appointments-confirmation.js.map?v=e09415d738d19b735882
|
||||
File diff suppressed because one or more lines are too long
@ -37552,4 +37552,4 @@ const booking = (0,_nextcloud_initial_state__WEBPACK_IMPORTED_MODULE_1__.loadSta
|
||||
|
||||
/******/ })()
|
||||
;
|
||||
//# sourceMappingURL=calendar-appointments-conflict.js.map?v=5598f906629cead96b94
|
||||
//# sourceMappingURL=calendar-appointments-conflict.js.map?v=203b5778e2275f51e478
|
||||
File diff suppressed because one or more lines are too long
@ -160605,4 +160605,4 @@ vue__WEBPACK_IMPORTED_MODULE_5__["default"].prototype.$n = _nextcloud_l10n__WEBP
|
||||
|
||||
/******/ })()
|
||||
;
|
||||
//# sourceMappingURL=calendar-appointments-overview.js.map?v=083cf88f751169dcba78
|
||||
//# sourceMappingURL=calendar-appointments-overview.js.map?v=11949b799a3d070cc45a
|
||||
File diff suppressed because one or more lines are too long
@ -500,4 +500,4 @@ if(false) {}
|
||||
/***/ })
|
||||
|
||||
}]);
|
||||
//# sourceMappingURL=calendar-dashboard-lazy.js.map?v=173cc8b933d97acb8d15
|
||||
//# sourceMappingURL=calendar-dashboard-lazy.js.map?v=0dd354a2fd4b9e38ddcf
|
||||
File diff suppressed because one or more lines are too long
@ -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":"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":"94fac30d128df46a89a6","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] + "";
|
||||
/******/ return "calendar-" + chunkId + ".js?v=" + {"vendors-node_modules_nextcloud_capabilities_dist_index_js-node_modules_nextcloud_vue-select_d-877981":"7bde6f386631234ba146","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":"273df538e0dc19672feb","vendors-node_modules_nextcloud_vue-dashboard_dist_vue-dashboard_js-node_modules_css-loader_di-9e6f3d":"86eaa619747854c0da61","src_models_rfcProps_js-src_services_caldavService_js-src_services_talkService_js-src_services-8a2790":"94fac30d128df46a89a6","src_store_index_js":"8e651e1007c1cc1d62d0","src_fullcalendar_eventSources_eventSourceFunction_js-src_utils_moment_js-data_image_svg_xml_3-b73258":"740a2859d1f364b508c1","dashboard-lazy":"0dd354a2fd4b9e38ddcf","vendors-node_modules_vue-material-design-icons_CalendarBlank_vue-node_modules_vue-material-de-e2c1f8":"2e0b0e8bc0e8488c397c","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"728c782d2751f8e6150a","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=0b685ac8c33d924cbf7b
|
||||
//# sourceMappingURL=calendar-dashboard.js.map?v=561bba8d5d28f5eebd8f
|
||||
File diff suppressed because one or more lines are too long
@ -32474,7 +32474,8 @@ const actions = {
|
||||
const calendarObject = state.calendarObject;
|
||||
(0,_utils_alarms_js__WEBPACK_IMPORTED_MODULE_5__.updateAlarms)(eventComponent);
|
||||
(0,_services_talkService_js__WEBPACK_IMPORTED_MODULE_13__.updateTalkParticipants)(eventComponent);
|
||||
if (eventComponent.isDirty()) {
|
||||
let additionalFieldWasUpdated = eventComponent.client != null;
|
||||
if (eventComponent.isDirty() || additionalFieldWasUpdated) {
|
||||
const isForkedItem = eventComponent.primaryItem !== null;
|
||||
let original = null;
|
||||
let fork = null;
|
||||
@ -33376,12 +33377,22 @@ const actions = {
|
||||
} = _ref8;
|
||||
let eventComponent = calendarObject.calendarComponent.getFirstComponent('VEVENT');
|
||||
if (calendarObject.existsOnServer) {
|
||||
calendarObject.dav.data = calendarObject.calendarComponent.toICS();
|
||||
let icsValue = calendarObject.calendarComponent.toICS();
|
||||
if (eventComponent != null) {
|
||||
if (eventComponent.client != null) {
|
||||
let newClientKeyValue = "CLIENT:" + eventComponent.client;
|
||||
icsValue = icsValue.replace(/CLIENT:\d+/, newClientKeyValue);
|
||||
}
|
||||
}
|
||||
calendarObject.dav.data = icsValue;
|
||||
await calendarObject.dav.update();
|
||||
context.commit('addCalendarObjectIdToAllTimeRangesOfCalendar', {
|
||||
calendarId: calendarObject.calendarId,
|
||||
calendarObjectId: calendarObject.id
|
||||
});
|
||||
context.commit('resetCalendarObjectToDav', {
|
||||
calendarObject
|
||||
});
|
||||
context.commit('incrementModificationCount');
|
||||
return;
|
||||
// TODO - catch conflicts
|
||||
@ -309737,7 +309748,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":"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","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] + "";
|
||||
/******/ return "calendar-" + chunkId + ".js?v=" + {"vendors-node_modules_nextcloud_capabilities_dist_index_js-node_modules_nextcloud_vue-select_d-877981":"7bde6f386631234ba146","vendors-node_modules_vue-material-design-icons_CalendarBlank_vue-node_modules_vue-material-de-e2c1f8":"2e0b0e8bc0e8488c397c","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"728c782d2751f8e6150a","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","public-calendar-subscription-picker":"9168fca99a878d4c37e3","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] + "";
|
||||
/******/ };
|
||||
/******/ })();
|
||||
/******/
|
||||
@ -310042,4 +310053,4 @@ appointmentsConfigsStore.addInitialConfigs((0,_nextcloud_initial_state__WEBPACK_
|
||||
|
||||
/******/ })()
|
||||
;
|
||||
//# sourceMappingURL=calendar-main.js.map?v=aee16081822c9ddf30f9
|
||||
//# sourceMappingURL=calendar-main.js.map?v=8a26d47f5b506167ce1b
|
||||
File diff suppressed because one or more lines are too long
@ -369,4 +369,4 @@ module.exports = /*#__PURE__*/JSON.parse('[{"country":"Algeria","filename":"Alge
|
||||
/***/ })
|
||||
|
||||
}]);
|
||||
//# sourceMappingURL=calendar-public-calendar-subscription-picker.js.map?v=3abddc6cf2aada41095d
|
||||
//# sourceMappingURL=calendar-public-calendar-subscription-picker.js.map?v=9168fca99a878d4c37e3
|
||||
File diff suppressed because one or more lines are too long
@ -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":"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":"94fac30d128df46a89a6","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":"832bad2f91d7bbf297e5","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] + "";
|
||||
/******/ 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":"7bde6f386631234ba146","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":"2e0b0e8bc0e8488c397c","vendors-node_modules_vue-material-design-icons_CalendarBlankOutline_vue-node_modules_nextclou-4adead":"273df538e0dc19672feb","vendors-node_modules_autosize_dist_autosize_esm_js-node_modules_html-entities_lib_index_js-no-4072c5":"56373f2063898525e8de","src_models_rfcProps_js-src_services_caldavService_js-src_services_talkService_js-src_services-8a2790":"94fac30d128df46a89a6","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":"70f973572631ebf61374","vendors-node_modules_webdav_dist_web_index_js":"454da8f908d41b47c607","src_store_index_js":"8e651e1007c1cc1d62d0","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"728c782d2751f8e6150a","node_modules_nextcloud_dialogs_dist_legacy_mjs":"8be838e4c6e9aae56c87","vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-8ibBgPg__mjs":"ea54a36450de178d1141","public-calendar-subscription-picker":"9168fca99a878d4c37e3","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=fe9ebb278e638101a795
|
||||
//# sourceMappingURL=calendar-reference.js.map?v=f0917e7f93f4ffd7ea47
|
||||
File diff suppressed because one or more lines are too long
@ -3650,7 +3650,8 @@ const actions = {
|
||||
const calendarObject = state.calendarObject;
|
||||
(0,_utils_alarms_js__WEBPACK_IMPORTED_MODULE_5__.updateAlarms)(eventComponent);
|
||||
(0,_services_talkService_js__WEBPACK_IMPORTED_MODULE_13__.updateTalkParticipants)(eventComponent);
|
||||
if (eventComponent.isDirty()) {
|
||||
let additionalFieldWasUpdated = eventComponent.client != null;
|
||||
if (eventComponent.isDirty() || additionalFieldWasUpdated) {
|
||||
const isForkedItem = eventComponent.primaryItem !== null;
|
||||
let original = null;
|
||||
let fork = null;
|
||||
@ -4551,12 +4552,22 @@ const actions = {
|
||||
} = _ref8;
|
||||
let eventComponent = calendarObject.calendarComponent.getFirstComponent('VEVENT');
|
||||
if (calendarObject.existsOnServer) {
|
||||
calendarObject.dav.data = calendarObject.calendarComponent.toICS();
|
||||
let icsValue = calendarObject.calendarComponent.toICS();
|
||||
if (eventComponent != null) {
|
||||
if (eventComponent.client != null) {
|
||||
let newClientKeyValue = "CLIENT:" + eventComponent.client;
|
||||
icsValue = icsValue.replace(/CLIENT:\d+/, newClientKeyValue);
|
||||
}
|
||||
}
|
||||
calendarObject.dav.data = icsValue;
|
||||
await calendarObject.dav.update();
|
||||
context.commit('addCalendarObjectIdToAllTimeRangesOfCalendar', {
|
||||
calendarId: calendarObject.calendarId,
|
||||
calendarObjectId: calendarObject.id
|
||||
});
|
||||
context.commit('resetCalendarObjectToDav', {
|
||||
calendarObject
|
||||
});
|
||||
context.commit('incrementModificationCount');
|
||||
return;
|
||||
// TODO - catch conflicts
|
||||
@ -8102,4 +8113,4 @@ function getLinkToConfig(key) {
|
||||
/***/ })
|
||||
|
||||
}]);
|
||||
//# sourceMappingURL=calendar-src_store_index_js.js.map?v=35fe7fb5d199fb22a689
|
||||
//# sourceMappingURL=calendar-src_store_index_js.js.map?v=8e651e1007c1cc1d62d0
|
||||
File diff suppressed because one or more lines are too long
@ -27321,4 +27321,4 @@ module.exports = "data:image/svg+xml,%3csvg%20xmlns=%27http://www.w3.org/2000/sv
|
||||
/***/ })
|
||||
|
||||
}]);
|
||||
//# sourceMappingURL=calendar-src_views_Calendar_vue-data_image_svg_xml_3csvg_20xmlns_27http_www_w3_org_2000_svg_27_20heigh-4a4254.js.map?v=832bad2f91d7bbf297e5
|
||||
//# sourceMappingURL=calendar-src_views_Calendar_vue-data_image_svg_xml_3csvg_20xmlns_27http_www_w3_org_2000_svg_27_20heigh-4a4254.js.map?v=70f973572631ebf61374
|
||||
File diff suppressed because one or more lines are too long
@ -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=2d0f50875cdbabc38e4b
|
||||
//# sourceMappingURL=calendar-vendors-node_modules_autosize_dist_autosize_esm_js-node_modules_html-entities_lib_index_js-no-4072c5.js.map?v=56373f2063898525e8de
|
||||
File diff suppressed because one or more lines are too long
@ -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=b70c315d43924cf28e02
|
||||
//# sourceMappingURL=calendar-vendors-node_modules_nextcloud_capabilities_dist_index_js-node_modules_nextcloud_vue-select_d-877981.js.map?v=7bde6f386631234ba146
|
||||
File diff suppressed because one or more lines are too long
@ -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=ce406a3daa36b3f00bbd
|
||||
//# sourceMappingURL=calendar-vendors-node_modules_nextcloud_vue-dashboard_dist_vue-dashboard_js-node_modules_css-loader_di-9e6f3d.js.map?v=86eaa619747854c0da61
|
||||
File diff suppressed because one or more lines are too long
@ -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=57f3e24b6f63561c43e0
|
||||
//# sourceMappingURL=calendar-vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f.js.map?v=728c782d2751f8e6150a
|
||||
File diff suppressed because one or more lines are too long
@ -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=a05d4be7db8074129155
|
||||
//# sourceMappingURL=calendar-vendors-node_modules_vue-material-design-icons_CalendarBlankOutline_vue-node_modules_nextclou-4adead.js.map?v=273df538e0dc19672feb
|
||||
File diff suppressed because one or more lines are too long
@ -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=290f7a6dcecead54b4db
|
||||
//# sourceMappingURL=calendar-vendors-node_modules_vue-material-design-icons_CalendarBlank_vue-node_modules_vue-material-de-e2c1f8.js.map?v=2e0b0e8bc0e8488c397c
|
||||
File diff suppressed because one or more lines are too long
@ -1687,8 +1687,9 @@ const actions = {
|
||||
|
||||
updateAlarms(eventComponent)
|
||||
updateTalkParticipants(eventComponent)
|
||||
|
||||
if (eventComponent.isDirty()) {
|
||||
let additionalFieldWasUpdated =
|
||||
eventComponent.client != null;
|
||||
if (eventComponent.isDirty() || additionalFieldWasUpdated) {
|
||||
const isForkedItem = eventComponent.primaryItem !== null
|
||||
let original = null
|
||||
let fork = null
|
||||
|
||||
@ -226,12 +226,20 @@ const actions = {
|
||||
async updateCalendarObject(context, { calendarObject }) {
|
||||
let eventComponent = calendarObject.calendarComponent.getFirstComponent('VEVENT');
|
||||
if (calendarObject.existsOnServer) {
|
||||
calendarObject.dav.data = calendarObject.calendarComponent.toICS()
|
||||
let icsValue = calendarObject.calendarComponent.toICS();
|
||||
if(eventComponent != null){
|
||||
if(eventComponent.client != null){
|
||||
let newClientKeyValue = "CLIENT:"+eventComponent.client;
|
||||
icsValue = icsValue.replace(/CLIENT:\d+/, newClientKeyValue);
|
||||
}
|
||||
}
|
||||
calendarObject.dav.data = icsValue;
|
||||
await calendarObject.dav.update()
|
||||
context.commit('addCalendarObjectIdToAllTimeRangesOfCalendar', {
|
||||
calendarId: calendarObject.calendarId,
|
||||
calendarObjectId: calendarObject.id,
|
||||
})
|
||||
context.commit('resetCalendarObjectToDav', { calendarObject })
|
||||
context.commit('incrementModificationCount')
|
||||
return
|
||||
// TODO - catch conflicts
|
||||
|
||||
@ -15,6 +15,7 @@ return [
|
||||
['name' => 'page#isConfig', 'url' => '/isconfig', 'verb' => 'GET'],
|
||||
['name' => 'page#statistique', 'url' => '/statistique', 'verb' => 'GET'],
|
||||
['name' => 'page#legalnotice', 'url' => '/legalnotice', 'verb' => 'GET'],
|
||||
['name' => 'order#order', 'url' => '/order', 'verb' => 'GET'],
|
||||
|
||||
['name' => 'page#france', 'url' => '/legalnotice/france', 'verb' => 'GET'],
|
||||
|
||||
@ -145,9 +146,14 @@ return [
|
||||
|
||||
//thanato
|
||||
['name' => 'page#getThanatoTypeList', 'url' => '/thanato/type', 'verb' => 'PROPFIND'],
|
||||
['name' => 'page#getThanatosByType', 'url' => '/thanatos/type/{thanatoType}', 'verb' => 'PROPFIND'],
|
||||
|
||||
//relation of user and thanato
|
||||
['name' => 'page#getUsersNotLinkedToThanato','url' => '/user/getUsersNotLinkedToThanato', 'verb' => 'PROPFIND'],
|
||||
|
||||
//order
|
||||
['name' => 'order#getOrdersWithDetails','url' => '/order/list', 'verb' => 'PROPFIND'],
|
||||
['name' => 'order#createDefaultOrder','url' => '/order/createDefaultOrder', 'verb' => 'POST'],
|
||||
['name' => 'order#updateOrderDate','url' => '/order/{orderId}/updateDate', 'verb' => 'PUT'],
|
||||
]
|
||||
];
|
||||
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
2
gestion/js/order.app.js
Normal file
2
gestion/js/order.app.js
Normal file
File diff suppressed because one or more lines are too long
46
gestion/js/order.app.js.LICENSE.txt
Normal file
46
gestion/js/order.app.js.LICENSE.txt
Normal file
@ -0,0 +1,46 @@
|
||||
/*!
|
||||
* Sizzle CSS Selector Engine v2.3.9
|
||||
* https://sizzlejs.com/
|
||||
*
|
||||
* Copyright JS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://js.foundation/
|
||||
*
|
||||
* Date: 2022-12-19
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Toastify js 1.12.0
|
||||
* https://github.com/apvarun/toastify-js
|
||||
* @license MIT licensed
|
||||
*
|
||||
* Copyright (C) 2018 Varun A P
|
||||
*/
|
||||
|
||||
/*!
|
||||
* escape-html
|
||||
* Copyright(c) 2012-2013 TJ Holowaychuk
|
||||
* Copyright(c) 2015 Andreas Lubbe
|
||||
* Copyright(c) 2015 Tiancheng "Timothy" Gu
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* jQuery JavaScript Library v3.6.3
|
||||
* https://jquery.com/
|
||||
*
|
||||
* Includes Sizzle.js
|
||||
* https://sizzlejs.com/
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2022-12-20T21:28Z
|
||||
*/
|
||||
|
||||
/*! @license DOMPurify 2.4.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.4/LICENSE */
|
||||
|
||||
/*! DataTables 1.13.2
|
||||
* ©2008-2023 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
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
@ -5,7 +5,11 @@
|
||||
namespace OCA\Gestion\AppInfo;
|
||||
|
||||
use OCA\DAV\Events\CalendarObjectCreatedEvent;
|
||||
use OCA\DAV\Events\CalendarObjectMovedToTrashEvent;
|
||||
use OCA\DAV\Events\CalendarObjectUpdatedEvent;
|
||||
use OCA\Gestion\Listener\CalendarObjectCreatedListener;
|
||||
use OCA\Gestion\Listener\CalendarObjectMovedToTrashListener;
|
||||
use OCA\Gestion\Listener\CalendarObjectUpdatedListener;
|
||||
use OCP\AppFramework\App;
|
||||
use OCP\AppFramework\Bootstrap\IBootstrap;
|
||||
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
||||
@ -21,6 +25,8 @@ class Application extends App implements IBootstrap {
|
||||
|
||||
public function register(IRegistrationContext $context): void {
|
||||
$context->registerEventListener(CalendarObjectCreatedEvent::class, CalendarObjectCreatedListener::class);
|
||||
$context->registerEventListener(CalendarObjectMovedToTrashEvent::class, CalendarObjectMovedToTrashListener::class);
|
||||
$context->registerEventListener(CalendarObjectUpdatedEvent::class, CalendarObjectUpdatedListener::class);
|
||||
}
|
||||
|
||||
public function boot(IBootContext $context): void {
|
||||
|
||||
11
gestion/lib/Constants/DevisMentionConstant.php
Normal file
11
gestion/lib/Constants/DevisMentionConstant.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\Gestion\Constants;
|
||||
abstract class DevisMentionConstant
|
||||
{ const FACTURED = "facturé";
|
||||
const FACTURED_FORMATTED = "facturé";
|
||||
const MENTION = "Mention";
|
||||
const NEW = "Nouveau";
|
||||
const CANCELED = "CANCELED";
|
||||
}
|
||||
11
gestion/lib/Constants/OrderStatusConstant.php
Normal file
11
gestion/lib/Constants/OrderStatusConstant.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\Gestion\Constants;
|
||||
abstract class OrderStatusConstant
|
||||
{
|
||||
const ORDERED_KEY = "ORDERED";
|
||||
const CANCELED_KEY = "CANCELED";
|
||||
|
||||
const NEW_KEY = "NEW";
|
||||
}
|
||||
10
gestion/lib/Constants/ThanatoTypeConstant.php
Normal file
10
gestion/lib/Constants/ThanatoTypeConstant.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\Gestion\Constants;
|
||||
abstract class ThanatoTypeConstant
|
||||
{
|
||||
const DEFAULT_CALENDAR_UUID_FOR_DEVIS = "not-related";
|
||||
const THANATO_TYPE_EMPLOYEE = "EMPLOYEE";
|
||||
const THANATO_TYPE_SUBCONTRACTOR = "SUBCONTRACTOR";
|
||||
}
|
||||
138
gestion/lib/Controller/OrderController.php
Normal file
138
gestion/lib/Controller/OrderController.php
Normal file
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
namespace OCA\Gestion\Controller;
|
||||
|
||||
use Exception;
|
||||
use OCA\Gestion\Service\NavigationService;
|
||||
use OCA\Gestion\Service\Order\OrderService;
|
||||
defined("TAB1") or define("TAB1", "\t");
|
||||
|
||||
use OCP\IGroupManager;
|
||||
use OCP\IRequest;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Mail\IMailer;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\AppFramework\Http\DataResponse;
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCA\Gestion\Db\Bdd;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\IConfig;
|
||||
|
||||
date_default_timezone_set('Europe/Paris');
|
||||
|
||||
class OrderController extends Controller {
|
||||
private $idNextcloud;
|
||||
private $myDb;
|
||||
// private $src_path = "/var/www/html/apps/gestion/img/";
|
||||
private $src_path = "/var/www/html/custom_apps/gestion/img/";
|
||||
private const H2F_DEFAULT_ADMIN = "Emmanuelle";
|
||||
private const DEFAULT_ADMIN = "admin";
|
||||
private $urlGenerator;
|
||||
private $mailer;
|
||||
private $config;
|
||||
|
||||
/** @var IRootStorage */
|
||||
private $storage;
|
||||
|
||||
private $user;
|
||||
private $groups = [];
|
||||
|
||||
/** @var OrderService */
|
||||
private $orderService;
|
||||
|
||||
/** @var \OCA\Gestion\Service\NavigationService */
|
||||
private $navigationService;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct($AppName,
|
||||
IRequest $request,
|
||||
$UserId,
|
||||
Bdd $myDb,
|
||||
IRootFolder $rootFolder,
|
||||
IURLGenerator $urlGenerator,
|
||||
IMailer $mailer,
|
||||
Iconfig $config,
|
||||
IUserSession $userSession,
|
||||
IGroupManager $groupManager,
|
||||
OrderService $orderService,
|
||||
NavigationService $navigationService
|
||||
){
|
||||
|
||||
parent::__construct($AppName, $request);
|
||||
|
||||
$this->idNextcloud = $UserId;
|
||||
$this->myDb = $myDb;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->mailer = $mailer;
|
||||
$this->config = $config;
|
||||
$this->orderService = $orderService;
|
||||
$this->navigationService = $navigationService;
|
||||
//$this->fpdf = $fpdf;
|
||||
|
||||
if ($userSession->isLoggedIn()) {
|
||||
$this->user = $userSession->getUser();
|
||||
}
|
||||
|
||||
if ($this->user != null) {
|
||||
$groups = $groupManager->getUserGroups($this->user);
|
||||
$this->groups = [];
|
||||
foreach ($groups as $group) {
|
||||
$this->groups[] = $group->getGID();
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
$this->storage = $rootFolder->getUserFolder($this->idNextcloud);
|
||||
}catch(\OC\User\NoUserException $e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function order() {
|
||||
return new TemplateResponse('gestion', 'order', array('groups' => $this->groups, 'user' => $this->user, 'path' => $this->idNextcloud, 'url' => $this->navigationService->getNavigationLink()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function getOrdersWithDetails() {
|
||||
$orders = $this->orderService->getOrdersWithDetailsAsArray();
|
||||
return json_encode($orders);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function createDefaultOrder() {
|
||||
try{
|
||||
$this->orderService->createDefaultOrder($this->idNextcloud);
|
||||
return true;
|
||||
}
|
||||
catch(Exception $e){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function updateOrderDate($orderId,$orderDate) {
|
||||
try{
|
||||
$this->orderService->updateOrderDate($orderId,$orderDate);
|
||||
return true;
|
||||
}
|
||||
catch(Exception $e){
|
||||
var_dump($e->getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -386,6 +386,7 @@ class PageController extends Controller {
|
||||
"statistique" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.statistique"),
|
||||
"legalnotice" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.legalnotice"),
|
||||
"france" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.france"),
|
||||
"orders" => $this->urlGenerator->linkToRouteAbsolute("gestion.order.order"),
|
||||
);
|
||||
}
|
||||
|
||||
@ -2803,4 +2804,18 @@ class PageController extends Controller {
|
||||
return json_encode([]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*
|
||||
*/
|
||||
public function getThanatosByType($thanatoType){
|
||||
try{
|
||||
return $this->myDb->getThanatosByType($thanatoType);
|
||||
}
|
||||
catch(Exception $e) {
|
||||
return json_encode([]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
namespace OCA\Gestion\Db;
|
||||
|
||||
use OCA\Gestion\Constants\BddConstant;
|
||||
use OCA\Gestion\Constants\DevisMentionConstant;
|
||||
use OCA\Gestion\Constants\ThanatoTypeConstant;
|
||||
use OCA\Gestion\Helpers\DateHelpers;
|
||||
use OCA\Gestion\Helpers\VCalendarHelpers;
|
||||
use OCP\IDBConnection;
|
||||
@ -34,8 +36,12 @@ class Bdd {
|
||||
"drainage", "drainage_qte", "drainage_etat", "ponction", "ponction_qte", "cavite", "cavite_qte", "desinfection", "lavage",
|
||||
"rasage", "presentation_cosmetique", "presentation_sur", "hypodermiques", "hypodermiques_sur", "local", "local_sur", "contenu",
|
||||
"commentaire", "designation", "hypodermiques_text1", "hypodermiques_text2", "qte", "endroit",
|
||||
"fk_thanato_type_key","thanato_email","fk_user_uuid");
|
||||
$this->whiteTable = array("client", "lieu", "trajet", "devis", "produit_devis", "facture", "produit", "configuration", "ligne_trajet", "thanato", "article", "defunt", "article_devis", "bibliotheque", "bijou_defunt", "obs_defunt", "hypo_defunt");
|
||||
"fk_thanato_type_key","thanato_email","fk_user_uuid",
|
||||
"fk_defunt_id","fk_lieu_id","fk_client_id","fk_thanato_id");
|
||||
$this->whiteTable = array("client", "lieu", "trajet", "devis", "produit_devis", "facture", "produit",
|
||||
"configuration", "ligne_trajet", "thanato", "article", "defunt", "article_devis",
|
||||
"bibliotheque", "bijou_defunt", "obs_defunt", "hypo_defunt",
|
||||
"orders");
|
||||
$this->tableprefix = '*PREFIX*' ."gestion_";
|
||||
$this->pdo = $db;
|
||||
$this->l = $l;
|
||||
@ -477,7 +483,9 @@ class Bdd {
|
||||
.$this->tableprefix."devis.user_id as user_id
|
||||
FROM ".$this->tableprefix."defunt
|
||||
LEFT JOIN ".$this->tableprefix."devis ON ".$this->tableprefix."devis.id_defunt = ".$this->tableprefix."defunt.id
|
||||
WHERE ".$this->tableprefix."devis.id_defunt IS NULL
|
||||
LEFT JOIN ".$this->tableprefix."orders ON ".$this->tableprefix."defunt.id = ".$this->tableprefix."orders.fk_defunt_id
|
||||
WHERE ".$this->tableprefix."devis.id_defunt IS NULL AND "
|
||||
.$this->tableprefix."orders.fk_defunt_id IS NULL
|
||||
ORDER BY ".$this->tableprefix."defunt.id DESC;";
|
||||
return $this->execSQL($sql, array());
|
||||
}
|
||||
@ -972,7 +980,8 @@ class Bdd {
|
||||
} else if(strcmp($table, "ligne_trajet")==0 && (strcmp($column, "id_devis")==0 || strcmp($column, "date")==0 || strcmp($column, "id_lieu")==0 || strcmp($column, "rang")==0)) {
|
||||
$ligne_trajet = json_decode($this->getOneTrajetdetails($id, $idNextcloud))[0];
|
||||
$this->update_lieu_date_devis_rang_ligneTrajet($ligne_trajet, $column, htmlentities(rtrim($data)), $idNextcloud);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$sql = "UPDATE ".$this->tableprefix.$table." SET $column = ? WHERE `id` = ?";
|
||||
$this->execSQLNoData($sql, array(trim($data), $id));
|
||||
}
|
||||
@ -1736,6 +1745,17 @@ class Bdd {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getThanatoByUserUuid($userUuid){
|
||||
$sql = "SELECT *
|
||||
FROM ".$this->tableprefix."thanato as thanato
|
||||
WHERE thanato.fk_user_uuid = ?";
|
||||
$res = $this->execSQLNoJsonReturn($sql,array($userUuid));
|
||||
if($res){
|
||||
return $res[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getThanatoIdByUserUuid($userUuid){
|
||||
$sql = "SELECT min(id) as FIRST_INSERT_ID
|
||||
FROM ".$this->tableprefix."thanato
|
||||
@ -2665,4 +2685,142 @@ class Bdd {
|
||||
return $this->execSQL($sql,[BddConstant::DEFAULT_THANATOS_GROUP_NAME]);
|
||||
}
|
||||
|
||||
public function getDevisByCalendarUuid($calendarUuid){
|
||||
if($calendarUuid === self::DEFAULT_CALENDAR_UUID_FOR_DEVIS){
|
||||
return null;
|
||||
}
|
||||
$sql = "SELECT
|
||||
devis.id,
|
||||
devis.id_thanato,
|
||||
devis.id_defunt as defunt_id,
|
||||
devis.num,
|
||||
devis.comment,
|
||||
devis.id_lieu as lieu_id,
|
||||
devis.id_client as client_id,
|
||||
defunt.nom as defunt_nom
|
||||
FROM ".$this->tableprefix."devis as devis
|
||||
LEFT JOIN ".$this->tableprefix."defunt as defunt on devis.id_defunt = defunt.id
|
||||
WHERE devis.num = ? ;";
|
||||
|
||||
$devis = $this->execSQLNoJsonReturn($sql, array($calendarUuid));
|
||||
if(empty($devis)){
|
||||
return null;
|
||||
}
|
||||
return $devis[0];
|
||||
}
|
||||
|
||||
public function updateDevisMentionToCanceled($devisId){
|
||||
$sql= "UPDATE ".$this->tableprefix."devis as devis
|
||||
SET devis.mentions = ?
|
||||
WHERE devis.id = ?";
|
||||
|
||||
$this->execSQLNoData($sql,[DevisMentionConstant::CANCELED,$devisId]);
|
||||
}
|
||||
|
||||
public function updateDevisMention(int $devisId,string $mention){
|
||||
$sql = "UPDATE ".$this->tableprefix."devis as devis
|
||||
SET devis.mentions = ?
|
||||
WHERE devis.id = ?;";
|
||||
$this->execSQLNoData($sql,[$mention,$devisId]);
|
||||
}
|
||||
|
||||
public function getProduitDevisByDevisId($devisId){
|
||||
$sql = "SELECT *
|
||||
FROM ".$this->tableprefix ."produit_devis as produit_devis
|
||||
WHERE produit_devis.devis_id = ?;";
|
||||
|
||||
$produitDevisList = $this->execSQLNoJsonReturn(
|
||||
$sql,
|
||||
[$devisId]);
|
||||
|
||||
|
||||
return $produitDevisList;
|
||||
}
|
||||
|
||||
private function updateDefuntByName($defuntId,$requestedDefuntName){
|
||||
$sql= "UPDATE ".$this->tableprefix."defunt as defunt
|
||||
SET defunt.nom = ?
|
||||
WHERE defunt.id = ?";
|
||||
$this->execSQLNoData($sql,[$requestedDefuntName,$defuntId]);
|
||||
}
|
||||
|
||||
public function createOrUpdateDefuntByNameAndReturnDefuntId($defuntId,$currentDefuntName,$requestedDefuntName){
|
||||
if($defuntId != null){
|
||||
$defuntNameIsUpdated = $currentDefuntName != $requestedDefuntName;
|
||||
if($defuntNameIsUpdated){
|
||||
$this->updateDefuntByName($defuntId,$requestedDefuntName);
|
||||
}
|
||||
}
|
||||
else{
|
||||
$this->insertDefuntByName($requestedDefuntName);
|
||||
$defunt = $this->getLastDefuntIdByName($requestedDefuntName);
|
||||
$defuntId = $defunt['id'];
|
||||
}
|
||||
return $defuntId;
|
||||
}
|
||||
|
||||
public function updateDevisDefunt($devisId,$requestedDefuntId,$currentDefuntId = null){
|
||||
$defuntIsUpdated = $currentDefuntId != $requestedDefuntId;
|
||||
if($defuntIsUpdated){
|
||||
$sql= "UPDATE ".$this->tableprefix."devis as devis
|
||||
SET devis.id_defunt = ?
|
||||
WHERE devis.id = ?";
|
||||
$this->execSQLNoData($sql,[$requestedDefuntId,$devisId]);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateDevisClient($devisId,$requestedClientId,$currentClientId = null){
|
||||
$clientIsUpdated = $currentClientId != $requestedClientId;
|
||||
if($clientIsUpdated){
|
||||
$sql= "UPDATE ".$this->tableprefix."devis as devis
|
||||
SET devis.id_client = ?
|
||||
WHERE devis.id = ?";
|
||||
$this->execSQLNoData($sql,[$requestedClientId,$devisId]);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateDevisLieu($devisId,$requestedLieuId,$currentLieuId = null){
|
||||
$lieuIsUpdated = $currentLieuId != $requestedLieuId;
|
||||
if($lieuIsUpdated){
|
||||
$sql= "UPDATE ".$this->tableprefix."devis as devis
|
||||
SET devis.id_lieu = ?
|
||||
WHERE devis.id = ?";
|
||||
$this->execSQLNoData($sql,[$requestedLieuId,$devisId]);
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteDevisProduit($devisProductId){
|
||||
$sql = "DELETE FROM ".$this->tableprefix."produit_devis WHERE id = ?;";
|
||||
$this->execSQLNoData($sql, array($devisProductId));
|
||||
}
|
||||
|
||||
public function updateDevisArticles($devisId,$requestedArticlesIds){
|
||||
$currentDevisProducts = $this->getDevisProduits($devisId);
|
||||
$currentDevisProduitIds = [];
|
||||
//delete old product
|
||||
foreach($currentDevisProducts as $devisProduct){
|
||||
$currentDevisProduitIds[] = $devisProduct['produit_id'];
|
||||
$currentProductIsNotPartOfRequestedDevisProduct = !in_array($devisProduct['produit_id'],$requestedArticlesIds);
|
||||
if($currentProductIsNotPartOfRequestedDevisProduct){
|
||||
$this->deleteDevisProduit($devisProduct['id']);
|
||||
}
|
||||
}
|
||||
//add new requested product
|
||||
foreach($requestedArticlesIds as $requestedArticleId){
|
||||
$currentRequestedArticleIsNewArticleForDevis = !in_array($requestedArticleId,$currentDevisProduitIds);
|
||||
if($currentRequestedArticleIsNewArticleForDevis){
|
||||
$this->insertDevisArticle(devisId: $devisId, articleId: $requestedArticleId,idNextcloud: BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getThanatosByType($thanatoType = ThanatoTypeConstant::THANATO_TYPE_EMPLOYEE){
|
||||
$thanatoType = $thanatoType ?? ThanatoTypeConstant::THANATO_TYPE_EMPLOYEE;
|
||||
$sql = "SELECT * FROM ".$this->tableprefix."thanato as thanato
|
||||
WHERE thanato.fk_thanato_type_key = ?
|
||||
";
|
||||
|
||||
return $this->execSQL($sql,[$thanatoType]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
242
gestion/lib/Db/OrderBdd.php
Normal file
242
gestion/lib/Db/OrderBdd.php
Normal file
@ -0,0 +1,242 @@
|
||||
<?php
|
||||
namespace OCA\Gestion\Db;
|
||||
|
||||
use OCA\Gestion\Constants\OrderStatusConstant;
|
||||
use OCA\Gestion\Constants\ThanatoTypeConstant;
|
||||
use OCA\Gestion\Helpers\OrderHelpers;
|
||||
use OCP\IDBConnection;
|
||||
use \Datetime;
|
||||
use OCA\Gestion\Constants\BddConstant;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
class OrderBdd {
|
||||
private $orderTablePrefix;
|
||||
|
||||
private $defaultTablePrefix;
|
||||
private IDbConnection $pdo;
|
||||
|
||||
public function __construct(IDbConnection $db) {
|
||||
$this->orderTablePrefix = BddConstant::DEFAULT_TABLE_PREFIX ."gestion_";
|
||||
$this->defaultTablePrefix = BddConstant::DEFAULT_TABLE_PREFIX;
|
||||
$this->pdo = $db;
|
||||
}
|
||||
|
||||
private function execSQL($sql, $conditions){
|
||||
$stmt = $this->pdo->prepare($sql);
|
||||
$stmt->execute($conditions);
|
||||
$data = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
return json_encode($data);
|
||||
}
|
||||
|
||||
private function execSQLNoData($sql, $conditions){
|
||||
$stmt = $this->pdo->prepare($sql);
|
||||
$stmt->execute($conditions);
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
|
||||
private function execSQLNoJsonReturn($sql, $conditions){
|
||||
$stmt = $this->pdo->prepare($sql);
|
||||
$stmt->execute($conditions);
|
||||
$data = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function getLastOrderNumber(){
|
||||
$sql = "SELECT max(orders.order_number) as order_last_number FROM "
|
||||
.$this->orderTablePrefix."orders as orders";
|
||||
|
||||
$result = $this->execSQLNoJsonReturn($sql,[]);
|
||||
$lastNumber = 0;
|
||||
if(!empty($result)){
|
||||
$lastNumber = $result[0]["order_last_number"];
|
||||
}
|
||||
return $lastNumber;
|
||||
}
|
||||
|
||||
private function insertOrderProduct(int $orderId,int $productId){
|
||||
$sql = "INSERT INTO ".$this->orderTablePrefix."order_product (fk_order_id, fk_product_id, quantity) VALUES (?,?,1)";
|
||||
$this->execSQLNoData($sql, array($orderId, $productId));
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getOrderByCalendarUuid($calendarUuid){
|
||||
$sql = "SELECT * FROM ".$this->orderTablePrefix."orders as orders
|
||||
WHERE orders.fk_calendar_uuid = ? LIMIT 1";
|
||||
|
||||
$result = $this->execSQLNoJsonReturn($sql,[$calendarUuid]);
|
||||
if(!empty($result)){
|
||||
return $result[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function insertOrderProductsByProductIds(int $orderId,array $productIds){
|
||||
if (!empty($productIds)) {
|
||||
foreach ($productIds as $productId) {
|
||||
$this->insertOrderProduct(
|
||||
$orderId,
|
||||
$productId
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function insertOrderFromVCalendarPropertyAndReturnId($thanatoId,$clientId,$locationId,$defuntId,$calendarUuid,$date,$idNextCloud = BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD){
|
||||
$dateTime = new DateTime($date);
|
||||
|
||||
$lastOrderNumber = $this->getLastOrderNumber();
|
||||
$thisOrderNumber = $lastOrderNumber + 1;
|
||||
$thisOrderFullNumber = OrderHelpers::GetFullOrderNumberByDateAndOrderNumber($dateTime,$thisOrderNumber);
|
||||
$sql = "INSERT INTO `".$this->orderTablePrefix."orders` (
|
||||
`order_date`,
|
||||
`order_number`,
|
||||
`order_full_number`,
|
||||
`fk_defunt_id`,
|
||||
`fk_lieu_id`,
|
||||
`fk_client_id`,
|
||||
`fk_thanato_id`,
|
||||
`fk_order_status_key`,
|
||||
`fk_calendar_uuid`,
|
||||
`id_nextcloud`
|
||||
)
|
||||
VALUES (?,?,?,?,?,?,?,?,?,?);";
|
||||
$this->execSQLNoData($sql, array(
|
||||
$date,
|
||||
$thisOrderNumber,
|
||||
$thisOrderFullNumber,
|
||||
$defuntId,
|
||||
$locationId,
|
||||
$clientId,
|
||||
$thanatoId,
|
||||
OrderStatusConstant::ORDERED_KEY,
|
||||
$calendarUuid,
|
||||
$idNextCloud
|
||||
)
|
||||
);
|
||||
|
||||
$order = $this->getOrderByCalendarUuid($calendarUuid);
|
||||
return $order['id'];
|
||||
}
|
||||
|
||||
public function updateOrderStatus($orderId,$statusKey){
|
||||
$sql= "UPDATE ".$this->orderTablePrefix."orders as orders
|
||||
SET orders.fk_order_status_key = ?
|
||||
WHERE orders.id = ?";
|
||||
|
||||
$this->execSQLNoData($sql,[$statusKey,$orderId]);
|
||||
}
|
||||
public function getOrderProductsByOrderId($orderId){
|
||||
$sql = "SELECT
|
||||
order_product.id as order_product_id,
|
||||
produit.id as produit_id,
|
||||
produit.reference as produit_reference,
|
||||
produit.description as produit_description
|
||||
FROM ".$this->orderTablePrefix."order_product as order_product
|
||||
LEFT JOIN ".$this->orderTablePrefix."produit as produit on order_product.fk_product_id = produit.id
|
||||
WHERE order_product.fk_order_id = ?;";
|
||||
$produitsList = $this->execSQLNoJsonReturn(
|
||||
$sql,
|
||||
[$orderId]);
|
||||
|
||||
$finalProduitList = [];
|
||||
foreach($produitsList as $produit){
|
||||
if($produit['produit_id'] != null){
|
||||
$finalProduitList[] = $produit;
|
||||
}
|
||||
}
|
||||
return $finalProduitList;
|
||||
}
|
||||
|
||||
public function getOrdersWithDetails(){
|
||||
$sql = "SELECT
|
||||
orders.id,
|
||||
orders.order_date,
|
||||
orders.order_number,
|
||||
orders.order_full_number,
|
||||
orders.order_comment,
|
||||
orders.fk_defunt_id,
|
||||
orders.fk_lieu_id,
|
||||
orders.fk_client_id,
|
||||
orders.fk_thanato_id,
|
||||
orders.fk_order_status_key,
|
||||
thanato.id as thanato_id,
|
||||
thanato.nom as thanato_nom,
|
||||
thanato.prenom as thanato_prenom,
|
||||
client.id as client_id,
|
||||
client.nom as client_nom,
|
||||
client.prenom as client_prenom,
|
||||
client.entreprise as client_entreprise,
|
||||
defunt.id as defunt_id,
|
||||
defunt.nom as defunt_nom,
|
||||
lieu.id as lieu_id,
|
||||
lieu.adresse as lieu_adresse,
|
||||
lieu.nom as lieu_nom,
|
||||
order_status.status_label as order_status_label
|
||||
FROM "
|
||||
.$this->orderTablePrefix."orders as orders
|
||||
LEFT JOIN ".$this->orderTablePrefix."thanato as thanato on orders.fk_thanato_id = thanato.id
|
||||
LEFT JOIN ".$this->orderTablePrefix."client as client on orders.fk_client_id = client.id
|
||||
LEFT JOIN ".$this->orderTablePrefix."defunt as defunt on orders.fk_defunt_id = defunt.id
|
||||
LEFT JOIN ".$this->orderTablePrefix."lieu as lieu on orders.fk_lieu_id = lieu.id
|
||||
LEFT JOIN ".$this->orderTablePrefix."order_status as order_status on orders.fk_order_status_key = order_status.status_key
|
||||
ORDER BY orders.id DESC;
|
||||
"
|
||||
;
|
||||
|
||||
return $this->execSQLNoJsonReturn($sql,[]);
|
||||
}
|
||||
|
||||
public function createDefaultOrder($idNextCloud){
|
||||
$currentDatetime = new Datetime();
|
||||
$currentDate = $currentDatetime->format('Y-m-d');
|
||||
$lastOrderNumber = $this->getLastOrderNumber();
|
||||
$currentOrderNumber = $lastOrderNumber + 1;
|
||||
$currentOrderFullNumber = OrderHelpers::GetFullOrderNumberByDateAndOrderNumber($currentDatetime,$currentOrderNumber);
|
||||
|
||||
$sql = "INSERT INTO `".$this->orderTablePrefix."orders` (
|
||||
`order_date`,
|
||||
`order_number`,
|
||||
`order_full_number`,
|
||||
`fk_order_status_key`,
|
||||
`id_nextcloud`
|
||||
)
|
||||
VALUES (?,?,?,?,?);";
|
||||
$this->execSQLNoData($sql, array(
|
||||
$currentDate,
|
||||
$currentOrderNumber,
|
||||
$currentOrderFullNumber,
|
||||
OrderStatusConstant::NEW_KEY,
|
||||
$idNextCloud
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private function updateOrderNumber($orderId,$datetime){
|
||||
$lastOrderNumber = $this->getLastOrderNumber();
|
||||
$currentOrderNumber = $lastOrderNumber + 1;
|
||||
$currentOrderFullNumber = OrderHelpers::GetFullOrderNumberByDateAndOrderNumber($datetime,$currentOrderNumber);
|
||||
$sql = "UPDATE ".$this->orderTablePrefix."orders as orders
|
||||
SET orders.order_number = ?,orders.order_full_number = ?
|
||||
WHERE orders.id = ?
|
||||
";
|
||||
$this->execSQLNoData($sql,[$currentOrderNumber,$currentOrderFullNumber,$orderId]);
|
||||
}
|
||||
|
||||
private function updateOrderDate($orderId,$orderDate){
|
||||
$sql = "UPDATE ".$this->orderTablePrefix."orders as orders
|
||||
SET orders.order_date = ?
|
||||
WHERE orders.id = ?
|
||||
";
|
||||
|
||||
$this->execSQLNoData($sql,[$orderDate,$orderId]);
|
||||
}
|
||||
|
||||
public function updateOrderDateAndSetNewOrderNumber($orderId,$date){
|
||||
$this->updateOrderDate($orderId,$date);
|
||||
$datetime = new Datetime($date);
|
||||
$this->updateOrderNumber($orderId,$datetime);
|
||||
}
|
||||
|
||||
}
|
||||
14
gestion/lib/Helpers/OrderHelpers.php
Normal file
14
gestion/lib/Helpers/OrderHelpers.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace OCA\Gestion\Helpers;
|
||||
|
||||
class OrderHelpers
|
||||
{
|
||||
public static function GetFullOrderNumberByDateAndOrderNumber($datetime,$orderNumber,$prefix = "BDC",$companyKey = "H2F"){
|
||||
$year = $datetime->format('y');
|
||||
$month = $datetime->format('m');
|
||||
$orderFullNumber = str_pad($orderNumber, 3, '0', STR_PAD_LEFT);
|
||||
|
||||
return "{$prefix} {$companyKey}/{$year}/{$month}/{$orderFullNumber}";
|
||||
}
|
||||
}
|
||||
57
gestion/lib/Listener/CalendarObjectMovedToTrashListener.php
Normal file
57
gestion/lib/Listener/CalendarObjectMovedToTrashListener.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* @copyright 2022 Christoph Wurst <christoph@winzerhof-wurst.at>
|
||||
*
|
||||
* @author 2022 Christoph Wurst <christoph@winzerhof-wurst.at>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace OCA\Gestion\Listener;
|
||||
|
||||
use OCA\DAV\Events\CalendarObjectMovedToTrashEvent;
|
||||
use OCA\Gestion\Service\GestionService;
|
||||
use OCP\EventDispatcher\Event;
|
||||
use OCP\EventDispatcher\IEventListener;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class CalendarObjectMovedToTrashListener implements IEventListener {
|
||||
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
/** @var GestionService */
|
||||
private $gestionService;
|
||||
|
||||
public function __construct(
|
||||
LoggerInterface $logger,GestionService $gestionService) {
|
||||
$this->logger = $logger;
|
||||
$this->gestionService = $gestionService;
|
||||
}
|
||||
|
||||
public function handle(Event $event): void {
|
||||
if (!($event instanceof CalendarObjectMovedToTrashEvent)) {
|
||||
return;
|
||||
}
|
||||
$calendarData = $event->getObjectData();
|
||||
$vCalendarString = $calendarData["calendardata"];
|
||||
$this->gestionService->HandleCalendarObjectMovedToTrash($vCalendarString);
|
||||
}
|
||||
|
||||
}
|
||||
58
gestion/lib/Listener/CalendarObjectUpdatedListener.php
Normal file
58
gestion/lib/Listener/CalendarObjectUpdatedListener.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* @copyright 2022 Christoph Wurst <christoph@winzerhof-wurst.at>
|
||||
*
|
||||
* @author 2022 Christoph Wurst <christoph@winzerhof-wurst.at>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace OCA\Gestion\Listener;
|
||||
|
||||
use OCA\DAV\Events\CalendarObjectCreatedEvent;
|
||||
use OCA\DAV\Events\CalendarObjectUpdatedEvent;
|
||||
use OCA\Gestion\Service\GestionService;
|
||||
use OCP\EventDispatcher\Event;
|
||||
use OCP\EventDispatcher\IEventListener;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class CalendarObjectUpdatedListener implements IEventListener {
|
||||
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
/** @var GestionService */
|
||||
private $gestionService;
|
||||
|
||||
public function __construct(
|
||||
LoggerInterface $logger,GestionService $gestionService) {
|
||||
$this->logger = $logger;
|
||||
$this->gestionService = $gestionService;
|
||||
}
|
||||
|
||||
public function handle(Event $event): void {
|
||||
if (!($event instanceof CalendarObjectUpdatedEvent)) {
|
||||
return;
|
||||
}
|
||||
$calendarData = $event->getObjectData();
|
||||
$vCalendarString = $calendarData["calendardata"];
|
||||
$this->gestionService->HandleUpdatedCalendarObject($vCalendarString);
|
||||
}
|
||||
|
||||
}
|
||||
@ -26,7 +26,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace OCA\Gestion\Service;
|
||||
|
||||
use OCA\Gestion\Constants\DevisMentionConstant;
|
||||
use OCA\Gestion\Constants\OrderStatusConstant;
|
||||
use OCA\Gestion\Constants\ThanatoTypeConstant;
|
||||
use OCA\Gestion\Db\Bdd;
|
||||
use OCA\Gestion\Db\OrderBdd;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use OCA\Gestion\Helpers\VCalendarHelpers;
|
||||
|
||||
@ -37,9 +41,14 @@ class GestionService {
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
/** @var \OCA\Gestion\Db\OrderBdd */
|
||||
private $orderBdd;
|
||||
|
||||
public function __construct(
|
||||
Bdd $gestionBdd,
|
||||
OrderBdd $orderBdd,
|
||||
LoggerInterface $logger) {
|
||||
$this->orderBdd = $orderBdd;
|
||||
$this->logger = $logger;
|
||||
$this->gestionBdd = $gestionBdd;
|
||||
}
|
||||
@ -54,6 +63,29 @@ class GestionService {
|
||||
return $summaryValue;
|
||||
}
|
||||
|
||||
private function GetThanatoFromVCalendarString(string $vCalendarString){
|
||||
$thanato = null;
|
||||
$thanatoNames = $this->GetAttendeesNameFromVCalendarString($vCalendarString);
|
||||
if(count($thanatoNames) > 0){
|
||||
$thanatoName = $thanatoNames[0];
|
||||
$thanatoFromDb = $this->gestionBdd->getThanatoByUserUuid($thanatoName);
|
||||
if($thanatoFromDb != null){
|
||||
$thanato = $thanatoFromDb;
|
||||
}
|
||||
}
|
||||
else{
|
||||
//get from calendar object
|
||||
$organizerName = $this->getPrincipalUsernameFromVCalendarString($vCalendarString);
|
||||
if($organizerName != null){
|
||||
$thanatoFromDb = $this->gestionBdd->getThanatoByUserUuid($organizerName);
|
||||
if($thanatoFromDb != null){
|
||||
$thanato = $thanatoFromDb;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $thanato;
|
||||
}
|
||||
|
||||
private function GetThanatoIdFromVCalendarString(string $vCalendarString)
|
||||
{
|
||||
$thanatoId = 0;
|
||||
@ -114,11 +146,55 @@ class GestionService {
|
||||
return $calendarStartDate;
|
||||
}
|
||||
|
||||
public function HandleCreatedCalendarObject(string $vCalendarString){
|
||||
private function IsOrderAlreadyCreated($calendarUuid){
|
||||
$order = $this->orderBdd->getOrderByCalendarUuid($calendarUuid);
|
||||
return $order != null;
|
||||
}
|
||||
|
||||
private function CreateOrderFromVCalendarString($vCalendarString,$thanatoId){
|
||||
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
||||
$orderAlreadyCreated = $this->IsOrderAlreadyCreated($calendarUuid);
|
||||
if($orderAlreadyCreated){
|
||||
return;
|
||||
}
|
||||
$nextcloudUser = $this->GetThanatoNameFromVCalendarString($vCalendarString);
|
||||
$calendarSummary = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
||||
$clientId = $this->GetClientIdFromVCalendarString($vCalendarString);
|
||||
$locationId = $this->GetLocationIdFromVCalendarString($vCalendarString);
|
||||
$calendarStartDate = $this->GetCalendarDateFromVCalendarString($vCalendarString);
|
||||
$defuntId = $this->gestionBdd->insertDefuntByNameAndReturnId($calendarSummary);
|
||||
$orderId = $this->orderBdd->insertOrderFromVCalendarPropertyAndReturnId(
|
||||
$thanatoId,
|
||||
$clientId,
|
||||
$locationId,
|
||||
$defuntId,
|
||||
$calendarUuid,
|
||||
$calendarStartDate,
|
||||
$nextcloudUser);
|
||||
$productsValue = $this->GetArticlesNameFromVCalendarString($vCalendarString);
|
||||
if(!empty($productsValue)){
|
||||
$productIds = $this->gestionBdd->getArticleIdsByArticleReferences($productsValue);
|
||||
$this->orderBdd->insertOrderProductsByProductIds($orderId, $productIds);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function HandleCreatedCalendarObject(string $vCalendarString){
|
||||
$thanato = $this->GetThanatoFromVCalendarString($vCalendarString);
|
||||
if($thanato != null){
|
||||
$thanatoId = $thanato["id"];
|
||||
$thanatoIsSubcontractor = $thanato["fk_thanato_type_key"] === ThanatoTypeConstant::THANATO_TYPE_SUBCONTRACTOR;
|
||||
if($thanatoIsSubcontractor){
|
||||
$this->CreateOrderFromVCalendarString($vCalendarString,$thanatoId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$thanatoId = 0;
|
||||
}
|
||||
$calendarSummary = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
||||
$clientId = $this->GetClientIdFromVCalendarString($vCalendarString);
|
||||
$locationId = $this->GetLocationIdFromVCalendarString($vCalendarString);
|
||||
$thanatoId = $this->GetThanatoIdFromVCalendarString($vCalendarString);
|
||||
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
||||
$userName = $this->GetThanatoNameFromVCalendarString($vCalendarString);
|
||||
$devisAlreadyCreated = $this->IsDevisAlreadyCreated($clientId,$locationId,$thanatoId,$calendarSummary,$calendarUuid);
|
||||
@ -172,4 +248,79 @@ class GestionService {
|
||||
$mapped = array_map('trim', $articles);
|
||||
return $mapped;
|
||||
}
|
||||
|
||||
public function HandleCalendarObjectMovedToTrash(string $vCalendarString){
|
||||
$thanato = $this->GetThanatoFromVCalendarString($vCalendarString);
|
||||
if($thanato == null){
|
||||
return;
|
||||
}
|
||||
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
||||
$thanatoIsSubcontractor = $thanato["fk_thanato_type_key"] === ThanatoTypeConstant::THANATO_TYPE_SUBCONTRACTOR;
|
||||
if($thanatoIsSubcontractor){
|
||||
$order = $this->orderBdd->getOrderByCalendarUuid($calendarUuid);
|
||||
if($order != null){
|
||||
$this->orderBdd->updateOrderStatus($order['id'],OrderStatusConstant::CANCELED_KEY);
|
||||
}
|
||||
}
|
||||
else{
|
||||
$devis = $this->gestionBdd->getDevisByCalendarUuid($calendarUuid);
|
||||
if($devis != null){
|
||||
$this->gestionBdd->updateDevisMentionToCanceled($devis['id']);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private function CheckIfDevisIsAlreadyUpdated($devis,$vCalendarString){
|
||||
$requestedDefuntName = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
||||
$requestedClientId = $this->GetClientIdFromVCalendarString($vCalendarString);
|
||||
$requestLocationId = $this->GetLocationIdFromVCalendarString($vCalendarString);
|
||||
$requestedArticleReferences = $this->GetArticlesNameFromVCalendarString($vCalendarString);
|
||||
$requestedArticleIds = $this->gestionBdd->getArticleIdsByArticleReferences($requestedArticleReferences);
|
||||
$articleDevis = $this->gestionBdd->getProduitDevisByDevisId($devis['id']);
|
||||
$articleDevisIds = [];
|
||||
foreach($articleDevis as $currentArticleDevis){
|
||||
$articleDevisIds[] = $currentArticleDevis['produit_id'];
|
||||
}
|
||||
sort($requestedArticleIds);
|
||||
sort($articleDevisIds);
|
||||
|
||||
return
|
||||
$devis['defunt_nom'] == $requestedDefuntName &&
|
||||
$devis['client_id'] == $requestedClientId &&
|
||||
$devis['lieu_id'] == $requestLocationId &&
|
||||
$requestedArticleIds == $articleDevisIds;
|
||||
}
|
||||
|
||||
private function UpdateDevisDataByVCalendarString($devis,$vCalendarString){
|
||||
$requestedDefuntName = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
||||
$defuntId = $this->gestionBdd->createOrUpdateDefuntByNameAndReturnDefuntId($devis['defunt_id'],$devis['defunt_nom'],$requestedDefuntName);
|
||||
$this->gestionBdd->updateDevisDefunt($devis['id'],$defuntId,$devis['defunt_id']);
|
||||
|
||||
$requestedClientId = $this->GetClientIdFromVCalendarString($vCalendarString);
|
||||
$this->gestionBdd->updateDevisClient($devis['id'],$requestedClientId,$devis['client_id']);
|
||||
|
||||
$requestLocationId = $this->GetLocationIdFromVCalendarString($vCalendarString);
|
||||
$this->gestionBdd->updateDevisLieu($devis['id'],$requestLocationId,$devis['lieu_id']);
|
||||
|
||||
$articlesValue = $this->GetArticlesNameFromVCalendarString($vCalendarString);
|
||||
if(!empty($articlesValue)){
|
||||
$articleIds = $this->gestionBdd->getArticleIdsByArticleReferences($articlesValue);
|
||||
$this->gestionBdd->updateDevisArticles($devis['id'],$articleIds);
|
||||
}
|
||||
}
|
||||
|
||||
public function HandleUpdatedCalendarObject(string $vCalendarString){
|
||||
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
||||
$devis = $this->gestionBdd->getDevisByCalendarUuid($calendarUuid);
|
||||
if($devis != null){
|
||||
$this->gestionBdd->updateDevisMention($devis['id'],DevisMentionConstant::NEW);
|
||||
$isDevisAlreadyUpdated = $this->CheckIfDevisIsAlreadyUpdated($devis,$vCalendarString);
|
||||
if($isDevisAlreadyUpdated){
|
||||
return true;
|
||||
}
|
||||
$this->UpdateDevisDataByVCalendarString($devis,$vCalendarString);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
60
gestion/lib/Service/NavigationService.php
Normal file
60
gestion/lib/Service/NavigationService.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Calendar App
|
||||
*
|
||||
* @copyright 2021 Anna Larch <anna.larch@gmx.net>
|
||||
*
|
||||
* @author Anna Larch <anna.larch@gmx.net>
|
||||
* @author Richard Steinmetz <richard@steinmetz.cloud>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Gestion\Service;
|
||||
|
||||
use OCP\IURLGenerator;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class NavigationService {
|
||||
private $urlGenerator;
|
||||
|
||||
public function __construct(IURLGenerator $urlGenerator) {
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
}
|
||||
|
||||
public function getNavigationLink(){
|
||||
return array(
|
||||
"index" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.index"),
|
||||
"defunt" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.defunt"),
|
||||
"devis" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.devis"),
|
||||
"thanatopracteur" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.thanatopracteur"),
|
||||
"trajet" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.trajet"),
|
||||
"lieu" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.lieu"),
|
||||
"facture" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.facture"),
|
||||
"produit" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.produit"),
|
||||
"article" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.article"),
|
||||
"bibliotheque" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.bibliotheque"),
|
||||
"config" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.config"),
|
||||
"isConfig" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.isConfig"),
|
||||
"statistique" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.statistique"),
|
||||
"legalnotice" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.legalnotice"),
|
||||
"france" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.france"),
|
||||
"orders" => $this->urlGenerator->linkToRouteAbsolute("gestion.order.order"),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
70
gestion/lib/Service/Order/OrderService.php
Normal file
70
gestion/lib/Service/Order/OrderService.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Calendar App
|
||||
*
|
||||
* @copyright 2021 Anna Larch <anna.larch@gmx.net>
|
||||
*
|
||||
* @author Anna Larch <anna.larch@gmx.net>
|
||||
* @author Richard Steinmetz <richard@steinmetz.cloud>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Gestion\Service\Order;
|
||||
|
||||
use OCA\Gestion\Db\OrderBdd;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class OrderService {
|
||||
/** @var \OCA\Gestion\Db\OrderBdd */
|
||||
private $orderBdd;
|
||||
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
public function __construct(
|
||||
OrderBdd $orderBdd,
|
||||
LoggerInterface $logger) {
|
||||
$this->logger = $logger;
|
||||
$this->orderBdd = $orderBdd;
|
||||
}
|
||||
|
||||
public function getOrdersWithDetailsAsArray(){
|
||||
$orders = $this->orderBdd->getOrdersWithDetails();
|
||||
foreach($orders as &$order){
|
||||
$currentOrderProductsReferenceAsString = "";
|
||||
$currentOrderProductsReferences = [];
|
||||
$currentOrderProducts = $this->orderBdd->getOrderProductsByOrderId($order['id']);
|
||||
foreach($currentOrderProducts as $currentProduct){
|
||||
$currentOrderProductsReferences[] = $currentProduct["produit_reference"];
|
||||
}
|
||||
if(!empty($currentOrderProductsReferences)){
|
||||
$currentOrderProductsReferenceAsString = implode('-',$currentOrderProductsReferences);
|
||||
}
|
||||
$order["product_references"] = $currentOrderProductsReferenceAsString;
|
||||
}
|
||||
return $orders;
|
||||
}
|
||||
|
||||
public function createDefaultOrder($idNextcloud){
|
||||
$this->orderBdd->createDefaultOrder($idNextcloud);
|
||||
}
|
||||
|
||||
public function updateOrderDate($orderId,$date){
|
||||
$this->orderBdd->updateOrderDateAndSetNewOrderNumber($orderId,$date);
|
||||
}
|
||||
}
|
||||
41
gestion/lib/Sql/20250206-ADD-ORDER-TABLES-FEATURES.sql
Normal file
41
gestion/lib/Sql/20250206-ADD-ORDER-TABLES-FEATURES.sql
Normal file
@ -0,0 +1,41 @@
|
||||
CREATE TABLE IF NOT EXISTS oc_gestion_order_status(
|
||||
status_key VARCHAR(100) PRIMARY KEY NOT NULL,
|
||||
status_label VARCHAR(100) DEFAULT ''
|
||||
);
|
||||
|
||||
INSERT INTO oc_gestion_order_status (status_key, status_label)
|
||||
VALUES
|
||||
('NEW', 'Nouveau'),
|
||||
('ORDERED', 'Commandé'),
|
||||
('CANCELED', 'Annulé');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS oc_gestion_orders(
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
order_date DATE NOT NULL,
|
||||
order_number int NOT NULL,
|
||||
order_full_number VARCHAR(100) NOT NULL,
|
||||
order_comment VARCHAR(100) DEFAULT '',
|
||||
fk_defunt_id int,
|
||||
fk_lieu_id int,
|
||||
fk_client_id int,
|
||||
fk_thanato_id int,
|
||||
fk_order_status_key VARCHAR(100),
|
||||
fk_calendar_uuid VARCHAR(100),
|
||||
id_nextcloud VARCHAR(100)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS oc_gestion_order_product(
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_order_id INT NOT NULL,
|
||||
fk_product_id INT NOT NULL,
|
||||
quantity INT NOT NULL,
|
||||
id_nextcloud VARCHAR(100)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS oc_gestion_thanato_product_discount(
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_thanato_id INT NOT NULL,
|
||||
fk_product_id INT NOT NULL,
|
||||
ht_price INT NOT NULL,
|
||||
id_nextcloud VARCHAR(100)
|
||||
);
|
||||
9
gestion/src/js/constants/invoiceConstant.js
Normal file
9
gestion/src/js/constants/invoiceConstant.js
Normal file
@ -0,0 +1,9 @@
|
||||
export const FacturedDevisMentionConstant = "facturé";
|
||||
export const FacturedDevisMentionConstantFormatted = "facturé";
|
||||
export const DefaultDevisMentionConstant = "Mention";
|
||||
export const NewDevisMentionConstant = "Nouveau";
|
||||
export const CanceledDevisMentionConstant = "CANCELED";
|
||||
|
||||
export const FactureStatusPaid = "PAID";
|
||||
export const FactureStatusPending = "PENDING";
|
||||
export const FactureStatusCanceled = "CANCELED";
|
||||
3
gestion/src/js/constants/orderConstant.js
Normal file
3
gestion/src/js/constants/orderConstant.js
Normal file
@ -0,0 +1,3 @@
|
||||
export const OrderStatusOrdered = "ORDERED";
|
||||
export const OrderStatusNew = "NEW";
|
||||
export const OrderStatusCanceled = "CANCELED";
|
||||
2
gestion/src/js/constants/thanatoTypeConstant.js
Normal file
2
gestion/src/js/constants/thanatoTypeConstant.js
Normal file
@ -0,0 +1,2 @@
|
||||
export const ThanatoEmployeeTypeKey = "EMPLOYEE";
|
||||
export const ThanatoSubcontractorTypeKey = "SUBCONTRACTOR";
|
||||
@ -14,6 +14,8 @@ import { Thanatopracteur } from "../objects/thanatopracteur.mjs";
|
||||
import { Article } from "../objects/article.mjs";
|
||||
import { Defunt } from "../objects/defunt.mjs";
|
||||
import { Bibliotheque } from "../objects/bibliotheque.mjs";
|
||||
import { Order } from "../objects/order.mjs";
|
||||
import { ThanatoEmployeeTypeKey,ThanatoSubcontractorTypeKey } from "../constants/thanatoTypeConstant";
|
||||
|
||||
var choose_folder = t('gestion', 'Choose work folder');
|
||||
|
||||
@ -230,6 +232,7 @@ $('body').on('click', '.deleteItem', function () {
|
||||
if (modifier === "article") { Article.loadArticleDT(dt); }
|
||||
if (modifier === "defunt") { Defunt.loadDefuntDT(dt); }
|
||||
if (modifier === "bibliotheque") { Bibliotheque.loadBibliothequeDT(dt); }
|
||||
if (modifier === "orders") { Order.loadOrderDatatable(dt); }
|
||||
});
|
||||
|
||||
$('body').on('change', '.listClient,.listDevis', function () {
|
||||
|
||||
24
gestion/src/js/listener/orderListener.js
Normal file
24
gestion/src/js/listener/orderListener.js
Normal file
@ -0,0 +1,24 @@
|
||||
import DataTable from "datatables.net";
|
||||
import { Order } from "../objects/order.mjs";
|
||||
import { updateOrderDate } from "../modules/order/orderAjaxRequest.mjs";
|
||||
import { Thanatopracteur } from "../objects/thanatopracteur.mjs";
|
||||
import { ThanatoSubcontractorTypeKey } from "../constants/thanatoTypeConstant";
|
||||
|
||||
$('body').on('change', '.orderInputDate', function () {
|
||||
var dt = new DataTable('.tabledt');
|
||||
var id = $(this).data('id');
|
||||
var val = this.value;
|
||||
updateOrderDate(id,val);
|
||||
Order.loadOrderDatatable(dt);
|
||||
})
|
||||
|
||||
document.body.addEventListener('click', e => {
|
||||
if(e.target.className.includes("getThanatosSubcontractor")){
|
||||
Thanatopracteur.loadThanatosListedByTypeIntoSelect(e,ThanatoSubcontractorTypeKey);
|
||||
return;
|
||||
}
|
||||
if("createDefaultOrder"=== e.target.id){
|
||||
Order.createDefaultOrder(new DataTable('.tabledt'));
|
||||
return;
|
||||
}
|
||||
});
|
||||
@ -816,4 +816,5 @@ export function exportCareCertificate(defuntIdPayload) {
|
||||
showMessage(t('gestion', 'There is an error'));
|
||||
error(response);
|
||||
});
|
||||
|
||||
};
|
||||
26
gestion/src/js/modules/order/orderAjaxRequest.mjs
Normal file
26
gestion/src/js/modules/order/orderAjaxRequest.mjs
Normal file
@ -0,0 +1,26 @@
|
||||
import { showSuccess, showError } from "@nextcloud/dialogs";
|
||||
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
|
||||
import { baseUrl } from "../mainFunction.mjs";
|
||||
|
||||
/**
|
||||
* Update order date
|
||||
* @param orderId
|
||||
* @param dateValue
|
||||
*/
|
||||
export function updateOrderDate(orderId,dateValue) {
|
||||
var payload = {
|
||||
orderDate: dateValue
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl + '/order/'+orderId+'/updateDate',
|
||||
type: 'PUT',
|
||||
async: false,
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify(payload)
|
||||
}).done(function (response, code) {
|
||||
showSuccess(t('gestion', 'Succès'));
|
||||
}).fail(function (response, code) {
|
||||
showError(t('gestion', 'Erreur dans la mise à jour de la date du commande'));
|
||||
});
|
||||
}
|
||||
@ -194,7 +194,7 @@ export class Client {
|
||||
);
|
||||
|
||||
var parentElement = el.target.parentElement
|
||||
parentElement.innerHTML = el.target.value + " " + el.target.options[el.target.selectedIndex].text;
|
||||
parentElement.innerHTML = el.target.options[el.target.selectedIndex].text;
|
||||
parentElement.dataset.current = el.target.value;
|
||||
}else{
|
||||
var parentElement = el.target.parentElement
|
||||
|
||||
@ -142,7 +142,7 @@ export class Defunt {
|
||||
);
|
||||
|
||||
var parentElement = el.target.parentElement
|
||||
parentElement.innerHTML = el.target.value + " " + el.target.options[el.target.selectedIndex].text;
|
||||
parentElement.innerHTML = el.target.options[el.target.selectedIndex].text;
|
||||
parentElement.dataset.current = el.target.value;
|
||||
}else{
|
||||
var parentElement = el.target.parentElement
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { generateUrl } from "@nextcloud/router";
|
||||
import { updateDB } from "../modules/ajaxRequest.mjs";
|
||||
import { baseUrl, checkSelectPurJs, LoadDT, showDone } from "../modules/mainFunction.mjs";
|
||||
|
||||
import { NewDevisMentionConstant,FacturedDevisMentionConstant,DefaultDevisMentionConstant,CanceledDevisMentionConstant, FacturedDevisMentionConstantFormatted } from "../constants/invoiceConstant.js";
|
||||
export class Devis {
|
||||
|
||||
/**
|
||||
@ -26,10 +26,50 @@ export class Devis {
|
||||
this.nomThanato = ((myresp.nom_thanato == null || myresp.prenom_thanato.length === 0) ? '-' : `${myresp.nom_thanato +' '+ myresp.prenom_thanato}`);
|
||||
this.version = ((myresp.version == null || myresp.version.length === 0) ? '-' : myresp.version);
|
||||
this.lieu = ((myresp.lieu == null || myresp.lieu.length === 0) ? '-' : myresp.lieu);
|
||||
this.mentions = ((myresp.mentions == null || myresp.mentions.length === 0) ? '-' : myresp.mentions);
|
||||
this.mentions = Devis.getDevisMentionFromApiResponse(myresp);
|
||||
this.baseUrl = generateUrl(`/apps/gestion/devis/${this.id}/show`);
|
||||
}
|
||||
|
||||
static getDevisMentionLabelFromMention(mention){
|
||||
let labelValue = mention;
|
||||
switch (mention) {
|
||||
case FacturedDevisMentionConstant:
|
||||
labelValue = "Facturé"
|
||||
break;
|
||||
case CanceledDevisMentionConstant:
|
||||
labelValue = "Annulé"
|
||||
break;
|
||||
case FacturedDevisMentionConstantFormatted:
|
||||
labelValue = "Facturé"
|
||||
break;
|
||||
default:
|
||||
labelValue = mention
|
||||
}
|
||||
return labelValue;
|
||||
}
|
||||
|
||||
static getDevisMentionFromApiResponse(myresp){
|
||||
let mention = "-";
|
||||
if(myresp.mentions != null && myresp.mentions.length > 0){
|
||||
mention = myresp.mentions;
|
||||
}
|
||||
return mention;
|
||||
}
|
||||
|
||||
static getDevisMentionCssStyle(mention){
|
||||
let style = "display:inline; border-radius: 5px; padding: 8px;";
|
||||
if(mention === FacturedDevisMentionConstant || mention === FacturedDevisMentionConstantFormatted){
|
||||
style += " background-color:green !important; color: white";
|
||||
}
|
||||
else if(mention === CanceledDevisMentionConstant){
|
||||
style += " background-color:red !important; color: white";
|
||||
}
|
||||
else{
|
||||
style += " background-color:yellow !important";
|
||||
}
|
||||
return style;
|
||||
}
|
||||
|
||||
/**undefined
|
||||
* Get datatable row for a devis
|
||||
*/
|
||||
@ -44,7 +84,7 @@ export class Devis {
|
||||
'<div class="loadSelect_listclient" data-table="devis" data-column="id_client" data-id="' + this.id + '" data-current="' + this.cid + '">'+ this.cid + ' (' + this.prenom + ' ' + this.nom + ')</div>',
|
||||
'<div class="loadSelect_listthanato" data-table="devis" data-column="id_thanato" data-id="' + this.id + '" data-current="' + this.tid + '">'+ this.tid + ' (' + this.nomThanato+ ')</div>',
|
||||
'<div class="loadSelect_listlieu" data-table="devis" data-column="id_lieu" data-id="' + this.id + '" data-current="' + this.lid + '">' + this.lieu + '</div>',
|
||||
(this.mentions == "facturé")?('<div data-table="devis" data-column="mentions" data-id="' + this.id +'" style="display:inline; border-radius: 5px; padding: 8px;background-color:green !important; color: white">'+ this.mentions + '</div>'):('<div data-table="devis" data-column="mentions" data-id="' + this.id +'" style="display:inline; border-radius: 5px; padding: 8px;background-color:yellow !important">'+ this.mentions + '</div>'),
|
||||
'<div data-table="devis" data-column="mentions" data-id="' + this.id +'" style="'+ Devis.getDevisMentionCssStyle(this.mentions) +'">' +Devis.getDevisMentionLabelFromMention(this.mentions) + '</div>',
|
||||
'<div style="display:inline-block;margin-right:0px;width:80%;"><a href="' + this.baseUrl + '"><button>' + t('gestion', 'Open') + '</button></a></div><div data-modifier="devis" data-id=' + this.id + ' data-table="devis" style="display:inline-block;margin-right:0px;" class="deleteItem icon-delete"></div>'
|
||||
];
|
||||
return myrow;
|
||||
@ -94,7 +134,11 @@ export class Devis {
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
oReq.onload = function(e){
|
||||
if (this.status == 200) {
|
||||
let devis_temp = (JSON.parse(JSON.parse(this.response))).filter((d)=>(d.mentions != "facturé"));
|
||||
let devis_temp = (JSON.parse(JSON.parse(this.response))).filter((d)=>(
|
||||
d.mentions != FacturedDevisMentionConstant &&
|
||||
d.mentions != FacturedDevisMentionConstantFormatted &&
|
||||
d.mentions != CanceledDevisMentionConstant
|
||||
));
|
||||
devis_temp = JSON.stringify(JSON.stringify(devis_temp));
|
||||
callback(JSON.parse(devis_temp));
|
||||
}else{
|
||||
|
||||
138
gestion/src/js/objects/order.mjs
Normal file
138
gestion/src/js/objects/order.mjs
Normal file
@ -0,0 +1,138 @@
|
||||
import { showError } from "@nextcloud/dialogs";
|
||||
import { baseUrl, checkSelectPurJs, LoadDT, showDone } from "../modules/mainFunction.mjs";
|
||||
import { OrderStatusOrdered,OrderStatusNew,OrderStatusCanceled } from "../constants/orderConstant.js";
|
||||
export class Order {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param myresp instantiate order object
|
||||
*/
|
||||
constructor(myresp) {
|
||||
this.id = myresp.id;
|
||||
this.orderDate = ((myresp.order_date == null || myresp.order_date.length === 0) ? '-' : myresp.order_date);
|
||||
this.orderFullNumber = ((myresp.order_full_number == null || myresp.order_full_number.length === 0) ? '-' : myresp.order_full_number);
|
||||
this.defuntName = ((myresp.defunt_nom == null || myresp.defunt_nom.length === 0) ? '-' : myresp.defunt_nom);
|
||||
this.thanatoFullName = Order.getThanatoFullname(myresp);
|
||||
this.clientFullName = Order.getClientFullname(myresp);
|
||||
this.locationName = ((myresp.lieu_nom == null || myresp.lieu_nom.length === 0) ? '-' : myresp.lieu_nom);
|
||||
this.statusLabel = ((myresp.order_status_label == null || myresp.order_status_label.length === 0) ? '-' : myresp.order_status_label);
|
||||
this.defuntId = ((myresp.fk_defunt_id == null || myresp.fk_defunt_id.length === 0) ? '-' : myresp.fk_defunt_id);
|
||||
this.thanatoId = ((myresp.fk_thanato_id == null || myresp.fk_thanato_id.length === 0) ? '-' : myresp.fk_thanato_id);
|
||||
this.clientId = ((myresp.fk_client_id == null || myresp.fk_client_id.length === 0) ? '-' : myresp.fk_client_id);
|
||||
this.locationId = ((myresp.fk_lieu_id == null || myresp.fk_lieu_id.length === 0) ? '-' : myresp.fk_lieu_id);
|
||||
this.statusKey = ((myresp.fk_order_status_key == null || myresp.fk_order_status_key.length === 0) ? '-' : myresp.fk_order_status_key);
|
||||
this.productReferences = ((myresp.product_references == null || myresp.product_references.length === 0) ? '-' : myresp.product_references);
|
||||
}
|
||||
|
||||
static getClientFullname(myresp){
|
||||
let clientPrenom = '';
|
||||
let clientNom = '';
|
||||
let clientFullName = '';
|
||||
if(myresp.client_nom != null && myresp.client_nom.length != 0){
|
||||
clientNom = myresp.client_nom;
|
||||
clientFullName += clientNom;
|
||||
}
|
||||
if(myresp.client_prenom != null && myresp.client_prenom.length != 0){
|
||||
clientPrenom = myresp.client_prenom;
|
||||
if(clientNom.length > 0 && clientPrenom.length > 0){
|
||||
clientFullName += ' '
|
||||
}
|
||||
clientFullName += clientPrenom;
|
||||
}
|
||||
return (clientFullName.length === 0) ? '-' : clientFullName;
|
||||
}
|
||||
|
||||
static getThanatoFullname(myresp){
|
||||
let thanatoPrenom = '';
|
||||
let thanatoNom = '';
|
||||
let thanatoFullName = '';
|
||||
if(myresp.thanato_nom != null && myresp.thanato_nom.length != 0){
|
||||
thanatoNom = myresp.thanato_nom;
|
||||
thanatoFullName += thanatoNom;
|
||||
}
|
||||
if(myresp.thanato_prenom != null && myresp.thanato_prenom.length != 0){
|
||||
thanatoPrenom = myresp.thanato_prenom;
|
||||
if(thanatoNom.length > 0 && thanatoPrenom.length > 0){
|
||||
thanatoFullName += ' '
|
||||
}
|
||||
thanatoFullName += thanatoPrenom;
|
||||
}
|
||||
return (thanatoFullName.length === 0) ? '-' : thanatoFullName;
|
||||
}
|
||||
|
||||
static getComandStatusCssSytle(orderStatusKey){
|
||||
let style = "display:inline; border-radius: 5px; padding: 8px;";
|
||||
if(orderStatusKey === OrderStatusOrdered){
|
||||
style += " background-color:green !important; color: white";
|
||||
}
|
||||
else if(orderStatusKey === OrderStatusCanceled){
|
||||
style += " background-color:red !important; color: white";
|
||||
}
|
||||
else{
|
||||
style += " background-color:yellow !important";
|
||||
}
|
||||
return style;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get datatable row for an order
|
||||
*/
|
||||
getDTRow() {
|
||||
let orderRow = [
|
||||
'<input class="orderToExport" data-id= '+ this.id + ' type="checkbox" name="orderToExport" value="' + this.id + '"/>',
|
||||
'<div>' + this.id + '</div>',
|
||||
'<input style="margin:0;padding:0;" class="orderInputDate" type="date" value=' + this.orderDate + ' data-id="' + this.id + '"/>',
|
||||
'<div>' + this.orderFullNumber + '</div>',
|
||||
'<div class="loadSelect_listdefunt" data-table="orders" data-column="fk_defunt_id" data-id="' + this.id + '" data-current="' + this.defuntId + '">'+ this.defuntName + '</div>',
|
||||
'<div class="loadSelect_listclient" data-table="orders" data-column="fk_client_id" data-id="' + this.id + '" data-current="' + this.clientId + '">'+ this.clientFullName + '</div>',
|
||||
'<div class="getThanatosSubcontractor" data-table="orders" data-column="fk_thanato_id" data-id="' + this.id + '" data-current="' + this.thanatoId + '">'+ this.thanatoFullName + '</div>',
|
||||
'<div class="loadSelect_listlieu" data-table="orders" data-column="fk_lieu_id" data-id="' + this.id + '" data-current="' + this.locationId + '">'+ this.locationName + '</div>',
|
||||
'<div>' + this.productReferences + '</div>',
|
||||
'<div style="'+ Order.getComandStatusCssSytle(this.statusKey) +'">' + this.statusLabel + '</div>',
|
||||
'<div data-modifier="orders" data-id=' + this.id + ' data-table="orders" style="display:inline-block;margin-right:0px;" class="deleteItem icon-delete"></div>'
|
||||
];
|
||||
|
||||
return orderRow;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} orderDatatable
|
||||
*/
|
||||
static loadOrderDatatable(orderDatatable) {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open('PROPFIND', baseUrl + '/order/list', true);
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
oReq.onload = function(e){
|
||||
if (this.status == 200) {
|
||||
LoadDT(orderDatatable, JSON.parse(this.response), Order);
|
||||
}else{
|
||||
showError(this.response);
|
||||
}
|
||||
};
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} dt
|
||||
*/
|
||||
static createDefaultOrder(dt) {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open('POST', baseUrl + '/order/createDefaultOrder', true);
|
||||
oReq.onload = function(e){
|
||||
if (this.status == 200) {
|
||||
if(this.response != null){
|
||||
showDone()
|
||||
Order.loadOrderDatatable(dt);
|
||||
}
|
||||
else{
|
||||
showError("Erreur dans la création de la commande");
|
||||
}
|
||||
}else{
|
||||
showError("Erreur dans la création de la commande");
|
||||
}
|
||||
};
|
||||
oReq.send();
|
||||
}
|
||||
}
|
||||
@ -108,6 +108,20 @@ export class Thanatopracteur {
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
static getThanatoByType(thanatoType,callback){
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open('PROPFIND', baseUrl + '/thanatos/type/'+thanatoType, true);
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
oReq.onload = function(e){
|
||||
if (this.status == 200) {
|
||||
callback(JSON.parse(this.response));
|
||||
}else{
|
||||
showError(this.response);
|
||||
}
|
||||
};
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
static getUsersNotLinkedToThanato(callback){
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open('PROPFIND', baseUrl + '/user/getUsersNotLinkedToThanato', true);
|
||||
@ -142,7 +156,7 @@ export class Thanatopracteur {
|
||||
);
|
||||
|
||||
var parentElement = el.target.parentElement
|
||||
parentElement.innerHTML = el.target.value + " " + el.target.options[el.target.selectedIndex].text;
|
||||
parentElement.innerHTML = el.target.options[el.target.selectedIndex].text;
|
||||
parentElement.dataset.current = el.target.value;
|
||||
}else{
|
||||
var parentElement = el.target.parentElement
|
||||
@ -265,4 +279,50 @@ export class Thanatopracteur {
|
||||
e.target.appendChild(selectElement);
|
||||
});
|
||||
}
|
||||
|
||||
static loadThanatosListedByTypeIntoSelect(e,thanatoType){
|
||||
Thanatopracteur.getThanatoByType(thanatoType,response => {
|
||||
|
||||
var selectElement = document.createElement("select");
|
||||
selectElement.dataset.current = e.target.dataset.current;
|
||||
selectElement.dataset.id = e.target.dataset.id;
|
||||
selectElement.dataset.old = e.target.innerHTML;
|
||||
|
||||
selectElement.addEventListener("change", el=>{
|
||||
if(el.target.value != 0 && el.target.value != null){
|
||||
updateDB(el.target.parentElement.dataset.table,
|
||||
el.target.parentElement.dataset.column,
|
||||
el.target.value,
|
||||
el.target.parentElement.dataset.id
|
||||
);
|
||||
|
||||
var parentElement = el.target.parentElement
|
||||
parentElement.innerHTML = el.target.options[el.target.selectedIndex].text;
|
||||
parentElement.dataset.current = el.target.value;
|
||||
}else{
|
||||
var parentElement = el.target.parentElement
|
||||
parentElement.innerHTML = el.target.dataset.old
|
||||
}
|
||||
});
|
||||
|
||||
var option = document.createElement("option");
|
||||
option.value = null;
|
||||
option.text = t('gestion', 'Cancel');
|
||||
selectElement.appendChild(option);
|
||||
|
||||
JSON.parse(response).forEach(myresp => {
|
||||
var txt = document.createElement("textarea");
|
||||
txt.innerHTML = myresp.nom + ' ' + myresp.prenom;
|
||||
var option = document.createElement("option");
|
||||
option.value = myresp.id;
|
||||
option.text = txt.value;
|
||||
selectElement.appendChild(option);
|
||||
});
|
||||
|
||||
checkSelectPurJs(selectElement);
|
||||
|
||||
e.target.innerHTML = ''
|
||||
e.target.appendChild(selectElement);
|
||||
});
|
||||
}
|
||||
}
|
||||
13
gestion/src/js/order.js
Normal file
13
gestion/src/js/order.js
Normal file
@ -0,0 +1,13 @@
|
||||
import "@nextcloud/dialogs/dist/index.css";
|
||||
import "datatables.net-dt/css/jquery.dataTables.css";
|
||||
import "../css/mycss.css";
|
||||
|
||||
import DataTable from "datatables.net";
|
||||
import { globalConfiguration, optionDatatable } from "./modules/mainFunction.mjs";
|
||||
import "./listener/main_listener";
|
||||
import "./listener/orderListener";
|
||||
import { Order } from "./objects/order.mjs";
|
||||
window.addEventListener("DOMContentLoaded", function () {
|
||||
globalConfiguration();
|
||||
Order.loadOrderDatatable(new DataTable(".tabledt",optionDatatable));
|
||||
});
|
||||
33
gestion/templates/content/order.php
Normal file
33
gestion/templates/content/order.php
Normal file
@ -0,0 +1,33 @@
|
||||
<div id="contentTable">
|
||||
<div class="breadcrumb" data-html2canvas-ignore>
|
||||
<div class="crumb svg crumbhome">
|
||||
<a href="<?php echo($_['url']['index']); ?>" class="icon-home"></a>
|
||||
<span style="display: none;"></span>
|
||||
</div>
|
||||
<div class="crumb svg crumbhome">
|
||||
<span>Commandes</span>
|
||||
</div>
|
||||
<div class="crumb svg crumbhome">
|
||||
<button style="margin-left:3px;" type="button" id="createDefaultOrder">Ajouter une commande</button>
|
||||
</div>
|
||||
</div>
|
||||
<table id="tableOrderList" class="display tabledt">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><?php p($l->t('ID'));?></th>
|
||||
<th><?php p($l->t('Date de commande'));?></th>
|
||||
<th><?php p($l->t('Numéro de commande'));?></th>
|
||||
<th><?php p($l->t('Défunt'));?></th>
|
||||
<th><?php p($l->t('Client'));?></th>
|
||||
<th><?php p($l->t('Thanatopracteur'));?></th>
|
||||
<th><?php p($l->t('Lieu'));?></th>
|
||||
<th><?php p($l->t('Type de soins'));?></th>
|
||||
<th><?php p($l->t('Etat'));?></th>
|
||||
<th><?php p($l->t('Actions'));?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -187,7 +187,7 @@
|
||||
</li>
|
||||
<li class="app-navigation-entry-submenu">
|
||||
<span class="navmarg icon-category-integration"></span>
|
||||
<a class="a-entry-submenu" href="<?php echo($_['url']['index']); ?>">
|
||||
<a class="a-entry-submenu" href="<?php echo($_['url']['orders']); ?>">
|
||||
<?php p($l->t('Commandes'));?>
|
||||
</a>
|
||||
<div class="app-navigation-entry-utils-submenu">
|
||||
|
||||
18
gestion/templates/order.php
Normal file
18
gestion/templates/order.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
style('gestion', array('style'));
|
||||
script('gestion', array('order.app', '814.app', '856.app'));
|
||||
?>
|
||||
<div id="app">
|
||||
<div id="app-navigation">
|
||||
<?php print_unescaped($this->inc('navigation/index')); ?>
|
||||
<?php print_unescaped($this->inc('settings/index')); ?>
|
||||
</div>
|
||||
|
||||
<div id="app-content">
|
||||
<div id="app-content-wrapper">
|
||||
<?php print_unescaped($this->inc('content/changelog')); ?>
|
||||
<?php print_unescaped($this->inc('content/order')); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -28,6 +28,7 @@ module.exports =
|
||||
adminSection: './src/js/adminSection.js',
|
||||
configuration: './src/js/configuration.js',
|
||||
pdf: './src/js/pdf.js',
|
||||
order: './src/js/order.js'
|
||||
},
|
||||
output: {
|
||||
filename: '../js/[name].app.js',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user