@smarterplan/ngx-smarterplan-locations 0.2.42 → 0.2.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/.browserslistrc +16 -0
  2. package/README.md +24 -24
  3. package/karma.conf.js +44 -0
  4. package/ng-package.json +7 -0
  5. package/package.json +6 -23
  6. package/src/lib/components/carousel/carousel.component.html +13 -0
  7. package/src/lib/components/carousel/carousel.component.scss +0 -0
  8. package/src/lib/components/carousel/carousel.component.spec.ts +25 -0
  9. package/src/lib/components/carousel/carousel.component.ts +31 -0
  10. package/src/lib/components/chevron/chevron.component.html +5 -0
  11. package/src/lib/components/chevron/chevron.component.scss +16 -0
  12. package/src/lib/components/chevron/chevron.component.spec.ts +25 -0
  13. package/src/lib/components/chevron/chevron.component.ts +17 -0
  14. package/src/lib/components/detail-location/detail-location.component.html +108 -0
  15. package/src/lib/components/detail-location/detail-location.component.scss +0 -0
  16. package/src/lib/components/detail-location/detail-location.component.spec.ts +25 -0
  17. package/src/lib/components/detail-location/detail-location.component.ts +215 -0
  18. package/src/lib/components/form-location/form-location.component.html +160 -0
  19. package/src/lib/components/form-location/form-location.component.scss +62 -0
  20. package/src/lib/components/form-location/form-location.component.spec.ts +25 -0
  21. package/src/lib/components/form-location/form-location.component.ts +274 -0
  22. package/src/lib/components/images/images.component.html +27 -0
  23. package/src/lib/components/images/images.component.scss +0 -0
  24. package/src/lib/components/images/images.component.spec.ts +25 -0
  25. package/src/lib/components/images/images.component.ts +133 -0
  26. package/src/lib/components/locations/locations.component.html +63 -0
  27. package/src/lib/components/locations/locations.component.scss +121 -0
  28. package/src/lib/components/locations/locations.component.spec.ts +25 -0
  29. package/src/lib/components/locations/locations.component.ts +186 -0
  30. package/src/lib/components/locations/map/map-popup/map-popup.component.html +11 -0
  31. package/src/lib/components/locations/map/map-popup/map-popup.component.scss +51 -0
  32. package/src/lib/components/locations/map/map-popup/map-popup.component.spec.ts +25 -0
  33. package/src/lib/components/locations/map/map-popup/map-popup.component.ts +79 -0
  34. package/src/lib/components/locations/map/map.component.html +2 -0
  35. package/src/lib/components/locations/map/map.component.scss +0 -0
  36. package/src/lib/components/locations/map/map.component.spec.ts +25 -0
  37. package/src/lib/components/locations/map/map.component.ts +111 -0
  38. package/src/lib/components/plan-legend/plan-legend.component.html +9 -0
  39. package/src/lib/components/plan-legend/plan-legend.component.scss +38 -0
  40. package/src/lib/components/plan-legend/plan-legend.component.spec.ts +25 -0
  41. package/src/lib/components/plan-legend/plan-legend.component.ts +50 -0
  42. package/src/lib/components/plans/calibration/calibration.component.html +98 -0
  43. package/src/lib/components/plans/calibration/calibration.component.scss +136 -0
  44. package/src/lib/components/plans/calibration/calibration.component.spec.ts +25 -0
  45. package/src/lib/components/plans/calibration/calibration.component.ts +603 -0
  46. package/src/lib/components/plans/edit-plan/edit-plan.component.html +77 -0
  47. package/src/lib/components/plans/edit-plan/edit-plan.component.scss +9 -0
  48. package/src/lib/components/plans/edit-plan/edit-plan.component.spec.ts +25 -0
  49. package/src/lib/components/plans/edit-plan/edit-plan.component.ts +421 -0
  50. package/src/lib/components/plans/plans.component.html +102 -0
  51. package/src/lib/components/plans/plans.component.scss +24 -0
  52. package/src/lib/components/plans/plans.component.spec.ts +25 -0
  53. package/src/lib/components/plans/plans.component.ts +305 -0
  54. package/src/lib/components/tab-navigation/tab-navigation.component.html +7 -0
  55. package/src/lib/components/tab-navigation/tab-navigation.component.scss +27 -0
  56. package/src/lib/components/tab-navigation/tab-navigation.component.spec.ts +25 -0
  57. package/src/lib/components/tab-navigation/tab-navigation.component.ts +35 -0
  58. package/src/lib/components/visits/visits.component.html +134 -0
  59. package/src/lib/components/visits/visits.component.scss +24 -0
  60. package/src/lib/components/visits/visits.component.spec.ts +25 -0
  61. package/src/lib/components/visits/visits.component.ts +357 -0
  62. package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.html +73 -0
  63. package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.scss +14 -0
  64. package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.spec.ts +25 -0
  65. package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.ts +269 -0
  66. package/src/lib/components/zones/add-zone/add-zone.component.html +153 -0
  67. package/src/lib/components/zones/add-zone/add-zone.component.scss +44 -0
  68. package/src/lib/components/zones/add-zone/add-zone.component.spec.ts +25 -0
  69. package/src/lib/components/zones/add-zone/add-zone.component.ts +377 -0
  70. package/src/lib/components/zones/add-zone/selection/selection.component.html +3 -0
  71. package/src/lib/components/zones/add-zone/selection/selection.component.scss +16 -0
  72. package/src/lib/components/zones/add-zone/selection/selection.component.spec.ts +25 -0
  73. package/src/lib/components/zones/add-zone/selection/selection.component.ts +95 -0
  74. package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.html +73 -0
  75. package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.scss +23 -0
  76. package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.spec.ts +25 -0
  77. package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.ts +595 -0
  78. package/src/lib/components/zones/zones.component.html +181 -0
  79. package/src/lib/components/zones/zones.component.scss +36 -0
  80. package/src/lib/components/zones/zones.component.spec.ts +25 -0
  81. package/src/lib/components/zones/zones.component.ts +339 -0
  82. package/src/lib/helper.service.ts +161 -0
  83. package/src/lib/ngx-smarterplan-location-routing.module.ts +41 -0
  84. package/src/lib/ngx-smarterplan-locations.module.ts +74 -0
  85. package/src/lib/ngx-smarterplan-locations.service.spec.ts +16 -0
  86. package/src/lib/ngx-smarterplan-locations.service.ts +9 -0
  87. package/src/lib/pipes/count-audio-sweeps.pipe.ts +21 -0
  88. package/src/lib/radio-button/radio-button.component.html +9 -0
  89. package/src/lib/radio-button/radio-button.component.scss +152 -0
  90. package/src/lib/radio-button/radio-button.component.spec.ts +25 -0
  91. package/src/lib/radio-button/radio-button.component.ts +26 -0
  92. package/{public-api.d.ts → src/public-api.ts} +11 -4
  93. package/src/test.ts +27 -0
  94. package/tsconfig.lib.json +15 -0
  95. package/tsconfig.lib.prod.json +10 -0
  96. package/tsconfig.spec.json +17 -0
  97. package/esm2020/lib/components/carousel/carousel.component.mjs +0 -28
  98. package/esm2020/lib/components/chevron/chevron.component.mjs +0 -18
  99. package/esm2020/lib/components/detail-location/detail-location.component.mjs +0 -168
  100. package/esm2020/lib/components/form-location/form-location.component.mjs +0 -237
  101. package/esm2020/lib/components/images/images.component.mjs +0 -107
  102. package/esm2020/lib/components/locations/locations.component.mjs +0 -145
  103. package/esm2020/lib/components/locations/map/map-popup/map-popup.component.mjs +0 -66
  104. package/esm2020/lib/components/locations/map/map.component.mjs +0 -91
  105. package/esm2020/lib/components/plan-legend/plan-legend.component.mjs +0 -47
  106. package/esm2020/lib/components/plans/calibration/calibration.component.mjs +0 -468
  107. package/esm2020/lib/components/plans/edit-plan/edit-plan.component.mjs +0 -324
  108. package/esm2020/lib/components/plans/plans.component.mjs +0 -225
  109. package/esm2020/lib/components/tab-navigation/tab-navigation.component.mjs +0 -41
  110. package/esm2020/lib/components/visits/visits.component.mjs +0 -283
  111. package/esm2020/lib/components/zones/add-audio-zone/add-audio-zone.component.mjs +0 -230
  112. package/esm2020/lib/components/zones/add-zone/add-zone.component.mjs +0 -315
  113. package/esm2020/lib/components/zones/add-zone/selection/selection.component.mjs +0 -77
  114. package/esm2020/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.mjs +0 -502
  115. package/esm2020/lib/components/zones/zones.component.mjs +0 -260
  116. package/esm2020/lib/helper.service.mjs +0 -134
  117. package/esm2020/lib/ngx-smarterplan-location-routing.module.mjs +0 -49
  118. package/esm2020/lib/ngx-smarterplan-locations.module.mjs +0 -125
  119. package/esm2020/lib/ngx-smarterplan-locations.service.mjs +0 -14
  120. package/esm2020/lib/pipes/count-audio-sweeps.pipe.mjs +0 -27
  121. package/esm2020/lib/radio-button/radio-button.component.mjs +0 -26
  122. package/esm2020/public-api.mjs +0 -9
  123. package/esm2020/smarterplan-ngx-smarterplan-locations.mjs +0 -5
  124. package/fesm2015/smarterplan-ngx-smarterplan-locations.mjs +0 -3983
  125. package/fesm2015/smarterplan-ngx-smarterplan-locations.mjs.map +0 -1
  126. package/fesm2020/smarterplan-ngx-smarterplan-locations.mjs +0 -3820
  127. package/fesm2020/smarterplan-ngx-smarterplan-locations.mjs.map +0 -1
  128. package/lib/components/carousel/carousel.component.d.ts +0 -12
  129. package/lib/components/chevron/chevron.component.d.ts +0 -9
  130. package/lib/components/detail-location/detail-location.component.d.ts +0 -55
  131. package/lib/components/form-location/form-location.component.d.ts +0 -45
  132. package/lib/components/images/images.component.d.ts +0 -33
  133. package/lib/components/locations/locations.component.d.ts +0 -51
  134. package/lib/components/locations/map/map-popup/map-popup.component.d.ts +0 -22
  135. package/lib/components/locations/map/map.component.d.ts +0 -22
  136. package/lib/components/plan-legend/plan-legend.component.d.ts +0 -14
  137. package/lib/components/plans/calibration/calibration.component.d.ts +0 -140
  138. package/lib/components/plans/edit-plan/edit-plan.component.d.ts +0 -55
  139. package/lib/components/plans/plans.component.d.ts +0 -63
  140. package/lib/components/tab-navigation/tab-navigation.component.d.ts +0 -13
  141. package/lib/components/visits/visits.component.d.ts +0 -62
  142. package/lib/components/zones/add-audio-zone/add-audio-zone.component.d.ts +0 -63
  143. package/lib/components/zones/add-zone/add-zone.component.d.ts +0 -69
  144. package/lib/components/zones/add-zone/selection/selection.component.d.ts +0 -44
  145. package/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.d.ts +0 -107
  146. package/lib/components/zones/zones.component.d.ts +0 -72
  147. package/lib/helper.service.d.ts +0 -53
  148. package/lib/ngx-smarterplan-location-routing.module.d.ts +0 -7
  149. package/lib/ngx-smarterplan-locations.module.d.ts +0 -36
  150. package/lib/ngx-smarterplan-locations.service.d.ts +0 -6
  151. package/lib/pipes/count-audio-sweeps.pipe.d.ts +0 -10
  152. package/lib/radio-button/radio-button.component.d.ts +0 -12
  153. package/smarterplan-ngx-smarterplan-locations.d.ts +0 -5
@@ -0,0 +1,16 @@
1
+ # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2
+ # For additional information regarding the format and rule options, please see:
3
+ # https://github.com/browserslist/browserslist#queries
4
+
5
+ # For the full list of supported browsers by the Angular framework, please see:
6
+ # https://angular.io/guide/browser-support
7
+
8
+ # You can see what browsers were selected by your queries by running:
9
+ # npx browserslist
10
+
11
+ last 1 Chrome version
12
+ last 1 Firefox version
13
+ last 2 Edge major versions
14
+ last 2 Safari major versions
15
+ last 2 iOS major versions
16
+ Firefox ESR
package/README.md CHANGED
@@ -1,24 +1,24 @@
1
- # NgxSmarterplanLocations
2
-
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
4
-
5
- ## Code scaffolding
6
-
7
- Run `ng generate component component-name --project ngx-smarterplan-locations` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-smarterplan-locations`.
8
- > Note: Don't forget to add `--project ngx-smarterplan-locations` or else it will be added to the default project in your `angular.json` file.
9
-
10
- ## Build
11
-
12
- Run `ng build ngx-smarterplan-locations` to build the project. The build artifacts will be stored in the `dist/` directory.
13
-
14
- ## Publishing
15
-
16
- After building your library with `ng build ngx-smarterplan-locations`, go to the dist folder `cd dist/ngx-smarterplan-locations` and run `npm publish`.
17
-
18
- ## Running unit tests
19
-
20
- Run `ng test ngx-smarterplan-locations` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
-
22
- ## Further help
23
-
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
1
+ # NgxSmarterplanLocations
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project ngx-smarterplan-locations` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-smarterplan-locations`.
8
+ > Note: Don't forget to add `--project ngx-smarterplan-locations` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build ngx-smarterplan-locations` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+
14
+ ## Publishing
15
+
16
+ After building your library with `ng build ngx-smarterplan-locations`, go to the dist folder `cd dist/ngx-smarterplan-locations` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test ngx-smarterplan-locations` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
package/karma.conf.js ADDED
@@ -0,0 +1,44 @@
1
+ // Karma configuration file, see link for more information
2
+ // https://karma-runner.github.io/1.0/config/configuration-file.html
3
+
4
+ module.exports = function (config) {
5
+ config.set({
6
+ basePath: '',
7
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
+ plugins: [
9
+ require('karma-jasmine'),
10
+ require('karma-chrome-launcher'),
11
+ require('karma-jasmine-html-reporter'),
12
+ require('karma-coverage'),
13
+ require('@angular-devkit/build-angular/plugins/karma')
14
+ ],
15
+ client: {
16
+ jasmine: {
17
+ // you can add configuration options for Jasmine here
18
+ // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19
+ // for example, you can disable the random execution with `random: false`
20
+ // or set a specific seed with `seed: 4321`
21
+ },
22
+ clearContext: false // leave Jasmine Spec Runner output visible in browser
23
+ },
24
+ jasmineHtmlReporter: {
25
+ suppressAll: true // removes the duplicated traces
26
+ },
27
+ coverageReporter: {
28
+ dir: require('path').join(__dirname, '../../coverage/ngx-smarterplan-locations'),
29
+ subdir: '.',
30
+ reporters: [
31
+ { type: 'html' },
32
+ { type: 'text-summary' }
33
+ ]
34
+ },
35
+ reporters: ['progress', 'kjhtml'],
36
+ port: 9876,
37
+ colors: true,
38
+ logLevel: config.LOG_INFO,
39
+ autoWatch: true,
40
+ browsers: ['Chrome'],
41
+ singleRun: false,
42
+ restartOnFileChange: true
43
+ });
44
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/ngx-smarterplan-locations",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smarterplan/ngx-smarterplan-locations",
3
- "version": "0.2.42",
3
+ "version": "0.2.44",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^13.2.0",
6
6
  "@angular/core": "^13.2.0",
@@ -9,31 +9,14 @@
9
9
  "@ngx-translate/core": "^14.0.0",
10
10
  "leaflet": "^1.8.0",
11
11
  "ngx-clipboard": "^15.1.0",
12
- "@smarterplan/ngx-smarterplan-core": "^1.0.45",
12
+ "@smarterplan/ngx-smarterplan-core": "^1.0.48",
13
13
  "panzoom": "^9.4.2",
14
14
  "ng2-pdf-viewer": "^9.0.0"
15
15
  },
16
16
  "dependencies": {
17
17
  "tslib": "^2.3.0"
18
18
  },
19
- "module": "fesm2015/smarterplan-ngx-smarterplan-locations.mjs",
20
- "es2020": "fesm2020/smarterplan-ngx-smarterplan-locations.mjs",
21
- "esm2020": "esm2020/smarterplan-ngx-smarterplan-locations.mjs",
22
- "fesm2020": "fesm2020/smarterplan-ngx-smarterplan-locations.mjs",
23
- "fesm2015": "fesm2015/smarterplan-ngx-smarterplan-locations.mjs",
24
- "typings": "smarterplan-ngx-smarterplan-locations.d.ts",
25
- "exports": {
26
- "./package.json": {
27
- "default": "./package.json"
28
- },
29
- ".": {
30
- "types": "./smarterplan-ngx-smarterplan-locations.d.ts",
31
- "esm2020": "./esm2020/smarterplan-ngx-smarterplan-locations.mjs",
32
- "es2020": "./fesm2020/smarterplan-ngx-smarterplan-locations.mjs",
33
- "es2015": "./fesm2015/smarterplan-ngx-smarterplan-locations.mjs",
34
- "node": "./fesm2015/smarterplan-ngx-smarterplan-locations.mjs",
35
- "default": "./fesm2020/smarterplan-ngx-smarterplan-locations.mjs"
36
- }
37
- },
38
- "sideEffects": false
39
- }
19
+ "devDependencies": {
20
+ "@types/leaflet": "^1.7.9"
21
+ }
22
+ }
@@ -0,0 +1,13 @@
1
+ <ngb-carousel [interval]="5000" *ngIf="images && images.length > 1" (slide)="onSlide($event)">
2
+ <ng-template *ngFor="let image of images; let i = index" ngbSlide [id]="'slideId_' + i">
3
+ <div class="picsum-img-wrapper">
4
+ <img [src]="image.path" alt="Scan" class="d-block w-100">
5
+ </div>
6
+ <div class="carousel-caption">
7
+ <h3>{{image.title}}</h3>
8
+ <p>{{image.description}}</p>
9
+ </div>
10
+ </ng-template>
11
+ </ngb-carousel>
12
+
13
+ <img *ngIf="images.length === 1" [src]="images[0].path" alt="Scan" class="d-block w-100">
@@ -0,0 +1,25 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { CarouselComponent } from './carousel.component';
4
+
5
+ describe('CarouselComponent', () => {
6
+ let component: CarouselComponent;
7
+ let fixture: ComponentFixture<CarouselComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ declarations: [ CarouselComponent ]
12
+ })
13
+ .compileComponents();
14
+ });
15
+
16
+ beforeEach(() => {
17
+ fixture = TestBed.createComponent(CarouselComponent);
18
+ component = fixture.componentInstance;
19
+ fixture.detectChanges();
20
+ });
21
+
22
+ it('should create', () => {
23
+ expect(component).toBeTruthy();
24
+ });
25
+ });
@@ -0,0 +1,31 @@
1
+ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'lib-carousel',
5
+ templateUrl: './carousel.component.html',
6
+ styleUrls: ['./carousel.component.scss']
7
+ })
8
+ export class CarouselComponent implements OnInit {
9
+
10
+ @Input() images;
11
+
12
+ @Output() currentScan = new EventEmitter<number>();
13
+
14
+ dataEvent: string;
15
+
16
+ constructor() { }
17
+
18
+ ngOnInit(): void {
19
+ this.currentScan.emit(0);
20
+ }
21
+
22
+ onSlide(event) {
23
+ this.dataEvent = JSON.stringify(event);
24
+ const imageIndex = Number.parseInt(
25
+ event.current.replace("slideId_", ""),
26
+ 10,
27
+ );
28
+ this.currentScan.emit(imageIndex);
29
+ }
30
+
31
+ }
@@ -0,0 +1,5 @@
1
+ <div style="height: 30px; width: 30px;">
2
+ <span class="icon-container" >
3
+ <div [class]="conditionShowing ? 'icon-img-up' : 'icon-img-down'"></div>
4
+ </span>
5
+ </div>
@@ -0,0 +1,16 @@
1
+ .icon-container {
2
+ height: 30px;
3
+ width: 30px;
4
+ }
5
+
6
+ .icon-img-down {
7
+ width: 30px;
8
+ height: 100%;
9
+ background: url('https://api.iconify.design/mdi-light/chevron-right.svg?width=28') no-repeat center center / contain;
10
+ }
11
+
12
+ .icon-img-up {
13
+ width: 30px;
14
+ height: 100%;
15
+ background: url('https://api.iconify.design/mdi-light/chevron-down.svg?width=28') no-repeat center center / contain;
16
+ }
@@ -0,0 +1,25 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { ChevronComponent } from './chevron.component';
4
+
5
+ describe('ChevronComponent', () => {
6
+ let component: ChevronComponent;
7
+ let fixture: ComponentFixture<ChevronComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ declarations: [ ChevronComponent ]
12
+ })
13
+ .compileComponents();
14
+ });
15
+
16
+ beforeEach(() => {
17
+ fixture = TestBed.createComponent(ChevronComponent);
18
+ component = fixture.componentInstance;
19
+ fixture.detectChanges();
20
+ });
21
+
22
+ it('should create', () => {
23
+ expect(component).toBeTruthy();
24
+ });
25
+ });
@@ -0,0 +1,17 @@
1
+ import { Component, Input, OnInit } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'lib-chevron',
5
+ templateUrl: './chevron.component.html',
6
+ styleUrls: ['./chevron.component.scss']
7
+ })
8
+ export class ChevronComponent implements OnInit {
9
+
10
+ @Input() conditionShowing = false;
11
+
12
+ constructor() { }
13
+
14
+ ngOnInit(): void {
15
+ }
16
+
17
+ }
@@ -0,0 +1,108 @@
1
+ <div class="container-fluid">
2
+ <div class="m-3">
3
+ <lib-tab-navigation [menuItems]='menuItems' (onGoBack)="reset()"></lib-tab-navigation>
4
+ </div>
5
+ <button class="btn btn-outline-primary rounded-pill me-3" (click)="onReturn()">{{'Back to locations' |
6
+ translate}}</button>
7
+ <div class="row" *ngIf="!isEditing && space">
8
+ <div class="col-md-5">
9
+ <ul class="list-group list-group-flush">
10
+ <li class="list-group-item bg-transparent">{{'Name' | translate}}: {{space.name}} </li>
11
+ <li class="list-group-item bg-transparent">{{'Address' | translate}}: {{space.addresses}} </li>
12
+ <li class="list-group-item bg-transparent">{{'Construction year' | translate}}:
13
+ {{space.constructionYear ?
14
+ space.constructionYear : "No data" | translate}} </li>
15
+ <li class="list-group-item bg-transparent">{{'Latitude' | translate}}:
16
+ {{space.latitude ?
17
+ space.latitude : "No data" | translate}}</li>
18
+ <li class="list-group-item bg-transparent">{{'Longitude' | translate}}: {{space.longitude ?
19
+ space.longitude : "No data" | translate}} </li>
20
+ <li class="list-group-item bg-transparent">{{'Access level' | translate}}: {{space.level | translate
21
+ }} </li>
22
+ <li class="list-group-item bg-transparent">{{'Energy Class' | translate}}:
23
+ {{space.classEnergyConsumption ?
24
+ space.classEnergyConsumption : "No data" | translate}}
25
+ <button *ngIf="space.status !== 'DPE_TO_VALIDATE'"
26
+ class="btn btn-outline-primary rounded-pill no-lowercase ms-5" (click)="onGetDpeData()">
27
+ {{'Get data from API DPE' | translate}}</button>
28
+ <a class="bg-transparent ms-5" *ngIf="space.status === 'DPE_TO_VALIDATE'"
29
+ (click)="onDpeValidate()" style="cursor: pointer;">
30
+ <span class="iconify" data-icon="mdi:alert-circle-check" style="color: #f19c80;" data-width="25"
31
+ data-height="25"></span>
32
+ {{'DPE data found. Click to validate' | translate}}
33
+ </a>
34
+ </li>
35
+ <li class="list-group-item bg-transparent">{{'Greenhouse gas emission Class' | translate}}:
36
+ {{space.classGes ? space.classGes : "No data" | translate}} </li>
37
+ <li class="list-group-item bg-transparent">{{'Shareable Guest Link' | translate}}:
38
+ <div style="display: inline;" *ngIf="guestLink">
39
+ <a id="linkHref" target="_blank">{{'Try the link' | translate }}</a>
40
+ <div ngxClipboard [cbContent]="guestLink" [style.cursor]="'pointer'"
41
+ style="margin-left: 5px; max-width: 20px; display: inline;" ngbTooltip="Copied!"
42
+ triggers="click:blur">
43
+ <span class="iconify" data-icon="mdi:content-copy" data-inline="false" data-width="20"
44
+ data-height="20"></span>
45
+ </div>
46
+ </div>
47
+ <p *ngIf="!guestLink" style="display: inline;">{{'No link' | translate }}</p>
48
+ <p *ngIf="!guestLink"><small>({{'Generate link from a VISITOR mission'|translate}})</small>
49
+ </p>
50
+ </li>
51
+
52
+ </ul>
53
+ <div class="d-flex justify-content-center" *ngIf="gettingData">
54
+ <div class="spinner-border" role="status">
55
+ <span class="visually-hidden">Loading...</span>
56
+ </div>
57
+ </div>
58
+ <hr>
59
+ <div class="d-flex">
60
+ <button class="btn btn-outline-primary rounded-pill me-3" (click)="onEdit()" data-testid="location-edit-btn">{{'Edit' |
61
+ translate}}</button>
62
+ <div class="tooltip-wrapper" ngbTooltip="{{!canArchive ? ('Contact SmarterPlan' | translate) : ('Archive location and related data' | translate)}}">
63
+ <button class="btn btn-outline-primary rounded-pill" (click)="onArchive()" [disabled]="!canArchive">
64
+ {{'Archive' | translate}}</button>
65
+ </div>
66
+ </div>
67
+
68
+
69
+ </div>
70
+ <div class="col-md-7" *ngIf="isValidatingDpe">
71
+ <h6>{{'Most relevant results for' | translate}} :
72
+ <b>diagnostics de performance énergétique (DPE) des bâtiments tertiaires</b></h6>
73
+ <table class="table table-striped">
74
+ <thead>
75
+ <tr>
76
+ <th scope="col">#</th>
77
+ <th scope="col">{{'Apply to location' | translate}}</th>
78
+ <th scope="col">{{'Address' | translate}}</th>
79
+ <th scope="col">{{'Activity sector' | translate}}</th>
80
+ <th scope="col">{{'Construction year' | translate}}</th>
81
+ <th scope="col">{{'Energy Class' | translate}}</th>
82
+ <th scope="col">{{'Greenhouse gas emission Class' | translate}}</th>
83
+ </tr>
84
+ </thead>
85
+ <tbody>
86
+ <tr *ngFor="let result of parsedMetadata; index as i">
87
+ <th scope="row">{{ i + 1 }}</th>
88
+ <td><input class="checkbox-apply" type="checkbox" [(ngModel)]="result.selected"
89
+ (change)="onSelectChange(result)"></td>
90
+ <td>{{result.geo_adresse}}</td>
91
+ <td>{{result.secteur_activite}}</td>
92
+ <td>{{ result.annee_construction }}</td>
93
+ <td>{{ result.classe_consommation_energie }}</td>
94
+ <td>{{ result.classe_estimation_ges }}</td>
95
+ </tr>
96
+ </tbody>
97
+ </table>
98
+ <button class="btn btn-outline-primary rounded-pill me-2" (click)="onSaveResult()"
99
+ [disabled]="!selectedDpeResult">{{'Save selected' |
100
+ translate}}</button>
101
+ <button class="btn btn-outline-primary rounded-pill me-2" (click)="onErase()">
102
+ {{'No match (erase data)' | translate}}</button>
103
+ <button class="btn btn-outline-primary rounded-pill me-2" (click)="onCancel()">
104
+ {{'Cancel' | translate}}</button>
105
+ </div>
106
+ </div>
107
+ <lib-form-location *ngIf="isEditing" [location]="space" (onChange)="onFormChange($event)"></lib-form-location>
108
+ </div>
@@ -0,0 +1,25 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { DetailLocationComponent } from './detail-location.component';
4
+
5
+ describe('DetailLocationComponent', () => {
6
+ let component: DetailLocationComponent;
7
+ let fixture: ComponentFixture<DetailLocationComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ declarations: [ DetailLocationComponent ]
12
+ })
13
+ .compileComponents();
14
+ });
15
+
16
+ beforeEach(() => {
17
+ fixture = TestBed.createComponent(DetailLocationComponent);
18
+ component = fixture.componentInstance;
19
+ fixture.detectChanges();
20
+ });
21
+
22
+ it('should create', () => {
23
+ expect(component).toBeTruthy();
24
+ });
25
+ });
@@ -0,0 +1,215 @@
1
+ import { Component, OnInit } from '@angular/core';
2
+ import { FormGroup } from '@angular/forms';
3
+ import { ActivatedRoute, Router } from '@angular/router';
4
+ import { TranslateService } from '@ngx-translate/core';
5
+ import { MenuItem, SpaceService, BaseUserService, NavigatorService, SpaceStatus, Space } from '@smarterplan/ngx-smarterplan-core';
6
+ import { Subject, takeUntil } from 'rxjs';
7
+
8
+ @Component({
9
+ selector: 'lib-detail-location',
10
+ templateUrl: './detail-location.component.html',
11
+ styleUrls: ['./detail-location.component.scss']
12
+ })
13
+ export class DetailLocationComponent implements OnInit {
14
+
15
+ space: Space;
16
+
17
+ editForm: FormGroup;
18
+
19
+ isEditing = false;
20
+
21
+ imageToUpload: File;
22
+
23
+ id: string;
24
+
25
+ menuItems: MenuItem[] = [];
26
+
27
+ isValidatingDpe = false;
28
+
29
+ selectedDpeResult: any;
30
+
31
+ gettingData = false;
32
+
33
+ parsedMetadata: {
34
+ geo_adresse: string;
35
+ secteur_activite: string;
36
+ annee_construction: string;
37
+ classe_consommation_energie: string;
38
+ classe_estimation_ges: string;
39
+ selected: boolean;
40
+ }[];
41
+
42
+ guestLink: string;
43
+
44
+ canArchive: boolean;
45
+
46
+ destroy$ = new Subject();
47
+
48
+ constructor(
49
+ private route: ActivatedRoute,
50
+ private spaceService: SpaceService,
51
+ private router: Router,
52
+ private userService: BaseUserService,
53
+ private translate: TranslateService,
54
+ private navigatorService: NavigatorService,
55
+ ) {
56
+ this.navigatorService.locationIDChange
57
+ .pipe(takeUntil(this.destroy$))
58
+ .subscribe((spaceID) => {
59
+ this.router.navigate(["dashboard/localisation", spaceID]);
60
+ });
61
+
62
+ this.route.params.subscribe((params) => {
63
+ this.id = params.id;
64
+ this.setup();
65
+ });
66
+ }
67
+
68
+ ngOnInit() { }
69
+
70
+ async setup() {
71
+ this.space = await this.spaceService.getSpace(this.id);
72
+ this.setupMenuItems();
73
+ this.setGuestLink();
74
+ this.setCanArchive();
75
+ }
76
+
77
+ ngOnDestroy() {
78
+ this.destroy$.next(true);
79
+ this.destroy$.complete();
80
+ }
81
+
82
+ setupMenuItems() {
83
+ this.menuItems = [
84
+ { label: "Locations", url: "/localisation" },
85
+ {
86
+ label: this.space.name,
87
+ url: `/localisation/${this.space.id}`,
88
+ },
89
+ ];
90
+
91
+ if (this.isEditing) {
92
+ this.menuItems.push({ label: "Edit" });
93
+ } else {
94
+ this.menuItems.push({ label: "Information" });
95
+ }
96
+ }
97
+
98
+ onEdit() {
99
+ this.isEditing = true;
100
+ this.setupMenuItems();
101
+ }
102
+
103
+ onReturn() {
104
+ // this.locationService.back()
105
+ this.router.navigate(["dashboard/localisation"]);
106
+ }
107
+
108
+ reset() {
109
+ this.isEditing = false;
110
+ this.setupMenuItems();
111
+ }
112
+
113
+ async onArchive() {
114
+ const message = this.translate.instant("confirm.archiveSpace");
115
+ if (window.confirm(message)) {
116
+ await this.spaceService.softDeleteSpace(this.id);
117
+ this.onReturn();
118
+ }
119
+ }
120
+
121
+ onFormChange(event: Space) {
122
+ this.isEditing = false;
123
+ if (event) {
124
+ this.space = event;
125
+ }
126
+ this.setupMenuItems();
127
+ }
128
+
129
+ onDpeValidate() {
130
+ this.isValidatingDpe = true;
131
+ this.parsedMetadata = JSON.parse(this.space.metadata);
132
+ this.parsedMetadata = this.parsedMetadata.filter(
133
+ (result) => result.geo_adresse,
134
+ );
135
+ }
136
+
137
+ onSelectChange(selectedResult: any) {
138
+ for (const result of this.parsedMetadata) {
139
+ if (result !== selectedResult && result.selected) {
140
+ result.selected = false;
141
+ }
142
+ }
143
+ this.selectedDpeResult = selectedResult;
144
+ }
145
+
146
+ async onSaveResult() {
147
+ if (this.selectedDpeResult) {
148
+ const input = {
149
+ id: this.space.id,
150
+ constructionYear: this.selectedDpeResult.annee_construction,
151
+ classEnergyConsumption:
152
+ this.selectedDpeResult.classe_consommation_energie,
153
+ classGes: this.selectedDpeResult.classe_estimation_ges,
154
+ status: SpaceStatus.DPE_VALIDATED,
155
+ };
156
+ const updatedLoc = await this.spaceService.updateSpace(input);
157
+ this.space = updatedLoc;
158
+ this.isValidatingDpe = false;
159
+ }
160
+ }
161
+
162
+ onCancel() {
163
+ this.isValidatingDpe = false;
164
+ }
165
+
166
+ async onErase() {
167
+ await this.spaceService.updateSpace({
168
+ id: this.space.id,
169
+ status: SpaceStatus.DPE_VALIDATED,
170
+ });
171
+ this.space.status = SpaceStatus.DPE_VALIDATED;
172
+ this.isValidatingDpe = false;
173
+ }
174
+
175
+ async onGetDpeData() {
176
+ this.gettingData = true;
177
+ await this.spaceService.updateSpace({
178
+ id: this.space.id,
179
+ status: SpaceStatus.DPE_FETCH,
180
+ });
181
+
182
+ // force update of location
183
+ setTimeout(async () => {
184
+ this.space = await this.spaceService.getSpace(this.space.id);
185
+ this.gettingData = false;
186
+ }, 1500);
187
+ }
188
+
189
+ setGuestLink() {
190
+ if (this.space.guestLink) {
191
+ const { origin } = document.location;
192
+ this.guestLink = `${origin}/${this.space.guestLink}`;
193
+ setTimeout(() => {
194
+ const hyperlink = document.querySelector(
195
+ "#linkHref",
196
+ ) as HTMLLinkElement;
197
+ const message = this.translate.instant("confirm.followLink");
198
+ hyperlink.addEventListener("click", async () => {
199
+ if (window.confirm(message)) {
200
+ window.location.href = this.guestLink;
201
+ await this.userService.logoutCurrentAndSignOutAuth();
202
+ this.router.navigate(["auth"]);
203
+ }
204
+ });
205
+ }, 0);
206
+ }
207
+ }
208
+
209
+ async setCanArchive() {
210
+ this.canArchive = this.userService.isSPAdmin()
211
+ ? true
212
+ : await this.spaceService.canArchiveSpace(this.id);
213
+ }
214
+
215
+ }