@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,274 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit } from '@angular/core';
|
|
2
|
-
import { ActivatedRoute, Router } from '@angular/router';
|
|
3
|
-
import { Space, Visit, MenuItem, SpaceService, VisitService, NodeService, InventoryStatus, NavigatorService } from '@smarterplan/ngx-smarterplan-core';
|
|
4
|
-
import { Subject, takeUntil } from 'rxjs';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'lib-images',
|
|
8
|
-
templateUrl: './images.component.html',
|
|
9
|
-
styleUrls: ['./images.component.scss']
|
|
10
|
-
})
|
|
11
|
-
export class ImagesComponent implements OnInit {
|
|
12
|
-
|
|
13
|
-
images: Array<any>;
|
|
14
|
-
|
|
15
|
-
spaceID: string;
|
|
16
|
-
|
|
17
|
-
currentSpace: Space;
|
|
18
|
-
|
|
19
|
-
currentVisit: Visit;
|
|
20
|
-
|
|
21
|
-
currentImages: Array<any>;
|
|
22
|
-
|
|
23
|
-
loading = false;
|
|
24
|
-
|
|
25
|
-
currentScanID: string;
|
|
26
|
-
|
|
27
|
-
menuItems: MenuItem[] = [];
|
|
28
|
-
|
|
29
|
-
destroy$ = new Subject();
|
|
30
|
-
|
|
31
|
-
constructor(
|
|
32
|
-
private route: ActivatedRoute,
|
|
33
|
-
private spaceService: SpaceService,
|
|
34
|
-
private visitService: VisitService,
|
|
35
|
-
private nodeService: NodeService,
|
|
36
|
-
private navigatorService: NavigatorService,
|
|
37
|
-
private router: Router,
|
|
38
|
-
) {
|
|
39
|
-
this.navigatorService.locationIDChange
|
|
40
|
-
.pipe(takeUntil(this.destroy$))
|
|
41
|
-
.subscribe((spaceID) => {
|
|
42
|
-
this.router.navigate(["dashboard/localisation", spaceID, "images"]);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
this.route.params.subscribe((params) => {
|
|
46
|
-
this.spaceID = params.id;;
|
|
47
|
-
this.loadImages();
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
ngOnInit(): void {
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
ngOnDestroy() {
|
|
55
|
-
this.destroy$.next(true);
|
|
56
|
-
this.destroy$.complete();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
setupMenuItems() {
|
|
60
|
-
this.menuItems = [
|
|
61
|
-
{ label: "Locations", url: "/localisation" },
|
|
62
|
-
{
|
|
63
|
-
label: this.currentSpace.name,
|
|
64
|
-
url: `/localisation/${this.spaceID}`,
|
|
65
|
-
},
|
|
66
|
-
{ label: "360° Images" },
|
|
67
|
-
];
|
|
68
|
-
|
|
69
|
-
if (this.currentVisit) {
|
|
70
|
-
this.menuItems.push({ label: this.currentVisit.name });
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
onGoBack() {
|
|
75
|
-
this.currentVisit = null;
|
|
76
|
-
this.currentImages = null;
|
|
77
|
-
this.setupMenuItems();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
async loadImages() {
|
|
81
|
-
this.loading = true;
|
|
82
|
-
this.currentSpace = await this.spaceService.getSpace(this.spaceID);
|
|
83
|
-
this.setupMenuItems();
|
|
84
|
-
this.images = await this.visitService.loadImagesForSpace(
|
|
85
|
-
this.currentSpace,
|
|
86
|
-
);
|
|
87
|
-
if (this.currentSpace.visits.length === 1) {
|
|
88
|
-
this.setVisit(this.currentSpace.visits[0]);
|
|
89
|
-
}
|
|
90
|
-
this.loading = false;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
setVisit(visit) {
|
|
94
|
-
this.currentVisit = visit;
|
|
95
|
-
this.currentImages = this.images.filter((im) => {
|
|
96
|
-
return im.visit === visit;
|
|
97
|
-
});
|
|
98
|
-
this.setupMenuItems();
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
setCurrentScan(id) {
|
|
102
|
-
this.currentScanID = id;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
async onInventoryClick() {
|
|
106
|
-
const { node } = this.currentVisit;
|
|
107
|
-
const { filename } = this.currentImages[this.currentScanID]; // 110ee452_sweep.jpeg
|
|
108
|
-
// check if node has already errors of inventory
|
|
109
|
-
const missingFilesErrors = [
|
|
110
|
-
InventoryStatus.ERROR_FILE_JSON_NOT_EXIST,
|
|
111
|
-
InventoryStatus.ERROR_FILE_MODEL_NOT_EXIST,
|
|
112
|
-
InventoryStatus.ERROR_FILE_OBJ_NOT_EXIST,
|
|
113
|
-
];
|
|
114
|
-
if (
|
|
115
|
-
node.inventoryStatus &&
|
|
116
|
-
missingFilesErrors.includes(node.inventoryStatus)
|
|
117
|
-
) {
|
|
118
|
-
alert(
|
|
119
|
-
"Files missing for this visit's inventory. Contact your administrator.",
|
|
120
|
-
);
|
|
121
|
-
} else {
|
|
122
|
-
await this.nodeService.updateNode({
|
|
123
|
-
id: node.id,
|
|
124
|
-
inventoryStatus: InventoryStatus.TO_RUN_ONE_IMAGE,
|
|
125
|
-
navigationForInventory: filename.split("_")[0],
|
|
126
|
-
});
|
|
127
|
-
alert(
|
|
128
|
-
"Automatic AI Inventory started! Detected equipments will appear soon in the visit.",
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
<div class="dashboard-tab">
|
|
2
|
-
<div class="header-dashboard-tab">
|
|
3
|
-
<div class="m-3">
|
|
4
|
-
<lib-tab-navigation (onGoBack)="onFormChange(null)" [menuItems]='menuItems'></lib-tab-navigation>
|
|
5
|
-
<span class="ml-3 refreshIcon" (click)="refresh()" *ngIf="!(isAdding)" ngbTooltip="Refresh list">
|
|
6
|
-
<span class="iconify refreshIcon" data-icon="ion:refresh-circle" data-width="35" data-rotate="90deg"></span>
|
|
7
|
-
</span>
|
|
8
|
-
</div>
|
|
9
|
-
<lib-search-bar *ngIf="!isAdding && !isMuseumUser" [searchable]="locations" [objectType]="getSearchType()"
|
|
10
|
-
(searchEvent)="applyResultsSearchBar($event)"></lib-search-bar>
|
|
11
|
-
|
|
12
|
-
<div class="col-md-8">
|
|
13
|
-
<div class="sp-row" *ngIf="!isAdding && isManager">
|
|
14
|
-
<button data-testid="new-location-btn" class="btn btn-outline-primary rounded-pill add-location" (click)="onAddLocation()">
|
|
15
|
-
{{'Add location' | translate}}</button>
|
|
16
|
-
<!-- <div class="outer_circle">
|
|
17
|
-
<button id='btn-icon' (click)="onAddLocation()"></button>
|
|
18
|
-
</div> -->
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
<hr>
|
|
23
|
-
<div class="row" *ngIf="isAdding">
|
|
24
|
-
<div class="col-md-6">
|
|
25
|
-
<h4>{{'New location' | translate}}</h4>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
<section *ngIf="!isAdding">
|
|
29
|
-
<div class="row">
|
|
30
|
-
<div class="col-sm-12 col-md-12 col-lg-6" *ngIf="filteredLocations">
|
|
31
|
-
<ul data-testid="location-list-container" class="list-group list-group-flush">
|
|
32
|
-
<li class="d-flex justify-content-between list-group-item"
|
|
33
|
-
*ngFor="let loc of filteredLocations; index as index">
|
|
34
|
-
<div class="d-flex">
|
|
35
|
-
<div class="col-md-5 img-main-container">
|
|
36
|
-
<div id="img_container">
|
|
37
|
-
<img class="location-img" *ngIf="loc.annexes; else elseBlock" [src]="loc.annexes">
|
|
38
|
-
<ng-template #elseBlock><img class="location-img"
|
|
39
|
-
src="./../../../../assets/images/visuel-off-big.jpg" />
|
|
40
|
-
</ng-template>
|
|
41
|
-
<button [ngClass]="['open-btn-'+getStringNoSpace(loc.name)]" *ngIf="isManagerForSpace(loc.id)" class="btn-details" (click)="onDetailViewClick(loc.id)">
|
|
42
|
-
{{'View details' | translate}}</button>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
</div>
|
|
46
|
-
<div class="col-md-7 location-info">
|
|
47
|
-
<p>{{loc.name}}</p>
|
|
48
|
-
<p>{{loc.addresses}}</p>
|
|
49
|
-
<p [ngClass]="['view-btn-'+getStringNoSpace(loc.name)]" *ngFor="let visit of loc.visits" (click)="onVisitClick(loc, visit)" class="visit-name"
|
|
50
|
-
[style.cursor]="'pointer'" ngbTooltip="Visit">{{ visit.name ? visit.name : loc.name}}</p>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</li>
|
|
54
|
-
|
|
55
|
-
</ul>
|
|
56
|
-
</div>
|
|
57
|
-
<div class="col-sm-12 col-md-12 col-lg-6">
|
|
58
|
-
<lib-map [spaces]="filteredLocations"></lib-map>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</section>
|
|
62
|
-
<lib-form-location *ngIf="isAdding" (onChange)="onFormChange($event)"></lib-form-location>
|
|
63
|
-
</div>
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
.searchbar {
|
|
2
|
-
margin-bottom: 10px;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
input[type="file"] {
|
|
6
|
-
display: none;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.form-control {
|
|
10
|
-
border-radius: var(--form-control-border-radius);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.custom-select {
|
|
14
|
-
border-color: var(--smarterplan-primary);
|
|
15
|
-
width: auto;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.form-new-loc {
|
|
19
|
-
background-color: lightgray;
|
|
20
|
-
padding-top: 10px;
|
|
21
|
-
padding-bottom: 10px;
|
|
22
|
-
margin-bottom: 15px;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.btn-outline-primary {
|
|
26
|
-
background-color: white;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
h4 {
|
|
30
|
-
color: var(--smarterplan-primary);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
section {
|
|
34
|
-
.list-group {
|
|
35
|
-
margin-top: 15px;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.list-group-item {
|
|
39
|
-
padding: 5px 0px 5px 0px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.location-info {
|
|
43
|
-
font-size: 1.1em;
|
|
44
|
-
}
|
|
45
|
-
.location-img {
|
|
46
|
-
width: 100%;
|
|
47
|
-
object-fit: cover;
|
|
48
|
-
object-position: center bottom;
|
|
49
|
-
height: 165px;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
#img_container {
|
|
53
|
-
position: relative;
|
|
54
|
-
display: inline-block;
|
|
55
|
-
text-align: center;
|
|
56
|
-
width: 250px;
|
|
57
|
-
}
|
|
58
|
-
.img-main-container {
|
|
59
|
-
max-width: 250px;
|
|
60
|
-
width: 250px !important;
|
|
61
|
-
margin-right: 10px;
|
|
62
|
-
}
|
|
63
|
-
.visit-name {
|
|
64
|
-
color: var(--smarterplan-primary);
|
|
65
|
-
font-weight: 600;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.btn-details {
|
|
69
|
-
background-color: var(--smarterplan-primary-transparent);
|
|
70
|
-
position: absolute;
|
|
71
|
-
color: white;
|
|
72
|
-
bottom: 0px;
|
|
73
|
-
right: 0px;
|
|
74
|
-
width: 100%;
|
|
75
|
-
height: 30%;
|
|
76
|
-
border: none;
|
|
77
|
-
font-size: 1em;
|
|
78
|
-
text-transform: lowercase;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
#btn-icon {
|
|
82
|
-
width: 30px;
|
|
83
|
-
height: 30px;
|
|
84
|
-
background: url("../../../../assets/icons/plus.svg");
|
|
85
|
-
border: none;
|
|
86
|
-
vertical-align: middle;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
#btn-icon:hover {
|
|
90
|
-
background: url("../../../../assets/icons/plus-over.svg");
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
#btn-icon[disabled]:hover {
|
|
94
|
-
background: url("../../../../assets/icons/plus.svg");
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.outer_circle {
|
|
98
|
-
background-color: #ebebeb;
|
|
99
|
-
border-radius: 50%;
|
|
100
|
-
width: 32px;
|
|
101
|
-
height: 32px;
|
|
102
|
-
padding: 1px;
|
|
103
|
-
margin-left: 5px;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.refreshIcon {
|
|
107
|
-
color: var(--smarterplan-primary);
|
|
108
|
-
cursor: pointer;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.refreshIcon svg {
|
|
112
|
-
vertical-align: middle !important;
|
|
113
|
-
}
|
|
114
|
-
.add-location {
|
|
115
|
-
width: 12vw;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.sp-row {
|
|
119
|
-
display: flex;
|
|
120
|
-
flex-direction: row;
|
|
121
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { LocationsComponent } from './locations.component';
|
|
4
|
-
|
|
5
|
-
describe('LocationsComponent', () => {
|
|
6
|
-
let component: LocationsComponent;
|
|
7
|
-
let fixture: ComponentFixture<LocationsComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [ LocationsComponent ]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(LocationsComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|