@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,181 +0,0 @@
1
- <div class="container-fluid" *ngIf="currentSpace">
2
- <div class="m-3">
3
- <lib-tab-navigation [menuItems]='menuItems' (onGoBack)="onGoBack()"></lib-tab-navigation>
4
- </div>
5
- <div class="row" *ngIf="!isEditingZone && !isAddingAudioTrack">
6
- <div class="col-md-6">
7
- <ul class="list-group list-group-flush">
8
- <li class="list-group-item default-zone-line-item">
9
- <div class="d-flex justify-content-between align-items-center zone-name" *ngIf="defaultZone">
10
- {{defaultZone.name}}
11
- <div class="default-zone-label">{{ "whole space" | translate }}</div>
12
- <lib-chevron [conditionShowing]="defaultShowing" (click)="onToggleDefaultZone()"></lib-chevron>
13
- </div>
14
- <div *ngIf="defaultShowing">
15
- <ul class="list-group list-group-flush">
16
- <li class="list-group-item bg-transparent">{{'Type of zone' | translate}}:
17
- {{defaultZone.layer ? defaultZone.layer.name : "No type" | translate}} </li>
18
- <li class="list-group-item bg-transparent" *ngIf="defaultZone.surface">
19
- {{'Surface' | translate}}, m<sup>2</sup>: {{defaultZone.surface }}
20
- </li>
21
- <li class="list-group-item bg-transparent" *ngIf="!defaultZone.virtual">{{'Scan Points' | translate}}:
22
- {{defaultZone.sweepIDs ? defaultZone.sweepIDs.length : "No scan points" | translate}} </li>
23
- </ul>
24
- <div *ngFor="let pair of zonesMap | keyvalue">
25
- <div *ngIf="pair.key == defaultZone.id">
26
- <h5 style="margin: 8px;" *ngIf="pair.value.length > 0">{{'Children zones'|translate}}</h5>
27
- <ul class="list-group list-group-flush">
28
- <li class="list-group-item list-group-flush list-group-item-action"
29
- *ngFor="let lot of pair.value; index as zoneIndex">
30
- <div class="d-flex justify-content-between align-items-center zone-name">
31
- {{lot.name}}
32
- <div class="museum-label" *ngIf="lot.isMuseumVisitZone">{{ "itinerary" | translate }}</div>
33
- <lib-chevron [conditionShowing]="zoneIndex==lotIndexDetails"
34
- (click)="onToggleDetail(zoneIndex, lot)"></lib-chevron>
35
-
36
- </div>
37
- <div *ngIf="zoneIndex==lotIndexDetails">
38
- <ul class="list-group list-group-flush">
39
- <li class="list-group-item bg-transparent" *ngIf="!lot.isMuseumVisitZone">{{'Type of zone' |
40
- translate}}: {{lot.layer ? lot.layer.name :
41
- "No type" | translate}} </li>
42
- <li class="list-group-item bg-transparent" *ngIf="lot.surface">
43
- {{'Surface' | translate}},m<sup>2</sup>: {{lot.surface }}
44
- </li>
45
- <li class="list-group-item bg-transparent" *ngIf="!lot.virtual">{{'Scan Points' | translate}}:
46
- {{lot.sweepIDs ? lot.sweepIDs.length : "No scan points" | translate}} </li>
47
- <li class="list-group-item bg-transparent" *ngIf="lot.virtual">
48
- {{'Zone not visible in 3D visit' | translate}}</li>
49
- </ul>
50
- <button type="button" class="btn btn-outline-primary rounded-pill me-2"
51
- (click)="onEdit(lot)">{{'Edit' | translate}}</button>
52
- <button class="btn btn-outline-primary rounded-pill me-2" (click)="onAddAudioZone(lot)"
53
- *ngIf="isMuseumModule"> {{'add-audio.add' | translate}}</button>
54
- <button type="button" class="btn btn-outline-primary rounded-pill"
55
- (click)="onDelete(lot)">{{'Delete' | translate}}</button>
56
- </div>
57
- </li>
58
- </ul>
59
-
60
- </div>
61
- </div>
62
- </div>
63
- </li>
64
-
65
- <li class="list-group-item" *ngFor="let floor of floorZones; index as index">
66
- <div class="d-flex justify-content-between align-items-center zone-name">
67
- {{floor.name}}
68
- <!-- <small>({{ lot.metadata ? ('Calibrated' | translate) : ('Not calibrated' | translate)}})</small> -->
69
- <div class="museum-label" *ngIf="floor.isMuseumVisitZone">{{ "itinerary" | translate }}</div>
70
- <lib-chevron [conditionShowing]="index==floorDetails"
71
- (click)="onToggleDetailFloor(index, floor)"></lib-chevron>
72
- </div>
73
- <div *ngIf="index==floorDetails">
74
- <ul class="list-group list-group-flush">
75
- <li class="list-group-item bg-transparent">{{'Type of zone' | translate}}: {{floor.layer ?
76
- floor.layer.name :
77
- "No type" | translate}} </li>
78
- <li class="list-group-item bg-transparent" *ngIf="floor.surface">{{'Surface' | translate}}, m<sup>2</sup>:
79
- {{floor.surface }}
80
- </li>
81
- <li class="list-group-item bg-transparent" *ngIf="!floor.virtual">{{'Scan Points' | translate}}:
82
- {{floor.sweepIDs ? floor.sweepIDs.length : "No scan points" | translate}} </li>
83
- <li class="list-group-item bg-transparent" *ngIf="floor.virtual">{{'Zone not visible in 3D visit' |
84
- translate}}</li>
85
- </ul>
86
- <button type="button" class="btn btn-outline-primary rounded-pill me-2" (click)="onEdit(floor)">{{'Edit' |
87
- translate}}</button>
88
-
89
- <!-- List of children zones -->
90
-
91
- <div *ngFor="let pair of zonesMap | keyvalue">
92
- <div *ngIf="pair.key == floor.id">
93
- <h5 style="margin: 8px;" *ngIf="pair.value.length > 0">{{'Children zones'|translate}}</h5>
94
- <ul class="list-group list-group-flush">
95
- <li class="list-group-item list-group-flush list-group-item-action"
96
- *ngFor="let lot of pair.value; index as zoneIndex">
97
- <div class="d-flex justify-content-between align-items-center zone-name">
98
- <div><span *ngIf="lot.code_ref">{{lot.code_ref}}_</span>{{lot.name}}</div>
99
- <div class="museum-label" *ngIf="lot.isMuseumVisitZone">{{ "itinerary" | translate }}</div>
100
- <lib-chevron [conditionShowing]="zoneIndex==lotIndexDetails"
101
- (click)="onToggleDetail(zoneIndex, lot)"></lib-chevron>
102
-
103
- </div>
104
- <div *ngIf="zoneIndex==lotIndexDetails">
105
- <ul class="list-group list-group-flush">
106
- <li class="list-group-item bg-transparent" *ngIf="!lot.isMuseumVisitZone">{{'Type of zone' |
107
- translate}}: {{lot.layer ? lot.layer.name :
108
- "No type" | translate}} </li>
109
- <li class="list-group-item bg-transparent" *ngIf="lot.surface">{{'Surface' | translate}},
110
- m<sup>2</sup>:
111
- {{lot.surface }}
112
- </li>
113
- <li class="list-group-item bg-transparent" *ngIf="!lot.virtual">{{'Scan Points' | translate}}:
114
- {{lot.sweepIDs ? lot.sweepIDs.length : "No scan points" | translate}} </li>
115
- <li class="list-group-item bg-transparent" *ngIf="!lot.virtual && lot.isMuseumVisitZone">
116
- {{'Scan Points with audio' | translate}}: {{ lot | countAudioSweeps | async}} </li>
117
- <li class="list-group-item bg-transparent" *ngIf="lot.virtual">
118
- {{'Zone not visible in 3D visit' | translate}}</li> dist
119
- </ul>
120
- <button type="button" class="btn btn-outline-primary rounded-pill me-2"
121
- (click)="onEdit(lot)">{{'Edit' | translate}}</button>
122
- <button class="btn btn-outline-primary rounded-pill me-2" (click)="onAddAudioZone(lot)"
123
- *ngIf="isMuseumModule"> {{'add-audio.add' | translate}}</button>
124
- <button type="button" class="btn btn-outline-primary rounded-pill"
125
- (click)="onDelete(lot)">{{'Delete' | translate}}</button>
126
- </div>
127
- </li>
128
- </ul>
129
-
130
- </div>
131
- </div>
132
- </div>
133
- </li>
134
- </ul>
135
-
136
- <div>
137
- <button class="btn btn-outline-primary rounded-pill me-2" (click)="onAddLot()">{{'Add zone' |
138
- translate}}</button>
139
- <button class="btn btn-outline-primary rounded-pill me-2" (click)="onAddMuseumZone()" *ngIf="isMuseumModule">
140
- {{'Add museum itinerary' | translate}}</button>
141
- </div>
142
- </div>
143
- <div class="col-md-6" *ngIf="planIsVisible">
144
- <div class="d-flex justify-content-center" *ngIf="loadingPlan">
145
- <div class="spinner-border" role="status">
146
- <span class="visually-hidden">Loading...</span>
147
- </div>
148
- </div>
149
- <div class="row" style="overflow: hidden; flex-direction: column;">
150
- <div *ngIf="currentPlan">
151
- <lib-plan-legend [isAudioZone]="false"></lib-plan-legend>
152
- <div class="planContainer">
153
- <div class="mt-3 ms-3" style="height: 500px; width: 100%;" id="planDiv"></div>
154
- </div>
155
- </div>
156
-
157
- <div *ngIf="!currentPlan && plans && !loadingPlan && currentZone">
158
- <div class="mt-3 ms-3" id="no-plan" *ngIf="!currentZone.virtual && !currentZone.isMultipleFloorZone">
159
- {{ 'Plan is not calibrated' | translate}}
160
- </div>
161
- <div class="mt-3 ms-3" id="no-plan" *ngIf="currentZone.virtual">
162
- {{ 'No scan points chosen' | translate}}
163
- </div>
164
- <div class="mt-3 ms-3" id="no-plan" *ngIf="currentZone.isMultipleFloorZone">
165
- {{ 'The zone is on several floors' | translate}}
166
- </div>
167
- </div>
168
-
169
- </div>
170
- </div>
171
- </div>
172
- <div class="mb-3" *ngIf="isEditingZone">
173
- <lib-add-zone [zoneEdit]="zoneForEdit" [spaceID]="spaceID" [images360]="images360" [navigationIDs]="navigations"
174
- [zones]="allZones" [defaultZone]="defaultZone" (updatedZone)="editCompleted($event)"
175
- [isMuseumVisit]="isMuseumVisit"></lib-add-zone>
176
- </div>
177
- <div class="mb-3" *ngIf="isAddingAudioTrack">
178
- <lib-add-audio-zone [spaceID]="spaceID" [defaultZone]="defaultZone" [parentZone]="parentZoneForAudio"
179
- [zones]="allZones" [currentAudioZone]="zoneForEdit" (updatedZone)="editCompleted($event)"></lib-add-audio-zone>
180
- </div>
181
- </div>
@@ -1,36 +0,0 @@
1
- .museum-label {
2
- background-color: #6f3974;
3
- font-size: .95rem;
4
- border-radius: 10px;
5
- padding: 5px 10px;
6
- color: #fff;
7
- text-transform: uppercase;
8
- margin-left: auto;
9
- margin-right: 8px;
10
- }
11
-
12
- .default-zone-line-item {
13
- border-bottom-width: 3px;
14
- }
15
-
16
- .default-zone-label {
17
- background-color: var(--smarterplan-primary);
18
- font-size: .95rem;
19
- border-radius: 10px;
20
- padding: 5px 10px;
21
- color: #fff;
22
- text-transform: uppercase;
23
- margin-left: auto;
24
- margin-right: 8px;
25
- }
26
-
27
- .planContainer {
28
- overflow: hidden;
29
- border-radius: 6px;
30
- background-color: var(--smarterplan-secondary);
31
- height: 500px;
32
- }
33
-
34
- button {
35
- min-width: 80px;
36
- }
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { ZonesComponent } from './zones.component';
4
-
5
- describe('ZonesComponent', () => {
6
- let component: ZonesComponent;
7
- let fixture: ComponentFixture<ZonesComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ ZonesComponent ]
12
- })
13
- .compileComponents();
14
- });
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(ZonesComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,339 +0,0 @@
1
- import { Component, EventEmitter, OnInit, Output } from '@angular/core';
2
- import { ActivatedRoute, Router } from '@angular/router';
3
- import { TranslateService } from '@ngx-translate/core';
4
- import {
5
- MenuItem, ZoneService, SpaceService, VisitService,
6
- NavigationService, BaseUserService, PlanService, wait, Navigation, showScanPointsOnPlanInDiv, Plan, Space, Zone, SpModule, NavigatorService
7
- } from '@smarterplan/ngx-smarterplan-core';
8
- import panzoom from "panzoom";
9
- import { Subject, takeUntil } from 'rxjs';
10
- @Component({
11
- selector: 'lib-zones',
12
- templateUrl: './zones.component.html',
13
- styleUrls: ['./zones.component.scss']
14
- })
15
- export class ZonesComponent implements OnInit {
16
-
17
- lotIndexDetails = -1;
18
-
19
- currentSpace: Space;
20
-
21
- @Output() updatedZone = new EventEmitter<boolean>();
22
-
23
- plans: Plan[];
24
-
25
- zoneForEdit: Zone;
26
-
27
- isEditingZone = false;
28
-
29
- captureDate: number;
30
-
31
- spaceID: string;
32
-
33
- navigations: string[];
34
-
35
- images360: any[];
36
-
37
- carouselIsVisible = false;
38
-
39
- planIsVisible = false;
40
-
41
- currentPlan: Plan;
42
-
43
- currentZone: Zone;
44
-
45
- loadingPlan = false;
46
-
47
- menuItems: MenuItem[] = [];
48
-
49
- isMuseumVisit = false;
50
-
51
- isMuseumModule = false;
52
-
53
- allZones: Zone[];
54
-
55
- floorZones: Zone[] = [];
56
-
57
- zonesMap: Map<string, Zone[]> = new Map();
58
-
59
- floorDetails: number = -1;
60
-
61
- defaultZone: Zone;
62
-
63
- defaultShowing = false;
64
-
65
- isAddingAudioTrack = false;
66
-
67
- parentZoneForAudio: Zone;
68
-
69
- destroy$ = new Subject();
70
-
71
- constructor(
72
- private route: ActivatedRoute,
73
- private zoneService: ZoneService,
74
- private spaceService: SpaceService,
75
- private visitService: VisitService,
76
- private navigationService: NavigationService,
77
- private userService: BaseUserService,
78
- private planService: PlanService,
79
- private translate: TranslateService,
80
- private navigatorService: NavigatorService,
81
- private router: Router,
82
- ) {
83
- // listen to the change of location via navigation bar dropdown
84
- this.navigatorService.locationIDChange
85
- .pipe(takeUntil(this.destroy$))
86
- .subscribe((spaceID) => {
87
- this.router.navigate(["dashboard/localisation", spaceID, "zones"]).catch(e => console.log(e.message));
88
- });
89
-
90
- this.route.params.subscribe((params) => {
91
- this.spaceID = params.id;
92
- this.resetZones().catch(e => console.log(e.message));
93
- });
94
- }
95
-
96
- async ngOnInit() {
97
- this.isMuseumModule = this.userService.getSpModule() === SpModule.MUSEUM;
98
- }
99
-
100
- ngOnDestroy() {
101
- this.destroy$.next(true);
102
- this.destroy$.complete();
103
- }
104
-
105
- setupMenuItems() {
106
- this.menuItems = [
107
- { label: "Locations", url: "/localisation" },
108
- {
109
- label: this.currentSpace.name,
110
- url: `/localisation/${this.spaceID}`,
111
- },
112
- {
113
- label: "Zones",
114
- url: `/localisation/${this.currentSpace.id}/zones`,
115
- },
116
- ];
117
- }
118
-
119
- onGoBack() {
120
- this.editCompleted(null);
121
- }
122
-
123
- ngOnChanges() {
124
- this.resetZones().catch(e => console.log(e.message));
125
- }
126
-
127
- async resetZones() {
128
- this.isMuseumVisit = false;
129
- this.currentSpace = await this.spaceService.getSpace(this.spaceID);
130
- this.setupMenuItems();
131
-
132
- this.allZones = await this.zoneService.getZonesBySpace(this.spaceID);
133
- this.defaultZone = this.allZones.find(
134
- (zone) => zone.layer && zone.layer.name === "BUILDING" && zone.sweepIDs,
135
- );
136
-
137
- this.floorZones = this.allZones.filter(
138
- (zone) => zone.layer && zone.layer.name === "FLOOR",
139
- );
140
- // sort alphabetically
141
- this.floorZones.sort((a, b) => a.name.localeCompare(b.name));
142
- // we add only children zones that are not Floors
143
- if (!!this.defaultZone) {
144
- this.zonesMap.set(this.defaultZone.id, this.allZones.filter((zone) => zone.parentID === this.defaultZone.id && !this.floorZones.includes(zone)));
145
- }
146
- for (const floor of this.floorZones) {
147
- const zonesForFloor = this.allZones.filter((zone) => zone.parentID === floor.id);
148
- this.zonesMap.set(
149
- floor.id,
150
- zonesForFloor.sort((a, b) => a.name.localeCompare(b.name)),
151
- );
152
- }
153
- this.resetNavigations();
154
- this.images360 = await this.visitService.loadImagesForSpace(
155
- this.currentSpace,
156
- );
157
- this.plans = await this.planService.getPlansWithZonesForSpace(
158
- this.spaceID,
159
- );
160
- this.plans = this.plans.filter((plan) => plan.isCurrentForZone);
161
- this.onPlansLoaded().catch(e => console.log(e.message));
162
- }
163
-
164
- resetNavigations() {
165
- this.navigations = [];
166
- const zonesWithSweeps = this.allZones.filter((zone) => zone.sweepIDs);
167
- this.navigations = [
168
- ...new Set(zonesWithSweeps.flatMap((zone) => zone.sweepIDs)),
169
- ];
170
- }
171
-
172
- async onPlansLoaded(): Promise<void> {
173
- if (this.planIsVisible && this.currentZone) {
174
- this.preparePlan().catch(e=>console.log(e.message));
175
- }
176
- }
177
-
178
- /**
179
- * onToggleDetail folds/unfolds details for a zone
180
- * @param index
181
- * @param zone
182
- */
183
- async onToggleDetail(index: number, zone: Zone) {
184
- this.lotIndexDetails = index === this.lotIndexDetails ? -1 : index;
185
- if (this.lotIndexDetails === -1) {
186
- this.currentZone = null;
187
- this.planIsVisible = false;
188
- return;
189
- }
190
- this.currentZone = zone;
191
- this.planIsVisible = true;
192
- if (!this.plans) {
193
- return; // wait until the plans are set
194
- }
195
- if (this.loadingPlan) {
196
- // another plan is already loading
197
- await wait(1000);
198
- }
199
- this.preparePlan().catch(e=>console.log(e.message));
200
- }
201
-
202
- onToggleDetailFloor(index: number, floor: Zone) {
203
- this.defaultShowing = false;
204
- this.floorDetails = index === this.floorDetails ? -1 : index;
205
- if (this.floorDetails === -1) {
206
- this.currentZone = null;
207
- this.planIsVisible = false;
208
- return;
209
- }
210
- this.currentZone = floor;
211
- this.planIsVisible = true;
212
- if (!this.plans) {
213
- console.log("plans not ready");
214
- return; // wait until the plans are set
215
- }
216
- this.preparePlan().catch(e => console.log(e.message));
217
- }
218
-
219
- onToggleDefaultZone() {
220
- this.defaultShowing = !this.defaultShowing;
221
- this.currentZone = this.defaultShowing ? this.defaultZone : null;
222
- }
223
-
224
- async preparePlan() {
225
- this.loadingPlan = true;
226
- this.currentPlan = null;
227
- if (this.currentZone.virtual) {
228
- this.currentPlan = null;
229
- this.loadingPlan = false;
230
- return;
231
- }
232
- this.currentPlan = await this.planService.getCalibratedPlanForZone(
233
- this.currentZone,
234
- );
235
- if (this.currentPlan) {
236
- const scans = await this.navigationService.getNavigationsForZone(
237
- this.currentZone,
238
- );
239
- await this.showScanPointsOnPlan(scans);
240
- }
241
- this.loadingPlan = false;
242
- }
243
-
244
- toggleCarousel() {
245
- this.carouselIsVisible = true;
246
- }
247
-
248
- onEdit(zone: Zone) {
249
- this.zoneForEdit = zone;
250
- if (this.zoneForEdit.layer && this.zoneForEdit.layer.name === "AUDIO") {
251
- this.isAddingAudioTrack = true;
252
- } else {
253
- this.isEditingZone = true;
254
- }
255
-
256
- this.menuItems.push({
257
- label: `${zone.name}`,
258
- });
259
- }
260
-
261
- onAddLot() {
262
- this.isMuseumVisit = false;
263
- this.isEditingZone = true;
264
- this.menuItems.push({
265
- label: "New",
266
- });
267
- }
268
-
269
- onAddMuseumZone() {
270
- this.isMuseumVisit = true;
271
- this.isEditingZone = true;
272
- this.menuItems.push({
273
- label: "New Museum Itinerary",
274
- });
275
- }
276
-
277
- onAddAudioZone(parentZone: Zone) {
278
- this.parentZoneForAudio = parentZone;
279
- this.isAddingAudioTrack = true;
280
- this.menuItems.push({
281
- label: parentZone.name,
282
- });
283
- this.menuItems.push({
284
- label: "add-audio.add",
285
- });
286
- }
287
-
288
- async onDelete(zone: Zone) {
289
- const message = this.translate.instant("confirm.deleteZone");
290
- // eslint-disable-next-line no-alert
291
- if (window.confirm(message)) {
292
- const childrenZones = await this.zoneService.getZonesByParentZone(zone.id);
293
- await Promise.all(childrenZones.map(async (childZone) => {
294
- await this.zoneService.deleteZone(childZone.id);
295
- this.allZones.splice(this.allZones.indexOf(childZone), 1);
296
- }));
297
- await this.zoneService.deleteZone(zone.id);
298
- this.allZones.splice(this.allZones.indexOf(zone), 1);
299
- // remove current zone from its parent list
300
- if (zone.parentID && Array.from(this.zonesMap.keys()).includes(zone.parentID)) {
301
- const zonesForParent = this.zonesMap.get(zone.parentID);
302
- zonesForParent.splice(zonesForParent.indexOf(zone), 1);
303
- this.zonesMap.set(zone.parentID, zonesForParent);
304
- }
305
- // we send update of location in order to force update of list of zones in nav bar
306
- this.navigatorService.locationIDChange.next(this.spaceID);
307
- }
308
- }
309
-
310
- editCompleted(event: any) {
311
- this.lotIndexDetails = -1;
312
- this.currentPlan = null;
313
- this.isEditingZone = false;
314
- this.isAddingAudioTrack = false;
315
- this.zoneForEdit = null;
316
- this.planIsVisible = false;
317
- this.carouselIsVisible = false;
318
- this.setupMenuItems();
319
- if (event) {
320
- this.resetZones().catch(e=> console.log(e.message));
321
- // we send update of location in order to force update of list of zones in nav bar
322
- this.navigatorService.locationIDChange.next(this.spaceID);
323
- }
324
-
325
- }
326
-
327
- async showScanPointsOnPlan(navigations: Navigation[]) {
328
- if (this.currentPlan) {
329
- const divPlan = document.querySelector("#planDiv") as HTMLElement;
330
- await showScanPointsOnPlanInDiv(this.currentPlan, divPlan, navigations);
331
- panzoom(divPlan, {
332
- bounds: true,
333
- boundsPadding: 0,
334
- maxZoom: 3.5,
335
- });
336
- }
337
- }
338
-
339
- }