Merge branch 'features/feature-update-and-delete-agenda' into staging

This commit is contained in:
Tiavina 2025-01-15 14:18:39 +03:00
commit 28a63bcc7a
43 changed files with 471 additions and 66 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":"31a7d4ece3cdde2d67f1","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":"702892edfb255629754c","vendors-node_modules_nextcloud_vue-dashboard_dist_vue-dashboard_js-node_modules_css-loader_di-9e6f3d":"bab844a8fb43e3701945","src_models_rfcProps_js-src_services_caldavService_js-src_services_talkService_js-src_services-8a2790":"7cf71b4f92d5bbc180b4","src_store_index_js":"0338b9a6ef0b356d96af","src_fullcalendar_eventSources_eventSourceFunction_js-src_utils_moment_js-data_image_svg_xml_3-b73258":"740a2859d1f364b508c1","dashboard-lazy":"a51e4becd0c10f90296c","vendors-node_modules_vue-material-design-icons_CalendarBlank_vue-node_modules_vue-material-de-e2c1f8":"1ec24b5ef07652c6dd39","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"7ec0cf6b65f5c745fa03","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":"31a7d4ece3cdde2d67f1","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":"702892edfb255629754c","vendors-node_modules_nextcloud_vue-dashboard_dist_vue-dashboard_js-node_modules_css-loader_di-9e6f3d":"bab844a8fb43e3701945","src_models_rfcProps_js-src_services_caldavService_js-src_services_talkService_js-src_services-8a2790":"7cf71b4f92d5bbc180b4","src_store_index_js":"420e15dec2eb84cba206","src_fullcalendar_eventSources_eventSourceFunction_js-src_utils_moment_js-data_image_svg_xml_3-b73258":"740a2859d1f364b508c1","dashboard-lazy":"a51e4becd0c10f90296c","vendors-node_modules_vue-material-design-icons_CalendarBlank_vue-node_modules_vue-material-de-e2c1f8":"1ec24b5ef07652c6dd39","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"7ec0cf6b65f5c745fa03","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=0b87d468a835f9f596c4 //# sourceMappingURL=calendar-dashboard.js.map?v=cd85d9b21f2d310f9ed9

File diff suppressed because one or more lines are too long

View File

@ -32632,11 +32632,14 @@ const actions = {
thisAndAllFuture, thisAndAllFuture,
calendarId calendarId
} = _ref78; } = _ref78;
debugger;
const eventComponent = state.calendarObjectInstance.eventComponent; const eventComponent = state.calendarObjectInstance.eventComponent;
const calendarObject = state.calendarObject; const calendarObject = state.calendarObject;
(0,_utils_alarms_js__WEBPACK_IMPORTED_MODULE_5__.updateAlarms)(eventComponent); (0,_utils_alarms_js__WEBPACK_IMPORTED_MODULE_5__.updateAlarms)(eventComponent);
(0,_services_talkService_js__WEBPACK_IMPORTED_MODULE_13__.updateTalkParticipants)(eventComponent); (0,_services_talkService_js__WEBPACK_IMPORTED_MODULE_13__.updateTalkParticipants)(eventComponent);
if (eventComponent.isDirty()) { let client = eventComponent.client;
let additionalFieldWasUpdated = eventComponent.client != null || eventComponent.comment != null;
if (eventComponent.isDirty() || additionalFieldWasUpdated) {
const isForkedItem = eventComponent.primaryItem !== null; const isForkedItem = eventComponent.primaryItem !== null;
let original = null; let original = null;
let fork = null; let fork = null;
@ -33536,9 +33539,21 @@ const actions = {
let { let {
calendarObject calendarObject
} = _ref8; } = _ref8;
debugger;
let eventComponent = calendarObject.calendarComponent.getFirstComponent('VEVENT'); let eventComponent = calendarObject.calendarComponent.getFirstComponent('VEVENT');
if (calendarObject.existsOnServer) { 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);
}
if (eventComponent.comment != null) {
let newCommentKeyValue = "COMMENT:" + eventComponent.comment;
icsValue = icsValue.replace(/COMMENT:[^\s]+/, newCommentKeyValue);
}
}
calendarObject.dav.data = icsValue;
await calendarObject.dav.update(); await calendarObject.dav.update();
context.commit('addCalendarObjectIdToAllTimeRangesOfCalendar', { context.commit('addCalendarObjectIdToAllTimeRangesOfCalendar', {
calendarId: calendarObject.calendarId, calendarId: calendarObject.calendarId,
@ -310253,4 +310268,4 @@ appointmentsConfigsStore.addInitialConfigs((0,_nextcloud_initial_state__WEBPACK_
/******/ })() /******/ })()
; ;
//# sourceMappingURL=calendar-main.js.map?v=baa756356549c2cc0dfb //# sourceMappingURL=calendar-main.js.map?v=4b019479817d0570a03d

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":"31a7d4ece3cdde2d67f1","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":"1ec24b5ef07652c6dd39","vendors-node_modules_vue-material-design-icons_CalendarBlankOutline_vue-node_modules_nextclou-4adead":"702892edfb255629754c","vendors-node_modules_autosize_dist_autosize_esm_js-node_modules_html-entities_lib_index_js-no-4072c5":"7212b31e059bc10c256e","src_models_rfcProps_js-src_services_caldavService_js-src_services_talkService_js-src_services-8a2790":"7cf71b4f92d5bbc180b4","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":"5307ae844eb83db74a98","vendors-node_modules_webdav_dist_web_index_js":"454da8f908d41b47c607","src_store_index_js":"0338b9a6ef0b356d96af","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"7ec0cf6b65f5c745fa03","node_modules_nextcloud_dialogs_dist_legacy_mjs":"8be838e4c6e9aae56c87","vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-8ibBgPg__mjs":"ea54a36450de178d1141","public-calendar-subscription-picker":"2315e24e67ebf6e4b6db","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":"31a7d4ece3cdde2d67f1","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":"1ec24b5ef07652c6dd39","vendors-node_modules_vue-material-design-icons_CalendarBlankOutline_vue-node_modules_nextclou-4adead":"702892edfb255629754c","vendors-node_modules_autosize_dist_autosize_esm_js-node_modules_html-entities_lib_index_js-no-4072c5":"7212b31e059bc10c256e","src_models_rfcProps_js-src_services_caldavService_js-src_services_talkService_js-src_services-8a2790":"7cf71b4f92d5bbc180b4","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":"5307ae844eb83db74a98","vendors-node_modules_webdav_dist_web_index_js":"454da8f908d41b47c607","src_store_index_js":"420e15dec2eb84cba206","vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-e0595f":"7ec0cf6b65f5c745fa03","node_modules_nextcloud_dialogs_dist_legacy_mjs":"8be838e4c6e9aae56c87","vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-8ibBgPg__mjs":"ea54a36450de178d1141","public-calendar-subscription-picker":"2315e24e67ebf6e4b6db","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=a7adcb947a9e7b3719aa //# sourceMappingURL=calendar-reference.js.map?v=683c4c65ae1a2b722668

File diff suppressed because one or more lines are too long

View File

@ -3698,11 +3698,14 @@ const actions = {
thisAndAllFuture, thisAndAllFuture,
calendarId calendarId
} = _ref78; } = _ref78;
debugger;
const eventComponent = state.calendarObjectInstance.eventComponent; const eventComponent = state.calendarObjectInstance.eventComponent;
const calendarObject = state.calendarObject; const calendarObject = state.calendarObject;
(0,_utils_alarms_js__WEBPACK_IMPORTED_MODULE_5__.updateAlarms)(eventComponent); (0,_utils_alarms_js__WEBPACK_IMPORTED_MODULE_5__.updateAlarms)(eventComponent);
(0,_services_talkService_js__WEBPACK_IMPORTED_MODULE_13__.updateTalkParticipants)(eventComponent); (0,_services_talkService_js__WEBPACK_IMPORTED_MODULE_13__.updateTalkParticipants)(eventComponent);
if (eventComponent.isDirty()) { let client = eventComponent.client;
let additionalFieldWasUpdated = eventComponent.client != null || eventComponent.comment != null;
if (eventComponent.isDirty() || additionalFieldWasUpdated) {
const isForkedItem = eventComponent.primaryItem !== null; const isForkedItem = eventComponent.primaryItem !== null;
let original = null; let original = null;
let fork = null; let fork = null;
@ -4601,9 +4604,21 @@ const actions = {
let { let {
calendarObject calendarObject
} = _ref8; } = _ref8;
debugger;
let eventComponent = calendarObject.calendarComponent.getFirstComponent('VEVENT'); let eventComponent = calendarObject.calendarComponent.getFirstComponent('VEVENT');
if (calendarObject.existsOnServer) { 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);
}
if (eventComponent.comment != null) {
let newCommentKeyValue = "COMMENT:" + eventComponent.comment;
icsValue = icsValue.replace(/COMMENT:[^\s]+/, newCommentKeyValue);
}
}
calendarObject.dav.data = icsValue;
await calendarObject.dav.update(); await calendarObject.dav.update();
context.commit('addCalendarObjectIdToAllTimeRangesOfCalendar', { context.commit('addCalendarObjectIdToAllTimeRangesOfCalendar', {
calendarId: calendarObject.calendarId, calendarId: calendarObject.calendarId,
@ -8202,4 +8217,4 @@ function getLinkToConfig(key) {
/***/ }) /***/ })
}]); }]);
//# sourceMappingURL=calendar-src_store_index_js.js.map?v=0338b9a6ef0b356d96af //# sourceMappingURL=calendar-src_store_index_js.js.map?v=420e15dec2eb84cba206

File diff suppressed because one or more lines are too long

View File

@ -1695,13 +1695,17 @@ const actions = {
* @return {Promise<void>} * @return {Promise<void>}
*/ */
async saveCalendarObjectInstance({ state, dispatch, commit }, { thisAndAllFuture, calendarId }) { async saveCalendarObjectInstance({ state, dispatch, commit }, { thisAndAllFuture, calendarId }) {
debugger;
const eventComponent = state.calendarObjectInstance.eventComponent const eventComponent = state.calendarObjectInstance.eventComponent
const calendarObject = state.calendarObject const calendarObject = state.calendarObject
updateAlarms(eventComponent) updateAlarms(eventComponent)
updateTalkParticipants(eventComponent) updateTalkParticipants(eventComponent)
let client = eventComponent.client;
if (eventComponent.isDirty()) { let additionalFieldWasUpdated =
eventComponent.client != null ||
eventComponent.comment != null;
if (eventComponent.isDirty() || additionalFieldWasUpdated) {
const isForkedItem = eventComponent.primaryItem !== null const isForkedItem = eventComponent.primaryItem !== null
let original = null let original = null
let fork = null let fork = null

View File

@ -224,9 +224,21 @@ const actions = {
* @return {Promise<void>} * @return {Promise<void>}
*/ */
async updateCalendarObject(context, { calendarObject }) { async updateCalendarObject(context, { calendarObject }) {
debugger;
let eventComponent = calendarObject.calendarComponent.getFirstComponent('VEVENT'); let eventComponent = calendarObject.calendarComponent.getFirstComponent('VEVENT');
if (calendarObject.existsOnServer) { 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);
}
if(eventComponent.comment != null){
let newCommentKeyValue = "COMMENT:"+eventComponent.comment;
icsValue = icsValue.replace(/COMMENT:[^\s]+/, newCommentKeyValue);
}
}
calendarObject.dav.data = icsValue;
await calendarObject.dav.update() await calendarObject.dav.update()
context.commit('addCalendarObjectIdToAllTimeRangesOfCalendar', { context.commit('addCalendarObjectIdToAllTimeRangesOfCalendar', {
calendarId: calendarObject.calendarId, calendarId: calendarObject.calendarId,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,11 @@
namespace OCA\Gestion\AppInfo; namespace OCA\Gestion\AppInfo;
use OCA\DAV\Events\CalendarObjectCreatedEvent; use OCA\DAV\Events\CalendarObjectCreatedEvent;
use OCA\DAV\Events\CalendarObjectMovedToTrashEvent;
use OCA\DAV\Events\CalendarObjectUpdatedEvent;
use OCA\Gestion\Listener\CalendarObjectCreatedListener; use OCA\Gestion\Listener\CalendarObjectCreatedListener;
use OCA\Gestion\Listener\CalendarObjectMovedToTrashListener;
use OCA\Gestion\Listener\CalendarObjectUpdatedListener;
use OCP\AppFramework\App; use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\AppFramework\Bootstrap\IRegistrationContext;
@ -21,6 +25,8 @@ class Application extends App implements IBootstrap {
public function register(IRegistrationContext $context): void { public function register(IRegistrationContext $context): void {
$context->registerEventListener(CalendarObjectCreatedEvent::class, CalendarObjectCreatedListener::class); $context->registerEventListener(CalendarObjectCreatedEvent::class, CalendarObjectCreatedListener::class);
$context->registerEventListener(CalendarObjectMovedToTrashEvent::class, CalendarObjectMovedToTrashListener::class);
$context->registerEventListener(CalendarObjectUpdatedEvent::class, CalendarObjectUpdatedListener::class);
} }
public function boot(IBootContext $context): void { public function boot(IBootContext $context): void {

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace OCA\Gestion\Constants;
abstract class DevisMentionConstant
{ const FACTURED = "factur&eacute;";
const MENTION = "Mention";
const NEW = "Nouveau";
const CANCELED = "CANCELED";
}

View File

@ -1313,8 +1313,8 @@ class PageController extends Controller {
* @NoAdminRequired * @NoAdminRequired
* @NoCSRFRequired * @NoCSRFRequired
*/ */
public function getDevis() { public function getDevis($mentionFilters = []) {
return $this->myDb->getDevis($this->idNextcloud); return $this->myDb->getDevis($this->idNextcloud,$mentionFilters);
} }
/** /**

View File

@ -5,6 +5,8 @@ use OCA\Gestion\Helpers\DateHelpers;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\IL10N; use OCP\IL10N;
use \Datetime; use \Datetime;
use OCA\Gestion\Constants\BddConstant;
use OCA\Gestion\Constants\DevisMentionConstant;
use OCA\Gestion\Constants\ProductConstant; use OCA\Gestion\Constants\ProductConstant;
use OCA\Gestion\Helpers\FileExportHelpers; use OCA\Gestion\Helpers\FileExportHelpers;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
@ -225,7 +227,7 @@ class Bdd {
return $this->execSQL($sql, array($id)); return $this->execSQL($sql, array($id));
} }
public function getDevis($idNextcloud){ public function getDevis($idNextcloud,$mentionFilters = []){
$sql = "SELECT ".$this->tableprefix."devis.id, ".$this->tableprefix."devis.id as devisid, ".$this->tableprefix."devis.user_id,".$this->tableprefix."devis.id_nextcloud ,".$this->tableprefix."devis.comment ," $sql = "SELECT ".$this->tableprefix."devis.id, ".$this->tableprefix."devis.id as devisid, ".$this->tableprefix."devis.user_id,".$this->tableprefix."devis.id_nextcloud ,".$this->tableprefix."devis.comment ,"
.$this->tableprefix."client.nom, ".$this->tableprefix."client.prenom, ".$this->tableprefix."client.id as cid, ".$this->tableprefix."client.id as id_client, " .$this->tableprefix."client.nom, ".$this->tableprefix."client.prenom, ".$this->tableprefix."client.id as cid, ".$this->tableprefix."client.id as id_client, "
.$this->tableprefix."client.adresse as adresse_cli,".$this->tableprefix."client.mail as mail_cli,".$this->tableprefix."client.telephone as telephone_cli,".$this->tableprefix."client.legal_one as legalone_cli," .$this->tableprefix."client.adresse as adresse_cli,".$this->tableprefix."client.mail as mail_cli,".$this->tableprefix."client.telephone as telephone_cli,".$this->tableprefix."client.legal_one as legalone_cli,"
@ -234,13 +236,20 @@ class Bdd {
.$this->tableprefix."lieu.id as lid, ".$this->tableprefix."lieu.nom as lieu,".$this->tableprefix."lieu.adresse as adresse_soin,".$this->tableprefix."devis.id_lieu, " .$this->tableprefix."lieu.id as lid, ".$this->tableprefix."lieu.nom as lieu,".$this->tableprefix."lieu.adresse as adresse_soin,".$this->tableprefix."devis.id_lieu, "
.$this->tableprefix."defunt.id as id_defunt, ".$this->tableprefix."defunt.nom as nom_defunt, " .$this->tableprefix."defunt.id as id_defunt, ".$this->tableprefix."defunt.nom as nom_defunt, "
.$this->tableprefix."devis.devis_full_number as devis_full_number .$this->tableprefix."devis.devis_full_number as devis_full_number
FROM (".$this->tableprefix."devis FROM ".$this->tableprefix."devis
LEFT JOIN ".$this->tableprefix."defunt on id_defunt = ".$this->tableprefix."defunt.id LEFT JOIN ".$this->tableprefix."defunt on id_defunt = ".$this->tableprefix."defunt.id
LEFT JOIN ".$this->tableprefix."client on id_client = ".$this->tableprefix."client.id LEFT JOIN ".$this->tableprefix."client on id_client = ".$this->tableprefix."client.id
LEFT JOIN ".$this->tableprefix."thanato on id_thanato = ".$this->tableprefix."thanato.id LEFT JOIN ".$this->tableprefix."thanato on id_thanato = ".$this->tableprefix."thanato.id
LEFT JOIN ".$this->tableprefix."lieu on id_lieu = ".$this->tableprefix."lieu.id LEFT JOIN ".$this->tableprefix."lieu on id_lieu = ".$this->tableprefix."lieu.id";
) ORDER BY ".$this->tableprefix."devis.id DESC, ".$this->tableprefix."devis.date DESC;";
return $this->execSQL($sql, array()); $conditions = [];
if(!empty($mentionFilters)){
$mentionsFilterPlaceholders = implode(',', array_fill(0, count($mentionFilters), '?'));
$sql .= " WHERE ". $this->tableprefix."devis.mentions IN ($mentionsFilterPlaceholders)";
$conditions = array_merge($conditions, $mentionFilters);
}
$sql .= " ORDER BY ".$this->tableprefix."devis.id DESC, ".$this->tableprefix."devis.date DESC;";
return $this->execSQL($sql, $conditions);
} }
public function getDevisWithProduits($idNextcloud){ public function getDevisWithProduits($idNextcloud){
@ -1160,26 +1169,30 @@ class Bdd {
return $last; return $last;
} }
private function getDevisIdListFilteredByMentionAndDevisListId($mentionToNotInclude,$devisListId){ private function getDevisIdListFilteredByMentionAndDevisListId($mentionsFilter,$devisListId){
if (empty($devisListId)) { if (empty($devisListId)) {
return []; return [];
} }
$placeholders = implode(',', array_fill(0, count($devisListId), '?')); $placeholders = implode(',', array_fill(0, count($devisListId), '?'));
$mentionsFilterPlaceholders = implode(',', array_fill(0, count($mentionsFilter), '?'));
$this->logger->debug('Placeholders : ' . $placeholders); $this->logger->debug('Placeholders : ' . $placeholders);
$sql = "SELECT devis.id as id,devis.date as devis_date $sql = "SELECT devis.id as id,devis.date as devis_date
FROM ".$this->tableprefix."devis as devis FROM ".$this->tableprefix."devis as devis
WHERE devis.id IN ($placeholders) AND mentions != ?"; WHERE devis.id IN ($placeholders) AND
mentions IN ($mentionsFilterPlaceholders)";
$this->logger->debug('SQL : ' . $sql); $result = $this->execSQLNoJsonReturn($sql,array_merge(
$result = $this->execSQLNoJsonReturn($sql,array_merge($devisListId, [$mentionToNotInclude])); $devisListId,
$mentionsFilter));
return $result; return $result;
} }
public function insertFactureForeEachDevisId($idNextCloud,$devisIdArray,$paymentDate = null){ public function insertFactureForeEachDevisId($idNextCloud,$devisIdArray,$paymentDate = null){
$devisIdarrayToString = implode(',', $devisIdArray); $mentionsFilter = [
$this->logger->debug($devisIdarrayToString); DevisMentionConstant::NEW,
$mentionToNotInclude = 'factur&eacute;'; DevisMentionConstant::MENTION
$devisIdListFiltered = $this->getDevisIdListFilteredByMentionAndDevisListId($mentionToNotInclude,$devisIdArray); ];
$devisIdListFiltered = $this->getDevisIdListFilteredByMentionAndDevisListId($mentionsFilter,$devisIdArray);
$factureIdsGenerated = []; $factureIdsGenerated = [];
foreach($devisIdListFiltered as $devis){ foreach($devisIdListFiltered as $devis){
$factureId = $this->insertFactureByDevisId($idNextCloud,$devis['id'],$devis['devis_date'],$paymentDate); $factureId = $this->insertFactureByDevisId($idNextCloud,$devis['id'],$devis['devis_date'],$paymentDate);
@ -2247,6 +2260,7 @@ class Bdd {
produit_devis.produit_id, produit_devis.produit_id,
produit_devis.quantite, produit_devis.quantite,
produit_devis.discount, produit_devis.discount,
produit_devis.devis_id,
produit.prix_unitaire as produit_price, produit.prix_unitaire as produit_price,
produit.reference as produit_reference, produit.reference as produit_reference,
produit.description as produit_description, produit.description as produit_description,
@ -3057,6 +3071,127 @@ class Bdd {
$message .= ". COMMENTAIRES: ".html_entity_decode($devis->comment); $message .= ". COMMENTAIRES: ".html_entity_decode($devis->comment);
return $message; return $message;
} }
} 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]);
}
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 updateDevisComment($devisId,$requestedComment,$currentComment = null){
$commentIsUpdated = $currentComment != $requestedComment;
if($commentIsUpdated){
$sql= "UPDATE ".$this->tableprefix."devis as devis
SET devis.comment = ?
WHERE devis.id = ?";
$this->execSQLNoData($sql,[$requestedComment,$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);
}
}
}
}

View 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\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->logger->debug($vCalendarString);
$this->gestionService->HandleCalendarObjectMovedToTrash($vCalendarString);
}
}

View 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);
}
}

View File

@ -127,6 +127,45 @@ class GestionService {
return $calendarStartDate; return $calendarStartDate;
} }
public function HandleCalendarObjectMovedToTrash(string $vCalendarString){
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
$devis = $this->gestionBdd->getDevisByCalendarUuid($calendarUuid);
if($devis != null){
$this->gestionBdd->updateDevisMentionToCanceled($devis['id']);
}
return true;
}
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']);
$requestedDevisComment = $this->GetDevisCommentFromVCalendarString($vCalendarString);
$this->gestionBdd->updateDevisComment($devis['id'],$requestedDevisComment,$devis['comment']);
$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->UpdateDevisDataByVCalendarString($devis,$vCalendarString);
}
return true;
}
public function HandleCreatedCalendarObject(string $vCalendarString){ public function HandleCreatedCalendarObject(string $vCalendarString){
$calendarSummary = $this->GetCalendarSummaryFromVCalendarString($vCalendarString); $calendarSummary = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
$clientId = $this->GetClientIdFromVCalendarString($vCalendarString); $clientId = $this->GetClientIdFromVCalendarString($vCalendarString);

View File

@ -0,0 +1,4 @@
export const FacturedDevisMentionConstant = "factur&eacute;";
export const DefaultDevisMentionConstant = "Mention";
export const NewDevisMentionConstant = "Nouveau";
export const CanceledDevisMentionConstant = "CANCELED";

View File

@ -16,6 +16,7 @@ import { Defunt } from "../objects/defunt.mjs";
import { Bibliotheque } from "../objects/bibliotheque.mjs"; import { Bibliotheque } from "../objects/bibliotheque.mjs";
import { ClientGroup } from '../objects/clientGroup.mjs'; import { ClientGroup } from '../objects/clientGroup.mjs';
import { ClientGroupDiscount } from "../objects/clientGroupDiscount.mjs"; import { ClientGroupDiscount } from "../objects/clientGroupDiscount.mjs";
import { DefaultDevisMentionConstant, FacturedDevisMentionConstant, NewDevisMentionConstant } from "../constants/invoiceConstant";
var choose_folder = t('gestion', 'Choose work folder'); var choose_folder = t('gestion', 'Choose work folder');
@ -68,7 +69,13 @@ document.body.addEventListener('click', e => {
Devis.loadDevisList_dnum(e); Devis.loadDevisList_dnum(e);
}else if(e.target.className.includes("loadSelect_listalldevis")){ }else if(e.target.className.includes("loadSelect_listalldevis")){
Devis.loadAllDevisList_dnum(e); Devis.loadAllDevisList_dnum(e);
}else if(e.target.className.includes("loadSelect_listDelphineDevis")){ }else if(e.target.className.includes("selectAvailableDevis")){
Devis.loadAllDevisList_dnum(e,[
NewDevisMentionConstant,
DefaultDevisMentionConstant
]);
}
else if(e.target.className.includes("loadSelect_listDelphineDevis")){
Devis.loadDelphineDevisList_dnum(e); Devis.loadDelphineDevisList_dnum(e);
}else if(e.target.className.includes("loadSelect_listdefunt")){ }else if(e.target.className.includes("loadSelect_listdefunt")){
Defunt.loadDefuntList_tid(e); Defunt.loadDefuntList_tid(e);

View File

@ -1,13 +1,14 @@
import { generateUrl } from "@nextcloud/router"; import { generateUrl } from "@nextcloud/router";
import { updateDB } from "../modules/ajaxRequest.mjs"; import { updateDB } from "../modules/ajaxRequest.mjs";
import { baseUrl, checkSelectPurJs, LoadDT, showDone } from "../modules/mainFunction.mjs"; import { baseUrl, checkSelectPurJs, LoadDT, showDone } from "../modules/mainFunction.mjs";
import { NewDevisMentionConstant,FacturedDevisMentionConstant,DefaultDevisMentionConstant,CanceledDevisMentionConstant } from "../constants/invoiceConstant.js";
export class Devis { export class Devis {
/** /**
* Devis object * Devis object
* @param myresp instantiate devis object * @param myresp instantiate devis object
*/ */
constructor(myresp) { constructor(myresp) {
this.id = myresp.id; this.id = myresp.id;
this.user_id = myresp.user_id; this.user_id = myresp.user_id;
@ -26,13 +27,36 @@ export class Devis {
this.nomThanato = Devis.getDevisThanatoFullname(myresp); this.nomThanato = Devis.getDevisThanatoFullname(myresp);
this.version = ((myresp.version == null || myresp.version.length === 0) ? '-' : myresp.version); this.version = ((myresp.version == null || myresp.version.length === 0) ? '-' : myresp.version);
this.lieu = ((myresp.lieu == null || myresp.lieu.length === 0) ? '-' : myresp.lieu); 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`); this.baseUrl = generateUrl(`/apps/gestion/devis/${this.id}/show`);
this.devisFullNumber = ((myresp.devis_full_number != null && myresp.mentions.devis_full_number != 0) ? myresp.devis_full_number : '-'); this.devisFullNumber = ((myresp.devis_full_number != null && myresp.mentions.devis_full_number != 0) ? myresp.devis_full_number : '-');
this.devisProduits = Devis.getDevisProduitsString(myresp); this.devisProduits = Devis.getDevisProduitsString(myresp);
} }
static getDevisMentionLabelFromMention(mention){
let labelValue = mention;
switch (mention) {
case FacturedDevisMentionConstant:
labelValue = "Facturé"
break;
case CanceledDevisMentionConstant:
labelValue = "Annulé"
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 getDevisThanatoFullname(myresp){ static getDevisThanatoFullname(myresp){
let thanatoPrenom = ''; let thanatoPrenom = '';
let thanatoNom = ''; let thanatoNom = '';
@ -51,6 +75,20 @@ export class Devis {
return (thanatoFullName.length === 0) ? '-' : thanatoFullName; return (thanatoFullName.length === 0) ? '-' : thanatoFullName;
} }
static getDevisMentionCssStyle(mention){
let style = "display:inline; border-radius: 5px; padding: 8px;";
if(mention === FacturedDevisMentionConstant){
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;
}
static getDevisProduitsString(myresp){ static getDevisProduitsString(myresp){
let devisProduitsAsString = ''; let devisProduitsAsString = '';
if(myresp.produits != null && myresp.produits.length > 0){ if(myresp.produits != null && myresp.produits.length > 0){
@ -83,7 +121,7 @@ export class Devis {
'<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_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>', '<div class="loadSelect_listlieu" data-table="devis" data-column="id_lieu" data-id="' + this.id + '" data-current="' + this.lid + '">' + this.lieu + '</div>',
'<div>' + this.devisProduits + '</div>', '<div>' + this.devisProduits + '</div>',
(this.mentions == "factur&eacute;")?('<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>' '<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; return myrow;
@ -117,7 +155,6 @@ export class Devis {
oReq.setRequestHeader("Content-Type", "application/json"); oReq.setRequestHeader("Content-Type", "application/json");
oReq.onload = function(e){ oReq.onload = function(e){
if (this.status == 200) { if (this.status == 200) {
console.log(this.response);
// let devis_temp = (JSON.parse(JSON.parse(this.response))).filter((d)=>(d.mentions != "factur&eacute;")); // let devis_temp = (JSON.parse(JSON.parse(this.response))).filter((d)=>(d.mentions != "factur&eacute;"));
// devis_temp = JSON.stringify(JSON.stringify(devis_temp)); // devis_temp = JSON.stringify(JSON.stringify(devis_temp));
LoadDT(devisDT, JSON.parse(this.response), Devis); LoadDT(devisDT, JSON.parse(this.response), Devis);
@ -144,9 +181,14 @@ export class Devis {
oReq.send(); oReq.send();
} }
static getAllDevis(callback){ static getAllDevis(callback,mentionFilters = []){
var oReq = new XMLHttpRequest(); var oReq = new XMLHttpRequest();
oReq.open('PROPFIND', baseUrl + '/getDevis', true); let url = baseUrl + '/getDevis';
if(mentionFilters.length > 0){
const queryParams = mentionFilters.map(mention => `mentionFilters[]=${encodeURIComponent(mention)}`).join('&');
url = `${url}?${queryParams}`;
}
oReq.open('PROPFIND', url, true);
oReq.setRequestHeader("Content-Type", "application/json"); oReq.setRequestHeader("Content-Type", "application/json");
oReq.onload = function(e){ oReq.onload = function(e){
if (this.status == 200) { if (this.status == 200) {
@ -225,7 +267,7 @@ export class Devis {
}); });
} }
static loadAllDevisList_dnum(e){ static loadAllDevisList_dnum(e,mentionFilters = []){
Devis.getAllDevis( response => { Devis.getAllDevis( response => {
var selectElement = document.createElement("select"); var selectElement = document.createElement("select");
selectElement.dataset.current = e.target.dataset.current; selectElement.dataset.current = e.target.dataset.current;
@ -271,7 +313,7 @@ export class Devis {
e.target.innerHTML = '' e.target.innerHTML = ''
e.target.appendChild(selectElement); e.target.appendChild(selectElement);
}); },mentionFilters);
} }
static loadDelphineDevisList_dnum(e){ static loadDelphineDevisList_dnum(e){

View File

@ -38,7 +38,7 @@ export class Facture {
'<input style="margin:0;padding:0;" class="inputDate devisOrFactureInputDate" type="date" value=' + this.date + ' data-table="facture" data-column="date" data-id="' + this.id + '"/>', '<input style="margin:0;padding:0;" class="inputDate devisOrFactureInputDate" type="date" value=' + this.date + ' data-table="facture" data-column="date" data-id="' + this.id + '"/>',
'<input style="margin:0;padding:0;" class="inputDate devisOrFactureInputDate" type="date" value=' + this.date_paiement + ' data-table="facture" data-column="date_paiement" data-id="' + this.id + '"/>', '<input style="margin:0;padding:0;" class="inputDate devisOrFactureInputDate" type="date" value=' + this.date_paiement + ' data-table="facture" data-column="date_paiement" data-id="' + this.id + '"/>',
'<div class="editable" data-table="facture" data-column="type_paiement" data-id="' + this.id + '">' + this.type_paiement + '</div>', '<div class="editable" data-table="facture" data-column="type_paiement" data-id="' + this.id + '">' + this.type_paiement + '</div>',
'<div class="loadSelect_listdevis" data-table="facture" data-column="id_devis" data-id="' + this.id + '" data-current="' + this.id_devis + '">' + this.nom_defunt + ' | <span style="font-size: 0.7rem">' + this.prenom + ' ' + this.nom + '</span></div>', '<div class="selectAvailableDevis" data-table="facture" data-column="id_devis" data-id="' + this.id + '" data-current="' + this.id_devis + '">' + this.nom_defunt + ' | <span style="font-size: 0.7rem">' + this.prenom + ' ' + this.nom + '</span></div>',
'<div class="" data-table="facture" data-column="" data-id="' + this.id + '" style="display:inline">' + this.lieu + '</div>', '<div class="" data-table="facture" data-column="" data-id="' + this.id + '" style="display:inline">' + this.lieu + '</div>',
'<div>' + this.factureProduits + '</div>', '<div>' + this.factureProduits + '</div>',
'<div class="editable" data-table="facture" data-column="status_paiement" data-id="' + this.id + '" style="display:inline">' + this.status_paiement + '</div>', '<div class="editable" data-table="facture" data-column="status_paiement" data-id="' + this.id + '" style="display:inline">' + this.status_paiement + '</div>',