@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.
Files changed (152) hide show
  1. package/esm2020/lib/components/carousel/carousel.component.mjs +28 -0
  2. package/esm2020/lib/components/chevron/chevron.component.mjs +18 -0
  3. package/esm2020/lib/components/detail-location/detail-location.component.mjs +168 -0
  4. package/esm2020/lib/components/form-location/form-location.component.mjs +237 -0
  5. package/esm2020/lib/components/images/images.component.mjs +107 -0
  6. package/esm2020/lib/components/locations/locations.component.mjs +145 -0
  7. package/esm2020/lib/components/locations/map/map-popup/map-popup.component.mjs +66 -0
  8. package/esm2020/lib/components/locations/map/map.component.mjs +91 -0
  9. package/esm2020/lib/components/plan-legend/plan-legend.component.mjs +47 -0
  10. package/esm2020/lib/components/plans/calibration/calibration.component.mjs +468 -0
  11. package/esm2020/lib/components/plans/edit-plan/edit-plan.component.mjs +324 -0
  12. package/esm2020/lib/components/plans/plans.component.mjs +225 -0
  13. package/esm2020/lib/components/tab-navigation/tab-navigation.component.mjs +41 -0
  14. package/esm2020/lib/components/visits/visits.component.mjs +283 -0
  15. package/esm2020/lib/components/zones/add-audio-zone/add-audio-zone.component.mjs +230 -0
  16. package/esm2020/lib/components/zones/add-zone/add-zone.component.mjs +315 -0
  17. package/esm2020/lib/components/zones/add-zone/selection/selection.component.mjs +77 -0
  18. package/esm2020/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.mjs +502 -0
  19. package/esm2020/lib/components/zones/zones.component.mjs +268 -0
  20. package/esm2020/lib/helper.service.mjs +134 -0
  21. package/esm2020/lib/ngx-smarterplan-location-routing.module.mjs +49 -0
  22. package/esm2020/lib/ngx-smarterplan-locations.module.mjs +125 -0
  23. package/esm2020/lib/ngx-smarterplan-locations.service.mjs +14 -0
  24. package/esm2020/lib/pipes/count-audio-sweeps.pipe.mjs +27 -0
  25. package/esm2020/lib/radio-button/radio-button.component.mjs +26 -0
  26. package/esm2020/public-api.mjs +9 -0
  27. package/esm2020/smarterplan-ngx-smarterplan-locations.mjs +5 -0
  28. package/fesm2015/smarterplan-ngx-smarterplan-locations.mjs +3991 -0
  29. package/fesm2015/smarterplan-ngx-smarterplan-locations.mjs.map +1 -0
  30. package/fesm2020/smarterplan-ngx-smarterplan-locations.mjs +3828 -0
  31. package/fesm2020/smarterplan-ngx-smarterplan-locations.mjs.map +1 -0
  32. package/lib/components/carousel/carousel.component.d.ts +12 -0
  33. package/lib/components/chevron/chevron.component.d.ts +9 -0
  34. package/lib/components/detail-location/detail-location.component.d.ts +55 -0
  35. package/lib/components/form-location/form-location.component.d.ts +45 -0
  36. package/lib/components/images/images.component.d.ts +33 -0
  37. package/lib/components/locations/locations.component.d.ts +51 -0
  38. package/lib/components/locations/map/map-popup/map-popup.component.d.ts +22 -0
  39. package/lib/components/locations/map/map.component.d.ts +22 -0
  40. package/lib/components/plan-legend/plan-legend.component.d.ts +14 -0
  41. package/lib/components/plans/calibration/calibration.component.d.ts +140 -0
  42. package/lib/components/plans/edit-plan/edit-plan.component.d.ts +55 -0
  43. package/lib/components/plans/plans.component.d.ts +63 -0
  44. package/lib/components/tab-navigation/tab-navigation.component.d.ts +13 -0
  45. package/lib/components/visits/visits.component.d.ts +62 -0
  46. package/lib/components/zones/add-audio-zone/add-audio-zone.component.d.ts +63 -0
  47. package/lib/components/zones/add-zone/add-zone.component.d.ts +69 -0
  48. package/lib/components/zones/add-zone/selection/selection.component.d.ts +44 -0
  49. package/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.d.ts +107 -0
  50. package/lib/components/zones/zones.component.d.ts +73 -0
  51. package/lib/helper.service.d.ts +53 -0
  52. package/lib/ngx-smarterplan-location-routing.module.d.ts +7 -0
  53. package/lib/ngx-smarterplan-locations.module.d.ts +36 -0
  54. package/lib/ngx-smarterplan-locations.service.d.ts +6 -0
  55. package/lib/pipes/count-audio-sweeps.pipe.d.ts +10 -0
  56. package/lib/radio-button/radio-button.component.d.ts +12 -0
  57. package/package.json +22 -5
  58. package/{src/public-api.ts → public-api.d.ts} +4 -11
  59. package/smarterplan-ngx-smarterplan-locations.d.ts +5 -0
  60. package/.browserslistrc +0 -16
  61. package/karma.conf.js +0 -44
  62. package/ng-package.json +0 -7
  63. package/src/lib/components/carousel/carousel.component.html +0 -13
  64. package/src/lib/components/carousel/carousel.component.scss +0 -0
  65. package/src/lib/components/carousel/carousel.component.spec.ts +0 -25
  66. package/src/lib/components/carousel/carousel.component.ts +0 -31
  67. package/src/lib/components/chevron/chevron.component.html +0 -5
  68. package/src/lib/components/chevron/chevron.component.scss +0 -16
  69. package/src/lib/components/chevron/chevron.component.spec.ts +0 -25
  70. package/src/lib/components/chevron/chevron.component.ts +0 -17
  71. package/src/lib/components/detail-location/detail-location.component.html +0 -108
  72. package/src/lib/components/detail-location/detail-location.component.scss +0 -0
  73. package/src/lib/components/detail-location/detail-location.component.spec.ts +0 -25
  74. package/src/lib/components/detail-location/detail-location.component.ts +0 -215
  75. package/src/lib/components/form-location/form-location.component.html +0 -160
  76. package/src/lib/components/form-location/form-location.component.scss +0 -62
  77. package/src/lib/components/form-location/form-location.component.spec.ts +0 -25
  78. package/src/lib/components/form-location/form-location.component.ts +0 -274
  79. package/src/lib/components/images/images.component.html +0 -27
  80. package/src/lib/components/images/images.component.scss +0 -0
  81. package/src/lib/components/images/images.component.spec.ts +0 -25
  82. package/src/lib/components/images/images.component.ts +0 -133
  83. package/src/lib/components/locations/locations.component.html +0 -63
  84. package/src/lib/components/locations/locations.component.scss +0 -121
  85. package/src/lib/components/locations/locations.component.spec.ts +0 -25
  86. package/src/lib/components/locations/locations.component.ts +0 -186
  87. package/src/lib/components/locations/map/map-popup/map-popup.component.html +0 -11
  88. package/src/lib/components/locations/map/map-popup/map-popup.component.scss +0 -51
  89. package/src/lib/components/locations/map/map-popup/map-popup.component.spec.ts +0 -25
  90. package/src/lib/components/locations/map/map-popup/map-popup.component.ts +0 -79
  91. package/src/lib/components/locations/map/map.component.html +0 -2
  92. package/src/lib/components/locations/map/map.component.scss +0 -0
  93. package/src/lib/components/locations/map/map.component.spec.ts +0 -25
  94. package/src/lib/components/locations/map/map.component.ts +0 -111
  95. package/src/lib/components/plan-legend/plan-legend.component.html +0 -9
  96. package/src/lib/components/plan-legend/plan-legend.component.scss +0 -38
  97. package/src/lib/components/plan-legend/plan-legend.component.spec.ts +0 -25
  98. package/src/lib/components/plan-legend/plan-legend.component.ts +0 -50
  99. package/src/lib/components/plans/calibration/calibration.component.html +0 -98
  100. package/src/lib/components/plans/calibration/calibration.component.scss +0 -136
  101. package/src/lib/components/plans/calibration/calibration.component.spec.ts +0 -25
  102. package/src/lib/components/plans/calibration/calibration.component.ts +0 -603
  103. package/src/lib/components/plans/edit-plan/edit-plan.component.html +0 -77
  104. package/src/lib/components/plans/edit-plan/edit-plan.component.scss +0 -9
  105. package/src/lib/components/plans/edit-plan/edit-plan.component.spec.ts +0 -25
  106. package/src/lib/components/plans/edit-plan/edit-plan.component.ts +0 -421
  107. package/src/lib/components/plans/plans.component.html +0 -102
  108. package/src/lib/components/plans/plans.component.scss +0 -24
  109. package/src/lib/components/plans/plans.component.spec.ts +0 -25
  110. package/src/lib/components/plans/plans.component.ts +0 -305
  111. package/src/lib/components/tab-navigation/tab-navigation.component.html +0 -7
  112. package/src/lib/components/tab-navigation/tab-navigation.component.scss +0 -27
  113. package/src/lib/components/tab-navigation/tab-navigation.component.spec.ts +0 -25
  114. package/src/lib/components/tab-navigation/tab-navigation.component.ts +0 -35
  115. package/src/lib/components/visits/visits.component.html +0 -134
  116. package/src/lib/components/visits/visits.component.scss +0 -24
  117. package/src/lib/components/visits/visits.component.spec.ts +0 -25
  118. package/src/lib/components/visits/visits.component.ts +0 -357
  119. package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.html +0 -73
  120. package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.scss +0 -14
  121. package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.spec.ts +0 -25
  122. package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.ts +0 -269
  123. package/src/lib/components/zones/add-zone/add-zone.component.html +0 -153
  124. package/src/lib/components/zones/add-zone/add-zone.component.scss +0 -44
  125. package/src/lib/components/zones/add-zone/add-zone.component.spec.ts +0 -25
  126. package/src/lib/components/zones/add-zone/add-zone.component.ts +0 -377
  127. package/src/lib/components/zones/add-zone/selection/selection.component.html +0 -3
  128. package/src/lib/components/zones/add-zone/selection/selection.component.scss +0 -16
  129. package/src/lib/components/zones/add-zone/selection/selection.component.spec.ts +0 -25
  130. package/src/lib/components/zones/add-zone/selection/selection.component.ts +0 -95
  131. package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.html +0 -73
  132. package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.scss +0 -23
  133. package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.spec.ts +0 -25
  134. package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.ts +0 -595
  135. package/src/lib/components/zones/zones.component.html +0 -181
  136. package/src/lib/components/zones/zones.component.scss +0 -36
  137. package/src/lib/components/zones/zones.component.spec.ts +0 -25
  138. package/src/lib/components/zones/zones.component.ts +0 -339
  139. package/src/lib/helper.service.ts +0 -161
  140. package/src/lib/ngx-smarterplan-location-routing.module.ts +0 -41
  141. package/src/lib/ngx-smarterplan-locations.module.ts +0 -74
  142. package/src/lib/ngx-smarterplan-locations.service.spec.ts +0 -16
  143. package/src/lib/ngx-smarterplan-locations.service.ts +0 -9
  144. package/src/lib/pipes/count-audio-sweeps.pipe.ts +0 -21
  145. package/src/lib/radio-button/radio-button.component.html +0 -9
  146. package/src/lib/radio-button/radio-button.component.scss +0 -152
  147. package/src/lib/radio-button/radio-button.component.spec.ts +0 -25
  148. package/src/lib/radio-button/radio-button.component.ts +0 -26
  149. package/src/test.ts +0 -27
  150. package/tsconfig.lib.json +0 -15
  151. package/tsconfig.lib.prod.json +0 -10
  152. package/tsconfig.spec.json +0 -17
@@ -1,305 +0,0 @@
1
- import { Component, OnInit } from '@angular/core';
2
- import { FormGroup, FormBuilder, Validators } from '@angular/forms';
3
- import { ActivatedRoute, Router } from '@angular/router';
4
- import { TranslateService } from '@ngx-translate/core';
5
- import { Zone, Space, Plan, MenuItem, SpaceService, PlanService, getMetaForImage, getSignedFile, downloadFileAsObject, downloadBlob, NavigatorService } from '@smarterplan/ngx-smarterplan-core';
6
- import panzoom from 'panzoom';
7
- import { Subject, takeUntil } from 'rxjs';
8
-
9
- @Component({
10
- selector: 'lib-plans',
11
- templateUrl: './plans.component.html',
12
- styleUrls: ['./plans.component.scss']
13
- })
14
- export class PlansComponent implements OnInit {
15
-
16
- spaceID: string;
17
-
18
- currentSpace: Space;
19
-
20
- plans: Plan[];
21
-
22
- // chosenPlan: Plan;
23
-
24
- indexDetails = -1;
25
-
26
- loading = false;
27
-
28
- uploadingPlan = false;
29
-
30
- planForm: FormGroup;
31
-
32
- isCurrentPlanForZone = false;
33
-
34
- canvas;
35
-
36
- scale: number;
37
-
38
- panzoom: any;
39
-
40
- currentZone: Zone;
41
-
42
- fileToUpload: File;
43
-
44
- chosenPlanIsPdf = false;
45
-
46
- zones: Zone[];
47
-
48
- menuItems: MenuItem[] = [];
49
-
50
- destroy$ = new Subject();
51
-
52
- constructor(
53
- private route: ActivatedRoute,
54
- private router: Router,
55
- private spaceService: SpaceService,
56
- private planService: PlanService,
57
- private fb: FormBuilder,
58
- private translate: TranslateService,
59
- private navigatorService: NavigatorService
60
- ) {
61
- this.navigatorService.locationIDChange
62
- .pipe(takeUntil(this.destroy$))
63
- .subscribe((spaceID) => {
64
- this.router.navigate(["dashboard/localisation", spaceID, "plans"]);
65
- });
66
-
67
- this.route.params.subscribe((params) => {
68
- this.spaceID = params.id;
69
- this.getPlans();
70
- });
71
- }
72
-
73
- ngOnInit(): void {
74
- if (
75
- this.planService.getPlanFileCache() &&
76
- this.planService.getChosenPlan()
77
- ) {
78
- this.addPlanFromCache(
79
- this.planService.getPlanFileCache(),
80
- this.planService.getChosenPlan(),
81
- );
82
- this.planService.setPlanFileCache(null);
83
- }
84
- this.planService.setChosenPlan(null);
85
- }
86
-
87
- ngOnDestroy() {
88
- this.destroy$.next(true);
89
- this.destroy$.complete();
90
- }
91
-
92
- setupMenuItems() {
93
- this.menuItems = [
94
- { label: "Locations", url: "/localisation" },
95
- {
96
- label: this.currentSpace.name,
97
- url: `/localisation/${this.currentSpace.id}`,
98
- },
99
- {
100
- label: "Plans",
101
- url: `/localisation/${this.currentSpace.id}/plans`,
102
- },
103
- ];
104
- }
105
-
106
- onGoBack() { }
107
-
108
- async onPlanClick(plan?: Plan) {
109
- if (plan) this.planService.setChosenPlan(plan);
110
- this.chosenPlanIsPdf = plan.annexe.includes("pdf");
111
- if (!this.chosenPlanIsPdf) {
112
- setTimeout(() => {
113
- this.configureCanvas().then(() => {
114
- this.panzoom = panzoom(this.canvas, {
115
- bounds: true,
116
- boundsPadding: 0,
117
- maxZoom: 3.5,
118
- minZoom: 0.1,
119
- initialZoom: 0.5,
120
- });
121
- });
122
- }, 500);
123
- }
124
- }
125
-
126
- async configureCanvas() {
127
- this.uploadingPlan = true;
128
- const canvas = document.querySelector("#canvas") as HTMLCanvasElement;
129
- const image = await getMetaForImage(this.getChoosenPlan().filepath);
130
- canvas.width = image.width;
131
- canvas.height = image.height;
132
- this.canvas = canvas;
133
- this.drawImage(this.getChoosenPlan().filepath);
134
- this.uploadingPlan = false;
135
- }
136
-
137
- drawImage(url: string, x = 0, y = 0) {
138
- const image = new Image();
139
- const context = this.canvas.getContext("2d");
140
- const imageWidth = this.canvas.width;
141
- const imageHeight = this.canvas.height;
142
- image.addEventListener("load", () => {
143
- context.drawImage(
144
- image,
145
- 0,
146
- 0,
147
- image.width,
148
- image.height,
149
- x,
150
- y,
151
- imageWidth,
152
- imageHeight,
153
- );
154
- });
155
- image.src = url;
156
- // image.crossOrigin = "*"; //need to download as png,
157
- // BUT: https://stackoverflow.com/questions/49503171/the-image-tag-with-crossorigin-anonymous-cant-load-success-from-s3
158
- }
159
-
160
- async getPlans() {
161
- this.loading = true;
162
- this.currentSpace = await this.spaceService.getSpace(this.spaceID);
163
- this.setupMenuItems();
164
-
165
- this.zones = this.currentSpace.zones.items;
166
- this.plans = await this.planService.getSingedPlansForSpace(this.spaceID);
167
- this.loading = false;
168
- if (this.plans.length === 1) {
169
- this.onPlanClick(this.plans[0]);
170
- }
171
- }
172
-
173
- getChoosenPlan() {
174
- return this.planService.getChosenPlan();
175
- }
176
-
177
- removeImage() {
178
- const context = this.canvas.getContext("2d");
179
- context.clearRect(0, 0, 4096, 4096);
180
- }
181
-
182
- /**
183
- *
184
- */
185
- onCalibrateClick() {
186
- if (this.getChoosenPlan()) {
187
- this.router.navigate(
188
- ["/dashboard/localisation", this.spaceID, "plan-calibration"],
189
- { queryParams: { spaceID: this.spaceID } },
190
- );
191
- }
192
- }
193
-
194
- /**
195
- *
196
- */
197
- onEditClick() {
198
- if (this.getChoosenPlan()) {
199
- this.router.navigate(
200
- ["/dashboard/localisation", this.spaceID, "plan-edit"],
201
- { queryParams: { spaceID: this.spaceID } },
202
- );
203
- }
204
- }
205
-
206
- onUploadClick() {
207
- const inputFile = document.querySelector(
208
- "#upload-file",
209
- ) as HTMLInputElement;
210
- inputFile.click();
211
- }
212
-
213
- addPlan(target: EventTarget) {
214
- this.fileToUpload = (target as HTMLInputElement).files[0];
215
- this.planForm = this.fb.group({
216
- name: [this.fileToUpload.name, [Validators.required]],
217
- zoneID: [null, [Validators.required]],
218
- spaceID: this.spaceID,
219
- isModified: false,
220
- calibration: "",
221
- });
222
- }
223
-
224
- addPlanFromCache(file: File, plan: Plan) {
225
- this.fileToUpload = file;
226
- this.planForm = this.fb.group({
227
- name: [this.fileToUpload.name, [Validators.required]],
228
- zoneID: [plan ? plan.zoneID : null, [Validators.required]],
229
- spaceID: this.spaceID,
230
- isModified: !!plan,
231
- calibration:
232
- plan && plan.isModified && plan.calibration
233
- ? plan.calibration
234
- : "",
235
- });
236
- }
237
-
238
- async onSavePlan() {
239
- const formValue = this.planForm.value as Plan;
240
- formValue.isCurrentForZone = this.isCurrentPlanForZone;
241
- const createdPlan = await this.planService.createPlanWithAnnexe(
242
- formValue,
243
- this.fileToUpload,
244
- );
245
- const filepath = await getSignedFile(createdPlan.annexe);
246
- if (filepath) {
247
- createdPlan.filepath = filepath;
248
- }
249
- if (formValue.isCurrentForZone) {
250
- // set all other plans to not current
251
- this.planService.setAllPlansForZoneNotCurrent(
252
- createdPlan.zoneID,
253
- createdPlan.id,
254
- );
255
- }
256
- this.plans.push(createdPlan);
257
- this.planForm = null;
258
- this.fileToUpload = null;
259
- }
260
-
261
- onCancelUpload() {
262
- this.fileToUpload = null;
263
- this.planForm = null;
264
- }
265
-
266
- async onCurrentPlanClick() {
267
- await this.planService.updatePlan({
268
- id: this.getChoosenPlan().id,
269
- isCurrentForZone: this.getChoosenPlan().isCurrentForZone,
270
- });
271
- if (this.getChoosenPlan().isCurrentForZone) {
272
- this.planService.setAllPlansForZoneNotCurrent(
273
- this.getChoosenPlan().zoneID,
274
- this.getChoosenPlan().id,
275
- );
276
- }
277
- }
278
-
279
- async onDownloadClick() {
280
- const signedFile = await downloadFileAsObject(
281
- this.getChoosenPlan().annexe,
282
- );
283
- if (signedFile) {
284
- // @ts-ignore
285
- downloadBlob(signedFile.Body, this.getChoosenPlan().name);
286
- }
287
- }
288
-
289
- async onDownloadAsPng() {
290
- const canvas = document.querySelector("#canvas") as HTMLCanvasElement;
291
- canvas.toBlob(function (blob) {
292
- downloadBlob(blob, "plan-as-png.png");
293
- });
294
- }
295
-
296
- async onRemoveClick() {
297
- const message = this.translate.instant("confirm.deletePlan");
298
- if (window.confirm(message)) {
299
- await this.planService.deletePlan(this.getChoosenPlan());
300
- this.removeImage();
301
- this.planService.setChosenPlan(null);
302
- this.getPlans();
303
- }
304
- }
305
- }
@@ -1,7 +0,0 @@
1
- <span class="menu">
2
- <span *ngFor="let item of menuItems; let index = index;">
3
- <span class="item" [ngClass]="{'current':index === menuItems.length - 1}"
4
- (click)="onClick(item.url,item.back, index)">{{item.label | translate}}</span> <span
5
- *ngIf="index !== menuItems.length - 1" class="separator">></span>
6
- </span>
7
- </span>
@@ -1,27 +0,0 @@
1
- .item {
2
- font-size: 1.35em;
3
- color: var(--smarterplan-primary);
4
- cursor: pointer;
5
- }
6
-
7
- .current{
8
- color: var(--smarterplan-primary) !important;
9
- cursor: default !important;
10
- text-decoration: none !important;
11
- }
12
-
13
- .separator{
14
- font-size: 1.4em;
15
- margin-left: 10px;
16
- margin-right: 10px;
17
- color: var(--smarterplan-primary);
18
- }
19
-
20
- .item:hover {
21
- text-decoration: underline;
22
- }
23
-
24
- .menu {
25
- margin-top: 15px;
26
- margin-bottom: 20px;
27
- }
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { TabNavigationComponent } from './tab-navigation.component';
4
-
5
- describe('TabNavigationComponent', () => {
6
- let component: TabNavigationComponent;
7
- let fixture: ComponentFixture<TabNavigationComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ TabNavigationComponent ]
12
- })
13
- .compileComponents();
14
- });
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(TabNavigationComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,35 +0,0 @@
1
- import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
2
- import { Router } from '@angular/router';
3
- import { MenuItem } from '@smarterplan/ngx-smarterplan-core';
4
-
5
- @Component({
6
- selector: 'lib-tab-navigation',
7
- templateUrl: './tab-navigation.component.html',
8
- styleUrls: ['./tab-navigation.component.scss']
9
- })
10
- export class TabNavigationComponent {
11
-
12
- @Output() onGoBack = new EventEmitter<void>();
13
-
14
- @Input() menuItems: MenuItem[] = [];
15
-
16
- constructor(private router: Router) { }
17
-
18
- onClick(url: string, parameter: any, index: number) {
19
- if (index === this.menuItems.length - 1) {
20
- return;
21
- }
22
- if (url) {
23
- const newURL = `/dashboard${url}`;
24
- if (this.router.url !== newURL) {
25
- console.log('new url', newURL);
26
- this.router.navigate([newURL]);
27
- } else {
28
- this.onGoBack.emit(parameter);
29
- }
30
- } else {
31
- this.onGoBack.emit(parameter);
32
- }
33
- }
34
-
35
- }
@@ -1,134 +0,0 @@
1
- <div class="container-fluid" class="dashboard-tab">
2
- <div class="m-3">
3
- <lib-tab-navigation [menuItems]='menuItems' (onGoBack)="onGoBack()"></lib-tab-navigation>
4
- </div>
5
-
6
- <div class="row main-form-container">
7
- <div class="col-md-6 form-container">
8
- <ul class="list-group list-group-flush" *ngIf="!visitForm">
9
- <li class="list-group-item list-group-item-action" *ngFor="let visit of visits; index as index">
10
- <div class="d-flex justify-content-between align-items-center" (click)="onToggleDetail(index)">
11
- {{visit.name ? visit.name : visit.model3d }}
12
- <lib-chevron [conditionShowing]="index==visitIndexDetails"></lib-chevron>
13
- </div>
14
- <div *ngIf="index==visitIndexDetails">
15
- <ul class="list-group list-group-flush">
16
- <li class="list-group-item bg-transparent">{{'Name' | translate}} : {{ visit.name ?
17
- visit.name : "Not provided" | translate}}</li>
18
- <li class="list-group-item bg-transparent">{{'3D Model' | translate}} : {{ visit.model3d }}
19
- </li>
20
- <li class="list-group-item bg-transparent">{{'Surface' | translate}}, m<sup>2</sup>: {{
21
- visit.surface ?
22
- visit.surface : 'Not provided' | translate}}</li>
23
- <li class="list-group-item bg-transparent">{{'Viewer' | translate}} : {{ visit.viewer }}
24
- </li>
25
- <li class="list-group-item bg-transparent">{{'Date of capture' | translate}} : {{
26
- visit.takenAt | timeDateString | async}}
27
- <li class="list-group-item bg-transparent">{{'Images imported' | translate}} : {{
28
- visit.nmbImagesImported }}
29
- </li>
30
- </ul>
31
-
32
- <lib-loader *ngIf="isProcessing"></lib-loader>
33
- <button type="button" class="btn btn-outline-primary rounded-pill me-2" (click)="onImport(visit)" [disabled]="isProcessing">{{'Import images' |
34
- translate}}</button>
35
- <button type="button" class="btn btn-outline-primary rounded-pill me-2" [disabled]="isProcessing"
36
- (click)="onEdit(visit)">{{'Edit' | translate}}</button>
37
- <button type="button" class="btn btn-outline-primary rounded-pill" [disabled]="isProcessing"
38
- (click)="onDelete(visit)">{{'Delete' | translate}}</button>
39
- </div>
40
- </li>
41
- </ul>
42
- <div *ngIf="visitForm">
43
- <form (ngSubmit)="onSubmitVisit()" [formGroup]="visitForm">
44
- <div class="mb-3 row">
45
- <label class="col-sm-2 col-form-label">{{'Name' | translate}}</label>
46
- <div class="col-sm-10">
47
- <input type="text" class="form-control" formControlName="name">
48
- </div>
49
- </div>
50
- <div class="mb-3 row">
51
- <label class="col-sm-2 col-form-label">{{'Reference 3D model' | translate}} *</label>
52
- <div class="col-sm-10">
53
- <input type="text" class="form-control" [readonly]="isEditing"
54
- [class.is-invalid]="model3D.invalid && visitSubmitted" required
55
- formControlName="model3D">
56
- <div class="invalid-feedback">
57
- <ngb-alert data-testid="new-location-name-invalid" [dismissible]="false" type="danger"
58
- *ngIf="validatorsService.isControlError(visitForm.controls['name'])
59
- || isFormError(visitForm.controls['name'])">
60
- {{validatorsService.getError(visitForm.controls['name']) | translate}}
61
- </ngb-alert>
62
- </div>
63
- <div *ngIf="isEditing" class="text-danger">
64
- {{'Cannot change 3D model reference. Please add new model.' | translate}}
65
- </div>
66
- </div>
67
- </div>
68
-
69
- <div class="mb-3 row">
70
- <label class="col-sm-2 col-form-label">{{'Viewer' | translate}}</label>
71
- <div class="col-sm-10">
72
- <input type="text" class="form-control" formControlName="viewer">
73
- </div>
74
- </div>
75
-
76
- <div class="mb-3 row">
77
- <label class="col-sm-2 col-form-label">{{'Surface' | translate}}</label>
78
- <div class="col-sm-10">
79
- <input type="text" class="form-control" formControlName="surface">
80
- </div>
81
- </div>
82
-
83
- <div class="mb-3 row">
84
- <label class="col-sm-2 col-form-label">{{'Capture Date' | translate}}</label>
85
- <div class="input-group">
86
- <input class="form-control" placeholder="dd/mm/yyyy" [(ngModel)]="captureDate" ngbDatepicker
87
- #d1="ngbDatepicker" [ngModelOptions]="{standalone: true}">
88
- <div class="input-group-append">
89
- <button class="btn btn-outline-secondary calendar" (click)="d1.toggle()"
90
- type="button"></button>
91
- </div>
92
- </div>
93
- </div>
94
- <button type="submit" class="btn btn-outline-primary rounded-pill me-2">{{'Save' |
95
- translate}}</button>
96
- <button type="button" (click)="onCancel()" class="btn btn-outline-primary rounded-pill">{{'Cancel' |
97
- translate}}</button>
98
- <div class="invalid-feedback" *ngIf="errorForm">
99
- <ngb-alert data-testid="new-location-form-invalid" [dismissible]="false" type="danger">
100
- {{'errorForm.infoBtn' |translate}}
101
-
102
- </ngb-alert>
103
- </div>
104
- </form>
105
- </div>
106
- <div *ngIf="!visitForm">
107
- <button class="btn btn-outline-primary rounded-pill" (click)="onAddVisit()">{{'Add 3D visit' |
108
- translate}}</button>
109
- </div>
110
- </div>
111
- <div id="viewer-frame" style="width: 100%; aspect-ratio: 2/1;"></div>
112
- </div>
113
- <ng-template #content let-modal>
114
- <div class="modal-header">
115
- <h4 class="modal-title" id="modal-basic-title">{{'Importing Data' | translate}}</h4>
116
- <button type="button" class="close" aria-label="Close" (click)="modal.dismiss('Cross click')">
117
- <span aria-hidden="true">×</span>
118
- </button>
119
- </div>
120
- <div class="modal-body">
121
- {{'Please do not leave or refresh this page...' | translate}}
122
- <div *ngIf="totalImages != 0">Imported {{imagesProcessed}} out of {{totalImages}} images.</div>
123
- <div class="d-flex justify-content-center">
124
- <div class="spinner-border" role="status">
125
- <span class="visually-hidden">{{'Loading' | translate}}...</span>
126
- </div>
127
- </div>
128
- </div>
129
- <div class="modal-footer">
130
- <button type="button" class="btn btn-outline-dark" [disabled]="!canCancelImport"
131
- (click)="modal.close('Cancel click')">{{'Cancel import of images' | translate}}</button>
132
- </div>
133
- </ng-template>
134
- </div>
@@ -1,24 +0,0 @@
1
- .col-form-label {
2
- width: 180px;
3
- margin-bottom: 1rem;
4
- }
5
-
6
- .btn-outline-primary {
7
- width: 200px;
8
- margin-right: 1rem;
9
- }
10
- .input-group {
11
- width: 83%;
12
- height: fit-content;
13
- }
14
- .main-form-container {
15
- width: 60vw;
16
- display: flex;
17
- flex-direction: column;
18
- @media screen and (max-width: 765px) {
19
- width: 90vw;
20
- }
21
- .form-container {
22
- width: 100%;
23
- }
24
- }
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { VisitsComponent } from './visits.component';
4
-
5
- describe('VisitsComponent', () => {
6
- let component: VisitsComponent;
7
- let fixture: ComponentFixture<VisitsComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ VisitsComponent ]
12
- })
13
- .compileComponents();
14
- });
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(VisitsComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });