PageSourceSearch

https://phproc.univpm.it/rubrica/js/repository/repo_struttura.js

js univpm.it collected 2026-09-25 09:03:14 UTC 2,518 bytes, 73 lines download raw bytes

1"use strict";
2
3function RepoStruttura(util, placeholder) {
4
5    this.getStrutture = function (onSuccess, onError) {
6        var api = util.getApiStrutture();
7        API_CLIENT.fetch(api)
8            .then((response) => {
9                if (!response.ok) {
10                    throw new Error(`Errore nella ricerca: ${response.status}`)
11                }
12                return response.json();
13            })
14            .then(function (data) {
15                onSuccess(filtraRisultati(data["hydra:member"]));
16            })
17            .catch(function (error) {
18                onError(error);
19            });
20    }
21
22    function filtraRisultati(data) {
23        //rimuovere dalla lista la struttura rettorato
24        //aggiunta la struttura radice univpm con rettore come responsabile
25        /*var struttura={
26            "idStruttura": "000000", 
27            "descrizione": "Università Politecnica delle Marche",
28            "cognomeResponsabile": "Gregori",
29            "nomeResponsabile": "Gian Luca",
30            "descrizionePosizione": "Rettore",
31            "email1": "[email protected]",
32            "idStrutturaPadre": null,
33            "livello": 0,
34            "tel1": "071 220 3212"
35        }*/
36        var id_to_remove = [];
37        for (var d of data) {            
38            if (d.idStruttura == "000075") {
39                //data.splice(i,1);
40                d.idStrutturaPadre = "170001";
41                d.descrizione = "Università Politecnica delle Marche";
42                d.livello=1;
43            }
44            if (d.idStruttura == "000001" || d.idStruttura == "290002") {
45                id_to_remove.push(d.idStruttura);
46            }
47            if (d.idStrutturaPadre == "000001") {
48                d.idStrutturaPadre = "280500";
49            }
50            if (d.idStrutturaPadre == "290002") {
51                d.idStrutturaPadre = "000075";
52            }
53            if (d.idStruttura=="280500"){
54                d.cognomeResponsabile="Iacopini";
55                d.nomeResponsabile="Alessandro";
56                d.descrizionePosizione="Direttore Generale";
57            }
58        }
59        for (var idx of id_to_remove) {
60            for (var i = 0; i < data.length; i++) {
61                if (data[i].idStruttura==idx)
62                    data.splice(i,1)
63            }            
64        }
65        //data.push(struttura);
66
67        //togliere direzione generale e mettere come padre a tutti i figli direttamente amministrazione
68
69        return data;
70    }
71}
72
73export { RepoStruttura };

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.