-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
1,106 additions
and
135 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 80 additions & 1 deletion
81
src/app/administracion/avanzado/avanzado-formulario.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,80 @@ | ||
<p>avanzado-formulario works!</p> | ||
<div class="row"> | ||
<div class="col-lg-7"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<h4 class="card-title">Crear Agencia</h4> | ||
<form ngNativeValidate #formulario="ngForm" (ngSubmit)="crearCursoAvanzado(formulario)" | ||
class="form p-t-20"> | ||
<div class="form-group"> | ||
<label for="exampleInputuname">Titulo</label> | ||
<app-ngx-editor ngNativeValidate [config]="configuraciones" name="titulo" | ||
[(ngModel)]="avanzado.titulo" [placeholder]="'Ingrese el titulo aqui....'" | ||
[spellcheck]="true" required></app-ngx-editor> | ||
</div> | ||
<div class="form-group"> | ||
<label for="exampleInputuname">Direccion</label> | ||
<app-ngx-editor ngNativeValidate [config]="configuraciones" name="direccion" | ||
[(ngModel)]="avanzado.direccion" [placeholder]="'Ingrese la dirección aqui....'" | ||
[spellcheck]="true" required></app-ngx-editor> | ||
</div> | ||
<div class="form-group"> | ||
<label for="exampleInputuname">Fecha</label> | ||
<app-ngx-editor ngNativeValidate [config]="configuraciones" name="fecha" | ||
[(ngModel)]="avanzado.fecha" [placeholder]="'Ingrese la fecha aqui....'" | ||
[spellcheck]="true" required></app-ngx-editor> | ||
</div> | ||
<div class="form-group"> | ||
<label for="exampleInputuname">Descripción</label> | ||
<app-ngx-editor ngNativeValidate [config]="configuraciones" name="descripcion" | ||
[(ngModel)]="avanzado.descripcion" [placeholder]="'Ingrese la descripción aqui....'" | ||
[spellcheck]="true" required></app-ngx-editor> | ||
</div> | ||
<div class="form-group"> | ||
<label for="exampleInputuname">Requisitos</label> | ||
<app-ngx-editor ngNativeValidate [config]="configuraciones" name="requisitos" | ||
[(ngModel)]="avanzado.requisitos" [placeholder]="'Ingrese los requisitos aqui....'" | ||
[spellcheck]="true" required></app-ngx-editor> | ||
</div> | ||
<div class="form-group"> | ||
<label for="exampleInputuname">Proposito</label> | ||
<app-ngx-editor ngNativeValidate [config]="configuraciones" name="proposito" | ||
[(ngModel)]="avanzado.proposito" [placeholder]="'Ingrese el proposito aqui....'" | ||
[spellcheck]="true" required></app-ngx-editor> | ||
</div> | ||
<div class="form-group"> | ||
<label for="exampleInputuname">Metodología</label> | ||
<app-ngx-editor ngNativeValidate [config]="configuraciones" name="metodologia" [(ngModel)]="avanzado.metodologia" | ||
[placeholder]="'Ingrese la metodología aqui....'" [spellcheck]="true" required></app-ngx-editor> | ||
</div> | ||
<div class="form-group"> | ||
<label for="exampleInputuname">Valor</label> | ||
<app-ngx-editor ngNativeValidate [config]="configuraciones" name="valor" [(ngModel)]="avanzado.valor" | ||
[placeholder]="'Ingrese el valor aqui....'" [spellcheck]="true" required></app-ngx-editor> | ||
</div> | ||
<div class="form-group"> | ||
<label for="exampleInputuname">Incluye</label> | ||
<app-ngx-editor ngNativeValidate [config]="configuraciones" name="incluye" [(ngModel)]="avanzado.incluye" | ||
[placeholder]="'Ingrese lo que se incluye aqui....'" [spellcheck]="true" required></app-ngx-editor> | ||
</div> | ||
<button type="submit" class="btn btn-success waves-effect waves-light m-r-10"> | ||
<i class="fa fa-save"></i> | ||
Guardar</button> | ||
<a routerLink="/avanzado" class="btn btn-inverse waves-effect waves-light m-r-10"> | ||
<i class="fa fa-times"></i> | ||
Cancelar</a> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col-lg-5 col-md-5"> | ||
<div class="card"> | ||
<div class="card-body" align="center"> | ||
<h4 class="card-title">Imagen del curso avanzado</h4> | ||
<img *ngIf="!imagenTemporal" [src]="avanzado.imagen| imagen:'avanzados'" class="w150"> | ||
<img *ngIf="imagenTemporal" [src]="imagenTemporal" class="w150"> | ||
<input style="font-family: 'Times New Roman', Times, serif;" | ||
(change)="seleccionarImagen($event.target.files[0])" type="file" /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
66 changes: 65 additions & 1 deletion
66
src/app/administracion/avanzado/avanzado-formulario.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,79 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { CursoAvanzado } from '../../models/cursoAvanzado.model'; | ||
import { CursoAvanzadoService } from '../../services/service.index'; | ||
import Swal from 'sweetalert2'; | ||
import { NgForm } from '@angular/forms'; | ||
import { Router, ActivatedRoute } from '@angular/router'; | ||
import { configuracion } from '../../config/editor'; | ||
|
||
@Component({ | ||
selector: 'app-avanzado-formulario', | ||
templateUrl: './avanzado-formulario.component.html', | ||
styles: [] | ||
}) | ||
export class AvanzadoFormularioComponent implements OnInit { | ||
avanzado: CursoAvanzado = new CursoAvanzado(); | ||
imagenSubir: File; | ||
imagenTemporal: string | ArrayBuffer; | ||
configuraciones = configuracion; | ||
id: string; | ||
|
||
constructor() { } | ||
constructor( | ||
public avanzadoService: CursoAvanzadoService, | ||
public router: Router, | ||
public activatedRoute: ActivatedRoute | ||
) { | ||
activatedRoute.params.subscribe(params => { | ||
this.id = params.id; | ||
if (this.id !== 'nuevo') { | ||
this.buscarInformacion(this.id); | ||
} | ||
}); | ||
} | ||
|
||
ngOnInit() { | ||
} | ||
|
||
seleccionarImagen(archivo: File) { | ||
if (!archivo) { | ||
this.imagenSubir = null; | ||
return; | ||
} | ||
if (archivo.type.indexOf('image') < 0) { | ||
Swal.fire('Solo imagenes', 'El archivo seleccionado no es una imagen', 'error'); | ||
this.imagenSubir = null; | ||
return; | ||
} | ||
this.imagenSubir = archivo; | ||
const reader = new FileReader(); | ||
const urlImagenTemp = reader.readAsDataURL(archivo); | ||
reader.onloadend = () => this.imagenTemporal = reader.result; | ||
} | ||
|
||
crearCursoAvanzado(formulario: NgForm) { | ||
if (formulario.invalid) { | ||
return; | ||
} | ||
const programacion = this.avanzado.programacion; | ||
this.avanzado = formulario.value; | ||
this.avanzado._id = this.id; | ||
this.avanzado.programacion = programacion; | ||
const formData = new FormData(); | ||
if (this.imagenSubir) { | ||
formData.append('imagen', this.imagenSubir, this.imagenSubir.name); | ||
} | ||
this.avanzadoService.crearCursosAvanzados(formData, this.avanzado) | ||
.subscribe(() => { | ||
this.router.navigate(['/avanzado']); | ||
} | ||
); | ||
} | ||
|
||
buscarInformacion(id) { | ||
this.avanzadoService.buscarCursoAvanzadoId(id) | ||
.subscribe((avanzado) => { | ||
this.avanzado = avanzado; | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/app/administracion/estilo-celda-agrid/estilo-celda-agrid.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div [innerHTML]="cellValue | domSeguro"></div> |
25 changes: 25 additions & 0 deletions
25
src/app/administracion/estilo-celda-agrid/estilo-celda-agrid.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ICellRendererAngularComp } from 'ag-grid-angular'; | ||
|
||
@Component({ | ||
selector: 'app-estilo-celda-agrid', | ||
templateUrl: './estilo-celda-agrid.component.html', | ||
styles: [] | ||
}) | ||
export class EstiloCeldaAgridComponent implements OnInit, ICellRendererAngularComp { | ||
public cellValue: any; | ||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
agInit(params: any) { | ||
this.cellValue = params.value; | ||
} | ||
|
||
refresh(params: any): boolean { | ||
this.cellValue = params.value; | ||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.