diff --git a/src/module_anc/module/forms/anc_saisie/anc_saisie_anc_controle_controle_rapport.js b/src/module_anc/module/forms/anc_saisie/anc_saisie_anc_controle_controle_rapport.js new file mode 100644 index 0000000000000000000000000000000000000000..87b9c63c84d97ac6ba482d42839178b578817e60 --- /dev/null +++ b/src/module_anc/module/forms/anc_saisie/anc_saisie_anc_controle_controle_rapport.js @@ -0,0 +1,149 @@ + +var $q = angular.element(vitisApp.appMainDrtv).injector().get(['$q']); +var $log = angular.element(vitisApp.appMainDrtv).injector().get(['$log']); +var envSrvc = angular.element(vitisApp.appMainDrtv).injector().get(['envSrvc']); +var propertiesSrvc = angular.element(vitisApp.appMainDrtv).injector().get(['propertiesSrvc']); + +/** + * constructor_form + * Function called by form init only if javascript boolean is Equal true + * @param {type} scope Scope who contain the formreader + * @param {type} s_url URL of file for destructor + * @returns {undefined} + */ +var constructor_form = function (scope, s_url) { + console.log("Constructor Rapports"); + + var sBoId; + console.log("propertiesSrvc: ", propertiesSrvc); + if (angular.isDefined(propertiesSrvc)) { + if (angular.isDefined(propertiesSrvc['anc'])) { + if (angular.isDefined(propertiesSrvc['anc']['controle'])) { + if (angular.isDefined(propertiesSrvc['anc']['controle']['business_object_id'])) { + sBoId = propertiesSrvc['anc']['controle']['business_object_id']; + } + } + } + } + + getReportsArray(sBoId).then(function(aPrintReports){ + console.log("aPrintReports: ", aPrintReports); + + if (typeof aPrintReports !== 'object') { + aPrintReports = []; + } + + var sHTMLList = getReportsListAsHTML(aPrintReports); + $('#anc_saisie_controle_rapports_list_container').parent().html(sHTMLList); + }); +}; + +/** + * destructor_form + * Function called before constructor_form of a new form to remove all the watchers, variables, and others objects useless for others forms + * @returns {undefined} + */ +var destructor_form = function () { + console.log("Destructor Rapports"); +}; + +/** + * Download the BO reports list + * @param {string} business_object_id + * @return {promise} + */ +var getReportsArray = function(sBoId) { + $log.info('getReportsArray'); + + var deferred = $q.defer(); + + if (!angular.isDefined(sBoId) || sBoId == '') { + console.error('Objet métier non configuré'); + deferred.resolve([]); + } else { + + // Récupère la liste des rapports disponibles + ajaxRequest({ + 'method': 'GET', + 'url': propertiesSrvc["web_server_name"] + "/" + propertiesSrvc["services_alias"] + '/vmap/printreports', + 'headers': { + 'Accept': 'application/x-vm-json' + }, + 'params': { + 'attributs': 'name|printreport_id|business_object_id|business_object_id_field|multiobject', + 'filter': { + "column": "business_object_id", + "compare_operator": "=", + "value": sBoId + } + }, + 'success': function (response) { + if (!angular.isDefined(response['data'])) { + console.error('response.data undefined: ', response); + deferred.resolve([]); + return 0; + } + if (!angular.isDefined(response['data']['data'])) { + console.error('Aucun rapport disponible pour ' + sBoId); + deferred.resolve([]); + return 0; + } + var avaliablePrintReports = response['data']['data']; + deferred.resolve(avaliablePrintReports); + } + }); + } + + return deferred.promise; +} + +/** + * Retourne une liste HTML contenant les rapports + * @param {array} aPrintReports liste des rapports + * @return {dom} Liste au format HTML + */ +var getReportsListAsHTML = function(aPrintReports) { + + if (!aPrintReports.length > 0) { + return 'Aucun rapport disponible'; + } + + var domLi; + var sHTMLLi; + var domUl = $(document.createElement('ul')).addClass('anc_saisie_controle_rapports_list'); + for (var i = 0; i < aPrintReports.length; i++) { + + sHTMLLi = '<li>'; + sHTMLLi += '<a href="javascript:void(0)" class="padding-sides-10">'; + sHTMLLi += '<span class="glyphicon glyphicon-download-alt margin-sides-5"></span>'; + sHTMLLi += aPrintReports[i]['name']; + sHTMLLi += '<span class="margin-sides-5 icon-files-o"></span>'; + sHTMLLi += '</a>'; + sHTMLLi += '</li>'; + domLi = $(sHTMLLi); + + $(domLi).click(angular.bind(this, generateReport, aPrintReports[i])); + $(domUl).append($(domLi)); + } + + return domUl; +} + +/** + * Génère le rapport vMap correspondant + * + * @param {object} oPrintReport Définition du rapport + */ +var generateReport = function(oPrintReport) { + + if (angular.isDefined(oVmap.generatePrintReport)) { + oVmap.generatePrintReport({ + 'printReportId': oPrintReport['printreport_id'], + 'ids': envSrvc['sId'] + }); + } else { + var sMessage = 'Module vMap requis pour effectuer cette opération'; + console.error(sMessage); + $.notify(sMessage, 'error'); + } +} diff --git a/src/module_anc/module/forms/anc_saisie/anc_saisie_anc_controle_controle_rapport.json b/src/module_anc/module/forms/anc_saisie/anc_saisie_anc_controle_controle_rapport.json new file mode 100644 index 0000000000000000000000000000000000000000..c8a5758c3e64da694c2019ad12a307e74a5e4f7d --- /dev/null +++ b/src/module_anc/module/forms/anc_saisie/anc_saisie_anc_controle_controle_rapport.json @@ -0,0 +1,73 @@ +{ + "display": { + "name": "anc_saisie_anc_controle_controle_schema-form", + "title": "ANC_SAISIE_ANC_CONTROLE_CONTROLE_SCHEMA_TITLE", + "input_size": "xxs", + "nb_cols": 12, + "javascript": false, + "rows": [ + { + "fields": [ + { + "type": "button", + "class": "btn-ungroup btn-group-sm", + "nb_cols": 12, + "name": "display_button", + "id": "display_button", + "buttons": [ + { + "type": "button", + "name": "return_list", + "label": "FORM_RETURN_LIST", + "class": "btn-primary", + "event": "setMode(\"search\")" + } + ] + } + ] + } + ] + }, + "search": { + "name": "anc_saisie_anc_controle_controle_schema-form", + "title": "ANC_SAISIE_ANC_CONTROLE_CONTROLE_SCHEMA_TITLE", + "input_size": "xxs", + "nb_cols": 12, + "javascript": false, + "rows": [ + + ] + }, + "insert": { + "name": "anc_saisie_anc_controle_controle_schema-form", + "title": "ANC_SAISIE_ANC_CONTROLE_CONTROLE_SCHEMA_TITLE_INSERT", + "input_size": "xxs", + "nb_cols": 12, + "javascript": false, + "rows": [ + + ], + "event": "sendSimpleForm()" + }, + "update": { + "name": "anc_saisie_anc_controle_controle_rapport-form", + "title": "ANC_SAISIE_ANC_CONTROLE_CONTROLE_RAPPORT_TITLE", + "input_size": "xxs", + "nb_cols": 12, + "javascript": true, + "rows": [ + { + "fields": [ + { + "type": "label", + "name": "raports", + "label": "Rapports", + "id": "anc_saisie_controle_rapports_list_container", + "nb_cols": 12 + } + ] + } + ], + "event": "sendSimpleForm()" + } +} diff --git a/src/module_anc/module/lang/lang-en.json b/src/module_anc/module/lang/lang-en.json index 9c458e29aced1e4ba66d568140a802113f7931bf..1487e6a0045603c213cd191d9f05ee99c01562a1 100644 --- a/src/module_anc/module/lang/lang-en.json +++ b/src/module_anc/module/lang/lang-en.json @@ -427,6 +427,7 @@ "ANC_SAISIE_ANC_CONTROLE_CONTROLE_PRETRAITEMENT_TITLE_UPDATE" : "Pretreatment n°{{sId}}", "ANC_SAISIE_ANC_CONTROLE_CONTROLE_PRETRAITEMENT_TITLE_DISPLAY" : "Pretreatment n°{{sId}}", "ANC_SAISIE_ANC_CONTROLE_CONTROLE_SCHEMA_TITLE" : "", + "ANC_SAISIE_ANC_CONTROLE_CONTROLE_RAPPORT_TITLE" : "Reports", "GRID_TITLE_ANC_SAISIE_ANC_CONTROLE_CONTROLE_TRAITEMENT" : "Liste des traitements du contrôle", "ANC_SAISIE_ANC_CONTROLE_CONTROLE_TRAITEMENT_TITLE_INSERT" : "Treatement", "ANC_SAISIE_ANC_CONTROLE_CONTROLE_TRAITEMENT_TITLE_UPDATE" : "Treatement n°{{sId}}", diff --git a/src/module_anc/module/lang/lang-fr.json b/src/module_anc/module/lang/lang-fr.json index 42e7f1224d3048de063b209203a858a81a7e75a0..b2fd7288a32cc36971715c24ac4c18e04739dc44 100644 --- a/src/module_anc/module/lang/lang-fr.json +++ b/src/module_anc/module/lang/lang-fr.json @@ -428,6 +428,7 @@ "ANC_SAISIE_ANC_CONTROLE_CONTROLE_PRETRAITEMENT_TITLE_UPDATE" : "Prétraitement n°{{sId}}", "ANC_SAISIE_ANC_CONTROLE_CONTROLE_PRETRAITEMENT_TITLE_DISPLAY" : "Prétraitement n°{{sId}}", "ANC_SAISIE_ANC_CONTROLE_CONTROLE_SCHEMA_TITLE" : "", + "ANC_SAISIE_ANC_CONTROLE_CONTROLE_RAPPORT_TITLE" : "Rapports", "GRID_TITLE_ANC_SAISIE_ANC_CONTROLE_CONTROLE_TRAITEMENT" : "Liste des traitements du contrôle", "ANC_SAISIE_ANC_CONTROLE_CONTROLE_TRAITEMENT_TITLE_INSERT" : "Traitement", "ANC_SAISIE_ANC_CONTROLE_CONTROLE_TRAITEMENT_TITLE_UPDATE" : "Traitement n°{{sId}}", diff --git a/src/module_anc/module/less/controle.less b/src/module_anc/module/less/controle.less new file mode 100644 index 0000000000000000000000000000000000000000..58349156f8a25029e8ebf618f3663700b2e0b4e4 --- /dev/null +++ b/src/module_anc/module/less/controle.less @@ -0,0 +1,29 @@ + + +ul.anc_saisie_controle_rapports_list { + float: left; + min-width: 50%; + padding: 5px 0; + margin: 2px 0 0; + font-size: 14px; + text-align: left; + list-style: none; + background-color: #fff; + -webkit-background-clip: padding-box; + background-clip: padding-box; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, 0.15); + border-radius: 4px; + -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); + box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); +} + +ul.anc_saisie_controle_rapports_list > li > a { + display: block; + padding: 3px 20px; + clear: both; + font-weight: 400; + line-height: 1.42857143; + color: #333; + white-space: nowrap; +} diff --git a/src/module_anc/module/less/main.less b/src/module_anc/module/less/main.less index bb0d9d122754198104f0338eaf75dec3909d4767..527f89c953f796ab8027de8bab8048ac2e37e216 100644 --- a/src/module_anc/module/less/main.less +++ b/src/module_anc/module/less/main.less @@ -2,4 +2,5 @@ @ui-grid-bg-image: "../images/ui-grid/wbg.gif"; @font-color-purple: #6d1a67; @test-color: black; -@import 'installation.less'; \ No newline at end of file +@import 'installation.less'; +@import 'controle.less'; diff --git a/src/module_anc/web_service/conf/properties.inc b/src/module_anc/web_service/conf/properties.inc index a9031e78ca538fae970a6fb1226362541fc3d0b2..a8477bb70bdf2e2a65c76622d9d7b7d922ac521e 100755 --- a/src/module_anc/web_service/conf/properties.inc +++ b/src/module_anc/web_service/conf/properties.inc @@ -7,4 +7,5 @@ $properties["anc"]["code_postal"]["schema"] = ''; $properties["anc"]["code_postal"]["table"] = ''; $properties["anc"]["code_postal"]["column"] = ''; -?> \ No newline at end of file + $properties["anc"]["controle"]["business_object_id"] = ''; +?> diff --git a/src/module_anc/web_service/sql/sqlQueries.xml b/src/module_anc/web_service/sql/sqlQueries.xml index 1741ee1d666aca0520ac490ac6810771af3495e2..c3d9f5e91d0fa278d75cac91ec07ee441e599b86 100644 --- a/src/module_anc/web_service/sql/sqlQueries.xml +++ b/src/module_anc/web_service/sql/sqlQueries.xml @@ -3125,6 +3125,11 @@ INSERT INTO s_vitis.vm_table_button (button_class, table_button_id, event, label_id, ressource_id, tab_id) VALUES ('add_smallFlexigrid',(SELECT nextval('s_vitis.seq_vm'::regclass)), 'AddSectionForm', 'anc_14', (SELECT ressource_id FROM s_vitis.vm_tab WHERE vm_tab.name = 'anc_installation'), (SELECT tab_id FROM s_vitis.vm_tab WHERE vm_tab.name = 'anc_installation')); INSERT INTO s_vitis.vm_table_button (button_class, table_button_id, event, label_id, ressource_id, tab_id) VALUES ('deleteFlexigrid',(SELECT nextval('s_vitis.seq_vm'::regclass)), 'DeleteSelection', 'anc_13', (SELECT ressource_id FROM s_vitis.vm_tab WHERE vm_tab.name = 'anc_installation'), (SELECT tab_id FROM s_vitis.vm_tab WHERE vm_tab.name = 'anc_installation')); UPDATE s_vitis.vm_tab SET sorted_dir = 'DESC' WHERE name = 'anc_installation'; + -- Armand 16/01/2019 15h01 + INSERT INTO s_vitis.vm_string (string, string_id) VALUES ('section rapport', 'anc_135'); + INSERT INTO s_vitis.vm_translation (translation_id, lang, translation) VALUES ('anc_135', 'en', 'Reports'); + INSERT INTO s_vitis.vm_translation (translation_id, lang, translation) VALUES ('anc_135', 'fr', 'Rapports'); + INSERT INTO s_vitis.vm_section (label_id, name, index, event, tab_id, template, ressource_id, module) VALUES ('anc_135', 'controle_rapport', 12, 'Javascript:loadSectionForm', (SELECT tab_id FROM s_vitis.vm_tab WHERE vm_tab.name = 'anc_controle'), 'simpleFormTpl.html', (SELECT ressource_id FROM s_vitis.vm_tab WHERE vm_tab.name = 'anc_controle'), 'anc'); -- Frédéric le 16/01/2019 15:52 ALTER TABLE s_anc.param_entreprise ADD COLUMN commune character varying(50); UPDATE s_anc.param_entreprise SET commune = id_com; diff --git a/src/module_vmap/module/javascript/app/vmap/vmap.js b/src/module_vmap/module/javascript/app/vmap/vmap.js index f178a8c8318359837bd33d27463450bfe7744ea8..827c9d01c74d66819605bb7bba3177a2804d6454 100644 --- a/src/module_vmap/module/javascript/app/vmap/vmap.js +++ b/src/module_vmap/module/javascript/app/vmap/vmap.js @@ -897,7 +897,7 @@ oVmap.maxResizeBottomBar = function () { oVmap.minResizeBottomBar = function () { angular.element($('#olMap')).scope()['ctrl'].startAnimation(); angular.element($('#olMapCompare')).scope()['ctrl'].startAnimation(); - + if ($("#map-container").hasClass("open2")) { $("#map-container").removeClass("open2"); $("#bottombar").removeClass("open2"); @@ -1131,9 +1131,17 @@ oVmap.generatePrintReport = function (opt_options) { } printWindow.document.write('<div style="width: 100%; text-align: center; margin-top: 80px"><img src="images/ajax-big-loader.GIF" alt="Load img" style="width: 200px;height: 170px;"><br><br><i style="color: gray">Construction de la fiche en cours..</i></div>'); + var sUrl; + if (goog.isDefAndNotNull(oVmap['properties']['api_url'])) { + sUrl = oVmap['properties']['api_url'] + '/vmap/printreportservices'; + } else { + var propertiesSrvc = angular.element(vitisApp.appMainDrtv).injector().get(['propertiesSrvc']); + sUrl = propertiesSrvc["web_server_name"] + "/" + propertiesSrvc["services_alias"] + '/vmap/printreportservices'; + } + ajaxRequest({ 'method': 'POST', - 'url': oVmap['properties']['api_url'] + '/vmap/printreportservices', + 'url': sUrl, 'headers': { 'Accept': 'application/x-vm-json' },