Add jQuery and fix modal close on register survey

This commit is contained in:
Pablo Bonilla 2021-07-11 01:17:12 -06:00
parent 762129cdb8
commit 046d97af33
No known key found for this signature in database
GPG Key ID: 46877262B8DE47E2
8 changed files with 8349 additions and 56 deletions

View File

@ -45,7 +45,7 @@
], ],
"styles": ["src/main/webapp/content/scss/paper-dashboard.scss", "./node_modules/swiper/swiper-bundle.min.css"], "styles": ["src/main/webapp/content/scss/paper-dashboard.scss", "./node_modules/swiper/swiper-bundle.min.css"],
"scripts": [ "scripts": [
"src/main/webapp/content/js/jquery-3.1.1.min.js", "./node_modules/jquery/dist/jquery.min.js",
"src/main/webapp/content/js/jquery.bootstrap.wizard.min.js", "src/main/webapp/content/js/jquery.bootstrap.wizard.min.js",
"src/main/webapp/content/js/jquery.datatables.js", "src/main/webapp/content/js/jquery.datatables.js",
"src/main/webapp/content/js/jquery.easypiechart.min.js", "src/main/webapp/content/js/jquery.easypiechart.min.js",
@ -53,7 +53,6 @@
"src/main/webapp/content/js/jquery-jvectormap.js", "src/main/webapp/content/js/jquery-jvectormap.js",
"src/main/webapp/content/js/jquery-ui.min.js", "src/main/webapp/content/js/jquery-ui.min.js",
"src/main/webapp/content/js/bootstrap.bundle.min.js", "src/main/webapp/content/js/bootstrap.bundle.min.js",
"src/main/webapp/content/js/bootstrap.min.js",
"src/main/webapp/content/js/moment.min.js", "src/main/webapp/content/js/moment.min.js",
"src/main/webapp/content/js/bootstrap-datetimepicker.js", "src/main/webapp/content/js/bootstrap-datetimepicker.js",
"src/main/webapp/content/js/bootstrap-notify.js", "src/main/webapp/content/js/bootstrap-notify.js",
@ -64,10 +63,10 @@
"src/main/webapp/content/js/es6-promise-auto.min.js", "src/main/webapp/content/js/es6-promise-auto.min.js",
"src/main/webapp/content/js/fullcalendar.min.js", "src/main/webapp/content/js/fullcalendar.min.js",
"src/main/webapp/content/js/nouislider.min.js", "src/main/webapp/content/js/nouislider.min.js",
"src/main/webapp/content/js/paper-dashboard.js",
"src/main/webapp/content/js/perfect-scrollbar.min.js", "src/main/webapp/content/js/perfect-scrollbar.min.js",
"src/main/webapp/content/js/sweetalert2.js", "src/main/webapp/content/js/sweetalert2.js",
"./node_modules/swiper/swiper-bundle.min.js" "./node_modules/swiper/swiper-bundle.min.js",
"src/main/webapp/content/js/paper-dashboard.js"
] ]
}, },
"configurations": { "configurations": {

79
package-lock.json generated
View File

@ -25,6 +25,7 @@
"@ngx-translate/http-loader": "6.0.0", "@ngx-translate/http-loader": "6.0.0",
"bootstrap": "4.6.0", "bootstrap": "4.6.0",
"dayjs": "1.10.5", "dayjs": "1.10.5",
"jquery": "^3.6.0",
"ngx-infinite-scroll": "10.0.1", "ngx-infinite-scroll": "10.0.1",
"ngx-webstorage": "8.0.0", "ngx-webstorage": "8.0.0",
"rxjs": "6.6.7", "rxjs": "6.6.7",
@ -42,7 +43,9 @@
"@angular/cli": "12.0.4", "@angular/cli": "12.0.4",
"@angular/compiler-cli": "12.0.5", "@angular/compiler-cli": "12.0.5",
"@angular/service-worker": "12.0.5", "@angular/service-worker": "12.0.5",
"@types/bootstrap": "^5.0.17",
"@types/jest": "26.0.23", "@types/jest": "26.0.23",
"@types/jquery": "^3.5.6",
"@types/node": "15.12.2", "@types/node": "15.12.2",
"@types/sockjs-client": "1.5.0", "@types/sockjs-client": "1.5.0",
"@typescript-eslint/eslint-plugin": "4.27.0", "@typescript-eslint/eslint-plugin": "4.27.0",
@ -3981,6 +3984,16 @@
"integrity": "sha512-15spi3V28QdevleWBNXE4pIls3nFZmBbUGrW9IVPwiQczuSb9n76TCB4bsk8TSel+I1OkHEdPhu5QKMfY6rQHA==", "integrity": "sha512-15spi3V28QdevleWBNXE4pIls3nFZmBbUGrW9IVPwiQczuSb9n76TCB4bsk8TSel+I1OkHEdPhu5QKMfY6rQHA==",
"dev": true "dev": true
}, },
"node_modules/@popperjs/core": {
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.9.2.tgz",
"integrity": "sha512-VZMYa7+fXHdwIq1TDhSXoVmSPEGM/aa+6Aiq3nVVJ9bXr24zScr+NlKFKC3iPljA7ho/GAZr+d2jOf5GIRC30Q==",
"dev": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/popperjs"
}
},
"node_modules/@scarf/scarf": { "node_modules/@scarf/scarf": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/@scarf/scarf/-/scarf-1.1.1.tgz", "resolved": "https://registry.npmjs.org/@scarf/scarf/-/scarf-1.1.1.tgz",
@ -4177,6 +4190,16 @@
"@babel/types": "^7.3.0" "@babel/types": "^7.3.0"
} }
}, },
"node_modules/@types/bootstrap": {
"version": "5.0.17",
"resolved": "https://registry.npmjs.org/@types/bootstrap/-/bootstrap-5.0.17.tgz",
"integrity": "sha512-uQQQ3p+zw10VjZLvtCuKWI6QgVCYEnK/yHnno3gyEhikfQdiZexS2XPxjWRboGmX135o470GkmCta9eAgQMVLQ==",
"dev": true,
"dependencies": {
"@popperjs/core": "^2.9.2",
"@types/jquery": "*"
}
},
"node_modules/@types/concat-stream": { "node_modules/@types/concat-stream": {
"version": "1.6.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-1.6.0.tgz", "resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-1.6.0.tgz",
@ -4280,6 +4303,15 @@
"pretty-format": "^26.0.0" "pretty-format": "^26.0.0"
} }
}, },
"node_modules/@types/jquery": {
"version": "3.5.6",
"resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.6.tgz",
"integrity": "sha512-SmgCQRzGPId4MZQKDj9Hqc6kSXFNWZFHpELkyK8AQhf8Zr6HKfCzFv9ZC1Fv3FyQttJZOlap3qYb12h61iZAIg==",
"dev": true,
"dependencies": {
"@types/sizzle": "*"
}
},
"node_modules/@types/json-schema": { "node_modules/@types/json-schema": {
"version": "7.0.7", "version": "7.0.7",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz",
@ -4328,6 +4360,12 @@
"integrity": "sha512-0/HnwIfW4ki2D8L8c9GVcG5I72s9jP5GSLVF0VIXDW00kmIpA6O33G7a8n59Tmh7Nz0WUC3rSb7PTY/sdW2JzA==", "integrity": "sha512-0/HnwIfW4ki2D8L8c9GVcG5I72s9jP5GSLVF0VIXDW00kmIpA6O33G7a8n59Tmh7Nz0WUC3rSb7PTY/sdW2JzA==",
"dev": true "dev": true
}, },
"node_modules/@types/sizzle": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.3.tgz",
"integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==",
"dev": true
},
"node_modules/@types/sockjs-client": { "node_modules/@types/sockjs-client": {
"version": "1.5.0", "version": "1.5.0",
"resolved": "https://registry.npmjs.org/@types/sockjs-client/-/sockjs-client-1.5.0.tgz", "resolved": "https://registry.npmjs.org/@types/sockjs-client/-/sockjs-client-1.5.0.tgz",
@ -15464,6 +15502,11 @@
"@sideway/pinpoint": "^2.0.0" "@sideway/pinpoint": "^2.0.0"
} }
}, },
"node_modules/jquery": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz",
"integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw=="
},
"node_modules/js-tokens": { "node_modules/js-tokens": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@ -30101,6 +30144,12 @@
"integrity": "sha512-15spi3V28QdevleWBNXE4pIls3nFZmBbUGrW9IVPwiQczuSb9n76TCB4bsk8TSel+I1OkHEdPhu5QKMfY6rQHA==", "integrity": "sha512-15spi3V28QdevleWBNXE4pIls3nFZmBbUGrW9IVPwiQczuSb9n76TCB4bsk8TSel+I1OkHEdPhu5QKMfY6rQHA==",
"dev": true "dev": true
}, },
"@popperjs/core": {
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.9.2.tgz",
"integrity": "sha512-VZMYa7+fXHdwIq1TDhSXoVmSPEGM/aa+6Aiq3nVVJ9bXr24zScr+NlKFKC3iPljA7ho/GAZr+d2jOf5GIRC30Q==",
"dev": true
},
"@scarf/scarf": { "@scarf/scarf": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/@scarf/scarf/-/scarf-1.1.1.tgz", "resolved": "https://registry.npmjs.org/@scarf/scarf/-/scarf-1.1.1.tgz",
@ -30270,6 +30319,16 @@
"@babel/types": "^7.3.0" "@babel/types": "^7.3.0"
} }
}, },
"@types/bootstrap": {
"version": "5.0.17",
"resolved": "https://registry.npmjs.org/@types/bootstrap/-/bootstrap-5.0.17.tgz",
"integrity": "sha512-uQQQ3p+zw10VjZLvtCuKWI6QgVCYEnK/yHnno3gyEhikfQdiZexS2XPxjWRboGmX135o470GkmCta9eAgQMVLQ==",
"dev": true,
"requires": {
"@popperjs/core": "^2.9.2",
"@types/jquery": "*"
}
},
"@types/concat-stream": { "@types/concat-stream": {
"version": "1.6.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-1.6.0.tgz", "resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-1.6.0.tgz",
@ -30373,6 +30432,15 @@
"pretty-format": "^26.0.0" "pretty-format": "^26.0.0"
} }
}, },
"@types/jquery": {
"version": "3.5.6",
"resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.6.tgz",
"integrity": "sha512-SmgCQRzGPId4MZQKDj9Hqc6kSXFNWZFHpELkyK8AQhf8Zr6HKfCzFv9ZC1Fv3FyQttJZOlap3qYb12h61iZAIg==",
"dev": true,
"requires": {
"@types/sizzle": "*"
}
},
"@types/json-schema": { "@types/json-schema": {
"version": "7.0.7", "version": "7.0.7",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz",
@ -30421,6 +30489,12 @@
"integrity": "sha512-0/HnwIfW4ki2D8L8c9GVcG5I72s9jP5GSLVF0VIXDW00kmIpA6O33G7a8n59Tmh7Nz0WUC3rSb7PTY/sdW2JzA==", "integrity": "sha512-0/HnwIfW4ki2D8L8c9GVcG5I72s9jP5GSLVF0VIXDW00kmIpA6O33G7a8n59Tmh7Nz0WUC3rSb7PTY/sdW2JzA==",
"dev": true "dev": true
}, },
"@types/sizzle": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.3.tgz",
"integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==",
"dev": true
},
"@types/sockjs-client": { "@types/sockjs-client": {
"version": "1.5.0", "version": "1.5.0",
"resolved": "https://registry.npmjs.org/@types/sockjs-client/-/sockjs-client-1.5.0.tgz", "resolved": "https://registry.npmjs.org/@types/sockjs-client/-/sockjs-client-1.5.0.tgz",
@ -39006,6 +39080,11 @@
"@sideway/pinpoint": "^2.0.0" "@sideway/pinpoint": "^2.0.0"
} }
}, },
"jquery": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz",
"integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw=="
},
"js-tokens": { "js-tokens": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",

View File

@ -82,6 +82,7 @@
"@ngx-translate/http-loader": "6.0.0", "@ngx-translate/http-loader": "6.0.0",
"bootstrap": "4.6.0", "bootstrap": "4.6.0",
"dayjs": "1.10.5", "dayjs": "1.10.5",
"jquery": "^3.6.0",
"ngx-infinite-scroll": "10.0.1", "ngx-infinite-scroll": "10.0.1",
"ngx-webstorage": "8.0.0", "ngx-webstorage": "8.0.0",
"rxjs": "6.6.7", "rxjs": "6.6.7",
@ -99,7 +100,9 @@
"@angular/cli": "12.0.4", "@angular/cli": "12.0.4",
"@angular/compiler-cli": "12.0.5", "@angular/compiler-cli": "12.0.5",
"@angular/service-worker": "12.0.5", "@angular/service-worker": "12.0.5",
"@types/bootstrap": "^5.0.17",
"@types/jest": "26.0.23", "@types/jest": "26.0.23",
"@types/jquery": "^3.5.6",
"@types/node": "15.12.2", "@types/node": "15.12.2",
"@types/sockjs-client": "1.5.0", "@types/sockjs-client": "1.5.0",
"@typescript-eslint/eslint-plugin": "4.27.0", "@typescript-eslint/eslint-plugin": "4.27.0",

View File

@ -216,7 +216,7 @@
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal"> <button id="cancelBtn" type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal">
<fa-icon icon="arrow-left"></fa-icon>&nbsp;&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span> <fa-icon icon="arrow-left"></fa-icon>&nbsp;&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button> </button>
<button <button

View File

@ -1,48 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HttpHeaders, HttpResponse } from '@angular/common/http';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { of } from 'rxjs';
import { EncuestaService } from '../service/encuesta.service';
import { EncuestaComponent } from './encuesta.component';
describe('Component Tests', () => {
describe('Encuesta Management Component', () => {
let comp: EncuestaComponent;
let fixture: ComponentFixture<EncuestaComponent>;
let service: EncuestaService;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
declarations: [EncuestaComponent],
})
.overrideTemplate(EncuestaComponent, '')
.compileComponents();
fixture = TestBed.createComponent(EncuestaComponent);
comp = fixture.componentInstance;
service = TestBed.inject(EncuestaService);
const headers = new HttpHeaders().append('link', 'link;link');
jest.spyOn(service, 'query').mockReturnValue(
of(
new HttpResponse({
body: [{ id: 123 }],
headers,
})
)
);
});
it('Should call load all on init', () => {
// WHEN
comp.ngOnInit();
// THEN
expect(service.query).toHaveBeenCalled();
expect(comp.encuestas?.[0]).toEqual(expect.objectContaining({ id: 123 }));
});
});
});

View File

@ -21,7 +21,8 @@ import { UsuarioExtraService } from 'app/entities/usuario-extra/service/usuario-
import { EstadoEncuesta } from 'app/entities/enumerations/estado-encuesta.model'; import { EstadoEncuesta } from 'app/entities/enumerations/estado-encuesta.model';
import { AccountService } from 'app/core/auth/account.service'; import { AccountService } from 'app/core/auth/account.service';
import { Account } from 'app/core/auth/account.model'; import { Account } from 'app/core/auth/account.model';
import { $ } from 'dom7';
import * as $ from 'jquery';
@Component({ @Component({
selector: 'jhi-encuesta', selector: 'jhi-encuesta',
@ -140,7 +141,6 @@ export class EncuestaComponent implements OnInit {
save(): void { save(): void {
this.isSaving = true; this.isSaving = true;
const encuesta = this.createFromForm(); const encuesta = this.createFromForm();
console.log(encuesta);
if (encuesta.id !== undefined) { if (encuesta.id !== undefined) {
this.subscribeToSaveResponse(this.encuestaService.update(encuesta)); this.subscribeToSaveResponse(this.encuestaService.update(encuesta));
@ -166,7 +166,10 @@ export class EncuestaComponent implements OnInit {
protected onSaveSuccess(): void { protected onSaveSuccess(): void {
// this.previousState(); // this.previousState();
// $('#crearEncuesta').modal('hide') // ($('#crearEncuesta') as any).modal('hide');
this.encuestas = [];
this.loadAll();
$('#cancelBtn').click();
} }
protected onSaveError(): void { protected onSaveError(): void {

View File

@ -51,6 +51,9 @@ export class EncuestaUpdateComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.activatedRoute.data.subscribe(({ encuesta }) => { this.activatedRoute.data.subscribe(({ encuesta }) => {
console.log(this.activatedRoute.data);
console.log(encuesta);
if (encuesta.id === undefined) { if (encuesta.id === undefined) {
const today = dayjs().startOf('day'); const today = dayjs().startOf('day');
encuesta.fechaCreacion = today; encuesta.fechaCreacion = today;

File diff suppressed because it is too large Load Diff