ember-ebau-gwr 2.7.1 → 3.2.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/.github/workflows/release.yml +2 -0
- package/CHANGELOG.md +95 -0
- package/addon/components/back-route.hbs +10 -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 +105 -0
- package/addon/components/link-street.js +24 -0
- package/addon/components/linked-models.hbs +12 -6
- 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-errors/error-indicator.hbs +3 -1
- package/addon/components/model-errors/header.hbs +4 -2
- package/addon/components/model-errors.hbs +1 -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 +36 -9
- package/addon/components/model-form/header/actions.hbs +70 -36
- package/addon/components/model-form/header/actions.js +6 -0
- package/addon/components/model-form/header/status-selector/submit-parameters.hbs +1 -1
- package/addon/components/model-form/header/status-selector.hbs +1 -1
- package/addon/components/model-form/header.hbs +4 -2
- package/addon/components/model-form/submit-errors.hbs +41 -23
- package/addon/components/model-form.hbs +6 -5
- package/addon/components/model-form.js +25 -5
- package/addon/components/model-inview.hbs +8 -0
- package/addon/components/model-inview.js +12 -0
- 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 +5 -1
- package/addon/components/search/filters.hbs +0 -5
- package/addon/components/search/filters.js +1 -3
- package/addon/components/sub-nav.hbs +5 -10
- package/addon/controllers/building/edit/dwelling/edit.js +27 -32
- package/addon/controllers/building/edit/dwellings.js +1 -1
- package/addon/controllers/building/edit/entrance/edit/index.js +26 -13
- package/addon/controllers/building/edit/entrance/edit/link-street.js +45 -20
- package/addon/controllers/building/edit/entrances.js +18 -2
- package/addon/controllers/building/edit/form.js +29 -44
- package/addon/controllers/import.js +70 -0
- package/addon/controllers/project/errors.js +25 -29
- package/addon/controllers/project/form.js +35 -48
- package/addon/controllers/project.js +2 -1
- package/addon/helpers/housing-stat-link.js +13 -0
- package/addon/helpers/is-unset.js +7 -0
- package/addon/helpers/show-model-field.js +13 -0
- package/addon/models/address.js +39 -9
- package/addon/models/building-entrance.js +17 -7
- package/addon/models/building.js +74 -75
- package/addon/models/client.js +1 -1
- package/addon/models/construction-project.js +18 -16
- package/addon/models/date-partially-known.js +1 -1
- package/addon/models/dwelling.js +28 -1
- package/addon/models/heating.js +1 -1
- package/addon/models/identification.js +2 -1
- package/addon/models/options.js +251 -1
- package/addon/models/organisation-identification.js +6 -3
- package/addon/models/realestate-identification.js +0 -6
- package/addon/models/street.js +2 -0
- package/addon/models/xml-model.js +18 -7
- package/addon/models.js +2 -1
- package/addon/routes/building/edit/entrance/edit/index.js +0 -2
- package/addon/routes/building/edit/entrance/edit/link-street.js +10 -1
- package/addon/routes/building/edit/entrance/new.js +9 -16
- package/addon/routes/building/edit/index.js +8 -1
- package/addon/routes/building/new.js +10 -1
- package/addon/routes/project/form.js +5 -0
- package/addon/routes/project/new.js +3 -2
- package/addon/services/building-entrance.js +13 -9
- package/addon/services/building.js +195 -193
- package/addon/services/construction-project.js +140 -152
- package/addon/services/gwr.js +47 -2
- package/addon/services/street.js +10 -0
- package/addon/templates/building/edit/dwelling/edit.hbs +29 -6
- package/addon/templates/building/edit/dwellings.hbs +7 -4
- package/addon/templates/building/edit/entrance/edit/index.hbs +49 -84
- package/addon/templates/building/edit/entrance/edit/link-street.hbs +41 -12
- package/addon/templates/building/edit/entrances.hbs +6 -3
- package/addon/templates/building/edit/form.hbs +75 -21
- package/addon/templates/project/errors.hbs +121 -132
- package/addon/templates/project/form.hbs +126 -97
- package/addon/templates/project/linked-buildings.hbs +13 -20
- package/addon/templates/project.hbs +29 -19
- package/addon/templates/search-building.hbs +6 -0
- package/addon/templates/search-project.hbs +6 -0
- package/addon/utils.js +8 -0
- package/addon/validations/building-entrance.js +6 -4
- package/addon/validations/building-work.js +131 -11
- package/addon/validations/construction-project.js +154 -6
- package/addon/validations/coordinates.js +2 -2
- package/addon/validations/dwelling.js +61 -6
- package/addon/validations/realestate-identification.js +9 -9
- package/addon/validations/status/status-project-change.js +1 -1
- package/addon/validations/status/status-project-correction.js +1 -1
- package/addon/validators/range-state.js +27 -0
- package/addon/xml/helpers.js +4 -0
- package/addon/xml/templates/building-entrance.js +0 -14
- package/addon/xml/templates/building.js +0 -6
- package/addon/xml/templates/construction-project.js +2 -9
- package/addon/xml/templates/street.js +1 -7
- package/app/styles/ember-ebau-gwr.scss +32 -5
- package/config/environment.js +3 -0
- package/package.json +2 -2
- package/translations/building/de.yaml +13 -8
- package/translations/building-entrance/de.yaml +4 -10
- package/translations/construction-project/de.yaml +270 -15
- package/translations/de.yaml +46 -13
- package/translations/dwelling/de.yaml +14 -0
- package/translations/locality/de.yaml +2 -0
|
@@ -1,29 +1,28 @@
|
|
|
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
|
|
|
16
16
|
@service constructionProject;
|
|
17
17
|
@service building;
|
|
18
18
|
@service dwelling;
|
|
19
|
+
@service gwr;
|
|
19
20
|
@service config;
|
|
20
|
-
@service dataImport;
|
|
21
21
|
@service store;
|
|
22
22
|
@service router;
|
|
23
23
|
@service intl;
|
|
24
24
|
@service notification;
|
|
25
25
|
|
|
26
|
-
@tracked import = false;
|
|
27
26
|
@tracked buildingWork;
|
|
28
27
|
@tracked typeOfConstructionProject;
|
|
29
28
|
@tracked removedWork = [];
|
|
@@ -46,6 +45,7 @@ export default class ProjectFormController extends Controller {
|
|
|
46
45
|
@lastValue("fetchProject") project;
|
|
47
46
|
@task
|
|
48
47
|
*fetchProject() {
|
|
48
|
+
yield this.fetchCalumaData.perform();
|
|
49
49
|
// Add a new default work for new projects so we don't have to
|
|
50
50
|
// validate if the user has attached a work or not.
|
|
51
51
|
if (this.model.project?.isNew && !this.model.project?.work.length) {
|
|
@@ -60,15 +60,9 @@ export default class ProjectFormController extends Controller {
|
|
|
60
60
|
return project;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
@lastValue("fetchCalumaData") importData;
|
|
64
|
-
@task
|
|
65
|
-
*fetchCalumaData() {
|
|
66
|
-
return yield this.dataImport.fetchProject(this.model.instanceId);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
63
|
@action
|
|
70
64
|
cancelMerge() {
|
|
71
|
-
this.
|
|
65
|
+
this.resetImport();
|
|
72
66
|
this.fetchProject.perform();
|
|
73
67
|
}
|
|
74
68
|
|
|
@@ -122,7 +116,7 @@ export default class ProjectFormController extends Controller {
|
|
|
122
116
|
yield this.constructionProject.update(this.project);
|
|
123
117
|
}
|
|
124
118
|
|
|
125
|
-
this.
|
|
119
|
+
this.resetImport();
|
|
126
120
|
this.errors = [];
|
|
127
121
|
this.notification.success(
|
|
128
122
|
this.intl.t("ember-gwr.constructionProject.saveSuccess")
|
|
@@ -138,18 +132,6 @@ export default class ProjectFormController extends Controller {
|
|
|
138
132
|
}
|
|
139
133
|
}
|
|
140
134
|
|
|
141
|
-
concatStates(states) {
|
|
142
|
-
if (states.length === 1) {
|
|
143
|
-
return this.intl.t(`ember-gwr.lifeCycles.states.${states[0]}`);
|
|
144
|
-
}
|
|
145
|
-
const tail = states.pop();
|
|
146
|
-
return `${states
|
|
147
|
-
.map((state) => this.intl.t(`ember-gwr.lifeCycles.states.${state}`))
|
|
148
|
-
.join(", ")} ${this.intl.t("ember-gwr.general.or")} ${this.intl.t(
|
|
149
|
-
`ember-gwr.lifeCycles.states.${tail}`
|
|
150
|
-
)}`;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
135
|
@task
|
|
154
136
|
*transitionState(currentStatus, newStatus, isCascading) {
|
|
155
137
|
try {
|
|
@@ -189,24 +171,9 @@ export default class ProjectFormController extends Controller {
|
|
|
189
171
|
this.intl.t("ember-gwr.constructionProject.saveError")
|
|
190
172
|
);
|
|
191
173
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
: "statusErrorBuilding";
|
|
196
|
-
throw [
|
|
197
|
-
this.intl.t(`ember-gwr.lifeCycles.${errorType}`, {
|
|
198
|
-
dwellingId: error.dwellingId,
|
|
199
|
-
buildingId: error.buildingId,
|
|
200
|
-
states: this.concatStates(error.states),
|
|
201
|
-
href: error.dwellingId
|
|
202
|
-
? `/${this.model.instanceId}/${this.project.EPROID}/building/${error.buildingId}/dwelling/${error.dwellingId}`
|
|
203
|
-
: `/${this.model.instanceId}/${this.project.EPROID}/building/${error.buildingId}/form`,
|
|
204
|
-
htmlSafe: true,
|
|
205
|
-
}),
|
|
206
|
-
];
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
throw error;
|
|
174
|
+
throw error.isLifeCycleError
|
|
175
|
+
? this.gwr.buildLifeCycleError(error, this.model)
|
|
176
|
+
: error;
|
|
210
177
|
}
|
|
211
178
|
}
|
|
212
179
|
|
|
@@ -241,11 +208,6 @@ export default class ProjectFormController extends Controller {
|
|
|
241
208
|
return this.constructionProject.getCorrectionParameters(newStatus);
|
|
242
209
|
}
|
|
243
210
|
|
|
244
|
-
@action
|
|
245
|
-
getChangeHint(currentStatus, newStatus) {
|
|
246
|
-
return this.constructionProject.getChangeHint(currentStatus, newStatus);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
211
|
@action
|
|
250
212
|
updateWork(work, attr, value) {
|
|
251
213
|
work[attr] = value;
|
|
@@ -338,6 +300,12 @@ export default class ProjectFormController extends Controller {
|
|
|
338
300
|
@action
|
|
339
301
|
cancelTypeOfConstructionProjectChange() {
|
|
340
302
|
this.showConfirmationDialog = false;
|
|
303
|
+
// Reset the type of construction project set on model during submit
|
|
304
|
+
// This ensures that the buildings tab is correctly (in)activated
|
|
305
|
+
this.project.typeOfConstructionProject =
|
|
306
|
+
this.typeOfConstructionProject === 6011 ? 6010 : 6011;
|
|
307
|
+
|
|
308
|
+
this.typeOfConstructionProject = this.project.typeOfConstructionProject;
|
|
341
309
|
}
|
|
342
310
|
|
|
343
311
|
get workWithoutBuildings() {
|
|
@@ -347,4 +315,23 @@ export default class ProjectFormController extends Controller {
|
|
|
347
315
|
get workWithBuildings() {
|
|
348
316
|
return this.project.work.filter((work) => !work.building.isNew);
|
|
349
317
|
}
|
|
318
|
+
|
|
319
|
+
@action
|
|
320
|
+
isClientMismatch(changeset) {
|
|
321
|
+
const personNamePath =
|
|
322
|
+
"client.identification.personIdentification.officialName";
|
|
323
|
+
const organisationNamePath =
|
|
324
|
+
"client.identification.organisationIdentification.organisationName";
|
|
325
|
+
|
|
326
|
+
const conditionHolds = (isEqual, v, w) => (isEqual ? v === w : v !== w);
|
|
327
|
+
const isMismatch = (value, isEqual, path) =>
|
|
328
|
+
conditionHolds(isEqual, changeset.get("typeOfClient"), value) && changeset
|
|
329
|
+
? changeset.get(path)
|
|
330
|
+
: false;
|
|
331
|
+
|
|
332
|
+
return (
|
|
333
|
+
isMismatch(6161, true, organisationNamePath) ||
|
|
334
|
+
isMismatch(6161, false, personNamePath)
|
|
335
|
+
);
|
|
336
|
+
}
|
|
350
337
|
}
|
|
@@ -5,6 +5,7 @@ import { inject as service } from "@ember/service";
|
|
|
5
5
|
export default class ProjectController extends Controller {
|
|
6
6
|
@service router;
|
|
7
7
|
@service store;
|
|
8
|
+
@service config;
|
|
8
9
|
@service constructionProject;
|
|
9
10
|
@service intl;
|
|
10
11
|
|
|
@@ -64,6 +65,6 @@ export default class ProjectController extends Controller {
|
|
|
64
65
|
.peekAll("gwr-link")
|
|
65
66
|
.find(({ eproid }) => Number(eproid) === this.activeProject);
|
|
66
67
|
await link.destroyRecord();
|
|
67
|
-
await this.constructionProject.all.perform();
|
|
68
|
+
await this.constructionProject.all.perform(this.model);
|
|
68
69
|
}
|
|
69
70
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Helper from "@ember/component/helper";
|
|
2
|
+
import { inject as service } from "@ember/service";
|
|
3
|
+
import ENV from "ember-ebau-gwr/config/environment";
|
|
4
|
+
|
|
5
|
+
export default class HousingStatLink extends Helper {
|
|
6
|
+
@service config;
|
|
7
|
+
|
|
8
|
+
compute() {
|
|
9
|
+
return this.config.isTestEnvironment === false
|
|
10
|
+
? ENV.housingStatLinkProd
|
|
11
|
+
: ENV.housingStatLinkTest;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { helper } from "@ember/component/helper";
|
|
2
|
+
import { get } from "@ember/object";
|
|
3
|
+
|
|
4
|
+
function showModelField([field, changeset, importData]) {
|
|
5
|
+
const isSet = (value) => value !== undefined && value !== null;
|
|
6
|
+
|
|
7
|
+
return changeset
|
|
8
|
+
? isSet(changeset.get(field)) ||
|
|
9
|
+
(importData && isSet(get(importData.data, field)))
|
|
10
|
+
: false;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default helper(showModelField);
|
package/addon/models/address.js
CHANGED
|
@@ -2,12 +2,33 @@ import { tracked } from "@glimmer/tracking";
|
|
|
2
2
|
|
|
3
3
|
import XMLModel from "./xml-model";
|
|
4
4
|
|
|
5
|
+
export class Country extends XMLModel {
|
|
6
|
+
@tracked countryNameShort;
|
|
7
|
+
|
|
8
|
+
constructor(...args) {
|
|
9
|
+
super(...args);
|
|
10
|
+
this.setFieldsFromXML({
|
|
11
|
+
fields: {
|
|
12
|
+
countryNameShort: String,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static template = `
|
|
18
|
+
<ns5:country>
|
|
19
|
+
<ns5:countryNameShort>{{model.countryNameShort}}</ns5:countryNameShort>
|
|
20
|
+
</ns5:country>
|
|
21
|
+
`;
|
|
22
|
+
}
|
|
23
|
+
|
|
5
24
|
export default class Address extends XMLModel {
|
|
6
25
|
@tracked street;
|
|
7
26
|
@tracked houseNumber;
|
|
8
27
|
@tracked swissZipCode;
|
|
9
|
-
@tracked
|
|
10
|
-
@tracked
|
|
28
|
+
@tracked swissZipCodeAddOn;
|
|
29
|
+
@tracked foreignZipCode;
|
|
30
|
+
@tracked addressLine2;
|
|
31
|
+
@tracked country = new Country();
|
|
11
32
|
|
|
12
33
|
constructor(...args) {
|
|
13
34
|
super(...args);
|
|
@@ -16,21 +37,30 @@ export default class Address extends XMLModel {
|
|
|
16
37
|
street: String,
|
|
17
38
|
houseNumber: Number,
|
|
18
39
|
swissZipCode: Number,
|
|
19
|
-
|
|
20
|
-
|
|
40
|
+
swissZipCodeAddOn: Number,
|
|
41
|
+
foreignZipCode: Number,
|
|
42
|
+
addressLine2: String,
|
|
43
|
+
country: Country,
|
|
21
44
|
},
|
|
22
45
|
});
|
|
23
46
|
}
|
|
24
47
|
|
|
25
48
|
static template = `
|
|
26
49
|
<address>
|
|
50
|
+
{{{modelField model "addressLine2" namespace="ns5:"}}}
|
|
27
51
|
<ns5:street>{{model.street}}</ns5:street>
|
|
28
52
|
<ns5:houseNumber>{{model.houseNumber}}</ns5:houseNumber>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
53
|
+
{{!--TODO: Town is ignored by the API, N/A is returned.
|
|
54
|
+
However, an error is returned if it isn't present.
|
|
55
|
+
Remove once API no longer requires field --}}
|
|
56
|
+
<ns5:town />
|
|
57
|
+
{{#if (eq model.country.countryNameShort "ch")}}
|
|
58
|
+
{{{modelField model "swissZipCode" namespace="ns5:"}}}
|
|
59
|
+
{{{modelField model "swissZipCodeAddOn" namespace="ns5:"}}}
|
|
60
|
+
{{else}}
|
|
61
|
+
{{{modelField model "foreignZipCode" namespace="ns5:"}}}
|
|
62
|
+
{{/if}}
|
|
63
|
+
{{> Country model=model.country}}
|
|
34
64
|
</address>
|
|
35
65
|
`;
|
|
36
66
|
}
|
|
@@ -47,28 +47,38 @@ export default class BuildingEntrance extends XMLModel {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
get fullAddressText() {
|
|
50
|
+
const isSet = (value) => value || value === 0;
|
|
51
|
+
|
|
50
52
|
const { street, buildingEntranceNo, locality } = this;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
const streetText = [street?.description.descriptionLong, buildingEntranceNo]
|
|
54
|
+
.filter(isSet)
|
|
55
|
+
.join(" ");
|
|
56
|
+
|
|
57
|
+
const localityText = [locality.swissZipCode, locality.name.nameLong]
|
|
58
|
+
.filter(isSet)
|
|
59
|
+
.join(" ");
|
|
60
|
+
|
|
61
|
+
return [streetText, localityText].filter(isSet).join(", ");
|
|
54
62
|
}
|
|
55
63
|
|
|
56
64
|
static template = `
|
|
57
65
|
{{#if model.isNew}}
|
|
58
|
-
{{
|
|
59
|
-
<ns2:buildingEntranceNo>{{model.buildingEntranceNo}}</ns2:buildingEntranceNo>
|
|
60
|
-
{{/if}}
|
|
66
|
+
{{{modelField model "buildingEntranceNo"}}}
|
|
61
67
|
<ns2:isOfficialAddress>{{model.isOfficialAddress}}</ns2:isOfficialAddress>
|
|
62
68
|
{{> Street model=model.street}}
|
|
63
69
|
{{> Locality model=model.locality}}
|
|
64
70
|
{{else}}
|
|
65
71
|
<ns2:buildingEntrance>
|
|
66
72
|
<ns2:EGAID>{{model.EGAID}}</ns2:EGAID>
|
|
67
|
-
|
|
73
|
+
{{{modelField model "buildingEntranceNo"}}}
|
|
68
74
|
<ns2:isOfficialAddress>{{model.isOfficialAddress}}</ns2:isOfficialAddress>
|
|
69
75
|
{{> Street model=model.street}}
|
|
70
76
|
{{> Locality model=model.locality}}
|
|
71
77
|
</ns2:buildingEntrance>
|
|
72
78
|
{{/if}}
|
|
73
79
|
`;
|
|
80
|
+
|
|
81
|
+
static DEACTIVATION_ERROR =
|
|
82
|
+
"Cannot deactivate an entrance while active dwellings are still linked to it";
|
|
83
|
+
static LOCALITY_ERROR = "There is no link between Locality and Street";
|
|
74
84
|
}
|
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>
|
|
@@ -393,7 +325,7 @@ export default class Building extends XMLModel {
|
|
|
393
325
|
[this.STATUS_NOT_REALIZED]: [],
|
|
394
326
|
};
|
|
395
327
|
|
|
396
|
-
static
|
|
328
|
+
static transitionHint = {
|
|
397
329
|
[this.STATUS_PROJECTED]: {
|
|
398
330
|
[this.STATUS_APPROVED]: true,
|
|
399
331
|
[this.STATUS_NOT_REALIZED]: true,
|
|
@@ -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;
|
|
@@ -56,15 +56,15 @@ export default class ConstructionProject extends XMLModel {
|
|
|
56
56
|
extensionOfOfficialConstructionProjectFileNo: Number,
|
|
57
57
|
constructionProjectDescription: String,
|
|
58
58
|
constructionSurveyDeptNumber: String,
|
|
59
|
-
withdrawalDate:
|
|
60
|
-
projectStartDate:
|
|
59
|
+
withdrawalDate: Date,
|
|
60
|
+
projectStartDate: Date,
|
|
61
61
|
durationOfConstructionPhase: Number,
|
|
62
|
-
constructionAuthorisationDeniedDate:
|
|
63
|
-
|
|
64
|
-
projectCompletionDate:
|
|
65
|
-
projectSuspensionDate:
|
|
66
|
-
buildingPermitIssueDate:
|
|
67
|
-
projectAnnouncementDate:
|
|
62
|
+
constructionAuthorisationDeniedDate: Date,
|
|
63
|
+
cancellationDate: Date,
|
|
64
|
+
projectCompletionDate: Date,
|
|
65
|
+
projectSuspensionDate: Date,
|
|
66
|
+
buildingPermitIssueDate: Date,
|
|
67
|
+
projectAnnouncementDate: Date,
|
|
68
68
|
projectFreeText1: String,
|
|
69
69
|
projectFreeText2: String,
|
|
70
70
|
projectStatus: Number,
|
|
@@ -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 },
|
|
@@ -372,7 +372,7 @@ export default class ConstructionProject extends XMLModel {
|
|
|
372
372
|
],
|
|
373
373
|
};
|
|
374
374
|
|
|
375
|
-
static
|
|
375
|
+
static transitionHint = {
|
|
376
376
|
[this.STATUS_PROJECTED]: {
|
|
377
377
|
[this.STATUS_APPROVED]: true,
|
|
378
378
|
[this.STATUS_REFUSED]: true,
|
|
@@ -402,4 +402,6 @@ export default class ConstructionProject extends XMLModel {
|
|
|
402
402
|
[this.STATUS_NOT_REALIZED]: {},
|
|
403
403
|
[this.STATUS_WITHDRAWN]: {},
|
|
404
404
|
};
|
|
405
|
+
|
|
406
|
+
static MISSING_BUILDING_ERROR = "No link with a building found";
|
|
405
407
|
}
|