ember-ebau-gwr 2.7.1 → 3.0.0
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/CHANGELOG.md +39 -0
- package/addon/components/import-modal/building-data.hbs +64 -0
- package/addon/components/import-modal/dwelling-data.hbs +30 -0
- package/addon/components/import-modal/entrance-data.hbs +14 -0
- package/addon/components/import-modal.hbs +54 -0
- package/addon/components/import-modal.js +6 -0
- package/addon/components/link-building-modal.hbs +1 -1
- package/addon/components/link-building-modal.js +2 -0
- package/addon/components/link-street.hbs +83 -0
- package/addon/components/link-street.js +6 -0
- package/addon/components/linked-models.hbs +1 -1
- package/addon/components/linked-models.js +6 -0
- package/addon/components/linked-projects.hbs +1 -1
- package/addon/components/linked-projects.js +6 -0
- package/addon/components/model-form/date.hbs +1 -0
- package/addon/components/model-form/date.js +6 -6
- package/addon/components/model-form/diff.hbs +40 -27
- package/addon/components/model-form/field.hbs +13 -8
- package/addon/components/model-form/field.js +27 -8
- package/addon/components/model-form/header/actions.hbs +65 -33
- package/addon/components/model-form/header/actions.js +6 -0
- package/addon/components/model-form/header.hbs +4 -2
- package/addon/components/model-form.hbs +6 -5
- package/addon/components/model-form.js +17 -5
- package/addon/components/project-form/date.hbs +1 -1
- package/addon/components/project-form/field.hbs +1 -1
- package/addon/components/project-form/field.js +1 -1
- package/addon/controllers/building/edit/dwelling/edit.js +11 -2
- package/addon/controllers/building/edit/entrance/edit/index.js +12 -2
- package/addon/controllers/building/edit/entrance/edit/link-street.js +30 -6
- package/addon/controllers/building/edit/entrances.js +18 -2
- package/addon/controllers/building/edit/form.js +23 -11
- package/addon/controllers/import.js +70 -0
- package/addon/controllers/project/form.js +6 -13
- package/addon/controllers/project.js +1 -0
- package/addon/helpers/is-unset.js +7 -0
- package/addon/models/building-entrance.js +4 -3
- package/addon/models/building.js +73 -74
- package/addon/models/client.js +1 -1
- package/addon/models/construction-project.js +8 -8
- package/addon/models/identification.js +2 -1
- package/addon/routes/building/edit/entrance/edit/index.js +3 -1
- package/addon/routes/building/edit/entrance/edit/link-street.js +8 -1
- package/addon/routes/building/edit/index.js +13 -1
- package/addon/routes/building/new.js +19 -0
- package/addon/routes/project/form.js +5 -0
- package/addon/routes/project/new.js +3 -2
- package/addon/services/building-entrance.js +1 -1
- package/addon/services/building.js +6 -0
- package/addon/services/construction-project.js +0 -6
- package/addon/services/gwr.js +4 -2
- package/addon/templates/building/edit/dwelling/edit.hbs +1 -0
- package/addon/templates/building/edit/entrance/edit/index.hbs +7 -60
- package/addon/templates/building/edit/entrance/edit/link-street.hbs +9 -4
- package/addon/templates/building/edit/entrances.hbs +6 -3
- package/addon/templates/building/edit/form.hbs +40 -3
- package/addon/templates/project/form.hbs +20 -20
- package/addon/templates/project.hbs +3 -3
- package/addon/validations/building-entrance.js +5 -0
- package/addon/validations/building-work.js +30 -10
- package/addon/validations/realestate-identification.js +1 -1
- package/addon/validations/status/status-project-change.js +1 -1
- package/addon/validations/status/status-project-correction.js +1 -1
- package/addon/xml/templates/construction-project.js +1 -2
- package/app/styles/ember-ebau-gwr.scss +24 -5
- package/package.json +1 -1
- package/translations/building/de.yaml +7 -0
- package/translations/building-entrance/de.yaml +2 -10
- package/translations/construction-project/de.yaml +1 -1
- package/translations/de.yaml +18 -3
- package/translations/dwelling/de.yaml +3 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import Controller from "@ember/controller";
|
|
2
1
|
import { action } from "@ember/object";
|
|
3
2
|
import { inject as service } from "@ember/service";
|
|
4
3
|
import { tracked } from "@glimmer/tracking";
|
|
5
4
|
import { task, dropTask, lastValue } from "ember-concurrency-decorators";
|
|
5
|
+
import ImportController from "ember-ebau-gwr/controllers/import";
|
|
6
6
|
import BuildingWork from "ember-ebau-gwr/models/building-work";
|
|
7
7
|
import ConstructionProject from "ember-ebau-gwr/models/construction-project";
|
|
8
8
|
import Options from "ember-ebau-gwr/models/options";
|
|
9
9
|
import ConstructionProjectValidations from "ember-ebau-gwr/validations/construction-project";
|
|
10
10
|
|
|
11
|
-
export default class ProjectFormController extends
|
|
12
|
-
|
|
11
|
+
export default class ProjectFormController extends ImportController {
|
|
12
|
+
importModelName = "project";
|
|
13
13
|
ConstructionProjectValidations = ConstructionProjectValidations;
|
|
14
14
|
kindOfWorkOptions = BuildingWork.kindOfWorkOptions;
|
|
15
15
|
|
|
@@ -17,13 +17,11 @@ export default class ProjectFormController extends Controller {
|
|
|
17
17
|
@service building;
|
|
18
18
|
@service dwelling;
|
|
19
19
|
@service config;
|
|
20
|
-
@service dataImport;
|
|
21
20
|
@service store;
|
|
22
21
|
@service router;
|
|
23
22
|
@service intl;
|
|
24
23
|
@service notification;
|
|
25
24
|
|
|
26
|
-
@tracked import = false;
|
|
27
25
|
@tracked buildingWork;
|
|
28
26
|
@tracked typeOfConstructionProject;
|
|
29
27
|
@tracked removedWork = [];
|
|
@@ -46,6 +44,7 @@ export default class ProjectFormController extends Controller {
|
|
|
46
44
|
@lastValue("fetchProject") project;
|
|
47
45
|
@task
|
|
48
46
|
*fetchProject() {
|
|
47
|
+
yield this.fetchCalumaData.perform();
|
|
49
48
|
// Add a new default work for new projects so we don't have to
|
|
50
49
|
// validate if the user has attached a work or not.
|
|
51
50
|
if (this.model.project?.isNew && !this.model.project?.work.length) {
|
|
@@ -60,15 +59,9 @@ export default class ProjectFormController extends Controller {
|
|
|
60
59
|
return project;
|
|
61
60
|
}
|
|
62
61
|
|
|
63
|
-
@lastValue("fetchCalumaData") importData;
|
|
64
|
-
@task
|
|
65
|
-
*fetchCalumaData() {
|
|
66
|
-
return yield this.dataImport.fetchProject(this.model.instanceId);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
62
|
@action
|
|
70
63
|
cancelMerge() {
|
|
71
|
-
this.
|
|
64
|
+
this.resetImport();
|
|
72
65
|
this.fetchProject.perform();
|
|
73
66
|
}
|
|
74
67
|
|
|
@@ -122,7 +115,7 @@ export default class ProjectFormController extends Controller {
|
|
|
122
115
|
yield this.constructionProject.update(this.project);
|
|
123
116
|
}
|
|
124
117
|
|
|
125
|
-
this.
|
|
118
|
+
this.resetImport();
|
|
126
119
|
this.errors = [];
|
|
127
120
|
this.notification.success(
|
|
128
121
|
this.intl.t("ember-gwr.constructionProject.saveSuccess")
|
|
@@ -55,9 +55,7 @@ export default class BuildingEntrance extends XMLModel {
|
|
|
55
55
|
|
|
56
56
|
static template = `
|
|
57
57
|
{{#if model.isNew}}
|
|
58
|
-
{{
|
|
59
|
-
<ns2:buildingEntranceNo>{{model.buildingEntranceNo}}</ns2:buildingEntranceNo>
|
|
60
|
-
{{/if}}
|
|
58
|
+
{{{modelField model "buildingEntranceNo"}}}
|
|
61
59
|
<ns2:isOfficialAddress>{{model.isOfficialAddress}}</ns2:isOfficialAddress>
|
|
62
60
|
{{> Street model=model.street}}
|
|
63
61
|
{{> Locality model=model.locality}}
|
|
@@ -71,4 +69,7 @@ export default class BuildingEntrance extends XMLModel {
|
|
|
71
69
|
</ns2:buildingEntrance>
|
|
72
70
|
{{/if}}
|
|
73
71
|
`;
|
|
72
|
+
|
|
73
|
+
static DEACTIVATION_ERROR =
|
|
74
|
+
"Cannot deactivate an entrance while active dwellings are still linked to it";
|
|
74
75
|
}
|
package/addon/models/building.js
CHANGED
|
@@ -10,73 +10,6 @@ import ThermotechnicalDeviceForHeating from "./thermotechnical-device-for-heatin
|
|
|
10
10
|
import ThermotechnicalDeviceForWarmWater from "./thermotechnical-device-for-warm-water";
|
|
11
11
|
import XMLModel from "./xml-model";
|
|
12
12
|
|
|
13
|
-
export class Volume extends XMLModel {
|
|
14
|
-
@tracked volume;
|
|
15
|
-
@tracked informationSource;
|
|
16
|
-
@tracked norm;
|
|
17
|
-
|
|
18
|
-
constructor(xmlOrObject, root = "volume") {
|
|
19
|
-
super(xmlOrObject);
|
|
20
|
-
this.setFieldsFromXML({
|
|
21
|
-
root,
|
|
22
|
-
fields: {
|
|
23
|
-
volume: Number,
|
|
24
|
-
informationSource: Number,
|
|
25
|
-
norm: Number,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static template = `
|
|
31
|
-
<ns2:volume>
|
|
32
|
-
<volume>{{model.volume}}</volume>
|
|
33
|
-
{{#if model.informationSource}}
|
|
34
|
-
<informationSource>{{model.informationSource}}</informationSource>
|
|
35
|
-
{{/if}}
|
|
36
|
-
<norm>{{model.norm}}</norm>
|
|
37
|
-
</ns2:volume>
|
|
38
|
-
`;
|
|
39
|
-
|
|
40
|
-
static informationSourceOptions = [
|
|
41
|
-
869, // Gemäss Baubewilligung
|
|
42
|
-
858, // Gemäss Gebäudeenergieausweis der Kantone (GEAK)
|
|
43
|
-
853, // Gemäss Gebäudeversicherung
|
|
44
|
-
852, // Gemäss amtlicher Schätzung
|
|
45
|
-
857, // Gemäss Eigentümer / Immobilienverwaltung
|
|
46
|
-
851, // Gemäss amtlicher Vermessung
|
|
47
|
-
870, // Gemäss topografisches Landschaft Modell (TLM)
|
|
48
|
-
878, // Nicht bestimmbares Volumen (Gebäude nicht geschlossen)
|
|
49
|
-
859, // Andere
|
|
50
|
-
];
|
|
51
|
-
|
|
52
|
-
static normOptions = [
|
|
53
|
-
961, // Gemäss SIA-Norm 116
|
|
54
|
-
962, // Gemäss SIA-Norm 416
|
|
55
|
-
969, // unbekannt
|
|
56
|
-
];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
class ThermotechnicalDeviceForHeating1 extends ThermotechnicalDeviceForHeating {
|
|
60
|
-
constructor(xmlOrObject, root = "thermotechnicalDeviceForHeating1") {
|
|
61
|
-
super(xmlOrObject, root);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
class ThermotechnicalDeviceForHeating2 extends ThermotechnicalDeviceForHeating {
|
|
65
|
-
constructor(xmlOrObject, root = "thermotechnicalDeviceForHeating2") {
|
|
66
|
-
super(xmlOrObject, root);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
class ThermotechnicalDeviceForWarmWater1 extends ThermotechnicalDeviceForWarmWater {
|
|
70
|
-
constructor(xmlOrObject, root = "thermotechnicalDeviceForWarmWater1") {
|
|
71
|
-
super(xmlOrObject, root);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
class ThermotechnicalDeviceForWarmWater2 extends ThermotechnicalDeviceForWarmWater {
|
|
75
|
-
constructor(xmlOrObject, root = "thermotechnicalDeviceForWarmWater2") {
|
|
76
|
-
super(xmlOrObject, root);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
13
|
export default class Building extends XMLModel {
|
|
81
14
|
@tracked EGID;
|
|
82
15
|
@tracked municipality;
|
|
@@ -217,7 +150,7 @@ export default class Building extends XMLModel {
|
|
|
217
150
|
<ns2:numberOfSeparateHabitableRooms>{{model.numberOfSeparateHabitableRooms}}</ns2:numberOfSeparateHabitableRooms>
|
|
218
151
|
{{/if}}
|
|
219
152
|
{{! Returns no error but not saved by api}}
|
|
220
|
-
|
|
153
|
+
{{{modelField model "civilDefenseShelter"}}}
|
|
221
154
|
{{#if model.energyRelevantSurface}}
|
|
222
155
|
<ns2:energyRelevantSurface>{{model.energyRelevantSurface}}</ns2:energyRelevantSurface>
|
|
223
156
|
{{/if}}
|
|
@@ -235,13 +168,12 @@ export default class Building extends XMLModel {
|
|
|
235
168
|
{{/if}}
|
|
236
169
|
|
|
237
170
|
{{#if model.isNew}}
|
|
171
|
+
{{!--The default building entrance on a new building is stored as a single
|
|
172
|
+
element to facilitate form validation--}}
|
|
173
|
+
{{!--After building creation the building entrances are stored in an
|
|
174
|
+
array on the building and handled through building entrance API requests--}}
|
|
238
175
|
<ns2:buildingEntrance>
|
|
239
|
-
|
|
240
|
-
<ns2:locality>
|
|
241
|
-
<ns2:name>
|
|
242
|
-
<ns2:nameLong>{{model.municipalityName}}</ns2:nameLong>
|
|
243
|
-
</ns2:name>
|
|
244
|
-
</ns2:locality>
|
|
176
|
+
{{> BuildingEntrance model=model.buildingEntrance}}
|
|
245
177
|
</ns2:buildingEntrance>
|
|
246
178
|
{{/if}}
|
|
247
179
|
</ns2:building>
|
|
@@ -417,3 +349,70 @@ export default class Building extends XMLModel {
|
|
|
417
349
|
[this.STATUS_NOT_REALIZED]: {},
|
|
418
350
|
};
|
|
419
351
|
}
|
|
352
|
+
|
|
353
|
+
export class Volume extends XMLModel {
|
|
354
|
+
@tracked volume;
|
|
355
|
+
@tracked informationSource;
|
|
356
|
+
@tracked norm;
|
|
357
|
+
|
|
358
|
+
constructor(xmlOrObject, root = "volume") {
|
|
359
|
+
super(xmlOrObject);
|
|
360
|
+
this.setFieldsFromXML({
|
|
361
|
+
root,
|
|
362
|
+
fields: {
|
|
363
|
+
volume: Number,
|
|
364
|
+
informationSource: Number,
|
|
365
|
+
norm: Number,
|
|
366
|
+
},
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
static template = `
|
|
371
|
+
<ns2:volume>
|
|
372
|
+
<volume>{{model.volume}}</volume>
|
|
373
|
+
{{#if model.informationSource}}
|
|
374
|
+
<informationSource>{{model.informationSource}}</informationSource>
|
|
375
|
+
{{/if}}
|
|
376
|
+
<norm>{{model.norm}}</norm>
|
|
377
|
+
</ns2:volume>
|
|
378
|
+
`;
|
|
379
|
+
|
|
380
|
+
static informationSourceOptions = [
|
|
381
|
+
869, // Gemäss Baubewilligung
|
|
382
|
+
858, // Gemäss Gebäudeenergieausweis der Kantone (GEAK)
|
|
383
|
+
853, // Gemäss Gebäudeversicherung
|
|
384
|
+
852, // Gemäss amtlicher Schätzung
|
|
385
|
+
857, // Gemäss Eigentümer / Immobilienverwaltung
|
|
386
|
+
851, // Gemäss amtlicher Vermessung
|
|
387
|
+
870, // Gemäss topografisches Landschaft Modell (TLM)
|
|
388
|
+
878, // Nicht bestimmbares Volumen (Gebäude nicht geschlossen)
|
|
389
|
+
859, // Andere
|
|
390
|
+
];
|
|
391
|
+
|
|
392
|
+
static normOptions = [
|
|
393
|
+
961, // Gemäss SIA-Norm 116
|
|
394
|
+
962, // Gemäss SIA-Norm 416
|
|
395
|
+
969, // unbekannt
|
|
396
|
+
];
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
class ThermotechnicalDeviceForHeating1 extends ThermotechnicalDeviceForHeating {
|
|
400
|
+
constructor(xmlOrObject, root = "thermotechnicalDeviceForHeating1") {
|
|
401
|
+
super(xmlOrObject, root);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
class ThermotechnicalDeviceForHeating2 extends ThermotechnicalDeviceForHeating {
|
|
405
|
+
constructor(xmlOrObject, root = "thermotechnicalDeviceForHeating2") {
|
|
406
|
+
super(xmlOrObject, root);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
class ThermotechnicalDeviceForWarmWater1 extends ThermotechnicalDeviceForWarmWater {
|
|
410
|
+
constructor(xmlOrObject, root = "thermotechnicalDeviceForWarmWater1") {
|
|
411
|
+
super(xmlOrObject, root);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
class ThermotechnicalDeviceForWarmWater2 extends ThermotechnicalDeviceForWarmWater {
|
|
415
|
+
constructor(xmlOrObject, root = "thermotechnicalDeviceForWarmWater2") {
|
|
416
|
+
super(xmlOrObject, root);
|
|
417
|
+
}
|
|
418
|
+
}
|
package/addon/models/client.js
CHANGED
|
@@ -26,7 +26,7 @@ export default class Client extends XMLModel {
|
|
|
26
26
|
)
|
|
27
27
|
}}
|
|
28
28
|
<ns2:client>
|
|
29
|
-
{{> Identification model=model.identification}}
|
|
29
|
+
{{> Identification model=model.identification typeOfClient=typeOfClient}}
|
|
30
30
|
{{> Address model=model.address}}
|
|
31
31
|
</ns2:client>
|
|
32
32
|
{{/if}}
|
|
@@ -27,7 +27,7 @@ export default class ConstructionProject extends XMLModel {
|
|
|
27
27
|
@tracked projectStartDate;
|
|
28
28
|
@tracked durationOfConstructionPhase;
|
|
29
29
|
@tracked constructionAuthorisationDeniedDate;
|
|
30
|
-
@tracked
|
|
30
|
+
@tracked cancellationDate;
|
|
31
31
|
@tracked projectCompletionDate;
|
|
32
32
|
@tracked projectSuspensionDate;
|
|
33
33
|
@tracked buildingPermitIssueDate;
|
|
@@ -60,7 +60,7 @@ export default class ConstructionProject extends XMLModel {
|
|
|
60
60
|
projectStartDate: String,
|
|
61
61
|
durationOfConstructionPhase: Number,
|
|
62
62
|
constructionAuthorisationDeniedDate: String,
|
|
63
|
-
|
|
63
|
+
cancellationDate: String,
|
|
64
64
|
projectCompletionDate: String,
|
|
65
65
|
projectSuspensionDate: String,
|
|
66
66
|
buildingPermitIssueDate: String,
|
|
@@ -96,7 +96,7 @@ export default class ConstructionProject extends XMLModel {
|
|
|
96
96
|
? this.STATUS_COMPLETED
|
|
97
97
|
: this.withdrawalDate
|
|
98
98
|
? this.STATUS_WITHDRAWN
|
|
99
|
-
: this.
|
|
99
|
+
: this.cancellationDate
|
|
100
100
|
? this.STATUS_NOT_REALIZED
|
|
101
101
|
: this.constructionAuthorisationDeniedDate
|
|
102
102
|
? this.STATUS_REFUSED
|
|
@@ -122,7 +122,7 @@ export default class ConstructionProject extends XMLModel {
|
|
|
122
122
|
<ns2:typeOfPermit>{{model.typeOfPermit}}</ns2:typeOfPermit>
|
|
123
123
|
<ns2:typeOfClient>{{model.typeOfClient}}</ns2:typeOfClient>
|
|
124
124
|
{{! this is accepted by the api but in the response the field is missing. Is this intended?}}
|
|
125
|
-
{{> Client model=model.client}}
|
|
125
|
+
{{> Client model=model.client typeOfClient=model.typeOfClient}}
|
|
126
126
|
<ns2:typeOfConstructionProject>{{model.typeOfConstructionProject}}</ns2:typeOfConstructionProject>
|
|
127
127
|
<ns2:typeOfConstruction>{{model.typeOfConstruction}}</ns2:typeOfConstruction>
|
|
128
128
|
<ns2:totalCostsOfProject>{{model.totalCostsOfProject}}</ns2:totalCostsOfProject>
|
|
@@ -141,7 +141,7 @@ export default class ConstructionProject extends XMLModel {
|
|
|
141
141
|
|
|
142
142
|
{{! this is accepted by the api but in the response the field is missing. Is this intended?}}
|
|
143
143
|
{{{modelField model "withdrawalDate" value=(echDate model.withdrawalDate)}}}
|
|
144
|
-
{{{modelField model "cancellationDate" value=(echDate model.
|
|
144
|
+
{{{modelField model "cancellationDate" value=(echDate model.cancellationDate)}}}
|
|
145
145
|
{{{modelField model "durationOfConstructionPhase"}}}
|
|
146
146
|
{{/unless}}
|
|
147
147
|
|
|
@@ -254,7 +254,7 @@ export default class ConstructionProject extends XMLModel {
|
|
|
254
254
|
{ field: "withdrawalDate", type: "date", required: true },
|
|
255
255
|
],
|
|
256
256
|
setToCancelledConstructionProject: [
|
|
257
|
-
{ field: "
|
|
257
|
+
{ field: "cancellationDate", type: "date", required: true },
|
|
258
258
|
],
|
|
259
259
|
setToSuspendedConstructionProject: [
|
|
260
260
|
{ field: "projectSuspensionDate", type: "date", required: true },
|
|
@@ -288,7 +288,7 @@ export default class ConstructionProject extends XMLModel {
|
|
|
288
288
|
"projectCompletionDate",
|
|
289
289
|
"projectSuspensionDate",
|
|
290
290
|
"constructionAuthorisationDeniedDate",
|
|
291
|
-
"
|
|
291
|
+
"cancellationDate",
|
|
292
292
|
"withdrawalDate",
|
|
293
293
|
];
|
|
294
294
|
|
|
@@ -363,7 +363,7 @@ export default class ConstructionProject extends XMLModel {
|
|
|
363
363
|
[this.STATUS_NOT_REALIZED]: [
|
|
364
364
|
{ field: "projectAnnouncementDate", type: "date", required: true },
|
|
365
365
|
{ field: "buildingPermitIssueDate", type: "date", required: false },
|
|
366
|
-
{ field: "
|
|
366
|
+
{ field: "cancellationDate", type: "date", required: true },
|
|
367
367
|
],
|
|
368
368
|
[this.STATUS_WITHDRAWN]: [
|
|
369
369
|
{ field: "projectAnnouncementDate", type: "date", required: true },
|
|
@@ -14,13 +14,14 @@ export default class Identification extends XMLModel {
|
|
|
14
14
|
root,
|
|
15
15
|
fields: {
|
|
16
16
|
personIdentification: PersonIdentification,
|
|
17
|
+
organisationIdentification: OrganisationIdentification,
|
|
17
18
|
},
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
static template = `
|
|
22
23
|
<identification>
|
|
23
|
-
{{#if (eq
|
|
24
|
+
{{#if (eq typeOfClient 6161)}}
|
|
24
25
|
{{> PersonIdentification model=model.personIdentification}}
|
|
25
26
|
{{else}}
|
|
26
27
|
{{> OrganisationIdentification model=model.organisationIdentification}}
|
|
@@ -5,7 +5,9 @@ export default class BuildingEditEntranceEditIndexRoute extends Route {
|
|
|
5
5
|
@service buildingEntrance;
|
|
6
6
|
|
|
7
7
|
model() {
|
|
8
|
-
// reset the newRecord
|
|
8
|
+
// reset the newRecord if building entrance already exists
|
|
9
|
+
// should be done in model hook, beforeModel causes reset of
|
|
10
|
+
// changeset on every route entry (also on new route)
|
|
9
11
|
this.buildingEntrance.newRecord = null;
|
|
10
12
|
return this.modelFor("building.edit.entrance.edit");
|
|
11
13
|
}
|
|
@@ -3,13 +3,20 @@ import { inject as service } from "@ember/service";
|
|
|
3
3
|
|
|
4
4
|
export default class BuildingEditEntranceLinkStreetRoute extends Route {
|
|
5
5
|
@service buildingEntrance;
|
|
6
|
+
@service building;
|
|
6
7
|
|
|
7
8
|
model() {
|
|
8
9
|
return this.modelFor("building.edit.entrance.edit");
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
afterModel(model) {
|
|
12
|
-
if (model.
|
|
13
|
+
if (model.buildingId === "new" && !this.building.newRecord) {
|
|
14
|
+
this.transitionTo("building.new");
|
|
15
|
+
} else if (
|
|
16
|
+
model.entranceId === "new" &&
|
|
17
|
+
model.buildingId !== "new" &&
|
|
18
|
+
!this.buildingEntrance.newRecord
|
|
19
|
+
) {
|
|
13
20
|
this.transitionTo("building.edit.entrance.new");
|
|
14
21
|
}
|
|
15
22
|
}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
import Route from "@ember/routing/route";
|
|
2
|
+
import { inject as service } from "@ember/service";
|
|
2
3
|
|
|
3
|
-
export default class BuildingEditIndexRoute extends Route {
|
|
4
|
+
export default class BuildingEditIndexRoute extends Route {
|
|
5
|
+
@service building;
|
|
6
|
+
|
|
7
|
+
beforeModel() {
|
|
8
|
+
// reset the newRecord
|
|
9
|
+
this.building.newRecord = null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
model() {
|
|
13
|
+
return this.modelFor("building.edit");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { inject as service } from "@ember/service";
|
|
2
|
+
import Changeset from "ember-changeset";
|
|
3
|
+
import lookupValidator from "ember-changeset-validations";
|
|
4
|
+
import BuildingEntrance from "ember-ebau-gwr/models/building-entrance";
|
|
2
5
|
import BuildingWork from "ember-ebau-gwr/models/building-work";
|
|
3
6
|
import municipalities from "ember-ebau-gwr/models/municipalities";
|
|
7
|
+
import { buildingWorkValidation } from "ember-ebau-gwr/validations/building-work";
|
|
4
8
|
|
|
5
9
|
import BuildingFormRoute from "./edit/form";
|
|
6
10
|
|
|
@@ -10,6 +14,7 @@ const WORK_NEW = 6001;
|
|
|
10
14
|
export default class BuildingNewRoute extends BuildingFormRoute {
|
|
11
15
|
@service building;
|
|
12
16
|
@service config;
|
|
17
|
+
@service intl;
|
|
13
18
|
|
|
14
19
|
templateName = "building.edit.form";
|
|
15
20
|
controllerName = "building.edit.form";
|
|
@@ -25,6 +30,20 @@ export default class BuildingNewRoute extends BuildingFormRoute {
|
|
|
25
30
|
buildingWork.building.buildingStatus = STATUS_PROJECTED;
|
|
26
31
|
buildingWork.kindOfWork = WORK_NEW;
|
|
27
32
|
|
|
33
|
+
// Generate a editable first building entrance for new buildings
|
|
34
|
+
// to prevent having to generate a dummy entrance
|
|
35
|
+
buildingWork.building.buildingEntrance = new BuildingEntrance();
|
|
36
|
+
|
|
37
|
+
// Reuse changeset if already exists, otherwise changes on building
|
|
38
|
+
// are lost after setting street
|
|
39
|
+
if (!this.building.newRecord) {
|
|
40
|
+
this.building.newRecord = new Changeset(
|
|
41
|
+
buildingWork,
|
|
42
|
+
lookupValidator(buildingWorkValidation(true)),
|
|
43
|
+
buildingWorkValidation(true)
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
28
47
|
model.buildingWork = buildingWork;
|
|
29
48
|
return model;
|
|
30
49
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import Route from "@ember/routing/route";
|
|
2
1
|
import { inject as service } from "@ember/service";
|
|
3
2
|
import ConstructionProject from "ember-ebau-gwr/models/construction-project";
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
import FormRoute from "./form";
|
|
5
|
+
|
|
6
|
+
export default class ProjectNewRoute extends FormRoute {
|
|
6
7
|
@service constructionProject;
|
|
7
8
|
@service config;
|
|
8
9
|
|
|
@@ -97,7 +97,7 @@ export default class BuildingEntranceService extends GwrService {
|
|
|
97
97
|
);
|
|
98
98
|
if (!response.ok) {
|
|
99
99
|
const xmlErrors = await response.text();
|
|
100
|
-
const errors = this.extractErrorsFromXML(xmlErrors);
|
|
100
|
+
const errors = this.extractErrorsFromXML(xmlErrors, false);
|
|
101
101
|
|
|
102
102
|
console.error("GWR API: deactivateBuildingEntrance failed");
|
|
103
103
|
throw errors;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { inject as service } from "@ember/service";
|
|
2
|
+
import { tracked } from "@glimmer/tracking";
|
|
2
3
|
import Building from "ember-ebau-gwr/models/building";
|
|
3
4
|
import BuildingsList from "ember-ebau-gwr/models/buildings-list";
|
|
4
5
|
import Dwelling from "ember-ebau-gwr/models/dwelling";
|
|
@@ -11,6 +12,7 @@ export default class BuildingService extends GwrService {
|
|
|
11
12
|
|
|
12
13
|
cacheKey = "EGID";
|
|
13
14
|
cacheClass = Building;
|
|
15
|
+
@tracked newRecord;
|
|
14
16
|
|
|
15
17
|
async unbindBuildingFromConstructionProject(EPROID, EGID) {
|
|
16
18
|
const response = await this.authFetch.fetch(
|
|
@@ -101,10 +103,14 @@ export default class BuildingService extends GwrService {
|
|
|
101
103
|
const errors = this.extractErrorsFromXML(xmlErrors);
|
|
102
104
|
|
|
103
105
|
await this.constructionProject.removeWorkFromProject(EPROID, work.ARBID);
|
|
106
|
+
|
|
107
|
+
buildingWork.ARBID = undefined;
|
|
108
|
+
buildingWork.isNew = true;
|
|
104
109
|
console.error("GWR API: addBuildingToConstructionProject failed");
|
|
105
110
|
throw errors;
|
|
106
111
|
}
|
|
107
112
|
|
|
113
|
+
this.newRecord = null;
|
|
108
114
|
const xml = await response.text();
|
|
109
115
|
return this.createAndCache(xml);
|
|
110
116
|
}
|
|
@@ -104,13 +104,7 @@ export default class ConstructionProjectService extends GwrService {
|
|
|
104
104
|
|
|
105
105
|
buildingWork.ARBID = ARBID;
|
|
106
106
|
buildingWork.isNew = false;
|
|
107
|
-
|
|
108
|
-
// TODO: apply for type "Umbau" with modifyWork
|
|
109
|
-
// don't execute bindBuildingToConstructionProject
|
|
110
107
|
return buildingWork;
|
|
111
|
-
/*return buildingWork.kindOfWork === 6002
|
|
112
|
-
? await this.modifyWork(projectId, buildingWork)
|
|
113
|
-
: buildingWork;*/
|
|
114
108
|
}
|
|
115
109
|
|
|
116
110
|
async modifyWork(projectId, buildingWork) {
|
package/addon/services/gwr.js
CHANGED
|
@@ -88,7 +88,7 @@ export default class GwrService extends Service {
|
|
|
88
88
|
})[searchKey];
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
extractErrorsFromXML(xml) {
|
|
91
|
+
extractErrorsFromXML(xml, showGeneral = true) {
|
|
92
92
|
const model = new XMLModel(xml);
|
|
93
93
|
model.setFieldsFromXML({
|
|
94
94
|
fields: {
|
|
@@ -99,7 +99,9 @@ export default class GwrService extends Service {
|
|
|
99
99
|
|
|
100
100
|
const errors = [
|
|
101
101
|
...(model.error
|
|
102
|
-
?
|
|
102
|
+
? showGeneral
|
|
103
|
+
? [this.intl.t("ember-gwr.generalErrors.genericFormError")]
|
|
104
|
+
: model.error
|
|
103
105
|
: []),
|
|
104
106
|
...(model.errorList
|
|
105
107
|
? model.errorList.map((error) => error.messageOfError)
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
@projectId={{this.router.currentRoute.attributes.projectId}}
|
|
16
16
|
@headerModelName="dwelling"
|
|
17
17
|
@hasStatus={{true}}
|
|
18
|
+
@import={{this.import}}
|
|
18
19
|
@modelStatusOptions={{this.dwellingStatusOptions}}
|
|
19
20
|
@nextValidStates={{this.nextValidStates}}
|
|
20
21
|
@onStatusChange={{this.transitionState}}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
@projectId={{this.router.currentRoute.attributes.projectId}}
|
|
18
18
|
@headerModelName="entrance"
|
|
19
19
|
@hasStatus={{false}}
|
|
20
|
+
@import={{this.import}}
|
|
20
21
|
as |Field|
|
|
21
22
|
>
|
|
22
23
|
{{#unless this.buildingEntrance.isNew}}
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
<Field @attr="buildingEntranceNo" />
|
|
45
46
|
<Field @attr="isOfficialAddress" @type="checkbox" />
|
|
46
47
|
|
|
47
|
-
<
|
|
48
|
+
<h3>{{t "ember-gwr.buildingEntrance.coordinates"}}</h3>
|
|
48
49
|
<Field
|
|
49
50
|
@attr="coordinates.north"
|
|
50
51
|
@type="number"
|
|
@@ -69,65 +70,11 @@
|
|
|
69
70
|
@disabled={{true}}
|
|
70
71
|
/>
|
|
71
72
|
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
</span>
|
|
78
|
-
<span>
|
|
79
|
-
<LinkTo
|
|
80
|
-
class="uk-button
|
|
81
|
-
{{if
|
|
82
|
-
this.buildingEntrance.isNew
|
|
83
|
-
"uk-button-primary"
|
|
84
|
-
"uk-button-default"
|
|
85
|
-
}}"
|
|
86
|
-
@route="building.edit.entrance.edit.link-street"
|
|
87
|
-
@models={{if this.buildingEntrance.isNew (array "new") (array)}}
|
|
88
|
-
>
|
|
89
|
-
{{t
|
|
90
|
-
(if
|
|
91
|
-
this.buildingEntrance.isNew
|
|
92
|
-
"ember-gwr.buildingEntrance.linkStreet.link"
|
|
93
|
-
"ember-gwr.buildingEntrance.linkStreet.change"
|
|
94
|
-
)
|
|
95
|
-
}}
|
|
96
|
-
</LinkTo>
|
|
97
|
-
</span>
|
|
98
|
-
</div>
|
|
99
|
-
{{#if this.buildingEntrance.street.isNew}}
|
|
100
|
-
<div uk-alert class="uk-alert-warning">{{t
|
|
101
|
-
"ember-gwr.buildingEntrance.streetHint"
|
|
102
|
-
}}</div>
|
|
103
|
-
{{else}}
|
|
104
|
-
<Field @attr="street.ESID" @disabled={{true}} readonly />
|
|
105
|
-
<Field
|
|
106
|
-
@attr="street.description.descriptionLong"
|
|
107
|
-
@disabled={{true}}
|
|
108
|
-
readonly
|
|
109
|
-
/>
|
|
110
|
-
<Field
|
|
111
|
-
@attr="street.streetKind"
|
|
112
|
-
@type="select"
|
|
113
|
-
@gwrEnumOptions={{this.Models.Street.streetKindOptions}}
|
|
114
|
-
@convertValueTo="number"
|
|
115
|
-
@disabled={{true}}
|
|
116
|
-
readonly
|
|
117
|
-
/>
|
|
118
|
-
<Field
|
|
119
|
-
@attr="street.officialStreetNumber"
|
|
120
|
-
@type="number"
|
|
121
|
-
@disabled={{true}}
|
|
122
|
-
readonly
|
|
123
|
-
/>
|
|
124
|
-
<Field
|
|
125
|
-
@attr="street.isOfficialDescription"
|
|
126
|
-
@type="checkbox"
|
|
127
|
-
@disabled={{true}}
|
|
128
|
-
readonly
|
|
129
|
-
/>
|
|
130
|
-
{{/if}}
|
|
73
|
+
<LinkStreet
|
|
74
|
+
@fieldComponent={{Field}}
|
|
75
|
+
@buildingEntrance={{this.buildingEntrance}}
|
|
76
|
+
@translationBase="ember-gwr.buildingEntrance.fields"
|
|
77
|
+
/>
|
|
131
78
|
|
|
132
79
|
</ModelForm>
|
|
133
80
|
{{/if}}
|