@smarterplan/ngx-smarterplan-locations 0.2.44 → 0.2.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/components/carousel/carousel.component.mjs +28 -0
- package/esm2020/lib/components/chevron/chevron.component.mjs +18 -0
- package/esm2020/lib/components/detail-location/detail-location.component.mjs +168 -0
- package/esm2020/lib/components/form-location/form-location.component.mjs +237 -0
- package/esm2020/lib/components/images/images.component.mjs +107 -0
- package/esm2020/lib/components/locations/locations.component.mjs +145 -0
- package/esm2020/lib/components/locations/map/map-popup/map-popup.component.mjs +66 -0
- package/esm2020/lib/components/locations/map/map.component.mjs +91 -0
- package/esm2020/lib/components/plan-legend/plan-legend.component.mjs +47 -0
- package/esm2020/lib/components/plans/calibration/calibration.component.mjs +468 -0
- package/esm2020/lib/components/plans/edit-plan/edit-plan.component.mjs +324 -0
- package/esm2020/lib/components/plans/plans.component.mjs +225 -0
- package/esm2020/lib/components/tab-navigation/tab-navigation.component.mjs +41 -0
- package/esm2020/lib/components/visits/visits.component.mjs +283 -0
- package/esm2020/lib/components/zones/add-audio-zone/add-audio-zone.component.mjs +230 -0
- package/esm2020/lib/components/zones/add-zone/add-zone.component.mjs +315 -0
- package/esm2020/lib/components/zones/add-zone/selection/selection.component.mjs +77 -0
- package/esm2020/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.mjs +502 -0
- package/esm2020/lib/components/zones/zones.component.mjs +268 -0
- package/esm2020/lib/helper.service.mjs +134 -0
- package/esm2020/lib/ngx-smarterplan-location-routing.module.mjs +49 -0
- package/esm2020/lib/ngx-smarterplan-locations.module.mjs +125 -0
- package/esm2020/lib/ngx-smarterplan-locations.service.mjs +14 -0
- package/esm2020/lib/pipes/count-audio-sweeps.pipe.mjs +27 -0
- package/esm2020/lib/radio-button/radio-button.component.mjs +26 -0
- package/esm2020/public-api.mjs +9 -0
- package/esm2020/smarterplan-ngx-smarterplan-locations.mjs +5 -0
- package/fesm2015/smarterplan-ngx-smarterplan-locations.mjs +3991 -0
- package/fesm2015/smarterplan-ngx-smarterplan-locations.mjs.map +1 -0
- package/fesm2020/smarterplan-ngx-smarterplan-locations.mjs +3828 -0
- package/fesm2020/smarterplan-ngx-smarterplan-locations.mjs.map +1 -0
- package/lib/components/carousel/carousel.component.d.ts +12 -0
- package/lib/components/chevron/chevron.component.d.ts +9 -0
- package/lib/components/detail-location/detail-location.component.d.ts +55 -0
- package/lib/components/form-location/form-location.component.d.ts +45 -0
- package/lib/components/images/images.component.d.ts +33 -0
- package/lib/components/locations/locations.component.d.ts +51 -0
- package/lib/components/locations/map/map-popup/map-popup.component.d.ts +22 -0
- package/lib/components/locations/map/map.component.d.ts +22 -0
- package/lib/components/plan-legend/plan-legend.component.d.ts +14 -0
- package/lib/components/plans/calibration/calibration.component.d.ts +140 -0
- package/lib/components/plans/edit-plan/edit-plan.component.d.ts +55 -0
- package/lib/components/plans/plans.component.d.ts +63 -0
- package/lib/components/tab-navigation/tab-navigation.component.d.ts +13 -0
- package/lib/components/visits/visits.component.d.ts +62 -0
- package/lib/components/zones/add-audio-zone/add-audio-zone.component.d.ts +63 -0
- package/lib/components/zones/add-zone/add-zone.component.d.ts +69 -0
- package/lib/components/zones/add-zone/selection/selection.component.d.ts +44 -0
- package/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.d.ts +107 -0
- package/lib/components/zones/zones.component.d.ts +73 -0
- package/lib/helper.service.d.ts +53 -0
- package/lib/ngx-smarterplan-location-routing.module.d.ts +7 -0
- package/lib/ngx-smarterplan-locations.module.d.ts +36 -0
- package/lib/ngx-smarterplan-locations.service.d.ts +6 -0
- package/lib/pipes/count-audio-sweeps.pipe.d.ts +10 -0
- package/lib/radio-button/radio-button.component.d.ts +12 -0
- package/package.json +22 -5
- package/{src/public-api.ts → public-api.d.ts} +4 -11
- package/smarterplan-ngx-smarterplan-locations.d.ts +5 -0
- package/.browserslistrc +0 -16
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -7
- package/src/lib/components/carousel/carousel.component.html +0 -13
- package/src/lib/components/carousel/carousel.component.scss +0 -0
- package/src/lib/components/carousel/carousel.component.spec.ts +0 -25
- package/src/lib/components/carousel/carousel.component.ts +0 -31
- package/src/lib/components/chevron/chevron.component.html +0 -5
- package/src/lib/components/chevron/chevron.component.scss +0 -16
- package/src/lib/components/chevron/chevron.component.spec.ts +0 -25
- package/src/lib/components/chevron/chevron.component.ts +0 -17
- package/src/lib/components/detail-location/detail-location.component.html +0 -108
- package/src/lib/components/detail-location/detail-location.component.scss +0 -0
- package/src/lib/components/detail-location/detail-location.component.spec.ts +0 -25
- package/src/lib/components/detail-location/detail-location.component.ts +0 -215
- package/src/lib/components/form-location/form-location.component.html +0 -160
- package/src/lib/components/form-location/form-location.component.scss +0 -62
- package/src/lib/components/form-location/form-location.component.spec.ts +0 -25
- package/src/lib/components/form-location/form-location.component.ts +0 -274
- package/src/lib/components/images/images.component.html +0 -27
- package/src/lib/components/images/images.component.scss +0 -0
- package/src/lib/components/images/images.component.spec.ts +0 -25
- package/src/lib/components/images/images.component.ts +0 -133
- package/src/lib/components/locations/locations.component.html +0 -63
- package/src/lib/components/locations/locations.component.scss +0 -121
- package/src/lib/components/locations/locations.component.spec.ts +0 -25
- package/src/lib/components/locations/locations.component.ts +0 -186
- package/src/lib/components/locations/map/map-popup/map-popup.component.html +0 -11
- package/src/lib/components/locations/map/map-popup/map-popup.component.scss +0 -51
- package/src/lib/components/locations/map/map-popup/map-popup.component.spec.ts +0 -25
- package/src/lib/components/locations/map/map-popup/map-popup.component.ts +0 -79
- package/src/lib/components/locations/map/map.component.html +0 -2
- package/src/lib/components/locations/map/map.component.scss +0 -0
- package/src/lib/components/locations/map/map.component.spec.ts +0 -25
- package/src/lib/components/locations/map/map.component.ts +0 -111
- package/src/lib/components/plan-legend/plan-legend.component.html +0 -9
- package/src/lib/components/plan-legend/plan-legend.component.scss +0 -38
- package/src/lib/components/plan-legend/plan-legend.component.spec.ts +0 -25
- package/src/lib/components/plan-legend/plan-legend.component.ts +0 -50
- package/src/lib/components/plans/calibration/calibration.component.html +0 -98
- package/src/lib/components/plans/calibration/calibration.component.scss +0 -136
- package/src/lib/components/plans/calibration/calibration.component.spec.ts +0 -25
- package/src/lib/components/plans/calibration/calibration.component.ts +0 -603
- package/src/lib/components/plans/edit-plan/edit-plan.component.html +0 -77
- package/src/lib/components/plans/edit-plan/edit-plan.component.scss +0 -9
- package/src/lib/components/plans/edit-plan/edit-plan.component.spec.ts +0 -25
- package/src/lib/components/plans/edit-plan/edit-plan.component.ts +0 -421
- package/src/lib/components/plans/plans.component.html +0 -102
- package/src/lib/components/plans/plans.component.scss +0 -24
- package/src/lib/components/plans/plans.component.spec.ts +0 -25
- package/src/lib/components/plans/plans.component.ts +0 -305
- package/src/lib/components/tab-navigation/tab-navigation.component.html +0 -7
- package/src/lib/components/tab-navigation/tab-navigation.component.scss +0 -27
- package/src/lib/components/tab-navigation/tab-navigation.component.spec.ts +0 -25
- package/src/lib/components/tab-navigation/tab-navigation.component.ts +0 -35
- package/src/lib/components/visits/visits.component.html +0 -134
- package/src/lib/components/visits/visits.component.scss +0 -24
- package/src/lib/components/visits/visits.component.spec.ts +0 -25
- package/src/lib/components/visits/visits.component.ts +0 -357
- package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.html +0 -73
- package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.scss +0 -14
- package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.spec.ts +0 -25
- package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.ts +0 -269
- package/src/lib/components/zones/add-zone/add-zone.component.html +0 -153
- package/src/lib/components/zones/add-zone/add-zone.component.scss +0 -44
- package/src/lib/components/zones/add-zone/add-zone.component.spec.ts +0 -25
- package/src/lib/components/zones/add-zone/add-zone.component.ts +0 -377
- package/src/lib/components/zones/add-zone/selection/selection.component.html +0 -3
- package/src/lib/components/zones/add-zone/selection/selection.component.scss +0 -16
- package/src/lib/components/zones/add-zone/selection/selection.component.spec.ts +0 -25
- package/src/lib/components/zones/add-zone/selection/selection.component.ts +0 -95
- package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.html +0 -73
- package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.scss +0 -23
- package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.spec.ts +0 -25
- package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.ts +0 -595
- package/src/lib/components/zones/zones.component.html +0 -181
- package/src/lib/components/zones/zones.component.scss +0 -36
- package/src/lib/components/zones/zones.component.spec.ts +0 -25
- package/src/lib/components/zones/zones.component.ts +0 -339
- package/src/lib/helper.service.ts +0 -161
- package/src/lib/ngx-smarterplan-location-routing.module.ts +0 -41
- package/src/lib/ngx-smarterplan-locations.module.ts +0 -74
- package/src/lib/ngx-smarterplan-locations.service.spec.ts +0 -16
- package/src/lib/ngx-smarterplan-locations.service.ts +0 -9
- package/src/lib/pipes/count-audio-sweeps.pipe.ts +0 -21
- package/src/lib/radio-button/radio-button.component.html +0 -9
- package/src/lib/radio-button/radio-button.component.scss +0 -152
- package/src/lib/radio-button/radio-button.component.spec.ts +0 -25
- package/src/lib/radio-button/radio-button.component.ts +0 -26
- package/src/test.ts +0 -27
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { EditPlanComponent } from './edit-plan.component';
|
|
4
|
-
|
|
5
|
-
describe('EditPlanComponent', () => {
|
|
6
|
-
let component: EditPlanComponent;
|
|
7
|
-
let fixture: ComponentFixture<EditPlanComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [ EditPlanComponent ]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(EditPlanComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,421 +0,0 @@
|
|
|
1
|
-
import { Component, HostListener, NgZone, OnInit, ViewChild } from '@angular/core';
|
|
2
|
-
import { ActivatedRoute, Router } from '@angular/router';
|
|
3
|
-
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
|
4
|
-
import { TranslateService } from '@ngx-translate/core';
|
|
5
|
-
import { getDocument } from "pdfjs-dist";
|
|
6
|
-
import { PDFDocumentProxy } from "ng2-pdf-viewer";
|
|
7
|
-
import { Zone, Plan, Space, MenuItem, PlanService, ZoneService, VisitService, SpaceService, sortAlphabeticallyOnName, downloadFileAsObject } from '@smarterplan/ngx-smarterplan-core';
|
|
8
|
-
|
|
9
|
-
@Component({
|
|
10
|
-
selector: 'lib-edit-plan',
|
|
11
|
-
templateUrl: './edit-plan.component.html',
|
|
12
|
-
styleUrls: ['./edit-plan.component.scss']
|
|
13
|
-
})
|
|
14
|
-
export class EditPlanComponent implements OnInit {
|
|
15
|
-
|
|
16
|
-
@ViewChild("dialog") dialog!: any;
|
|
17
|
-
|
|
18
|
-
@ViewChild("dialogZone") dialogZone!: any;
|
|
19
|
-
|
|
20
|
-
@ViewChild("preparing") loadingModal: any;
|
|
21
|
-
|
|
22
|
-
spaceID: string;
|
|
23
|
-
|
|
24
|
-
chosenPlan: Plan;
|
|
25
|
-
|
|
26
|
-
editedPlan: Plan;
|
|
27
|
-
|
|
28
|
-
loading: boolean = false;
|
|
29
|
-
|
|
30
|
-
svgEditor;
|
|
31
|
-
|
|
32
|
-
svgEditorIframe;
|
|
33
|
-
|
|
34
|
-
navigations: string[];
|
|
35
|
-
|
|
36
|
-
zones: Zone[];
|
|
37
|
-
|
|
38
|
-
isNewZone: boolean = false;
|
|
39
|
-
|
|
40
|
-
newZoneData;
|
|
41
|
-
|
|
42
|
-
editorUrl;
|
|
43
|
-
|
|
44
|
-
editedZone: Zone;
|
|
45
|
-
|
|
46
|
-
images360;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Options for svgEditor
|
|
51
|
-
*/
|
|
52
|
-
private config: any = {
|
|
53
|
-
noStorageOnLoad: true,
|
|
54
|
-
forceStorage: true,
|
|
55
|
-
// imgPath: "/assets/editor/images/",
|
|
56
|
-
// extPath: "/assets/editor/extensions/",
|
|
57
|
-
// langPath: "/assets/editor/locale/",
|
|
58
|
-
// canvgPath: "/assets/editor/canvg/",
|
|
59
|
-
// jspdfPath: "/assets/editor/jspdf/",
|
|
60
|
-
// jGraduatePath: "/assets/editor/jgraduate/images/",
|
|
61
|
-
// extIconsPath: "/assets/editor/extensions/",
|
|
62
|
-
// stylesheets: [
|
|
63
|
-
// "/assets/editor/jgraduate/css/jGraduate.css",
|
|
64
|
-
// "/assets/editor/spinbtn/jQuery.SpinButton.css",
|
|
65
|
-
// "/assets/editor/jgraduate/css/jPicker.css",
|
|
66
|
-
// "/assets/editor/svg-editor.css",
|
|
67
|
-
// ],
|
|
68
|
-
dimensions: [10000, 10000],
|
|
69
|
-
showlayers: true,
|
|
70
|
-
noDefaultExtensions: true,
|
|
71
|
-
basePath: "/assets/editor/",
|
|
72
|
-
customExportImage: true,
|
|
73
|
-
extensions: [
|
|
74
|
-
"ext-connector",
|
|
75
|
-
// "ext-eyedropper",
|
|
76
|
-
// "ext-grid",
|
|
77
|
-
// "ext-markers",
|
|
78
|
-
// "ext-overview_window",
|
|
79
|
-
// "ext-spi-library",
|
|
80
|
-
// "ext-spi-icon",
|
|
81
|
-
"ext-sp-zone",
|
|
82
|
-
// "ext-arrows",
|
|
83
|
-
// "ext-sp-css",
|
|
84
|
-
// "ext-placemark",
|
|
85
|
-
],
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
currentSpace: Space;
|
|
89
|
-
|
|
90
|
-
menuItems: MenuItem[] = [];
|
|
91
|
-
|
|
92
|
-
constructor(
|
|
93
|
-
private planService: PlanService,
|
|
94
|
-
private route: ActivatedRoute,
|
|
95
|
-
private router: Router,
|
|
96
|
-
private modalService: NgbModal,
|
|
97
|
-
private zoneService: ZoneService,
|
|
98
|
-
private visitService: VisitService,
|
|
99
|
-
private spaceService: SpaceService,
|
|
100
|
-
private translate: TranslateService,
|
|
101
|
-
private ngZone: NgZone,
|
|
102
|
-
) {
|
|
103
|
-
this.chosenPlan = this.planService.getChosenPlan();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
async ngOnInit() {
|
|
107
|
-
this.editorUrl = "/assets/editor/main.html";
|
|
108
|
-
this.spaceID = this.route.snapshot.queryParams.spaceID;
|
|
109
|
-
this.currentSpace = await this.spaceService.getSpace(this.spaceID);
|
|
110
|
-
this.setupMenuItems();
|
|
111
|
-
if (this.spaceID && !this.planService.getChosenPlan()) {
|
|
112
|
-
this.router.navigate([
|
|
113
|
-
"/dashboard/localisation",
|
|
114
|
-
this.spaceID,
|
|
115
|
-
"plans",
|
|
116
|
-
]);
|
|
117
|
-
} else if (!this.spaceID && !this.planService.getChosenPlan()) {
|
|
118
|
-
this.router.navigate(["/dashboard/localisation"]);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
setupMenuItems() {
|
|
123
|
-
this.menuItems = [
|
|
124
|
-
{ label: "Locations", url: "/localisation" },
|
|
125
|
-
{
|
|
126
|
-
label: this.currentSpace.name,
|
|
127
|
-
url: `/localisation/${this.spaceID}`,
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
label: "Plans",
|
|
131
|
-
url: `/localisation/${this.currentSpace.id}/plans`,
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
label: "Edit",
|
|
135
|
-
url: `/localisation/${this.currentSpace.id}/plan-edit?spaceID=${this.currentSpace.id}`,
|
|
136
|
-
},
|
|
137
|
-
];
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
@HostListener("window:message", ["$event"])
|
|
141
|
-
async switchAction(event) {
|
|
142
|
-
if (event.origin === window.location.origin) {
|
|
143
|
-
switch (event.data.message) {
|
|
144
|
-
case "save":
|
|
145
|
-
this.onSave(event.data.redirect);
|
|
146
|
-
break;
|
|
147
|
-
case "close":
|
|
148
|
-
this.onCancel();
|
|
149
|
-
break;
|
|
150
|
-
case "new-zone":
|
|
151
|
-
const modalReference = this.modalService.open(
|
|
152
|
-
this.loadingModal,
|
|
153
|
-
);
|
|
154
|
-
const svg = unescape(
|
|
155
|
-
encodeURIComponent(
|
|
156
|
-
this.svgEditor.svgCanvas.getSvgString(),
|
|
157
|
-
),
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
const base64 = `data:image/svg+xml;base64,${window.btoa(
|
|
161
|
-
svg,
|
|
162
|
-
)}`;
|
|
163
|
-
const currentSpace = await this.spaceService.getSpace(
|
|
164
|
-
this.spaceID,
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
this.images360 = await this.visitService.loadImagesForSpace(
|
|
168
|
-
currentSpace,
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
this.editedPlan = { ...this.chosenPlan };
|
|
172
|
-
this.editedPlan.filepath = base64;
|
|
173
|
-
this.newZoneData = event.data.zoneData;
|
|
174
|
-
if (this.newZoneData.elements.length === 0) {
|
|
175
|
-
modalReference.close();
|
|
176
|
-
alert(this.translate.instant("edition.no-zone"));
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
this.zones = await this.zoneService.getZonesBySpace(
|
|
180
|
-
this.spaceID,
|
|
181
|
-
);
|
|
182
|
-
// this.zones = sortAlphabeticallyOnName(this.zones);
|
|
183
|
-
// console.log("zones", this.zones);
|
|
184
|
-
// this.editedZone = this.zones.find(
|
|
185
|
-
// (z) => z.name === this.newZoneData.name,
|
|
186
|
-
// );
|
|
187
|
-
this.resetNavigations();
|
|
188
|
-
modalReference.close();
|
|
189
|
-
this.modalService.open(this.dialogZone);
|
|
190
|
-
|
|
191
|
-
break;
|
|
192
|
-
|
|
193
|
-
default:
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
async resetNavigations() {
|
|
200
|
-
this.navigations = [];
|
|
201
|
-
const defaultZone = this.zones.find((zone) => !zone.parentID);
|
|
202
|
-
if (defaultZone.sweepIDs.length > 0) {
|
|
203
|
-
this.navigations = defaultZone.sweepIDs;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
async onLoad(svgEditor) {
|
|
208
|
-
if (svgEditor.contentWindow.SvgEditor) {
|
|
209
|
-
this.svgEditorIframe = svgEditor;
|
|
210
|
-
this.svgEditor = new svgEditor.contentWindow.SvgEditor();
|
|
211
|
-
|
|
212
|
-
await this.svgEditor.init();
|
|
213
|
-
await this.svgEditor.setConfig(this.config, {
|
|
214
|
-
allowInitialUserOverride: true,
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
if (this.chosenPlan && this.chosenPlan.extension === "svg") {
|
|
218
|
-
this.loadSvg();
|
|
219
|
-
}
|
|
220
|
-
if (this.chosenPlan && this.chosenPlan.extension === "pdf") {
|
|
221
|
-
this.loadPdf();
|
|
222
|
-
}
|
|
223
|
-
if (!this.chosenPlan.calibration || !this.chosenPlan.isModified) {
|
|
224
|
-
setTimeout(() => {
|
|
225
|
-
this.svgEditorIframe.contentWindow.postMessage(
|
|
226
|
-
{ action: "disable-zone" },
|
|
227
|
-
"*",
|
|
228
|
-
);
|
|
229
|
-
}, 1000);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
this.svgEditor.svgCanvas.setMode('ext-panning');
|
|
233
|
-
this.svgEditor.bottomPanel.changeZoom(50)
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
async onSave(redirect: boolean) {
|
|
238
|
-
const imgBlob = await new Blob(
|
|
239
|
-
[this.svgEditor.svgCanvas.getSvgString()],
|
|
240
|
-
{
|
|
241
|
-
type: "image/svg+xml",
|
|
242
|
-
},
|
|
243
|
-
);
|
|
244
|
-
const [name] = this.chosenPlan.name.split(".");
|
|
245
|
-
const imgFile: File = new File([imgBlob], `${name}-edited.svg`, {
|
|
246
|
-
type: "image/svg+xml",
|
|
247
|
-
lastModified: Date.now(),
|
|
248
|
-
});
|
|
249
|
-
this.planService.setPlanFileCache(imgFile);
|
|
250
|
-
if (this.chosenPlan.isModified) {
|
|
251
|
-
this.ngZone.run(() =>
|
|
252
|
-
this.modalService.open(this.dialog));
|
|
253
|
-
} else {
|
|
254
|
-
this.ngZone.run(() =>
|
|
255
|
-
this.router.navigate([
|
|
256
|
-
"/dashboard/localisation",
|
|
257
|
-
this.spaceID,
|
|
258
|
-
"plans",
|
|
259
|
-
]));
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
async updateSvg() {
|
|
264
|
-
const newUrl = await this.planService.updatePlanFile();
|
|
265
|
-
await this.planService.updatePlan({
|
|
266
|
-
id: this.chosenPlan.id,
|
|
267
|
-
annexe: newUrl,
|
|
268
|
-
});
|
|
269
|
-
this.planService.setPlanFileCache(null);
|
|
270
|
-
this.ngZone.run(() =>
|
|
271
|
-
this.router.navigate([
|
|
272
|
-
"/dashboard/localisation",
|
|
273
|
-
this.spaceID,
|
|
274
|
-
"plans",
|
|
275
|
-
]));
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
async newSvg() {
|
|
279
|
-
this.ngZone.run(() =>
|
|
280
|
-
this.router.navigate([
|
|
281
|
-
"/dashboard/localisation",
|
|
282
|
-
this.spaceID,
|
|
283
|
-
"plans",
|
|
284
|
-
]));
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
async onCancel() {
|
|
288
|
-
if (window.confirm(this.translate.instant("edition.cancel-alert"))) {
|
|
289
|
-
this.ngZone.run(() =>
|
|
290
|
-
this.router.navigate([
|
|
291
|
-
"/dashboard/localisation",
|
|
292
|
-
this.spaceID,
|
|
293
|
-
"plans",
|
|
294
|
-
]));
|
|
295
|
-
alert(this.translate.instant("edition.cancel"));
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
async loadSvg() {
|
|
300
|
-
const svgRequest: any = await downloadFileAsObject(
|
|
301
|
-
this.chosenPlan.annexe,
|
|
302
|
-
);
|
|
303
|
-
if (svgRequest) {
|
|
304
|
-
const svgBlob = await svgRequest.Body;
|
|
305
|
-
const reader = new FileReader();
|
|
306
|
-
reader.onloadend = () => {
|
|
307
|
-
this.svgEditor.loadFromDataURI(reader.result);
|
|
308
|
-
};
|
|
309
|
-
reader.readAsDataURL(svgBlob);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
async loadPdf() {
|
|
314
|
-
this.svgEditorIframe.contentWindow.postMessage(
|
|
315
|
-
{ action: "disable-zone" },
|
|
316
|
-
"*",
|
|
317
|
-
);
|
|
318
|
-
const canvas = document.querySelector(
|
|
319
|
-
"#canvas4pdf",
|
|
320
|
-
) as HTMLCanvasElement;
|
|
321
|
-
const context = canvas.getContext("2d") as CanvasRenderingContext2D;
|
|
322
|
-
|
|
323
|
-
const pdfjs = await import("pdfjs-dist/build/pdf");
|
|
324
|
-
const pdfjsWorker = await import("pdfjs-dist/build/pdf.worker.entry");
|
|
325
|
-
|
|
326
|
-
pdfjs.GlobalWorkerOptions.workerSrc = pdfjsWorker;
|
|
327
|
-
|
|
328
|
-
const pdf: PDFDocumentProxy = await getDocument(
|
|
329
|
-
this.chosenPlan.filepath,
|
|
330
|
-
).promise;
|
|
331
|
-
const page = await pdf.getPage(1);
|
|
332
|
-
|
|
333
|
-
const viewPortParameters = { scale: 1.5 };
|
|
334
|
-
const viewport = page.getViewport(viewPortParameters);
|
|
335
|
-
this.svgEditor.svgCanvas.setResolution(viewport.width, viewport.height);
|
|
336
|
-
|
|
337
|
-
canvas.height = viewport.height;
|
|
338
|
-
canvas.width = viewport.width;
|
|
339
|
-
const renderContext = {
|
|
340
|
-
canvasContext: context,
|
|
341
|
-
viewport,
|
|
342
|
-
};
|
|
343
|
-
const renderTask = page.render(renderContext).promise;
|
|
344
|
-
renderTask.then(() => {
|
|
345
|
-
const newImage = this.svgEditor.svgCanvas.addSVGElementFromJson({
|
|
346
|
-
element: "image",
|
|
347
|
-
attr: {
|
|
348
|
-
x: 0,
|
|
349
|
-
y: 0,
|
|
350
|
-
width: viewport.width,
|
|
351
|
-
height: viewport.height,
|
|
352
|
-
id: this.svgEditor.svgCanvas.getNextId(),
|
|
353
|
-
style: "pointer-events:inherit",
|
|
354
|
-
},
|
|
355
|
-
});
|
|
356
|
-
this.svgEditor.svgCanvas.setHref(
|
|
357
|
-
newImage,
|
|
358
|
-
canvas.toDataURL("image/png"),
|
|
359
|
-
);
|
|
360
|
-
|
|
361
|
-
this.svgEditor.svgCanvas.renameCurrentLayer(this.translate.instant("edition.plan-base"));
|
|
362
|
-
this.svgEditor.svgCanvas.createLayer(this.translate.instant("edition.personalization"));
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
async onLoadImg(img: any) {
|
|
367
|
-
this.svgEditorIframe.contentWindow.postMessage(
|
|
368
|
-
{ action: "disable-zone" },
|
|
369
|
-
"*",
|
|
370
|
-
);
|
|
371
|
-
const imgRequest: any = await downloadFileAsObject(
|
|
372
|
-
this.chosenPlan.annexe,
|
|
373
|
-
);
|
|
374
|
-
if (imgRequest) {
|
|
375
|
-
const imgBlob = await imgRequest.Body;
|
|
376
|
-
const imgWidth = img.naturalWidth;
|
|
377
|
-
const imgHeight = img.naturalHeight;
|
|
378
|
-
// await this.svgEditor.setConfig({
|
|
379
|
-
// dimensions: [imgWidth, imgHeight],
|
|
380
|
-
// });
|
|
381
|
-
this.svgEditor.svgCanvas.setResolution(imgWidth, imgHeight);
|
|
382
|
-
|
|
383
|
-
const reader = new FileReader();
|
|
384
|
-
reader.onloadend = () => {
|
|
385
|
-
const newImage = this.svgEditor.svgCanvas.addSVGElementFromJson(
|
|
386
|
-
{
|
|
387
|
-
element: "image",
|
|
388
|
-
attr: {
|
|
389
|
-
x: 0,
|
|
390
|
-
y: 0,
|
|
391
|
-
width: imgWidth,
|
|
392
|
-
height: imgHeight,
|
|
393
|
-
id: this.svgEditor.svgCanvas.getNextId(),
|
|
394
|
-
style: "pointer-events:inherit",
|
|
395
|
-
},
|
|
396
|
-
},
|
|
397
|
-
);
|
|
398
|
-
this.svgEditor.svgCanvas.setHref(newImage, reader.result);
|
|
399
|
-
this.svgEditor.svgCanvas.renameCurrentLayer(this.translate.instant("edition.plan-base"));
|
|
400
|
-
this.svgEditor.svgCanvas.createLayer(this.translate.instant("edition.personalization"));
|
|
401
|
-
};
|
|
402
|
-
reader.readAsDataURL(imgBlob);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
onNewZone(event) {
|
|
407
|
-
this.isNewZone = false;
|
|
408
|
-
if (event) {
|
|
409
|
-
this.svgEditorIframe.contentWindow.postMessage(
|
|
410
|
-
{ action: "rename-layer", name: event },
|
|
411
|
-
"*",
|
|
412
|
-
);
|
|
413
|
-
} else {
|
|
414
|
-
this.svgEditorIframe.contentWindow.postMessage(
|
|
415
|
-
{ action: "cancel-layer" },
|
|
416
|
-
"*",
|
|
417
|
-
);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
<div class="container-fluid" *ngIf="currentSpace" class="dashboard-tab">
|
|
2
|
-
<div class="m-3">
|
|
3
|
-
<lib-tab-navigation [menuItems]='menuItems' (onGoBack)="onGoBack()"></lib-tab-navigation>
|
|
4
|
-
</div>
|
|
5
|
-
<div class="d-flex justify-content-center" *ngIf="loading">
|
|
6
|
-
<div class="spinner-border" role="status">
|
|
7
|
-
<span class="visually-hidden">Loading...</span>
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
<div class="mt-3" *ngIf="!plans && !loading">
|
|
11
|
-
<h4 style="font-weight: bold;">{{'No imported plans' | translate }}</h4>
|
|
12
|
-
<p>{{'For import from 3D visit: go Virtual Visits => Import Images' | translate}}</p>
|
|
13
|
-
</div>
|
|
14
|
-
<div class="row ms-1">
|
|
15
|
-
<div ngbDropdown class="d-inline-block me-3">
|
|
16
|
-
<button class="btn btn-label-file rounded-pill" id="dropdownBasic1" ngbDropdownToggle>{{getChoosenPlan() ?
|
|
17
|
-
getChoosenPlan().name: ('Choose Plan' | translate) }}</button>
|
|
18
|
-
<div ngbDropdownMenu aria-labelledby="dropdownBasic1">
|
|
19
|
-
<button ngbDropdownItem *ngFor="let plan of plans" (click)="onPlanClick(plan)">{{plan.name }}
|
|
20
|
-
</button>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
<div class="d-inline-block" ngbDropdown #myDrop="ngbDropdown">
|
|
24
|
-
<button class="btn btn-label-file rounded-pill" id="dropdownManual" ngbDropdownToggle>{{'Choose action' |
|
|
25
|
-
translate}}</button>
|
|
26
|
-
<div ngbDropdownMenu aria-labelledby="dropdownManual">
|
|
27
|
-
<button (click)="onCalibrateClick()" ngbDropdownItem [disabled]="!getChoosenPlan()">{{'Calibrate' |
|
|
28
|
-
translate}}</button>
|
|
29
|
-
<button (click)="onEditClick()" ngbDropdownItem [disabled]="!getChoosenPlan()">{{'Edit plan' |
|
|
30
|
-
translate}}
|
|
31
|
-
</button>
|
|
32
|
-
<button (click)="onUploadClick()" ngbDropdownItem>{{'Upload new plan' | translate}}</button>
|
|
33
|
-
<button (click)="onDownloadClick()" ngbDropdownItem [disabled]="!getChoosenPlan()">{{'Download plan' |
|
|
34
|
-
translate}}</button>
|
|
35
|
-
<button (click)="onRemoveClick()" ngbDropdownItem
|
|
36
|
-
[disabled]="!getChoosenPlan() || getChoosenPlan().isImportedMatterport">{{'Delete plan' |
|
|
37
|
-
translate}}</button>
|
|
38
|
-
<!-- <button (click)="onDownloadAsPng()" ngbDropdownItem [disabled]="!getChoosenPlan()">
|
|
39
|
-
{{'Download plan as PNG' | translate}}</button> -->
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
<div class="row mt-3 ms-0">
|
|
44
|
-
<h4 *ngIf="fileToUpload">{{'New plan' | translate }}</h4>
|
|
45
|
-
<input class="hidden" type="file" id="upload-file" name="upload-file" accept="image/png, image/jpeg, .pdf, .svg"
|
|
46
|
-
ngf-max-size="6MB" (change)="addPlan($event.target)">
|
|
47
|
-
</div>
|
|
48
|
-
<div class="col-md-6 mt-3" *ngIf="planForm">
|
|
49
|
-
<form (ngSubmit)="onSavePlan()" [formGroup]="planForm">
|
|
50
|
-
<div class="mb-3 row">
|
|
51
|
-
<label class="col-sm-3">{{'Name' | translate}} </label>
|
|
52
|
-
<div class="col-sm-9">
|
|
53
|
-
<input type="text" class="form-control" formControlName="name">
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
<div class="mb-3 row">
|
|
57
|
-
<label class="col-sm-3">{{'Zone' | translate}} </label>
|
|
58
|
-
<div class="col-sm-9">
|
|
59
|
-
<select class="form-control" formControlName="zoneID">
|
|
60
|
-
<option *ngFor="let zone of zones" [ngValue]="zone.id">
|
|
61
|
-
{{ zone.name }}
|
|
62
|
-
</option>
|
|
63
|
-
</select>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
<div class="mb-3 row">
|
|
67
|
-
<label class="col-sm-3">{{'Set as current plan for zone' | translate}}</label>
|
|
68
|
-
<div class="col-sm-3">
|
|
69
|
-
<input type="checkbox" [(ngModel)]="isCurrentPlanForZone" [ngModelOptions]="{standalone: true}">
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
72
|
-
<button [disabled]="planForm.invalid" type='submit' class="btn btn-label-file rounded-pill">{{'Save' |
|
|
73
|
-
translate}}</button>
|
|
74
|
-
<button class="btn btn-label-file rounded-pill ms-3" type="button" (click)="onCancelUpload()">{{'Cancel' |
|
|
75
|
-
translate}}</button>
|
|
76
|
-
</form>
|
|
77
|
-
</div>
|
|
78
|
-
<ul class="col-md-6 list-group list-group-flush" *ngIf="getChoosenPlan()">
|
|
79
|
-
<li class="list-group-item bg-transparent">{{'Name' | translate }} : {{getChoosenPlan().name}} </li>
|
|
80
|
-
<li class="list-group-item bg-transparent"> {{'Plan is ' | translate }} :
|
|
81
|
-
{{getChoosenPlan().calibration ? ('Calibrated' | translate) : ('Not calibrated' | translate)}}</li>
|
|
82
|
-
<li class="list-group-item bg-transparent">{{'Attributed to zone ' | translate }} :
|
|
83
|
-
{{getChoosenPlan().zone ? getChoosenPlan().zone.name : 'None'}}</li>
|
|
84
|
-
<li class="list-group-item bg-transparent">{{'Is current plan for zone ' | translate }} :
|
|
85
|
-
<input type="checkbox" [(ngModel)]="getChoosenPlan().isCurrentForZone" (change)="onCurrentPlanClick()">
|
|
86
|
-
</li>
|
|
87
|
-
|
|
88
|
-
</ul>
|
|
89
|
-
|
|
90
|
-
<div class="row mt-4">
|
|
91
|
-
<div class="col-md-10">
|
|
92
|
-
<embed *ngIf="getChoosenPlan() && chosenPlanIsPdf" [src]="getChoosenPlan().filepath | safeUrl"
|
|
93
|
-
type="application/pdf" frameBorder="0" scrolling="auto" height="650px;" width="100%" />
|
|
94
|
-
<div *ngIf="!chosenPlanIsPdf" class="row" style="height: 500px; overflow: hidden;" id="canvasDiv">
|
|
95
|
-
<canvas id="canvas" width="4096px" height="4096px">
|
|
96
|
-
<!-- <img *ngIf="chosenPlan" id="plan-image" [src]="chosenPlan.filepath" style="width: 100%;"> -->
|
|
97
|
-
</canvas>
|
|
98
|
-
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
.button-visit {
|
|
2
|
-
display: none;
|
|
3
|
-
height: 30px;
|
|
4
|
-
width: 30px;
|
|
5
|
-
position: absolute;
|
|
6
|
-
background: url('https://api.iconify.design/mdi:map-marker-check.svg?color=red&height=30') no-repeat scroll 0 0 transparent;
|
|
7
|
-
border: none;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
#button-visit-left {
|
|
11
|
-
left: 350px;
|
|
12
|
-
top: 550px;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
#button-visit-right {
|
|
16
|
-
left: 500px;
|
|
17
|
-
top: 600px;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.hidden {
|
|
21
|
-
visibility: hidden;
|
|
22
|
-
width: 1px;
|
|
23
|
-
height: 1px;
|
|
24
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { PlansComponent } from './plans.component';
|
|
4
|
-
|
|
5
|
-
describe('PlansComponent', () => {
|
|
6
|
-
let component: PlansComponent;
|
|
7
|
-
let fixture: ComponentFixture<PlansComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [ PlansComponent ]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(PlansComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|