How to use deleteIndex method in ng-mocks

Best JavaScript code snippet using ng-mocks

socialCardEditController.js

Source:socialCardEditController.js Github

copy

Full Screen

1'use strict';2/* Controllers */3var app = angular.module('harragapp.socialCardEditController', []);4// Clear browser cache (in development mode)5//6// http://stackoverflow.com/questions/14718826/angularjs-disable-partial-caching-on-dev-machine7//app.run(function($rootScope, $templateCache) {8// $rootScope.$on('$viewContentLoaded', function() {9// $templateCache.removeAll();10// });11//});12app.config(function($mdDateLocaleProvider) {13 $mdDateLocaleProvider.formatDate = function(date) {14 return moment(date).format('DD-MM-YYYY');15 };16 });17app.controller('SocialCardEditCtrl', [ '$scope', '$routeParams', '$location', 'socialCardService', 'commonService', '$localStorage','$mdDialog', '$filter',18 function($scope, $routeParams, $location, socialCardService, commonService, $localStorage, $mdDialog, $filter) {19 20 $scope.userSession = $localStorage.userSession;21 22 if ($scope.userSession==undefined || Object.keys($scope.userSession).length === 0) {23 $location.path('/login');24 }25 26 $scope.socialCard = {};27 $scope.socialCard.id = $routeParams.id;28 29 30 31 32 //inizializzaizone strutture dati vuote33 34 var templateAllegato = {35 nome: '',36 link: '',37// data: ''38 isNew: true,39 }40 var templateContatto = {41 nome: '',42 cognome: '',43 email: '',44 telefono: ''45 }46 47// INIZIO ANAGRAFICA48 49 var documentoVuoto = {50 tipologia: '',51 descrizione: '',52 note:'',53 allegato: templateAllegato54 };55 56 var domicilioVuoto = {57 nome: '',58 tipoInserimento: '',59 responsabile: '',60 email: '',61 telefono: '',62 tempoPermanenza: new Date()63 };64 $scope.addDomicilio = function() {65 $scope.socialCard.anagrafica.domicilio.push(angular.copy(domicilioVuoto));66 }67 $scope.addDocumento = function() {68 $scope.socialCard.anagrafica.documenti.push(angular.copy(documentoVuoto));69 }70 71 $scope.validateNumeroTutela = function(){72 var testo = $scope.socialCard.anagrafica.numeroTutela;73 if(testo.match(/^[0-9]+$/) != null || testo.includes("/")){74 console.log("ottimo");75 }76 77 }78 79 80 $scope.deleteDomicilio = function(_domicilio) {81 var deleteIndex = $scope.socialCard.anagrafica.domicilio.indexOf(_domicilio);82 if(deleteIndex>-1){83 $scope.socialCard.anagrafica.domicilio.splice(deleteIndex,1);84 }85 }86 $scope.deleteDocumento = function(_documento) { 87 var deleteIndex = $scope.socialCard.anagrafica.documenti.indexOf(_documento);88 if(deleteIndex>-1){89 $scope.socialCard.anagrafica.documenti.splice(deleteIndex,1);90 }91 }92// $scope.socialCard = new Object();93// $scope.socialCard.anagrafica = new Object();94// $scope.socialCard.anagrafica.domicilio = [domicilioVuoto];95// $scope.socialCard.anagrafica.documenti = [documentoVuoto];96 97// FINE ANAGRAFICA98 99 100 101 102// INIZIO AMMINISTRATIVA103 var permessoSoggTemplate = {104 stato:'',105 dataScadenza: new Date(),106 dataRilascio: new Date(),107 dataRichiesta: new Date(),108 rilasciatoDa: "",109 tipologia:'',110 allegato: templateAllegato,111 };112 113 $scope.addPermSogg = function() {114 if( !$scope.socialCard.amministrativa.permessoSoggiorno )115 $scope.socialCard.amministrativa.permessoSoggiorno = [];116 $scope.socialCard.amministrativa.permessoSoggiorno.push(angular.copy(permessoSoggTemplate));117 }118 $scope.deletePermSogg = function(_item) {119 var deleteIndex = $scope.socialCard.amministrativa.permessoSoggiorno.indexOf(_item);120 if(deleteIndex>-1){121 $scope.socialCard.amministrativa.permessoSoggiorno.splice(deleteIndex,1);122 }123 }124 var docIdentitaTemplate = {125 allegato: templateAllegato,126 };127 $scope.addDocumIdent = function() {128 if( !$scope.socialCard.amministrativa.documentiIdentita )129 $scope.socialCard.amministrativa.documentiIdentita = [];130 $scope.socialCard.amministrativa.documentiIdentita.push(angular.copy(docIdentitaTemplate));131 }132 $scope.deleteDocIdent = function(_item) {133 var deleteIndex = $scope.socialCard.amministrativa.documentiIdentita.indexOf(_item);134 if(deleteIndex>-1){135 $scope.socialCard.amministrativa.documentiIdentita.splice(deleteIndex,1);136 }137 }138 139 var allegatoAppuntamentoTemplate = {140 descrizione: '',141 allegato: templateAllegato142 }143 144 $scope.addAllegatoAppunt = function(appuntamento) {145 if( appuntamento.allegati == undefined )146 appuntamento.allegati = [];147 appuntamento.allegati.push(angular.copy(allegatoAppuntamentoTemplate));148 }149 $scope.deleteAllegatoAppunt = function(appuntamento, _item) {150 var deleteIndex = appuntamento.allegati.indexOf(_item);151 if(deleteIndex>-1){152 appuntamento.allegati.splice(deleteIndex,1);153 }154 }155 156 var appuntamentoTemplate = {157 luogo: '',158 data: new Date(),159 motivo: '',160 esito: '',161 allegati: []162 }163 164 $scope.addAppuntamento = function(procedura) {165 if( procedura.appuntamenti == undefined )166 procedura.appuntamenti = [];167 procedura.appuntamenti.push(angular.copy(appuntamentoTemplate));168 }169 $scope.deleteAppuntamento = function(procedura, _item) {170 var deleteIndex = procedura.appuntamenti.indexOf(_item);171 if(deleteIndex>-1){172 procedura.appuntamenti.splice(deleteIndex,1);173 }174 } 175 176 177 var allegatoRicorsoTemplate = {178 descrizione: '',179 allegato: templateAllegato180 }181 182 var udienzaTemplate = {183 dataUdienza: new Date()184 };185 186 $scope.addAllegatoRicorso = function(ricorso) {187 if( ricorso.allegati == undefined )188 ricorso.allegati = [];189 ricorso.allegati.push(angular.copy(ricorsoTemplate));190 }191 $scope.deleteAllegatoRicorso = function(ricorso, _item) {192 var deleteIndex = ricorso.allegati.indexOf(_item);193 if(deleteIndex>-1){194 ricorso.allegati.splice(deleteIndex,1);195 }196 }197 $scope.addUdienzaRicorso = function(ricorso) {198 if( ricorso.udienze == undefined )199 ricorso.udienze = [];200 ricorso.udienze.push(angular.copy(udienzaTemplate));201 }202 $scope.deleteUdienzaRicorso = function(ricorso, _item) {203 var deleteIndex = ricorso.udienze.indexOf(_item);204 if(deleteIndex>-1){205 ricorso.udienze.splice(deleteIndex,1);206 }207 }208 209 210 var ricorsoTemplate = { 211 data: new Date(),212 avvocato: '',213 gratuito: '',214 patrocinio: '',215 udienze: [], 216 allegati: []217 }218 $scope.addRicorso = function(procedura) {219 if( procedura.ricorsiAmministrativi == undefined )220 procedura.ricorsiAmministrativi = [];221 procedura.ricorsiAmministrativi.push(angular.copy(ricorsoTemplate));222 }223 $scope.deleteRicorso = function(procedura, _item) {224 var deleteIndex = procedura.ricorsiAmministrativi.indexOf(_item);225 if(deleteIndex>-1){226 procedura.ricorsiAmministrativi.splice(deleteIndex,1);227 }228 }229 230 var dublinoTemplate ={231 paese: '',232 data: new Date(),233 statoProcedura: "",234 allegato: templateAllegato235 }236 var procLegTemplate = {237 dublino: dublinoTemplate,238 appuntamenti: [],239 ricorsiAmministrativi: []240 }241 242 $scope.addProcLeg = function() {243 if( !$scope.socialCard.amministrativa.procedureLegali )244 $scope.socialCard.amministrativa.procedureLegali = [];245 $scope.socialCard.amministrativa.procedureLegali.push(angular.copy(procLegTemplate));246 }247 $scope.deleteProcLeg = function(_item) {248 var deleteIndex = $scope.socialCard.amministrativa.procedureLegali.indexOf(_item);249 if(deleteIndex>-1){250 $scope.socialCard.amministrativa.procedureLegali.splice(deleteIndex,1);251 }252 }253 254 var provvedimentoTemplate = {255 data: new Date(),256 tipo:"",257 istituzioneEmittente:"",258 avvocato:""259 260 }261 $scope.addProvvedimento = function() {262 if( !$scope.socialCard.amministrativa.provvedimentiGiudiziari )263 $scope.socialCard.amministrativa.provvedimentiGiudiziari = [];264 $scope.socialCard.amministrativa.provvedimentiGiudiziari.push(angular.copy(provvedimentoTemplate));265 }266 $scope.deleteProvvedimento = function(_item) {267 var deleteIndex = $scope.socialCard.amministrativa.provvedimentiGiudiziari.indexOf(_item);268 if(deleteIndex>-1){269 $scope.socialCard.amministrativa.provvedimentiGiudiziari.splice(deleteIndex,1);270 }271 }272 273 274 var allegatoDelegaTemplate ={275 descrizione: '',276 allegato: templateAllegato277 }278 279 $scope.addAllegatoDelega = function() {280 if( !$scope.socialCard.amministrativa.delegaAmministrativa.allegati )281 $scope.socialCard.amministrativa.delegaAmministrativa.allegati = [];282 $scope.socialCard.amministrativa.delegaAmministrativa.allegati.push(angular.copy(allegatoDelegaTemplate));283 }284 $scope.deleteAllegatoDelega = function(_item) {285 var deleteIndex = $scope.socialCard.amministrativa.delegaAmministrativa.allegati.indexOf(_item);286 if(deleteIndex>-1){287 $scope.socialCard.amministrativa.delegaAmministrativa.allegati.splice(deleteIndex,1);288 }289 }290 291// FINE AMMINISTRATIVA292 // INIZIO PENALE293 294 var assistenteSocialeTemplate ={295 nome:'',296 cognome:'',297 mail:'',298 telefono:''299 }300 var peiTemplate2 ={301 descrizione: '',302 allegato: templateAllegato303 }304 305 var procPenaleTemplate = {306 statoProcedimento:'',307 assistenteSociale: assistenteSocialeTemplate,308 pei:peiTemplate2,309 310 }311 312 $scope.addProcPenale = function() {313 if( !$scope.socialCard.penale.procedimentiPenali)314 $scope.socialCard.penale.procedimentiPenali = [];315 $scope.socialCard.penale.procedimentiPenali.push(angular.copy(procPenaleTemplate));316 }317 $scope.deleteProcPenale = function(_item) {318 var deleteIndex = $scope.socialCard.penale.procedimentiPenali.indexOf(_item);319 if(deleteIndex>-1){320 $scope.socialCard.penale.procedimentiPenali.splice(deleteIndex,1);321 }322 }323 324 // FINE PENALE325 326 327 //INIZIO STORIA328 var familiareTemplate ={329 relazione: '',330 contatto: templateContatto,331 inVita: false,332 paese: '',333 boolean: false,334 statusGiuridico: '',335 paeseOrigine:'',336 note: '',337 allegato: templateAllegato338 }339 340 $scope.addFamiliare = function() {341 if( !$scope.socialCard.storia.familiari )342 $scope.socialCard.storia.familiari = [];343 $scope.socialCard.storia.familiari.push(angular.copy(familiareTemplate));344 }345 $scope.deleteFamiliare = function(_familiare) {346 var deleteIndex = $scope.socialCard.storia.familiari.indexOf(_familiare);347 if(deleteIndex>-1){348 $scope.socialCard.storia.familiari.splice(deleteIndex,1);349 }350 }351 352 var paeseAttraversatoTemplate ={353 nome: '',354 traumatico: false,355 dataPartenza: new Date(),356 dataArrivo: new Date(),357 visto: templateAllegato358 }359 360 $scope.addPaeseAttraversato = function() {361 if( !$scope.socialCard.storia.percorsoMigratorio)362 $scope.socialCard.storia.percorsoMigratorio = new Object();363 if( !$scope.socialCard.storia.percorsoMigratorio.paesiAttraversati )364 $scope.socialCard.storia.percorsoMigratorio.paesiAttraversati = [];365 $scope.socialCard.storia.percorsoMigratorio.paesiAttraversati.push(angular.copy(paeseAttraversatoTemplate));366 }367 $scope.deletePaeseAttraversato = function(_paese) {368 var deleteIndex = $scope.socialCard.storia.percorsoMigratorio.paesiAttraversati.indexOf(_paese);369 if(deleteIndex>-1){370 $scope.socialCard.storia.percorsoMigratorio.paesiAttraversati.splice(deleteIndex,1);371 }372 }373 374 var allRitTemplate ={375 tipo: '',376 data: new Date(),377 luogo: '',378 comunicazione: templateAllegato379 }380 381 $scope.addAllRit = function() { 382 if( !$scope.socialCard.storia.accoglienza)383 $scope.socialCard.storia.accoglienza = new Object();384 if( !$scope.socialCard.storia.accoglienza.allontanamentiRitrovamenti )385 $scope.socialCard.storia.accoglienza.allontanamentiRitrovamenti = [];386 $scope.socialCard.storia.accoglienza.allontanamentiRitrovamenti.push(angular.copy(allRitTemplate));387 }388 $scope.deleteAllRit = function(_allRit) {389 var deleteIndex = $scope.socialCard.storia.accoglienza.allontanamentiRitrovamenti.indexOf(_allRit);390 if(deleteIndex>-1){391 $scope.socialCard.storia.accoglienza.allontanamentiRitrovamenti.splice(deleteIndex,1);392 }393 }394 395 var peiTemplate ={396 descrizione: '',397 allegato: templateAllegato398 }399 400 $scope.addAccPei = function() {401 if( !$scope.socialCard.storia.accoglienza)402 $scope.socialCard.storia.accoglienza = new Object();403 if( !$scope.socialCard.storia.accoglienza.pei )404 $scope.socialCard.storia.accoglienza.pei = [];405 $scope.socialCard.storia.accoglienza.pei.push(angular.copy(peiTemplate));406 }407 $scope.deleteAccPei = function(_item) {408 var deleteIndex = $scope.socialCard.storia.accoglienza.pei.indexOf(_item);409 if(deleteIndex>-1){410 $scope.socialCard.storia.accoglienza.pei.splice(deleteIndex,1);411 }412 }413 414 var affidoTemplate ={415 dataAffido: new Date(),416 enteAffido: '',417 allegatoAffido: templateAllegato418 }419 420 $scope.addAffido = function() {421 if( !$scope.socialCard.storia.accoglienza)422 $scope.socialCard.storia.accoglienza = new Object();423 if( !$scope.socialCard.storia.accoglienza.affidi )424 $scope.socialCard.storia.accoglienza.affidi = [];425 $scope.socialCard.storia.accoglienza.affidi.push(angular.copy(affidoTemplate));426 }427 $scope.deleteAffido = function(_item) {428 var deleteIndex = $scope.socialCard.storia.accoglienza.affidi.indexOf(_item);429 if(deleteIndex>-1){430 $scope.socialCard.storia.accoglienza.affidi.splice(deleteIndex,1);431 }432 }433 434 var adozioneTemplate ={435 dataAdozione: new Date(),436 enteAdozione: '',437 allegatoAdozione: templateAllegato438 }439 440 $scope.addAdozione = function() {441 if( !$scope.socialCard.storia.accoglienza)442 $scope.socialCard.storia.accoglienza = new Object();443 if( !$scope.socialCard.storia.accoglienza.adozioni )444 $scope.socialCard.storia.accoglienza.adozioni = [];445 $scope.socialCard.storia.accoglienza.adozioni.push(angular.copy(adozioneTemplate));446 }447 $scope.deleteAdozione = function(_item) {448 var deleteIndex = $scope.socialCard.storia.accoglienza.adozioni.indexOf(_item);449 if(deleteIndex>-1){450 $scope.socialCard.storia.accoglienza.adozioni.splice(deleteIndex,1);451 }452 }453 var relazioneTemplate ={454 descrizione: '',455 allegato: templateAllegato456 }457 458 $scope.addRelazione = function() {459 if( !$scope.socialCard.storia.accoglienza)460 $scope.socialCard.storia.accoglienza = new Object();461 if( !$scope.socialCard.storia.accoglienza.relazioniAssistenteSociale )462 $scope.socialCard.storia.accoglienza.relazioniAssistenteSociale = [];463 $scope.socialCard.storia.accoglienza.relazioniAssistenteSociale.push(angular.copy(relazioneTemplate));464 }465 $scope.deleteRelazione = function(_item) {466 var deleteIndex = $scope.socialCard.storia.accoglienza.relazioniAssistenteSociale.indexOf(_item);467 if(deleteIndex>-1){468 $scope.socialCard.storia.accoglienza.relazioniAssistenteSociale.splice(deleteIndex,1);469 }470 }471 //FINE STORIA472 473 //INIZIO ISTRUZIONE474 var istrOrgTemplate = {475 saLeggere:'',476 saScrivere: '',477 tipo:'',478 anni:'',479 descrizione:'',480 riconosciuto:'',481 allegato: templateAllegato482 };483 484 $scope.addIstrOrg = function() {485 if( !$scope.socialCard.istruzione.istruzioneOrigine )486 $scope.socialCard.istruzione.istruzioneOrigine = [];487 $scope.socialCard.istruzione.istruzioneOrigine.push(angular.copy(istrOrgTemplate));488 }489 $scope.deleteIstrOrg = function(item) {490 var deleteIndex = $scope.socialCard.istruzione.istruzioneOrigine.indexOf(item);491 if(deleteIndex>-1){492 $scope.socialCard.istruzione.istruzioneOrigine.splice(deleteIndex,1);493 }494 }495 496 var istrItaConTemplate = {497 tipo: '',498 quale:'',499 tipo:'',500 inizio: new Date(),501 fine: new Date(),502 istituto:'',503 allegato: templateAllegato504 };505 506 $scope.addIstItaCon = function() {507 if( !$scope.socialCard.istruzione.istruzioneItaliaConculsi )508 $scope.socialCard.istruzione.istruzioneItaliaConculsi = [];509 $scope.socialCard.istruzione.istruzioneItaliaConculsi.push(angular.copy(istrItaConTemplate));510 }511 $scope.deleteIstItaCon = function(item) {512 var deleteIndex = $scope.socialCard.istruzione.istruzioneItaliaConculsi.indexOf(item);513 if(deleteIndex>-1){514 $scope.socialCard.istruzione.istruzioneItaliaConculsi.splice(deleteIndex,1);515 }516 }517 518 519 var istrItaInCorsoTemplate = {520 tipo: '',521 nome:'',522 inizio: new Date(),523 fine: new Date(),524 classeGruppo:'',525 orariGiorni:'',526 istituto:'',527 luogo:'',528 pianoCPIA: templateAllegato,529 pattoCPIA: templateAllegato,530 progettoFormativo: templateAllegato,531 valutazioni:[]532 };533 534 $scope.addIstItaInCorso = function() {535 if( !$scope.socialCard.istruzione.istruzioneItaliainCorso )536 $scope.socialCard.istruzione.istruzioneItaliainCorso = [];537 $scope.socialCard.istruzione.istruzioneItaliainCorso.push(angular.copy(istrItaInCorsoTemplate));538 }539 $scope.deleteIstItaInCorso = function(item) {540 var deleteIndex = $scope.socialCard.istruzione.istruzioneItaliainCorso.indexOf(item);541 if(deleteIndex>-1){542 $scope.socialCard.istruzione.istruzioneItaliainCorso.splice(deleteIndex,1);543 }544 }545 546 547 var valutazioneTemplate = {548 allegato:''549 };550 551 $scope.addValutazione = function(item) {552 if( item.valutazioni == undefined )553 item.valutazioni = [];554 item.valutazioni.push(angular.copy(valutazioneTemplate));555 556 }557 $scope.deleteValutazione = function(item, _item) {558 var deleteIndex = item.valutazioni.indexOf(_item);559 if(deleteIndex>-1){560 item.valutazioni.splice(deleteIndex,1);561 }562 }563 564 565 566// FINE ISTRUZIONE567 568 //INIZIO SANITARIA569 var disabilitaVuota = {570 nome: '',571 allegato: templateAllegato572 };573 574 $scope.addDisabilita = function() {575 if( !$scope.socialCard.sanitaria.specificheDisabilita )576 $scope.socialCard.sanitaria.specificheDisabilita = [];577 $scope.socialCard.sanitaria.specificheDisabilita.push(angular.copy(disabilitaVuota));578 }579 $scope.deleteDisabilita = function(_disabilita) {580 var deleteIndex = $scope.socialCard.sanitaria.specificheDisabilita.indexOf(_disabilita);581 if(deleteIndex>-1){582 $scope.socialCard.sanitaria.specificheDisabilita.splice(deleteIndex,1);583 }584 }585 586 var allergiaVuota = {587 nome: '',588 allegato: templateAllegato589 };590 591 592 $scope.addAllergia = function() {593 if( !$scope.socialCard.sanitaria.patologieAllergiche )594 $scope.socialCard.sanitaria.patologieAllergiche = [];595 $scope.socialCard.sanitaria.patologieAllergiche.push(angular.copy(allergiaVuota));596 }597 598 $scope.deleteAllergia = function(_allergia) { 599 var deleteIndex = $scope.socialCard.sanitaria.patologieAllergiche.indexOf(_allergia);600 if(deleteIndex>-1){601 $scope.socialCard.sanitaria.patologieAllergiche.splice(deleteIndex,1);602 }603 }604 605 606 var eventoMedicoTemplate = {607 data: new Date(),608 tipo: '',609 presidioOspedaliero: '',610 unitaOperativa: '',611 medicoRiferimento: templateContatto,612 allegato: templateAllegato613 };614 615 616 $scope.addEventoMedico = function() {617 if( !$scope.socialCard.sanitaria.eventiMedici )618 $scope.socialCard.sanitaria.eventiMedici = [];619 $scope.socialCard.sanitaria.eventiMedici.push(angular.copy(eventoMedicoTemplate));620 }621 622 $scope.deleteEventoMedico = function(_eventoMed) { 623 var deleteIndex = $scope.socialCard.sanitaria.eventiMedici.indexOf(_eventoMed);624 if(deleteIndex>-1){625 $scope.socialCard.sanitaria.eventiMedici.splice(deleteIndex,1);626 }627 }628 var templateVaccino = {629 vaccino: ''630 };631 632 633 $scope.addVaccino = function() {634 if( !$scope.socialCard.sanitaria.vaccini )635 $scope.socialCard.sanitaria.vaccini = [];636 $scope.socialCard.sanitaria.vaccini.push(angular.copy(templateVaccino));637 }638 639 $scope.deleteVaccino = function(_vaccino) { 640 var deleteIndex = $scope.socialCard.sanitaria.vaccini.indexOf(_vaccino);641 if(deleteIndex>-1){642 $scope.socialCard.sanitaria.vaccini.splice(deleteIndex,1);643 }644 }645 646 647 648 649 650 651 //JACOPO addVaccino e deleteVaccino652 653 // FINE SANITARIA654 655 //INIZIO SOCIALE 656 var esperienzaTemplete = {657 pregressa: '',658 tipo: '',659 dataInizio: new Date(),660 dataFine: new Date(),661 giorniOrari: '',662 competenzeAcquisite: '',663 referente: templateContatto,664 allegato: templateAllegato665 };666 667 $scope.addVolont = function() {668 if( !$scope.socialCard.sociale.volontariato )669 $scope.socialCard.sociale.volontariato = [];670 $scope.socialCard.sociale.volontariato.push(angular.copy(esperienzaTemplete));671 }672 $scope.deleteVolont = function(_item) {673 var deleteIndex = $scope.socialCard.sociale.volontariato.indexOf(_item);674 if(deleteIndex>-1){675 $scope.socialCard.sociale.volontariato.splice(deleteIndex,1);676 }677 }678 $scope.addLab = function() {679 if( !$scope.socialCard.sociale.laboratori )680 $scope.socialCard.sociale.laboratori = [];681 $scope.socialCard.sociale.laboratori.push(angular.copy(esperienzaTemplete));682 }683 $scope.deleteLab = function(_lab) {684 var deleteIndex = $scope.socialCard.sociale.laboratori.indexOf(_lab);685 if(deleteIndex>-1){686 $scope.socialCard.sociale.laboratori.splice(deleteIndex,1);687 }688 }689 690 $scope.addSport = function() {691 if( !$scope.socialCard.sociale.sport )692 $scope.socialCard.sociale.sport = [];693 $scope.socialCard.sociale.sport.push(angular.copy(esperienzaTemplete));694 }695 $scope.deleteSport = function(_item) {696 var deleteIndex = $scope.socialCard.sociale.sport.indexOf(_item);697 if(deleteIndex>-1){698 $scope.socialCard.sociale.sport.splice(deleteIndex,1);699 }700 }701 702 $scope.addGruppiAss = function() {703 if( !$scope.socialCard.sociale.gruppiAss )704 $scope.socialCard.sociale.gruppiAss = [];705 $scope.socialCard.sociale.gruppiAss.push(angular.copy(esperienzaTemplete));706 }707 $scope.deleteGruppiAss = function(_item) {708 var deleteIndex = $scope.socialCard.sociale.gruppiAss.indexOf(_item);709 if(deleteIndex>-1){710 $scope.socialCard.sociale.gruppiAss.splice(deleteIndex,1);711 }712 }713 714 //FINE SOCIALE715 716 717 //INIZIO LAVORO 718 719 720 var certLavTemplate = {721 descrizione: '',722 allegato: templateAllegato723 };724 $scope.addCertificazione = function(_lavoro) {725 var addIndex = $scope.socialCard.lavoro.indexOf(_lavoro);726 if(addIndex>-1){727 $scope.socialCard.lavoro[addIndex].certificazioni.push(angular.copy(certLavTemplate));728 }729// if(lavoro.certificazioni == undefined) 730// lavoro.certificazioni = [];731// lavoro.certificazioni.push(angular.copy(allegatoVuoto));732 }733 734 $scope.deleteCertificazione = function(lavoro, _certificazione) {735 var deleteIndex = lavoro.certificazioni.indexOf(_certificazione);736 if(deleteIndex>-1){737 lavoro.certificazioni.splice(deleteIndex,1);738 }739 }740 741 var esperienzaVuota = {742 tipo:'',743 stato:'',744 tipologia:'',745 ambito:'',746 inquadramento:'',747 orariGiorni:'',748 dataInizio: new Date(),749 dataFine: new Date(),750 nomeAzienda:'',751 luogoAzienda:'',752 emailAzienda:'',753 telefonoAzienda:'',754 competenzeAcquisite:'',755 certificazioni: []756 }757 758 $scope.addEsperienza = function() { 759 if($scope.socialCard.lavoro == undefined) 760 $scope.socialCard.lavoro = [];761 $scope.socialCard.lavoro.push(angular.copy(esperienzaVuota));762 }763 764 $scope.deleteEsperienza = function(_esperienza) {765 var deleteIndex = $scope.socialCard.lavoro.indexOf(_esperienza);766 if(deleteIndex>-1){767 $scope.socialCard.lavoro.splice(deleteIndex,1);768 }769 }770 771 //FINE LAVORO772 773// INIZIO COMPETENZE774 775 var linguaTemplate ={776 nome: '',777 livelloScritto: '',778 livelloOrale: ''779 }780 781 $scope.addLinguaDichiarata = function() {782 if( !$scope.socialCard.competenze.lingueDichiarate )783 $scope.socialCard.competenze.lingueDichiarate = [];784 $scope.socialCard.competenze.lingueDichiarate.push(angular.copy(linguaTemplate));785 }786 $scope.deleteLinguaDichiarata = function(_item) {787 var deleteIndex = $scope.socialCard.competenze.lingueDichiarate.indexOf(_item);788 if(deleteIndex>-1){789 $scope.socialCard.competenze.lingueDichiarate.splice(deleteIndex,1);790 }791 }792 793 $scope.addLinguaAttestata = function() {794 if( !$scope.socialCard.competenze.lingueAttestate )795 $scope.socialCard.competenze.lingueAttestate = [];796 $scope.socialCard.competenze.lingueAttestate.push(angular.copy(linguaTemplate));797 }798 $scope.deleteLinguaAttestata = function(_item) {799 var deleteIndex = $scope.socialCard.competenze.lingueAttestate.indexOf(_item);800 if(deleteIndex>-1){801 $scope.socialCard.competenze.lingueAttestate.splice(deleteIndex,1);802 }803 }804 805 $scope.addLinguaCertificata = function() {806 if( !$scope.socialCard.competenze.lingueCertificate )807 $scope.socialCard.competenze.lingueCertificate = [];808 $scope.socialCard.competenze.lingueCertificate.push(angular.copy(linguaTemplate));809 }810 $scope.deleteLinguaCertificata = function(_item) {811 var deleteIndex = $scope.socialCard.competenze.lingueCertificate.indexOf(_item);812 if(deleteIndex>-1){813 $scope.socialCard.competenze.lingueCertificate.splice(deleteIndex,1);814 }815 }816 817 818 819 var compDigTemplate ={820 nome: '',821 descrizione: '',822 tipo: '',823 attivitaSvolta: '',824 livello: '',825 certificazione: templateAllegato826 }827 828 $scope.addCompDig = function() {829 if( !$scope.socialCard.competenze.competenzeDigitali )830 $scope.socialCard.competenze.competenzeDigitali = [];831 $scope.socialCard.competenze.competenzeDigitali.push(angular.copy(compDigTemplate));832 }833 $scope.deleteCompDig = function(_item) {834 var deleteIndex = $scope.socialCard.competenze.competenzeDigitali.indexOf(_item);835 if(deleteIndex>-1){836 $scope.socialCard.competenze.competenzeDigitali.splice(deleteIndex,1);837 }838 }839 840 var compBaseTemplate ={841 nome: '',842 descrizione: '',843 tipo: '',844 attivitaSvolta: '',845 livello: '',846 certificazione: templateAllegato847 }848 849 $scope.addCompBase = function() {850 if( !$scope.socialCard.competenze.altreCompetenze )851 $scope.socialCard.competenze.altreCompetenze = [];852 $scope.socialCard.competenze.altreCompetenze.push(angular.copy(compBaseTemplate));853 }854 $scope.deleteCompBase = function(_item) {855 var deleteIndex = $scope.socialCard.competenze.altreCompetenze.indexOf(_item);856 if(deleteIndex>-1){857 $scope.socialCard.competenze.altreCompetenze.splice(deleteIndex,1);858 }859 }860 var patenteTemplate ={861 descrizione: '',862 allegato: templateAllegato863 }864 865 $scope.addPatente = function() {866 if( !$scope.socialCard.competenze.patenti )867 $scope.socialCard.competenze.patenti = [];868 $scope.socialCard.competenze.patenti.push(angular.copy(patenteTemplate));869 }870 $scope.deletePatente = function(_item) {871 var deleteIndex = $scope.socialCard.competenze.patenti.indexOf(_item);872 if(deleteIndex>-1){873 $scope.socialCard.competenze.patenti.splice(deleteIndex,1);874 }875 }876 877 878// FINE COMPETENZE879// INIZIO Opzioni precompilate880 $scope.sessoOpzioni = sessoOpzioni;881 // JACOPO : aggiunta italOpzioni, tipoDomicOp, luogoOp882 $scope.italOpzioni = italOpzioni;883 $scope.tipoDomicOp = tipoDomicOp;884 $scope.tipologiaValutazioneOp = tipologiaValutazioneOp;885 $scope.luogoOp = luogoOp;886 $scope.secAccOp = secAccOp;887 $scope.booleanOp = booleanOp;888 $scope.motivazioneOp = motivazioneOp;889 $scope.penaleOp = penaleOp;890 $scope.istruzioneOp = istruzioneOp;891 $scope.linguaOp = linguaOp;892 $scope.tipologiaAdozioneOp = tipologiaAdozioneOp;893 894 895 // JACOPO : aggiunta documentoOp896 $scope.documentoOp = documentoOp;897 898 $scope.permSoggStatoOp = permSoggStatoOp;899 $scope.perSoggTipoOp = perSoggTipoOp;900 $scope.rifLegOp = rifLegOp;901 902 $scope.familiareOp = familiareOp;903 $scope.allRitOp = allRitOp;904 905 $scope.livelloLinguaOp = livelloLinguaOp;906 $scope.livelloOp = livelloOp;907 $scope.formInformOp = formInformOp;908 $scope.formNoFormOp = formNoFormOp;909 $scope.formTriFormOp = formTriFormOp;910 $scope.readWriteOp = readWriteOp;911 $scope.istrOrgAnniOp = istrOrgAnniOp;912 $scope.corsoRiconosciutoOp = corsoRiconosciutoOp;913 914 $scope.statoLavoroOp = statoLavoroOp;915 916 917 918// FINE Opzioni precompilate919 $scope.canWrite = function(section, subSetcion ) {920 return commonService.canWrite(section, subSetcion);921 };922 923 // callback for ng-click 'showSocialCard':924 $scope.showSocialCard = function(socialCardId) { 925 var confirm = $mdDialog.confirm()926 .title('Sicuro di voler tornare a Mostra Dettagli?')927 .textContent('Eventuali modifiche non salvate saranno perse')928 .ariaLabel('Lucky day')929 .targetEvent(socialCardId)930 .ok('Conferma')931 .cancel('Annulla');932 $mdDialog.show(confirm).then(function() {933 console.log("back to list confirmed");934 $location.path('/social-card-detail/' + $scope.socialCard.id);935 }, function() {936 console.log("back to list cancel");937 });938 };939 // callback for ng-click 'updateAnagrafica':940 $scope.updateAnagrafica = function(ev) {941 $scope.loading = true;942 //updateUserDummy($scope.user);943 socialCardService.updateAnagrafica($scope.socialCard.id, angular.copy($scope.socialCard.anagrafica)).then(function(temp) {944 console.log("SUCCESS");945 946 updateSuccess("Anagrafica", ev)947// $scope.loading = false;948// var confirm = $mdDialog.confirm()949// .title('Anagrafica Modificata con successo')950// .textContent('Anagrafica Modificata con successo!')951// .ariaLabel('Lucky day')952// .targetEvent(ev)953// .ok('Vai in Visualizzazione')954// .cancel('Continua in Modifica');955//956// $mdDialog.show(confirm).then(function() {957// $location.path('/social-card-detail/' + $scope.socialCard.id);958// }, function() {959// $location.path('/social-card-edit/' + $scope.socialCard.id);960// });961 962 963 //$scope.user = temp; 964 }, function() {965 console.log("ERROR");966 $scope.loading = false;967 }); 968 };969 970 // callback for ng-click 'updateAmministrativa':971 $scope.updateAmministrativa = function(ev) {972 $scope.loading = false;973 974 socialCardService.updateAmministrativa( $scope.socialCard.id, angular.copy($scope.socialCard.amministrativa)).then(function(temp) {975 console.log("SUCCESS");976 updateSuccess("Amministrativa", ev )977 }, function() {978 console.log("ERROR");979 }); 980 };981 // callback for ng-click 'updateStoria':982 $scope.updateStoria = function(ev) {983 $scope.loading = false;984 985 socialCardService.updateStoria( $scope.socialCard.id, angular.copy($scope.socialCard.storia)).then(function(temp) {986 console.log("SUCCESS");987 updateSuccess("Storia", ev )988 }, function() {989 console.log("ERROR");990 }); 991 };992 993 // callback for ng-click 'updateSanitaria':994 $scope.updateSanitaria = function(ev) {995 $scope.loading = false;996 997 socialCardService.updateSanitaria( $scope.socialCard.id, angular.copy($scope.socialCard.sanitaria)).then(function(temp) {998 console.log("SUCCESS");999 updateSuccess("Sanitaria", ev )1000 }, function() {1001 console.log("ERROR");1002 }); 1003 };1004 1005 // callback for ng-click 'updateIstruzione':1006 $scope.updateIstruzione = function(ev) {1007 $scope.loading = false;1008 1009 socialCardService.updateIstruzione( $scope.socialCard.id, angular.copy($scope.socialCard.istruzione)).then(function(temp) {1010 console.log("SUCCESS");1011 updateSuccess("Istruzione", ev )1012 }, function() {1013 console.log("ERROR");1014 }); 1015 };1016 1017 // callback for ng-click 'updateLavoro':1018 $scope.updateLavoro = function(ev) {1019 $scope.loading = false;1020 1021 //$scope.socialCard.lavoro.idAnagrafica = $scope.socialCard.id; 1022 socialCardService.updateLavoro( $scope.socialCard.id, angular.copy($scope.socialCard.lavoro)).then(function(temp) {1023 1024 console.log("SUCCESS");1025 updateSuccess("Lavoro", ev )1026 }, function() {1027 console.log("ERROR");1028 }); 1029 };1030 1031 // callback for ng-click 'updateSociale':1032 $scope.updateSociale = function(ev) {1033 $scope.loading = false;1034 1035 socialCardService.updateSociale( $scope.socialCard.id, angular.copy($scope.socialCard.sociale)).then(function(temp) {1036 console.log("SUCCESS");1037 updateSuccess("Sociale", ev )1038 }, function() {1039 console.log("ERROR");1040 }); 1041 };1042 1043 // callback for ng-click 'updateCompetenze':1044 $scope.updateCompetenze = function(ev) {1045 $scope.loading = false;1046 1047 socialCardService.updateCompetenze( $scope.socialCard.id, angular.copy($scope.socialCard.competenze)).then(function(temp) {1048 console.log("SUCCESS");1049 updateSuccess("Competenze", ev )1050 }, function() {1051 console.log("ERROR");1052 }); 1053 };1054 1055 // callback for ng-click 'updateDesideri':1056 $scope.updateDesideri = function(ev) {1057 $scope.loading = false;1058 //updateUserDummy($scope.user);1059 //$scope.socialCard.desideri.socialCardId = $scope.socialCard.id; 1060 socialCardService.updateDesideri($scope.socialCard.id, angular.copy($scope.socialCard.desideri)).then(function(temp) {1061 1062 console.log("SUCCESS");1063 updateSuccess("Desideri", ev )1064 }, function() {1065 console.log("ERROR");1066 }); 1067 };1068 1069 1070 // callback for ng-click 'updatePenale':1071 $scope.updatePenale = function(ev) {1072 $scope.loading = false;1073 1074 socialCardService.updatePenale( $scope.socialCard.id, angular.copy($scope.socialCard.penale)).then(function(temp) {1075 console.log("SUCCESS");1076 updateSuccess("Penale", ev )1077 }, function() {1078 console.log("ERROR");1079 }); 1080 };1081 1082 1083 1084 function updateSuccess(sectionName, event){1085 1086 $scope.loading = false;1087 var confirm = $mdDialog.confirm()1088 .title('Sezione '+sectionName +' Modificata con successo')1089 .textContent('Sezione '+ sectionName +' Modificata con successo!')1090 .ariaLabel('Lucky day')1091 .targetEvent(event)1092 .ok('Vai in Visualizzazione')1093 .cancel('Continua in Modifica');1094 1095 $mdDialog.show(confirm).then(function() {1096 $location.path('/social-card-detail/' + $scope.socialCard.id);1097 }, function() {1098 $location.path('/social-card-edit/' + $scope.socialCard.id);1099 });1100 }1101 // callback for ng-click 'back':1102 $scope.back = function(ev) {1103 var confirm = $mdDialog.confirm()1104 .title('Sicuro di voler tornare a Elenco Cartelle Sociali?')1105 .textContent('Eventuali modifiche non salvate saranno perse')1106 .ariaLabel('Lucky day')1107 .targetEvent(ev)1108 .ok('Conferma')1109 .cancel('Annulla');1110 $mdDialog.show(confirm).then(function() {1111 console.log("back to list confirmed");1112 $location.path('/social-card-list');1113 }, function() {1114 console.log("back to list cancel");1115 });1116 };1117 1118// $scope.onDateChange = function() {1119// if (this.node.mydate) {1120// this.node.mydate = this.node.mydate.getTime();1121// }1122// };1123 1124 1125 //GESTIONE TAB START1126 1127 1128 1129 $scope.showTab = function(tabId) {1130 switch(tabId) {1131 case "ANAGRAFICA":1132 getAnagrafica();1133 break;1134 case "AMMINISTRATIVA":1135 getAmministrativa(); 1136 break;1137 case "STORIA":1138 getStoria();1139 break;1140 case "SANITARIA":1141 getSanitaria();1142 break;1143 case "ISTRUZIONE":1144 getIstruzione();1145 break;1146 case "LAVORO":1147 getLavoro();1148 break;1149 case "SOCIALE":1150 getSociale();1151 break;1152 case "COMPETENZE":1153 getCompetenze();1154 break;1155 case "DESIDERI":1156 getDesideri();1157 break;1158 case "PENALE":1159 getPenale();1160 break;1161 1162 default:1163 //text = "I have never heard of that fruit...";1164 1165 } 1166 $scope.tab=tabId;1167 };1168 1169 1170 function getAnagrafica() {1171 if($scope.socialCard.anagrafica==undefined){ 1172 $scope.loading = true;1173 socialCardService.getAnagrafica($routeParams.id).then(function(temp) {1174 if( !temp.domicilio )1175 temp.domicilio = [angular.copy(domicilioVuoto)];1176 if(!temp.documenti) 1177 temp.documenti = [angular.copy(documentoVuoto)]; 1178 $scope.socialCard.anagrafica = temp;1179 turnAnagraficaCheckboxesOn();1180 console.log("SUCCESS");1181 $scope.loading = false;1182 }, function() {1183 console.log("ERROR");1184 $scope.loading = false;1185 });1186 }1187 }1188 function turnAnagraficaCheckboxesOn(){1189 1190 if($scope.socialCard.anagrafica.mediatore!=undefined){1191 $scope.socialCard.anagrafica.medYes = true;1192 }1193 }1194 1195 function getAmministrativa() { 1196 if($scope.socialCard.amministrativa==undefined){1197 $scope.loading = true;1198 socialCardService.getAmministrativa($routeParams.id).then(1199 function(temp) {1200 $scope.socialCard.amministrativa = temp;1201 turnAmministrativaCheckboxesOn();1202 console.log("SUCCESS");1203 $scope.loading=false;1204 }, function() {1205 $scope.loading=false;1206 console.log("ERROR");1207 });1208 }1209 }1210 function turnAmministrativaCheckboxesOn(){1211 if($scope.socialCard.amministrativa.procedureLegali != undefined ){1212 $scope.socialCard.amministrativa.procedureLegali.forEach(function(evento){1213 if(evento.dublino != undefined){1214 evento.dublinoYes = true; 1215 }1216 })1217 }1218 if($scope.socialCard.amministrativa.proseguo21!=undefined){1219 $scope.socialCard.amministrativa.proseguoYes = true;1220 }1221 }1222 1223 function getStoria() {1224 if($scope.socialCard.storia==undefined){ 1225 $scope.loading = true;1226 socialCardService.getStoria($routeParams.id).then(function(temp) {1227 if(temp==null){1228 temp = new Object();1229 } 1230 $scope.socialCard.storia = temp;1231 turnStoriaCheckboxesOn();1232 console.log("SUCCESS");1233 $scope.loading=false;1234 }, function() {1235 console.log("ERROR");1236 $scope.loading=false;1237 });1238 }1239 };1240 1241 function turnStoriaCheckboxesOn(){1242 1243 if($scope.socialCard.storia.accoglienza!=undefined){1244 if($scope.socialCard.storia.accoglienza.hotSpot!=undefined){1245 $scope.socialCard.storia.accoglienzaYes = true;1246 }1247 }1248 }1249 1250 function getSanitaria() {1251 if($scope.socialCard.sanitaria==undefined){ 1252 $scope.loading = true;1253 socialCardService.getSanitaria($routeParams.id).then(function(temp) {1254 if(temp==null){1255 temp = new Object();1256 } 1257 $scope.socialCard.sanitaria = temp;1258 turnSanitariaheckboxesOn();1259 console.log("SUCCESS");1260 $scope.loading=false;1261 }, function() {1262 console.log("ERROR");1263 $scope.loading=false;1264 });1265 }1266 };1267 1268 function turnSanitariaheckboxesOn(){1269 1270 if($scope.socialCard.sanitaria.specificheDisabilita!=undefined){1271 $scope.socialCard.sanitaria.disabilitaYes = true;1272 }1273 if($scope.socialCard.sanitaria.patologieAllergiche!=undefined){1274 $scope.socialCard.sanitaria.patologiaYes = true;1275 }1276 if($scope.socialCard.sanitaria.medicoCurante!=undefined){1277 $scope.socialCard.sanitaria.medicoYes = true;1278 }1279 if($scope.socialCard.sanitaria.presoInCarico!=undefined){1280 $scope.socialCard.sanitaria.inCaricoYes = true;1281 }1282 if($scope.socialCard.sanitaria.vaccini!=undefined){1283 $scope.socialCard.sanitaria.vaccinoYes = true;1284 }1285 }1286 1287 1288 function getIstruzione() {1289 if($scope.socialCard.istruzione==undefined){ 1290 $scope.loading = true;1291 socialCardService.getIstruzione($routeParams.id).then(function(temp) {1292 if(temp==null){1293 temp = new Object();1294 } 1295 $scope.socialCard.istruzione = temp;1296 console.log("SUCCESS");1297 $scope.loading=false;1298 }, function() {1299 console.log("ERROR");1300 $scope.loading=false;1301 });1302 }1303 };1304 1305 function getLavoro() {1306 if($scope.socialCard.lavoro==undefined){ 1307 $scope.loading = true;1308 socialCardService.getLavoro($routeParams.id).then(function(temp) {1309 $scope.socialCard.lavoro = temp;1310 console.log("SUCCESS");1311 $scope.loading=false;1312 }, function() {1313 console.log("ERROR");1314 $scope.loading=false;1315 });1316 }1317 };1318 1319 function getCompetenze() {1320 if($scope.socialCard.competenze==undefined){ 1321 $scope.loading = true;1322 socialCardService.getCompetenze($routeParams.id).then(function(temp) {1323 if(temp==null){1324 temp = new Object();1325 }1326 $scope.socialCard.competenze = temp;1327 console.log("SUCCESS");1328 $scope.loading=false;1329 }, function() {1330 console.log("ERROR");1331 $scope.loading=false;1332 });1333 }1334 }1335 1336 function getSociale() {1337 if($scope.socialCard.sociale==undefined){ 1338 $scope.loading = true;1339 socialCardService.getSociale($routeParams.id).then(function(temp) {1340 if(temp==null){1341 temp = new Object();1342 }1343 $scope.socialCard.sociale = temp;1344 turnSocialeheckboxesOn();1345 console.log("SUCCESS");1346 $scope.loading=false;1347 }, function() {1348 console.log("ERROR");1349 $scope.loading=false;1350 });1351 }1352 };1353 function turnSocialeheckboxesOn(){1354 1355 if($scope.socialCard.sociale.volontariato!=undefined){1356 $scope.socialCard.sociale.volontariatoYes = true;1357 }1358 if($scope.socialCard.sociale.laboratori!=undefined){1359 $scope.socialCard.sociale.laboratoriYes = true;1360 }1361 if($scope.socialCard.sociale.sport!=undefined){1362 $scope.socialCard.sociale.sportYes = true;1363 }1364 if($scope.socialCard.sociale.gruppiAss!=undefined){1365 $scope.socialCard.sociale.gruppiYes = true;1366 }1367 }1368 1369 function getPenale() {1370 if($scope.socialCard.penale==undefined){ 1371 $scope.loading = true;1372 socialCardService.getPenale($routeParams.id).then(function(temp) {1373 $scope.socialCard.penale = temp;1374 console.log("SUCCESS");1375 $scope.loading=false;1376 }, function() {1377 console.log("ERROR");1378 $scope.loading=false;1379 });1380 }1381 };1382 1383 1384 function getDesideri() {1385 if($scope.socialCard.desideri==undefined){ 1386 $scope.loading = true;1387 socialCardService.getDesideri($routeParams.id).then(function(temp) {1388 $scope.socialCard.desideri = temp;1389 console.log("SUCCESS");1390 $scope.loading=false;1391 }, function() {1392 console.log("ERROR");1393 $scope.loading=false;1394 });1395 }1396 };1397 1398 1399 $scope.tab = commonService.getFirstWriteSection();1400 $scope.showTab($scope.tab);1401 1402 //FINE GESTIONE TAB1403 1404 // callback for ng-click logout:1405 $scope.logout = function(ev) { 1406 1407 var confirm = $mdDialog.confirm()1408 .title('Sicuro di voler uscire?')1409 .textContent('Eventuali modifiche non salvate saranno perse')1410 .ariaLabel('Lucky day')1411 .targetEvent(ev)1412 .ok('Conferma')1413 .cancel('Annulla');1414 $mdDialog.show(confirm).then(function() {1415 console.log("logout confirmed");1416 $localStorage.userSession = {};1417 $location.path('/');1418 }, function() {1419 console.log("logout cancel");1420 });1421 1422 };1423 //$scope.user = getDummyUser($routeParams.id); // TODO1424 // SocialCardFactory.show({id:1425 // $routeParams.id});1426 }1427]);1428 1429 ...

Full Screen

Full Screen

Delete_Data.js

Source:Delete_Data.js Github

copy

Full Screen

1'use strict';2/**3 * @ngdoc function4 * @name dashyAngular.controller:MainCtrl5 * @description6 * # MainCtrl7 * Controller of dashyAngular8 */9angular.module('dashyAngular').controller('Delete_Data', function ($scope, $filter, $http, $sce, $compile) {10$scope.errMsg ='';11 $scope.alerts1 = [];12 $scope.addAlert1 = function(){13 $scope.alerts1 = [];14 $scope.alerts1.push({type: 'danger', msg: $scope.errMsg})15 };16 $scope.closeAlert1 = function(index) {17 $scope.alerts1.splice(index, 1);18 };19 20 var feildname=[];21$scope.dtypes=[];22 $scope.users = []; 23var length =0;24var updateIndex=0;25var deleteIndex = 0;26$scope.database_names_select ="";27$scope.table_names_select ="";28$scope.table_heder = "";29$scope.table_body = "";30$scope.table_newdata = "";31$scope.input_feilds ="";32$scope.input_tbl ="";33$scope.addDataBtn = "";34 35$scope.query = "Waiting For Query";36$scope.java =" /*STEP 1. Import required packages*/\n"37 + "import java.sql.*;\n"38 + "\n"39 + "public class CodeMageExample {\n"40 + "\n"41 + " /* JDBC driver name and database URL */\n"42 + " static final String JDBC_DRIVER = \"com.mysql.jdbc.Driver\";\n"43 + " static final String DB_URL = \"jdbc:mysql://localhost/db1\";\n"44 + "\n"45 + " /* Change Your Database credentials */\n"46 + " static final String USER = \"username\";\n"47 + " static final String PASS = \"password\";\n"48 + "\n"49 + " public static void main(String[] args) {\n"50 + " Connection conn = null;\n"51 + " Statement stmt = null;\n"52 + " try {\n"53 + " /*STEP 2: Register JDBC driver */\n"54 + " Class.forName(\"com.mysql.jdbc.Driver\");\n"55 + "\n"56 + " /* STEP 3: Open a connection */\n"57 + " System.out.println(\"Connecting to a selected database...\");\n"58 + " conn = DriverManager.getConnection(DB_URL, USER, PASS);\n"59 + " System.out.println(\"Connected database successfully...\");\n"60 + "\n"61 + " /* STEP 4: Execute a query */\n"62 + " System.out.println(\"Deleteing records in the table...\");\n"63 + " stmt = conn.createStatement();\n"64 + "\n"65 + " String sql = \"Enter Your Query \";\n"66 + " stmt.executeUpdate(sql);\n"67 + " System.out.println(\"Deleted records in the table...\");\n"68 + "\n"69 + " } catch (SQLException | ClassNotFoundException se) {\n"70 + " } finally {\n"71 + " /* finally block used to close resources */\n"72 + " try {\n"73 + " if (stmt != null) {\n"74 + " conn.close();\n"75 + " }\n"76 + " } catch (SQLException se) {\n"77 + " }\n"78 + " try {\n"79 + " if (conn != null) {\n"80 + " conn.close();\n"81 + " }\n"82 + " } catch (SQLException se) {\n"83 + " }\n"84 + " }\n"85 + " System.out.println(\"Goodbye!\");\n"86 + " }\n"87 + "}";88$scope.inputFeild ="";89$scope.alerts = [90 { type: 'info', msg: $scope.java }91 ];92 $scope.closeAlert = function(index) {93 $scope.alerts.splice(index, 1);94 };95 96 $scope.showJavaCode = function(){97 $scope.alerts = [];98 $scope.alerts.push({ msg: $scope.java});99 };100 101$scope.init = function() {102 $http({103 method: 'GET',104 url: 'http://localhost:8084/CodeMage/database/1'105 }).then(function successCallback(response) {106 var dbs = [];107 var i = 0;108 for(i=0;i<response.data.length;i++){109 dbs[i] = response.data[i].user_dbname;110 }111 $scope.database_names_select = dbs;112 }, function errorCallback(response) {113 swal(114 'error!',115 'something wrong!',116 'error'117 )118 });119 };120 121$scope.getTable = function (){122 $http({123 method: 'GET',124 url: 'http://localhost:8084/CodeMage/tables/'+$scope.selectedDB125 }).then(function successCallback(response) {126 $scope.table_names_select = response.data;127 }, function errorCallback(response) {128 swal(129 'error!',130 'something wrong!',131 'error'132 )133 });134 };135 136 137 138 139 140// remove user141 $scope.saveUser = function(index) {142 updateIndex = index;143 console.log(index);144 };145 // remove user146 $scope.removeUser = function(index) {147 deleteIndex = index;148 //$scope.users.splice(index, 1);149 console.log( deleteIndex);150 };151 // add user152 $scope.addUser = function() {153 $scope.inserted = {154 id: $scope.users.length+1,155 feild1: '',156 feild2: '',157 feild3: '', 158 feild4: '',159 feild5: '',160 feild6: '', 161 feild7: '',162 feild8: '',163 feild9: '', 164 feild10: '',165 feild11: '',166 feild12: '', 167 feild13: '',168 feild14: '',169 feild15: ''170 };171 $scope.users.push($scope.inserted);172 console.log( $scope.users);173 };174 175 176 177 178 179 180 181 182 183 184 185 186 187 $scope.submit = function(){188 $http({189 method: 'GET',190 url: 'http://localhost:8084/CodeMage/colmns/'+$scope.selectedDB+'/'+$scope.selectedTBL191 }).then(function successCallback(response) {192 feildname = response.data;193 var i=0;194 var tblHeady = "<tr>";195 for(i = 0; i< response.data.length; i++){196 tblHeady = tblHeady + "<th>"+response.data[i]+"</th>";197 } 198 tblHeady = tblHeady + '</tr>';199 $scope.table_heder = $sce.trustAsHtml(tblHeady);200 }, function errorCallback(response) {201 swal(202 'error!',203 'something wrong!',204 'error'205 )206 });207 208 $http({209 method: 'GET',210 url: 'http://localhost:8084/CodeMage/data-delete/'+$scope.selectedDB+'/'+$scope.selectedTBL211 }).then(function successCallback(response) { 212 $scope.table_body = $sce.trustAsHtml(response.data.result);213 $scope.input_feilds = $sce.trustAsHtml(response.data.table);214 $scope.input_tbl = "";215 }, function errorCallback(response) {216 swal(217 'error!',218 'something wrong!',219 'error'220 )221 });222 223 224 $http({225 method: 'GET',226 url: 'http://localhost:8084/CodeMage/data-json/'+$scope.selectedDB+'/'+$scope.selectedTBL227 }).then(function successCallback(response) { 228 var usersss = JSON.parse(response.data.query);229 $scope.users = usersss;230 }, function errorCallback(response) {231 swal(232 'error!',233 'something wrong!',234 'error'235 )236 });237 238 239 240 241 $http({242 method: 'GET',243 url: 'http://localhost:8084/CodeMage/colmn-types/'+$scope.selectedDB+'/'+$scope.selectedTBL244 }).then(function successCallback(response) {245 $scope.dtypes = response.data;246 length = response.data.length;247 }, function errorCallback(response) {248 swal(249 'error!',250 'something wrong!',251 'error'252 )253 });254 255 };256$scope.insertData = function(){257 var valuesofData = [];258 switch(length) {259 case 1:260 valuesofData[0] = $scope.users[deleteIndex].feild0;261 break;262 case 2:263 valuesofData[0] = $scope.users[deleteIndex].feild0;264 valuesofData[1] = $scope.users[deleteIndex].feild1;265 break;266 case 3:267 valuesofData[0] = $scope.users[deleteIndex].feild0;268 valuesofData[1] = $scope.users[deleteIndex].feild1;269 valuesofData[2] = $scope.users[deleteIndex].feild2;270 break;271 case 4:272 valuesofData[0] = $scope.users[deleteIndex].feild0;273 valuesofData[1] = $scope.users[deleteIndex].feild1;274 valuesofData[2] = $scope.users[deleteIndex].feild2;275 valuesofData[3] = $scope.users[deleteIndex].feild3;276 break;277 case 5:278 valuesofData[0] = $scope.users[deleteIndex].feild0;279 valuesofData[1] = $scope.users[deleteIndex].feild1;280 valuesofData[2] = $scope.users[deleteIndex].feild2;281 valuesofData[3] = $scope.users[deleteIndex].feild3;282 valuesofData[4] = $scope.users[deleteIndex].feild4;283 break;284 case 6:285 valuesofData[0] = $scope.users[deleteIndex].feild0;286 valuesofData[1] = $scope.users[deleteIndex].feild1;287 valuesofData[2] = $scope.users[deleteIndex].feild2;288 valuesofData[3] = $scope.users[deleteIndex].feild3;289 valuesofData[4] = $scope.users[deleteIndex].feild4;290 valuesofData[5] = $scope.users[deleteIndex].feild5;291 break;292 case 7:293 valuesofData[0] = $scope.users[deleteIndex].feild0;294 valuesofData[1] = $scope.users[deleteIndex].feild1;295 valuesofData[2] = $scope.users[deleteIndex].feild2;296 valuesofData[3] = $scope.users[deleteIndex].feild3;297 valuesofData[4] = $scope.users[deleteIndex].feild4;298 valuesofData[5] = $scope.users[deleteIndex].feild5;299 valuesofData[6] = $scope.users[deleteIndex].feild6;300 break;301 case 8:302 valuesofData[0] = $scope.users[deleteIndex].feild0;303 valuesofData[1] = $scope.users[deleteIndex].feild1;304 valuesofData[2] = $scope.users[deleteIndex].feild2;305 valuesofData[3] = $scope.users[deleteIndex].feild3;306 valuesofData[4] = $scope.users[deleteIndex].feild4;307 valuesofData[5] = $scope.users[deleteIndex].feild5;308 valuesofData[6] = $scope.users[deleteIndex].feild6;309 valuesofData[7] = $scope.users[deleteIndex].feild7;310 break;311 case 9:312 valuesofData[0] = $scope.users[deleteIndex].feild0;313 valuesofData[1] = $scope.users[deleteIndex].feild1;314 valuesofData[2] = $scope.users[deleteIndex].feild2;315 valuesofData[3] = $scope.users[deleteIndex].feild3;316 valuesofData[4] = $scope.users[deleteIndex].feild4;317 valuesofData[5] = $scope.users[deleteIndex].feild5;318 valuesofData[6] = $scope.users[deleteIndex].feild6;319 valuesofData[7] = $scope.users[deleteIndex].feild7;320 valuesofData[8] = $scope.users[deleteIndex].feild8;321 break;322 case 10:323 valuesofData[0] = $scope.users[deleteIndex].feild0;324 valuesofData[1] = $scope.users[deleteIndex].feild1;325 valuesofData[2] = $scope.users[deleteIndex].feild2;326 valuesofData[3] = $scope.users[deleteIndex].feild3;327 valuesofData[4] = $scope.users[deleteIndex].feild4;328 valuesofData[5] = $scope.users[deleteIndex].feild5;329 valuesofData[6] = $scope.users[deleteIndex].feild6;330 valuesofData[7] = $scope.users[deleteIndex].feild7;331 valuesofData[8] = $scope.users[deleteIndex].feild8;332 valuesofData[9] = $scope.users[deleteIndex].feild9;333 break;334 case 11:335 valuesofData[0] = $scope.users[deleteIndex].feild0;336 valuesofData[1] = $scope.users[deleteIndex].feild1;337 valuesofData[2] = $scope.users[deleteIndex].feild2;338 valuesofData[3] = $scope.users[deleteIndex].feild3;339 valuesofData[4] = $scope.users[deleteIndex].feild4;340 valuesofData[5] = $scope.users[deleteIndex].feild5;341 valuesofData[6] = $scope.users[deleteIndex].feild6;342 valuesofData[7] = $scope.users[deleteIndex].feild7;343 valuesofData[8] = $scope.users[deleteIndex].feild8;344 valuesofData[9] = $scope.users[deleteIndex].feild9;345 valuesofData[10] = $scope.users[deleteIndex].feild10;346 break;347 case 12:348 valuesofData[0] = $scope.users[deleteIndex].feild0;349 valuesofData[1] = $scope.users[deleteIndex].feild1;350 valuesofData[2] = $scope.users[deleteIndex].feild2;351 valuesofData[3] = $scope.users[deleteIndex].feild3;352 valuesofData[4] = $scope.users[deleteIndex].feild4;353 valuesofData[5] = $scope.users[deleteIndex].feild5;354 valuesofData[6] = $scope.users[deleteIndex].feild6;355 valuesofData[7] = $scope.users[deleteIndex].feild7;356 valuesofData[8] = $scope.users[deleteIndex].feild8;357 valuesofData[9] = $scope.users[deleteIndex].feild9;358 valuesofData[10] = $scope.users[deleteIndex].feild10;359 valuesofData[11] = $scope.users[deleteIndex].feild11;360 break;361 case 13:362 valuesofData[0] = $scope.users[deleteIndex].feild0;363 valuesofData[1] = $scope.users[deleteIndex].feild1;364 valuesofData[2] = $scope.users[deleteIndex].feild2;365 valuesofData[3] = $scope.users[deleteIndex].feild3;366 valuesofData[4] = $scope.users[deleteIndex].feild4;367 valuesofData[5] = $scope.users[deleteIndex].feild5;368 valuesofData[6] = $scope.users[deleteIndex].feild6;369 valuesofData[7] = $scope.users[deleteIndex].feild7;370 valuesofData[8] = $scope.users[deleteIndex].feild8;371 valuesofData[9] = $scope.users[deleteIndex].feild9;372 valuesofData[10] = $scope.users[deleteIndex].feild10;373 valuesofData[11] = $scope.users[deleteIndex].feild11;374 valuesofData[12] = $scope.users[deleteIndex].feild12;375 break;376 case 14:377 valuesofData[0] = $scope.users[deleteIndex].feild0;378 valuesofData[1] = $scope.users[deleteIndex].feild1;379 valuesofData[2] = $scope.users[deleteIndex].feild2;380 valuesofData[3] = $scope.users[deleteIndex].feild3;381 valuesofData[4] = $scope.users[deleteIndex].feild4;382 valuesofData[5] = $scope.users[deleteIndex].feild5;383 valuesofData[6] = $scope.users[deleteIndex].feild6;384 valuesofData[7] = $scope.users[deleteIndex].feild7;385 valuesofData[8] = $scope.users[deleteIndex].feild8;386 valuesofData[9] = $scope.users[deleteIndex].feild9;387 valuesofData[10] = $scope.users[deleteIndex].feild10;388 valuesofData[11] = $scope.users[deleteIndex].feild11;389 valuesofData[12] = $scope.users[deleteIndex].feild12;390 valuesofData[13] = $scope.users[deleteIndex].feild13;391 break;392 case 15:393 valuesofData[0] = $scope.users[deleteIndex].feild0;394 valuesofData[1] = $scope.users[deleteIndex].feild1;395 valuesofData[2] = $scope.users[deleteIndex].feild2;396 valuesofData[3] = $scope.users[deleteIndex].feild3;397 valuesofData[4] = $scope.users[deleteIndex].feild4;398 valuesofData[5] = $scope.users[deleteIndex].feild5;399 valuesofData[6] = $scope.users[deleteIndex].feild6;400 valuesofData[7] = $scope.users[deleteIndex].feild7;401 valuesofData[8] = $scope.users[deleteIndex].feild8;402 valuesofData[9] = $scope.users[deleteIndex].feild9;403 valuesofData[10] = $scope.users[deleteIndex].feild10;404 valuesofData[11] = $scope.users[deleteIndex].feild11;405 valuesofData[12] = $scope.users[deleteIndex].feild12;406 valuesofData[13] = $scope.users[deleteIndex].feild13;407 valuesofData[14] = $scope.users[deleteIndex].feild14;408 break;409 default:410 console.log('something wrong');411 }412 413 console.log($scope.users[deleteIndex].feild0);414 415 var deleteJSON ={416 "db_name": $scope.selectedDB,417 "delete_data": {418 "table_name": $scope.selectedTBL,419 "condition": {420 "base_feild": feildname[0],421 "data_type": $scope.dtypes[0],422 "operation": "=",423 "value": $scope.users[deleteIndex].feild0424 }425 }426 };427 428 429 console.log(deleteJSON);430 $http({431 method: 'DELETE',432 data : deleteJSON,433 url: 'http://localhost:8084/CodeMage/delete'434 }).then(function successCallback(response) {435 if(response.data.err == 'true'){436 $scope.query = response.data.query;437 $scope.errMsg =response.data.msg;438 $scope.showGrowlWarning = true;439 $scope.addAlert1();440 }else{441 442 console.log(response.data);443 console.log(response.data.java_code);444 $scope.query = response.data.query;445 $scope.java = response.data.java_code;446 $scope.submit();447 448 449 $scope.errMsg ='';450 $scope.showGrowlWarning = false;451 }452 453 454 455 }, function errorCallback(response) {456 console.log(response);457 swal(458 'error!',459 'something wrong! massa',460 'error'461 )462 });463 464};465 ...

Full Screen

Full Screen

view-tabs.js

Source:view-tabs.js Github

copy

Full Screen

1/* 2 @description 预览文档tabs3 @author shuxiaokai4 @create 2019-07-26 17:42"5*/6export default {7 state: {8 tabs: [],9 currentTab: {}10 },11 mutations: {12 addViewTabs(state, payload) {13 const hasTab = state.tabs.some(val => val.id === payload.id);14 if (!hasTab) {15 state.tabs.push(payload)16 localStorage.setItem("viewTabs", JSON.stringify(state.tabs))17 }18 },19 changeAllViewTabs(state, payload) {20 state.tabs = payload21 },22 changeCurrentViewTabs(state, id) {23 const findTab = state.tabs.find(val => val.id === id);24 localStorage.setItem("viewCurrentTab", JSON.stringify(findTab || []));25 state.currentTab = findTab;26 },27 /* 28 @description 删除tabs29 @author shuxiaokai30 @create 2019-10-23 16:46"31 @params tabs的id32 @return null33 */34 removeViewTabs(state, payload) {35 let deleteIndex = 0;36 state.tabs.forEach((val, index) => {37 if (val.id === payload) {38 deleteIndex = index;39 }40 })41 if (payload === state.currentTab.id) {42 if (state.tabs[deleteIndex + 1] != null) {43 state.currentTab = state.tabs[deleteIndex + 1];44 } else if (state.tabs[deleteIndex + 1] == null && state.tabs[deleteIndex - 1] != null) {45 state.currentTab = state.tabs[deleteIndex - 1];46 } else if (state.tabs[deleteIndex + 1] == null && state.tabs[deleteIndex - 1] == null) {47 state.currentTab = "";48 }49 localStorage.setItem("viewCurrentTab", JSON.stringify(state.currentTab));50 }51 state.tabs.splice(deleteIndex, 1);52 localStorage.setItem("viewTabs", JSON.stringify(state.tabs));53 },54 /* 55 @description 关闭多个标签56 @author shuxiaokai57 @create 2019-07-21 09:37"58 @params state<object> store状态59 @params payload.start<int> 关闭的起始位置60 @params payload.end<int> 关闭的结束位置61 @return null62 */63 deleteViewTabs(state, payload) {64 state.tabs.splice(payload.start, payload.num)65 },66 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { deleteIndex } from 'ng-mocks';2describe('TestComponent', () => {3 let component: TestComponent;4 let fixture: ComponentFixture<TestComponent>;5 beforeEach(async(() => {6 TestBed.configureTestingModule({7 })8 .compileComponents();9 }));10 beforeEach(() => {11 fixture = TestBed.createComponent(TestComponent);12 component = fixture.componentInstance;13 fixture.detectChanges();14 });15 it('should create', () => {16 expect(component).toBeTruthy();17 });18 afterEach(() => {19 deleteIndex();20 });21});22PASS test.js (5.442s)

Full Screen

Using AI Code Generation

copy

Full Screen

1import { deleteIndex } from 'ng-mocks';2import { TestBed } from '@angular/core/testing';3import { MyComponent } from './my.component';4describe('MyComponent', () => {5 beforeEach(() => {6 TestBed.configureTestingModule({7 });8 });9 it('should delete index', () => {10 deleteIndex(MyComponent);11 });12});13Using the deleteIndex() method14deleteIndex() method example15import { deleteIndex } from 'ng-mocks';16import { TestBed } from '@angular/core/testing';17import { MyComponent } from './my.component';18describe('MyComponent', () => {19 beforeEach(() => {20 TestBed.configureTestingModule({21 });22 });23 it('should delete index', () => {24 let result = deleteIndex(MyComponent);25 expect(result).toBe(true);26 });27});28The deleteIndex() method is used to delete the index of a component or

Full Screen

Using AI Code Generation

copy

Full Screen

1import { deleteIndex } from 'ng-mocks';2describe('deleteIndex', () => {3 it('should delete index of array', () => {4 const array = [1, 2, 3];5 deleteIndex(array, 1);6 expect(array).toEqual([1, 3]);7 });8});9import 'ng-mocks';10describe('ng-mocks global', () => {11 it('should delete index of array', () => {12 const array = [1, 2, 3];13 ngMocks.deleteIndex(array, 1);14 expect(array).toEqual([1, 3]);15 });16});17import 'ng-mocks';18describe('ng-mocks global', () => {19 it('should delete index of array', () => {20 const array = [1, 2, 3];21 ngMocks.deleteIndex(array, 1);22 expect(array).toEqual([1, 3]);23 });24});25import 'ng-mocks';26describe('ng-mocks global', () => {27 it('should delete index of array', () => {28 const array = [1, 2, 3];29 ngMocks.deleteIndex(array, 1);30 expect(array).toEqual([1, 3]);31 });32});33import 'ng-mocks';34describe('ng-mocks global', () => {35 it('should delete index of array', () => {36 const array = [1, 2, 3];37 ngMocks.deleteIndex(array, 1);38 expect(array).toEqual([1, 3]);39 });40});41import 'ng-mocks';42describe('ng-mocks global', () => {43 it('should delete index of array', () => {44 const array = [1, 2, 3];45 ngMocks.deleteIndex(array, 1);46 expect(array).toEqual([1, 3]);47 });48});49import 'ng-mocks';50describe('ng-mocks global', () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { deleteIndex } from 'ng-mocks';2describe('MyComponent', () => {3 let component: MyComponent;4 beforeEach(() => {5 deleteIndex(MyComponent);6 TestBed.configureTestingModule({7 });8 component = TestBed.createComponent(MyComponent).componentInstance;9 });10 it('should be created', () => {11 expect(component).toBeTruthy();12 });13});14@Component({15})16export class MyComponent { }17import { MyComponent } from './my-component';18describe('MyComponent', () => {19 let component: MyComponent;20 beforeEach(() => {21 TestBed.configureTestingModule({22 });23 component = TestBed.createComponent(MyComponent).componentInstance;24 });25 it('should be created', () => {26 expect(component).toBeTruthy();27 });28});29import { MyComponent } from './my-component';30describe('MyComponent', () => {31 let component: MyComponent;32 beforeEach(() => {33 TestBed.configureTestingModule({34 });35 component = TestBed.createComponent(MyComponent).componentInstance;36 });37 it('should be created', () => {38 expect(component).toBeTruthy();39 });40});41import { MyComponent } from './my-component';42describe('MyComponent', () => {43 let component: MyComponent;44 beforeEach(() => {45 TestBed.configureTestingModule({46 });47 component = TestBed.createComponent(MyComponent).componentInstance;48 });49 it('should be created', () => {50 expect(component).toBeTruthy();51 });52});53import { MyComponent } from './my-component';54describe('MyComponent', () => {55 let component: MyComponent;56 beforeEach(() => {57 TestBed.configureTestingModule({58 });59 component = TestBed.createComponent(MyComponent).componentInstance;60 });61 it('should be created', () => {62 expect(component).toBeTruthy();63 });64});65import { MyComponent } from './my-component';66describe('MyComponent', () => {67 let component: MyComponent;68 beforeEach(() => {69 TestBed.configureTestingModule({70 });

Full Screen

Using AI Code Generation

copy

Full Screen

1const ngMocks = require('ng-mocks');2ngMocks.deleteIndex('test');3const ngMocks = require('ng-mocks');4ngMocks.deleteIndex('test');5const ngMocks = require('ng-mocks');6ngMocks.deleteIndex('test');7const ngMocks = require('ng-mocks');8ngMocks.deleteIndex('test');9const ngMocks = require('ng-mocks');10ngMocks.deleteIndex('test');11const ngMocks = require('ng-mocks');12ngMocks.deleteIndex('test');13const ngMocks = require('ng-mocks');14ngMocks.deleteIndex('test');15const ngMocks = require('ng-mocks');16ngMocks.deleteIndex('test');17const ngMocks = require('ng-mocks');18ngMocks.deleteIndex('test');19const ngMocks = require('ng-mocks');20ngMocks.deleteIndex('test');21const ngMocks = require('ng-mocks');22ngMocks.deleteIndex('test');23const ngMocks = require('ng-mocks');24ngMocks.deleteIndex('test');25const ngMocks = require('ng-mocks');26ngMocks.deleteIndex('test');27const ngMocks = require('ng-mocks');28ngMocks.deleteIndex('test');

Full Screen

Using AI Code Generation

copy

Full Screen

1import { TestBed } from '@angular/core/testing';2import { deleteIndex } from 'ng-mocks';3describe('Test deleteIndex', () => {4 it('deleteIndex', () => {5 const obj = { a: 1, b: 2, c: 3 };6 deleteIndex(obj, 1);7 expect(obj).toEqual({ a: 1, c: 3 });8 });9});10{11 "compilerOptions": {12 },13}14module.exports = {15 globals: {16 'ts-jest': {17 }18 },19 transform: {20 '^.+\\.(ts|js|html)$': 'ts-jest'21 },22 transformIgnorePatterns: ['node_modules/(?!@ngrx|ngx-socket-io)'],23 moduleNameMapper: {24 '@app/(.*)': '<rootDir>/src/app/$1',25 }26};27import 'jest-preset-angular';28import 'jest-date-mock';29import './test';30import 'core-js/es7/reflect';31import 'zone.js/dist/zone-testing';32import { getTestBed } from '@angular/core/testing';33import {34} from '@angular/platform-browser-dynamic/testing';35getTestBed().initTestEnvironment(36 platformBrowserDynamicTesting()37);38module.exports = {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { deleteIndex } from 'ng-mocks';2import { deleteIndex } from 'ng-mocks';3deleteIndex(component: Type<any>): number;4import { deleteIndex } from 'ng-mocks';5import { AppComponent } from './app.component';6import { TestBed } from '@angular/core/testing';7import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';8TestBed.initTestEnvironment(9 platformBrowserDynamicTesting()10);11describe('AppComponent', () => {12 it('should delete the index of the component', () => {13 const index = deleteIndex(AppComponent);14 expect(index).toEqual(0);15 });16});17 ✓ should delete the index of the component (3ms)

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ng-mocks automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful