alsmanager_lib 3.0.89 → 3.0.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/modules.js +105 -29
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -6823,7 +6823,7 @@ function getDatesRangeConsegne() {
6823
6823
  }
6824
6824
 
6825
6825
 
6826
- function queryConsegneSQLite(data_da, data_a, data_filter, adulto, alunno, still_open) {
6826
+ function queryConsegneSQLite(data_da, data_a, data_filter, adulto, alunno, still_open, only_outofdate) {
6827
6827
  var query = "SELECT c.id, c.data_richiesta as Richiesta, c.data_consegna as Consegna, c.richiedente_adulto as Adulto, c.richiedente_alunno as Alunno, c.richiedente_genitore as Genitore, c.is_home as Casa, c.note as Note, c.email_adulto, c.email_genitore from consegne c ";
6828
6828
  query += "where (removed is null or removed = 0) ";
6829
6829
  if (adulto && adulto.trim() != '') {
@@ -6856,6 +6856,9 @@ function queryConsegneSQLite(data_da, data_a, data_filter, adulto, alunno, still
6856
6856
  if (still_open) {
6857
6857
  query += " and (select count(*) from consegna_beni where id_consegna = c.id and stato_restituzione in(0,1)) > 0"
6858
6858
  }
6859
+ if (only_outofdate && only_outofdate > 0) {
6860
+ query += " and date('now') >= c.data_limite ";
6861
+ }
6859
6862
  }
6860
6863
  if (data_filter == "RICHIESTA")
6861
6864
  query += " order by data_richiesta desc";
@@ -6864,7 +6867,7 @@ function queryConsegneSQLite(data_da, data_a, data_filter, adulto, alunno, still
6864
6867
  return query;
6865
6868
  }
6866
6869
 
6867
- function queryConsegneMySQL(data_da, data_a, data_filter, adulto, alunno, still_open) {
6870
+ function queryConsegneMySQL(data_da, data_a, data_filter, adulto, alunno, still_open, only_outofdate) {
6868
6871
  var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note, email_adulto, email_genitore from consegne ";
6869
6872
  query += "where (removed is null or removed = 0) ";
6870
6873
  if (adulto && adulto.trim() != '') {
@@ -6893,6 +6896,9 @@ function queryConsegneMySQL(data_da, data_a, data_filter, adulto, alunno, still_
6893
6896
  if (still_open) {
6894
6897
  query += " and (select count(*) from consegna_beni where id_consegna = c.id and stato_restituzione in(0,1)) > 0"
6895
6898
  }
6899
+ if (only_outofdate && only_outofdate > 0) {
6900
+ query += " and date('now') >= c.data_limite ";
6901
+ }
6896
6902
  }
6897
6903
  if (data_filter == "RICHIESTA")
6898
6904
  query += " order by data_richiesta desc";
@@ -6901,18 +6907,18 @@ function queryConsegneMySQL(data_da, data_a, data_filter, adulto, alunno, still_
6901
6907
 
6902
6908
  return query;
6903
6909
  }
6904
- function queryConsegne(db_used,data_da, data_a, data_filter, adulto, alunno, still_open) {
6910
+ function queryConsegne(db_used,data_da, data_a, data_filter, adulto, alunno, still_open, only_outofdate) {
6905
6911
  var query = "";
6906
6912
  if (db_used) {
6907
6913
  switch (db_used) {
6908
6914
  case 'SQLITE':
6909
- query = queryConsegneSQLite(data_da, data_a, data_filter, adulto, alunno, still_open);
6915
+ query = queryConsegneSQLite(data_da, data_a, data_filter, adulto, alunno, still_open, only_outofdate);
6910
6916
  break;
6911
6917
  case 'MYSQL':
6912
- query = queryConsegneMySQL(data_da, data_a, data_filter, adulto, alunno, still_open);
6918
+ query = queryConsegneMySQL(data_da, data_a, data_filter, adulto, alunno, still_open, only_outofdate);
6913
6919
  break;
6914
6920
  case 'MYSQL2':
6915
- query = queryConsegneSQLite(data_da, data_a, data_filter, adulto, alunno, still_open);
6921
+ query = queryConsegneSQLite(data_da, data_a, data_filter, adulto, alunno, still_open, only_outofdate);
6916
6922
  break;
6917
6923
  }
6918
6924
  }
@@ -10923,12 +10929,17 @@ function queryFloorsByPlace(db_used, id_place) {
10923
10929
  return query;
10924
10930
  }
10925
10931
 
10926
- function queryFunzioneByPlaceAndFloorSQLite(id_place, piano) {
10932
+ function queryFunzioneByPlaceAndFloorSQLite(id_place, piano, date_ref) {
10927
10933
  var query = "";
10928
10934
  query = "SELECT DISTINCT sd.type as funzione from site_destinations sd";
10929
10935
  query += " JOIN sites s ON s.id = sd.id_site"
10930
10936
  if (id_place) {
10931
- query += " where date('now') >= sd.date_start and date('now') <= sd.date_end";
10937
+ if (date_ref) {
10938
+ query += " where " + date_ref + " >= sd.date_start and " + date_ref + " <= sd.date_end";
10939
+ }
10940
+ else {
10941
+ query += " where date('now') >= sd.date_start and date('now') <= sd.date_end";
10942
+ }
10932
10943
  query += " and sd.id_place = '" + id_place + "'";
10933
10944
  if (piano) {
10934
10945
  query += " and s.floor = '" + piano + "'";
@@ -10939,12 +10950,17 @@ function queryFunzioneByPlaceAndFloorSQLite(id_place, piano) {
10939
10950
 
10940
10951
  }
10941
10952
 
10942
- function queryFunzioneByPlaceAndFloorMySQL(id_place, piano) {
10953
+ function queryFunzioneByPlaceAndFloorMySQL(id_place, piano, date_ref) {
10943
10954
  var query = "";
10944
10955
  query = "SELECT DISTINCT sd.type as funzione from site_destinations sd";
10945
10956
  query += " JOIN sites s ON s.id = sd.id_site"
10946
10957
  if (id_place) {
10947
- query += " where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
10958
+ if (date_ref) {
10959
+ query += " where :date_ref >= sd.date_start and :date_ref <= sd.date_end";
10960
+ }
10961
+ else {
10962
+ query += " where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
10963
+ }
10948
10964
  query += " and sd.id_place = :id_place";
10949
10965
  if (piano) {
10950
10966
  query += " and s.floor = :piano";
@@ -10955,12 +10971,17 @@ function queryFunzioneByPlaceAndFloorMySQL(id_place, piano) {
10955
10971
 
10956
10972
  }
10957
10973
 
10958
- function queryFunzioneByPlaceAndFloorMySQL2(id_place, piano) {
10974
+ function queryFunzioneByPlaceAndFloorMySQL2(id_place, piano, date_ref) {
10959
10975
  var query = "";
10960
10976
  query = "SELECT DISTINCT sd.type as funzione from site_destinations sd";
10961
10977
  query += " JOIN sites s ON s.id = sd.id_site"
10962
10978
  if (id_place) {
10963
- query += " where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
10979
+ if (date_ref) {
10980
+ query += " where " + date_ref + " >= sd.date_start and " + date_ref + " <= sd.date_end";
10981
+ }
10982
+ else {
10983
+ query += " where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
10984
+ }
10964
10985
  query += " and sd.id_place = '" + id_place + "'";
10965
10986
  if (piano) {
10966
10987
  query += " and s.floor = '" + piano + "'";
@@ -10971,18 +10992,18 @@ function queryFunzioneByPlaceAndFloorMySQL2(id_place, piano) {
10971
10992
 
10972
10993
  }
10973
10994
 
10974
- function queryFunzioneByPlaceAndFloor(db_used, id_place, piano) {
10995
+ function queryFunzioneByPlaceAndFloor(db_used, id_place, piano, date_ref) {
10975
10996
  var query = "";
10976
10997
  if (db_used) {
10977
10998
  switch (db_used) {
10978
10999
  case 'SQLITE':
10979
- query = queryFunzioneByPlaceAndFloorSQLite(id_place, piano);
11000
+ query = queryFunzioneByPlaceAndFloorSQLite(id_place, piano, date_ref);
10980
11001
  break;
10981
11002
  case 'MYSQL':
10982
- query = queryFunzioneByPlaceAndFloorMySQL(id_place, piano);
11003
+ query = queryFunzioneByPlaceAndFloorMySQL(id_place, piano, date_ref);
10983
11004
  break;
10984
11005
  case 'MYSQL2':
10985
- query = queryFunzioneByPlaceAndFloorMySQL2(id_place, piano);
11006
+ query = queryFunzioneByPlaceAndFloorMySQL2(id_place, piano, date_ref);
10986
11007
  break;
10987
11008
  }
10988
11009
  }
@@ -10991,11 +11012,15 @@ function queryFunzioneByPlaceAndFloor(db_used, id_place, piano) {
10991
11012
  }
10992
11013
 
10993
11014
 
10994
- function querySitesSQLite(place, piano, funzione) {
11015
+ function querySitesSQLite(place, piano, funzione, date_ref) {
10995
11016
  var query = "SELECT DISTINCT sd.id_site as id, s.id_place as Plesso, sd.name as Nome, s.mark as Codice, s.floor as Piano, sd.type as Funzione from site_destinations sd";
10996
11017
  query += " LEFT JOIN sites s ON s.id = sd.id_site"
10997
- query += " where date('now') >= sd.date_start and date('now') <= sd.date_end";
10998
-
11018
+ if (date_ref) {
11019
+ query += " where " + date_ref + " >= sd.date_start and " + date_ref + " <= sd.date_end";
11020
+ }
11021
+ else {
11022
+ query += " where date('now') >= sd.date_start and date('now') <= sd.date_end";
11023
+ }
10999
11024
  if (place) {
11000
11025
  query += " and s.id_place = '" + place + "'";
11001
11026
  }
@@ -11010,11 +11035,16 @@ function querySitesSQLite(place, piano, funzione) {
11010
11035
  return query;
11011
11036
  }
11012
11037
 
11013
- function querySitesMySQL(place, piano, funzione) {
11038
+ function querySitesMySQL(place, piano, funzione, date_ref) {
11014
11039
  var query = "SELECT DISTINCT sd.id_site as id, s.id_place as Plesso, sd.name as Nome, s.mark as Codice, s.floor as Piano, sd.type as Funzione from site_destinations sd ";
11015
11040
  query += " LEFT JOIN sites s ON s.id = sd.id_site"
11016
- query += " where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
11017
-
11041
+ if (date_ref) {
11042
+ query += " where :date_ref >= sd.date_start and :date_ref <= sd.date_end";
11043
+ }
11044
+ else {
11045
+ query += " where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
11046
+ }
11047
+
11018
11048
  if (place) {
11019
11049
  query += " and s.id_place = :id_place";
11020
11050
  }
@@ -11029,10 +11059,15 @@ function querySitesMySQL(place, piano, funzione) {
11029
11059
  return query;
11030
11060
  }
11031
11061
 
11032
- function querySitesMySQL2(place, piano, funzione) {
11062
+ function querySitesMySQL2(place, piano, funzione, date_ref) {
11033
11063
  var query = "SELECT DISTINCT sd.id_site as id, s.id_place as Plesso, sd.name as Nome, s.mark as Codice, s.floor as Piano, sd.type as Funzione from site_destinations sd";
11034
11064
  query += " LEFT JOIN sites s ON s.id = sd.id_site"
11035
- query += " where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
11065
+ if (date_ref) {
11066
+ query += " where " + date_ref + " >= sd.date_start and " + date_ref + " <= sd.date_end";
11067
+ }
11068
+ else {
11069
+ query += " where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
11070
+ }
11036
11071
 
11037
11072
  if (place) {
11038
11073
  query += " and s.id_place = '" + place + "'";
@@ -11048,18 +11083,18 @@ function querySitesMySQL2(place, piano, funzione) {
11048
11083
  return query;
11049
11084
  }
11050
11085
 
11051
- function querySites(db_used, place, piano, funzione) {
11086
+ function querySites(db_used, place, piano, funzione, date_ref) {
11052
11087
  var query = "";
11053
11088
  if (db_used) {
11054
11089
  switch (db_used) {
11055
11090
  case 'SQLITE':
11056
- query = querySitesSQLite(place, piano, funzione);
11091
+ query = querySitesSQLite(place, piano, funzione, date_ref);
11057
11092
  break;
11058
11093
  case 'MYSQL':
11059
- query = querySitesMySQL(place, piano, funzione);
11094
+ query = querySitesMySQL(place, piano, funzione, date_ref);
11060
11095
  break;
11061
11096
  case 'MYSQL2':
11062
- query = querySitesMySQL2(place, piano, funzione);
11097
+ query = querySitesMySQL2(place, piano, funzione, date_ref);
11063
11098
  break;
11064
11099
  }
11065
11100
  }
@@ -14340,6 +14375,45 @@ function removeDismissioneAltroBeneFromDismissione(db_used, id_benedismiss, id_d
14340
14375
 
14341
14376
 
14342
14377
  //End Manage altri beni
14378
+ function getMapScript(map_tag) {
14379
+ var text = "<script>";
14380
+ text += "(function($scope) {";
14381
+
14382
+ text += "$('#Maps_MAPPA_cards').on('touchstart touchmove',function(e){";
14383
+ text += "e.preventDefault();";
14384
+ text += "const map = document.getElementById(\"" + map_tag +"\");";
14385
+ text += "let rect = map.getBoundingClientRect();";
14386
+ text += "let xCoordinate = ((e.touches[0].clientX - rect.left)/ (rect.right- rect.left)).toFixed(4);";
14387
+ text += "let yCoordinate = ((e.touches[0].clientY - rect.top)/(rect.bottom - rect.top)).toFixed(4);";
14388
+ text += "if (xCoordinate < 1 && xCoordinate > 0 && yCoordinate < 1 && yCoordinate > 0){";
14389
+ text += "$(\"#coords\").text( \"X: \" + xCoordinate + \", Y: \" + yCoordinate);";
14390
+ text += "$(\"#imgcursor\").css( \"left\", (e.touches[0].clientX - rect.left) - 20 ); // offset to half of the cursor's width";
14391
+ text += "$(\"#imgcursor\").css( \"top\", (e.touches[0].clientY - rect.top) - 20 ); // offset to half of the cursor's height";
14392
+ text += "$scope.send({\"payload\":{\"coordX\": xCoordinate, \"coordY\": yCoordinate}});";
14393
+ text += "}";
14394
+ text += "});";
14395
+
14396
+ text += "$('#Maps_MAPPA_cards').on('mousemove mousedown mouseup',function(e){";
14397
+ text += "e.preventDefault();";
14398
+ text += "const map = document.getElementById(\"" + map_tag +"\");";
14399
+ text += "let rect = map.getBoundingClientRect();";
14400
+ text += "let xCoordinate = ((e.clientX - rect.left)/ (rect.right- rect.left)).toFixed(4);";
14401
+ text += "let yCoordinate = ((e.clientY - rect.top)/(rect.bottom - rect.top)).toFixed(4);";
14402
+ text += "if (xCoordinate < 1 && xCoordinate > 0 && yCoordinate < 1 && yCoordinate > 0 && e.buttons == 1){ ";
14403
+ text += "$(\"#coords\").text( \"X: \" + xCoordinate + \", Y: \" + yCoordinate);";
14404
+ text += "$(\"#imgcursor\").css( \"left\", (e.clientX - rect.left) - 20); // offset to half of the cursor's width";
14405
+ text += "$(\"#imgcursor\").css( \"top\", (e.clientY - rect.top) - 20 ); // offset to half of the cursor's height";
14406
+
14407
+ text += "$scope.send({\"payload\":{\"coordX\": xCoordinate, \"coordY\": yCoordinate}});";
14408
+ text += "}";
14409
+ text += "});";
14410
+
14411
+ text += "})(scope);";
14412
+ text += "</script>";
14413
+ return text;
14414
+ }
14415
+
14416
+
14343
14417
 
14344
14418
  // Exports
14345
14419
 
@@ -14724,6 +14798,8 @@ module.exports = {
14724
14798
  loadAltroBeneDaDismettereCombo,
14725
14799
  assignAltriBeniToDismissione,
14726
14800
  removeAltriBeniFromDismissione,
14727
- removeDismissioneAltroBeneFromDismissione
14801
+ removeDismissioneAltroBeneFromDismissione,
14802
+ //
14803
+ getMapScript
14728
14804
  };
14729
14805
  // end of source
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  ".": "./lib/modules.js",
5
5
  "./dbconn": "./lib/dbconn.js"
6
6
  },
7
- "version": "3.0.89",
7
+ "version": "3.0.90",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",