Skip to content
Snippets Groups Projects
Commit 44fdb884 authored by Roberto Junior's avatar Roberto Junior
Browse files

Ajustes na tela de Infraestrutura e novas salas, desabilitando campos quando for Brasil.

parent 3223c211
No related branches found
No related tags found
1 merge request!1v1
...@@ -54,7 +54,10 @@ ...@@ -54,7 +54,10 @@
<th *ngIf="!pqrMode" rowspan="3">Mês/ano referência</th> <th *ngIf="!pqrMode" rowspan="3">Mês/ano referência</th>
</tr> </tr>
<tr> <tr>
<th rowspan="2">Dimensão m2</th> <th rowspan="2"><span [class.dimension-title]="processDisabledData(pqrAdminMode)"
[popover]="popoverText" placement="bottom" container="body" [triggers]="popoverTriggers"
[isOpen]="processDisabledData(pqrAdminMode)" containerClass="popover-simcaq result">Dimensão
m2</span></th>
<th rowspan="2">Unidade de Medida</th> <th rowspan="2">Unidade de Medida</th>
<th *ngIf="!pqrMode" rowspan="2">Preço por m2 (R$) <sup>(3)</sup></th> <th *ngIf="!pqrMode" rowspan="2">Preço por m2 (R$) <sup>(3)</sup></th>
</tr> </tr>
...@@ -87,13 +90,13 @@ ...@@ -87,13 +90,13 @@
</ng-container> </ng-container>
<td> <td>
<input type="text" class="form-control dimension plan-value" [(ngModel)]="dependency.dimension" <input type="text" class="form-control dimension plan-value" [(ngModel)]="dependency.dimension"
[disabled]="!pqrAdminMode && pqrMode" currencyMask [disabled]="processDisabledData(pqrAdminMode)" currencyMask
[options]="{ prefix: '', align: 'right', precision: 2, thousands: '.', decimal: ',' }"> [options]="{ prefix: '', align: 'right', precision: 2, thousands: '.', decimal: ',' }">
</td> </td>
<td class="unit-measurement-description">{{dependency.unitOfMeasurement.description}}</td> <td class="unit-measurement-description">{{dependency.unitOfMeasurement.description}}</td>
<td *ngIf="!pqrMode"> <td *ngIf="!pqrMode">
<input type="text" class="form-control unit-price plan-value" [(ngModel)]="dependency.unitPrice" <input type="text" class="form-control unit-price plan-value" [(ngModel)]="dependency.unitPrice"
currencyMask currencyMask [disabled]="processDisabledData(pqrAdminMode)"
[options]="{ prefix: 'R$ ', align: 'right', precision: 2, thousands: '.', decimal: ',' }"> [options]="{ prefix: 'R$ ', align: 'right', precision: 2, thousands: '.', decimal: ',' }">
</td> </td>
<td *ngIf="!pqrMode"> <td *ngIf="!pqrMode">
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
min-width: 120px; min-width: 120px;
} }
.dimension-title {
cursor: pointer;
}
.dependency-title { .dependency-title {
background-color: $differentiated-table-background-color; background-color: $differentiated-table-background-color;
font-weight: bold; font-weight: bold;
......
import { Component, Injector, Type } from '@angular/core'; import { Component, Injector, Type, OnInit } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { PqrComponentData } from '../../shared/entities/base/pqr-component-data'; import { PqrComponentData } from '../../shared/entities/base/pqr-component-data';
...@@ -13,6 +13,7 @@ import { InfrastructureSchoolBuildings } from './entities/infrastructure-school- ...@@ -13,6 +13,7 @@ import { InfrastructureSchoolBuildings } from './entities/infrastructure-school-
import { CsvHeader } from '../../../shared/services/csv/entities/csv-header'; import { CsvHeader } from '../../../shared/services/csv/entities/csv-header';
import { CsvService } from '../../../shared/services/csv/csv.service'; import { CsvService } from '../../../shared/services/csv/csv.service';
import { Csv } from '../../../shared/services/csv/entities/csv'; import { Csv } from '../../../shared/services/csv/entities/csv';
import { SelectLocation } from 'app/simulator/select-location/entities/select-location';
@Component({ @Component({
selector: 'app-infrastructure-school-buildings', selector: 'app-infrastructure-school-buildings',
...@@ -20,7 +21,7 @@ import { Csv } from '../../../shared/services/csv/entities/csv'; ...@@ -20,7 +21,7 @@ import { Csv } from '../../../shared/services/csv/entities/csv';
styleUrls: ['./infrastructure-school-buildings.component.scss'] styleUrls: ['./infrastructure-school-buildings.component.scss']
}) })
export class InfrastructureSchoolBuildingsComponent extends BaseNavigableComponent<InfrastructureSchoolsBuildings> implements PqrComponentData { export class InfrastructureSchoolBuildingsComponent extends BaseNavigableComponent<InfrastructureSchoolsBuildings> implements PqrComponentData, OnInit {
data: InfrastructureSchoolsBuildings = new InfrastructureSchoolsBuildings(); data: InfrastructureSchoolsBuildings = new InfrastructureSchoolsBuildings();
functionality: FunctionalityInfo = Functionality.infrastructureSchoolBuildings; functionality: FunctionalityInfo = Functionality.infrastructureSchoolBuildings;
...@@ -29,13 +30,26 @@ export class InfrastructureSchoolBuildingsComponent extends BaseNavigableCompone ...@@ -29,13 +30,26 @@ export class InfrastructureSchoolBuildingsComponent extends BaseNavigableCompone
pqrMode: boolean; pqrMode: boolean;
pqrModalMode: boolean; pqrModalMode: boolean;
componentType: Type<PqrComponentData> = InfrastructureSchoolBuildingsComponent; componentType: Type<PqrComponentData> = InfrastructureSchoolBuildingsComponent;
selectLocationData: SelectLocation = this.sessionService.getItem<SelectLocation>(Functionality.selectLocation.key);
disabledData: boolean = true;
popoverTriggers: string;
popoverText: string = 'Esses parâmetros só podem ser alterados para simulações em nível estadual ou municipal. ' +
'Para simulações em nível nacional, são apresentados resultados dos valores estaduais agregados internamente pelo simulador.';
referenceDateMask: any = this.utilitiesService.getReferenceDateMask(); referenceDateMask: any = this.utilitiesService.getReferenceDateMask();
constructor(private injector: Injector, private infrastructureSchoolBuildingsService: InfrastructureSchoolBuildingsService, private csvService: CsvService) { constructor(private injector: Injector, private infrastructureSchoolBuildingsService: InfrastructureSchoolBuildingsService, private csvService: CsvService) {
super(injector); super(injector);
} }
ngOnInit(): void {
super.ngOnInit();
this.disabledData = this.processDisabledData();
if (this.disabledData) {
this.popoverTriggers = 'mouseenter:mouseleave';
}
}
processData(): Observable<InfrastructureSchoolsBuildings> { processData(): Observable<InfrastructureSchoolsBuildings> {
return this.infrastructureSchoolBuildingsService.getData(this.pqrMode); return this.infrastructureSchoolBuildingsService.getData(this.pqrMode);
} }
...@@ -125,4 +139,18 @@ export class InfrastructureSchoolBuildingsComponent extends BaseNavigableCompone ...@@ -125,4 +139,18 @@ export class InfrastructureSchoolBuildingsComponent extends BaseNavigableCompone
const csv: Csv = new Csv({ header: header, data: data, name: 'Infraestrutura dos prédios escolares' }); const csv: Csv = new Csv({ header: header, data: data, name: 'Infraestrutura dos prédios escolares' });
this.csvService.download(csv); this.csvService.download(csv);
} }
processDisabledData(pqrAdminMode: boolean = false): boolean {
if (pqrAdminMode) {
return false;
} else {
if (!(!this.pqrAdminMode && this.pqrMode)) {
return this.disabledData = !this.selectLocationData || !(this.selectLocationData.selectedCity || this.selectLocationData.selectedState);
} else {
return !this.pqrAdminMode && this.pqrMode;
}
}
}
} }
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<tr> <tr>
<th rowspan="2">Demanda por construção</th> <th rowspan="2">Demanda por construção</th>
<th *ngIf="!pqrMode" colspan="2"> <th *ngIf="!pqrMode" colspan="2">
<span [class.projection-title]="disabledData" [popover]="popoverText" placement="bottom" <span [class.quantity-title]="disabledData" [popover]="popoverText" placement="bottom"
container="body" [triggers]="popoverTriggers" [isOpen]="disabledData" container="body" [triggers]="popoverTriggers" [isOpen]="disabledData"
containerClass="popover-simcaq result">Quantidade</span> containerClass="popover-simcaq result">Quantidade</span>
</th> </th>
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
min-width: 120px; min-width: 120px;
} }
.quantity-title {
cursor: pointer;
}
.disable-th-cell { .disable-th-cell {
background-color: $differentiated-table-background-color; background-color: $differentiated-table-background-color;
color: #000; color: #000;
......
...@@ -29,9 +29,10 @@ export class NewRoomBuildingComponent extends BaseNavigableComponent<NewRoomsBui ...@@ -29,9 +29,10 @@ export class NewRoomBuildingComponent extends BaseNavigableComponent<NewRoomsBui
pqrModalMode: boolean; pqrModalMode: boolean;
locationUrban: number = LocationEnum.urban; locationUrban: number = LocationEnum.urban;
locationRural: number = LocationEnum.rural; locationRural: number = LocationEnum.rural;
selectLocationData: SelectLocation = this.sessionService.getItem<SelectLocation>(Functionality.selectLocation.key);
disabledData: boolean = true; disabledData: boolean = true;
popoverTriggers: string; popoverTriggers: string;
popoverText: string = 'Esses parâmetros só podem ser alterados para simulações em nível municipal ou estadual. ' + popoverText: string = 'Esses parâmetros só podem ser alterados para simulações em nível estadual ou municipal. ' +
'Para simulações em nível nacional, são apresentados resultados dos valores municipais agregados internamente pelo simulador.'; 'Para simulações em nível nacional, são apresentados resultados dos valores municipais agregados internamente pelo simulador.';
componentType: Type<PqrComponentData> = NewRoomBuildingComponent; componentType: Type<PqrComponentData> = NewRoomBuildingComponent;
...@@ -144,8 +145,7 @@ export class NewRoomBuildingComponent extends BaseNavigableComponent<NewRoomsBui ...@@ -144,8 +145,7 @@ export class NewRoomBuildingComponent extends BaseNavigableComponent<NewRoomsBui
return false; return false;
} else { } else {
if (!(!this.pqrAdminMode && this.pqrMode)) { if (!(!this.pqrAdminMode && this.pqrMode)) {
const selectLocationData: SelectLocation = this.sessionService.getItem<SelectLocation>(Functionality.selectLocation.key); return this.disabledData = !this.selectLocationData || !(this.selectLocationData.selectedCity || this.selectLocationData.selectedState);
return this.disabledData = !selectLocationData || !(selectLocationData.selectedCity || selectLocationData.selectedState);
} else { } else {
return !this.pqrAdminMode && this.pqrMode; return !this.pqrAdminMode && this.pqrMode;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment