@smarterplan/ngx-smarterplan-locations 0.2.44 → 0.2.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/components/carousel/carousel.component.mjs +28 -0
- package/esm2020/lib/components/chevron/chevron.component.mjs +18 -0
- package/esm2020/lib/components/detail-location/detail-location.component.mjs +168 -0
- package/esm2020/lib/components/form-location/form-location.component.mjs +237 -0
- package/esm2020/lib/components/images/images.component.mjs +107 -0
- package/esm2020/lib/components/locations/locations.component.mjs +145 -0
- package/esm2020/lib/components/locations/map/map-popup/map-popup.component.mjs +66 -0
- package/esm2020/lib/components/locations/map/map.component.mjs +91 -0
- package/esm2020/lib/components/plan-legend/plan-legend.component.mjs +47 -0
- package/esm2020/lib/components/plans/calibration/calibration.component.mjs +468 -0
- package/esm2020/lib/components/plans/edit-plan/edit-plan.component.mjs +324 -0
- package/esm2020/lib/components/plans/plans.component.mjs +225 -0
- package/esm2020/lib/components/tab-navigation/tab-navigation.component.mjs +41 -0
- package/esm2020/lib/components/visits/visits.component.mjs +283 -0
- package/esm2020/lib/components/zones/add-audio-zone/add-audio-zone.component.mjs +230 -0
- package/esm2020/lib/components/zones/add-zone/add-zone.component.mjs +315 -0
- package/esm2020/lib/components/zones/add-zone/selection/selection.component.mjs +77 -0
- package/esm2020/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.mjs +502 -0
- package/esm2020/lib/components/zones/zones.component.mjs +268 -0
- package/esm2020/lib/helper.service.mjs +134 -0
- package/esm2020/lib/ngx-smarterplan-location-routing.module.mjs +49 -0
- package/esm2020/lib/ngx-smarterplan-locations.module.mjs +125 -0
- package/esm2020/lib/ngx-smarterplan-locations.service.mjs +14 -0
- package/esm2020/lib/pipes/count-audio-sweeps.pipe.mjs +27 -0
- package/esm2020/lib/radio-button/radio-button.component.mjs +26 -0
- package/esm2020/public-api.mjs +9 -0
- package/esm2020/smarterplan-ngx-smarterplan-locations.mjs +5 -0
- package/fesm2015/smarterplan-ngx-smarterplan-locations.mjs +3991 -0
- package/fesm2015/smarterplan-ngx-smarterplan-locations.mjs.map +1 -0
- package/fesm2020/smarterplan-ngx-smarterplan-locations.mjs +3828 -0
- package/fesm2020/smarterplan-ngx-smarterplan-locations.mjs.map +1 -0
- package/lib/components/carousel/carousel.component.d.ts +12 -0
- package/lib/components/chevron/chevron.component.d.ts +9 -0
- package/lib/components/detail-location/detail-location.component.d.ts +55 -0
- package/lib/components/form-location/form-location.component.d.ts +45 -0
- package/lib/components/images/images.component.d.ts +33 -0
- package/lib/components/locations/locations.component.d.ts +51 -0
- package/lib/components/locations/map/map-popup/map-popup.component.d.ts +22 -0
- package/lib/components/locations/map/map.component.d.ts +22 -0
- package/lib/components/plan-legend/plan-legend.component.d.ts +14 -0
- package/lib/components/plans/calibration/calibration.component.d.ts +140 -0
- package/lib/components/plans/edit-plan/edit-plan.component.d.ts +55 -0
- package/lib/components/plans/plans.component.d.ts +63 -0
- package/lib/components/tab-navigation/tab-navigation.component.d.ts +13 -0
- package/lib/components/visits/visits.component.d.ts +62 -0
- package/lib/components/zones/add-audio-zone/add-audio-zone.component.d.ts +63 -0
- package/lib/components/zones/add-zone/add-zone.component.d.ts +69 -0
- package/lib/components/zones/add-zone/selection/selection.component.d.ts +44 -0
- package/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.d.ts +107 -0
- package/lib/components/zones/zones.component.d.ts +73 -0
- package/lib/helper.service.d.ts +53 -0
- package/lib/ngx-smarterplan-location-routing.module.d.ts +7 -0
- package/lib/ngx-smarterplan-locations.module.d.ts +36 -0
- package/lib/ngx-smarterplan-locations.service.d.ts +6 -0
- package/lib/pipes/count-audio-sweeps.pipe.d.ts +10 -0
- package/lib/radio-button/radio-button.component.d.ts +12 -0
- package/package.json +22 -5
- package/{src/public-api.ts → public-api.d.ts} +4 -11
- package/smarterplan-ngx-smarterplan-locations.d.ts +5 -0
- package/.browserslistrc +0 -16
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -7
- package/src/lib/components/carousel/carousel.component.html +0 -13
- package/src/lib/components/carousel/carousel.component.scss +0 -0
- package/src/lib/components/carousel/carousel.component.spec.ts +0 -25
- package/src/lib/components/carousel/carousel.component.ts +0 -31
- package/src/lib/components/chevron/chevron.component.html +0 -5
- package/src/lib/components/chevron/chevron.component.scss +0 -16
- package/src/lib/components/chevron/chevron.component.spec.ts +0 -25
- package/src/lib/components/chevron/chevron.component.ts +0 -17
- package/src/lib/components/detail-location/detail-location.component.html +0 -108
- package/src/lib/components/detail-location/detail-location.component.scss +0 -0
- package/src/lib/components/detail-location/detail-location.component.spec.ts +0 -25
- package/src/lib/components/detail-location/detail-location.component.ts +0 -215
- package/src/lib/components/form-location/form-location.component.html +0 -160
- package/src/lib/components/form-location/form-location.component.scss +0 -62
- package/src/lib/components/form-location/form-location.component.spec.ts +0 -25
- package/src/lib/components/form-location/form-location.component.ts +0 -274
- package/src/lib/components/images/images.component.html +0 -27
- package/src/lib/components/images/images.component.scss +0 -0
- package/src/lib/components/images/images.component.spec.ts +0 -25
- package/src/lib/components/images/images.component.ts +0 -133
- package/src/lib/components/locations/locations.component.html +0 -63
- package/src/lib/components/locations/locations.component.scss +0 -121
- package/src/lib/components/locations/locations.component.spec.ts +0 -25
- package/src/lib/components/locations/locations.component.ts +0 -186
- package/src/lib/components/locations/map/map-popup/map-popup.component.html +0 -11
- package/src/lib/components/locations/map/map-popup/map-popup.component.scss +0 -51
- package/src/lib/components/locations/map/map-popup/map-popup.component.spec.ts +0 -25
- package/src/lib/components/locations/map/map-popup/map-popup.component.ts +0 -79
- package/src/lib/components/locations/map/map.component.html +0 -2
- package/src/lib/components/locations/map/map.component.scss +0 -0
- package/src/lib/components/locations/map/map.component.spec.ts +0 -25
- package/src/lib/components/locations/map/map.component.ts +0 -111
- package/src/lib/components/plan-legend/plan-legend.component.html +0 -9
- package/src/lib/components/plan-legend/plan-legend.component.scss +0 -38
- package/src/lib/components/plan-legend/plan-legend.component.spec.ts +0 -25
- package/src/lib/components/plan-legend/plan-legend.component.ts +0 -50
- package/src/lib/components/plans/calibration/calibration.component.html +0 -98
- package/src/lib/components/plans/calibration/calibration.component.scss +0 -136
- package/src/lib/components/plans/calibration/calibration.component.spec.ts +0 -25
- package/src/lib/components/plans/calibration/calibration.component.ts +0 -603
- package/src/lib/components/plans/edit-plan/edit-plan.component.html +0 -77
- package/src/lib/components/plans/edit-plan/edit-plan.component.scss +0 -9
- package/src/lib/components/plans/edit-plan/edit-plan.component.spec.ts +0 -25
- package/src/lib/components/plans/edit-plan/edit-plan.component.ts +0 -421
- package/src/lib/components/plans/plans.component.html +0 -102
- package/src/lib/components/plans/plans.component.scss +0 -24
- package/src/lib/components/plans/plans.component.spec.ts +0 -25
- package/src/lib/components/plans/plans.component.ts +0 -305
- package/src/lib/components/tab-navigation/tab-navigation.component.html +0 -7
- package/src/lib/components/tab-navigation/tab-navigation.component.scss +0 -27
- package/src/lib/components/tab-navigation/tab-navigation.component.spec.ts +0 -25
- package/src/lib/components/tab-navigation/tab-navigation.component.ts +0 -35
- package/src/lib/components/visits/visits.component.html +0 -134
- package/src/lib/components/visits/visits.component.scss +0 -24
- package/src/lib/components/visits/visits.component.spec.ts +0 -25
- package/src/lib/components/visits/visits.component.ts +0 -357
- package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.html +0 -73
- package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.scss +0 -14
- package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.spec.ts +0 -25
- package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.ts +0 -269
- package/src/lib/components/zones/add-zone/add-zone.component.html +0 -153
- package/src/lib/components/zones/add-zone/add-zone.component.scss +0 -44
- package/src/lib/components/zones/add-zone/add-zone.component.spec.ts +0 -25
- package/src/lib/components/zones/add-zone/add-zone.component.ts +0 -377
- package/src/lib/components/zones/add-zone/selection/selection.component.html +0 -3
- package/src/lib/components/zones/add-zone/selection/selection.component.scss +0 -16
- package/src/lib/components/zones/add-zone/selection/selection.component.spec.ts +0 -25
- package/src/lib/components/zones/add-zone/selection/selection.component.ts +0 -95
- package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.html +0 -73
- package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.scss +0 -23
- package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.spec.ts +0 -25
- package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.ts +0 -595
- package/src/lib/components/zones/zones.component.html +0 -181
- package/src/lib/components/zones/zones.component.scss +0 -36
- package/src/lib/components/zones/zones.component.spec.ts +0 -25
- package/src/lib/components/zones/zones.component.ts +0 -339
- package/src/lib/helper.service.ts +0 -161
- package/src/lib/ngx-smarterplan-location-routing.module.ts +0 -41
- package/src/lib/ngx-smarterplan-locations.module.ts +0 -74
- package/src/lib/ngx-smarterplan-locations.service.spec.ts +0 -16
- package/src/lib/ngx-smarterplan-locations.service.ts +0 -9
- package/src/lib/pipes/count-audio-sweeps.pipe.ts +0 -21
- package/src/lib/radio-button/radio-button.component.html +0 -9
- package/src/lib/radio-button/radio-button.component.scss +0 -152
- package/src/lib/radio-button/radio-button.component.spec.ts +0 -25
- package/src/lib/radio-button/radio-button.component.ts +0 -26
- package/src/test.ts +0 -27
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { ChevronComponent } from './chevron.component';
|
|
4
|
-
|
|
5
|
-
describe('ChevronComponent', () => {
|
|
6
|
-
let component: ChevronComponent;
|
|
7
|
-
let fixture: ComponentFixture<ChevronComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [ ChevronComponent ]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(ChevronComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Component({
|
|
4
|
-
selector: 'lib-chevron',
|
|
5
|
-
templateUrl: './chevron.component.html',
|
|
6
|
-
styleUrls: ['./chevron.component.scss']
|
|
7
|
-
})
|
|
8
|
-
export class ChevronComponent implements OnInit {
|
|
9
|
-
|
|
10
|
-
@Input() conditionShowing = false;
|
|
11
|
-
|
|
12
|
-
constructor() { }
|
|
13
|
-
|
|
14
|
-
ngOnInit(): void {
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
<div class="container-fluid">
|
|
2
|
-
<div class="m-3">
|
|
3
|
-
<lib-tab-navigation [menuItems]='menuItems' (onGoBack)="reset()"></lib-tab-navigation>
|
|
4
|
-
</div>
|
|
5
|
-
<button class="btn btn-outline-primary rounded-pill me-3" (click)="onReturn()">{{'Back to locations' |
|
|
6
|
-
translate}}</button>
|
|
7
|
-
<div class="row" *ngIf="!isEditing && space">
|
|
8
|
-
<div class="col-md-5">
|
|
9
|
-
<ul class="list-group list-group-flush">
|
|
10
|
-
<li class="list-group-item bg-transparent">{{'Name' | translate}}: {{space.name}} </li>
|
|
11
|
-
<li class="list-group-item bg-transparent">{{'Address' | translate}}: {{space.addresses}} </li>
|
|
12
|
-
<li class="list-group-item bg-transparent">{{'Construction year' | translate}}:
|
|
13
|
-
{{space.constructionYear ?
|
|
14
|
-
space.constructionYear : "No data" | translate}} </li>
|
|
15
|
-
<li class="list-group-item bg-transparent">{{'Latitude' | translate}}:
|
|
16
|
-
{{space.latitude ?
|
|
17
|
-
space.latitude : "No data" | translate}}</li>
|
|
18
|
-
<li class="list-group-item bg-transparent">{{'Longitude' | translate}}: {{space.longitude ?
|
|
19
|
-
space.longitude : "No data" | translate}} </li>
|
|
20
|
-
<li class="list-group-item bg-transparent">{{'Access level' | translate}}: {{space.level | translate
|
|
21
|
-
}} </li>
|
|
22
|
-
<li class="list-group-item bg-transparent">{{'Energy Class' | translate}}:
|
|
23
|
-
{{space.classEnergyConsumption ?
|
|
24
|
-
space.classEnergyConsumption : "No data" | translate}}
|
|
25
|
-
<button *ngIf="space.status !== 'DPE_TO_VALIDATE'"
|
|
26
|
-
class="btn btn-outline-primary rounded-pill no-lowercase ms-5" (click)="onGetDpeData()">
|
|
27
|
-
{{'Get data from API DPE' | translate}}</button>
|
|
28
|
-
<a class="bg-transparent ms-5" *ngIf="space.status === 'DPE_TO_VALIDATE'"
|
|
29
|
-
(click)="onDpeValidate()" style="cursor: pointer;">
|
|
30
|
-
<span class="iconify" data-icon="mdi:alert-circle-check" style="color: #f19c80;" data-width="25"
|
|
31
|
-
data-height="25"></span>
|
|
32
|
-
{{'DPE data found. Click to validate' | translate}}
|
|
33
|
-
</a>
|
|
34
|
-
</li>
|
|
35
|
-
<li class="list-group-item bg-transparent">{{'Greenhouse gas emission Class' | translate}}:
|
|
36
|
-
{{space.classGes ? space.classGes : "No data" | translate}} </li>
|
|
37
|
-
<li class="list-group-item bg-transparent">{{'Shareable Guest Link' | translate}}:
|
|
38
|
-
<div style="display: inline;" *ngIf="guestLink">
|
|
39
|
-
<a id="linkHref" target="_blank">{{'Try the link' | translate }}</a>
|
|
40
|
-
<div ngxClipboard [cbContent]="guestLink" [style.cursor]="'pointer'"
|
|
41
|
-
style="margin-left: 5px; max-width: 20px; display: inline;" ngbTooltip="Copied!"
|
|
42
|
-
triggers="click:blur">
|
|
43
|
-
<span class="iconify" data-icon="mdi:content-copy" data-inline="false" data-width="20"
|
|
44
|
-
data-height="20"></span>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
<p *ngIf="!guestLink" style="display: inline;">{{'No link' | translate }}</p>
|
|
48
|
-
<p *ngIf="!guestLink"><small>({{'Generate link from a VISITOR mission'|translate}})</small>
|
|
49
|
-
</p>
|
|
50
|
-
</li>
|
|
51
|
-
|
|
52
|
-
</ul>
|
|
53
|
-
<div class="d-flex justify-content-center" *ngIf="gettingData">
|
|
54
|
-
<div class="spinner-border" role="status">
|
|
55
|
-
<span class="visually-hidden">Loading...</span>
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
<hr>
|
|
59
|
-
<div class="d-flex">
|
|
60
|
-
<button class="btn btn-outline-primary rounded-pill me-3" (click)="onEdit()" data-testid="location-edit-btn">{{'Edit' |
|
|
61
|
-
translate}}</button>
|
|
62
|
-
<div class="tooltip-wrapper" ngbTooltip="{{!canArchive ? ('Contact SmarterPlan' | translate) : ('Archive location and related data' | translate)}}">
|
|
63
|
-
<button class="btn btn-outline-primary rounded-pill" (click)="onArchive()" [disabled]="!canArchive">
|
|
64
|
-
{{'Archive' | translate}}</button>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
</div>
|
|
70
|
-
<div class="col-md-7" *ngIf="isValidatingDpe">
|
|
71
|
-
<h6>{{'Most relevant results for' | translate}} :
|
|
72
|
-
<b>diagnostics de performance énergétique (DPE) des bâtiments tertiaires</b></h6>
|
|
73
|
-
<table class="table table-striped">
|
|
74
|
-
<thead>
|
|
75
|
-
<tr>
|
|
76
|
-
<th scope="col">#</th>
|
|
77
|
-
<th scope="col">{{'Apply to location' | translate}}</th>
|
|
78
|
-
<th scope="col">{{'Address' | translate}}</th>
|
|
79
|
-
<th scope="col">{{'Activity sector' | translate}}</th>
|
|
80
|
-
<th scope="col">{{'Construction year' | translate}}</th>
|
|
81
|
-
<th scope="col">{{'Energy Class' | translate}}</th>
|
|
82
|
-
<th scope="col">{{'Greenhouse gas emission Class' | translate}}</th>
|
|
83
|
-
</tr>
|
|
84
|
-
</thead>
|
|
85
|
-
<tbody>
|
|
86
|
-
<tr *ngFor="let result of parsedMetadata; index as i">
|
|
87
|
-
<th scope="row">{{ i + 1 }}</th>
|
|
88
|
-
<td><input class="checkbox-apply" type="checkbox" [(ngModel)]="result.selected"
|
|
89
|
-
(change)="onSelectChange(result)"></td>
|
|
90
|
-
<td>{{result.geo_adresse}}</td>
|
|
91
|
-
<td>{{result.secteur_activite}}</td>
|
|
92
|
-
<td>{{ result.annee_construction }}</td>
|
|
93
|
-
<td>{{ result.classe_consommation_energie }}</td>
|
|
94
|
-
<td>{{ result.classe_estimation_ges }}</td>
|
|
95
|
-
</tr>
|
|
96
|
-
</tbody>
|
|
97
|
-
</table>
|
|
98
|
-
<button class="btn btn-outline-primary rounded-pill me-2" (click)="onSaveResult()"
|
|
99
|
-
[disabled]="!selectedDpeResult">{{'Save selected' |
|
|
100
|
-
translate}}</button>
|
|
101
|
-
<button class="btn btn-outline-primary rounded-pill me-2" (click)="onErase()">
|
|
102
|
-
{{'No match (erase data)' | translate}}</button>
|
|
103
|
-
<button class="btn btn-outline-primary rounded-pill me-2" (click)="onCancel()">
|
|
104
|
-
{{'Cancel' | translate}}</button>
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
<lib-form-location *ngIf="isEditing" [location]="space" (onChange)="onFormChange($event)"></lib-form-location>
|
|
108
|
-
</div>
|
|
File without changes
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { DetailLocationComponent } from './detail-location.component';
|
|
4
|
-
|
|
5
|
-
describe('DetailLocationComponent', () => {
|
|
6
|
-
let component: DetailLocationComponent;
|
|
7
|
-
let fixture: ComponentFixture<DetailLocationComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [ DetailLocationComponent ]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(DetailLocationComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit } from '@angular/core';
|
|
2
|
-
import { FormGroup } from '@angular/forms';
|
|
3
|
-
import { ActivatedRoute, Router } from '@angular/router';
|
|
4
|
-
import { TranslateService } from '@ngx-translate/core';
|
|
5
|
-
import { MenuItem, SpaceService, BaseUserService, NavigatorService, SpaceStatus, Space } from '@smarterplan/ngx-smarterplan-core';
|
|
6
|
-
import { Subject, takeUntil } from 'rxjs';
|
|
7
|
-
|
|
8
|
-
@Component({
|
|
9
|
-
selector: 'lib-detail-location',
|
|
10
|
-
templateUrl: './detail-location.component.html',
|
|
11
|
-
styleUrls: ['./detail-location.component.scss']
|
|
12
|
-
})
|
|
13
|
-
export class DetailLocationComponent implements OnInit {
|
|
14
|
-
|
|
15
|
-
space: Space;
|
|
16
|
-
|
|
17
|
-
editForm: FormGroup;
|
|
18
|
-
|
|
19
|
-
isEditing = false;
|
|
20
|
-
|
|
21
|
-
imageToUpload: File;
|
|
22
|
-
|
|
23
|
-
id: string;
|
|
24
|
-
|
|
25
|
-
menuItems: MenuItem[] = [];
|
|
26
|
-
|
|
27
|
-
isValidatingDpe = false;
|
|
28
|
-
|
|
29
|
-
selectedDpeResult: any;
|
|
30
|
-
|
|
31
|
-
gettingData = false;
|
|
32
|
-
|
|
33
|
-
parsedMetadata: {
|
|
34
|
-
geo_adresse: string;
|
|
35
|
-
secteur_activite: string;
|
|
36
|
-
annee_construction: string;
|
|
37
|
-
classe_consommation_energie: string;
|
|
38
|
-
classe_estimation_ges: string;
|
|
39
|
-
selected: boolean;
|
|
40
|
-
}[];
|
|
41
|
-
|
|
42
|
-
guestLink: string;
|
|
43
|
-
|
|
44
|
-
canArchive: boolean;
|
|
45
|
-
|
|
46
|
-
destroy$ = new Subject();
|
|
47
|
-
|
|
48
|
-
constructor(
|
|
49
|
-
private route: ActivatedRoute,
|
|
50
|
-
private spaceService: SpaceService,
|
|
51
|
-
private router: Router,
|
|
52
|
-
private userService: BaseUserService,
|
|
53
|
-
private translate: TranslateService,
|
|
54
|
-
private navigatorService: NavigatorService,
|
|
55
|
-
) {
|
|
56
|
-
this.navigatorService.locationIDChange
|
|
57
|
-
.pipe(takeUntil(this.destroy$))
|
|
58
|
-
.subscribe((spaceID) => {
|
|
59
|
-
this.router.navigate(["dashboard/localisation", spaceID]);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
this.route.params.subscribe((params) => {
|
|
63
|
-
this.id = params.id;
|
|
64
|
-
this.setup();
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
ngOnInit() { }
|
|
69
|
-
|
|
70
|
-
async setup() {
|
|
71
|
-
this.space = await this.spaceService.getSpace(this.id);
|
|
72
|
-
this.setupMenuItems();
|
|
73
|
-
this.setGuestLink();
|
|
74
|
-
this.setCanArchive();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
ngOnDestroy() {
|
|
78
|
-
this.destroy$.next(true);
|
|
79
|
-
this.destroy$.complete();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
setupMenuItems() {
|
|
83
|
-
this.menuItems = [
|
|
84
|
-
{ label: "Locations", url: "/localisation" },
|
|
85
|
-
{
|
|
86
|
-
label: this.space.name,
|
|
87
|
-
url: `/localisation/${this.space.id}`,
|
|
88
|
-
},
|
|
89
|
-
];
|
|
90
|
-
|
|
91
|
-
if (this.isEditing) {
|
|
92
|
-
this.menuItems.push({ label: "Edit" });
|
|
93
|
-
} else {
|
|
94
|
-
this.menuItems.push({ label: "Information" });
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
onEdit() {
|
|
99
|
-
this.isEditing = true;
|
|
100
|
-
this.setupMenuItems();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
onReturn() {
|
|
104
|
-
// this.locationService.back()
|
|
105
|
-
this.router.navigate(["dashboard/localisation"]);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
reset() {
|
|
109
|
-
this.isEditing = false;
|
|
110
|
-
this.setupMenuItems();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
async onArchive() {
|
|
114
|
-
const message = this.translate.instant("confirm.archiveSpace");
|
|
115
|
-
if (window.confirm(message)) {
|
|
116
|
-
await this.spaceService.softDeleteSpace(this.id);
|
|
117
|
-
this.onReturn();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
onFormChange(event: Space) {
|
|
122
|
-
this.isEditing = false;
|
|
123
|
-
if (event) {
|
|
124
|
-
this.space = event;
|
|
125
|
-
}
|
|
126
|
-
this.setupMenuItems();
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
onDpeValidate() {
|
|
130
|
-
this.isValidatingDpe = true;
|
|
131
|
-
this.parsedMetadata = JSON.parse(this.space.metadata);
|
|
132
|
-
this.parsedMetadata = this.parsedMetadata.filter(
|
|
133
|
-
(result) => result.geo_adresse,
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
onSelectChange(selectedResult: any) {
|
|
138
|
-
for (const result of this.parsedMetadata) {
|
|
139
|
-
if (result !== selectedResult && result.selected) {
|
|
140
|
-
result.selected = false;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
this.selectedDpeResult = selectedResult;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
async onSaveResult() {
|
|
147
|
-
if (this.selectedDpeResult) {
|
|
148
|
-
const input = {
|
|
149
|
-
id: this.space.id,
|
|
150
|
-
constructionYear: this.selectedDpeResult.annee_construction,
|
|
151
|
-
classEnergyConsumption:
|
|
152
|
-
this.selectedDpeResult.classe_consommation_energie,
|
|
153
|
-
classGes: this.selectedDpeResult.classe_estimation_ges,
|
|
154
|
-
status: SpaceStatus.DPE_VALIDATED,
|
|
155
|
-
};
|
|
156
|
-
const updatedLoc = await this.spaceService.updateSpace(input);
|
|
157
|
-
this.space = updatedLoc;
|
|
158
|
-
this.isValidatingDpe = false;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
onCancel() {
|
|
163
|
-
this.isValidatingDpe = false;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
async onErase() {
|
|
167
|
-
await this.spaceService.updateSpace({
|
|
168
|
-
id: this.space.id,
|
|
169
|
-
status: SpaceStatus.DPE_VALIDATED,
|
|
170
|
-
});
|
|
171
|
-
this.space.status = SpaceStatus.DPE_VALIDATED;
|
|
172
|
-
this.isValidatingDpe = false;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
async onGetDpeData() {
|
|
176
|
-
this.gettingData = true;
|
|
177
|
-
await this.spaceService.updateSpace({
|
|
178
|
-
id: this.space.id,
|
|
179
|
-
status: SpaceStatus.DPE_FETCH,
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
// force update of location
|
|
183
|
-
setTimeout(async () => {
|
|
184
|
-
this.space = await this.spaceService.getSpace(this.space.id);
|
|
185
|
-
this.gettingData = false;
|
|
186
|
-
}, 1500);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
setGuestLink() {
|
|
190
|
-
if (this.space.guestLink) {
|
|
191
|
-
const { origin } = document.location;
|
|
192
|
-
this.guestLink = `${origin}/${this.space.guestLink}`;
|
|
193
|
-
setTimeout(() => {
|
|
194
|
-
const hyperlink = document.querySelector(
|
|
195
|
-
"#linkHref",
|
|
196
|
-
) as HTMLLinkElement;
|
|
197
|
-
const message = this.translate.instant("confirm.followLink");
|
|
198
|
-
hyperlink.addEventListener("click", async () => {
|
|
199
|
-
if (window.confirm(message)) {
|
|
200
|
-
window.location.href = this.guestLink;
|
|
201
|
-
await this.userService.logoutCurrentAndSignOutAuth();
|
|
202
|
-
this.router.navigate(["auth"]);
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
}, 0);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
async setCanArchive() {
|
|
210
|
-
this.canArchive = this.userService.isSPAdmin()
|
|
211
|
-
? true
|
|
212
|
-
: await this.spaceService.canArchiveSpace(this.id);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
<div class="col-md-6 form-new-loc" *ngIf="form">
|
|
2
|
-
<form (ngSubmit)="onSubmit()" [formGroup]="form">
|
|
3
|
-
|
|
4
|
-
<div class="mb-3 row">
|
|
5
|
-
<label class="col-sm-3 col-form-label">{{'Name' | translate}} *</label>
|
|
6
|
-
<div class="col-sm-9">
|
|
7
|
-
<input type="text" class="form-control" data-testid="new-location-name" (ngModelChange)="onFormChange()"
|
|
8
|
-
[ngClass]="{'is-invalid' : validatorsService.isControlError(form.controls['name'])|| isFormError(form.controls['name'])}"
|
|
9
|
-
required formControlName="name">
|
|
10
|
-
|
|
11
|
-
<div class="invalid-feedback">
|
|
12
|
-
<ngb-alert data-testid="new-location-name-invalid" [dismissible]="false" type="danger" *ngIf="validatorsService.isControlError(form.controls['name'])
|
|
13
|
-
|| isFormError(form.controls['name'])">
|
|
14
|
-
{{validatorsService.getError(form.controls['name']) | translate}}
|
|
15
|
-
</ngb-alert>
|
|
16
|
-
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
<div class="mb-3 row">
|
|
21
|
-
<label class="col-sm-3 col-form-label">{{'Address' | translate}}</label>
|
|
22
|
-
<div class="col-sm-9">
|
|
23
|
-
<input type="text" class="form-control" formControlName="addresses" data-testid="new-location-address" (ngModelChange)="onFormChange()"
|
|
24
|
-
[ngClass]="{'is-invalid' : validatorsService.isControlError(form.controls['addresses']) || isFormError(form.controls['addresses'])}">
|
|
25
|
-
<div class="invalid-feedback">
|
|
26
|
-
<span data-testid="" [translate]="validatorsService.getError(form.controls['addresses'])"
|
|
27
|
-
*ngIf=" validatorsService.isControlError(form.controls['addresses'])"></span>
|
|
28
|
-
|
|
29
|
-
<ngb-alert data-testid="new-location-address-invalid" [dismissible]="false" type="danger"
|
|
30
|
-
*ngIf="validatorsService.isControlError(form.controls['addresses']) ">
|
|
31
|
-
|
|
32
|
-
{{validatorsService.getError(form.controls['addresses']) | translate}}
|
|
33
|
-
</ngb-alert>
|
|
34
|
-
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
<div class="mb-3 row">
|
|
40
|
-
<label class="col-sm-3 col-form-label">{{'Construction year' | translate}}</label>
|
|
41
|
-
<div class="col-sm-9">
|
|
42
|
-
<input type="text" class="form-control" formControlName="constructionYear"
|
|
43
|
-
data-testid="new-location-constructionYear" (ngModelChange)="onFormChange()"
|
|
44
|
-
[ngClass]="{'is-invalid' : validatorsService.isControlError(form.controls['constructionYear']) || isFormError(form.controls['constructionYear'])}">
|
|
45
|
-
<div class="invalid-feedback">
|
|
46
|
-
<ngb-alert data-testid="new-location-constructionYear-invalid" [dismissible]="false" type="danger"
|
|
47
|
-
*ngIf="validatorsService.isControlError(form.controls['constructionYear']) || isFormError(form.controls['constructionYear'])">
|
|
48
|
-
{{validatorsService.getError(form.controls['constructionYear']) | translate}}
|
|
49
|
-
</ngb-alert>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
<div class="mb-3 row">
|
|
55
|
-
<label class="col-sm-3 col-form-label">{{'Latitude' | translate}}</label>
|
|
56
|
-
<div class="col-sm-9">
|
|
57
|
-
<input type="text" class="form-control" formControlName="latitude" data-testid="new-location-latitude" (ngModelChange)="onFormChange()"
|
|
58
|
-
[ngClass]="{'is-invalid' : validatorsService.isControlError(form.controls['latitude'])|| isFormError(form.controls['latitude'])}">
|
|
59
|
-
<div class="invalid-feedback">
|
|
60
|
-
<ngb-alert data-testid="new-location-latitude-invalid" [dismissible]="false" type="danger"
|
|
61
|
-
*ngIf="validatorsService.isControlError(form.controls['latitude']) || isFormError(form.controls['latitude'])">
|
|
62
|
-
{{validatorsService.getError(form.controls['latitude']) | translate}}
|
|
63
|
-
</ngb-alert>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
<div class="mb-3 row">
|
|
69
|
-
<label class="col-sm-3 col-form-label">{{'Longitude' | translate}}</label>
|
|
70
|
-
<div class="col-sm-9">
|
|
71
|
-
<input type="text" class="form-control" formControlName="longitude" data-testid="new-location-longitude" (ngModelChange)="onFormChange()"
|
|
72
|
-
[ngClass]="{'is-invalid' : validatorsService.isControlError(form.controls['longitude'])|| isFormError(form.controls['longitude'])}">
|
|
73
|
-
<div class="invalid-feedback">
|
|
74
|
-
<ngb-alert data-testid="new-location-longitude-invalid" [dismissible]="false" type="danger"
|
|
75
|
-
*ngIf="validatorsService.isControlError(form.controls['longitude']) || isFormError(form.controls['longitude'])">
|
|
76
|
-
{{validatorsService.getError(form.controls['longitude']) | translate}}
|
|
77
|
-
</ngb-alert>
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
<div class="mb-3 row">
|
|
83
|
-
<label class="col-sm-3 col-form-label">{{'Access level' | translate}}</label>
|
|
84
|
-
<div class="col-sm-9">
|
|
85
|
-
<select class="d-inline-block custom-select rounded-pill" formControlName="level">
|
|
86
|
-
<option *ngFor="let level of levels" [value]="level">{{level | translate}}</option>
|
|
87
|
-
</select>
|
|
88
|
-
</div>
|
|
89
|
-
</div>
|
|
90
|
-
|
|
91
|
-
<div class="mb-3 row">
|
|
92
|
-
<label class="col-sm-3 col-form-label">{{'Energy Class' | translate}}</label>
|
|
93
|
-
<div class="col-sm-9">
|
|
94
|
-
<input type="text" class="form-control" formControlName="classEnergyConsumption"
|
|
95
|
-
data-testid="new-location-classEnergyConsumption" (ngModelChange)="onFormChange()"
|
|
96
|
-
[ngClass]="{'is-invalid' : validatorsService.isControlError(form.controls['classEnergyConsumption']) || isFormError(form.controls['classEnergyConsumption'])}">
|
|
97
|
-
<div class="invalid-feedback">
|
|
98
|
-
<ngb-alert data-testid="new-location-classEnergyConsumption-invalid" [dismissible]="false" type="danger"
|
|
99
|
-
*ngIf="validatorsService.isControlError(form.controls['classEnergyConsumption']) || isFormError(form.controls['classEnergyConsumption'])">
|
|
100
|
-
{{validatorsService.getError(form.controls['classEnergyConsumption']) | translate}}
|
|
101
|
-
</ngb-alert>
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
104
|
-
</div>
|
|
105
|
-
|
|
106
|
-
<div class="mb-3 row">
|
|
107
|
-
<label class="col-sm-3 col-form-label">{{'Greenhouse gas emission Class' | translate}}</label>
|
|
108
|
-
<div class="col-sm-9">
|
|
109
|
-
<input type="text" class="form-control" formControlName="classGes" data-testid="new-location-classGes" (ngModelChange)="onFormChange()"
|
|
110
|
-
[ngClass]="{'is-invalid' : validatorsService.isControlError(form.controls['classGes'])|| isFormError(form.controls['classGes'])}">
|
|
111
|
-
<div class="invalid-feedback">
|
|
112
|
-
<ngb-alert data-testid="new-location-classGes-invalid" [dismissible]="false" type="danger"
|
|
113
|
-
*ngIf="validatorsService.isControlError(form.controls['classGes']) || isFormError(form.controls['classGes'])">
|
|
114
|
-
{{validatorsService.getError(form.controls['classGes']) | translate}}
|
|
115
|
-
</ngb-alert>
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
|
|
120
|
-
<div class="mb-3 row">
|
|
121
|
-
<label class="col-sm-3 col-form-label">{{'Cover picture' | translate}}</label>
|
|
122
|
-
<div class="col-sm-9">
|
|
123
|
-
<img #imageBasePreview *ngIf="currentImage" class="image-preview" [src]="currentImage">
|
|
124
|
-
<label #imageInputContainer for="image"
|
|
125
|
-
class="btn btn-label-file btn-outline-primary rounded-pill imageInputContainer">
|
|
126
|
-
<input #imageInput type="file" id="image" (change)="handleImageInput($event.target)" />
|
|
127
|
-
{{ imageInputText | translate}}</label>
|
|
128
|
-
<button *ngIf="currentImage && !imageToUpload" class="btn btn-outline-primary rounded-pill"
|
|
129
|
-
(click)="imageToBeDeleted=true;clearImageFile()">{{'Delete picture' | translate }}</button>
|
|
130
|
-
<div class="image-name" *ngIf="imageToUpload">
|
|
131
|
-
<p>{{ imageToUpload.name}}</p>
|
|
132
|
-
<div (click)="clearImageFile()" [style.cursor]="'pointer'">
|
|
133
|
-
<span class="iconify" data-icon="mdi:trash-can-outline"></span>
|
|
134
|
-
</div>
|
|
135
|
-
</div>
|
|
136
|
-
|
|
137
|
-
</div>
|
|
138
|
-
</div>
|
|
139
|
-
<div class="mb-3 row" *ngIf="!location">
|
|
140
|
-
<label class="col-sm-3 col-form-label">{{'Create mission for this space' | translate}}</label>
|
|
141
|
-
<div class="col-sm-3">
|
|
142
|
-
<input type="checkbox" [(ngModel)]="addMissionForNewSpace" [ngModelOptions]="{standalone: true}">
|
|
143
|
-
</div>
|
|
144
|
-
</div>
|
|
145
|
-
|
|
146
|
-
<button data-testid="new-location-submit-btn" [ngClass]="{'is-invalid' : errorForm }" type="submit"
|
|
147
|
-
class="btn btn-outline-primary rounded-pill me-3">{{'Save' | translate}}</button>
|
|
148
|
-
|
|
149
|
-
<button data-testid="new-location-close-btn" type="button" (click)="onCancel()"
|
|
150
|
-
class="btn btn-outline-primary rounded-pill">{{'Cancel' |
|
|
151
|
-
translate}}</button>
|
|
152
|
-
|
|
153
|
-
<div class="invalid-feedback" *ngIf="errorForm">
|
|
154
|
-
<ngb-alert data-testid="new-location-form-invalid" [dismissible]="false" type="danger">
|
|
155
|
-
{{'errorForm.infoBtn' |translate}}
|
|
156
|
-
|
|
157
|
-
</ngb-alert>
|
|
158
|
-
</div>
|
|
159
|
-
</form>
|
|
160
|
-
</div>
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
input[type="file"] {
|
|
2
|
-
display: none;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.custom-select {
|
|
6
|
-
border-color: var(--smarterplan-primary);
|
|
7
|
-
width: auto;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.form-new-loc {
|
|
11
|
-
background-color: lightgray;
|
|
12
|
-
padding-top: 10px;
|
|
13
|
-
padding-bottom: 10px;
|
|
14
|
-
margin-bottom: 15px;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.btn-outline-primary {
|
|
18
|
-
background-color: white;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
h4 {
|
|
22
|
-
color: var(--smarterplan-primary);
|
|
23
|
-
}
|
|
24
|
-
.image-preview {
|
|
25
|
-
object-fit: cover;
|
|
26
|
-
max-height: 400px;
|
|
27
|
-
max-width: 400px;
|
|
28
|
-
display: flex;
|
|
29
|
-
margin-bottom: 15px;
|
|
30
|
-
}
|
|
31
|
-
.imageInputContainer {
|
|
32
|
-
width: fit-content;
|
|
33
|
-
height: fit-content;
|
|
34
|
-
}
|
|
35
|
-
.image-name {
|
|
36
|
-
display: flex;
|
|
37
|
-
}
|
|
38
|
-
.col-form-label {
|
|
39
|
-
margin-bottom: 1rem;
|
|
40
|
-
width: 230px;
|
|
41
|
-
}
|
|
42
|
-
.form-new-loc {
|
|
43
|
-
background-color: lightgray;
|
|
44
|
-
margin-bottom: 15px;
|
|
45
|
-
padding: 10px;
|
|
46
|
-
width: 80%;
|
|
47
|
-
border-radius: 10px;
|
|
48
|
-
}
|
|
49
|
-
.col-sm-9 select {
|
|
50
|
-
width: 100%;
|
|
51
|
-
height: 31.25px;
|
|
52
|
-
padding-left: 10px;
|
|
53
|
-
}
|
|
54
|
-
.btn-outline-primary {
|
|
55
|
-
width: 200px;
|
|
56
|
-
margin-bottom: 1rem;
|
|
57
|
-
margin-right: 1rem;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.is-invalid ,.btn-outline-primary.is-invalid{
|
|
61
|
-
border-color: red!important;
|
|
62
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { FormLocationComponent } from './form-location.component';
|
|
4
|
-
|
|
5
|
-
describe('FormLocationComponent', () => {
|
|
6
|
-
let component: FormLocationComponent;
|
|
7
|
-
let fixture: ComponentFixture<FormLocationComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [ FormLocationComponent ]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(FormLocationComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|