cambios finales de cierre

parent 65f34774
export class seguim {
uzytavseguim_id?: number;
uzytavproyec_id?: number;
uzytavseguim_descrip?: string;
uzytavobjetivo_programa_id?: number;
uzytavseguim_fecha_logro?: Date;
uzytavseguim_logro?: string;
}
......@@ -210,6 +210,16 @@ import { ListarActaConsejoDepartamentoComponent } from './pages/Proyectos/Acta d
import { PdfComponent } from './pages/Proyectos/pdf/pdf.component';
import { ListObjetivosEjecComponent } from './pages/Proyectos/Cierre/objetivos ejecutados/list-objetivos-ejec/list-objetivos-ejec.component';
import { EditObjetivosEjecComponent } from './pages/Proyectos/Cierre/objetivos ejecutados/edit-objetivos-ejec/edit-objetivos-ejec.component';
import { ListInformeComponent } from './pages/Proyectos/Ejecución/informes de avance/list-informe/list-informe.component';
import { EditInformeComponent } from './pages/Proyectos/Ejecución/informes de avance/edit-informe/edit-informe.component';
import { ListEntidadComponent } from './pages/Proyectos/Presupuesto Detallado/list-entidad/list-entidad.component';
import { ListComunidadComponent } from './pages/Proyectos/Presupuesto Detallado/list-comunidad/list-comunidad.component';
import { AporteComEjecComponent } from './pages/Proyectos/Cierre/presupuesto ejecutado/aporte-com-ejec/aporte-com-ejec.component';
import { AporteEntEjecComponent } from './pages/Proyectos/Cierre/presupuesto ejecutado/aporte-ent-ejec/aporte-ent-ejec.component';
import { AporteUniEjecComponent } from './pages/Proyectos/Cierre/presupuesto ejecutado/aporte-uni-ejec/aporte-uni-ejec.component';
import { ErrorTextoComponent } from './pages/Proyectos/errores/error-texto/error-texto.component';
import { seguim } from './Models/hito';
import { ComisionAsigComponent } from './pages/asignar comision/comision-asig/comision-asig.component';
@NgModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [
......@@ -373,6 +383,15 @@ import { EditObjetivosEjecComponent } from './pages/Proyectos/Cierre/objetivos e
PdfComponent,
ListObjetivosEjecComponent,
EditObjetivosEjecComponent,
ListInformeComponent,
EditInformeComponent,
ListEntidadComponent,
ListComunidadComponent,
AporteComEjecComponent,
AporteEntEjecComponent,
AporteUniEjecComponent,
ErrorTextoComponent,
ComisionAsigComponent
],
imports: [
MatTreeModule,
......@@ -407,6 +426,7 @@ import { EditObjetivosEjecComponent } from './pages/Proyectos/Cierre/objetivos e
MatRadioModule
],
providers: [
seguim,
instproy,
objetivoprograma,
proObjeEstra,
......
.principal {
text-align: center;
margin-bottom: 2%;
}
.grid-container {
display: grid;
grid-template-columns: 5% 10% 45% 10% 5% 10% 15%;
border: 1px solid #ccc;
}
.titulo{
text-align: center;
margin: 3px;
font-weight: bold;
}
#cabecera {
background: linear-gradient(135deg,
var(--background-base) 22px,
var(--background-hover) 22px,
var(--background-hover) 24px,
transparent 24px,
transparent 67px,
var(--background-hover) 67px,
var(--background-hover) 69px,
transparent 69px),
linear-gradient(225deg,
var(--background-base) 22px,
var(--background-hover) 22px,
var(--background-hover) 24px,
transparent 24px,
transparent 67px,
var(--background-hover) 67px,
var(--background-hover) 69px,
transparent 69px) 0 64px;
background-color: var(--background-base);
background-size: 64px 128px;
}
.Column {
padding-left: 0px;
padding-right: 0px;
width: 100px;
white-space: inherit;
/* overflow: visible;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis; */
}
.Column1 {
padding-left: 0px;
padding-right: 0px;
width: 10px;
white-space: normal;
overflow: visible;
}
.Column2 {
width: 25px;
padding-left: 0px;
padding-right: 0px;
}
.volver{
position: absolute;
top: 50%;
right: 10px;
transform: translateY(-50%);
border-radius: 50%;
background-color: white;
display: flex;
color: rgb(71, 127, 75);
align-items: center;
justify-content: center;
padding: 0;
width: 32px;
height: 32px;
border: none;
outline: none;
cursor: pointer;
}
.grid-item {
font-weight: bold;
}
.grid-opciones {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
}
.titulo {
display: flex;
align-items: center;
justify-content: center;
}
.titulo-texto {
font-weight: bold;
font-size: 18px;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
margin-right: 10px;
}
.componente {
justify-content: center;
align-items: center;
}
.card {
background-color: rgb(252, 252, 251)
}
.colorEditar {
color: blue;
}
.colorEditar svg {
fill: blue;
}
.contenedorP {
width: 96%;
margin-left: 2%;
margin-right: 2%;
margin: 10px auto;
border-radius: 10px;
text-align: center;
margin-top: 10%;
background-color: white;
}
.contenedor:not(:last-child) {
margin-bottom: 2px;
}
.separador{
margin-top: 5%;
}
.contenedor {
width: 96%;
margin-left: 2%;
margin-right: 2%;
padding-bottom: 2%;
border-radius: 10px;
background-color: white;
position: relative;
z-index: 1;
}
.sobremontado {
position: relative;
align-items: center;
justify-content: center;
padding: 10px;
width: 96%;
top: -20px;
left: 2%;
background-color: rgb(71, 127, 75);
color: #fff;
text-align: center;
padding: 10px;
box-sizing: border-box;
margin-bottom: -50px;
z-index: 2;
border-radius: 10px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
.sobremontado span {
display: flex;
align-items: center;
justify-content: center;
margin: 0;
}
.sobremontado mat-icon {
margin-right: 5px;
}
.icono-instituciones {
display: flex;
align-items: center;
justify-content: center;
margin-right: 5px;
font-size: 20px;
cursor: pointer;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
font-family: 'Roboto', sans-serif;
color: #333;
}
table th,
table td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #e0e0e0;
}
table th {
background-color: rgb(248, 249, 250);
font-weight: bold;
text-transform: uppercase;
}
table td {
position: relative;
}
table td::after {
content: "";
position: absolute;
bottom: -1px;
left: 0;
width: 100%;
height: 1px;
background-color: #e0e0e0;
}
input[type="text"] {
width: 200px;
padding: 8px;
border: 1px solid #ccc;
border-radius: 5px;
margin-left: 10px;
}
.area-busqueda {
padding: 20px;
margin-top: 30px;
text-align: right;
}
@media (max-width: 600px) {
table {
font-size: 14px;
}
table th,
table td {
padding: 8px;
}
}
.btn-observar {
border-radius: 50%;
width: 36px;
height: 36px;
}
.colorsito{
background-color: rgb(248, 249, 250);
}
.rounder{
border-radius: 50%;
background-color: rgb(71, 127, 75);
display: flex;
align-items: center;
justify-content: center;
padding: 0;
width: 15%;
height: 40px;
border: none;
outline: none;
cursor: pointer;
}
.rounder mat-icon {
font-size: 24px;
color: #fff;
}
@media (max-width: 768px) {
.rounder {
width: 30%;
}
}
@media (max-width: 480px) {
.rounder {
width: 40%;
}
}
.margen{
margin: 10px;
padding: 10px;
margin-bottom: 10px;
}
.bordes {
border-collapse: collapse;
width: 100%;
}
.bordes th,
.bordes td {
border: 1px solid black;
padding: 8px;
}
.bordes th {
background-color: #f5f5f5;
font-weight: bold;
}
.bordes td {
background-color: #ffffff;
}
.bordes tr:nth-child(even) {
background-color: #f9f9f9;
}
.bordes tr:hover {
background-color: #eaeaea;
}
.bordes th:last-child,
.bordes td:last-child {
border-bottom: none;
}
.rounder-nuevo {
border-radius: 50%;
background-color: rgb(71, 127, 75);
display: flex;
align-items: center;
justify-content: center;
padding: 0;
width: 36px;
height: 36px;
border: none;
outline: none;
cursor: pointer;
margin-left: 5px;
}
.white-icon {
color: white;
}
.btn{
padding: 0 2% 0 2%;
}
.azul {
color: blue;
}
.institution {
display: flex;
align-items: center;
}
.institution-name {
font-size: 20px;
/* Tamaño de fuente deseado */
font-weight: bold;
/* Opcional, para hacerlo más destacado */
margin-right: 30px;
/* Espacio entre el icono y el nombre */
}
.formulario {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
max-width: 96%;
margin: 0 auto;
background-color: white;
}
/* Estilos para la columna izquierda */
.columna {
display: flex;
justify-content: center; /* Center content horizontally */
align-items: center; /* Center content vertically */
padding-right: 2%;
text-align: center;
}
.form-field {
width: 100%;
}
.container{
margin: 10px;
}
.input-container {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
margin-left: 2%; /* Center content horizontally within the input container */
}
.add-icon {
display: flex;
align-items: center;
justify-content: center;
width: 25px;
height: 25px;
border-radius: 50%;
background-color: white;
color: black;
font-size: 25px;
}
\ No newline at end of file
<form [formGroup]="dynamicForm" (ngSubmit)="guardarCambios()">
<div class="container">
<div class="save-button">
<button mat-raised-button color="primary" *ngIf="!cambio" (click)="cambiar()">Editar</button>
<button mat-raised-button color="primary" *ngIf="cambio">Guardar</button>
<span class="separator"></span>
<button mat-raised-button color="warn" *ngIf="cambio" (click)="cancelado()">Cancelar</button>
</div>
<mat-label class="titulo">Aporte de la Comunidad Beneficiaria</mat-label>
<div class="mat-elevation-z8">
<table mat-table [dataSource]="dataSource" matSort>
<!-- Nro Column -->
<ng-container matColumnDef="Nro" class="Column1">
<th class="Column1 negrita" mat-header-cell *matHeaderCellDef mat-sort-header> Nro </th>
<td class="Column1" mat-cell *matCellDef="let i = index"> {{ i+1 }}
</td>
</ng-container>
<ng-container matColumnDef="bien" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Bien y/o Servicio</th>
<td class="Column" mat-cell *matCellDef="let dato">
{{dato.uzytavpresup_bien_servicio}}
</td>
</ng-container>
<ng-container matColumnDef="descripcion" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Descripción</th>
<td class="Column" mat-cell *matCellDef="let dato">
{{dato.uzytavpresup_esptecnic}}
</td>
</ng-container>
<ng-container matColumnDef="total" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Valor Planificado USD
</th>
<td class="Column" mat-cell *matCellDef="let dato">
{{ (dato.uzytavpresup_valor * dato.uzytavpresup_cantidad) | number:'1.2-2' }}
</td>
</ng-container>
<ng-container matColumnDef="totalEjecutado" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Valor Ejecutado USD
</th>
<td class="Column" mat-cell *matCellDef="let dato; let i = index">
<input matInput type="number" [formControlName]="'totalEjecCom_' + dato.uzytavpresup_id"
required min="0" pattern="[0-9]+">
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
<div class="columna">
<div class="input-container" style="font-weight: bold; color:black;">
<mat-form-field class="form-field" style="font-weight: bold;">
<mat-label>Total Planificado </mat-label>
<input matInput [disabled]="true" required pattern="\d+(\.\d+)?" [value]="totalSuma">
</mat-form-field>
</div>
</div>
<div class="columna">
<div class="input-container" style="font-weight: bold; color:black;">
<mat-form-field class="form-field" style="font-weight: bold;">
<mat-label>Total Ejecutado </mat-label>
<input matInput [disabled]="true" required pattern="\d+(\.\d+)?" [value]="totalSumaEjecutado">
</mat-form-field>
</div>
</div>
</div>
</div>
</form>
\ No newline at end of file
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { AporteComEjecComponent } from './aporte-com-ejec.component';
describe('AporteComEjecComponent', () => {
let component: AporteComEjecComponent;
let fixture: ComponentFixture<AporteComEjecComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AporteComEjecComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AporteComEjecComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { MatTable, MatTableDataSource } from '@angular/material/table';
import { CatalogoPP } from 'src/app/modules/main/Models/catalogo-partidas-presupuestarias';
import { PartidasPresupuestarias } from 'src/app/modules/main/Models/partidas-presupuestarias';
import { PresupuestoPartidas } from 'src/app/modules/main/Models/presupuesto-partidas';
import { Actualiza_datosService } from 'src/app/modules/main/services/actualiza_datos/actualiza_datos.service';
import { Compartir_idService } from 'src/app/modules/main/services/compartir_id/compartir_id.service';
import { EnvioFormularioComponent } from '../../../../programa/opciones/envio-formulario/envio-formulario.component';
import { PresupuestoPartidasService } from 'src/app/modules/main/services/presupuesto-partidas/presupuesto-partidas.service';
@Component({
selector: 'app-aporte-com-ejec',
templateUrl: './aporte-com-ejec.component.html',
styleUrls: ['./aporte-com-ejec.component.css']
})
export class AporteComEjecComponent implements OnInit {
idRecuperado: number;
totalSuma: number = 0;
//Para Mostrar la información
dataSource: MatTableDataSource<PresupuestoPartidas>;
claPre: PartidasPresupuestarias;
partida!: CatalogoPP[];
nombrePartida: string;
formularioEnviado: boolean;
@Output() formularioGuardado = new EventEmitter<void>();
cambio: boolean = false;
dynamicForm: FormGroup; // Declare a FormGroup
presupuesto: PresupuestoPartidas;
totalSumaEjecutado: number = 0;
politicas: any[] = [];
objetivos: any[] = [];
presupuestoPartidas!: PresupuestoPartidas[];
displayedColumns: string[] = [
'Nro',
'bien',
'descripcion',
'total',
'totalEjecutado'
];
@ViewChild(MatTable) table: MatTable<any>;
constructor(
private presupuestoPartidasService: PresupuestoPartidasService,
private id_Compartido: Compartir_idService,
private dialog: MatDialog,
private formBuilder: FormBuilder,
private datosCompartidos: Actualiza_datosService,
) {
this.claPre = new PartidasPresupuestarias();
this.dataSource = new MatTableDataSource<PresupuestoPartidas>([]);
this.presupuesto = new PresupuestoPartidas()
}
ngOnInit(): void {
this.initializeForm()
this.idRecuperado = parseInt(localStorage.getItem('proyectoId'),10);
this.datosCompartidos.datos$.subscribe(() => {
this.obtenerRegistros();
});
this.presupuestoPartidasService.parametrosActualizados.subscribe(() => {
this.obtenerRegistros();
});
}
initializeForm() {
this.dynamicForm = this.formBuilder.group({});
this.dynamicForm.disable(); // Disable all form controls
}
guardarCambios() {
// Iterate through the array and save the changes
this.presupuestoPartidas.forEach(partida => {
const controlName = 'totalEjecCom_' + partida.uzytavpresup_id;
const value = this.dynamicForm.get(controlName).value;
console.log("valor recuperado xxxx ", value)
this.presupuesto.uzytavpresup_total_ejec = value;
// Send the updated data to the API for this record
this.presupuestoPartidasService.modificarParametros(partida.uzytavpresup_id, this.presupuesto).subscribe(
(response) => {
console.log('Cambios guardados exitosamente para la partida', partida.uzytavpresup_id);
//this.openModal();
this.dynamicForm.disable()
this.cambio = false; // Disable editing mode
this.obtenerRegistros()
},
(error) => {
console.log('Error al guardar los cambios para la partida', partida.uzytavpresup_id, error);
}
);
});
}
openModal() {
const dialogRef = this.dialog.open(EnvioFormularioComponent, {
disableClose: true
});
dialogRef.afterClosed().subscribe(result => {
console.log('La ventana modal se ha cerrado');
this.formularioEnviado = true;
});
}
getSubgrupo3(item: any): string {
return (
item.uzytclasificador_presup_id +
'. ' +
(item.uzytclasificador_presup_nombre || '')
);
}
createDynamicFormControls(partida: PresupuestoPartidas) {
this.dynamicForm.addControl('totalEjecCom_' + partida.uzytavpresup_id,
this.formBuilder.control({ value : partida.uzytavpresup_total_ejec,disabled: true },
[Validators.required, Validators.min(0), Validators.pattern('[0-9]+')]));
this.dynamicForm.disable();
}
obtenerRegistros() {
if (this.idRecuperado !== undefined) {
this.presupuestoPartidasService.obtenerRegistrosRelacionadosComunidadProyecto(this.idRecuperado).subscribe(data => {
if (data !== undefined) {
this.presupuestoPartidas = data.map(partida => {
// Create dynamic form control
this.createDynamicFormControls(partida);
return partida
});
this.dataSource.data = this.presupuestoPartidas;
// Calcular los totales
this.calcularTotales();
this.calcularTotalesEjecutados()
}
});
}
}
calcularTotales() {
this.totalSuma = this.presupuestoPartidas.reduce((total, dato) => {
return total + dato.uzytavpresup_valor * dato.uzytavpresup_cantidad;
}, 0);
this.totalSuma = parseFloat(this.totalSuma.toFixed(2));
}
calcularTotalesEjecutados() {
this.totalSumaEjecutado = this.presupuestoPartidas.reduce((total, dato) => {
return total + dato.uzytavpresup_total_ejec;
}, 0);
this.totalSumaEjecutado = parseFloat(this.totalSumaEjecutado.toFixed(2));
}
cambiar() {
this.cambio = true;
this.dynamicForm.enable();
}
cancelado() {
this.cambio = false;
this.dynamicForm.disable();
}
guardar() {
this.cambio = false;
this.dynamicForm.disable();
}
}
.principal {
text-align: center;
margin-bottom: 2%;
}
.grid-container {
display: grid;
grid-template-columns: 5% 10% 45% 10% 5% 10% 15%;
border: 1px solid #ccc;
}
.titulo{
text-align: center;
margin: 3px;
font-weight: bold;
}
#cabecera {
background: linear-gradient(135deg,
var(--background-base) 22px,
var(--background-hover) 22px,
var(--background-hover) 24px,
transparent 24px,
transparent 67px,
var(--background-hover) 67px,
var(--background-hover) 69px,
transparent 69px),
linear-gradient(225deg,
var(--background-base) 22px,
var(--background-hover) 22px,
var(--background-hover) 24px,
transparent 24px,
transparent 67px,
var(--background-hover) 67px,
var(--background-hover) 69px,
transparent 69px) 0 64px;
background-color: var(--background-base);
background-size: 64px 128px;
}
.Column {
padding-left: 0px;
padding-right: 0px;
width: 100px;
white-space: inherit;
/* overflow: visible;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis; */
}
.Column1 {
padding-left: 0px;
padding-right: 0px;
width: 10px;
white-space: normal;
overflow: visible;
}
.Column2 {
width: 25px;
padding-left: 0px;
padding-right: 0px;
}
.volver{
position: absolute;
top: 50%;
right: 10px;
transform: translateY(-50%);
border-radius: 50%;
background-color: white;
display: flex;
color: rgb(71, 127, 75);
align-items: center;
justify-content: center;
padding: 0;
width: 32px;
height: 32px;
border: none;
outline: none;
cursor: pointer;
}
.grid-item {
font-weight: bold;
}
.grid-opciones {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
}
.titulo {
display: flex;
align-items: center;
justify-content: center;
}
.titulo-texto {
font-weight: bold;
font-size: 18px;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
margin-right: 10px;
}
.componente {
justify-content: center;
align-items: center;
}
.card {
background-color: rgb(252, 252, 251)
}
.colorEditar {
color: blue;
}
.colorEditar svg {
fill: blue;
}
.contenedorP {
width: 96%;
margin-left: 2%;
margin-right: 2%;
margin: 10px auto;
border-radius: 10px;
text-align: center;
margin-top: 10%;
background-color: white;
}
.contenedor:not(:last-child) {
margin-bottom: 2px;
}
.separador{
margin-top: 5%;
}
.contenedor {
width: 96%;
margin-left: 2%;
margin-right: 2%;
padding-bottom: 2%;
border-radius: 10px;
background-color: white;
position: relative;
z-index: 1;
}
.sobremontado {
position: relative;
align-items: center;
justify-content: center;
padding: 10px;
width: 96%;
top: -20px;
left: 2%;
background-color: rgb(71, 127, 75);
color: #fff;
text-align: center;
padding: 10px;
box-sizing: border-box;
margin-bottom: -50px;
z-index: 2;
border-radius: 10px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
.sobremontado span {
display: flex;
align-items: center;
justify-content: center;
margin: 0;
}
.sobremontado mat-icon {
margin-right: 5px;
}
.icono-instituciones {
display: flex;
align-items: center;
justify-content: center;
margin-right: 5px;
font-size: 20px;
cursor: pointer;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
font-family: 'Roboto', sans-serif;
color: #333;
}
table th,
table td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #e0e0e0;
}
table th {
background-color: rgb(248, 249, 250);
font-weight: bold;
text-transform: uppercase;
}
table td {
position: relative;
}
table td::after {
content: "";
position: absolute;
bottom: -1px;
left: 0;
width: 100%;
height: 1px;
background-color: #e0e0e0;
}
input[type="text"] {
width: 200px;
padding: 8px;
border: 1px solid #ccc;
border-radius: 5px;
margin-left: 10px;
}
.area-busqueda {
padding: 20px;
margin-top: 30px;
text-align: right;
}
@media (max-width: 600px) {
table {
font-size: 14px;
}
table th,
table td {
padding: 8px;
}
}
.btn-observar {
border-radius: 50%;
width: 36px;
height: 36px;
}
.colorsito{
background-color: rgb(248, 249, 250);
}
.rounder{
border-radius: 50%;
background-color: rgb(71, 127, 75);
display: flex;
align-items: center;
justify-content: center;
padding: 0;
width: 15%;
height: 40px;
border: none;
outline: none;
cursor: pointer;
}
.rounder mat-icon {
font-size: 24px;
color: #fff;
}
@media (max-width: 768px) {
.rounder {
width: 30%;
}
}
@media (max-width: 480px) {
.rounder {
width: 40%;
}
}
.margen{
margin: 10px;
padding: 10px;
margin-bottom: 10px;
}
.bordes {
border-collapse: collapse;
width: 100%;
}
.bordes th,
.bordes td {
border: 1px solid black;
padding: 8px;
}
.bordes th {
background-color: #f5f5f5;
font-weight: bold;
}
.bordes td {
background-color: #ffffff;
}
.bordes tr:nth-child(even) {
background-color: #f9f9f9;
}
.bordes tr:hover {
background-color: #eaeaea;
}
.bordes th:last-child,
.bordes td:last-child {
border-bottom: none;
}
.rounder-nuevo {
border-radius: 50%;
background-color: rgb(71, 127, 75);
display: flex;
align-items: center;
justify-content: center;
padding: 0;
width: 36px;
height: 36px;
border: none;
outline: none;
cursor: pointer;
margin-left: 5px;
}
.white-icon {
color: white;
}
.btn{
padding: 0 2% 0 2%;
}
.azul {
color: blue;
}
.institution {
display: flex;
align-items: center;
}
.institution-name {
font-size: 20px;
/* Tamaño de fuente deseado */
font-weight: bold;
/* Opcional, para hacerlo más destacado */
margin-right: 30px;
/* Espacio entre el icono y el nombre */
}
.formulario {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
max-width: 96%;
margin: 0 auto;
background-color: white;
}
/* Estilos para la columna izquierda */
.columna {
display: flex;
justify-content: center; /* Center content horizontally */
align-items: center; /* Center content vertically */
padding-right: 2%;
text-align: center;
}
.form-field {
width: 100%;
}
.container{
margin: 10px;
}
.input-container {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
margin-left: 2%; /* Center content horizontally within the input container */
}
.add-icon {
display: flex;
align-items: center;
justify-content: center;
width: 25px;
height: 25px;
border-radius: 50%;
background-color: white;
color: black;
font-size: 25px;
}
\ No newline at end of file
<form [formGroup]="dynamicForm" (ngSubmit)="guardarCambios()">
<div class="container">
<div class="save-button">
<button mat-raised-button color="primary" *ngIf="!cambio" (click)="cambiar()">Editar</button>
<button mat-raised-button color="primary" *ngIf="cambio">Guardar</button>
<span class="separator"></span>
<button mat-raised-button color="warn" *ngIf="cambio" (click)="cancelado()">Cancelar</button>
</div>
<mat-label class="titulo">Aporte de la Comunidad Beneficiaria</mat-label>
<div class="mat-elevation-z8">
<table mat-table [dataSource]="dataSource" matSort>
<!-- Nro Column -->
<ng-container matColumnDef="Nro" class="Column1">
<th class="Column1 negrita" mat-header-cell *matHeaderCellDef mat-sort-header> Nro </th>
<td class="Column1" mat-cell *matCellDef="let i = index"> {{ i+1 }}
</td>
</ng-container>
<ng-container matColumnDef="bien" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Bien y/o Servicio</th>
<td class="Column" mat-cell *matCellDef="let dato">
{{dato.uzytavpresup_bien_servicio}}
</td>
</ng-container>
<ng-container matColumnDef="descripcion" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Descripción</th>
<td class="Column" mat-cell *matCellDef="let dato">
{{dato.uzytavpresup_esptecnic}}
</td>
</ng-container>
<ng-container matColumnDef="total" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Valor Planificado USD
</th>
<td class="Column" mat-cell *matCellDef="let dato">
{{ (dato.uzytavpresup_valor * dato.uzytavpresup_cantidad) | number:'1.2-2' }}
</td>
</ng-container>
<ng-container matColumnDef="totalEjecutado" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Valor Ejecutado USD
</th>
<td class="Column" mat-cell *matCellDef="let dato; let i = index">
<input matInput type="number" [formControlName]="'totalEjecEnt_' + dato.uzytavpresup_id"
required min="0" pattern="[0-9]+">
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
<div class="columna">
<div class="input-container" style="font-weight: bold; color:black;">
<mat-form-field class="form-field" style="font-weight: bold;">
<mat-label>Total Planificado </mat-label>
<input matInput [disabled]="true" required pattern="\d+(\.\d+)?" [value]="totalSuma">
</mat-form-field>
</div>
</div>
<div class="columna">
<div class="input-container" style="font-weight: bold; color:black;">
<mat-form-field class="form-field" style="font-weight: bold;">
<mat-label>Total Ejecutado </mat-label>
<input matInput [disabled]="true" required pattern="\d+(\.\d+)?" [value]="totalSumaEjecutado">
</mat-form-field>
</div>
</div>
</div>
</div>
</form>
\ No newline at end of file
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { AporteEntEjecComponent } from './aporte-ent-ejec.component';
describe('AporteEntEjecComponent', () => {
let component: AporteEntEjecComponent;
let fixture: ComponentFixture<AporteEntEjecComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AporteEntEjecComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AporteEntEjecComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { MatTable, MatTableDataSource } from '@angular/material/table';
import { CatalogoPP } from 'src/app/modules/main/Models/catalogo-partidas-presupuestarias';
import { PartidasPresupuestarias } from 'src/app/modules/main/Models/partidas-presupuestarias';
import { PresupuestoPartidas } from 'src/app/modules/main/Models/presupuesto-partidas';
import { Actualiza_datosService } from 'src/app/modules/main/services/actualiza_datos/actualiza_datos.service';
import { Compartir_idService } from 'src/app/modules/main/services/compartir_id/compartir_id.service';
import { PresupuestoPartidasService } from 'src/app/modules/main/services/presupuesto-partidas/presupuesto-partidas.service';
import { EnvioFormularioComponent } from '../../../../programa/opciones/envio-formulario/envio-formulario.component';
@Component({
selector: 'app-aporte-ent-ejec',
templateUrl: './aporte-ent-ejec.component.html',
styleUrls: ['./aporte-ent-ejec.component.css']
})
export class AporteEntEjecComponent implements OnInit {
idRecuperado: number;
totalSuma: number = 0;
//Para Mostrar la información
dataSource: MatTableDataSource<PresupuestoPartidas>;
claPre: PartidasPresupuestarias;
partida!: CatalogoPP[];
nombrePartida: string;
formularioEnviado: boolean;
@Output() formularioGuardado = new EventEmitter<void>();
cambio: boolean = false;
dynamicForm: FormGroup; // Declare a FormGroup
presupuesto: PresupuestoPartidas;
totalSumaEjecutado: number = 0;
politicas: any[] = [];
objetivos: any[] = [];
presupuestoPartidas!: PresupuestoPartidas[];
displayedColumns: string[] = [
'Nro',
'bien',
'descripcion',
'total',
'totalEjecutado'
];
@ViewChild(MatTable) table: MatTable<any>;
constructor(
private presupuestoPartidasService: PresupuestoPartidasService,
private id_Compartido: Compartir_idService,
private dialog: MatDialog,
private formBuilder: FormBuilder,
private datosCompartidos: Actualiza_datosService,
) {
this.claPre = new PartidasPresupuestarias();
this.dataSource = new MatTableDataSource<PresupuestoPartidas>([]);
this.presupuesto = new PresupuestoPartidas()
}
ngOnInit(): void {
this.initializeForm()
this.idRecuperado = parseInt(localStorage.getItem('proyectoId'),10);
this.datosCompartidos.datos$.subscribe(() => {
this.obtenerRegistros();
});
this.presupuestoPartidasService.parametrosActualizados.subscribe(() => {
this.obtenerRegistros();
});
}
initializeForm() {
this.dynamicForm = this.formBuilder.group({});
this.dynamicForm.disable(); // Disable all form controls
}
guardarCambios() {
// Iterate through the array and save the changes
this.presupuestoPartidas.forEach(partida => {
const controlName = 'totalEjecEnt_' + partida.uzytavpresup_id;
const value = this.dynamicForm.get(controlName).value;
console.log("valor recuperado xxxx ", value)
this.presupuesto.uzytavpresup_total_ejec = value;
// Send the updated data to the API for this record
this.presupuestoPartidasService.modificarParametros(partida.uzytavpresup_id, this.presupuesto).subscribe(
(response) => {
console.log('Cambios guardados exitosamente para la partida', partida.uzytavpresup_id);
//this.openModal();
this.dynamicForm.disable()
this.cambio = false; // Disable editing mode
this.obtenerRegistros()
},
(error) => {
console.log('Error al guardar los cambios para la partida', partida.uzytavpresup_id, error);
}
);
});
}
openModal() {
const dialogRef = this.dialog.open(EnvioFormularioComponent, {
disableClose: true
});
dialogRef.afterClosed().subscribe(result => {
console.log('La ventana modal se ha cerrado');
this.formularioEnviado = true;
});
}
getSubgrupo3(item: any): string {
return (
item.uzytclasificador_presup_id +
'. ' +
(item.uzytclasificador_presup_nombre || '')
);
}
createDynamicFormControls(partida: PresupuestoPartidas) {
console.log("este es el total actual",partida.uzytavpresup_total_ejec)
this.dynamicForm.addControl('totalEjecEnt_' + partida.uzytavpresup_id,
this.formBuilder.control({ value : partida.uzytavpresup_total_ejec, disabled: true },
[Validators.required, Validators.min(0), Validators.pattern('[0-9]+')]));
this.dynamicForm.disable();
}
obtenerRegistros() {
if (this.idRecuperado !== undefined) {
this.presupuestoPartidasService.obtenerRegistrosRelacionadosEntidadProyecto(this.idRecuperado).subscribe(data => {
if (data !== undefined) {
this.presupuestoPartidas = data.map(partida => {
// Create dynamic form control
this.createDynamicFormControls(partida);
return partida
});
this.dataSource.data = this.presupuestoPartidas;
// Calcular los totales
this.calcularTotales();
this.calcularTotalesEjecutados()
}
});
}
}
calcularTotales() {
this.totalSuma = this.presupuestoPartidas.reduce((total, dato) => {
return total + dato.uzytavpresup_valor * dato.uzytavpresup_cantidad;
}, 0);
this.totalSuma = parseFloat(this.totalSuma.toFixed(2));
}
calcularTotalesEjecutados() {
this.totalSumaEjecutado = this.presupuestoPartidas.reduce((total, dato) => {
return total + dato.uzytavpresup_total_ejec;
}, 0);
this.totalSumaEjecutado = parseFloat(this.totalSumaEjecutado.toFixed(2));
}
cambiar() {
this.cambio = true;
this.dynamicForm.enable();
}
cancelado() {
this.cambio = false;
this.dynamicForm.disable();
}
guardar() {
this.cambio = false;
this.dynamicForm.disable();
}
}
.principal {
text-align: center;
margin-bottom: 2%;
}
.grid-container {
display: grid;
grid-template-columns: 5% 10% 45% 10% 5% 10% 15%;
border: 1px solid #ccc;
}
.titulo{
text-align: center;
margin: 3px;
font-weight: bold;
}
#cabecera {
background: linear-gradient(135deg,
var(--background-base) 22px,
var(--background-hover) 22px,
var(--background-hover) 24px,
transparent 24px,
transparent 67px,
var(--background-hover) 67px,
var(--background-hover) 69px,
transparent 69px),
linear-gradient(225deg,
var(--background-base) 22px,
var(--background-hover) 22px,
var(--background-hover) 24px,
transparent 24px,
transparent 67px,
var(--background-hover) 67px,
var(--background-hover) 69px,
transparent 69px) 0 64px;
background-color: var(--background-base);
background-size: 64px 128px;
}
.Column {
padding-left: 0px;
padding-right: 0px;
width: 100px;
white-space: inherit;
/* overflow: visible;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis; */
}
.Column1 {
padding-left: 0px;
padding-right: 0px;
width: 10px;
white-space: normal;
overflow: visible;
}
.Column2 {
width: 25px;
padding-left: 0px;
padding-right: 0px;
}
.volver{
position: absolute;
top: 50%;
right: 10px;
transform: translateY(-50%);
border-radius: 50%;
background-color: white;
display: flex;
color: rgb(71, 127, 75);
align-items: center;
justify-content: center;
padding: 0;
width: 32px;
height: 32px;
border: none;
outline: none;
cursor: pointer;
}
.grid-item {
font-weight: bold;
}
.grid-opciones {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
}
.titulo {
display: flex;
align-items: center;
justify-content: center;
}
.titulo-texto {
font-weight: bold;
font-size: 18px;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
margin-right: 10px;
}
.componente {
justify-content: center;
align-items: center;
}
.card {
background-color: rgb(252, 252, 251)
}
.colorEditar {
color: blue;
}
.colorEditar svg {
fill: blue;
}
.contenedorP {
width: 96%;
margin-left: 2%;
margin-right: 2%;
margin: 10px auto;
border-radius: 10px;
text-align: center;
margin-top: 10%;
background-color: white;
}
.contenedor:not(:last-child) {
margin-bottom: 2px;
}
.separador{
margin-top: 5%;
}
.contenedor {
width: 96%;
margin-left: 2%;
margin-right: 2%;
padding-bottom: 2%;
border-radius: 10px;
background-color: white;
position: relative;
z-index: 1;
}
.sobremontado {
position: relative;
align-items: center;
justify-content: center;
padding: 10px;
width: 96%;
top: -20px;
left: 2%;
background-color: rgb(71, 127, 75);
color: #fff;
text-align: center;
padding: 10px;
box-sizing: border-box;
margin-bottom: -50px;
z-index: 2;
border-radius: 10px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
.sobremontado span {
display: flex;
align-items: center;
justify-content: center;
margin: 0;
}
.sobremontado mat-icon {
margin-right: 5px;
}
.icono-instituciones {
display: flex;
align-items: center;
justify-content: center;
margin-right: 5px;
font-size: 20px;
cursor: pointer;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
font-family: 'Roboto', sans-serif;
color: #333;
}
table th,
table td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #e0e0e0;
}
table th {
background-color: rgb(248, 249, 250);
font-weight: bold;
text-transform: uppercase;
}
table td {
position: relative;
}
table td::after {
content: "";
position: absolute;
bottom: -1px;
left: 0;
width: 100%;
height: 1px;
background-color: #e0e0e0;
}
input[type="text"] {
width: 200px;
padding: 8px;
border: 1px solid #ccc;
border-radius: 5px;
margin-left: 10px;
}
.area-busqueda {
padding: 20px;
margin-top: 30px;
text-align: right;
}
@media (max-width: 600px) {
table {
font-size: 14px;
}
table th,
table td {
padding: 8px;
}
}
.btn-observar {
border-radius: 50%;
width: 36px;
height: 36px;
}
.colorsito{
background-color: rgb(248, 249, 250);
}
.rounder{
border-radius: 50%;
background-color: rgb(71, 127, 75);
display: flex;
align-items: center;
justify-content: center;
padding: 0;
width: 15%;
height: 40px;
border: none;
outline: none;
cursor: pointer;
}
.rounder mat-icon {
font-size: 24px;
color: #fff;
}
@media (max-width: 768px) {
.rounder {
width: 30%;
}
}
@media (max-width: 480px) {
.rounder {
width: 40%;
}
}
.margen{
margin: 10px;
padding: 10px;
margin-bottom: 10px;
}
.bordes {
border-collapse: collapse;
width: 100%;
}
.bordes th,
.bordes td {
border: 1px solid black;
padding: 8px;
}
.bordes th {
background-color: #f5f5f5;
font-weight: bold;
}
.bordes td {
background-color: #ffffff;
}
.bordes tr:nth-child(even) {
background-color: #f9f9f9;
}
.bordes tr:hover {
background-color: #eaeaea;
}
.bordes th:last-child,
.bordes td:last-child {
border-bottom: none;
}
.rounder-nuevo {
border-radius: 50%;
background-color: rgb(71, 127, 75);
display: flex;
align-items: center;
justify-content: center;
padding: 0;
width: 36px;
height: 36px;
border: none;
outline: none;
cursor: pointer;
margin-left: 5px;
}
.white-icon {
color: white;
}
.btn{
padding: 0 2% 0 2%;
}
.azul {
color: blue;
}
.institution {
display: flex;
align-items: center;
}
.institution-name {
font-size: 20px;
/* Tamaño de fuente deseado */
font-weight: bold;
/* Opcional, para hacerlo más destacado */
margin-right: 30px;
/* Espacio entre el icono y el nombre */
}
.formulario {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
max-width: 96%;
margin: 0 auto;
background-color: white;
}
/* Estilos para la columna izquierda */
.columna{
width: 32%;
padding-right: 2%;
}
.form-field {
width: 100%;
}
.container{
margin: 10px;
}
.input-container {
width: 100%;
display: flex;
flex-direction: column;
}
.add-icon {
display: flex;
align-items: center;
justify-content: center;
width: 25px;
/* Ancho del círculo */
height: 25px;
/* Altura del círculo */
border-radius: 50%;
/* Para crear la forma de círculo */
background-color: white;
/* Color de fondo del círculo */
color: black;
/* Color del signo "+" en el círculo */
font-size: 25px;
/* Tamaño del signo "+" */
}
\ No newline at end of file
<form [formGroup]="dynamicForm" (ngSubmit)="guardarCambios()">
<div class="container">
<div class="save-button">
<button mat-raised-button color="primary" *ngIf="!cambio" (click)="cambiar()">Editar</button>
<button mat-raised-button color="primary" *ngIf="cambio">Guardar</button>
<span class="separator"></span>
<button mat-raised-button color="warn" *ngIf="cambio" (click)="cancelado()">Cancelar</button>
</div>
<mat-label class="titulo">Aporte de la Universidad</mat-label>
<div class="mat-elevation-z8">
<table mat-table [dataSource]="dataSource" matSort>
<!-- Nro Column -->
<ng-container matColumnDef="Nro" class="Column1">
<th class="Column1 negrita" mat-header-cell *matHeaderCellDef mat-sort-header> Nro </th>
<td class="Column1" mat-cell *matCellDef="let i = index"> {{ i+1 }}
</td>
</ng-container>
<!-- Nombre Institución Column -->
<ng-container matColumnDef="partida" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header> Partida Presupuestaria</th>
<td class="Column" mat-cell *matCellDef="let dato">
{{dato.partida$ | async }} </td>
</ng-container>
<ng-container matColumnDef="descripcion" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Descripción</th>
<td class="Column" mat-cell *matCellDef="let dato">
{{dato.uzytavpresup_esptecnic}}
</td>
</ng-container>
<ng-container matColumnDef="gasto" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header> Tipo de Gasto </th>
<td class="Column" mat-cell *matCellDef="let dato">
<ng-container [ngSwitch]="dato.uzytavpresup_tipogasto">
<span *ngSwitchCase="'C'">Permanente</span>
<span *ngSwitchCase="'I'">No Permanente</span>
</ng-container>
</td>
</ng-container>
<ng-container matColumnDef="total" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Valor Planificado USD
</th>
<td class="Column" mat-cell *matCellDef="let dato">
{{ (dato.uzytavpresup_valor * dato.uzytavpresup_cantidad) | number:'1.2-2' }}
</td>
</ng-container>
<!-- Total Ejecutado Column -->
<ng-container matColumnDef="totalEjecutado" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Valor Ejecutado USD
</th>
<td class="Column" mat-cell *matCellDef="let dato; let i = index">
<input matInput type="number" [formControlName]="'totalEjec_' + dato.uzytavpresup_id"
required min="0" pattern="[0-9]+" [value]="dato.uzytavpresup_total_ejec">
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
<div class="formulario">
<div class="columna">
<div class="input-container">
<mat-form-field class="form-field" style="font-weight: bold; color:black;">
<mat-label>Sumatoria de Permanentes</mat-label>
<input matInput [disabled]="true" required pattern="\d+(\.\d+)?" [value]="totalPermanente">
</mat-form-field>
</div>
</div>
<div class="columna">
<div class="input-container">
<mat-form-field class="form-field" style="font-weight: bold; color:black;">
<mat-label>Sumatoria de No Permanentes</mat-label>
<input matInput [disabled]="true" required pattern="\d+(\.\d+)?" [value]="totalNoPermanente">
</mat-form-field>
</div>
</div>
<div class="columna">
<div class="input-container" style="font-weight: bold; color:black;">
<mat-form-field class="form-field" style="font-weight: bold;">
<mat-label>Total (Permanente + No Permanente)</mat-label>
<input matInput [disabled]="true" required pattern="\d+(\.\d+)?" [value]="totalSuma">
</mat-form-field>
</div>
</div>
<div class="columna">
<div class="input-container">
<mat-form-field class="form-field" style="font-weight: bold; color:black;">
<mat-label>Sumatoria Permanente Ejecutado</mat-label>
<input matInput [disabled]="true" required pattern="\d+(\.\d+)?" [value]="totalPermanenteEjecutado">
</mat-form-field>
</div>
</div>
<div class="columna">
<div class="input-container">
<mat-form-field class="form-field" style="font-weight: bold; color:black;">
<mat-label>Sumatoria No Permanente Ejecutado</mat-label>
<input matInput [disabled]="true" required pattern="\d+(\.\d+)?" [value]="totalNoPermanenteEjecutado">
</mat-form-field>
</div>
</div>
<div class="columna">
<div class="input-container" style="font-weight: bold; color:black;">
<mat-form-field class="form-field" style="font-weight: bold;">
<mat-label>Total Ejecutado (P+ NP)</mat-label>
<input matInput [disabled]="true" required pattern="\d+(\.\d+)?" [value]="totalSumaEjecutado">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
</form>
\ No newline at end of file
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { AporteUniEjecComponent } from './aporte-uni-ejec.component';
describe('AporteUniEjecComponent', () => {
let component: AporteUniEjecComponent;
let fixture: ComponentFixture<AporteUniEjecComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AporteUniEjecComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AporteUniEjecComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { MatTable, MatTableDataSource } from '@angular/material/table';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { CatalogoPP } from 'src/app/modules/main/Models/catalogo-partidas-presupuestarias';
import { PartidasPresupuestarias } from 'src/app/modules/main/Models/partidas-presupuestarias';
import { PresupuestoPartidas } from 'src/app/modules/main/Models/presupuesto-partidas';
import { Actualiza_datosService } from 'src/app/modules/main/services/actualiza_datos/actualiza_datos.service';
import { Compartir_idService } from 'src/app/modules/main/services/compartir_id/compartir_id.service';
import { PartidasPresupuestariasService } from 'src/app/modules/main/services/partidas-presupuestarias/partidas-presupuestarias.service';
import { PresupuestoPartidasService } from 'src/app/modules/main/services/presupuesto-partidas/presupuesto-partidas.service';
import { EnvioFormularioComponent } from '../../../../programa/opciones/envio-formulario/envio-formulario.component';
@Component({
selector: 'app-aporte-uni-ejec',
templateUrl: './aporte-uni-ejec.component.html',
styleUrls: ['./aporte-uni-ejec.component.css']
})
export class AporteUniEjecComponent implements OnInit {
formularioEnviado: boolean;
@Output() formularioGuardado = new EventEmitter<void>();
idRecuperado: number;
totalPermanente: number = 0;
totalNoPermanente: number = 0;
totalSuma: number = 0;
totalPermanenteEjecutado: number = 0;
totalNoPermanenteEjecutado: number = 0;
totalSumaEjecutado: number = 0;
//Para Mostrar la información
dataSource: MatTableDataSource<PresupuestoPartidas>;
claPre: PartidasPresupuestarias;
partida!: CatalogoPP[];
nombrePartida: string;
cambio: boolean = false;
dynamicForm: FormGroup; // Declare a FormGroup
presupuesto: PresupuestoPartidas;
politicas: any[] = [];
objetivos: any[] = [];
presupuestoPartidas!: PresupuestoPartidas[];
displayedColumns: string[] = [
'Nro',
'partida',
'descripcion',
'gasto',
'total',
'totalEjecutado',
];
@ViewChild(MatTable) table: MatTable<any>;
constructor(
private presupuestoPartidasService: PresupuestoPartidasService,
private id_Compartido: Compartir_idService,
private dialog: MatDialog,
private formBuilder: FormBuilder,
private datosCompartidos: Actualiza_datosService,
private partidaS: PartidasPresupuestariasService,
) {
this.claPre = new PartidasPresupuestarias();
this.dataSource = new MatTableDataSource<PresupuestoPartidas>([]);
this.presupuesto = new PresupuestoPartidas()
}
ngOnInit(): void {
this.initializeForm()
this.idRecuperado = parseInt(localStorage.getItem('proyectoId'), 10);
this.datosCompartidos.datos$.subscribe(() => {
this.obtenerRegistros();
});
this.presupuestoPartidasService.parametrosActualizados.subscribe(() => {
this.obtenerRegistros();
});
}
initializeForm() {
this.dynamicForm = this.formBuilder.group({});
this.dynamicForm.disable(); // Disable all form controls
}
openModal() {
const dialogRef = this.dialog.open(EnvioFormularioComponent, {
disableClose: true
});
dialogRef.afterClosed().subscribe(result => {
console.log('La ventana modal se ha cerrado');
this.formularioEnviado = true;
});
}
guardarCambios() {
// Iterate through the array and save the changes
this.presupuestoPartidas.forEach(partida => {
const controlName = 'totalEjec_' + partida.uzytavpresup_id;
const value = this.dynamicForm.get(controlName).value;
console.log("valor recuperado xxxx ", value)
this.presupuesto.uzytavpresup_total_ejec = value;
// Send the updated data to the API for this record
this.presupuestoPartidasService.modificarParametros(partida.uzytavpresup_id, this.presupuesto).subscribe(
(response) => {
console.log('Cambios guardados exitosamente para la partida', partida.uzytavpresup_id);
//this.openModal();
this.dynamicForm.disable()
this.cambio = false; // Disable editing mode
this.obtenerRegistros()
},
(error) => {
console.log('Error al guardar los cambios para la partida', partida.uzytavpresup_id, error);
}
);
});
}
getSubgrupo3(item: any): string {
return (
item.uzytclasificador_presup_id +
'. ' +
(item.uzytclasificador_presup_nombre || '')
);
}
obtenerRegistros() {
this.idRecuperado = this.idRecuperado;
if (this.idRecuperado !== undefined) {
this.presupuestoPartidasService.obtenerRegistrosRelacionadosUniversidadProyecto(this.idRecuperado).subscribe(data => {
if (data !== undefined) {
this.presupuestoPartidas = data.map(partida => {
// Create dynamic form control
this.createDynamicFormControls(partida);
return {
...partida,
partida$: this.obtenerPartidas(partida.uzytavclaspre_id)
};
});
this.dataSource.data = this.presupuestoPartidas;
// Calcular los totales
this.calcularTotales();
this.calcularTotalesEjecutados()
}
});
}
}
createDynamicFormControls(partida: PresupuestoPartidas) {
this.dynamicForm.addControl('totalEjec_' + partida.uzytavpresup_id,
this.formBuilder.control({ value : partida.uzytavpresup_total_ejec,disabled: true },
[Validators.required, Validators.min(0), Validators.pattern('[0-9]+')]));
this.dynamicForm.disable();
}
obtenerPartidas(id: number): Observable<string> {
return this.partidaS.obtenerNombrePartidas(id).pipe(
map(partida => {
const partidaEncontrada = partida.find(c => c.uzytavclaspre_id === id);
return partidaEncontrada ? partidaEncontrada.uzytclasificador_presup_id + ". "
+ partidaEncontrada.uzytclasificador_presup_nombre : 'No encontrado';
})
);
}
calcularTotales() {
this.totalPermanente = this.presupuestoPartidas.reduce((total, dato) => {
if (dato.uzytavpresup_tipogasto == "C") {
return total + dato.uzytavpresup_valor * dato.uzytavpresup_cantidad;
} else {
return total; // Si no es "C", devolver el total sin cambiarlo
}
}, 0);
this.totalNoPermanente = this.presupuestoPartidas.reduce((total, dato) => {
if (dato.uzytavpresup_tipogasto == "I") {
return total + dato.uzytavpresup_valor * dato.uzytavpresup_cantidad;
} else {
return total; // Si no es "I", devolver el total sin cambiarlo
}
}, 0);
this.totalPermanente = parseFloat(this.totalPermanente.toFixed(2));
this.totalNoPermanente = parseFloat(this.totalNoPermanente.toFixed(2));
this.totalSuma = this.totalPermanente + this.totalNoPermanente;
}
calcularTotalesEjecutados() {
this.totalPermanenteEjecutado = this.presupuestoPartidas.reduce((total, dato) => {
if (dato.uzytavpresup_tipogasto == "C") {
return total + dato.uzytavpresup_total_ejec;
} else {
return total; // Si no es "C", devolver el total sin cambiarlo
}
}, 0);
this.totalNoPermanenteEjecutado = this.presupuestoPartidas.reduce((total, dato) => {
if (dato.uzytavpresup_tipogasto == "I") {
return total + dato.uzytavpresup_total_ejec;
} else {
return total; // Si no es "I", devolver el total sin cambiarlo
}
}, 0);
this.totalPermanenteEjecutado = parseFloat(this.totalPermanenteEjecutado.toFixed(2));
this.totalNoPermanenteEjecutado = parseFloat(this.totalNoPermanenteEjecutado.toFixed(2));
this.totalSumaEjecutado = this.totalPermanenteEjecutado + this.totalNoPermanenteEjecutado;
}
cambiar() {
this.cambio = true;
this.dynamicForm.enable();
}
cancelado() {
this.cambio = false;
this.dynamicForm.disable();
}
guardar() {
this.cambio = false;
this.dynamicForm.disable();
}
}
.editor-separator{
margin-top: 4%;
}
.error-message {
color: red;
font-size: 14px;
margin-top: 5px;
}
<div class="container">
<form class="example-form" [formGroup]="myForm" (ngSubmit)="onSubmit()" >
<form class="example-form" [formGroup]="myForm" (ngSubmit)="onSubmit()">
<mat-card>
<mat-card-header>
<div class="save-button">
<button mat-raised-button color="primary" *ngIf="!cambio"
(click)="cambiar()">Editar</button>
<button mat-raised-button color="primary" *ngIf="cambio"
>Guardar</button>
[disabled]="!myForm.valid">Guardar</button>
<span class="separator"></span>
<button mat-raised-button color="warn" *ngIf="cambio"
(click)="cancelado()">Cancelar</button>
......@@ -15,41 +15,83 @@
<mat-card-content>
<div>
<label class="label-negrita"> <strong>Productos y/o servicios generados por el proyecto:</strong> </label>
<ckeditor formControlName="productoCierre" class="custom-ckeditor" [disabled]="!isEditorEnabled" [style.height]="editorHeight" [editor]="Editor"></ckeditor>
<label class="label-negrita"> <strong>Productos y/o servicios
generados por el proyecto:</strong> </label>
<ckeditor formControlName="productoCierre" class="custom-ckeditor"
[disabled]="!isEditorEnabled" [style.height]="editorHeight"
[editor]="Editor"></ckeditor>
<div *ngIf="myForm.get('productoCierre').hasError('maxlength')"
class="error-message">
El contenido no puede exceder los 500 caracteres.
</div>
</div>
<div class="editor-separator"></div>
<div>
<label class="label-negrita"> <strong>Bienes a favor de la ESPE:</strong></label>
<ckeditor formControlName="bienesCierre" class="custom-ckeditor" [disabled]="!isEditorEnabled" [style.height]="editorHeight" [editor]="Editor"></ckeditor>
<ckeditor formControlName="bienesCierre" class="custom-ckeditor"
[disabled]="!isEditorEnabled" [style.height]="editorHeight"
[editor]="Editor"></ckeditor>
<div *ngIf="myForm.get('bienesCierre').hasError('maxlength')"
class="error-message">
El contenido no puede exceder los 500 caracteres.
</div>
</div>
<div class="editor-separator"></div>
<div>
<label class="label-negrita"> <strong>Resultados del proyecto:</strong></label>
<ckeditor formControlName="resultadoCierre" class="custom-ckeditor" [disabled]="!isEditorEnabled" [style.height]="editorHeight" [editor]="Editor"></ckeditor>
<ckeditor formControlName="resultadoCierre" class="custom-ckeditor"
[disabled]="!isEditorEnabled" [style.height]="editorHeight"
[editor]="Editor"></ckeditor>
<div *ngIf="myForm.get('resultadoCierre').hasError('maxlength')"
class="error-message">
El contenido no puede exceder los 500 caracteres.
</div>
</div>
<div class="editor-separator"></div>
<div>
<label class="label-negrita"> <strong>Otras aplicaciones del producto y/o servicios:</strong></label>
<ckeditor formControlName="servicioCierre" class="custom-ckeditor" [disabled]="!isEditorEnabled" [style.height]="editorHeight" [editor]="Editor"></ckeditor>
<label class="label-negrita"> <strong>Otras aplicaciones del producto
y/o servicios:</strong></label>
<ckeditor formControlName="servicioCierre" class="custom-ckeditor"
[disabled]="!isEditorEnabled" [style.height]="editorHeight"
[editor]="Editor"></ckeditor>
<div *ngIf="myForm.get('servicioCierre').hasError('maxlength')"
class="error-message">
El contenido no puede exceder los 500 caracteres.
</div>
</div>
<div class="editor-separator"></div>
<div>
<label class="label-negrita"> <strong>Impacto futuro del proyecto:</strong></label>
<ckeditor formControlName="impactoCierre" class="custom-ckeditor" [disabled]="!isEditorEnabled" [style.height]="editorHeight" [editor]="Editor"></ckeditor>
<ckeditor formControlName="impactoCierre" class="custom-ckeditor"
[disabled]="!isEditorEnabled" [style.height]="editorHeight"
[editor]="Editor"></ckeditor>
<div *ngIf="myForm.get('impactoCierre').hasError('maxlength')"
class="error-message">
El contenido no puede exceder los 500 caracteres.
</div>
</div>
<div class="editor-separator"></div>
<div>
<label class="label-negrita"> <strong>Restricciones que limitan el impacto del proyecto:</strong></label>
<ckeditor formControlName="restricCierre" class="custom-ckeditor" [disabled]="!isEditorEnabled" [style.height]="editorHeight" [editor]="Editor"></ckeditor>
<label class="label-negrita"> <strong>Restricciones que limitan el
impacto del proyecto:</strong></label>
<ckeditor formControlName="restricCierre" class="custom-ckeditor"
[disabled]="!isEditorEnabled" [style.height]="editorHeight"
[editor]="Editor"></ckeditor>
<div *ngIf="myForm.get('restricCierre').hasError('maxlength')" class="error-message">
El contenido no puede exceder los 500 caracteres.
</div>
</div>
<div class="editor-separator"></div>
<div>
<label class="label-negrita"> <strong>Comentarios Generales:</strong></label>
<ckeditor formControlName="comenCierre" class="custom-ckeditor" [disabled]="!isEditorEnabled" [style.height]="editorHeight" [editor]="Editor"></ckeditor>
<ckeditor formControlName="comenCierre" class="custom-ckeditor"
[disabled]="!isEditorEnabled" [style.height]="editorHeight"
[editor]="Editor"></ckeditor>
<div *ngIf="myForm.get('comenCierre').hasError('maxlength')" class="error-message">
El contenido no puede exceder los 500 caracteres.
</div>
</div>
</mat-card-content>
......
......@@ -7,6 +7,7 @@ import { ProyectosService } from 'src/app/modules/main/services/proyectos/proyec
import ClassicEditor from '../../../ckeditor-custom/build/ckeditor';
import { EnvioFormularioComponent } from '../../../../programa/opciones/envio-formulario/envio-formulario.component';
import { MatDialog } from '@angular/material/dialog';
import { ErrorTextoComponent } from '../../../errores/error-texto/error-texto.component';
@Component({
selector: 'vex-resultados',
templateUrl: './resultados.component.html',
......@@ -45,13 +46,13 @@ export class ResultadosComponent implements OnInit {
this.obtenerRegistros();
this.myForm = this.formBuilder.group({
productoCierre: [this.proyectos.uzytavproyec_cierre_prod, Validators.required],
bienesCierre: [this.proyectos.uzytavproyec_cierre_bien, Validators.required],
resultadoCierre: [this.proyectos.uzytavproyec_cierre_resul, Validators.required],
servicioCierre: [this.proyectos.uzytavproyec_cierre_aplic, Validators.required],
impactoCierre: [this.proyectos.uzytavproyec_cierre_imp, Validators.required],
restricCierre: [this.proyectos.uzytavproyec_cierre_rest, Validators.required],
comenCierre: [this.proyectos.uzytavproyec_cierre_comen, Validators.required]
productoCierre: [this.proyectos.uzytavproyec_cierre_prod, [Validators.required, Validators.maxLength(500)]],
bienesCierre: [this.proyectos.uzytavproyec_cierre_bien, [Validators.required, Validators.maxLength(500)]],
resultadoCierre: [this.proyectos.uzytavproyec_cierre_resul, [Validators.required, Validators.maxLength(500)]],
servicioCierre: [this.proyectos.uzytavproyec_cierre_aplic, [Validators.required, Validators.maxLength(500)]],
impactoCierre: [this.proyectos.uzytavproyec_cierre_imp, [Validators.required, Validators.maxLength(500)]],
restricCierre: [this.proyectos.uzytavproyec_cierre_rest,[Validators.required, Validators.maxLength(500)]],
comenCierre: [this.proyectos.uzytavproyec_cierre_comen, [Validators.required, Validators.maxLength(500)]]
});
}
......@@ -84,6 +85,7 @@ export class ResultadosComponent implements OnInit {
this.proyectos.uzytavproyec_cierre_imp = this.myForm.get('impactoCierre').value;
this.proyectos.uzytavproyec_cierre_rest = this.myForm.get('restricCierre').value;
this.proyectos.uzytavproyec_cierre_comen = this.myForm.get('comenCierre').value;
console.log('observación', this.proyectos.uzytavproyec_cierre_comen)
this.proyectosService.modificarParametros(this.idRecuperado, this.proyectos).subscribe(response => {
this.cambio = false;
this.isEditorEnabled = false;
......@@ -91,7 +93,8 @@ export class ResultadosComponent implements OnInit {
});
} catch (error) {
console.error('Error al enviar los datos:', error);
console.error(error)
this.openEror();
}
}
}
......@@ -106,4 +109,14 @@ export class ResultadosComponent implements OnInit {
this.formularioEnviado = true;
});
}
openEror(){
const dialogRef = this.dialog.open(ErrorTextoComponent, {
disableClose: true
});
dialogRef.afterClosed().subscribe(result => {
this.formularioEnviado = true;
});
}
}
......@@ -37,6 +37,7 @@ export class ListarCoberturaProyectoComponent implements OnInit {
ngOnInit(): void {
this.idRecuperado = parseInt(localStorage.getItem('proyectoId'),10);
console.log('id', this.idRecuperado)
this.datosCompar.datos$.subscribe(() => {
this.obtenerRegistros();
this.obtenerProvincias();
......
import { Component, OnInit } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs';
......@@ -25,6 +25,8 @@ import { UsuariosService } from 'src/app/modules/main/services/usuarios/usuarios
styleUrls: ['./edit-datos-generales-proyecto.component.css']
})
export class EditDatosGeneralesProyectoComponent implements OnInit {
@Input() id: any;
myForm: FormGroup;
proyecto: Proyectos;
cambio: boolean;
......@@ -57,6 +59,7 @@ export class EditDatosGeneralesProyectoComponent implements OnInit {
) {
this.proyecto = new Proyectos();
console.log('pru',this.id)
}
ngOnInit(): void {
......
.area-busqueda {
padding: 20px;
margin-top: 30px;
display: flex;
justify-content: space-between;
align-items: center;
}
.contenedorP {
width: 96%;
margin-left: 2%;
margin-right: 2%;
margin: 5px auto;
border-radius: 10px;
text-align: center;
margin-top: 2%;
background-color: white;
}
.mat-mdc-radio-button ~ .mat-mdc-radio-button {
margin-left: 16px;
}
.mat-radio-button{
margin-right: 10px;
}
.form-container {
display: flex;
flex-direction: column;
align-items: center;
width: 80%;
}
.formulario {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
max-width: 96%;
margin: 0 auto;
background-color: white;
padding: 10px;
border-radius: 10px;
}
.contenedor-dos {
margin-top: 30px;
padding: 0.9375rem 20px;
position: relative;
}
.form-field {
width: 100%;
margin-bottom: 20px;
}
.separator {
margin: 0 5px;
opacity: 0;
pointer-events: none;
}
.separator2 {
margin: 5px 0;
opacity: 0;
pointer-events: none;
}
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { EditInformeComponent } from './edit-informe.component';
describe('EditInformeComponent', () => {
let component: EditInformeComponent;
let fixture: ComponentFixture<EditInformeComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ EditInformeComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(EditInformeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
@Component({
selector: 'vex-edit-informe',
templateUrl: './edit-informe.component.html',
styleUrls: ['./edit-informe.component.css']
})
export class EditInformeComponent implements OnInit {
idRecuperado: number;
myForm: FormGroup;
constructor(
private formBuilder: FormBuilder
) {
this.myForm = this.formBuilder.group({
fecha: [''],
observacion: [''],
});
}
ngOnInit(): void {
this.idRecuperado = parseInt(localStorage.getItem('proyectoId'),10);
}
}
/* Estilos generales */
.container {
width: 100%;
max-width: 1200px; /* Cambia este valor según tus necesidades */
margin: 0 auto;
padding: 20px;
box-sizing: border-box;
}
/* Estilos de la tabla */
.table-container {
overflow-x: auto;
}
table {
width: 100%;
max-width: 100%;
border-collapse: collapse;
font-family: 'Roboto', sans-serif;
color: #333;
border: 1px solid #e0e0e0;
}
table th,
table td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #e0e0e0;
}
table th {
background-color: rgb(248, 249, 250);
font-weight: bold;
text-transform: uppercase;
}
/* Ajuste de la celda que contiene el componente expandido */
td.expanded-cell {
padding: 0;
}
/* Estilos del botón de expansión */
.button-expand {
padding: 0;
border: none;
background-color: transparent;
cursor: pointer;
}
.button-expand mat-icon {
font-size: 24px;
}
/* Estilos del componente expandido */
.expanded-content {
padding: 10px;
background-color: white;
}
/* Estilos del botón de eliminación */
.button-delete {
border: none;
background-color: transparent;
cursor: pointer;
}
.button-delete mat-icon {
color: red;
}
/* Estilos del contenedor principal */
.contenedorP {
width: 100%;
margin: 10px auto;
border-radius: 10px;
text-align: center;
background-color: white;
}
/* Estilos de los botones redondos */
.rounder {
border-radius: 50%;
background-color: rgb(71, 127, 75);
display: flex;
align-items: center;
justify-content: center;
padding: 0;
width: 36px;
height: 36px;
border: none;
outline: none;
cursor: pointer;
}
.rounder mat-icon {
font-size: 24px;
color: #fff;
}
/* Estilos de los íconos de edición */
.colorEditar {
color: blue;
}
.colorEditar svg {
fill: blue;
}
/* Estilos del encabezado de la tabla */
.colorsito {
background-color: rgb(248, 249, 250);
}
/* Media Queries para pantallas pequeñas */
@media (max-width: 768px) {
table th,
table td {
padding: 8px;
}
}
@media (max-width: 1200px) {
table th,
table td {
padding: 10px;
}
}
<div class="container">
<div class="div-container">
<label class="label-negrita"><strong>Listado de informes de avance</strong></label>
</div>
<div class="mat-elevation-z8">
<table>
<thead>
<tr>
<th class="Column1"></th>
<th class="Column1 negrita">Nro</th>
<th class="Column1 negrita">Fecha</th>
<th class="Column1 negrita">Observación</th>
<th class="Column1 negrita">Acciones</th>
</tr>
</thead>
<tbody>
<ng-container *ngFor="let item of objetivoEspe; let i = index">
<tr id="fila-{{i}}">
<td>
<button (click)="toggleDiv(i)">
<mat-icon>{{ mostrarDiv[i] ? 'keyboard_arrow_down' :
'keyboard_arrow_right' }}</mat-icon>
</button>
</td>
<td>
{{i+1}}
</td>
<td>{{item.uzytavobjetivo_programaobjetivo_proy}}</td>
<td>{{item.uzytavobjetivo_programaindicador_tipo}}</td>
<td>
<button>
<mat-icon color="warn"
(click)="eliminar(item.uzytavobjetivo_programa_id)">delete</mat-icon>
</button>
</td>
</tr>
<!-- tabla interna para cada item -->
<tr *ngIf="mostrarDiv[i]">
<td colspan="8">
<div class="container">
<div class="">
<table>
<thead>
<tr>
<th class="Column1 negrita">Nro</th>
<th class="Column1 negrita">Descripción</th>
<th class="Column1 negrita">Tipo Indicador</th>
<th class="Column1 negrita">Valor Indicador</th>
<th class="Column1 negrita">Descripción Indicador</th>
<th class="Column1 negrita">Medio de Verificación</th>
<th class="Column1 negrita">Supuestos</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let acti of objetivoEspe; let i = index">
<ng-container
*ngIf="acti.uzytavobjetivo_programa_id_padre === item.uzytavobjetivo_programa_id">
<td>{{ i+1 }}</td>
<td>{{acti.uzytavobjetivo_programaobjetivo_proy}}</td>
<td>{{acti.uzytavobjetivo_programaindicador_tipo}}</td>
<td>{{acti.uzytavobjetivo_programaindicador_valor}}</td>
<td>{{acti.uzytavobjetivo_programaindicador}}</td>
<td>{{acti.uzytavobjetivo_programamverifica}}</td>
<td>{{acti.uzytavobjetivo_programasupuestos}}</td>
</ng-container>
</tr>
</tbody>
</table>
</div>
</div>
</td>
</tr>
</ng-container>
</tbody>
</table>
</div>
</div>
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ListInformeComponent } from './list-informe.component';
describe('ListInformeComponent', () => {
let component: ListInformeComponent;
let fixture: ComponentFixture<ListInformeComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ListInformeComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(ListInformeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { objetivoprograma } from 'src/app/modules/main/Models/objetivoPrograma';
@Component({
selector: 'vex-list-informe',
templateUrl: './list-informe.component.html',
styleUrls: ['./list-informe.component.css']
})
export class ListInformeComponent implements OnInit {
//para mostrar el div
mostrarDiv: boolean[] = [];
//objetivosEspe
objetivoEspe: objetivoprograma[] = [];
constructor() { }
ngOnInit(): void {
}
//toggle div para desplegar
toggleDiv(i: number){
this.mostrarDiv[i] = !this.mostrarDiv[i];
}
//acciones para eliminar
eliminar(id: number){
}
}
......@@ -47,7 +47,7 @@ export class AddCronogramaActiComponent implements OnInit {
private objM: objetivoprograma
) {
this.myForm = this.formBuilder.group({
Actividades: [''],
Actividades: ['', Validators.required],
fechaIni: ['', Validators.required],
fechaFin: ['', Validators.required],
horaFin: ['', Validators.required],
......
......@@ -17,41 +17,37 @@
<button mat-raised-button color="primary" *ngIf="ocultar"
(click)="AgregarF()" [disabled]="myForm.get('hitos').invalid">Agregar
Fecha</button>
<button mat-raised-button color="primary" *ngIf="showDataAdd">Guardar</button>
<button mat-raised-button color="primary" *ngIf="showDataAdd" (click)="enviarInfo()">Guardar</button>
<span class="separator"></span>
<button mat-raised-button color="warn" *ngIf="showDataAdd"
(click)="cancelarF()">Cancelar</button>
</div>
<div class="separator2"></div>
<!--fecha de inicio-->
<div *ngIf="showDataAdd">
<mat-label><strong>Fecha de Inicio:</strong></mat-label>
<mat-form-field class="form-field">
<mat-label>Fecha de inicio</mat-label>
<input matInput [matDatepicker]="pickerInicio" formControlName="fechaIniHitos">
<mat-datepicker-toggle matSuffix [for]="pickerInicio"></mat-datepicker-toggle>
<mat-datepicker #pickerInicio></mat-datepicker>
</mat-form-field>
<!-- Descripcion-->
<mat-form-field class="form-field">
<mat-label>Hora de inicio</mat-label>
<input matInput type="time" formControlName="horaIniHitos">
<mat-label>Descripción</mat-label>
<input matInput formControlName="descrip">
</mat-form-field>
<!--fecha de fin-->
<mat-label><strong>Fecha de Fin:</strong></mat-label>
<mat-label><strong>Fecha</strong></mat-label>
<mat-form-field class="form-field">
<mat-label>Fecha Fin:</mat-label>
<input matInput [matDatepicker]="pickerFin" formControlName="fechaFinHitos">
<mat-datepicker-toggle matSuffix [for]="pickerFin"></mat-datepicker-toggle>
<mat-datepicker #pickerFin></mat-datepicker>
<mat-label>Fecha:</mat-label>
<input matInput [matDatepicker]="pickerInicio"
formControlName="fechaIniHitos">
<mat-datepicker-toggle matSuffix [for]="pickerInicio"></mat-datepicker-toggle>
<mat-datepicker #pickerInicio></mat-datepicker>
</mat-form-field>
<!--fecha por defecto-->
<mat-form-field class="form-field">
<mat-label>Hora de Fin</mat-label>
<input matInput type="time" formControlName="horaFinHitos">
<mat-label>Resultados Esperados</mat-label>
<input matInput formControlName="resultados">
</mat-form-field>
</div>
</form>
</div>
......
......@@ -3,9 +3,11 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { CalendarOptions, EventApi, EventClickArg, EventInput } from '@fullcalendar/core';
import dayGridPlugin from '@fullcalendar/daygrid';
import moment from 'moment';
import { seguim } from 'src/app/modules/main/Models/hito';
import { objetivoprograma } from 'src/app/modules/main/Models/objetivoPrograma';
import { Actualiza_datosService } from 'src/app/modules/main/services/actualiza_datos/actualiza_datos.service';
import { Compartir_idService } from 'src/app/modules/main/services/compartir_id/compartir_id.service';
import { HitosService } from 'src/app/modules/main/services/hitos/hitos.service';
import { Objetivo_programaService } from 'src/app/modules/main/services/objetivo_programa/objetivo_programa.service';
@Component({
selector: 'vex-add-hitos',
......@@ -34,14 +36,15 @@ export class AddHitosComponent implements OnInit {
private idCompartido: Compartir_idService,
private datosCompartidos: Actualiza_datosService,
private objM: objetivoprograma,
private objPS: Objetivo_programaService
private objPS: Objetivo_programaService,
private hitoS: HitosService,
private hitoM: seguim
) {
this.myForm = this.formBuilder.group({
hitos: [''],
hitos: ['', Validators.required],
fechaIniHitos: ['', Validators.required],
fechaFinHitos: ['', Validators.required],
horaFinHitos: ['', Validators.required],
horaIniHitos: ['', Validators.required],
descrip: ['', Validators.required],
resultados: ['', Validators.required]
});
}
......@@ -82,6 +85,7 @@ export class AddHitosComponent implements OnInit {
const eventoSeleccionado = info.event;
const id = parseInt(eventoSeleccionado.id, 10);
this.eliminarFechas(id);
}
onUpdate(){
......@@ -89,21 +93,16 @@ export class AddHitosComponent implements OnInit {
const id_recuperado = this.myForm.get('hitos').value;
try {
const fechaIni = moment(this.myForm.get('fechaIniHitos').value).utc().toDate();
const horaIni = moment(this.myForm.get('horaIniHitos').value, 'HH:mm').utc().toDate();
const fechaHoraIni = new Date(fechaIni);
fechaHoraIni.setUTCHours(horaIni.getUTCHours());
fechaHoraIni.setUTCMinutes(horaIni.getUTCMinutes());
fechaHoraIni.setUTCHours(fechaHoraIni.getUTCHours() - 5);
const fechaHoraSecond = new Date(fechaIni);
fechaHoraSecond.setUTCHours(fechaHoraSecond.getUTCHours() - 3)
this.objM.uzytavobjetivo_programafec_ini = fechaHoraIni;
const fechaFin = moment(this.myForm.get('fechaFinHitos').value).utc().toDate();
const horaFin = moment(this.myForm.get('horaFinHitos').value, 'HH:mm').utc().toDate();
const fechaHoraFin = new Date(fechaFin);
fechaHoraFin.setUTCHours(horaFin.getUTCHours());
fechaHoraFin.setUTCMinutes(horaFin.getUTCMinutes());
fechaHoraFin.setUTCHours(fechaHoraFin.getUTCHours() - 5);
this.objM.uzytavobjetivo_programafec_fin = fechaHoraFin;
this.objM.uzytavobjetivo_programafec_fin = fechaHoraSecond;
this.objPS.modificarParametros(id_recuperado, this.objM).subscribe(response => {
this.showDataAdd = false;
this.ocultar = true;
......@@ -117,6 +116,32 @@ export class AddHitosComponent implements OnInit {
}
}
enviarInfo(){
if (this.myForm.valid) {
const id_recuperado = this.myForm.get('hitos').value;
try {
const fechaIni = moment(this.myForm.get('fechaIniHitos').value).utc().toDate();
const fechaHoraIni = new Date(fechaIni);
fechaHoraIni.setUTCHours(fechaHoraIni.getUTCHours() - 5);
this.hitoM.uzytavseguim_fecha_logro = fechaHoraIni
this.hitoM.uzytavproyec_id = this.idProyecto;
this.hitoM.uzytavobjetivo_programa_id = id_recuperado;
this.hitoM.uzytavseguim_descrip = this.myForm.get('descrip').value;
this.hitoM.uzytavseguim_logro = this.myForm.get('resultados').value;
this.hitoS.guardarParametros(this.hitoM).subscribe(response => {
});
} catch (error) {
console.error('Error al enviar los datos:', error);
}
}
}
AgregarF(){
this.showDataAdd = true;
this.ocultar = false;
......
table {
width: 100%;
}
/* Estilos generales */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.sinborder {
text-align: center;
font-weight: bold;
}
.General th {
padding: 10px;
border: 1px solid black;
font-weight: bold;
background-color: #b6b6b6
}
.Duracion th {
padding: 4px;
border: 1px solid black;
font-weight: bold;
background-color: #b6b6b6
}
.encabezado table {
width: 100%;
border-collapse: collapse;
}
.encabezado td {
padding: 10px;
border: 1px solid black;
}
.encabezado .image-cell img {
max-width: 100px;
height: auto;
}
.encabezado .center-cell {
text-align: center;
font-weight: bold;
}
/* Estilos para la tabla de detalles */
.detalle-table {
margin-top: 20px;
width: 100%;
border-collapse: collapse;
}
.detalle-table td {
padding: 5px;
border: 1px solid black;
}
.detalle-table .codigo-cell {
width: 30%;
font-weight: bold;
}
/* Estilos para el pie de página */
.pie {
margin-top: 20px;
text-align: center;
font-size: 12px;
}
.Column {
padding-left: 0px;
padding-right: 0px;
width: 100px;
white-space: inherit;
}
.Column1 negrita {
font-weight: bold;
}
.Column1 {
padding-left: 0px;
padding-right: 0px;
width: 10px;
white-space: normal;
overflow: visible;
}
.Column2 {
width: 25px;
padding-left: 0px;
padding-right: 0px;
}
.label-negrita {
font-weight: bold;
margin-right: 10px;
margin-top: 10px;
}
.div-container {
display: flex;
align-items: center;
padding: 0%;
}
.container {
padding: 0%;
margin: none;
}
.Marco_Lógico tr {
border: 5px;
}
.containerActividades {
padding: 0%;
border-left: 15px;
}
.container tr {
border-top: 3%;
border-width: 3%;
}
.separa {
margin-top: 3%;
}
.grid-container {
display: grid;
grid-template-columns: 5% 10% 45% 10% 5% 10% 15%;
border: 1px solid #ccc;
}
table,
th,
tr,
td {
border: 1px solid black;
border-collapse: collapse;
padding: 5px;
}
.mat-elevation-z8 table {
border-collapse: collapse;
width: 100%;
}
.mat-elevation-z8 th,
.mat-elevation-z8 td {
border: 1px solid black;
text-align: left;
}
.mat-elevation-z8 th {
background-color: #f2f2f2;
}
\ No newline at end of file
<div class="container">
<table>
<tr class="Duracion">
<th colspan="8">Aporte de la Comunidad Beneficiaria </th>
</tr>
</table>
<table>
<tr class="Duracion">
<th class="Column1 negrita">Nro</th>
<th class="Column negrita">Bien y/o Servicio</th>
<th class="Column negrita">Descripción</th>
<th class="Column negrita">Cantidad</th>
<th class="Column negrita">Valor Unitario USD</th>
<th class="Column negrita">Total USD</th>
</tr>
<tr *ngFor="let datoss of presupuestoPartidas; let i = index">
<td class="Column1">{{ i + 1 }}</td>
<td class="Column">{{ datoss.uzytavpresup_bien_servicio }}</td>
<td class="Column">{{ datoss.uzytavpresup_esptecnic }}</td>
<td class="Column">{{ datoss.uzytavpresup_cantidad }}</td>
<td class="Column">{{ datoss.uzytavpresup_valor }}</td>
<td class="Column">{{ (datoss.uzytavpresup_valor * datoss.uzytavpresup_cantidad) | number:'1.2-2' }}</td>
</tr>
<tr >
<th> Total: </th>
<th colspan="5" style="text-align: center;"> {{totalSuma}} </th>
</tr>
</table>
</div>
\ No newline at end of file
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { ListComunidadComponent } from './list-comunidad.component';
describe('ListComunidadComponent', () => {
let component: ListComunidadComponent;
let fixture: ComponentFixture<ListComunidadComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ListComunidadComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ListComunidadComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit, ViewChild } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatTable, MatTableDataSource } from '@angular/material/table';
import { CatalogoPP } from 'src/app/modules/main/Models/catalogo-partidas-presupuestarias';
import { PartidasPresupuestarias } from 'src/app/modules/main/Models/partidas-presupuestarias';
import { PresupuestoPartidas } from 'src/app/modules/main/Models/presupuesto-partidas';
import { Actualiza_datosService } from 'src/app/modules/main/services/actualiza_datos/actualiza_datos.service';
import { Compartir_idService } from 'src/app/modules/main/services/compartir_id/compartir_id.service';
import { PresupuestoPartidasService } from 'src/app/modules/main/services/presupuesto-partidas/presupuesto-partidas.service';
@Component({
selector: 'app-list-comunidad',
templateUrl: './list-comunidad.component.html',
styleUrls: ['./list-comunidad.component.css']
})
export class ListComunidadComponent implements OnInit {
idRecuperado: number;
totalSuma: number = 0;
dataSource: MatTableDataSource<PresupuestoPartidas>;
claPre: PartidasPresupuestarias;
partida!: CatalogoPP[];
nombrePartida: string;
politicas: any[] = [];
objetivos: any[] = [];
presupuestoPartidas!: PresupuestoPartidas[];
constructor(
private presupuestoPartidasService: PresupuestoPartidasService,
private id_Compartido: Compartir_idService,
private dialog: MatDialog,
private datosCompartidos: Actualiza_datosService,
) {
this.claPre = new PartidasPresupuestarias();
this.dataSource = new MatTableDataSource<PresupuestoPartidas>([]);
}
ngOnInit(): void {
this.idRecuperado = parseInt(localStorage.getItem('proyectoId'),10);
this.datosCompartidos.datos$.subscribe(() => {
this.obtenerRegistros();
});
this.presupuestoPartidasService.parametrosActualizados.subscribe(() => {
this.obtenerRegistros();
});
}
getSubgrupo3(item: any): string {
return (
item.uzytclasificador_presup_id +
'. ' +
(item.uzytclasificador_presup_nombre || '')
);
}
obtenerRegistros() {
if (this.idRecuperado !== undefined) {
this.presupuestoPartidasService.obtenerRegistrosRelacionadosComunidadProyecto(this.idRecuperado).subscribe(data => {
if (data !== undefined) {
this.presupuestoPartidas = data;
this.dataSource.data = this.presupuestoPartidas;
// Calcular los totales
this.calcularTotales();
// Fetch the names for the given uzytavclaspre_id
}
});
}
}
calcularTotales() {
this.totalSuma = this.presupuestoPartidas.reduce((total, dato) => {
return total + dato.uzytavpresup_valor * dato.uzytavpresup_cantidad;
}, 0);
this.totalSuma = parseFloat(this.totalSuma.toFixed(2));
}
eliminarParametros(id: number) {
const confirmacion = confirm('¿Desea eliminar el registro?');
if (confirmacion) {
this.presupuestoPartidasService.eliminarParametros(id).subscribe(
(response) => {
console.log('El registro se ha eliminado exitosamente.');
this.obtenerRegistros(); // Refresh the records after successful deletion
},
(error) => {
console.log('Error during the treatment of the record', error);
}
);
}
}
}
table {
width: 100%;
}
/* Estilos generales */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.sinborder {
text-align: center;
font-weight: bold;
}
.General th {
padding: 10px;
border: 1px solid black;
font-weight: bold;
background-color: #b6b6b6
}
.Duracion th {
padding: 4px;
border: 1px solid black;
font-weight: bold;
background-color: #b6b6b6
}
.encabezado table {
width: 100%;
border-collapse: collapse;
}
.encabezado td {
padding: 10px;
border: 1px solid black;
}
.encabezado .image-cell img {
max-width: 100px;
height: auto;
}
.encabezado .center-cell {
text-align: center;
font-weight: bold;
}
/* Estilos para la tabla de detalles */
.detalle-table {
margin-top: 20px;
width: 100%;
border-collapse: collapse;
}
.detalle-table td {
padding: 5px;
border: 1px solid black;
}
.detalle-table .codigo-cell {
width: 30%;
font-weight: bold;
}
/* Estilos para el pie de página */
.pie {
margin-top: 20px;
text-align: center;
font-size: 12px;
}
.Column {
padding-left: 0px;
padding-right: 0px;
width: 100px;
white-space: inherit;
}
.Column1 negrita {
font-weight: bold;
}
.Column1 {
padding-left: 0px;
padding-right: 0px;
width: 10px;
white-space: normal;
overflow: visible;
}
.Column2 {
width: 25px;
padding-left: 0px;
padding-right: 0px;
}
.label-negrita {
font-weight: bold;
margin-right: 10px;
margin-top: 10px;
}
.div-container {
display: flex;
align-items: center;
padding: 0%;
}
.container {
padding: 0%;
margin: none;
}
.Marco_Lógico tr {
border: 5px;
}
.containerActividades {
padding: 0%;
border-left: 15px;
}
.container tr {
border-top: 3%;
border-width: 3%;
}
.separa {
margin-top: 3%;
}
.grid-container {
display: grid;
grid-template-columns: 5% 10% 45% 10% 5% 10% 15%;
border: 1px solid #ccc;
}
table,
th,
tr,
td {
border: 1px solid black;
border-collapse: collapse;
padding: 5px;
}
.mat-elevation-z8 table {
border-collapse: collapse;
width: 100%;
}
.mat-elevation-z8 th,
.mat-elevation-z8 td {
border: 1px solid black;
text-align: left;
}
.mat-elevation-z8 th {
background-color: #f2f2f2;
}
\ No newline at end of file
<div class="container">
<table>
<tr class="Duracion">
<th colspan="8">Aporte de la Entidad Auspiciante </th>
</tr>
</table>
<table>
<tr class="Duracion">
<th class="Column1 negrita">Nro</th>
<th class="Column negrita">Bien y/o Servicio</th>
<th class="Column negrita">Descripción</th>
<th class="Column negrita">Cantidad</th>
<th class="Column negrita">Valor Unitario USD</th>
<th class="Column negrita">Total USD</th>
</tr>
<!-- Lógica de iteración para llenar la tabla -->
<tr *ngFor="let datos of presupuestoPartidas; let i = index">
<td class="Column1">{{ i + 1 }}</td>
<td class="Column">{{ datos.uzytavpresup_bien_servicio }}</td>
<td class="Column">{{ datos.uzytavpresup_esptecnic }}</td>
<td class="Column">{{ datos.uzytavpresup_cantidad }}</td>
<td class="Column">{{ datos.uzytavpresup_valor }}</td>
<td class="Column">{{ (datos.uzytavpresup_valor * datos.uzytavpresup_cantidad) | number:'1.2-2' }}</td>
</tr>
<tr colspan="4">
<th> Total: </th>
<th colspan="5" style="text-align: center;"> {{totalSuma}} </th>
</tr>
<!-- Fin de la iteración -->
</table>
</div>
\ No newline at end of file
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { ListEntidadComponent } from './list-entidad.component';
describe('ListEntidadComponent', () => {
let component: ListEntidadComponent;
let fixture: ComponentFixture<ListEntidadComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ListEntidadComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ListEntidadComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit, ViewChild } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatTable, MatTableDataSource } from '@angular/material/table';
import { CatalogoPP } from 'src/app/modules/main/Models/catalogo-partidas-presupuestarias';
import { PartidasPresupuestarias } from 'src/app/modules/main/Models/partidas-presupuestarias';
import { PresupuestoPartidas } from 'src/app/modules/main/Models/presupuesto-partidas';
import { Actualiza_datosService } from 'src/app/modules/main/services/actualiza_datos/actualiza_datos.service';
import { Compartir_idService } from 'src/app/modules/main/services/compartir_id/compartir_id.service';
import { PresupuestoPartidasService } from 'src/app/modules/main/services/presupuesto-partidas/presupuesto-partidas.service';
@Component({
selector: 'app-list-entidad',
templateUrl: './list-entidad.component.html',
styleUrls: ['./list-entidad.component.css']
})
export class ListEntidadComponent implements OnInit {
idRecuperado: number;
totalSuma: number = 0;
dataSource: MatTableDataSource<PresupuestoPartidas>;
claPre: PartidasPresupuestarias;
partida!: CatalogoPP[];
nombrePartida: string;
politicas: any[] = [];
objetivos: any[] = [];
presupuestoPartidas!: PresupuestoPartidas[];
@ViewChild(MatTable) table: MatTable<any>;
constructor(
private presupuestoPartidasService: PresupuestoPartidasService,
private id_Compartido: Compartir_idService,
private dialog: MatDialog,
private datosCompartidos: Actualiza_datosService,
) {
this.claPre = new PartidasPresupuestarias();
this.dataSource = new MatTableDataSource<PresupuestoPartidas>([]);
}
ngOnInit(): void {
this.idRecuperado = parseInt(localStorage.getItem('proyectoId'),10);
this.datosCompartidos.datos$.subscribe(() => {
this.obtenerRegistros();
});
this.presupuestoPartidasService.parametrosActualizados.subscribe(() => {
this.obtenerRegistros();
});
}
getSubgrupo3(item: any): string {
return (
item.uzytclasificador_presup_id +
'. ' +
(item.uzytclasificador_presup_nombre || '')
);
}
obtenerRegistros() {
this.idRecuperado = this.idRecuperado;
if (this.idRecuperado !== undefined) {
this.presupuestoPartidasService.obtenerRegistrosRelacionadosEntidadProyecto(this.idRecuperado).subscribe(data => {
if (data !== undefined) {
this.presupuestoPartidas = data;
this.dataSource.data = this.presupuestoPartidas;
// Calcular los totales
this.calcularTotales();
// Fetch the names for the given uzytavclaspre_id
}
});
}
}
calcularTotales() {
this.totalSuma = this.presupuestoPartidas.reduce((total, dato) => {
return total + dato.uzytavpresup_valor * dato.uzytavpresup_cantidad;
}, 0);
this.totalSuma = parseFloat(this.totalSuma.toFixed(2));
}
eliminarParametros(id: number) {
const confirmacion = confirm('¿Desea eliminar el registro?');
if (confirmacion) {
this.presupuestoPartidasService.eliminarParametros(id).subscribe(
(response) => {
console.log('El registro se ha eliminado exitosamente.');
this.obtenerRegistros(); // Refresh the records after successful deletion
},
(error) => {
console.log('Error during the treatment of the record', error);
}
);
}
}
}
......@@ -52,7 +52,7 @@
</mat-panel-title>
</mat-expansion-panel-header>
<!--Datos generales internos-->
<app-edit-datos-generales-proyecto></app-edit-datos-generales-proyecto>
<app-edit-datos-generales-proyecto [id]="id_d"></app-edit-datos-generales-proyecto>
<!--fin-->
</mat-expansion-panel>
......@@ -447,7 +447,7 @@
Ver y descargar PDF.
</mat-panel-title>
</mat-expansion-panel-header>
<!-- <vex-pdf></vex-pdf> -->
<app-pdf></app-pdf>
<!--fin-->
</mat-expansion-panel>
......@@ -543,7 +543,8 @@
1.- Informes de avance
</mat-panel-title>
</mat-expansion-panel-header>
<vex-edit-informe></vex-edit-informe>
<vex-list-informe></vex-list-informe>
<!--fin-->
</mat-expansion-panel>
......@@ -637,7 +638,9 @@
3.- Presupuesto ejecutado
</mat-panel-title>
</mat-expansion-panel-header>
<app-aporte-uni-ejec></app-aporte-uni-ejec>
<app-aporte-ent-ejec></app-aporte-ent-ejec>
<app-aporte-com-ejec></app-aporte-com-ejec>
<!--fin-->
</mat-expansion-panel>
......
import { Component, OnInit } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Compartir_idService } from 'src/app/modules/main/services/compartir_id/compartir_id.service';
@Component({
......@@ -7,7 +7,6 @@ import { Compartir_idService } from 'src/app/modules/main/services/compartir_id/
styleUrls: ['./edit-proyecto.component.css']
})
export class EditProyectoComponent implements OnInit {
contraccion = false;
mostraContraccion = false;
mostrarFormulario: boolean = false;
......@@ -18,7 +17,7 @@ export class EditProyectoComponent implements OnInit {
mostrarPresupuestoDetallado: boolean = false;
mostrarCompro: boolean = false;
mostrarEstra: boolean = false;
id_d: number = 19;
idRecu: number;
constructor(private router: Router,
private idCompartid: Compartir_idService) {
......@@ -26,7 +25,6 @@ export class EditProyectoComponent implements OnInit {
ngOnInit(): void {
this.idRecu = parseInt(localStorage.getItem('proyectoId'),10);
localStorage.setItem('proyectoId',this.idRecu.toString());
}
......
.modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
}
.modal-content {
background-color: white;
padding: 20px;
border-radius: 4px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
max-width: 400px;
width: 100%;
text-align: center;
position: relative;
}
.success-icon {
font-size: 80px;
color: #006400;
margin-right: 1em;
}
.modal-content p {
margin-bottom: 20px;
}
.modal-content button {
background-color: #2196f3;
color: white;
border: none;
padding: 10px 20px;
border-radius: 4px;
cursor: pointer;
}
.modal-content button:hover {
background-color: #0c7cd5;
}
<div class="modal">
<div class="modal-content">
<p>
La información excede el maximo de caracteres</p>
<button mat-button (click)="closeModal()">Cerrar</button>
</div>
</div>
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ErrorTextoComponent } from './error-texto.component';
describe('ErrorTextoComponent', () => {
let component: ErrorTextoComponent;
let fixture: ComponentFixture<ErrorTextoComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ErrorTextoComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(ErrorTextoComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { MatDialogRef } from '@angular/material/dialog';
@Component({
selector: 'vex-error-texto',
templateUrl: './error-texto.component.html',
styleUrls: ['./error-texto.component.css']
})
export class ErrorTextoComponent implements OnInit {
formularioEnviado = true;
constructor(
private dialogRef: MatDialogRef<ErrorTextoComponent>
) { }
ngOnInit(): void {
}
closeModal() {
this.dialogRef.close();
}
}
......@@ -136,6 +136,7 @@ export class ListaProyectosComponent implements OnInit {
agregarP() {
this.router.navigate(['main/Proyecto-Inicial']);
}
editar(id: number) {
const registroSeleccionado = this.proyectos.find(
proyectoFind => proyectoFind.uzytavproyec_id === id
......
......@@ -113,6 +113,7 @@ body {
.container {
padding: 0%;
margin: none;
}
.Marco_Lógico tr {
......
<div id="PDF">
<div class="encabezado">
<table>
<tr>
<td class="image-cell"> img </td>
<td style="max-width: 200px;">
<img style="margin-top: 2px; max-width: 100%; height: auto;" alt="clik aqui"
src="../../../../../assets/img/espe/logo-espe.png">
</td>
<td class="center-cell">VINCULACIÓN CON LA SOCIEDAD DE LA LINEA OPERATIVA DE PROYECTOS SOCIALES</td>
<td class="sinborder" style="
padding: 0px;
border: 0px;">
<tr>
<td colspan="2">Unidad de Gestión de la Vinculación</td>
</tr>
<table>
<table>
<tr colspan="2">
<th colspan="2">Unidad de Gestión de la Vinculación</th>
</tr>
<tr>
<td>Código de documento:</td>
<td>1</td>
......@@ -29,8 +32,6 @@
<br>
<br>
<table>
<tr class="General">
<th>1. DATOS GENERALES</th>
......@@ -46,7 +47,6 @@
<td>{{ proyecto?.uzytavproyec_nombre }}</td>
</tr>
</table>
<br>
<table>
......@@ -54,62 +54,42 @@
<td>{{ tipoCobertura }}</td>
</table>
<br>
<app-listar-cobertura-proyecto></app-listar-cobertura-proyecto>
<!-- <div class="mat-elevation-z8">
<table mat-table [dataSource]="dataSource" matSort>
<ng-container matColumnDef="Nro" class="Column1">
<th class="Column1 negrita" mat-header-cell *matHeaderCellDef mat-sort-header> Nro </th>
<td class="Column1" mat-cell *matCellDef="let i = index"> {{ i+1 }}
</td>
</ng-container>
<ng-container matColumnDef="Provincia" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Provincia </th>
<td class="Column" mat-cell *matCellDef="let dato"> {{ getProvinciaNombre(dato.uzytprovincia_id)}} </td>
</ng-container>
<ng-container matColumnDef="Canton" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Cantón </th>
<td class="Column" mat-cell *matCellDef="let dato"> {{ getCantonNombre(dato.uzytcanton_id)}} </td>
</ng-container>
<ng-container matColumnDef="Parroquia" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Parroquia </th>
<td class="Column" mat-cell *matCellDef="let dato"> {{getParroquiaNombre(dato.uzytparroquia_id)}} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
<div>
<table>
<thead>
<tr class="Duracion">
<th>Nro</th>
<th>Provincia</th>
<th>Cantón</th>
<th>Parroquia</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let parametro of zonaDM; let i = index">
<td>{{ i + 1 }}</td>
<td>{{ getProvinciaNombre(parametro.uzytprovincia_id) }}</td>
<td>{{ getCantonNombre(parametro.uzytcanton_id) }}</td>
<td>{{ getParroquiaNombre(parametro.uzytparroquia_id) }}</td>
</tr>
</tbody>
</table>
</div> -->
</div>
<br>
<table>
<tr class="Duracion">
<th colspan="3"> Plazo de ejecución </th>
</tr>
<tr>
<th>Fecha de inicio planificada</th>
<th>Fecha de finalización planificada</th>
<th>Duración</th>
</tr>
<!-- Fila de resultados -->
<tr>
<td>{{ formatFecha(proyecto?.uzytavproyec_fecha_inicio) }}</td>
<td>{{ formatFecha(proyecto?.uzytavproyec_fecha_finaliza) }}</td>
<td>{{ duracionProyecto }}</td>
</tr>
</table>
<br>
......@@ -118,12 +98,10 @@
<tr class="Duracion">
<th colspan="4"> Director del proyecto </th>
</tr>
<tr>
<th>Nombre y Apellido:</th>
<td colspan="3">{{ usuario?.uzytusuario_nombres }} {{ usuario?.uzytusuario_apellidos }} </td>
</tr>
<!-- Fila de resultados -->
<tr>
<th>Departamento:</th>
<td>{{ usuario?.uzytusuario_departamento }}</td>
......@@ -141,23 +119,18 @@
<br>
<table>
<tr class="Duracion">
<th colspan="2"> El proyecto social es resultado de </th>
</tr>
<tr *ngFor="let objetivo of objetivoPro">
<th>Otro</th>
<td>{{ objetivo.uzytavobjetivo_programaobjetivo_proy }}</td>
</tr>
</table>
<br>
<table>
<tr class="Duracion">
<th colspan="3"> Detalle de entregables del proyecto </th>
</tr>
......@@ -166,29 +139,22 @@
<th>Otro</th>
<td>{{ objetivo.uzytavobjetivo_programaobjetivo_proy }}</td>
</tr>
</table>
<br>
<table>
<tr class="Duracion">
<th colspan="2"> El proyecto social es resultado de </th>
</tr>
<tr style="text-align: center;">
<tr>
<th>Tipo</th>
<th>Descripción</th>
</tr>
<tr>
<th>Otro</th>
<td>Otros posibles impactos que el proyecto podría generar al finalizar la ejecución.</td>
</tr>
</table>
<br>
......@@ -197,7 +163,6 @@
<tr class="General">
<th>2. DIAGNÓSTICO Y PROBLEMA </th>
</tr>
<tr>
<th>Descripción de la situación actual del área de intervención del proyecto: </th>
</tr>
......@@ -215,41 +180,30 @@
<td>Ninguna</td>
</tr>
</table>
<br>
<table>
<tr class="General">
<th colspan="8">3. MARCO LÓGICO </th>
</tr>
<app-add-matriz-logico></app-add-matriz-logico>
</table>
<br>
<!-- <div class="Marco_Lógico">
<div class="container">
<div class="mat-elevation-z8">
<div>
<table>
<tr>
<th class="Column1 negrita"></th>
<tr class="Duracion">
<th class="Column1 negrita">Tipo</th>
<th class="Column1 negrita">Descripción</th>
<th class="Column1 negrita">Tipo Indicador</th>
<th class="Column1 negrita">Valor Indicador</th>
<th class="Column1 negrita">Descripción Indicador</th>
<th class="Column1 negrita">Medio de Verificación</th>
<th class="Column1 negrita">Supuestos</th>
</tr>
<tr *ngIf="objetivoPro.length === 0">
<td colspan="7" class="Column1">Fin</td>
</tr>
<tr *ngFor="let item of objetivoPro">
<td class="Column1">Fin</td>
<td class="Column1">{{item.uzytavobjetivo_programaobjetivo_proy || ''}}</td>
......@@ -259,12 +213,12 @@
<td class="Column1">{{item.uzytavobjetivo_programaindicador || ''}}</td>
<td class="Column1">{{item.uzytavobjetivo_programamverifica || ''}}</td>
<td class="Column1">{{item.uzytavobjetivo_programasupuestos || ''}}</td>
</tr>
<tr *ngIf="objetivoProObj.length === 0">
<td colspan="7" class="Column1">Proposito(Objetivo General)</td>
<td class="Column1">
</td>
</tr>
<tr *ngFor="let objG of objetivoProObj">
<td class="Column1">Proposito(Objetivo General)</td>
......@@ -275,23 +229,23 @@
<td class="Column1">{{ objG.uzytavobjetivo_programaindicador || ''}}</td>
<td class="Column1">{{ objG.uzytavobjetivo_programamverifica || ''}}</td>
<td class="Column1">{{ objG.uzytavobjetivo_programasupuestos || ''}}</td>
</tr>
</table>
</div>
</div>
<div class="separa"></div>
<div class="container">
<div class="mat-elevation-z8">
<div class="div-container">
<label class="label-negrita">Componentes (objetivos específicos):</label>
<br>
</div>
<div class="container">
<div>
<table>
<tr class="Duracion">
<th colspan="8">Componentes (objetivos específicos): </th>
</tr>
</table>
<table>
<thead>
<tr>
<tr class="Duracion">
<th class="Column1 negrita">Nro</th>
<th class="Column1 negrita">Descripción</th>
<th class="Column1 negrita">Tipo Indicador</th>
......@@ -303,6 +257,7 @@
</thead>
<tbody>
<ng-container *ngFor="let item of objetivoProEsp; let i = index">
<br>
<tr id="fila-{{i}}">
<td>
{{i+1}}
......@@ -313,20 +268,19 @@
<td>{{item.uzytavobjetivo_programaindicador}}</td>
<td>{{item.uzytavobjetivo_programamverifica}}</td>
<td>{{item.uzytavobjetivo_programasupuestos}}</td>
</tr>
<tr>
<td colspan="8">
<div class="container">
<div class="mat-elevation-z8">
<div class="div-container">
<label class="label-negrita">Actividades: </label>
</div>
<div>
<table>
<tr class="Duracion">
<th colspan="8">Actividades </th>
</tr>
</table>
<table>
<thead>
<tr>
<tr class="Duracion">
<th class="Column1 negrita">Nro</th>
<th class="Column1 negrita">Descripción</th>
<th class="Column1 negrita">Tipo Indicador</th>
......@@ -347,7 +301,6 @@
<td>{{acti.uzytavobjetivo_programaindicador}}</td>
<td>{{acti.uzytavobjetivo_programamverifica}}</td>
<td>{{acti.uzytavobjetivo_programasupuestos}}</td>
</ng-container>
</tr>
</tbody>
......@@ -362,17 +315,11 @@
</div>
</div>
</div>
-->
<br>
<table>
<tr class="Duracion">
<th colspan="6"> Identificación y caracterización de la población objetivo (beneficiarios y participantes) </th>
</tr>
<tr>
<th>Item</th>
<th>Hombres</th>
......@@ -381,7 +328,6 @@
<th>Personas con discapacidades </th>
<th>Total </th>
</tr>
<tr>
<th>DIRECTOS</th>
<td>{{proyecto.uzytavproyec_directos_hombres}}</td>
......@@ -390,7 +336,6 @@
<td>{{proyecto.uzytavproyec_directos_discapac}}</td>
<td>{{ proyecto.uzytavproyec_directos_ejec}}</td>
</tr>
<tr>
<th>INDIRECTOS</th>
<td>{{proyecto.uzytavproyec_inidirectos_hombres}}</td>
......@@ -399,18 +344,52 @@
<td>{{proyecto.uzytavproyec_inidirectos_discapa }}</td>
<td>{{proyecto.uzytavproyec_indirectos }}</td>
</tr>
</table>
<br>
<div class="container">
<table>
<tr class="Duracion">
<th class="Column1 negrita">Nro</th>
<th class="Column negrita">Carrera</th>
<th class="Column negrita">Estudiantes Participantes</th>
</tr>
<tr *ngFor="let dato of estudianteParticipante; let i = index">
<td class="Column1">{{ i + 1 }}</td>
<td class="Column">{{ dato.carrera$ | async }}</td>
<td class="Column">{{ dato.uzytavestuparti_numero }}</td>
</tr>
<tr>
<td class="Column1 negrita" colspan="2">Total</td>
<td class="Column">{{ totalEstudianteParticipantes }}</td>
</tr>
</table>
</div>
<br>
<div class="container">
<table>
<app-listar-docentes-participantes></app-listar-docentes-participantes>
<br>
<app-listar-estudiantes-participantes></app-listar-estudiantes-participantes>
<br>
<tr class="Duracion">
<th class="Column1 negrita">Nro</th>
<th class="Column negrita">Campus</th>
<th class="Column negrita">Departamento</th>
<th class="Column negrita">Docentes Participantes</th>
</tr>
<tr *ngFor="let dato of docenteParticipante; let i = index">
<td class="Column1">{{ i + 1 }}</td>
<td class="Column">{{ dato.campus$ | async }}</td>
<td class="Column">{{ dato.departamento$ | async }}</td>
<td class="Column">{{ dato.uzytavdocparti_numero }}</td>
</tr>
<tr>
<td class="Column1 negrita" colspan="3">Total</td>
<td class="Column">{{ totalDocentesParticipantes }}</td>
</tr>
</table>
</div>
<br>
<table>
<tr class="General">
......@@ -420,32 +399,80 @@
<br>
<div class="container">
<table>
<tr class="Duracion">
<th colspan="8">Aporte de la Universidad </th>
</tr>
</table>
<table>
<app-aporte-universidad></app-aporte-universidad>
<tr class="Duracion">
<th class="Column1 negrita">Nro</th>
<th class="Column negrita">Partida Presupuestaria</th>
<th class="Column negrita">Descripción</th>
<th class="Column negrita">Tipo de Gasto</th>
<th class="Column negrita">Cantidad</th>
<th class="Column negrita">Valor Unitario USD</th>
<th class="Column negrita">Total USD</th>
</tr>
<tr *ngFor="let dato of presupuestoPartidas; let i = index">
<td class="Column1">{{ i + 1 }}</td>
<td class="Column">{{ dato.partida$ | async }}</td>
<td class="Column">{{ dato.uzytavpresup_esptecnic }}</td>
<td class="Column">
<ng-container [ngSwitch]="dato.uzytavpresup_tipogasto">
<span *ngSwitchCase="'C'">Permanente</span>
<span *ngSwitchCase="'I'">No Permanente</span>
</ng-container>
</td>
<td class="Column">{{ dato.uzytavpresup_cantidad }}</td>
<td class="Column">{{ dato.uzytavpresup_valor }}</td>
<td class="Column">{{ (dato.uzytavpresup_valor * dato.uzytavpresup_cantidad) | number:'1.2-2' }}</td>
</tr>
<tr>
<th> Total Permanente: </th>
<th> {{totalPermanente}} </th>
<th> Total No Permanente: </th>
<th> {{totalNoPermanente}} </th>
<th> Total:</th>
<th colspan="2" style="text-align: center;"> {{totalSuma}} </th>
</tr>
</table>
</div>
<br>
<app-aporte-entidad></app-aporte-entidad>
<app-list-entidad></app-list-entidad>
<br>
<app-aporte-comunidad></app-aporte-comunidad>
<app-list-comunidad></app-list-comunidad>
<br>
</table>
<table>
<tr class="General">
<th>5. ALINEAMIENTO DEL PROYECTO </th>
</tr>
</table>
<br>
<table>
<tr class="Duracion">
<th colspan="2"> ¿A qué objetivos de desarrollo sostenible 2030 se alinea el proyecto? </th>
</tr>
<vex-list-objetivos-plnbv></vex-list-objetivos-plnbv>
</table>
<br>
<table>
<!-- Cabecera de la tabla -->
<thead>
<tr class="Duracion">
<th colspan="2"> ¿A qué campos de educación y capacitación (CINE- UNESCO) apunta el Proyecto? </th>
<th class="header-cell">Nro</th>
<th class="header-cell">Objetivo PLNBV Descripción</th>
<th class="header-cell">Política Descripción</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let dato of objetiP; let i = index">
<td class="Column1">{{ i + 1 }}</td>
<td class="data-cell">{{ ObtenerNombrePadre(dato.uzytavobjetivo_b_vivir_id)}}</td>
<td class="data-cell">{{ ObtenerNombreHijo(dato.uzytavobjetivo_b_vivir_id) }}</td>
</tr>
<ex-list-linea></ex-list-linea>
</tbody>
</table>
<br>
......@@ -454,14 +481,27 @@
<tr class="Duracion">
<th colspan="2"> ¿A qué objetivo u objetivos del Plan de Desarrollo del Ecuador se respalda el Proyecto?: </th>
</tr>
<br>
<app-objetivos-provinciales> </app-objetivos-provinciales>
</table>
<table>
<thead>
<tr class="Duracion">
<th class="header-cell">Nro</th>
<th class="header-cell">Provincia</th>
<th class="header-cell">Cantón</th>
<th class="header-cell">Parroquia</th>
<th class="header-cell">Objetivos</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let dato of zonaDM; let i = index">
<td class="Column1">{{ i + 1 }}</td>
<td class="data-cell">{{ getProvinciaNombre(dato.uzytprovincia_id)}}</td>
<td class="data-cell">{{ getCantonNombre(dato.uzytcanton_id)}}</td>
<td class="data-cell">{{ getParroquiaNombre(dato.uzytparroquia_id)}}</td>
<td class="data-cell">{{ dato.uzytavzona_objetivos}}</td>
</tr>
</tbody>
</table>
<br>
......@@ -469,25 +509,117 @@
<tr class="Duracion">
<th colspan="2"> ¿A qué Objetivos Estratégicos Institucionales se alinea el Proyecto?: </th>
</tr>
<vex-list-objetivos-estra></vex-list-objetivos-estra>
</table>
<table>
<thead>
<tr class="Duracion">
<th class="header-cell">Nro</th>
<th class="header-cell">Perpectiva</th>
<th class="header-cell">Estrategia</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let dato of proObjM; let i = index">
<td class="Column1">{{ i + 1 }}</td>
<td class="data-cell">{{obtenerDescripcionPerspectiva(dato.uzytavobjetivos_ESTRA_INSTI_ID)}}</td>
<td class="data-cell">{{obtenerDescripcionObjetivo(dato.uzytavobjetivos_ESTRA_INSTI_ID) }}</td>
</tr>
</tbody>
</table>
<br>
<table>
<tr class="General">
<th> 6. ESTRATEGIA DE EJECUCIÓN-CRONOGRAMA </th>
</tr>
<vex-add-cronograma-acti></vex-add-cronograma-acti>
</table>
<div class="container">
<div>
<table>
<thead>
<tr class="Duracion">
<th colspan="8">Componente: </th>
</tr>
</thead>
<tbody>
<ng-container *ngFor="let item of actividadesA; let i = index">
<br>
<tr id="fila-{{i}}">
<td>{{item.uzytavobjetivo_programaobjetivo_proy}}</td>
</tr>
<tr>
<td colspan="8">
<div class="container">
<div>
<table>
<tr class="Duracion">
<th colspan="8">Actividades </th>
</tr>
</table>
<table>
<thead>
<tr class="Duracion">
<th class="Column1 negrita">Descripción</th>
<th class="Column1 negrita">Fecha Inicio</th>
<th class="Column1 negrita">Fecha Fin</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let acti of hitosA; let i = index">
<ng-container>
<td>{{acti.uzytavobjetivo_programaobjetivo_proy}}</td>
<td>{{formatFecha(acti.uzytavobjetivo_programafec_ini)}}</td>
<td>{{formatFecha(acti.uzytavobjetivo_programafec_fin)}}</td>
</ng-container>
</tr>
</tbody>
</table>
</div>
</div>
</td>
</tr>
<tr>
<td colspan="8">
<div class="container">
<div>
<table>
<tr class="Duracion">
<th colspan="8">Hitos </th>
</tr>
</table>
<table>
<thead>
<tr class="Duracion">
<th class="Column1 negrita">Entregable</th>
<th class="Column1 negrita">Evidencia</th>
<th class="Column1 negrita">Fecha</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let acti of actividadesA; let i = index">
<ng-container>
<td>{{acti.uzytavobjetivo_programaobjetivo_proy}}</td>
<td>{{acti.uzytavobjetivo_programasupuestos}}</td>
<td>{{formatFecha(acti.uzytavobjetivo_programafec_fin)}}</td>
</ng-container>
</tr>
</tbody>
</table>
</div>
</div>
</td>
</tr>
</ng-container>
</tbody>
</table>
</div>
</div>
<br>
</div>
<br>
<div>
<button class="btn col col-lg-4 btn-danger btn-block ml-4" (click)="downloadPDF()">Download PDF</button>
</div>
import { ComponentFixture, TestBed } from '@angular/core/testing';
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { PdfComponent } from './pdf.component';
......@@ -6,12 +9,14 @@ describe('PdfComponent', () => {
let component: PdfComponent;
let fixture: ComponentFixture<PdfComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PdfComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PdfComponent);
component = fixture.componentInstance;
fixture.detectChanges();
......
import { Component, OnInit } from '@angular/core';
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import jsPDF from 'jspdf';
import html2canvas from 'html2canvas';
import { Proyectos } from '../../../Models/proyectos';
import { Usuario } from '../../../Models/usuario';
import { objetivoprograma } from '../../../Models/objetivoPrograma';
import { ZonaDetalle } from '../../../Models/zona_detalle';
import { MatTableDataSource } from '@angular/material/table';
import { Parroquia } from '../../../Models/Ubicaciones/parroquia';
import { Canton } from '../../../Models/Ubicaciones/canton';
import { Provincia } from '../../../Models/Ubicaciones/provincia';
import { Observable } from 'rxjs';
import { Carrera } from '../../../Models/carrera';
import { PoblacionProyecto } from '../../../Models/poblacion-proyecto';
import { Poblacion } from '../../../Models/poblacion';
import { Programa } from '../../../Models/programa-v';
import { Proyectos } from '../../../Models/proyectos';
import { Poblacion } from '../../../Models/poblacion';
import { PoblacionProyecto } from '../../../Models/poblacion-proyecto';
import { Carrera } from '../../../Models/carrera';
import { Observable, map } from 'rxjs';
import { FormBuilder } from '@angular/forms';
import { Compartir_idService } from '../../../services/compartir_id/compartir_id.service';
import { ProyectosService } from '../../../services/proyectos/proyectos.service';
import { UsuariosService } from '../../../services/usuarios/usuarios.service';
import { MostrarOcultarService } from '../../../services/mostrar-ocultar.service';
import { PoblacionService } from '../../../services/población/poblacion.service';
import { UsuariosService } from '../../../services/usuarios/usuarios.service';
import { PoblacionProyectoService } from '../../../services/poblacion-proyecto/poblacion-proyecto.service';
import { ActivatedRoute } from '@angular/router';
import { DatosEspeService } from '../../../services/APIs Externas/Datos espe/datos-espe.service';
import { ProgramaService } from '../../../services/programa/programa.service';
import { Provincia } from '../../../Models/Ubicaciones/provincia';
import { Canton } from '../../../Models/Ubicaciones/canton';
import { Parroquia } from '../../../Models/Ubicaciones/parroquia';
import { Zona_detalleService } from '../../../services/zona_detalle/zona_detalle.service';
import { UbicacionesService } from '../../../services/Ubicaciones/ubicaciones.service';
import { Actualiza_datosService } from '../../../services/actualiza_datos/actualiza_datos.service';
import { Objetivo_programaService } from '../../../services/objetivo_programa/objetivo_programa.service';
import { UbicacionesService } from '../../../services/Ubicaciones/ubicaciones.service';
import { MatTableDataSource } from '@angular/material/table';
import { ZonaDetalle } from '../../../Models/zona_detalle';
import { differenceInCalendarDays, differenceInDays, format } from 'date-fns';
import jsPDF from 'jspdf';
import html2canvas from 'html2canvas';
import { objetivoprograma } from '../../../Models/objetivoPrograma';
import { DocenteParticipante } from '../../../Models/docente-participante';
import { EstudianteParticipante } from '../../../Models/estudiante-participante';
import { PartidasPresupuestarias } from '../../../Models/partidas-presupuestarias';
import { CatalogoPP } from '../../../Models/catalogo-partidas-presupuestarias';
import { PresupuestoPartidas } from '../../../Models/presupuesto-partidas';
import { objetivosBV } from '../../../Models/objetivoPLNBV';
import { prograObj } from '../../../Models/prograObj';
import { proObjeEstra } from '../../../Models/proObjEstr';
import { objetivosEstraInst } from '../../../Models/objetivoEstraInst';
import { EventInput } from '@fullcalendar/core';
import { Compartir_idService } from '../../../services/compartir_id/compartir_id.service';
import { PoblacionService } from '../../../services/población/poblacion.service';
import { Objetivo_programaService } from '../../../services/objetivo_programa/objetivo_programa.service';
import { DocentesParticipantesService } from '../../../services/docentes-participantes/docentes-participantes.service';
import { EstudiantesParticipantesService } from '../../../services/estudiantes-participantes/estudiantes-participantes.service';
import { PartidasPresupuestariasService } from '../../../services/partidas-presupuestarias/partidas-presupuestarias.service';
import { PresupuestoPartidasService } from '../../../services/presupuesto-partidas/presupuesto-partidas.service';
import { ObjetivosPLNBVService } from '../../../services/objetivosPLNBV/objetivos-plnbv.service';
import { PrograObjService } from '../../../services/prograObj/prograObj.service';
import { Obj_estra_agService } from '../../../services/obj_estra_agre/obj_estra_ag.service';
import { ObjetivosEstraSService } from '../../../services/objetivos_estra_inst/objetivosEstraS.service';
@Component({
selector: 'vex-pdf',
selector: 'app-pdf',
templateUrl: './pdf.component.html',
styleUrls: ['./pdf.component.css']
})
export class PdfComponent implements OnInit {
@ViewChild('activitySection') activitySection!: ElementRef;
proyecto: Proyectos;
usuario: Usuario;
selectedProgramaId: number;
......@@ -59,17 +95,58 @@ export class PdfComponent implements OnInit {
displayedColumns: string[] = ['Nro', 'Provincia', 'Canton', 'Parroquia'];
tipoCobertura: string = '';
duracionProyecto: '';
presupuesto: PresupuestoPartidas;
idObjeGeneral: number;
idObjeGeneralRecu: number;
idEspecifico: number;
idObjeEspecifico: number;
objetivoPro: objetivoprograma[] = [];//esto recupera el arreglo para los del fin
objetivoPro: objetivoprograma[] = []; //esto recupera el arreglo para los del fin
objetivoProObj: objetivoprograma[] = []; //esto recupera el arreglo para los objetivos generales
objetivoProEsp: objetivoprograma[] = []; // esto recupera el arreglo para los objetivos especificos
objetivoProAct: objetivoprograma[] = []; // esto recupera el arreglo para los actividades de cada objetivo
docenteParticipante: DocenteParticipante[] = [];
totalDocentesParticipantes: number = 0; //total de participantes
estudianteParticipante: EstudianteParticipante[] = [];
totalEstudianteParticipantes: number = 0; // Total de estudiantes
totalPermanente: number = 0;
totalNoPermanente: number = 0;
totalSuma: number = 0;
claPre: PartidasPresupuestarias;
partida!: CatalogoPP[];
nombrePartida: string;
politicas: any[] = [];
objetivos: any[] = [];
presupuestoPartidas!: PresupuestoPartidas[];
dataSource2 = new MatTableDataSource<PresupuestoPartidas>([]);
obj!: objetivosBV[];
dataSourceOb: MatTableDataSource<objetivosBV>;
selectedTipo: string;
filtroGeneral: string = '';
objetiP: prograObj[] = [];
proObjM: proObjeEstra[] = [];
objet: objetivosEstraInst[] = [];
perspectiva: objetivosEstraInst[] = [];
objetivo: objetivosEstraInst[] = [];
estrategia: objetivosEstraInst[] = [];
actividadesA: objetivoprograma[] = [];
actividadesE: objetivoprograma[] = [];
hitosA: objetivoprograma[] = [];
hitosE: objetivoprograma[] = [];
constructor(
private formBuilder: FormBuilder,
private ID_compartido: Compartir_idService,
......@@ -88,23 +165,137 @@ export class PdfComponent implements OnInit {
private objeProS: Objetivo_programaService,
private objeProM: objetivoprograma,
private datosCompartidos: Actualiza_datosService
private datosCompartidos: Actualiza_datosService,
private docentesParticipantesService: DocentesParticipantesService,
private datosEspeService: DatosEspeService,
private estudiantesParticipantesService: EstudiantesParticipantesService,
private partidaS: PartidasPresupuestariasService,
private presupuestoPartidasService: PresupuestoPartidasService,
private presupuestoPartidasService2: PresupuestoPartidasService,
private objetS: ObjetivosPLNBVService,
private objS: ObjetivosPLNBVService,
private objPM: prograObj,
private objPS: PrograObjService,
private proObS: Obj_estra_agService,
private objEstraInS: ObjetivosEstraSService,
private objPS2: Objetivo_programaService,
private objM: objetivoprograma,
) {
this.dataSource = new MatTableDataSource<ZonaDetalle>([]);
this.claPre = new PartidasPresupuestarias();
}
ngOnInit(): void {
this.idRecuperado = parseInt(localStorage.getItem('proyectoId'),10)
this.idRecuperado = parseInt(localStorage.getItem('proyectoId'), 10);
this.datosCompartidos.datos$.subscribe(() => {
this.obtenerRegistros2();
});
this.objPS2.parametrosActualizados.subscribe(() => {
this.obtenerRegistros2();
});
this.datosCompartidos.datos$.subscribe(() => {
this.obtenerRegistros3();
});
this.objPS2.parametrosActualizados.subscribe(() => {
this.obtenerRegistros3();
});
this.obtenerDatos();
this.datosCompartidos.datos$.subscribe(() => {
this.obtenerRegistrosEstra();
});
this.proObS.parametrosActualizados.subscribe(() => {
this.obtenerRegistros();
});
this.datosCompartidos.datos$.subscribe(() => {
this.obtenerRegistrosOb();
this.obtenerObjetivos();
});
this.objPS.parametrosActualizados.subscribe(() => {
this.obtenerRegistrosOb();
this.obtenerObjetivos();
});
this.datosCompartidos.datos$.subscribe(() => {
/* this.obtenerRegistrosUni();
this.obtenerRegistrosEnti();
this.obtenerRegistrosComu(); */
this.obtenerRegistros();
this.obtenerRegistrosUni()
});
this.presupuestoPartidasService.parametrosActualizados.subscribe(() => {
this.obtenerRegistrosUni();
/* this.obtenerRegistrosComu();
this.obtenerRegistrosEnti(); */
});
this.estudiantesParticipantesService.parametrosActualizados.subscribe(() => {
this.obtenerRegistrosEstu();
});
this.objeProS.parametrosActualizados.subscribe(() => {
this.obtenerRegistros();
});
this.datosCompar.datos$.subscribe(() => {
this.obtenerRegistrosEstu();
this.obtenerRegistros();
this.obtenerProvincias();
this.obtenerParroquias();
this.obtenerCantones();
});
this.zonaS.parametrosActualizados.subscribe(() => {
this.obtenerRegistros();
this.obtenerProvincias();
this.obtenerParroquias();
this.obtenerCantones();
});
this.proyecto = this.mostrarOcultarService.editProyecto;
this.obtenerDatosDirector();
this.obtenerRegistrosObjetivos();
this.usuario = new Usuario();
this.obtenerParametrosPoblacion();
this.obtenerPoblacionProyecto();
this.obtenerParametrosPrograma(); // Agrega esta línea
this.datosCompar.datos$.subscribe(() => {
this.obtenerRegistrosDocente();
});
this.docentesParticipantesService.parametrosActualizados.subscribe(() => {
this.obtenerRegistrosDocente();
});
if (this.zonaDM.length === null) {
this.tipoCobertura = 'Internacional';
} else if (this.getProvinciaNombre.length === 0) {
......@@ -117,35 +308,311 @@ export class PdfComponent implements OnInit {
this.tipoCobertura = 'Parroquial';
}
this.proyecto = this.mostrarOcultarService.editProyecto;
this.obtenerDatosDirector();
this.obtenerRegistrosObjetivos();
this.usuario = new Usuario();
this.obtenerParametrosPoblacion();
this.obtenerPoblacionProyecto();
this.obtenerParametrosPrograma(); // Agrega esta línea
}
this.datosCompar.datos$.subscribe(() => {
this.obtenerRegistros();
this.obtenerProvincias();
this.obtenerParroquias();
this.obtenerCantones();
/* FC */
//función para llamar las actividades
obtenerRegistros3() {
this.objPS2.obtenerParametros().subscribe(data => {
this.hitosA = data.filter(item => item.uzytavproyec_id === this.idProyecto && item.uzytavobjetivo_programatipo === 4 && item.uzytavobjetivo_programafec_ini === null && item.uzytavobjetivo_programafec_fin === null);
// Limpia el arreglo de eventos antes de actualizarlo
const nuevosEventos: EventInput[] = [];
// Agrega los eventos al arreglo de eventos del calendario
this.hitosA.forEach(actividad => {
const evento: EventInput = {
id: actividad.uzytavobjetivo_programa_id.toString(),
title: actividad.uzytavobjetivo_programaobjetivo_proy,
start: actividad.uzytavobjetivo_programafec_ini,
end: actividad.uzytavobjetivo_programafec_fin,
};
nuevosEventos.push(evento);
});
});
}
this.zonaS.parametrosActualizados.subscribe(() => {
this.obtenerRegistros();
this.obtenerProvincias();
this.obtenerParroquias();
this.obtenerCantones();
obtenerRegistros2() {
this.objPS2.obtenerParametros().subscribe(data => {
this.actividadesA = data.filter(item => item.uzytavproyec_id === this.idRecuperado && item.uzytavobjetivo_programatipo === 3 && item.uzytavobjetivo_programafec_ini === null && item.uzytavobjetivo_programafec_fin === null);
});
}
mostrarObjetivosPorZona(id: number) {
this.idCompartido.mostrarFormulario();
const registroSeleccionado = this.zonaDM.find(
zona => zona.uzytavzona_detalle_id === id);
this.idCompartido.setIdZonaDetalle(id);
this.mostrarOcultarService.coberturaEdit = registroSeleccionado;
}
obtenerRegistrosEstra() {
if (this.idRecuperado !== undefined) {
this.proObS.obtenerParametros().subscribe(data => {
this.proObjM = data.filter(item => item.uzytavproyec_ID === this.idRecuperado);
});
}
}
obtenerDatos() {
this.objEstraInS.obtenerParametros().subscribe(data => {
if (data !== undefined) {
this.objet = data;
}
});
}
obtenerDescripcionEstrategia(id: number): string {
const objetivo = this.objet.find(obj => obj.uzytavobjetivos_ESTRA_INSTI_ID === id);
return objetivo ? objetivo.uzytavobjetivos_ESTRA_INSTI_DESCRIPCION || '' : '';
}
obtenerDescripcionObjetivo(id: number): string {
if (id !== undefined && this.objet && this.objet.length > 0) {
const objetivo = this.objet.find(item => item.uzytavobjetivos_ESTRA_INSTI_ID === id);
return objetivo && objetivo.uzyTavObjetivosEstraInstiPadre
? objetivo.uzyTavObjetivosEstraInstiPadre.uzytavobjetivos_ESTRA_INSTI_DESCRIPCION
: 'N/A';
}
return 'N/A';
}
obtenerDescripcionPerspectiva(id: number): string {
if (id !== undefined && this.objet && this.objet.length > 0) {
const objetivo = this.objet.find(item => item.uzytavobjetivos_ESTRA_INSTI_ID === id);
if (objetivo && objetivo.uzyTavObjetivosEstraInstiPadre) {
return objetivo.uzyTavObjetivosEstraInstiPadre.uzyTavObjetivosEstraInstiPadre
? objetivo.uzyTavObjetivosEstraInstiPadre.uzyTavObjetivosEstraInstiPadre.uzytavobjetivos_ESTRA_INSTI_DESCRIPCION
: 'N/A';
}
}
return 'N/A';
}
obtenerRegistrosOb() {
this.idRecuperado = this.idRecuperado;
if (this.idRecuperado !== undefined) {
this.objPS.obtenerRegistrosRelacionadosProyecto(this.idRecuperado).subscribe(data => {
if (data !== undefined) {
this.objetiP = data;
this.dataSource.data = this.objetiP;
}
});
}
}
ObtenerNombreHijo(id: number): string {
if (id !== undefined && this.obj && this.obj.length > 0) {
const objetivo = this.obj.find(item => item.uzytavobjetivo_b_vivir_id === id);
return objetivo ? objetivo.uzytavobjetivo_b_vivirdescripcion : 'N/A';
} else {
return 'N/A';
}
}
ObtenerNombrePadre(id: number): string {
if (id !== undefined && this.obj && this.obj.length > 0) {
const objetivo = this.obj.find(item => item.uzytavobjetivo_b_vivir_id === id);
return objetivo && objetivo.objetivo_b_vivirPadre
? objetivo.objetivo_b_vivirPadre.uzytavobjetivo_b_vivirdescripcion
: 'N/A';
}
return 'N/A';
}
obtenerObjetivos() {
this.objS.obtenerParametros().subscribe(data => {
if (data !== undefined) {
this.obj = data;
}
});
}
obtenerRegistrosEnti() {
if (this.idRecuperado !== undefined) {
this.presupuestoPartidasService.obtenerRegistrosRelacionadosEntidadProyecto(this.idRecuperado).subscribe(data => {
if (data !== undefined) {
this.presupuestoPartidas = data;
this.calcularTotalesEnti();
}
});
}
}
calcularTotalesEnti() {
this.totalSuma = this.presupuestoPartidas.reduce((total, dato) => {
return total + dato.uzytavpresup_valor * dato.uzytavpresup_cantidad;
}, 0);
this.totalSuma = parseFloat(this.totalSuma.toFixed(2));
}
obtenerRegistrosComu() {
if (this.idRecuperado !== undefined) {
this.presupuestoPartidasService2.obtenerRegistrosRelacionadosComunidadProyecto(this.idRecuperado).subscribe(data => {
if (data !== undefined) {
this.presupuestoPartidas = data;
this.calcularTotalesComu();
}
});
}
}
calcularTotalesComu() {
this.totalSuma = this.presupuestoPartidas.reduce((total, dato) => {
return total + dato.uzytavpresup_valor * dato.uzytavpresup_cantidad;
}, 0);
this.totalSuma = parseFloat(this.totalSuma.toFixed(2));
}
obtenerRegistrosUni() {
if (this.idRecuperado !== undefined) {
this.presupuestoPartidasService.obtenerRegistrosRelacionadosUniversidadProyecto(this.idRecuperado).subscribe(data => {
if (data !== undefined) {
this.presupuestoPartidas = data.map(partida => {
return {
...partida,
partida$: this.obtenerPartidas(partida.uzytavclaspre_id),
};
});
this.dataSource2.data = this.presupuestoPartidas;
// Calcular los totales
this.calcularTotales();
}
});
}
}
obtenerPartidas(id: number): Observable<string> {
return this.partidaS.obtenerNombrePartidas(id).pipe(
map(partida => {
const partidaEncontrada = partida.find(c => c.uzytavclaspre_id === id);
return partidaEncontrada ? partidaEncontrada.uzytclasificador_presup_id + ". " + partidaEncontrada.uzytclasificador_presup_nombre : 'No encontrado';
})
);
}
calcularTotales() {
this.totalPermanente = this.presupuestoPartidas.reduce((total, dato) => {
if (dato.uzytavpresup_tipogasto == "C") {
return total + dato.uzytavpresup_valor * dato.uzytavpresup_cantidad;
} else {
return total; // Si no es "C", devolver el total sin cambiarlo
}
}, 0);
this.totalNoPermanente = this.presupuestoPartidas.reduce((total, dato) => {
if (dato.uzytavpresup_tipogasto == "I") {
return total + dato.uzytavpresup_valor * dato.uzytavpresup_cantidad;
} else {
return total; // Si no es "I", devolver el total sin cambiarlo
}
}, 0);
console.log("objetivoProobj", this.objetivoProObj);
console.log("objetivoPro", this.objetivoPro);
this.totalPermanente = parseFloat(this.totalPermanente.toFixed(2));
this.totalNoPermanente = parseFloat(this.totalNoPermanente.toFixed(2));
this.totalSuma = this.totalPermanente + this.totalNoPermanente;
}
obtenerRegistrosEstu() {
if (this.idRecuperado !== undefined) {
this.estudiantesParticipantesService.obtenerRegistrosRelacionadosProyecto(this.idRecuperado).subscribe(data => {
this.estudianteParticipante = data.map(carrera => {
return {
...carrera,
carrera$: this.obtenerDatosCarreras(carrera.uzytavmajr_code),
};
});
this.dataSource.data = this.estudianteParticipante;
this.calcularTotalEstudiantesParticipantes();
});
}
}
calcularTotalEstudiantesParticipantes() {
this.totalEstudianteParticipantes = 0; // Reinicia el total a 0
for (const estudiante of this.estudianteParticipante) {
this.totalEstudianteParticipantes += estudiante.uzytavestuparti_numero;
}
}
obtenerDatosCarreras(codigo: string): Observable<string> {
return this.datosEspeService.obtenerCarreras().pipe(
map(carrera => {
const carreraEncontrada = carrera.find(c => c.codigo_CARRERA === 'PROG_' + codigo);
return carreraEncontrada ? carreraEncontrada.nombre_CARRERA : 'No encontrado';
})
);
}
obtenerRegistrosDocente() {
if (this.idRecuperado !== undefined) {
this.docentesParticipantesService.obtenerRegistrosRelacionadosProyecto(this.idRecuperado).
subscribe(data => {
this.docenteParticipante = data.map(docente => {
return {
...docente,
departamento$: this.obtenerDatosDepartamento(docente.uzytavsubj_code),
campus$: this.obtenerDatosCampus(docente.uzytavcamp_code)
};
});
this.dataSource.data = this.docenteParticipante;
this.calcularTotalDocentesParticipantes(); // Total de docentes
});
}
}
calcularTotalDocentesParticipantes() {
this.totalDocentesParticipantes = 0; // Reinicia el total a 0
for (const docente of this.docenteParticipante) {
this.totalDocentesParticipantes += docente.uzytavdocparti_numero;
}
}
obtenerDatosCampus(codigo: string): Observable<string> {
return this.datosEspeService.obtenerCampus().pipe(
map(campus => {
const campusEncontrado = campus.find(c => c.codigo === codigo);
return campusEncontrado ? campusEncontrado.descripcion : 'No encontrado';
})
);
}
obtenerDatosDepartamento(codigo: string): Observable<string> {
return this.datosEspeService.obtenerDepartamentos().pipe(
map(departamentos => {
const departamentoEncontrado = departamentos.find(c => c.subj === codigo);
return departamentoEncontrado ? departamentoEncontrado.descripcion : 'No encontrado';
})
);
}
especificarValor(tipo: number) {
if (tipo === 1) {
return 'Valor';
......@@ -154,8 +621,8 @@ export class PdfComponent implements OnInit {
}
}
obtenerRegistrosObjetivos() {
this.idRecuperado = this.idCompartido.getIdGuardado();
if (this.idRecuperado !== undefined) {
this.objeProS.registrosRelacionadosConProyecto(this.idRecuperado).subscribe(data => {
if (data !== undefined) {
......@@ -195,8 +662,8 @@ export class PdfComponent implements OnInit {
}
obtenerRegistros() {
this.idRecuperado = this.idCompartido.getIdGuardado();
if (this.idRecuperado !== undefined) {
this.zonaS.obtenerRegistrosRelacionadosProyecto(this.idRecuperado).subscribe(data => {
this.zonaDM = data;
......@@ -205,8 +672,6 @@ export class PdfComponent implements OnInit {
}
}
obtenerParroquias() {
this.ubicacionesS.obtenerCant().subscribe(cant => {
this.cantones = cant;
......@@ -252,22 +717,6 @@ export class PdfComponent implements OnInit {
return '';
}
eliminarParametro(id: number) {
const confirmacion = confirm('¿Desea eliminar el registro?');
if (confirmacion) {
this.zonaS.eliminarParametros(id).subscribe(
() => {
console.log('El registro se ha eliminado');
this.obtenerRegistros();
},
(error) => {
// No mostrar el error en la consola
console.log('Error durante el tratamiento al registro');
}
);
}
}
obtenerParametrosPrograma() {
const uzytavprograma_v_id = this.idProyecto;
this.programaService.obtenerParametros().subscribe(
......@@ -301,7 +750,7 @@ export class PdfComponent implements OnInit {
this.idProyecto = this.proyecto.uzytavproyec_id;
} else {
this.idProyecto = this.ID_compartido.getIdGuardado();
this.idProyecto = this.idRecuperado;
}
this.poblacionProyectoService.obtenerParametrosId(this.idProyecto).subscribe(
......@@ -317,7 +766,6 @@ export class PdfComponent implements OnInit {
}
obtenerParametrosPoblacion() {
this.poblacionService.obtenerParametros().subscribe(
poblacion => {
......@@ -330,104 +778,8 @@ export class PdfComponent implements OnInit {
);
}
/* public downloadPDF(): void {
const DATA = document.getElementById('PDF');
const doc = new jsPDF('p', 'pt', 'a4');
const options = {
background: 'white',
scale: 3
};
html2canvas(DATA, options).then((canvas) => {
const img = canvas.toDataURL('image/PNG');
// Add image Canvas to PDF
const bufferX = 15;
const bufferY = 15;
const imgProps = (doc as any).getImageProperties(img);
const pdfWidth = doc.internal.pageSize.getWidth() - 2 * bufferX;
const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width;
doc.addImage(img, 'PNG', bufferX, bufferY, pdfWidth, pdfHeight, undefined, 'FAST');
return doc;
}).then((docResult) => {
docResult.save(`${new Date().toISOString()}_Proyecto.pdf`);
});
} */
/* public downloadPDF(): void {
const DATA = document.getElementById('PDF');
const doc = new jsPDF('p', 'pt', 'a4');
const options = {
background: 'white',
scale: 3
};
html2canvas(DATA, options).then((canvas) => {
var imgData = canvas.toDataURL('image/png');
var imgWidth = 200;
var pageHeight = 200;
var imgHeight = canvas.height * imgWidth / canvas.width;
var heightLeft = imgHeight;
var doc = new jsPDF('p', 'mm', 'a4');
var position = 5;
doc.addImage(imgData, 'PNG', 5, position, imgWidth, imgHeight);
heightLeft -= pageHeight;
while (heightLeft >= 200) {
position = 5;
doc.addPage();
doc.addImage(imgData, 'PNG', 5, position, imgWidth, imgHeight);
heightLeft -= pageHeight;
heightLeft = -3;
}
doc.save('file.pdf');
});
}
*/
/* public downloadPDF(): void {
const DATA = document.getElementById('PDF');
const options = {
background: 'white',
scale: 3
};
html2canvas(DATA, options).then((canvas) => {
var imgData = canvas.toDataURL('image/png');
var imgWidth = 200;
var pageHeight = 200;
var imgHeight = (canvas.height * imgWidth) / canvas.width;
var doc = new jsPDF('p', 'mm', 'a4');
var position = 5;
var heightLeft = imgHeight;
while (heightLeft >= 0) {
doc.addImage(imgData, 'PNG', 5, position, imgWidth, imgHeight);
heightLeft = -1;
if (heightLeft > 0) {
doc.addPage();
position = 0;
}
}
doc.save('file.pdf');
});
}
*/
downloadPDF() {
var data = document.getElementById('PDF');
html2canvas(data).then(canvas => {
......@@ -437,7 +789,7 @@ export class PdfComponent implements OnInit {
var heightLeft = imgHeight;
const contentDataURL = canvas.toDataURL('image/png', 10)
var options = {
size: '70px',
size: '100px',
pagesplit: true,
};
......@@ -456,9 +808,16 @@ export class PdfComponent implements OnInit {
heightLeft -= pageHeight;
}
pdf.save('informe.pdf'); // Generated PDF
pdf.save(`${this.proyecto.uzytavproyec_nombre}.pdf`); // Usar el valor de la variable en el nombre del archivo
});
}
}
......@@ -124,8 +124,7 @@
text-transform: uppercase;
}
table td {
}
table td::after {
content: "";
......@@ -192,4 +191,3 @@
fill: blue;
}
\ No newline at end of file
.principal {
width: 100%; /* Cambia el ancho al 100% */
margin: 0; /* Elimina los márgenes para ocupar todo el espacio disponible */
border-collapse: collapse;
}
.principal th,
.principal td {
width: auto; /* Ajusta el ancho de las celdas automáticamente */
}
.titulo {
display: flex;
align-items: center;
}
.titulo-texto {
font-weight: bold;
font-size: 15px;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
margin-right: 10px;
}
.rounder-nuevo {
border-radius: 50%;
background-color: rgb(71, 127, 75);
display: flex;
align-items: center;
justify-content: center;
padding: 0;
width: 30px;
height: 30px;
border: none;
outline: none;
cursor: pointer;
margin-left: 5px;
}
.opciones {
margin: 0% 3% 0% 3%;
min-height: 50px;
}
.grid-item {
font-weight: bold;
min-height: 50px;
}
.datos {
min-height: 50px;
}
.ng-hide {
display: none;
}
#cabecera {
background: linear-gradient(135deg,
var(--background-base) 22px,
var(--background-hover) 22px,
var(--background-hover) 24px,
transparent 24px,
transparent 67px,
var(--background-hover) 67px,
var(--background-hover) 69px,
transparent 69px),
linear-gradient(225deg,
var(--background-base) 22px,
var(--background-hover) 22px,
var(--background-hover) 24px,
transparent 24px,
transparent 67px,
var(--background-hover) 67px,
var(--background-hover) 69px,
transparent 69px) 0 64px;
background-color: var(--background-base);
background-size: 64px 128px;
}
.azul svg {
fill: blue;
}
.card {
background-color: rgb(252, 252, 251)
}
.icono-instituciones {
display: flex;
align-items: center;
justify-content: center;
margin-right: 5px;
font-size: 20px;
cursor: pointer;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
font-family: 'Roboto', sans-serif;
color: #333;
}
table th,
table td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #e0e0e0;
}
table th {
background-color: rgb(248, 249, 250);
font-weight: bold;
text-transform: uppercase;
}
table td::after {
content: "";
bottom: -1px;
left: 0;
width: 100%;
height: 1px;
background-color: #e0e0e0;
}
input[type="text"] {
width: 200px;
padding: 8px;
border: 1px solid #ccc;
border-radius: 5px;
margin-left: 10px;
}
.area-busqueda {
padding: 10px;
margin-top: 3%;
text-align: right;
background-color: rgb(248, 249, 250);
}
@media (max-width: 600px) {
table {
font-size: 14px;
}
table th,
table td {
padding: 8px;
}
}
.btn-observar {
border-radius: 50%;
width: 36px;
height: 36px;
}
.colorsito{
background-color: rgb(248, 249, 250);
}
.white-icon {
color: white;
}
.azul{
color:blue
}
.colorEditar {
color: blue;
}
.colorEditar svg {
fill: blue;
}
<table class="principal">
<thead class="colorsito">
<tr>
<th class="colorsito">Nombres</th>
<th class="colorsito">Apellidos</th>
<th class="colorsito">E-mail</th>
</tr>
</thead>
<tbody>
<ng-container *ngFor="let opciones of integrantesComision; let i = index">
<tr>
<td>{{ usuario[opciones.uzytusuario_id_asignado]?.uzytusuario_nombres }}</td>
<td>{{ usuario[opciones.uzytusuario_id_asignado]?.uzytusuario_apellidos }}</td>
<td>{{ usuario[opciones.uzytusuario_id_asignado]?.uzytusuario_email_institucional }}</td>
</tr>
</ng-container>
</tbody>
</table>
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ComisionAsigComponent } from './comision-asig.component';
describe('ComisionAsigComponent', () => {
let component: ComisionAsigComponent;
let fixture: ComponentFixture<ComisionAsigComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ComisionAsigComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(ComisionAsigComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, Input, OnInit } from '@angular/core';
import { IntegrantesComision } from '../../../Models/Comision de evaluacion/integrantes-comision';
import { Subscription } from 'rxjs';
import { IntegrantesComisionService } from '../../../services/integrantes-comision/integrantes-comision.service';
import { UsuariosService } from '../../../services/usuarios/usuarios.service';
@Component({
selector: 'vex-comision-asig',
templateUrl: './comision-asig.component.html',
styleUrls: ['./comision-asig.component.css']
})
export class ComisionAsigComponent implements OnInit {
@Input() idProp: number;
usuario: any = {};
integrantesComision!: IntegrantesComision[];
parametrosSubscription: Subscription;
constructor(
private integrantesComisionService: IntegrantesComisionService,
private usuariosService: UsuariosService,
) { }
ngOnInit() {
this.obtenerRegistros(this.idProp);
}
obtenerRegistros(id:number) {
this.integrantesComisionService.obtenerDatos(id).subscribe(data => {
this.integrantesComision = data.map(parametro => {
parametro.uzytavdetcomca_fech_crea = new Date(parametro.uzytavdetcomca_fech_crea);
this.obtenerUsuarios(parametro.uzytusuario_id_asignado)
return parametro;
});
});
}
obtenerUsuarios(id: number) {
this.usuariosService.obtenerUsuariosId(id).subscribe(data => {
this.usuario[id] = data;
});
}
}
......@@ -65,4 +65,357 @@
pointer-events: none;
}
.principal {
text-align: center;
margin-bottom: 2%;
}
.grid-container {
display: grid;
grid-template-columns: 5% 10% 45% 10% 5% 10% 15%;
border: 1px solid #ccc;
}
#cabecera {
background: linear-gradient(135deg,
var(--background-base) 22px,
var(--background-hover) 22px,
var(--background-hover) 24px,
transparent 24px,
transparent 67px,
var(--background-hover) 67px,
var(--background-hover) 69px,
transparent 69px),
linear-gradient(225deg,
var(--background-base) 22px,
var(--background-hover) 22px,
var(--background-hover) 24px,
transparent 24px,
transparent 67px,
var(--background-hover) 67px,
var(--background-hover) 69px,
transparent 69px) 0 64px;
background-color: var(--background-base);
background-size: 64px 128px;
}
.volver{
position: absolute;
top: 50%;
right: 10px;
transform: translateY(-50%);
border-radius: 50%;
background-color: white;
display: flex;
color: rgb(71, 127, 75);
align-items: center;
justify-content: center;
padding: 0;
width: 32px;
height: 32px;
border: none;
outline: none;
cursor: pointer;
}
.grid-item {
font-weight: bold;
}
.grid-opciones {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
}
.titulo {
display: flex;
align-items: center;
justify-content: center;
}
.titulo-texto {
font-weight: bold;
font-size: 18px;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
margin-right: 10px;
}
.componente {
justify-content: center;
align-items: center;
}
.card {
background-color: rgb(252, 252, 251)
}
.colorEditar {
color: blue;
}
.colorEditar svg {
fill: blue;
}
.contenedorP {
width: 96%;
margin-left: 2%;
margin-right: 2%;
margin: 10px auto;
border-radius: 10px;
text-align: center;
margin-top: 10%;
background-color: white;
}
.contenedor:not(:last-child) {
margin-bottom: 2px;
}
.contenedor {
width: 96%;
margin-left: 2%;
margin-right: 2%;
padding-bottom: 2%;
border-radius: 10px;
background-color: white;
position: relative;
z-index: 1;
}
.sobremontado {
position: relative;
align-items: center;
justify-content: center;
padding: 10px;
width: 96%;
top: -20px;
left: 2%;
background-color: rgb(71, 127, 75);
color: #fff;
text-align: center;
padding: 10px;
box-sizing: border-box;
margin-bottom: -50px;
z-index: 2;
border-radius: 10px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
.sobremontado span {
display: flex;
align-items: center;
justify-content: center;
margin: 0;
}
.sobremontado mat-icon {
margin-right: 5px;
}
.icono-instituciones {
display: flex;
align-items: center;
justify-content: center;
margin-right: 5px;
font-size: 20px;
cursor: pointer;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
font-family: 'Roboto', sans-serif;
color: #333;
}
table th,
table td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #e0e0e0;
}
table th {
background-color: rgb(248, 249, 250);
font-weight: bold;
text-transform: uppercase;
}
table td {
position: relative;
}
table td::after {
content: "";
position: absolute;
bottom: -1px;
left: 0;
width: 100%;
height: 1px;
background-color: #e0e0e0;
}
input[type="text"] {
width: 200px;
padding: 8px;
border: 1px solid #ccc;
border-radius: 5px;
margin-left: 10px;
}
.area-busqueda {
padding: 10px;
margin-top: 3%;
text-align: right;
background-color: rgb(248, 249, 250);
}
@media (max-width: 600px) {
table {
font-size: 14px;
}
table th,
table td {
padding: 8px;
}
}
.btn-observar {
border-radius: 50%;
width: 36px;
height: 36px;
}
.white-icon {
color: blue;
}
.colorsito{
background-color: rgb(248, 249, 250);
}
.rounder{
border-radius: 50%;
background-color: rgb(71, 127, 75);
display: flex;
align-items: center;
justify-content: center;
padding: 0;
width: 15%;
height: 40px;
border: none;
outline: none;
cursor: pointer;
}
.rounder mat-icon {
font-size: 24px;
color: #fff;
}
@media (max-width: 768px) {
.rounder {
width: 30%;
}
}
@media (max-width: 480px) {
.rounder {
width: 40%;
}
}
.margen{
margin: 10px;
padding: 10px;
margin-bottom: 10px;
}
.bordes {
border-collapse: collapse;
width: 100%;
}
.bordes th,
.bordes td {
border: 1px solid black;
padding: 8px;
}
.bordes th {
background-color: #f5f5f5;
font-weight: bold;
}
.bordes td {
background-color: #ffffff;
}
.bordes tr:nth-child(even) {
background-color: #f9f9f9;
}
.bordes tr:hover {
background-color: #eaeaea;
}
.bordes th:last-child,
.bordes td:last-child {
border-bottom: none;
}
.rounder-nuevo {
border-radius: 50%;
background-color: rgb(71, 127, 75);
display: flex;
align-items: center;
justify-content: center;
padding: 0;
width: 36px;
height: 36px;
border: none;
outline: none;
cursor: pointer;
margin-left: 5px;
}
.white-icon {
color: white;
}
.conf {
display: flex;
align-items: center;
}
.conf-name {
font-size: 20px; /* Tamaño de fuente deseado */
font-weight: bold; /* Opcional, para hacerlo más destacado */
margin-right: 30px; /* Espacio entre el icono y el nombre */
}
.add-icon {
display: flex;
align-items: center;
justify-content: center;
width: 25px; /* Ancho del círculo */
height: 25px; /* Altura del círculo */
border-radius: 50%; /* Para crear la forma de círculo */
background-color: white; /* Color de fondo del círculo */
color:black; /* Color del signo "+" en el círculo */
font-size: 25px; /* Tamaño del signo "+" */
}
<div class="contenedorP">
<div class="contenedorP" *ngIf="shouldShowDiv">
<div>
<form [formGroup]="myForm" (ngSubmit)="onUpdate()">
<mat-label><strong>Asignar la comisión de Evaluación</strong></mat-label>
......@@ -29,8 +29,6 @@
[disabled]="!myForm.valid">Agregar
Fecha</button>
<span class="separator"></span>
<button mat-raised-button color="warn"
(click)="cancelarF()">Cancelar</button>
</div>
<div class="separator2"></div>
<!--fecha de inicio-->
......@@ -39,38 +37,41 @@
</div>
<div class="container">
<div class="mat-elevation-z8">
<table mat-table [dataSource]="dataSource" matSort>
<!-- Nro Column -->
<ng-container matColumnDef="Nro" class="Column1">
<th class="Column1 negrita" mat-header-cell *matHeaderCellDef
mat-sort-header> Nro </th>
<td class="Column1" mat-cell *matCellDef="let i = index"> {{ i+1 }}
<div>
<mat-card class="card">
<table>
<thead class="colorsito">
<tr>
<th class="colorsito"></th>
<th class="colorsito">Comsión de Evaluación Asignada para la evalucaión</th>
</tr>
</thead>
<tbody>
<ng-container *ngFor="let parametro of datos; let i = index">
<tr id="fila-{{ i }}">
<td>
<button (click)="parametro.uzytavcabcomca_id !== null && toggleDiv(i)">
<mat-icon>{{ mostrarDiv[i] ? 'keyboard_arrow_down' : 'keyboard_arrow_right' }}</mat-icon>
</button>
</td>
<td>
<ng-container *ngIf="parametro.uzytavcabcomca_id !== null; else noComision">
{{ getNombrePar(parametro.uzytavcabcomca_id) }}
</ng-container>
<ng-container matColumnDef="cedula" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Cedula </th>
<td class="Column" mat-cell *matCellDef="let dato"> {{dato.uzytavinstproy_dir_discapacidad}} </td>
</ng-container>
<ng-container matColumnDef="info" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Nombre y Apellidos </th>
<td class="Column" mat-cell *matCellDef="let dato"> {{dato.uzytavinstproy_DIRECTOS}} </td>
</ng-container>
<ng-container matColumnDef="correo" class="Column">
<th class="Column" mat-header-cell *matHeaderCellDef mat-sort-header>
Correo Electronico </th>
<td class="Column" mat-cell *matCellDef="let dato"> {{dato.uzytavinstproy_TOTAL}} </td>
<ng-template #noComision>
No se ha asignado Comisión de Evaluación
</ng-template>
</td>
</tr>
<tr *ngIf="mostrarDiv[i]">
<div></div>
<td colspan="5">
<vex-comision-asig [idProp]="this.parametro.uzytavcabcomca_id"></vex-comision-asig>
</td>
</tr>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</tbody>
</table>
</mat-card>
</div>
</div>
......@@ -12,6 +12,7 @@ import { Route, Router } from '@angular/router';
import { MatTableDataSource } from '@angular/material/table';
import { IntegrantesComision } from '../../../Models/Comision de evaluacion/integrantes-comision';
import { IntegrantesComisionService } from '../../../services/integrantes-comision/integrantes-comision.service';
import { Compartir_idService } from '../../../services/compartir_id/compartir_id.service';
@Component({
selector: 'vex-comision-eva',
......@@ -24,10 +25,13 @@ export class ComisionEvaComponent implements OnInit {
comisionA: ComisionEvaluacion[] = [];
parametroA: Parametros[] = [];
integrantes: IntegrantesComision[] = [];
datos: Proyectos;
datos: Proyectos[] = [];
idConv: number;
formularioEnviado: boolean = false;
dataSource: MatTableDataSource<IntegrantesComision>;
displayedColumns: string[] = ['Nro','cedula', 'info', 'correo'];
mostrarSegundoSelect: boolean = false;
shouldShowDiv: boolean = true;
constructor(
private formBuilder: FormBuilder,
private comiS: ComisionEvaluacionService,
......@@ -36,8 +40,10 @@ export class ComisionEvaComponent implements OnInit {
private proyecS: ProyectosService,
private dialog: MatDialog,
private router: Router,
private integranteService: IntegrantesComisionService
private integranteService: IntegrantesComisionService,
private idCompar: Compartir_idService
) {
this.myForm = formBuilder.group({
comision: ['', Validators.required],
preguntas: ['', Validators.required]
......@@ -47,6 +53,7 @@ export class ComisionEvaComponent implements OnInit {
ngOnInit(): void {
this.idRecuperado = parseInt(localStorage.getItem('proyectoId'),10);
this.obtenerRegistros();
}
onUpdate(){
......@@ -61,7 +68,6 @@ export class ComisionEvaComponent implements OnInit {
localStorage.setItem('comisionId',idcab.toString());
localStorage.setItem('parametrosId',idpara.toString());
this.router.navigate(['main/Asignar-Comision']);
this.setear();
this.openModal();
});
} catch (error) {
......@@ -70,16 +76,6 @@ export class ComisionEvaComponent implements OnInit {
}
}
setear(){
this.myForm.patchValue({
comision: [parseInt(localStorage.getItem('comisionId'),10)],
preguntas: [parseInt(localStorage.getItem('parametrosId'),10)]
});
}
cancelarF(){
}
obtenerRegistros(){
this.comiS.obtenerParametros().subscribe(data => {
......@@ -90,19 +86,33 @@ export class ComisionEvaComponent implements OnInit {
this.parametroA = data;
});
this.proyecS.obtenerParametrosRela(this.idRecuperado).subscribe(data => {
this.datos = data;
if(this.datos.uzytavcabcomca_id === undefined && this.datos.uzytavconparaeva_id === undefined ){
console.log('no tiene registro todavia')
}else{
localStorage.setItem('comisionId',this.datos.uzytavcabcomca_id.toString());
localStorage.setItem('parametrosId',this.datos.uzytavconparaeva_id.toString());
}
this.proyecS.obtenerParametros().subscribe(data => {
this.datos = data.filter(item => item.uzytavproyec_id === this.idRecuperado);
const tieneComision = this.datos.some(item => item.uzytavcabcomca_id !== null);
this.shouldShowDiv = !tieneComision;
});
this.integranteService.obtenerParametros().subscribe(data=>{
this.integrantes = data;
});
}
verificarIDPresente() {
const comisionControl = this.myForm.get('comision');
this.mostrarSegundoSelect = !comisionControl.value; // Cambia esto dependiendo de tu lógica
}
getNombrePar(id: number):string{
const busca = this.comisionA.find(i=> i.uzytavcabcomca_id === id)
if(busca){
const nombre = busca.uzytavcabcomca_decsrip
return nombre;
}
return '';
}
mostrarDiv: boolean[] = [];
toggleDiv(i: number) {
this.mostrarDiv[i] = !this.mostrarDiv[i];
}
openModal() {
......
......@@ -22,7 +22,7 @@
<div class="contenedor-dos">
<mat-accordion>
<!--perfil-->
<mat-expansion-panel hideToggle>
<mat-expansion-panel hideToggle expanded>
<mat-expansion-panel-header>
<mat-panel-title>
<strong>Perfil de Proyecto</strong>
......@@ -374,19 +374,53 @@
<!--fin-->
</mat-expansion-panel>
<!--Proyectos Planificados-->
<!--Acta de Consejo de Departamento-->
<mat-expansion-panel (opened)="contraccion = true"
(closed)="contraccion = false">
<mat-expansion-panel-header>
<mat-panel-title>
<mat-icon
[ngClass]="{'expanded': contraccion, 'collapsed': !contraccion}">keyboard_arrow_right</mat-icon>
8.- Acta de Consejo de Departamento
</mat-panel-title>
</mat-expansion-panel-header>
<!--Datos generales internos-->
<app-acta-consejo-departamento></app-acta-consejo-departamento>
<app-listar-acta-consejo-departamento></app-listar-acta-consejo-departamento>
<!--fin-->
</mat-expansion-panel>
<!--Acta de Compromiso Director del Proyecto-->
<mat-expansion-panel (opened)="contraccion = true"
(closed)="contraccion = false">
<mat-expansion-panel-header>
<mat-panel-title>
<mat-icon
[ngClass]="{'expanded': contraccion, 'collapsed': !contraccion}">keyboard_arrow_right</mat-icon>
Proyectos Planificados
9.- Acta de Compromiso Director del Proyecto
</mat-panel-title>
</mat-expansion-panel-header>
<!--Datos generales internos-->
<app-acta-director-proyecto></app-acta-director-proyecto>
<!--fin-->
</mat-expansion-panel>
<!--Acta de Compromiso de Carreras -->
<mat-expansion-panel (opened)="contraccion = true"
(closed)="contraccion = false">
<mat-expansion-panel-header>
<mat-panel-title>
<mat-icon
[ngClass]="{'expanded': contraccion, 'collapsed': !contraccion}">keyboard_arrow_right</mat-icon>
10.- Acta de Compromiso de Carreras
</mat-panel-title>
</mat-expansion-panel-header>
<!--Datos generales internos-->
<app-acta-compromiso-carreras></app-acta-compromiso-carreras>
<app-listar-acta-compromiso-carreras></app-listar-acta-compromiso-carreras>
<!--fin-->
</mat-expansion-panel>
......@@ -404,8 +438,24 @@
<!--fin-->
</mat-expansion-panel>
<mat-expansion-panel (opened)="contraccion = true"
(closed)="contraccion = false">
<mat-expansion-panel-header>
<mat-panel-title>
<mat-icon
[ngClass]="{'expanded': contraccion, 'collapsed': !contraccion}">keyboard_arrow_right</mat-icon>
Ver y descargar PDF.
</mat-panel-title>
</mat-expansion-panel-header>
<app-pdf></app-pdf>
<!--fin-->
</mat-expansion-panel>
<!--Stepper version dos-->
</mat-expansion-panel>
<!--Seguimiento-->
<mat-expansion-panel hideToggle expanded>
<mat-expansion-panel-header>
......
/* tslint:disable:no-unused-variable */
import { TestBed, async, inject } from '@angular/core/testing';
import { HitosService } from './hitos.service';
describe('Service: Hitos', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [HitosService]
});
});
it('should ...', inject([HitosService], (service: HitosService) => {
expect(service).toBeTruthy();
}));
});
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
import { Observable, Subject } from 'rxjs';
import { delay, tap } from 'rxjs/operators';
import { seguim } from '../../Models/hito';
@Injectable({
providedIn: 'root'
})
export class HitosService {
parametrosActualizados: Subject<void> = new Subject<void>();
private readonly URL = environment.appApiUrl + '/seguim';
constructor(private httpClient: HttpClient) { }
obtenerParametros(): Observable<seguim[]> {
return this.httpClient.get<seguim[]>(`${this.URL}/getAll`).pipe(delay(-1));
}
eliminarParametros(id: number): Observable<any> {
return this.httpClient.delete(`${this.URL}/eliminar/${id}`, { responseType: 'text' });
}
guardarParametros(parametros: seguim){
return this.httpClient.post(this.URL + '/guardar', parametros);
}
}
......@@ -44,4 +44,8 @@ export class PresupuestoPartidasService {
return this.httpClient.get<PresupuestoPartidas[]>(`${this.URL_RELA_PROYEC_COMUNIDAD}/${id}`);
}
modificarParametros(id: number, parametros: PresupuestoPartidas): Observable<any> {
return this.httpClient.put<any>(`${this.URL}/editar/${id}`, parametros);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment