@smarterplan/ngx-smarterplan-locations 0.2.43 → 0.2.44
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/.browserslistrc +16 -0
- package/karma.conf.js +44 -0
- package/ng-package.json +7 -0
- package/package.json +6 -23
- package/src/lib/components/carousel/carousel.component.html +13 -0
- package/src/lib/components/carousel/carousel.component.scss +0 -0
- package/src/lib/components/carousel/carousel.component.spec.ts +25 -0
- package/src/lib/components/carousel/carousel.component.ts +31 -0
- package/src/lib/components/chevron/chevron.component.html +5 -0
- package/src/lib/components/chevron/chevron.component.scss +16 -0
- package/src/lib/components/chevron/chevron.component.spec.ts +25 -0
- package/src/lib/components/chevron/chevron.component.ts +17 -0
- package/src/lib/components/detail-location/detail-location.component.html +108 -0
- package/src/lib/components/detail-location/detail-location.component.scss +0 -0
- package/src/lib/components/detail-location/detail-location.component.spec.ts +25 -0
- package/src/lib/components/detail-location/detail-location.component.ts +215 -0
- package/src/lib/components/form-location/form-location.component.html +160 -0
- package/src/lib/components/form-location/form-location.component.scss +62 -0
- package/src/lib/components/form-location/form-location.component.spec.ts +25 -0
- package/src/lib/components/form-location/form-location.component.ts +274 -0
- package/src/lib/components/images/images.component.html +27 -0
- package/src/lib/components/images/images.component.scss +0 -0
- package/src/lib/components/images/images.component.spec.ts +25 -0
- package/src/lib/components/images/images.component.ts +133 -0
- package/src/lib/components/locations/locations.component.html +63 -0
- package/src/lib/components/locations/locations.component.scss +121 -0
- package/src/lib/components/locations/locations.component.spec.ts +25 -0
- package/src/lib/components/locations/locations.component.ts +186 -0
- package/src/lib/components/locations/map/map-popup/map-popup.component.html +11 -0
- package/src/lib/components/locations/map/map-popup/map-popup.component.scss +51 -0
- package/src/lib/components/locations/map/map-popup/map-popup.component.spec.ts +25 -0
- package/src/lib/components/locations/map/map-popup/map-popup.component.ts +79 -0
- package/src/lib/components/locations/map/map.component.html +2 -0
- package/src/lib/components/locations/map/map.component.scss +0 -0
- package/src/lib/components/locations/map/map.component.spec.ts +25 -0
- package/src/lib/components/locations/map/map.component.ts +111 -0
- package/src/lib/components/plan-legend/plan-legend.component.html +9 -0
- package/src/lib/components/plan-legend/plan-legend.component.scss +38 -0
- package/src/lib/components/plan-legend/plan-legend.component.spec.ts +25 -0
- package/src/lib/components/plan-legend/plan-legend.component.ts +50 -0
- package/src/lib/components/plans/calibration/calibration.component.html +98 -0
- package/src/lib/components/plans/calibration/calibration.component.scss +136 -0
- package/src/lib/components/plans/calibration/calibration.component.spec.ts +25 -0
- package/src/lib/components/plans/calibration/calibration.component.ts +603 -0
- package/src/lib/components/plans/edit-plan/edit-plan.component.html +77 -0
- package/src/lib/components/plans/edit-plan/edit-plan.component.scss +9 -0
- package/src/lib/components/plans/edit-plan/edit-plan.component.spec.ts +25 -0
- package/src/lib/components/plans/edit-plan/edit-plan.component.ts +421 -0
- package/src/lib/components/plans/plans.component.html +102 -0
- package/src/lib/components/plans/plans.component.scss +24 -0
- package/src/lib/components/plans/plans.component.spec.ts +25 -0
- package/src/lib/components/plans/plans.component.ts +305 -0
- package/src/lib/components/tab-navigation/tab-navigation.component.html +7 -0
- package/src/lib/components/tab-navigation/tab-navigation.component.scss +27 -0
- package/src/lib/components/tab-navigation/tab-navigation.component.spec.ts +25 -0
- package/src/lib/components/tab-navigation/tab-navigation.component.ts +35 -0
- package/src/lib/components/visits/visits.component.html +134 -0
- package/src/lib/components/visits/visits.component.scss +24 -0
- package/src/lib/components/visits/visits.component.spec.ts +25 -0
- package/src/lib/components/visits/visits.component.ts +357 -0
- package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.html +73 -0
- package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.scss +14 -0
- package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.spec.ts +25 -0
- package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.ts +269 -0
- package/src/lib/components/zones/add-zone/add-zone.component.html +153 -0
- package/src/lib/components/zones/add-zone/add-zone.component.scss +44 -0
- package/src/lib/components/zones/add-zone/add-zone.component.spec.ts +25 -0
- package/src/lib/components/zones/add-zone/add-zone.component.ts +377 -0
- package/src/lib/components/zones/add-zone/selection/selection.component.html +3 -0
- package/src/lib/components/zones/add-zone/selection/selection.component.scss +16 -0
- package/src/lib/components/zones/add-zone/selection/selection.component.spec.ts +25 -0
- package/src/lib/components/zones/add-zone/selection/selection.component.ts +95 -0
- package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.html +73 -0
- package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.scss +23 -0
- package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.spec.ts +25 -0
- package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.ts +595 -0
- package/src/lib/components/zones/zones.component.html +181 -0
- package/src/lib/components/zones/zones.component.scss +36 -0
- package/src/lib/components/zones/zones.component.spec.ts +25 -0
- package/src/lib/components/zones/zones.component.ts +339 -0
- package/src/lib/helper.service.ts +161 -0
- package/src/lib/ngx-smarterplan-location-routing.module.ts +41 -0
- package/src/lib/ngx-smarterplan-locations.module.ts +74 -0
- package/src/lib/ngx-smarterplan-locations.service.spec.ts +16 -0
- package/src/lib/ngx-smarterplan-locations.service.ts +9 -0
- package/src/lib/pipes/count-audio-sweeps.pipe.ts +21 -0
- package/src/lib/radio-button/radio-button.component.html +9 -0
- package/src/lib/radio-button/radio-button.component.scss +152 -0
- package/src/lib/radio-button/radio-button.component.spec.ts +25 -0
- package/src/lib/radio-button/radio-button.component.ts +26 -0
- package/{public-api.d.ts → src/public-api.ts} +11 -4
- package/src/test.ts +27 -0
- package/tsconfig.lib.json +15 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/esm2020/lib/components/carousel/carousel.component.mjs +0 -28
- package/esm2020/lib/components/chevron/chevron.component.mjs +0 -18
- package/esm2020/lib/components/detail-location/detail-location.component.mjs +0 -168
- package/esm2020/lib/components/form-location/form-location.component.mjs +0 -237
- package/esm2020/lib/components/images/images.component.mjs +0 -107
- package/esm2020/lib/components/locations/locations.component.mjs +0 -145
- package/esm2020/lib/components/locations/map/map-popup/map-popup.component.mjs +0 -66
- package/esm2020/lib/components/locations/map/map.component.mjs +0 -91
- package/esm2020/lib/components/plan-legend/plan-legend.component.mjs +0 -47
- package/esm2020/lib/components/plans/calibration/calibration.component.mjs +0 -468
- package/esm2020/lib/components/plans/edit-plan/edit-plan.component.mjs +0 -324
- package/esm2020/lib/components/plans/plans.component.mjs +0 -225
- package/esm2020/lib/components/tab-navigation/tab-navigation.component.mjs +0 -41
- package/esm2020/lib/components/visits/visits.component.mjs +0 -283
- package/esm2020/lib/components/zones/add-audio-zone/add-audio-zone.component.mjs +0 -230
- package/esm2020/lib/components/zones/add-zone/add-zone.component.mjs +0 -315
- package/esm2020/lib/components/zones/add-zone/selection/selection.component.mjs +0 -77
- package/esm2020/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.mjs +0 -502
- package/esm2020/lib/components/zones/zones.component.mjs +0 -265
- package/esm2020/lib/helper.service.mjs +0 -134
- package/esm2020/lib/ngx-smarterplan-location-routing.module.mjs +0 -49
- package/esm2020/lib/ngx-smarterplan-locations.module.mjs +0 -125
- package/esm2020/lib/ngx-smarterplan-locations.service.mjs +0 -14
- package/esm2020/lib/pipes/count-audio-sweeps.pipe.mjs +0 -27
- package/esm2020/lib/radio-button/radio-button.component.mjs +0 -26
- package/esm2020/public-api.mjs +0 -9
- package/esm2020/smarterplan-ngx-smarterplan-locations.mjs +0 -5
- package/fesm2015/smarterplan-ngx-smarterplan-locations.mjs +0 -3988
- package/fesm2015/smarterplan-ngx-smarterplan-locations.mjs.map +0 -1
- package/fesm2020/smarterplan-ngx-smarterplan-locations.mjs +0 -3825
- package/fesm2020/smarterplan-ngx-smarterplan-locations.mjs.map +0 -1
- package/lib/components/carousel/carousel.component.d.ts +0 -12
- package/lib/components/chevron/chevron.component.d.ts +0 -9
- package/lib/components/detail-location/detail-location.component.d.ts +0 -55
- package/lib/components/form-location/form-location.component.d.ts +0 -45
- package/lib/components/images/images.component.d.ts +0 -33
- package/lib/components/locations/locations.component.d.ts +0 -51
- package/lib/components/locations/map/map-popup/map-popup.component.d.ts +0 -22
- package/lib/components/locations/map/map.component.d.ts +0 -22
- package/lib/components/plan-legend/plan-legend.component.d.ts +0 -14
- package/lib/components/plans/calibration/calibration.component.d.ts +0 -140
- package/lib/components/plans/edit-plan/edit-plan.component.d.ts +0 -55
- package/lib/components/plans/plans.component.d.ts +0 -63
- package/lib/components/tab-navigation/tab-navigation.component.d.ts +0 -13
- package/lib/components/visits/visits.component.d.ts +0 -62
- package/lib/components/zones/add-audio-zone/add-audio-zone.component.d.ts +0 -63
- package/lib/components/zones/add-zone/add-zone.component.d.ts +0 -69
- package/lib/components/zones/add-zone/selection/selection.component.d.ts +0 -44
- package/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.d.ts +0 -107
- package/lib/components/zones/zones.component.d.ts +0 -72
- package/lib/helper.service.d.ts +0 -53
- package/lib/ngx-smarterplan-location-routing.module.d.ts +0 -7
- package/lib/ngx-smarterplan-locations.module.d.ts +0 -36
- package/lib/ngx-smarterplan-locations.service.d.ts +0 -6
- package/lib/pipes/count-audio-sweeps.pipe.d.ts +0 -10
- package/lib/radio-button/radio-button.component.d.ts +0 -12
- package/smarterplan-ngx-smarterplan-locations.d.ts +0 -5
|
@@ -0,0 +1,160 @@
|
|
|
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>
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
|
|
2
|
+
import { FormGroup, FormBuilder, Validators, AbstractControl } from '@angular/forms';
|
|
3
|
+
import { Space, LevelStatus, SpaceService, PropertyService, BaseUserService, MissionService, enumToArray, uploadFileToS3, Layer, PropertyType, getSignedImageUrlForSpace, LayerService, deleteFromS3 } from '@smarterplan/ngx-smarterplan-core';
|
|
4
|
+
import { ValidatorsService, textValidator, noEmptyValidator, floatValidator } from "@smarterplan/ngx-smarterplan-core";
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'lib-form-location',
|
|
8
|
+
templateUrl: './form-location.component.html',
|
|
9
|
+
styleUrls: ['./form-location.component.scss']
|
|
10
|
+
})
|
|
11
|
+
export class FormLocationComponent implements OnInit {
|
|
12
|
+
|
|
13
|
+
form: FormGroup;
|
|
14
|
+
|
|
15
|
+
@ViewChild("imageInputContainer")
|
|
16
|
+
imageInputContainer: ElementRef;
|
|
17
|
+
|
|
18
|
+
@ViewChild("imageInput")
|
|
19
|
+
imageInput: ElementRef;
|
|
20
|
+
|
|
21
|
+
@ViewChild("imageBasePreview")
|
|
22
|
+
imageBasePreview: ElementRef;
|
|
23
|
+
|
|
24
|
+
@Input()
|
|
25
|
+
location: Space;
|
|
26
|
+
|
|
27
|
+
imageToUpload: any;
|
|
28
|
+
|
|
29
|
+
isSubmitted = false;
|
|
30
|
+
|
|
31
|
+
levels: Array<LevelStatus>;
|
|
32
|
+
|
|
33
|
+
addMissionForNewSpace = true;
|
|
34
|
+
|
|
35
|
+
imageInputText: string;
|
|
36
|
+
|
|
37
|
+
currentImage: string;
|
|
38
|
+
|
|
39
|
+
imageToBeDeleted: boolean = false;
|
|
40
|
+
|
|
41
|
+
errorForm: boolean = false;
|
|
42
|
+
|
|
43
|
+
@Output() onChange = new EventEmitter<Space | null>();
|
|
44
|
+
|
|
45
|
+
constructor(
|
|
46
|
+
private spaceService: SpaceService,
|
|
47
|
+
private propertyService: PropertyService,
|
|
48
|
+
private userService: BaseUserService,
|
|
49
|
+
private fb: FormBuilder,
|
|
50
|
+
private missionService: MissionService,
|
|
51
|
+
private layerService: LayerService,
|
|
52
|
+
public validatorsService: ValidatorsService
|
|
53
|
+
) {
|
|
54
|
+
this.levels = enumToArray(LevelStatus);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
ngOnInit(): void {
|
|
58
|
+
if (this.location) {
|
|
59
|
+
this.initEditForm();
|
|
60
|
+
} else {
|
|
61
|
+
this.initForm();
|
|
62
|
+
}
|
|
63
|
+
this.handleInputImageText();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
initForm() {
|
|
67
|
+
this.form = this.fb.group({
|
|
68
|
+
name: ["", [Validators.required, Validators.maxLength(255), textValidator(), noEmptyValidator()]],
|
|
69
|
+
addresses: ["", [Validators.maxLength(255), textValidator(), noEmptyValidator()]],
|
|
70
|
+
latitude: [null, [Validators.maxLength(255), noEmptyValidator(), floatValidator()]],
|
|
71
|
+
longitude: [null, [Validators.maxLength(255), noEmptyValidator(), floatValidator()]],
|
|
72
|
+
level: LevelStatus.LOW,
|
|
73
|
+
classGes: ["", [Validators.maxLength(255), textValidator(), noEmptyValidator()]],
|
|
74
|
+
classEnergyConsumption: ["", [Validators.maxLength(255), textValidator(), noEmptyValidator()]],
|
|
75
|
+
constructionYear: ["", [Validators.maxLength(255), textValidator(), noEmptyValidator()]],
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
initEditForm() {
|
|
80
|
+
this.form = this.fb.group({
|
|
81
|
+
id: this.location.id,
|
|
82
|
+
name: [this.location.name, [Validators.required, Validators.maxLength(255), textValidator(), noEmptyValidator()]],
|
|
83
|
+
addresses: [this.location.addresses, [Validators.maxLength(255), textValidator(), noEmptyValidator()]],
|
|
84
|
+
latitude: [this.location.latitude, [Validators.maxLength(255), floatValidator()]],
|
|
85
|
+
longitude: [this.location.longitude, [Validators.maxLength(255), floatValidator()]],
|
|
86
|
+
level: this.location.level,
|
|
87
|
+
classGes: [this.location.classGes, [Validators.maxLength(255), textValidator(), noEmptyValidator()]],
|
|
88
|
+
classEnergyConsumption: [this.location.classEnergyConsumption, [Validators.maxLength(255), textValidator(), noEmptyValidator()]],
|
|
89
|
+
constructionYear: [this.location.constructionYear, [Validators.maxLength(255), textValidator(), noEmptyValidator()]],
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
handleImageInput(target: EventTarget) {
|
|
94
|
+
this.imageToUpload = (target as HTMLInputElement).files[0];
|
|
95
|
+
if (this.imageToUpload) {
|
|
96
|
+
this.imageInputContainer.nativeElement.style.display = "none";
|
|
97
|
+
const reader = new FileReader();
|
|
98
|
+
reader.addEventListener("load", () => {
|
|
99
|
+
this.currentImage = reader.result as string;
|
|
100
|
+
});
|
|
101
|
+
reader.readAsDataURL(this.imageToUpload);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async uploadImage(spaceID: string) {
|
|
106
|
+
if (this.imageToUpload) {
|
|
107
|
+
uploadFileToS3("locations/", this.imageToUpload, spaceID).then(
|
|
108
|
+
async (url) => {
|
|
109
|
+
if (url) {
|
|
110
|
+
await this.spaceService.updateSpace({
|
|
111
|
+
id: spaceID,
|
|
112
|
+
annexes: url,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
);
|
|
117
|
+
} else if (this.imageToBeDeleted) {
|
|
118
|
+
await this.spaceService.updateSpace({
|
|
119
|
+
id: spaceID,
|
|
120
|
+
annexes: null,
|
|
121
|
+
});
|
|
122
|
+
await deleteFromS3(this.location.annexes);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
clearImageFile() {
|
|
127
|
+
this.imageToUpload = null;
|
|
128
|
+
this.currentImage = null;
|
|
129
|
+
this.imageInputContainer.nativeElement.style.display = "flex";
|
|
130
|
+
this.imageInput.nativeElement.value = "";
|
|
131
|
+
this.imageInputText = "Add picture";
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async getLayerByName(name: string): Promise<Layer> {
|
|
135
|
+
const currentOrgId = this.userService.currentOrganisation().id;
|
|
136
|
+
const layers = await this.layerService.getLayerByNameForOrganisation(
|
|
137
|
+
name,
|
|
138
|
+
currentOrgId,
|
|
139
|
+
);
|
|
140
|
+
if (layers) {
|
|
141
|
+
return layers[0];
|
|
142
|
+
}
|
|
143
|
+
// create then
|
|
144
|
+
return this.layerService.createLayerForOrganisation(name, currentOrgId);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async onSubmit() {
|
|
148
|
+
this.isSubmitted = true;
|
|
149
|
+
if (!this.form.valid) {
|
|
150
|
+
this.errorForm = true;
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
try {
|
|
154
|
+
this.errorForm = false;
|
|
155
|
+
let space;
|
|
156
|
+
if (this.location) {
|
|
157
|
+
this.changeCommaToDot();
|
|
158
|
+
space = await this.spaceService.updateSpace(this.form.value);
|
|
159
|
+
if (space) {
|
|
160
|
+
await this.uploadImage(space.id);
|
|
161
|
+
this.location = space;
|
|
162
|
+
this.onChange.emit(space);
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
this.changeCommaToDot();
|
|
166
|
+
const spaceInput = this.form.value as Space;
|
|
167
|
+
const currentOrgID = this.userService.currentOrganisation().id;
|
|
168
|
+
spaceInput.organisationID = currentOrgID;
|
|
169
|
+
let layer = await this.getLayerByName("BUILDING");
|
|
170
|
+
if (!layer) {
|
|
171
|
+
layer = await this.layerService.createLayerForOrganisation(
|
|
172
|
+
"BUILDING",
|
|
173
|
+
currentOrgID,
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
space = await this.spaceService.createSpace(
|
|
177
|
+
spaceInput,
|
|
178
|
+
layer,
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
const missions = this.userService.getManagerMissions();
|
|
182
|
+
if (space && missions.length > 0) {
|
|
183
|
+
const exampleMission = missions[0];
|
|
184
|
+
await this.uploadImage(space.id);
|
|
185
|
+
try {
|
|
186
|
+
await this.propertyService.createProperty({
|
|
187
|
+
type: PropertyType.PROPERTY,
|
|
188
|
+
spaceID: space.id,
|
|
189
|
+
organisationID: currentOrgID,
|
|
190
|
+
});
|
|
191
|
+
} catch (e) {
|
|
192
|
+
console.log("API Service does not have Property requests");
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// add directly a mission for this space
|
|
196
|
+
if (this.addMissionForNewSpace) {
|
|
197
|
+
await this.missionService.create({
|
|
198
|
+
spaceID: space.id,
|
|
199
|
+
userID: exampleMission.userID,
|
|
200
|
+
role: exampleMission.role,
|
|
201
|
+
level: exampleMission.level,
|
|
202
|
+
organisationID: exampleMission.organisationID,
|
|
203
|
+
orderedOrganisationID:
|
|
204
|
+
exampleMission.organisationID,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
this.onChange.emit(space);
|
|
208
|
+
} else {
|
|
209
|
+
this.onChange.emit(null);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
} catch (error) {
|
|
213
|
+
console.error(error);
|
|
214
|
+
this.onChange.emit(null);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
onCancel() {
|
|
219
|
+
this.form.reset();
|
|
220
|
+
this.onChange.emit(null);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
get name(): AbstractControl {
|
|
224
|
+
return this.form.get("name");
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
changeCommaToDot() {
|
|
228
|
+
const updatedSpace = this.form.value;
|
|
229
|
+
if (
|
|
230
|
+
updatedSpace.latitude &&
|
|
231
|
+
updatedSpace.latitude.toString().includes(",")
|
|
232
|
+
) {
|
|
233
|
+
updatedSpace.latitude = updatedSpace.latitude
|
|
234
|
+
.toString()
|
|
235
|
+
.replace(",", ".");
|
|
236
|
+
Number.parseFloat(updatedSpace.latitude);
|
|
237
|
+
}
|
|
238
|
+
if (
|
|
239
|
+
updatedSpace.longitude &&
|
|
240
|
+
updatedSpace.longitude.toString().includes(",")
|
|
241
|
+
) {
|
|
242
|
+
updatedSpace.longitude = updatedSpace.longitude
|
|
243
|
+
.toString()
|
|
244
|
+
.replace(",", ".");
|
|
245
|
+
Number.parseFloat(updatedSpace.longitude);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
handleInputImageText() {
|
|
250
|
+
if (this.location && this.location.annexes) {
|
|
251
|
+
this.imageInputText = "Change picture";
|
|
252
|
+
getSignedImageUrlForSpace(this.location).then((url) => {
|
|
253
|
+
if (url) {
|
|
254
|
+
this.currentImage = url;
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
} else {
|
|
258
|
+
this.imageInputText = "Add picture";
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
isFormError(control) {
|
|
264
|
+
return control && control.invalid && this.errorForm;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
onFormChange(){
|
|
269
|
+
if (this.errorForm && this.form.valid) {
|
|
270
|
+
this.errorForm = false;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
}
|
|
274
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<div class="container-fluid dashboard-tab col-sm-10 mb-3" *ngIf="currentSpace" >
|
|
2
|
+
<div class="m-3">
|
|
3
|
+
<lib-tab-navigation [menuItems]='menuItems' (onGoBack)="onGoBack()"></lib-tab-navigation>
|
|
4
|
+
</div>
|
|
5
|
+
<div class="d-flex justify-content-center" *ngIf="loading">
|
|
6
|
+
<div class="spinner-border" role="status">
|
|
7
|
+
<span class="visually-hidden">{{'Loading' | translate}}...</span>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
<div ngbDropdown class="d-inline-block" *ngIf="currentSpace.visits && currentSpace.visits.length > 0">
|
|
11
|
+
<button class="btn btn-label-file rounded-pill" id="dropdownBasic1" *ngIf="!currentVisit"
|
|
12
|
+
ngbDropdownToggle>{{'Choose 3D visit' | translate}}</button>
|
|
13
|
+
<div ngbDropdownMenu aria-labelledby="dropdownBasic1">
|
|
14
|
+
<button ngbDropdownItem *ngFor="let visit of currentSpace.visits" (click)="setVisit(visit)"> {{ visit.name }}
|
|
15
|
+
</button>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
<h3 *ngIf="currentVisit">{{ currentVisit.name }}</h3>
|
|
19
|
+
<div class="mt-3" *ngIf="currentVisit && currentImages.length == 0 && !loading">
|
|
20
|
+
<h4>{{'No imported images' | translate }}</h4>
|
|
21
|
+
<p>{{'For import: go Virtual Visits => Import Images' | translate}}</p>
|
|
22
|
+
</div>
|
|
23
|
+
<button *ngIf="currentVisit && currentImages.length > 0 && !loading"
|
|
24
|
+
class="btn btn-outline-primary rounded-pill no-lowercase mb-2" (click)="onInventoryClick()">
|
|
25
|
+
{{'Run AI inventory on this image' | translate}}</button>
|
|
26
|
+
<lib-carousel [images]="currentImages" *ngIf="currentImages" (currentScan)="setCurrentScan($event)"></lib-carousel>
|
|
27
|
+
</div>
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ImagesComponent } from './images.component';
|
|
4
|
+
|
|
5
|
+
describe('ImagesComponent', () => {
|
|
6
|
+
let component: ImagesComponent;
|
|
7
|
+
let fixture: ComponentFixture<ImagesComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ ImagesComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(ImagesComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|