Merge pull request #31 from Quantum-P3/feature/US-19

Add crear encuestas
This commit is contained in:
Eduardo Quiros 2021-07-14 01:17:35 +00:00 committed by GitHub
commit 2ec4f95ee3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 12798 additions and 1116 deletions

View File

@ -45,7 +45,15 @@
],
"styles": ["src/main/webapp/content/scss/paper-dashboard.scss", "./node_modules/swiper/swiper-bundle.min.css"],
"scripts": [
"src/main/webapp/content/js/bootstrap.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.datatables.js",
"src/main/webapp/content/js/jquery.easypiechart.min.js",
"src/main/webapp/content/js/jquery.validate.min.js",
"src/main/webapp/content/js/jquery-jvectormap.js",
"src/main/webapp/content/js/jquery-ui.min.js",
"src/main/webapp/content/js/bootstrap.bundle.min.js",
"src/main/webapp/content/js/moment.min.js",
"src/main/webapp/content/js/bootstrap-datetimepicker.js",
"src/main/webapp/content/js/bootstrap-notify.js",
"src/main/webapp/content/js/bootstrap-selectpicker.js",
@ -54,19 +62,11 @@
"src/main/webapp/content/js/chartist.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/jquery.bootstrap.wizard.min.js",
"src/main/webapp/content/js/jquery.datatables.js",
"src/main/webapp/content/js/jquery.easypiechart.min.js",
"src/main/webapp/content/js/jquery.validate.min.js",
"src/main/webapp/content/js/jquery-3.1.1.min.js",
"src/main/webapp/content/js/jquery-jvectormap.js",
"src/main/webapp/content/js/jquery-ui.min.js",
"src/main/webapp/content/js/moment.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/sweetalert2.js",
"./node_modules/swiper/swiper-bundle.min.js",
"src/main/webapp/content/js/paper-dashboard.js",
"src/main/webapp/content/js/api-google-platform.js"
]
},

79
package-lock.json generated
View File

@ -27,6 +27,7 @@
"angularx-social-login": "^4.0.1",
"bootstrap": "4.6.0",
"dayjs": "1.10.5",
"jquery": "^3.6.0",
"ngx-infinite-scroll": "10.0.1",
"ngx-webstorage": "8.0.0",
"rxjs": "6.6.7",
@ -44,7 +45,9 @@
"@angular/cli": "12.0.4",
"@angular/compiler-cli": "12.0.5",
"@angular/service-worker": "12.0.5",
"@types/bootstrap": "^5.0.17",
"@types/jest": "26.0.23",
"@types/jquery": "^3.5.6",
"@types/node": "15.12.2",
"@types/sockjs-client": "1.5.0",
"@typescript-eslint/eslint-plugin": "4.27.0",
@ -3983,6 +3986,16 @@
"integrity": "sha512-15spi3V28QdevleWBNXE4pIls3nFZmBbUGrW9IVPwiQczuSb9n76TCB4bsk8TSel+I1OkHEdPhu5QKMfY6rQHA==",
"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": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@scarf/scarf/-/scarf-1.1.1.tgz",
@ -4179,6 +4192,16 @@
"@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": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-1.6.0.tgz",
@ -4295,6 +4318,15 @@
"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": {
"version": "7.0.7",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz",
@ -4343,6 +4375,12 @@
"integrity": "sha512-0/HnwIfW4ki2D8L8c9GVcG5I72s9jP5GSLVF0VIXDW00kmIpA6O33G7a8n59Tmh7Nz0WUC3rSb7PTY/sdW2JzA==",
"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": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@types/sockjs-client/-/sockjs-client-1.5.0.tgz",
@ -15491,6 +15529,11 @@
"@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": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@ -30128,6 +30171,12 @@
"integrity": "sha512-15spi3V28QdevleWBNXE4pIls3nFZmBbUGrW9IVPwiQczuSb9n76TCB4bsk8TSel+I1OkHEdPhu5QKMfY6rQHA==",
"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": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@scarf/scarf/-/scarf-1.1.1.tgz",
@ -30297,6 +30346,16 @@
"@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": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-1.6.0.tgz",
@ -30413,6 +30472,15 @@
"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": {
"version": "7.0.7",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz",
@ -30461,6 +30529,12 @@
"integrity": "sha512-0/HnwIfW4ki2D8L8c9GVcG5I72s9jP5GSLVF0VIXDW00kmIpA6O33G7a8n59Tmh7Nz0WUC3rSb7PTY/sdW2JzA==",
"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": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@types/sockjs-client/-/sockjs-client-1.5.0.tgz",
@ -39054,6 +39128,11 @@
"@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": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",

View File

@ -84,6 +84,7 @@
"angularx-social-login": "^4.0.1",
"bootstrap": "4.6.0",
"dayjs": "1.10.5",
"jquery": "^3.6.0",
"ngx-infinite-scroll": "10.0.1",
"ngx-webstorage": "8.0.0",
"rxjs": "6.6.7",
@ -101,7 +102,9 @@
"@angular/cli": "12.0.4",
"@angular/compiler-cli": "12.0.5",
"@angular/service-worker": "12.0.5",
"@types/bootstrap": "^5.0.17",
"@types/jest": "26.0.23",
"@types/jquery": "^3.5.6",
"@types/node": "15.12.2",
"@types/sockjs-client": "1.5.0",
"@typescript-eslint/eslint-plugin": "4.27.0",

View File

@ -256,7 +256,7 @@
[disabled]="editForm.invalid || isSaving"
class="ds-btn ds-btn--primary"
>
&nbsp;<span jhiTranslate="entity.action.save">Save</span>
<span jhiTranslate="entity.action.save">Save</span>
</button>
</div>
</form>
@ -387,7 +387,7 @@
[disabled]="passwordForm.invalid || isSaving"
class="ds-btn ds-btn--primary"
>
<fa-icon icon="save"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
<span jhiTranslate="entity.action.save">Save</span>
</button>
</div>
</form>

View File

@ -106,3 +106,403 @@
</table>
</div>
</div>
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Button trigger modal -->
<button type="button" class="ds-btn ds-btn--primary" (click)="resetForm()" data-toggle="modal" data-target="#crearEncuesta">
Crear encuesta
</button>
<!-- Modal -->
<div
class="modal fade ds-modal"
id="crearEncuesta"
tabindex="-1"
role="dialog"
aria-labelledby="exampleModalCenterTitle"
aria-hidden="true"
>
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form autocomplete="off" class="ds-form" name="editForm" role="form" novalidate (ngSubmit)="save()" [formGroup]="editForm">
<div class="modal-header">
<h1 class="modal-title" id="exampleModalLongTitle">Crear Encuesta</h1>
</div>
<div class="modal-body">
<!-- Survey Registration Modal -->
<div>
<jhi-alert-error></jhi-alert-error>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.nombre" for="field_nombre">Nombre</label>
<input type="text" class="form-control" name="nombre" id="field_nombre" data-cy="nombre" formControlName="nombre" />
<div *ngIf="editForm.get('nombre')!.invalid && (editForm.get('nombre')!.dirty || editForm.get('nombre')!.touched)">
<small
class="form-text text-danger"
*ngIf="editForm.get('nombre')?.errors?.required"
jhiTranslate="entity.validation.required"
>
This field is required.
</small>
<small
class="form-text text-danger"
*ngIf="editForm.get('nombre')?.errors?.minlength"
jhiTranslate="entity.validation.minlength"
[translateValues]="{ min: 1 }"
>
This field is required to be at least 1 characters.
</small>
<small
class="form-text text-danger"
*ngIf="editForm.get('nombre')?.errors?.maxlength"
jhiTranslate="entity.validation.maxlength"
[translateValues]="{ max: 50 }"
>
This field cannot be longer than 50 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.descripcion" for="field_descripcion"
>Descripcion</label
>
<input
type="text"
class="form-control"
name="descripcion"
id="field_descripcion"
data-cy="descripcion"
formControlName="descripcion"
/>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.acceso" for="field_acceso">Acceso</label>
<select class="form-control" name="acceso" formControlName="acceso" id="field_acceso" data-cy="acceso">
<option [ngValue]="null">{{ 'dataSurveyApp.AccesoEncuesta.null' | translate }}</option>
<option value="PUBLIC">{{ 'dataSurveyApp.AccesoEncuesta.PUBLIC' | translate }}</option>
<option value="PRIVATE">{{ 'dataSurveyApp.AccesoEncuesta.PRIVATE' | translate }}</option>
</select>
<div *ngIf="editForm.get('acceso')!.invalid && (editForm.get('acceso')!.dirty || editForm.get('acceso')!.touched)">
<small
class="form-text text-danger"
*ngIf="editForm.get('acceso')?.errors?.required"
jhiTranslate="entity.validation.required"
>
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.categoria" for="field_categoria">Categoría</label>
<select class="form-control" id="field_categoria" data-cy="categoria" name="categoria" formControlName="categoria">
<option [ngValue]="null" selected></option>
<option
[ngValue]="
categoriaOption.id === editForm.get('categoria')!.value?.id ? editForm.get('categoria')!.value : categoriaOption
"
*ngFor="let categoriaOption of categoriasSharedCollection; trackBy: trackCategoriaById"
>
{{ categoriaOption.nombre }}
</option>
</select>
<div *ngIf="editForm.get('categoria')!.invalid && (editForm.get('categoria')!.dirty || editForm.get('categoria')!.touched)">
<small
class="form-text text-danger"
*ngIf="editForm.get('categoria')?.errors?.required"
jhiTranslate="entity.validation.required"
>
This field is required.
</small>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<input id="createAnother" type="checkbox" (change)="createAnotherChange($event)" />
<label for="createAnother">Crear otra</label>
<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>
</button>
<button
type="submit"
id="save-entity"
data-cy="entityCreateSaveButton"
class="ds-btn ds-btn--primary"
[disabled]="editForm.invalid || isSaving"
>
<span jhiTranslate="entity.action.create">Create</span>
</button>
</div>
</form>
</div>
</div>
</div>
<!-- ------------------------------------------------------------------------------------------------- -->
<!-- <div class="row justify-content-center">
<div class="col-8">
<form name="editForm" role="form" novalidate (ngSubmit)="save()" [formGroup]="editForm">
<h2 id="jhi-encuesta-heading" data-cy="EncuestaCreateUpdateHeading" jhiTranslate="dataSurveyApp.encuesta.home.createOrEditLabel">
Create or edit a Encuesta
</h2>
<div>
<jhi-alert-error></jhi-alert-error>
<div class="form-group" [hidden]="editForm.get('id')!.value == null">
<label class="form-control-label" jhiTranslate="global.field.id" for="field_id">ID</label>
<input type="number" class="form-control" name="id" id="field_id" data-cy="id" formControlName="id" [readonly]="true" />
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.nombre" for="field_nombre">Nombre</label>
<input type="text" class="form-control" name="nombre" id="field_nombre" data-cy="nombre" formControlName="nombre" />
<div *ngIf="editForm.get('nombre')!.invalid && (editForm.get('nombre')!.dirty || editForm.get('nombre')!.touched)">
<small class="form-text text-danger" *ngIf="editForm.get('nombre')?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
<small
class="form-text text-danger"
*ngIf="editForm.get('nombre')?.errors?.minlength"
jhiTranslate="entity.validation.minlength"
[translateValues]="{ min: 1 }"
>
This field is required to be at least 1 characters.
</small>
<small
class="form-text text-danger"
*ngIf="editForm.get('nombre')?.errors?.maxlength"
jhiTranslate="entity.validation.maxlength"
[translateValues]="{ max: 50 }"
>
This field cannot be longer than 50 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.descripcion" for="field_descripcion">Descripcion</label>
<input
type="text"
class="form-control"
name="descripcion"
id="field_descripcion"
data-cy="descripcion"
formControlName="descripcion"
/>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.fechaCreacion" for="field_fechaCreacion"
>Fecha Creacion</label
>
<div class="d-flex">
<input
id="field_fechaCreacion"
data-cy="fechaCreacion"
type="datetime-local"
class="form-control"
name="fechaCreacion"
formControlName="fechaCreacion"
placeholder="YYYY-MM-DD HH:mm"
/>
</div>
<div
*ngIf="
editForm.get('fechaCreacion')!.invalid && (editForm.get('fechaCreacion')!.dirty || editForm.get('fechaCreacion')!.touched)
"
>
<small
class="form-text text-danger"
*ngIf="editForm.get('fechaCreacion')?.errors?.required"
jhiTranslate="entity.validation.required"
>
This field is required.
</small>
<small
class="form-text text-danger"
[hidden]="!editForm.get('fechaCreacion')?.errors?.ZonedDateTimelocal"
jhiTranslate="entity.validation.ZonedDateTimelocal"
>
This field should be a date and time.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.fechaPublicacion" for="field_fechaPublicacion"
>Fecha Publicacion</label
>
<div class="d-flex">
<input
id="field_fechaPublicacion"
data-cy="fechaPublicacion"
type="datetime-local"
class="form-control"
name="fechaPublicacion"
formControlName="fechaPublicacion"
placeholder="YYYY-MM-DD HH:mm"
/>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.fechaFinalizar" for="field_fechaFinalizar"
>Fecha Finalizar</label
>
<div class="d-flex">
<input
id="field_fechaFinalizar"
data-cy="fechaFinalizar"
type="datetime-local"
class="form-control"
name="fechaFinalizar"
formControlName="fechaFinalizar"
placeholder="YYYY-MM-DD HH:mm"
/>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.fechaFinalizada" for="field_fechaFinalizada"
>Fecha Finalizada</label
>
<div class="d-flex">
<input
id="field_fechaFinalizada"
data-cy="fechaFinalizada"
type="datetime-local"
class="form-control"
name="fechaFinalizada"
formControlName="fechaFinalizada"
placeholder="YYYY-MM-DD HH:mm"
/>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.calificacion" for="field_calificacion">Calificacion</label>
<input
type="number"
class="form-control"
name="calificacion"
id="field_calificacion"
data-cy="calificacion"
formControlName="calificacion"
/>
<div
*ngIf="editForm.get('calificacion')!.invalid && (editForm.get('calificacion')!.dirty || editForm.get('calificacion')!.touched)"
>
<small
class="form-text text-danger"
*ngIf="editForm.get('calificacion')?.errors?.required"
jhiTranslate="entity.validation.required"
>
This field is required.
</small>
<small
class="form-text text-danger"
[hidden]="!editForm.get('calificacion')?.errors?.number"
jhiTranslate="entity.validation.number"
>
This field should be a number.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.acceso" for="field_acceso">Acceso</label>
<select class="form-control" name="acceso" formControlName="acceso" id="field_acceso" data-cy="acceso">
<option [ngValue]="null">{{ 'dataSurveyApp.AccesoEncuesta.null' | translate }}</option>
<option value="PUBLIC">{{ 'dataSurveyApp.AccesoEncuesta.PUBLIC' | translate }}</option>
<option value="PRIVATE">{{ 'dataSurveyApp.AccesoEncuesta.PRIVATE' | translate }}</option>
</select>
<div *ngIf="editForm.get('acceso')!.invalid && (editForm.get('acceso')!.dirty || editForm.get('acceso')!.touched)">
<small class="form-text text-danger" *ngIf="editForm.get('acceso')?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.contrasenna" for="field_contrasenna">Contrasenna</label>
<input
type="text"
class="form-control"
name="contrasenna"
id="field_contrasenna"
data-cy="contrasenna"
formControlName="contrasenna"
/>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.estado" for="field_estado">Estado</label>
<select class="form-control" name="estado" formControlName="estado" id="field_estado" data-cy="estado">
<option [ngValue]="null">{{ 'dataSurveyApp.EstadoEncuesta.null' | translate }}</option>
<option value="DRAFT">{{ 'dataSurveyApp.EstadoEncuesta.DRAFT' | translate }}</option>
<option value="ACTIVE">{{ 'dataSurveyApp.EstadoEncuesta.ACTIVE' | translate }}</option>
<option value="FINISHED">{{ 'dataSurveyApp.EstadoEncuesta.FINISHED' | translate }}</option>
<option value="DELETED">{{ 'dataSurveyApp.EstadoEncuesta.DELETED' | translate }}</option>
</select>
<div *ngIf="editForm.get('estado')!.invalid && (editForm.get('estado')!.dirty || editForm.get('estado')!.touched)">
<small class="form-text text-danger" *ngIf="editForm.get('estado')?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.categoria" for="field_categoria">Categoria</label>
<select class="form-control" id="field_categoria" data-cy="categoria" name="categoria" formControlName="categoria">
<option [ngValue]="null"></option>
<option
[ngValue]="categoriaOption.id === editForm.get('categoria')!.value?.id ? editForm.get('categoria')!.value : categoriaOption"
*ngFor="let categoriaOption of categoriasSharedCollection; trackBy: trackCategoriaById"
>
{{ categoriaOption.nombre }}
</option>
</select>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.usuarioExtra" for="field_usuarioExtra"
>Usuario Extra</label
>
<select class="form-control" id="field_usuarioExtra" data-cy="usuarioExtra" name="usuarioExtra" formControlName="usuarioExtra">
<option [ngValue]="null"></option>
<option
[ngValue]="
usuarioExtraOption.id === editForm.get('usuarioExtra')!.value?.id ? editForm.get('usuarioExtra')!.value : usuarioExtraOption
"
*ngFor="let usuarioExtraOption of usuarioExtrasSharedCollection; trackBy: trackUsuarioExtraById"
>
{{ usuarioExtraOption.id }}
</option>
</select>
</div>
</div>
<div>
<button type="button" id="cancel-save" data-cy="entityCreateCancelButton" class="btn btn-secondary" (click)="previousState()">
<fa-icon icon="ban"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button
type="submit"
id="save-entity"
data-cy="entityCreateSaveButton"
[disabled]="editForm.invalid || isSaving"
class="btn btn-primary"
>
<fa-icon icon="save"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
</button>
</div>
</form>
</div>
</div> -->

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

@ -2,19 +2,75 @@ import { Component, OnInit } from '@angular/core';
import { HttpResponse } from '@angular/common/http';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { IEncuesta } from '../encuesta.model';
import { IEncuesta, Encuesta } from '../encuesta.model';
import { EncuestaService } from '../service/encuesta.service';
import { EncuestaDeleteDialogComponent } from '../delete/encuesta-delete-dialog.component';
import { FormBuilder, Validators } from '@angular/forms';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs';
import { finalize, map } from 'rxjs/operators';
import * as dayjs from 'dayjs';
import { DATE_TIME_FORMAT } from 'app/config/input.constants';
import { ICategoria } from 'app/entities/categoria/categoria.model';
import { CategoriaService } from 'app/entities/categoria/service/categoria.service';
import { IUsuarioExtra, UsuarioExtra } from 'app/entities/usuario-extra/usuario-extra.model';
import { UsuarioExtraService } from 'app/entities/usuario-extra/service/usuario-extra.service';
import { EstadoEncuesta } from 'app/entities/enumerations/estado-encuesta.model';
import { AccountService } from 'app/core/auth/account.service';
import { Account } from 'app/core/auth/account.model';
import * as $ from 'jquery';
@Component({
selector: 'jhi-encuesta',
templateUrl: './encuesta.component.html',
})
export class EncuestaComponent implements OnInit {
account: Account | null = null;
usuarioExtra: UsuarioExtra | null = null;
encuestas?: IEncuesta[];
isLoading = false;
constructor(protected encuestaService: EncuestaService, protected modalService: NgbModal) {}
isSaving = false;
categoriasSharedCollection: ICategoria[] = [];
usuarioExtrasSharedCollection: IUsuarioExtra[] = [];
editForm = this.fb.group({
id: [],
nombre: [null, [Validators.required, Validators.minLength(1), Validators.maxLength(50)]],
descripcion: [],
// fechaCreacion: [null, [Validators.required]],
// fechaPublicacion: [],
// fechaFinalizar: [],
// fechaFinalizada: [],
// calificacion: [null, [Validators.required]],
acceso: [null, [Validators.required]],
// contrasenna: [],
// estado: [null, [Validators.required]],
categoria: [null, [Validators.required]],
// usuarioExtra: [],
});
createAnother: Boolean = false;
constructor(
protected encuestaService: EncuestaService,
protected modalService: NgbModal,
protected categoriaService: CategoriaService,
protected usuarioExtraService: UsuarioExtraService,
protected activatedRoute: ActivatedRoute,
protected fb: FormBuilder,
protected accountService: AccountService
) {}
resetForm(): void {
this.editForm.reset();
}
loadAll(): void {
this.isLoading = true;
@ -32,6 +88,41 @@ export class EncuestaComponent implements OnInit {
ngOnInit(): void {
this.loadAll();
// Call upon selecting a survey to edit
// this.updateForm(encuesta);
this.loadRelationshipsOptions();
// this.activatedRoute.data.subscribe(({ encuesta }) => {
// if (encuesta.id === undefined) {
// const today = dayjs().startOf('day');
// encuesta.fechaCreacion = today;
// encuesta.fechaPublicacion = today;
// encuesta.fechaFinalizar = today;
// encuesta.fechaFinalizada = today;
// }
// this.updateForm(encuesta);
// });
// Get jhi_user and usuario_extra information
this.accountService.getAuthenticationState().subscribe(account => {
if (account !== null) {
this.usuarioExtraService.find(account.id).subscribe(usuarioExtra => {
this.usuarioExtra = usuarioExtra.body;
if (this.usuarioExtra !== null) {
if (this.usuarioExtra.id === undefined) {
const today = dayjs().startOf('day');
this.usuarioExtra.fechaNacimiento = today;
}
}
// this.loadRelationshipsOptions();
});
}
});
}
trackId(index: number, item: IEncuesta): number {
@ -48,4 +139,124 @@ export class EncuestaComponent implements OnInit {
}
});
}
previousState(): void {
window.history.back();
}
save(): void {
this.isSaving = true;
const encuesta = this.createFromForm();
if (encuesta.id !== undefined) {
this.subscribeToSaveResponse(this.encuestaService.update(encuesta));
} else {
this.subscribeToSaveResponse(this.encuestaService.create(encuesta));
}
}
trackCategoriaById(index: number, item: ICategoria): number {
return item.id!;
}
trackUsuarioExtraById(index: number, item: IUsuarioExtra): number {
return item.id!;
}
protected subscribeToSaveResponse(result: Observable<HttpResponse<IEncuesta>>): void {
result.pipe(finalize(() => this.onSaveFinalize())).subscribe(
() => this.onSaveSuccess(),
() => this.onSaveError()
);
}
createAnotherChange(event: any) {
this.createAnother = event.target.checked;
}
protected onSaveSuccess(): void {
// this.previousState();
// ($('#crearEncuesta') as any).modal('hide');
this.resetForm();
this.encuestas = [];
this.loadAll();
if (!this.createAnother) {
$('#cancelBtn').click();
}
}
protected onSaveError(): void {
// Api for inheritance.
}
protected onSaveFinalize(): void {
this.isSaving = false;
}
protected updateForm(encuesta: IEncuesta): void {
this.editForm.patchValue({
id: encuesta.id,
nombre: encuesta.nombre,
descripcion: encuesta.descripcion,
fechaCreacion: encuesta.fechaCreacion ? encuesta.fechaCreacion.format(DATE_TIME_FORMAT) : null,
fechaPublicacion: encuesta.fechaPublicacion ? encuesta.fechaPublicacion.format(DATE_TIME_FORMAT) : null,
fechaFinalizar: encuesta.fechaFinalizar ? encuesta.fechaFinalizar.format(DATE_TIME_FORMAT) : null,
fechaFinalizada: encuesta.fechaFinalizada ? encuesta.fechaFinalizada.format(DATE_TIME_FORMAT) : null,
calificacion: encuesta.calificacion,
acceso: encuesta.acceso,
contrasenna: encuesta.contrasenna,
estado: encuesta.estado,
categoria: encuesta.categoria,
usuarioExtra: encuesta.usuarioExtra,
});
this.categoriasSharedCollection = this.categoriaService.addCategoriaToCollectionIfMissing(
this.categoriasSharedCollection,
encuesta.categoria
);
this.usuarioExtrasSharedCollection = this.usuarioExtraService.addUsuarioExtraToCollectionIfMissing(
this.usuarioExtrasSharedCollection,
encuesta.usuarioExtra
);
}
protected loadRelationshipsOptions(): void {
this.categoriaService
.query()
.pipe(map((res: HttpResponse<ICategoria[]>) => res.body ?? []))
.pipe(
map((categorias: ICategoria[]) =>
this.categoriaService.addCategoriaToCollectionIfMissing(categorias, this.editForm.get('categoria')!.value)
)
)
.subscribe((categorias: ICategoria[]) => (this.categoriasSharedCollection = categorias));
this.usuarioExtraService
.query()
.pipe(map((res: HttpResponse<IUsuarioExtra[]>) => res.body ?? []))
.pipe(
map((usuarioExtras: IUsuarioExtra[]) =>
this.usuarioExtraService.addUsuarioExtraToCollectionIfMissing(usuarioExtras, this.editForm.get('usuarioExtra')!.value)
)
)
.subscribe((usuarioExtras: IUsuarioExtra[]) => (this.usuarioExtrasSharedCollection = usuarioExtras));
}
protected createFromForm(): IEncuesta {
const now = dayjs();
return {
...new Encuesta(),
id: undefined,
nombre: this.editForm.get(['nombre'])!.value,
descripcion: this.editForm.get(['descripcion'])!.value,
fechaCreacion: dayjs(now, DATE_TIME_FORMAT),
calificacion: 5,
acceso: this.editForm.get(['acceso'])!.value,
contrasenna: undefined,
estado: EstadoEncuesta.DRAFT,
categoria: this.editForm.get(['categoria'])!.value,
usuarioExtra: this.usuarioExtra,
};
}
}

View File

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

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 491.996 491.996" style="enable-background:new 0 0 491.996 491.996; fill: #b4b6b8;" xml:space="preserve">
<g>
<g>
<path d="M484.132,124.986l-16.116-16.228c-5.072-5.068-11.82-7.86-19.032-7.86c-7.208,0-13.964,2.792-19.036,7.86l-183.84,183.848
L62.056,108.554c-5.064-5.068-11.82-7.856-19.028-7.856s-13.968,2.788-19.036,7.856l-16.12,16.128
c-10.496,10.488-10.496,27.572,0,38.06l219.136,219.924c5.064,5.064,11.812,8.632,19.084,8.632h0.084
c7.212,0,13.96-3.572,19.024-8.632l218.932-219.328c5.072-5.064,7.856-12.016,7.864-19.224
C491.996,136.902,489.204,130.046,484.132,124.986z"/>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -94,3 +94,4 @@
@import 'paper-dashboard/datasurvey-buttons';
@import 'paper-dashboard/datasurvey-form';
@import 'paper-dashboard/datasurvey-global';
@import 'paper-dashboard/datasurvey-modal';

View File

@ -22,6 +22,14 @@
top: -3px;
box-shadow: rgba(80, 80, 80, 0.15) 0px 5px 15px;
}
&:disabled,
&[disabled],
&.disabled {
background-color: #f7f9ff;
pointer-events: none;
color: #171820;
}
}
.ds-btn--primary {

View File

@ -8,30 +8,32 @@ $form-background: #f1f5f9;
.form-group:focus-within {
label,
input {
color: #313747;
input,
select {
color: #313747 !important;
}
}
input,
input:-webkit-autofill {
input:-webkit-autofill,
select {
background-color: $form-background;
border-radius: 15px;
border: 1.75px solid transparent;
outline: 0;
padding: 1rem !important;
color: #757d94;
color: #757d94 !important;
&:focus,
&:active {
background-color: $form-background;
border: 1.75px solid #2962ff;
// color: #313747;
}
&:read-only {
background-color: $form-background;
background-color: #eaebee;
cursor: default;
color: #9aa2b8;
&:focus,
&:active {
@ -41,6 +43,37 @@ $form-background: #f1f5f9;
}
}
select {
background-color: $form-background !important;
appearance: none;
cursor: pointer !important;
border: none;
outline: 0;
background: url(./../../img_datasurvey/down-arrow.svg) no-repeat right;
background-size: 3.5%;
-webkit-appearance: none;
background-position-x: 94%;
&:focus,
&:active {
background-color: $form-background !important;
border: 1.75px solid #2962ff !important;
}
option {
background-color: #fff !important;
color: #313747 !important;
padding: 1rem !important;
&:hover,
&:focus,
&:active {
background-color: #efefef !important;
}
}
}
label {
color: #757d94;
}

View File

@ -1,3 +1,8 @@
*::selection {
background-color: #2962ffb2;
color: #fff;
}
.ds-title {
color: #313747;
font-weight: 900;

View File

@ -0,0 +1,36 @@
.ds-modal {
padding: 0 !important;
h1 {
text-align: left;
color: #313747;
font-weight: 900;
letter-spacing: 0.025rem;
font-size: 1.2rem;
}
.modal-header,
.modal-footer {
border: none;
padding: 2rem;
}
.modal-body {
padding: 0 2rem;
}
.modal-content {
border-radius: 3px;
border: none;
box-shadow: none;
}
}
.modal-backdrop {
background-color: #172b4d;
opacity: 0.5;
}
.modal-dialog {
padding: 0;
}

View File

@ -119,7 +119,8 @@
"edit": "Editar",
"open": "Abrir",
"save": "Guardar",
"view": "Vista"
"view": "Vista",
"create": "Crear"
},
"detail": {
"field": "Campo",