add email contenu with pj attachment

This commit is contained in:
Narindra ezway 2025-03-28 17:59:51 +03:00
parent de431c0f95
commit 7c1ec3c829
19 changed files with 765 additions and 508 deletions

View File

@ -1322,7 +1322,7 @@ function b(n) {
/******/ // This function allow to reference async chunks /******/ // This function allow to reference async chunks
/******/ __webpack_require__.u = (chunkId) => { /******/ __webpack_require__.u = (chunkId) => {
/******/ // return url for filenames based on template /******/ // 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":"741d92f5ec54d0c1ff41","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":"01a7eb6779cc0e417f44","vendors-node_modules_nextcloud_vue-dashboard_dist_vue-dashboard_js-node_modules_css-loader_di-9e6f3d":"c2bd3081c493a88308a2","src_models_rfcProps_js-src_services_caldavService_js-src_services_talkService_js-src_services-8a2790":"870a881bc445f47fd3e0","src_store_index_js":"854eb1c42b63dedda92a","src_fullcalendar_eventSources_eventSourceFunction_js-src_utils_moment_js-data_image_svg_xml_3-b73258":"8bfde7d389740c269cd6","dashboard-lazy":"60b7f707e08fff04c7a1","vendors-node_modules_vue-material-design-icons_CalendarBlank_vue-node_modules_vue-material-de-e2c1f8":"0658eb6db50a09dd2afe","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"e0f3178442f3c9eb35e1","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":"741d92f5ec54d0c1ff41","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":"01a7eb6779cc0e417f44","vendors-node_modules_nextcloud_vue-dashboard_dist_vue-dashboard_js-node_modules_css-loader_di-9e6f3d":"c2bd3081c493a88308a2","src_models_rfcProps_js-src_services_caldavService_js-src_services_talkService_js-src_services-8a2790":"870a881bc445f47fd3e0","src_store_index_js":"748ab31152e1226f9b22","src_fullcalendar_eventSources_eventSourceFunction_js-src_utils_moment_js-data_image_svg_xml_3-b73258":"8bfde7d389740c269cd6","dashboard-lazy":"60b7f707e08fff04c7a1","vendors-node_modules_vue-material-design-icons_CalendarBlank_vue-node_modules_vue-material-de-e2c1f8":"0658eb6db50a09dd2afe","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"e0f3178442f3c9eb35e1","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=dfa2e4156b37f7a69c4e //# sourceMappingURL=calendar-dashboard.js.map?v=fd08a5d56f376e2cd30d

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -8865,7 +8865,7 @@ window._registerCustomPickerElement = _;
/******/ // This function allow to reference async chunks /******/ // This function allow to reference async chunks
/******/ __webpack_require__.u = (chunkId) => { /******/ __webpack_require__.u = (chunkId) => {
/******/ // return url for filenames based on template /******/ // 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":"741d92f5ec54d0c1ff41","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":"0658eb6db50a09dd2afe","vendors-node_modules_vue-material-design-icons_CalendarBlankOutline_vue-node_modules_nextclou-4adead":"01a7eb6779cc0e417f44","vendors-node_modules_autosize_dist_autosize_esm_js-node_modules_html-entities_lib_index_js-no-4072c5":"c3527b981de24f56109b","src_models_rfcProps_js-src_services_caldavService_js-src_services_talkService_js-src_services-8a2790":"870a881bc445f47fd3e0","src_fullcalendar_eventSources_eventSourceFunction_js-src_utils_moment_js-data_image_svg_xml_3-b73258":"8bfde7d389740c269cd6","src_views_Calendar_vue-data_image_svg_xml_3csvg_20xmlns_27http_www_w3_org_2000_svg_27_20heigh-4a4254":"cd491efe0949bd9d7d0f","vendors-node_modules_webdav_dist_web_index_js":"454da8f908d41b47c607","src_store_index_js":"854eb1c42b63dedda92a","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"e0f3178442f3c9eb35e1","node_modules_nextcloud_dialogs_dist_legacy_mjs":"8be838e4c6e9aae56c87","vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-8ibBgPg__mjs":"ea54a36450de178d1141","public-calendar-subscription-picker":"0c8b5b050db3beb63d49","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":"741d92f5ec54d0c1ff41","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":"0658eb6db50a09dd2afe","vendors-node_modules_vue-material-design-icons_CalendarBlankOutline_vue-node_modules_nextclou-4adead":"01a7eb6779cc0e417f44","vendors-node_modules_autosize_dist_autosize_esm_js-node_modules_html-entities_lib_index_js-no-4072c5":"c3527b981de24f56109b","src_models_rfcProps_js-src_services_caldavService_js-src_services_talkService_js-src_services-8a2790":"870a881bc445f47fd3e0","src_fullcalendar_eventSources_eventSourceFunction_js-src_utils_moment_js-data_image_svg_xml_3-b73258":"8bfde7d389740c269cd6","src_views_Calendar_vue-data_image_svg_xml_3csvg_20xmlns_27http_www_w3_org_2000_svg_27_20heigh-4a4254":"297f1f42ac74bad32e69","vendors-node_modules_webdav_dist_web_index_js":"454da8f908d41b47c607","src_store_index_js":"748ab31152e1226f9b22","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"e0f3178442f3c9eb35e1","node_modules_nextcloud_dialogs_dist_legacy_mjs":"8be838e4c6e9aae56c87","vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-8ibBgPg__mjs":"ea54a36450de178d1141","public-calendar-subscription-picker":"0c8b5b050db3beb63d49","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=0ac1fcf77595c35c1331 //# sourceMappingURL=calendar-reference.js.map?v=c50a6845f9eb0b6964ef

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -6057,7 +6057,7 @@ __webpack_require__.r(__webpack_exports__);
label: 'Repos' label: 'Repos'
}, { }, {
value: 'DISEASE', value: 'DISEASE',
label: 'Maladie' label: 'Arrêt maladie'
}] }]
}; };
}, },
@ -17139,14 +17139,23 @@ __webpack_require__.r(__webpack_exports__);
var _this$calendarObjectI12, _this$calendarObjectI13; var _this$calendarObjectI12, _this$calendarObjectI13;
return (_this$calendarObjectI12 = (_this$calendarObjectI13 = this.calendarObjectInstance) === null || _this$calendarObjectI13 === void 0 ? void 0 : _this$calendarObjectI13.isPrivate) !== null && _this$calendarObjectI12 !== void 0 ? _this$calendarObjectI12 : false; return (_this$calendarObjectI12 = (_this$calendarObjectI13 = this.calendarObjectInstance) === null || _this$calendarObjectI13 === void 0 ? void 0 : _this$calendarObjectI13.isPrivate) !== null && _this$calendarObjectI12 !== void 0 ? _this$calendarObjectI12 : false;
}, },
/**
* Returns the emailId property
*
* @return {string|null}
*/
emailId() {
var _this$calendarObjectI14, _this$calendarObjectI15;
return (_this$calendarObjectI14 = (_this$calendarObjectI15 = this.calendarObjectInstance) === null || _this$calendarObjectI15 === void 0 ? void 0 : _this$calendarObjectI15.emailId) !== null && _this$calendarObjectI14 !== void 0 ? _this$calendarObjectI14 : null;
},
/** /**
* Returns the description or null if the event is still loading * Returns the description or null if the event is still loading
* *
* @return {string|null} * @return {string|null}
*/ */
description() { description() {
var _this$calendarObjectI14, _this$calendarObjectI15; var _this$calendarObjectI16, _this$calendarObjectI17;
return (_this$calendarObjectI14 = (_this$calendarObjectI15 = this.calendarObjectInstance) === null || _this$calendarObjectI15 === void 0 ? void 0 : _this$calendarObjectI15.description) !== null && _this$calendarObjectI14 !== void 0 ? _this$calendarObjectI14 : null; return (_this$calendarObjectI16 = (_this$calendarObjectI17 = this.calendarObjectInstance) === null || _this$calendarObjectI17 === void 0 ? void 0 : _this$calendarObjectI17.description) !== null && _this$calendarObjectI16 !== void 0 ? _this$calendarObjectI16 : null;
}, },
/** /**
* Returns the start-date (without timezone) or null if the event is still loading * Returns the start-date (without timezone) or null if the event is still loading
@ -17154,8 +17163,8 @@ __webpack_require__.r(__webpack_exports__);
* @return {Date|null} * @return {Date|null}
*/ */
startDate() { startDate() {
var _this$calendarObjectI16, _this$calendarObjectI17; var _this$calendarObjectI18, _this$calendarObjectI19;
return (_this$calendarObjectI16 = (_this$calendarObjectI17 = this.calendarObjectInstance) === null || _this$calendarObjectI17 === void 0 ? void 0 : _this$calendarObjectI17.startDate) !== null && _this$calendarObjectI16 !== void 0 ? _this$calendarObjectI16 : null; return (_this$calendarObjectI18 = (_this$calendarObjectI19 = this.calendarObjectInstance) === null || _this$calendarObjectI19 === void 0 ? void 0 : _this$calendarObjectI19.startDate) !== null && _this$calendarObjectI18 !== void 0 ? _this$calendarObjectI18 : null;
}, },
/** /**
* Returns the timezone of the event's start-date or null if the event is still loading * Returns the timezone of the event's start-date or null if the event is still loading
@ -17163,8 +17172,8 @@ __webpack_require__.r(__webpack_exports__);
* @return {string|null} * @return {string|null}
*/ */
startTimezone() { startTimezone() {
var _this$calendarObjectI18, _this$calendarObjectI19; var _this$calendarObjectI20, _this$calendarObjectI21;
return (_this$calendarObjectI18 = (_this$calendarObjectI19 = this.calendarObjectInstance) === null || _this$calendarObjectI19 === void 0 ? void 0 : _this$calendarObjectI19.startTimezoneId) !== null && _this$calendarObjectI18 !== void 0 ? _this$calendarObjectI18 : null; return (_this$calendarObjectI20 = (_this$calendarObjectI21 = this.calendarObjectInstance) === null || _this$calendarObjectI21 === void 0 ? void 0 : _this$calendarObjectI21.startTimezoneId) !== null && _this$calendarObjectI20 !== void 0 ? _this$calendarObjectI20 : null;
}, },
/** /**
* Returns the end-date (without timezone) or null if the event is still loading * Returns the end-date (without timezone) or null if the event is still loading
@ -17172,8 +17181,8 @@ __webpack_require__.r(__webpack_exports__);
* @return {Date|null} * @return {Date|null}
*/ */
endDate() { endDate() {
var _this$calendarObjectI20, _this$calendarObjectI21; var _this$calendarObjectI22, _this$calendarObjectI23;
return (_this$calendarObjectI20 = (_this$calendarObjectI21 = this.calendarObjectInstance) === null || _this$calendarObjectI21 === void 0 ? void 0 : _this$calendarObjectI21.endDate) !== null && _this$calendarObjectI20 !== void 0 ? _this$calendarObjectI20 : null; return (_this$calendarObjectI22 = (_this$calendarObjectI23 = this.calendarObjectInstance) === null || _this$calendarObjectI23 === void 0 ? void 0 : _this$calendarObjectI23.endDate) !== null && _this$calendarObjectI22 !== void 0 ? _this$calendarObjectI22 : null;
}, },
/** /**
* Returns the timezone of the event's end-date or null if the event is still loading * Returns the timezone of the event's end-date or null if the event is still loading
@ -17181,8 +17190,8 @@ __webpack_require__.r(__webpack_exports__);
* @return {string|null} * @return {string|null}
*/ */
endTimezone() { endTimezone() {
var _this$calendarObjectI22, _this$calendarObjectI23; var _this$calendarObjectI24, _this$calendarObjectI25;
return (_this$calendarObjectI22 = (_this$calendarObjectI23 = this.calendarObjectInstance) === null || _this$calendarObjectI23 === void 0 ? void 0 : _this$calendarObjectI23.endTimezoneId) !== null && _this$calendarObjectI22 !== void 0 ? _this$calendarObjectI22 : null; return (_this$calendarObjectI24 = (_this$calendarObjectI25 = this.calendarObjectInstance) === null || _this$calendarObjectI25 === void 0 ? void 0 : _this$calendarObjectI25.endTimezoneId) !== null && _this$calendarObjectI24 !== void 0 ? _this$calendarObjectI24 : null;
}, },
/** /**
* Returns whether or not the event is all-day or null if the event is still loading * Returns whether or not the event is all-day or null if the event is still loading
@ -17190,8 +17199,8 @@ __webpack_require__.r(__webpack_exports__);
* @return {boolean} * @return {boolean}
*/ */
isAllDay() { isAllDay() {
var _this$calendarObjectI24, _this$calendarObjectI25; var _this$calendarObjectI26, _this$calendarObjectI27;
return (_this$calendarObjectI24 = (_this$calendarObjectI25 = this.calendarObjectInstance) === null || _this$calendarObjectI25 === void 0 ? void 0 : _this$calendarObjectI25.isAllDay) !== null && _this$calendarObjectI24 !== void 0 ? _this$calendarObjectI24 : false; return (_this$calendarObjectI26 = (_this$calendarObjectI27 = this.calendarObjectInstance) === null || _this$calendarObjectI27 === void 0 ? void 0 : _this$calendarObjectI27.isAllDay) !== null && _this$calendarObjectI26 !== void 0 ? _this$calendarObjectI26 : false;
}, },
/** /**
* Returns whether or not the user is allowed to modify the all-day setting * Returns whether or not the user is allowed to modify the all-day setting
@ -17199,8 +17208,8 @@ __webpack_require__.r(__webpack_exports__);
* @return {boolean} * @return {boolean}
*/ */
canModifyAllDay() { canModifyAllDay() {
var _this$calendarObjectI26, _this$calendarObjectI27; var _this$calendarObjectI28, _this$calendarObjectI29;
return (_this$calendarObjectI26 = (_this$calendarObjectI27 = this.calendarObjectInstance) === null || _this$calendarObjectI27 === void 0 ? void 0 : _this$calendarObjectI27.canModifyAllDay) !== null && _this$calendarObjectI26 !== void 0 ? _this$calendarObjectI26 : false; return (_this$calendarObjectI28 = (_this$calendarObjectI29 = this.calendarObjectInstance) === null || _this$calendarObjectI29 === void 0 ? void 0 : _this$calendarObjectI29.canModifyAllDay) !== null && _this$calendarObjectI28 !== void 0 ? _this$calendarObjectI28 : false;
}, },
/** /**
* Returns the color the illustration should be colored in * Returns the color the illustration should be colored in
@ -17232,8 +17241,8 @@ __webpack_require__.r(__webpack_exports__);
* @return {null | string} * @return {null | string}
*/ */
color() { color() {
var _this$calendarObjectI28, _this$calendarObjectI29; var _this$calendarObjectI30, _this$calendarObjectI31;
return (_this$calendarObjectI28 = (_this$calendarObjectI29 = this.calendarObjectInstance) === null || _this$calendarObjectI29 === void 0 ? void 0 : _this$calendarObjectI29.customColor) !== null && _this$calendarObjectI28 !== void 0 ? _this$calendarObjectI28 : null; return (_this$calendarObjectI30 = (_this$calendarObjectI31 = this.calendarObjectInstance) === null || _this$calendarObjectI31 === void 0 ? void 0 : _this$calendarObjectI31.customColor) !== null && _this$calendarObjectI30 !== void 0 ? _this$calendarObjectI30 : null;
}, },
/** /**
* Returns whether or not to display save buttons * Returns whether or not to display save buttons
@ -17409,8 +17418,8 @@ __webpack_require__.r(__webpack_exports__);
* @return {string|null} * @return {string|null}
*/ */
absenceType() { absenceType() {
var _this$calendarObjectI30, _this$calendarObjectI31; var _this$calendarObjectI32, _this$calendarObjectI33;
return (_this$calendarObjectI30 = (_this$calendarObjectI31 = this.calendarObjectInstance) === null || _this$calendarObjectI31 === void 0 ? void 0 : _this$calendarObjectI31.absenceType) !== null && _this$calendarObjectI30 !== void 0 ? _this$calendarObjectI30 : ''; return (_this$calendarObjectI32 = (_this$calendarObjectI33 = this.calendarObjectInstance) === null || _this$calendarObjectI33 === void 0 ? void 0 : _this$calendarObjectI33.absenceType) !== null && _this$calendarObjectI32 !== void 0 ? _this$calendarObjectI32 : '';
} }
}, },
methods: { methods: {
@ -17727,6 +17736,15 @@ __webpack_require__.r(__webpack_exports__);
isPrivate isPrivate
}); });
}, },
/**
* Toggles the event to private
*/
addEmailId(emailId) {
this.$store.commit('addEmailId', {
calendarObjectInstance: this.calendarObjectInstance,
emailId
});
},
/** /**
* Resets the internal state after changing the viewed calendar-object * Resets the internal state after changing the viewed calendar-object
*/ */
@ -28000,4 +28018,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=cd491efe0949bd9d7d0f //# sourceMappingURL=calendar-src_views_Calendar_vue-data_image_svg_xml_3csvg_20xmlns_27http_www_w3_org_2000_svg_27_20heigh-4a4254.js.map?v=297f1f42ac74bad32e69

View File

@ -153,12 +153,18 @@ class EmailBoxController extends Controller {
} finally { } finally {
$client->logout(); $client->logout();
} }
$data['fullMessage'] = $json;
$data['attachments'] = array_map(function ($a) use ($messageId) { $data['attachments'] = array_map(function ($a) use ($messageId) {
return $this->enrichDownloadUrl( return $this->enrichDownloadUrl(
$messageId, $messageId,
$a $a
); );
}, $json['attachments']); }, $json['attachments']);
if(isset( $json['attachments'])) {
unset($json['attachments']);
}
return new JSONResponse(($data)); return new JSONResponse(($data));
} }
/** /**

View File

@ -109,8 +109,11 @@
<div class="mailHeader"> <div class="mailHeader">
{{ getLabelEmailBox(selectedMail.from) + ' : ' + selectedMail.subject }} {{ getLabelEmailBox(selectedMail.from) + ' : ' + selectedMail.subject }}
</div> </div>
<div class="mailContent"> <div class="mailContent" v-if="selectedMail.body">
{{ selectedMail.previewText }} <div v-html="selectedMail.body "></div>
</div>
<div class="mailContent" v-else>
<div v-html="selectedMail.previewText "></div>
</div> </div>
</div> </div>
@ -256,6 +259,13 @@ export default {
calendarObjectInstance: this.calendarObjectInstance, calendarObjectInstance: this.calendarObjectInstance,
attachment, attachment,
}) })
if (this.selectedAttachements.length = 0) {
const emailId = null;
this.$store.commit('addEmailId', {
calendarObjectInstance: this.calendarObjectInstance,
emailId,
})
}
}, },
async openFilesModal() { async openFilesModal() {
const picker = getFilePickerBuilder(t('calendar', 'Choose a file to add as attachment')) const picker = getFilePickerBuilder(t('calendar', 'Choose a file to add as attachment'))
@ -385,13 +395,21 @@ export default {
}, },
async getAttachments(mail){ async getAttachments(mail){
this.loadingText = 'Récupération des piecs jointes ...' this.loadingText = 'Récupération des piecs jointes ...'
this.selectedMail = mail
this.loadingDataEmailBox = true this.loadingDataEmailBox = true
this.showAttachmentsSection = true this.showAttachmentsSection = true
this.selectedMail = mail
this.mailAttachmentData = [] ; this.mailAttachmentData = [] ;
await this.loadAttachments(mail) await this.loadAttachments(mail)
this.loadingDataEmailBox = false this.loadingDataEmailBox = false
}, },
async addEmailToVcalendar(mail){
const emailId = mail.databaseId ?? null;
this.$store.commit('addEmailId', {
calendarObjectInstance: this.calendarObjectInstance,
emailId,
})
},
selectAttachement(attachementId){ selectAttachement(attachementId){
if(this.isInSelectedAttachment(attachementId)){ if(this.isInSelectedAttachment(attachementId)){
console.log("remove") console.log("remove")
@ -411,6 +429,7 @@ export default {
//upload only attachmen if id is in selectedAttachements //upload only attachmen if id is in selectedAttachements
const selectedAttachements = this.selectedAttachements.map(id => this.mailAttachmentData.find(attachement => attachement.id === id)) const selectedAttachements = this.selectedAttachements.map(id => this.mailAttachmentData.find(attachement => attachement.id === id))
await this.uploadAttachment(selectedAttachements) await this.uploadAttachment(selectedAttachements)
this.addEmailToVcalendar(this.selectedMail);
this.closeMailBoxModal() this.closeMailBoxModal()
this.resetMailBoxModal() this.resetMailBoxModal()
@ -468,19 +487,8 @@ export default {
await axios.get(ajaxUrl) await axios.get(ajaxUrl)
.then(response => { .then(response => {
// response.data.attachments.forEach(attachement => {
// this.mailAttachmentData.push({
// id : attachement.id,
// fileName : attachement.fileName,
// downloadUrl : attachement.downloadUrl,
// id : attachement.id,
// isImage : attachement.isImage,
// isCalendarEvent : attachement.isCalendarEvent,
// size : attachement.size,
// })
// })
this.mailAttachmentData = response.data.attachments this.mailAttachmentData = response.data.attachments
this.selectedMail["body"] = response.data.fullMessage.body
}) })
.catch(error => { .catch(error => {
console.log(error) console.log(error)
@ -639,6 +647,8 @@ label {
flex-direction: column; flex-direction: column;
align-items: flex-start; align-items: flex-start;
padding: 10px; padding: 10px;
max-height: 400px;
overflow: scroll;
} }
</style> </style>

View File

@ -39,7 +39,7 @@ export default {
properties: [ properties: [
{ value: 'LEAVE', label: 'Congé' }, { value: 'LEAVE', label: 'Congé' },
{ value: 'REST', label: 'Repos' }, { value: 'REST', label: 'Repos' },
{ value: 'DISEASE', label: 'Maladie' }, { value: 'DISEASE', label: 'Arrêt maladie' },
], ],
}; };
}, },

View File

@ -137,6 +137,15 @@ export default {
return this.calendarObjectInstance?.isPrivate ?? false return this.calendarObjectInstance?.isPrivate ?? false
}, },
/**
* Returns the emailId property
*
* @return {string|null}
*/
emailId() {
return this.calendarObjectInstance?.emailId ?? null
},
/** /**
* Returns the description or null if the event is still loading * Returns the description or null if the event is still loading
* *
@ -747,6 +756,15 @@ export default {
isPrivate isPrivate
}) })
}, },
/**
* Toggles the event to private
*/
addEmailId(emailId) {
this.$store.commit('addEmailId', {
calendarObjectInstance: this.calendarObjectInstance,
emailId
})
},
/** /**
* Resets the internal state after changing the viewed calendar-object * Resets the internal state after changing the viewed calendar-object
*/ */

View File

@ -96,6 +96,8 @@ const getDefaultEventObject = (props = {}) => Object.assign({}, {
customColor: null, customColor: null,
// Categories // Categories
categories: [], categories: [],
// The event's UID
emailId: null,
// Attachments of this event // Attachments of this event
attachments: [], attachments: [],
}, props) }, props)
@ -117,6 +119,7 @@ const mapEventComponentToEventObject = (eventComponent) => {
embalmer : "TEST", embalmer : "TEST",
comment : "", comment : "",
absenceType : "", absenceType : "",
emailId: null,
description: eventComponent.description, description: eventComponent.description,
accessClass: eventComponent.accessClass, accessClass: eventComponent.accessClass,
status: eventComponent.status, status: eventComponent.status,
@ -222,6 +225,10 @@ const mapEventComponentToEventObject = (eventComponent) => {
eventObject.absenceType = eventComponent.getFirstPropertyFirstValue('ABSENCETYPE'); eventObject.absenceType = eventComponent.getFirstPropertyFirstValue('ABSENCETYPE');
} }
if(eventComponent.hasProperty('EMAILID')){
eventObject.emailId = eventComponent.getFirstPropertyFirstValue('EMAILID');
}
return eventObject; return eventObject;
} }
@ -238,6 +245,7 @@ const copyCalendarObjectInstanceIntoEventComponent = (eventObject, eventComponen
eventComponent.embalmer = eventObject.embalmer eventComponent.embalmer = eventObject.embalmer
eventComponent.isPrivate = eventObject.isPrivate eventComponent.isPrivate = eventObject.isPrivate
eventComponent.comment = eventObject.comment eventComponent.comment = eventObject.comment
eventComponent.emailId = eventObject.emailId
eventComponent.description = eventObject.description eventComponent.description = eventObject.description
eventComponent.accessClass = eventObject.accessClass eventComponent.accessClass = eventObject.accessClass
eventComponent.status = eventObject.status eventComponent.status = eventObject.status

View File

@ -297,8 +297,18 @@ const mutations = {
calendarObjectInstance.eventComponent.isPrivate = isPrivate calendarObjectInstance.eventComponent.isPrivate = isPrivate
calendarObjectInstance.isPrivate = isPrivate calendarObjectInstance.isPrivate = isPrivate
}, },
/**
*Email id
*
* @param {object} state The Vuex state
* @param {object} data The destructuring object
* @param {object} data.calendarObjectInstance The calendarObjectInstance object
*/
addEmailId(state, { calendarObjectInstance, emailId }) {
calendarObjectInstance.eventComponent.emailId = emailId
calendarObjectInstance.emailId = emailId
},
/** /**
@ -393,7 +403,7 @@ const mutations = {
const types = [ const types = [
{ value: 'LEAVE', label: 'Congé' }, { value: 'LEAVE', label: 'Congé' },
{ value: 'REST', label: 'Repos' }, { value: 'REST', label: 'Repos' },
{ value: 'DISEASE', label: 'Arret maladie' }, { value: 'DISEASE', label: 'Arrêt maladie' },
]; ];
types.forEach((element) => { types.forEach((element) => {
@ -1762,6 +1772,7 @@ const actions = {
eventComponent.client != null || eventComponent.client != null ||
eventComponent.isPrivate != null || eventComponent.isPrivate != null ||
eventComponent.absenceType || eventComponent.absenceType ||
eventComponent.emailId ||
eventComponent.comment != null ; eventComponent.comment != null ;
if (eventComponent.isDirty() || additionalFieldWasUpdated) { if (eventComponent.isDirty() || additionalFieldWasUpdated) {
const isForkedItem = eventComponent.primaryItem !== null const isForkedItem = eventComponent.primaryItem !== null

View File

@ -273,6 +273,20 @@ const actions = {
icsValue = setCustomKeyValuesArrayToIcsAndReturnIcs(icsValue,customKeyValue); icsValue = setCustomKeyValuesArrayToIcsAndReturnIcs(icsValue,customKeyValue);
} }
} }
if(eventComponent.emailId != null){
let emailIdValue = eventComponent.emailId ;
let emailIdValueValue = "EMAILID:"+emailIdValue;
let regex = /EMAILID:\d+/;
if(regex.test(icsValue)){
icsValue = icsValue.replace(regex, emailIdValueValue);
}
else{
const customKeyValue = {
"EMAILID": emailIdValue
};
icsValue = setCustomKeyValuesArrayToIcsAndReturnIcs(icsValue,customKeyValue);
}
}
if(eventComponent.absenceType != null && eventComponent.absenceType != ''){ if(eventComponent.absenceType != null && eventComponent.absenceType != ''){
let absenceTypeValue = eventComponent.absenceType; let absenceTypeValue = eventComponent.absenceType;
let key = "ABSENCETYPE:"+absenceTypeValue; let key = "ABSENCETYPE:"+absenceTypeValue;
@ -308,7 +322,9 @@ const actions = {
"EMBALMER": eventComponent.embalmer , "EMBALMER": eventComponent.embalmer ,
"ISPRIVATE": eventComponent.isPrivate ? "1" : "0", "ISPRIVATE": eventComponent.isPrivate ? "1" : "0",
"COMMENT": eventComponent.comment, "COMMENT": eventComponent.comment,
"EMAILID": eventComponent.emailId,
"ABSENCETYPE": eventComponent.absenceType ?? '' "ABSENCETYPE": eventComponent.absenceType ?? ''
}; };
icsValue = setCustomKeyValuesArrayToIcsAndReturnIcs(icsValue,customKeyValue); icsValue = setCustomKeyValuesArrayToIcsAndReturnIcs(icsValue,customKeyValue);
} }

View File

@ -72,6 +72,17 @@ class VCalendarHelpers
{ {
return str_contains($vCalendarString, 'ATTACH;FMTTYPE'); return str_contains($vCalendarString, 'ATTACH;FMTTYPE');
} }
public static function hasEmailIdInVCalendar(string $vCalendarString): bool
{
return self::getEmailIdInVCalendar("EMAILID", $vCalendarString) ? true : false;
}
public static function getEmailIdInVCalendar(string $vCalendarString): string|int|null
{
return self::GetValueFromKeyInVCalendarString("EMAILID", $vCalendarString) ?? null;
}
public static function extractAttachments(string $vCalendarString): array public static function extractAttachments(string $vCalendarString): array
{ {
$attachments = []; $attachments = [];

View File

@ -26,7 +26,6 @@ declare(strict_types=1);
namespace OCA\Gestion\Service; namespace OCA\Gestion\Service;
use GuzzleHttp\Exception\GuzzleException;
use OCP\IConfig; use OCP\IConfig;
use OCP\DB\Exception; use OCP\DB\Exception;
use OCP\IUserSession; use OCP\IUserSession;
@ -37,12 +36,17 @@ use OC\Files\Filesystem;
use OCP\Files\IRootFolder; use OCP\Files\IRootFolder;
use OCA\Gestion\Db\OrderBdd; use OCA\Gestion\Db\OrderBdd;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use OCA\Mail\Contracts\IMailManager;
use OCA\Mail\IMAP\IMAPClientFactory;
use OCA\Mail\Service\AccountService;
use OCA\Gestion\Constants\BddConstant; use OCA\Gestion\Constants\BddConstant;
use OCA\Gestion\Helpers\FolderHelpers; use OCA\Gestion\Helpers\FolderHelpers;
use GuzzleHttp\Exception\GuzzleException;
use OCA\Gestion\Helpers\VCalendarHelpers; use OCA\Gestion\Helpers\VCalendarHelpers;
use OCA\Gestion\Constants\OrderStatusConstant; use OCA\Gestion\Constants\OrderStatusConstant;
use OCA\Gestion\Constants\ThanatoTypeConstant; use OCA\Gestion\Constants\ThanatoTypeConstant;
use OCA\Gestion\Service\Order\OrderPdfService; use OCA\Gestion\Service\Order\OrderPdfService;
use OCP\AppFramework\Db\DoesNotExistException;
use OCA\Gestion\Constants\DevisMentionConstant; use OCA\Gestion\Constants\DevisMentionConstant;
use OCA\Gestion\Service\Devis\Pdf\DevisPdfService; use OCA\Gestion\Service\Devis\Pdf\DevisPdfService;
use OCA\Gestion\Constants\VCalendarPropertyConstant; use OCA\Gestion\Constants\VCalendarPropertyConstant;
@ -62,8 +66,6 @@ class GestionService {
private $orderPdfService; private $orderPdfService;
private $devisPdfService; private $devisPdfService;
private $userSession;
private string $userConnectedUuid; private string $userConnectedUuid;
private $userConnectedStorage; private $userConnectedStorage;
@ -72,8 +74,17 @@ class GestionService {
protected $config; protected $config;
private IMailManager $mailManager;
private $accountService;
private IMAPClientFactory $clientFactory;
private ?string $currentUserId;
public function __construct( public function __construct(
?string $UserId,
Bdd $gestionBdd, Bdd $gestionBdd,
OrderBdd $orderBdd, OrderBdd $orderBdd,
LoggerInterface $logger, LoggerInterface $logger,
@ -84,19 +95,26 @@ class GestionService {
IRootFolder $rootFolder, IRootFolder $rootFolder,
IMailer $mailer, IMailer $mailer,
IConfig $config, IConfig $config,
IMailManager $mailManager,
AccountService $accountService,
IMAPClientFactory $clientFactory,
) { ) {
$this->currentUserId = $UserId;
$this->orderBdd = $orderBdd; $this->orderBdd = $orderBdd;
$this->logger = $logger; $this->logger = $logger;
$this->gestionBdd = $gestionBdd; $this->gestionBdd = $gestionBdd;
$this->orderPdfService = $orderPdfService; $this->orderPdfService = $orderPdfService;
$this->devisPdfService = $devisPdfService; $this->devisPdfService = $devisPdfService;
$this->talkService = $talkService; $this->talkService = $talkService;
$this->userSession = $userSession;
$this->userConnectedUuid = $userSession->getUser()?->getUID() ?? BddConstant::DEFAULT_ADMIN_APP_ID_NEXTCLOUD; $this->userConnectedUuid = $userSession->getUser()?->getUID() ?? BddConstant::DEFAULT_ADMIN_APP_ID_NEXTCLOUD;
$this->userConnectedStorage = $rootFolder->getUserFolder($this->userConnectedUuid); $this->userConnectedStorage = $rootFolder->getUserFolder($this->userConnectedUuid);
$this->mailer = $mailer; $this->mailer = $mailer;
$this->config = $config; $this->config = $config;
$this->mailManager = $mailManager;
$this->accountService = $accountService;
$this->clientFactory = $clientFactory;
} }
@ -208,6 +226,7 @@ class GestionService {
public function HandleCreatedCalendarObject(string $vCalendarString ,$cookie){ public function HandleCreatedCalendarObject(string $vCalendarString ,$cookie){
try{ try{
$isPrivate = $this->GetIsPivateFromVCalendarString($vCalendarString); $isPrivate = $this->GetIsPivateFromVCalendarString($vCalendarString);
$absenceType = VCalendarHelpers::GetValueFromKeyInVCalendarString('ABSENCETYPE',$vCalendarString); $absenceType = VCalendarHelpers::GetValueFromKeyInVCalendarString('ABSENCETYPE',$vCalendarString);
if($isPrivate || $absenceType){ if($isPrivate || $absenceType){
@ -263,11 +282,15 @@ class GestionService {
if($devis != null && $devis["client_entreprise"] != null){ if($devis != null && $devis["client_entreprise"] != null){
$destinationFolderAttachment = FolderHelpers::GetDefuntFolder($devis["client_entreprise"],$devis["defunt_nom"]); $destinationFolderAttachment = FolderHelpers::GetDefuntFolder($devis["client_entreprise"],$devis["defunt_nom"]);
$attachments = VCalendarHelpers::extractAttachments($vCalendarString); $attachments = VCalendarHelpers::extractAttachments($vCalendarString);
$this->moveCalendarAttachmentFile($attachments,$destinationFolderAttachment); $this->moveCalendarAttachmentFile($attachments,$destinationFolderAttachment);
if ($thanatoIsSubcontractor) { if ($thanatoIsSubcontractor) {
$thanatoHasEmail = $thanato["thanato_email"] != null; $thanatoHasEmail = $thanato["thanato_email"] != null;
if($thanatoHasEmail){ if($thanatoHasEmail){
$this->sendEmailAttachment($thanato["thanato_email"] , $devis["defunt_nom"],$attachments); $emailBody = $this->extractBodyOfEmailAttachment(VCalendarHelpers::getEmailIdInVCalendar($vCalendarString));
$this->sendEmailAndAttachment($thanato["thanato_email"] , $devis["defunt_nom"],$emailBody ,$attachments);
} }
}else { }else {
$roomToken = $this->talkService->getRoomTokenBeetwenTwoUser($this->userConnectedUuid, $userName); $roomToken = $this->talkService->getRoomTokenBeetwenTwoUser($this->userConnectedUuid, $userName);
@ -435,7 +458,8 @@ class GestionService {
$this->devisPdfService->generateDevisPdfByDevisId($devis['id'],$this->userConnectedUuid); $this->devisPdfService->generateDevisPdfByDevisId($devis['id'],$this->userConnectedUuid);
} }
if (VCalendarHelpers::hasAttachment($vCalendarString)) { if (VCalendarHelpers::hasAttachment($vCalendarString) || VCalendarHelpers::hasEmailIdInVCalendar($vCalendarString)) {
$thanato = $this->gestionBdd->getThanatoByThanatoId($devis['id_thanato']); $thanato = $this->gestionBdd->getThanatoByThanatoId($devis['id_thanato']);
$thanatoIsSubcontractor = $thanato["fk_thanato_type_key"] === ThanatoTypeConstant::THANATO_TYPE_SUBCONTRACTOR; $thanatoIsSubcontractor = $thanato["fk_thanato_type_key"] === ThanatoTypeConstant::THANATO_TYPE_SUBCONTRACTOR;
@ -447,7 +471,8 @@ class GestionService {
if ($thanatoIsSubcontractor ) { if ($thanatoIsSubcontractor ) {
$thanatoHasEmail = $thanato["thanato_email"] != null; $thanatoHasEmail = $thanato["thanato_email"] != null;
if($thanatoHasEmail){ if($thanatoHasEmail){
$this->sendEmailAttachment($thanato["thanato_email"] , $devis["defunt_nom"],$attachments); $emailBody = $this->extractBodyOfEmailAttachment(VCalendarHelpers::getEmailIdInVCalendar($vCalendarString));
$this->sendEmailAndAttachment($thanato["thanato_email"] , $devis["defunt_nom"],$emailBody,$attachments);
} }
}else{ }else{
@ -477,16 +502,42 @@ class GestionService {
} }
} }
public function sendEmailAttachment($to , $defunt_nom ,$attachments = []){ private function extractBodyOfEmailAttachment($emailId){
$messageId = (int) $emailId;
try {
$message = $this->mailManager->getMessage($this->currentUserId, $messageId);
$mailbox = $this->mailManager->getMailbox($this->currentUserId, $message->getMailboxId());
$account = $this->accountService->find($this->currentUserId, $mailbox->getAccountId());
} catch (DoesNotExistException $e) {
}
$client = $this->clientFactory->getClient($account);
try {
$imapMessage = $this->mailManager->getImapMessage(
$client,
$account,
$mailbox,
$message->getUid(), true
);
$fullMessage = $imapMessage->getFullMessage($messageId);
} finally {
$client->logout();
}
return $fullMessage["body"] ?? '';
}
public function sendEmailAndAttachment($to , $defunt_nom ,$emailBody = '' ,$attachments = []){
$this->userConnectedStorage->getFullPath("/"); $this->userConnectedStorage->getFullPath("/");
$subject = "Piece jointe"; $subject = "Piece jointe";
$body = " $body = "
<p>Bonjour.</p> <p>Bonjour.</p>
<p>Vous trouverez en pièce jointe les documents concernant de « $defunt_nom ».</p> <p>Vous trouverez ci-dessous l'email et le(s) pièce(s) jointe(s) de « $defunt_nom ».</p>
<p>Vous en souhaitant bonne réception</p> <p>Vous en souhaitant bonne réception</p>
<p>Cordialement</p> <div>$emailBody</div>";
";
$message = $this->mailer->createMessage(); $message = $this->mailer->createMessage();
$message->setSubject($subject); $message->setSubject($subject);
@ -497,10 +548,10 @@ class GestionService {
$content = $this->mailer->createAttachment( Filesystem::file_get_contents($path),$attachment['name'],$attachment['mime_type']); $content = $this->mailer->createAttachment( Filesystem::file_get_contents($path),$attachment['name'],$attachment['mime_type']);
$message->attach($content); $message->attach($content);
} }
$message->setHtmlBody( $body);
$message->setHtmlBody($body);
$this->mailer->send($message); $this->mailer->send($message);
} }
public function sendFileAttachmentToTalk($roomToken, $cookie , $fileName ) { public function sendFileAttachmentToTalk($roomToken, $cookie , $fileName ) {