Added missing files

pull/6/head
Alvaro Puente Mella 2024-08-05 11:47:01 +02:00
parent 80f0324717
commit ecba08ecac
12 changed files with 155 additions and 7 deletions

View File

@ -70,6 +70,7 @@ import { LegendComponent } from './components/groups/legend/legend.component';
import { ClassroomViewDialogComponent } from './components/groups/classroom-view/classroom-view-modal';
import {MatPaginator} from "@angular/material/paginator";
import { SaveFiltersDialogComponent } from './components/groups/save-filters-dialog/save-filters-dialog.component';
import { AcctionsModalComponent } from './components/groups/acctions-modal/acctions-modal.component';
@NgModule({
declarations: [
@ -102,7 +103,8 @@ import { SaveFiltersDialogComponent } from './components/groups/save-filters-dia
TreeViewComponent,
LegendComponent,
ClassroomViewDialogComponent,
SaveFiltersDialogComponent
SaveFiltersDialogComponent,
AcctionsModalComponent
],
bootstrap: [AppComponent],
imports: [BrowserModule,

View File

@ -0,0 +1,20 @@
.button-column {
display: flex;
flex-direction: column;
align-items: center;
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Sombra ligera */
}
.button-column button {
margin: 10px 0; /* Espaciado entre los botones */
width: 200px; /* Ancho uniforme para todos los botones */
font-size: 16px; /* Tamaño de fuente consistente */
}
.button-column button.mat-flat-button {
border-radius: 5px; /* Bordes ligeramente redondeados */
}

View File

@ -0,0 +1,9 @@
<h1 mat-dialog-title i18n="@@actions-modal-title">Acciones</h1>
<div class="button-column">
<button mat-flat-button color="primary" class="button-action button-encender" i18n="@@power-on-button" (click)="onSend()">Encender</button>
<button mat-flat-button color="accent" class="button-action button-apagar" i18n="@@power-off-button" (click)="onSend()">Apagar</button>
<button mat-flat-button color="warn" class="button-action button-resetear" i18n="@@reset-button">Resetear</button>
<button mat-flat-button class="button-action button-otros-1" i18n="@@other-actions-1">Otras acciones 1</button>
<button mat-flat-button class="button-action button-otros-2" i18n="@@other-actions-2">Otras acciones 2</button>
<button mat-flat-button class="button-action button-otros-3" i18n="@@other-actions-3">Otras acciones 3</button>
</div>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AcctionsModalComponent } from './acctions-modal.component';
describe('AcctionsModalComponent', () => {
let component: AcctionsModalComponent;
let fixture: ComponentFixture<AcctionsModalComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [AcctionsModalComponent]
})
.compileComponents();
fixture = TestBed.createComponent(AcctionsModalComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,31 @@
// componente
import { Component, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ToastrService } from 'ngx-toastr';
@Component({
selector: 'app-acctions-modal',
templateUrl: './acctions-modal.component.html',
styleUrls: ['./acctions-modal.component.css']
})
export class AcctionsModalComponent {
selectedElements: any;
constructor(
private toastService: ToastrService,
public dialogRef: MatDialogRef<AcctionsModalComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {
this.selectedElements = data.selectedElements;
}
onCancel(): void {
this.dialogRef.close(null);
}
onSend(): void {
console.log('send Action');
console.log(this.selectedElements);
this.toastService.success(' Acción enviada a: ' + this.selectedElements);
}
}

View File

@ -133,7 +133,7 @@ mat-spinner {
padding-right: 20px;
}
.classroomBtn {
.roomMap-btn{
}
.container {

View File

@ -7,7 +7,7 @@
<button mat-flat-button color="primary" (click)="addClient($event)" i18n="@@newClientButton">Nuevo Cliente</button>
<button mat-raised-button (click)="openBottomSheet()" i18n="@@legendButton">Leyenda</button>
</div>
<div class="container">
<div class="classroomBtn-container">
<button mat-flat-button class="roomMap-btn" color="accent" (click)="roomMap()" *ngIf="selectedDetail && selectedDetail.type === 'classroom'" i18n="@@classroomMapButton">Plano de aula</button>
</div>
</div>

View File

@ -19,6 +19,7 @@ import {HttpClient} from "@angular/common/http";
import {Observable} from "rxjs";
import {PageEvent} from "@angular/material/paginator";
import { SaveFiltersDialogComponent } from './save-filters-dialog/save-filters-dialog.component';
import { AcctionsModalComponent } from './acctions-modal/acctions-modal.component';
@Component({
selector: 'app-groups',
@ -332,12 +333,12 @@ export class GroupsComponent implements OnInit {
}
};
console.log('Filters:', filters);
this.http.post('http://127.0.0.1:8080/views', filters).subscribe(response => {
console.log('Response from server:', response);
this.toastService.success('Se ha guardado el filtro correctamente');
}, error => {
console.error('Error:', error);
this.toastService.error(error);
});
}
});
@ -354,6 +355,7 @@ export class GroupsComponent implements OnInit {
this.filterName = response.filters.filter0 || '';
this.selectedFilter1 = response.filters.filter1 || null;
this.selectedFilter2 = response.filters.filter2 || '';
this.applyFilter();
}
}, error => {
console.error('Error:', error);
@ -375,8 +377,7 @@ export class GroupsComponent implements OnInit {
sendActions() {
alert('Send actions:'+ this.selectedElements);
const dialogRef = this.dialog.open(AcctionsModalComponent, { data: { selectedElements: this.selectedElements }, width: '700px'});
}
}

View File

@ -0,0 +1 @@
<p>save-filters-dialog works!</p>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SaveFiltersDialogComponent } from './save-filters-dialog.component';
describe('SaveFiltersDialogComponent', () => {
let component: SaveFiltersDialogComponent;
let fixture: ComponentFixture<SaveFiltersDialogComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [SaveFiltersDialogComponent]
})
.compileComponents();
fixture = TestBed.createComponent(SaveFiltersDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,38 @@
import { Component } from '@angular/core';
import { MatDialogRef } from '@angular/material/dialog';
import { FormControl, Validators } from '@angular/forms';
@Component({
selector: 'app-save-filters-dialog',
template: `
<h1 mat-dialog-title>Guardar filtros</h1>
<div mat-dialog-content>
<mat-form-field>
<mat-label>Nombre del filtro</mat-label>
<input matInput [formControl]="filterNameControl" placeholder="Nombre del filtro">
<mat-error *ngIf="filterNameControl.hasError('required')">
El nombre es obligatorio
</mat-error>
</mat-form-field>
</div>
<div mat-dialog-actions>
<button mat-button (click)="onCancel()">Cancelar</button>
<button mat-button [disabled]="filterNameControl.invalid" (click)="onSave()">Guardar</button>
</div>
`
})
export class SaveFiltersDialogComponent {
filterNameControl = new FormControl('', [Validators.required]);
constructor(public dialogRef: MatDialogRef<SaveFiltersDialogComponent>) {}
onCancel(): void {
this.dialogRef.close(null);
}
onSave(): void {
if (this.filterNameControl.valid) {
this.dialogRef.close(this.filterNameControl.value);
}
}
}