Skip to content
Snippets Groups Projects
Commit 3223c211 authored by Névisson Gonçalves's avatar Névisson Gonçalves
Browse files

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

parent 66f7951d
Branches
No related tags found
1 merge request!1v1
...@@ -44,7 +44,11 @@ ...@@ -44,7 +44,11 @@
</tr> </tr>
<tr> <tr>
<th rowspan="2">Demanda por construção</th> <th rowspan="2">Demanda por construção</th>
<th *ngIf="!pqrMode" colspan="2">Quantidade</th> <th *ngIf="!pqrMode" colspan="2">
<span [class.projection-title]="disabledData" [popover]="popoverText" placement="bottom"
container="body" [triggers]="popoverTriggers" [isOpen]="disabledData"
containerClass="popover-simcaq result">Quantidade</span>
</th>
<th rowspan="2">Dimensão m2</th> <th rowspan="2">Dimensão m2</th>
<th rowspan="2">Unidade de medida</th> <th rowspan="2">Unidade de medida</th>
<th *ngIf="!pqrMode" rowspan="2">Preço por m2</th> <th *ngIf="!pqrMode" rowspan="2">Preço por m2</th>
...@@ -60,19 +64,19 @@ ...@@ -60,19 +64,19 @@
<ng-container *ngIf="!pqrMode"> <ng-container *ngIf="!pqrMode">
<td *ngFor="let loc of room.numberDemandLocation"> <td *ngFor="let loc of room.numberDemandLocation">
<input type="text" class="form-control location" [(ngModel)]="loc.value" <input type="text" class="form-control location" [(ngModel)]="loc.value"
[disabled]="!pqrAdminMode && pqrMode" currencyMask [disabled]="disabledData" currencyMask
[options]="{ prefix: '', align: 'right', precision: 0, thousands: '.', decimal: ',' }"> [options]="{ prefix: '', align: 'right', precision: 0, thousands: '.', decimal: ',' }">
</td> </td>
</ng-container> </ng-container>
<td> <td>
<input type="text" class="form-control dimension plan-value" [(ngModel)]="room.dimension" <input type="text" class="form-control dimension plan-value" [(ngModel)]="room.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">{{room.unitOfMeasurement.description}}</td> <td class="unit-measurement-description">{{room.unitOfMeasurement.description}}</td>
<td *ngIf="!pqrMode"> <td *ngIf="!pqrMode">
<input type="text" class="form-control unit-price plan-value" [(ngModel)]="room.unitPrice" <input type="text" class="form-control unit-price plan-value" [(ngModel)]="room.unitPrice"
[disabled]="!pqrAdminMode && pqrMode" currencyMask [disabled]="disabledData" currencyMask
[options]="{ prefix: 'R$ ', align: 'right', precision: 2, thousands: '.', decimal: ',' }"> [options]="{ prefix: 'R$ ', align: 'right', precision: 2, thousands: '.', decimal: ',' }">
</td> </td>
<td *ngIf="!pqrMode">{{room.referenceDate}}</td> <td *ngIf="!pqrMode">{{room.referenceDate}}</td>
......
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';
...@@ -18,7 +18,7 @@ import { SelectLocation } from '../../select-location/entities/select-location'; ...@@ -18,7 +18,7 @@ import { SelectLocation } from '../../select-location/entities/select-location';
templateUrl: './new-room-building.component.html', templateUrl: './new-room-building.component.html',
styleUrls: ['./new-room-building.component.scss'] styleUrls: ['./new-room-building.component.scss']
}) })
export class NewRoomBuildingComponent extends BaseNavigableComponent<NewRoomsBuildings> implements PqrComponentData { export class NewRoomBuildingComponent extends BaseNavigableComponent<NewRoomsBuildings> implements PqrComponentData, OnInit {
data: NewRoomsBuildings = new NewRoomsBuildings(); data: NewRoomsBuildings = new NewRoomsBuildings();
functionality: FunctionalityInfo = Functionality.newRoomBuilding; functionality: FunctionalityInfo = Functionality.newRoomBuilding;
...@@ -29,6 +29,10 @@ export class NewRoomBuildingComponent extends BaseNavigableComponent<NewRoomsBui ...@@ -29,6 +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;
disabledData: boolean = true;
popoverTriggers: string;
popoverText: string = 'Esses parâmetros só podem ser alterados para simulações em nível municipal ou estadual. ' +
'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;
referenceDateMask: any = this.utilitiesService.getReferenceDateMask(); referenceDateMask: any = this.utilitiesService.getReferenceDateMask();
...@@ -37,6 +41,15 @@ export class NewRoomBuildingComponent extends BaseNavigableComponent<NewRoomsBui ...@@ -37,6 +41,15 @@ export class NewRoomBuildingComponent extends BaseNavigableComponent<NewRoomsBui
super(injector); super(injector);
} }
ngOnInit(): void {
super.ngOnInit();
this.disabledData = this.processDisabledData();
if (this.disabledData) {
this.popoverTriggers = 'mouseenter:mouseleave';
}
}
processData(): Observable<NewRoomsBuildings> { processData(): Observable<NewRoomsBuildings> {
return this.newRoomBuildingService.getData(); return this.newRoomBuildingService.getData();
} }
...@@ -124,4 +137,18 @@ export class NewRoomBuildingComponent extends BaseNavigableComponent<NewRoomsBui ...@@ -124,4 +137,18 @@ export class NewRoomBuildingComponent extends BaseNavigableComponent<NewRoomsBui
})); }));
} }
} }
processDisabledData(pqrAdminMode: boolean = false): boolean {
if (pqrAdminMode) {
return false;
} else {
if (!(!this.pqrAdminMode && this.pqrMode)) {
const selectLocationData: SelectLocation = this.sessionService.getItem<SelectLocation>(Functionality.selectLocation.key);
return this.disabledData = !selectLocationData || !(selectLocationData.selectedCity || selectLocationData.selectedState);
} else {
return !this.pqrAdminMode && this.pqrMode;
}
}
}
} }
import { Footnote } from './../../../../shared/components/footnote/entities/footnote';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs'; import { Observable, of } from 'rxjs';
...@@ -10,6 +9,7 @@ import { SchoolStaff } from '../entities/school-staff'; ...@@ -10,6 +9,7 @@ import { SchoolStaff } from '../entities/school-staff';
import { SchoolsStaff } from '../entities/schools-staff'; import { SchoolsStaff } from '../entities/schools-staff';
import { NavigableComponentService } from '../../../shared/entities/base/navigable-component-service'; import { NavigableComponentService } from '../../../shared/entities/base/navigable-component-service';
import { CurrentYearService } from '../../../shared/services/current-year/current-year.service'; import { CurrentYearService } from '../../../shared/services/current-year/current-year.service';
import { Footnote } from './../../../../shared/components/footnote/entities/footnote';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment