agregar comparacion inicial de fecha final
para evitar que se publique una encuesta con una fecha de finalización que sea anterior a la fecha actual
This commit is contained in:
		
							parent
							
								
									d920ab39dc
								
							
						
					
					
						commit
						79dc958873
					
				| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<form *ngIf="encuesta" name="deleteForm" (ngSubmit)="confirmPublish(encuesta)">
 | 
			
		||||
<form *ngIf="encuesta" name="deleteForm" (ngSubmit)="confirmPublish(encuesta!)">
 | 
			
		||||
  <div class="modal-header">
 | 
			
		||||
    <!-- <h4 class="modal-title" data-cy="encuestaDeleteDialogHeading" jhiTranslate="entity.publish.title">Confirm delete operation</h4>-->
 | 
			
		||||
  </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -6,7 +6,8 @@
 | 
			
		|||
  <div class="modal-body">
 | 
			
		||||
    <jhi-alert-error></jhi-alert-error>
 | 
			
		||||
 | 
			
		||||
    <p id="jhi-delete-encuesta-heading" jhiTranslate="entity.publish.detail">Are you sure you want to delete this Encuesta?</p>
 | 
			
		||||
    <p id="jhi-delete-encuesta-heading" jhiTranslate="entity.publish.detail">Are you sure you want to publish this survey?</p>
 | 
			
		||||
    <input type="date" onchange="fechaFinalizarIsInvalid()" />
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div class="modal-footer">
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +15,13 @@
 | 
			
		|||
      <fa-icon icon="ban"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
 | 
			
		||||
    </button>
 | 
			
		||||
 | 
			
		||||
    <button id="jhi-confirm-delete-encuesta" data-cy="entityConfirmDeleteButton" type="submit" class="ds-btn ds-btn--primary">
 | 
			
		||||
    <button
 | 
			
		||||
      disabled="fechaFinalizarInvalid"
 | 
			
		||||
      id="jhi-confirm-delete-encuesta"
 | 
			
		||||
      data-cy="entityConfirmDeleteButton"
 | 
			
		||||
      type="submit"
 | 
			
		||||
      class="ds-btn ds-btn--primary"
 | 
			
		||||
    >
 | 
			
		||||
       <span jhiTranslate="entity.action.publish">Delete</span>
 | 
			
		||||
    </button>
 | 
			
		||||
  </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,6 +13,8 @@ import { passwordResetFinishRoute } from '../../../account/password-reset/finish
 | 
			
		|||
})
 | 
			
		||||
export class EncuestaPublishDialogComponent implements OnInit {
 | 
			
		||||
  encuesta?: IEncuesta;
 | 
			
		||||
  fechaFinalizar?: Date;
 | 
			
		||||
  fechaFinalizarInvalid?: boolean;
 | 
			
		||||
 | 
			
		||||
  constructor(protected encuestaService: EncuestaService, protected activeModal: NgbActiveModal) {}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -35,6 +37,12 @@ export class EncuestaPublishDialogComponent implements OnInit {
 | 
			
		|||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  fechaFinalizarIsInvalid(): void {
 | 
			
		||||
    const now = new Date();
 | 
			
		||||
    debugger;
 | 
			
		||||
    this.fechaFinalizarInvalid = now < this.fechaFinalizar!;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  generatePassword(): string {
 | 
			
		||||
    debugger;
 | 
			
		||||
    const alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
 | 
			
		||||
| 
						 | 
				
			
			@ -46,5 +54,8 @@ export class EncuestaPublishDialogComponent implements OnInit {
 | 
			
		|||
    return password;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngOnInit(): void {}
 | 
			
		||||
  ngOnInit(): void {
 | 
			
		||||
    this.fechaFinalizar = new Date();
 | 
			
		||||
    this.fechaFinalizarInvalid = false;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue