ember-ebau-gwr 7.2.1 → 7.4.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 +29 -0
- package/addon/components/linked-models.hbs +8 -3
- package/addon/components/linked-projects.hbs +29 -28
- package/addon/components/project-nav.js +1 -1
- package/addon/controllers/building/edit/form.js +1 -0
- package/addon/controllers/project/form.js +40 -118
- package/addon/controllers/project/linked-buildings.js +0 -7
- package/addon/models/building.js +6 -5
- package/addon/models/construction-project.js +7 -10
- package/addon/models/options.js +1 -1
- package/addon/services/building-entrance.js +12 -8
- package/addon/services/building.js +27 -10
- package/addon/services/construction-project.js +8 -12
- package/addon/services/gwr.js +12 -13
- package/addon/templates/building/edit/dwelling/edit.hbs +8 -0
- package/addon/templates/building/edit/dwellings.hbs +42 -40
- package/addon/templates/building/edit/entrance/edit/link-street.hbs +24 -1
- package/addon/templates/building/edit/entrances.hbs +15 -14
- package/addon/templates/project/form.hbs +29 -71
- package/addon/templates/project/linked-buildings.hbs +31 -28
- package/addon/validations/building-work.js +1 -1
- package/addon/validations/construction-project.js +1 -96
- package/addon/xml/helpers.js +8 -1
- package/package.json +20 -20
- package/translations/building/de.yaml +2 -1
- package/translations/building/fr.yaml +5 -3
- package/translations/construction-project/de.yaml +4 -2
- package/translations/construction-project/fr.yaml +4 -2
- package/translations/de.yaml +14 -25
- package/translations/dwelling/de.yaml +5 -3
- package/translations/dwelling/fr.yaml +3 -1
- package/translations/fr.yaml +11 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
# [7.4.0](https://github.com/inosca/ember-ebau-gwr/compare/v7.3.0...v7.4.0) (2023-08-31)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **validations:** remove unndeeded validations and add some missing validation ([bcad503](https://github.com/inosca/ember-ebau-gwr/commit/bcad503ad85cd7c01b41c9fbfb6f4f78f6f9cc34))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **search-street:** add info about wildcard search ([b76dc97](https://github.com/inosca/ember-ebau-gwr/commit/b76dc9776306ed0ceb0f6c7ed377db6a352c4813))
|
|
12
|
+
|
|
13
|
+
# [7.3.0](https://github.com/inosca/ember-ebau-gwr/compare/v7.2.1...v7.3.0) (2023-07-25)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **extractErrorsFromXML:** use object for error list for readability ([5f552b8](https://github.com/inosca/ember-ebau-gwr/commit/5f552b80a448ed54845fe22d6ab2823d0652b738))
|
|
19
|
+
* **project/form:** fix spelling error on class ([f036b31](https://github.com/inosca/ember-ebau-gwr/commit/f036b310170c2369fa10ec9f47f8e79484b1ccaf))
|
|
20
|
+
* **translations:** add french deepl translations ([eeab6fe](https://github.com/inosca/ember-ebau-gwr/commit/eeab6febca62c37765860c2cb728bf81fc6e4d93))
|
|
21
|
+
* **translations:** spelling ([2802f37](https://github.com/inosca/ember-ebau-gwr/commit/2802f376747ad26cf6606cc9dcd9fc6d6b039e7e))
|
|
22
|
+
* **work:** allow linked work for all types of constructions ([cde554b](https://github.com/inosca/ember-ebau-gwr/commit/cde554bbe0851360c397ad69c348b56a3d2b3642))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **building:** add error mapping for forbidden buildingClass Landwirtschaftliche Betriebsgebäude ([027357f](https://github.com/inosca/ember-ebau-gwr/commit/027357fc8ab91ec8abc04197ab223ae91013d910))
|
|
28
|
+
* **constructionProject:** add Sonderbau as a typeOfConstructionProject ([defbd9b](https://github.com/inosca/ember-ebau-gwr/commit/defbd9b649adf767c61dabfa17159b002e12e683))
|
|
29
|
+
|
|
1
30
|
## [7.2.1](https://github.com/inosca/ember-ebau-gwr/compare/v7.2.0...v7.2.1) (2023-07-03)
|
|
2
31
|
|
|
3
32
|
|
|
@@ -20,9 +20,14 @@
|
|
|
20
20
|
<tbody>
|
|
21
21
|
{{#each @models as |model|}}
|
|
22
22
|
<tr>
|
|
23
|
-
{{yield model}}
|
|
24
|
-
{{
|
|
25
|
-
|
|
23
|
+
{{yield model to="list"}}
|
|
24
|
+
{{! If the model is a work and has a linked building, we display an infotext that the work is linked to the building}}
|
|
25
|
+
{{#if
|
|
26
|
+
(and (eq @modelName "building-work") (not model.building.isNew))
|
|
27
|
+
}}
|
|
28
|
+
{{yield model to="buildingLink"}}
|
|
29
|
+
{{else if @removeLink}}
|
|
30
|
+
<td class="uk-table-shrink uk-text-right">
|
|
26
31
|
<button
|
|
27
32
|
type="button"
|
|
28
33
|
class="uk-icon-button"
|
|
@@ -4,33 +4,34 @@
|
|
|
4
4
|
@searchRoute="search-project"
|
|
5
5
|
@newRoute="project.new"
|
|
6
6
|
...attributes
|
|
7
|
-
as |project|
|
|
8
7
|
>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{{project.EPROID}}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
{{project.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
8
|
+
<:list as |project|>
|
|
9
|
+
<td
|
|
10
|
+
class={{concat
|
|
11
|
+
"uk-table-shrink "
|
|
12
|
+
(if (eq @activeProjectId project.EPROID) "uk-text-bold")
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
15
|
+
<LinkTo @route="project.form" @model={{project.EPROID}} class="uk-link">
|
|
16
|
+
{{project.EPROID}}
|
|
17
|
+
</LinkTo>
|
|
18
|
+
</td>
|
|
19
|
+
<td class={{if (eq @activeProjectId project.EPROID) "uk-text-bold"}}>
|
|
20
|
+
{{project.constructionProjectDescription}}
|
|
21
|
+
</td>
|
|
22
|
+
<td class="uk-table-shrink">
|
|
23
|
+
{{#if (eq @activeProjectId project.EPROID)}}
|
|
24
|
+
<button
|
|
25
|
+
type="button"
|
|
26
|
+
class="uk-icon-button"
|
|
27
|
+
uk-icon="trash"
|
|
28
|
+
uk-tooltip="title: {{t
|
|
29
|
+
'ember-gwr.components.linkedModels.removeLink'
|
|
30
|
+
}}; container: {{this.config.modalContainer}}"
|
|
31
|
+
{{on "click" this.removeProjectLink}}
|
|
32
|
+
>
|
|
33
|
+
</button>
|
|
34
|
+
{{/if}}
|
|
35
|
+
</td>
|
|
36
|
+
</:list>
|
|
36
37
|
</LinkedModels>
|
|
@@ -18,7 +18,7 @@ export default class ProjectNavComponent extends Component {
|
|
|
18
18
|
)
|
|
19
19
|
: this.args.projects[0];
|
|
20
20
|
|
|
21
|
-
return project?.typeOfConstructionProject
|
|
21
|
+
return project?.typeOfConstructionProject === 6010
|
|
22
22
|
? this.intl.t(
|
|
23
23
|
"ember-gwr.linkedBuildings.buildingDisabledForInfrastructure"
|
|
24
24
|
)
|
|
@@ -155,6 +155,7 @@ export default class BuildingFormController extends ImportController {
|
|
|
155
155
|
this.notification.success(this.intl.t("ember-gwr.building.saveSuccess"));
|
|
156
156
|
} catch (error) {
|
|
157
157
|
this.errors = error;
|
|
158
|
+
console.error(error);
|
|
158
159
|
this.notification.danger(this.intl.t("ember-gwr.building.saveError"));
|
|
159
160
|
}
|
|
160
161
|
}
|
|
@@ -11,6 +11,7 @@ import ConstructionProjectValidations from "ember-ebau-gwr/validations/construct
|
|
|
11
11
|
export default class ProjectFormController extends ImportController {
|
|
12
12
|
ConstructionProjectValidations = ConstructionProjectValidations;
|
|
13
13
|
kindOfWorkOptions = BuildingWork.kindOfWorkOptions;
|
|
14
|
+
ConstructionProject = ConstructionProject;
|
|
14
15
|
|
|
15
16
|
@service constructionProject;
|
|
16
17
|
@service building;
|
|
@@ -26,7 +27,6 @@ export default class ProjectFormController extends ImportController {
|
|
|
26
27
|
@tracked typeOfConstructionProject;
|
|
27
28
|
@tracked removedWork = [];
|
|
28
29
|
@tracked errors;
|
|
29
|
-
@tracked showConfirmationDialog = false;
|
|
30
30
|
|
|
31
31
|
choiceOptions = Options;
|
|
32
32
|
|
|
@@ -45,6 +45,29 @@ export default class ProjectFormController extends ImportController {
|
|
|
45
45
|
return { correction: true, change: true };
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
get hasRemoveWorkLink() {
|
|
49
|
+
return !(this.project.isNew && this.project.work.length === 1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
get typeOfConstructionProjectHint() {
|
|
53
|
+
switch (this.typeOfConstructionProject) {
|
|
54
|
+
case this.ConstructionProject.INFRASTRUCTURE: {
|
|
55
|
+
return this.intl.t(
|
|
56
|
+
"ember-gwr.linkedBuildings.buildingDisabledForInfrastructure"
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
case this.ConstructionProject.SUPERSTRUCTURE: {
|
|
60
|
+
return this.intl.t("ember-gwr.linkedBuildings.superstructureInfo");
|
|
61
|
+
}
|
|
62
|
+
case this.ConstructionProject.SPECIALSTRUCTURE: {
|
|
63
|
+
return this.intl.t("ember-gwr.linkedBuildings.specialstructureInfo");
|
|
64
|
+
}
|
|
65
|
+
default: {
|
|
66
|
+
return "";
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
48
71
|
@lastValue("fetchProject") project;
|
|
49
72
|
@task
|
|
50
73
|
*fetchProject() {
|
|
@@ -82,39 +105,25 @@ export default class ProjectFormController extends ImportController {
|
|
|
82
105
|
yield this.constructionProject.all.perform(this.model.instanceId);
|
|
83
106
|
this.router.transitionTo("project.form", project.EPROID);
|
|
84
107
|
} else {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
this.workWithoutBuildings.length > 1)
|
|
92
|
-
) {
|
|
93
|
-
this.showConfirmationDialog = true;
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (this.typeOfConstructionProject === 6010) {
|
|
98
|
-
const added = this.project.work.filter((work) => work.isNew);
|
|
99
|
-
yield Promise.all(
|
|
100
|
-
added.map((work) =>
|
|
101
|
-
this.constructionProject.addWorkToProject(
|
|
102
|
-
this.model.projectId,
|
|
103
|
-
work
|
|
104
|
-
)
|
|
108
|
+
const added = this.project.work.filter((work) => work.isNew);
|
|
109
|
+
yield Promise.all(
|
|
110
|
+
added.map((work) =>
|
|
111
|
+
this.constructionProject.addWorkToProject(
|
|
112
|
+
this.model.projectId,
|
|
113
|
+
work
|
|
105
114
|
)
|
|
106
|
-
)
|
|
115
|
+
)
|
|
116
|
+
);
|
|
107
117
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
)
|
|
118
|
+
yield Promise.all(
|
|
119
|
+
this.removedWork.map((work) =>
|
|
120
|
+
this.constructionProject.removeWorkFromProject(
|
|
121
|
+
this.model.projectId,
|
|
122
|
+
work.ARBID
|
|
114
123
|
)
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
|
|
124
|
+
)
|
|
125
|
+
);
|
|
126
|
+
this.removedWork = [];
|
|
118
127
|
yield this.constructionProject.update(this.project);
|
|
119
128
|
}
|
|
120
129
|
|
|
@@ -231,93 +240,6 @@ export default class ProjectFormController extends ImportController {
|
|
|
231
240
|
this.project.work = [...this.project.work, new BuildingWork()];
|
|
232
241
|
}
|
|
233
242
|
|
|
234
|
-
@task
|
|
235
|
-
*addDefaultWork() {
|
|
236
|
-
const buildingWork = yield this.constructionProject.addDefaultWork(
|
|
237
|
-
this.project.EPROID
|
|
238
|
-
);
|
|
239
|
-
this.project.work = [...this.project.work, buildingWork];
|
|
240
|
-
return buildingWork;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
@task
|
|
244
|
-
*removeBuildings() {
|
|
245
|
-
return yield Promise.all(
|
|
246
|
-
this.workWithBuildings.map(async (work) => {
|
|
247
|
-
await this.building.unbindBuildingFromConstructionProject(
|
|
248
|
-
this.project.EPROID,
|
|
249
|
-
work.building.EGID
|
|
250
|
-
);
|
|
251
|
-
// locally remove building from work list
|
|
252
|
-
// so that it runs through second save check
|
|
253
|
-
this.project.work = this.project.work.filter((w) => w !== work);
|
|
254
|
-
})
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
@task
|
|
259
|
-
*removeWork() {
|
|
260
|
-
// always create default work of type "Neubau" to
|
|
261
|
-
// prevent errors from API, remove all others
|
|
262
|
-
const defaultWork = yield this.addDefaultWork.perform();
|
|
263
|
-
return yield Promise.all(
|
|
264
|
-
this.workWithoutBuildings.map(async (work) => {
|
|
265
|
-
if (work.ARBID !== defaultWork.ARBID) {
|
|
266
|
-
if (!work.isNew) {
|
|
267
|
-
await this.constructionProject.removeWorkFromProject(
|
|
268
|
-
this.project.EPROID,
|
|
269
|
-
work.ARBID
|
|
270
|
-
);
|
|
271
|
-
}
|
|
272
|
-
// locally remove work from work list
|
|
273
|
-
// so that it runs through second save check
|
|
274
|
-
this.project.work = this.project.work.filter((w) => w !== work);
|
|
275
|
-
}
|
|
276
|
-
})
|
|
277
|
-
);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
@task
|
|
281
|
-
*processTypeOfConstructionProjectChange() {
|
|
282
|
-
this.showConfirmationDialog = false;
|
|
283
|
-
|
|
284
|
-
if (
|
|
285
|
-
this.typeOfConstructionProject === 6010 &&
|
|
286
|
-
this.workWithBuildings.length
|
|
287
|
-
) {
|
|
288
|
-
if (!this.workWithoutBuildings.length) {
|
|
289
|
-
yield this.addDefaultWork.perform();
|
|
290
|
-
}
|
|
291
|
-
yield this.removeBuildings.perform();
|
|
292
|
-
} else if (
|
|
293
|
-
this.typeOfConstructionProject === 6011 &&
|
|
294
|
-
this.workWithoutBuildings.length
|
|
295
|
-
) {
|
|
296
|
-
yield this.removeWork.perform();
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
this.saveProject.perform();
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
@action
|
|
303
|
-
cancelTypeOfConstructionProjectChange() {
|
|
304
|
-
this.showConfirmationDialog = false;
|
|
305
|
-
// Reset the type of construction project set on model during submit
|
|
306
|
-
// This ensures that the buildings tab is correctly (in)activated
|
|
307
|
-
this.project.typeOfConstructionProject =
|
|
308
|
-
this.typeOfConstructionProject === 6011 ? 6010 : 6011;
|
|
309
|
-
|
|
310
|
-
this.typeOfConstructionProject = this.project.typeOfConstructionProject;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
get workWithoutBuildings() {
|
|
314
|
-
return this.project.work.filter((work) => work.building.isNew);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
get workWithBuildings() {
|
|
318
|
-
return this.project.work.filter((work) => !work.building.isNew);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
243
|
@action
|
|
322
244
|
isClientMismatch(changeset) {
|
|
323
245
|
const personNamePath =
|
|
@@ -41,13 +41,6 @@ export default class ProjectLinkedBuildingsController extends Controller {
|
|
|
41
41
|
this.model,
|
|
42
42
|
EGID
|
|
43
43
|
);
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
!this.workWithoutBuildings.length &&
|
|
47
|
-
this.workWithBuildings.length === 1
|
|
48
|
-
) {
|
|
49
|
-
await this.constructionProject.addDefaultWork(this.model);
|
|
50
|
-
}
|
|
51
44
|
await this.fetchBuildings.perform();
|
|
52
45
|
} catch (error) {
|
|
53
46
|
console.error(error);
|
package/addon/models/building.js
CHANGED
|
@@ -146,9 +146,7 @@ export default class Building extends XMLModel {
|
|
|
146
146
|
{{#if model.numberOfFloors}}
|
|
147
147
|
<ns2:numberOfFloors>{{model.numberOfFloors}}</ns2:numberOfFloors>
|
|
148
148
|
{{/if}}
|
|
149
|
-
{{
|
|
150
|
-
<ns2:numberOfSeparateHabitableRooms>{{model.numberOfSeparateHabitableRooms}}</ns2:numberOfSeparateHabitableRooms>
|
|
151
|
-
{{/if}}
|
|
149
|
+
{{{modelField model "numberOfSeparateHabitableRooms" renderZero=false}}}
|
|
152
150
|
{{! Returns no error but not saved by api}}
|
|
153
151
|
{{{modelField model "civilDefenseShelter"}}}
|
|
154
152
|
{{#if model.energyRelevantSurface}}
|
|
@@ -168,9 +166,9 @@ export default class Building extends XMLModel {
|
|
|
168
166
|
{{/if}}
|
|
169
167
|
|
|
170
168
|
{{#if model.isNew}}
|
|
171
|
-
{{!--The default building entrance on a new building is stored as a single
|
|
169
|
+
{{!--The default building entrance on a new building is stored as a single
|
|
172
170
|
element to facilitate form validation--}}
|
|
173
|
-
{{!--After building creation the building entrances are stored in an
|
|
171
|
+
{{!--After building creation the building entrances are stored in an
|
|
174
172
|
array on the building and handled through building entrance API requests--}}
|
|
175
173
|
<ns2:buildingEntrance>
|
|
176
174
|
{{> BuildingEntrance model=model.buildingEntrance}}
|
|
@@ -348,6 +346,9 @@ export default class Building extends XMLModel {
|
|
|
348
346
|
[this.STATUS_DEMOLISHED]: {},
|
|
349
347
|
[this.STATUS_NOT_REALIZED]: {},
|
|
350
348
|
};
|
|
349
|
+
|
|
350
|
+
static FORBIDDEN_BUILDING_CLASS_ERROR =
|
|
351
|
+
"This building class is not allowed for a building newly being added into the FRBD. Please chose among building classes 1276, 1277, 1278 instead.";
|
|
351
352
|
}
|
|
352
353
|
|
|
353
354
|
export class Volume extends XMLModel {
|
|
@@ -149,16 +149,9 @@ export default class ConstructionProject extends XMLModel {
|
|
|
149
149
|
{{{modelField model "projectFreeText2"}}}
|
|
150
150
|
|
|
151
151
|
{{#if model.isNew}}
|
|
152
|
-
{{#
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
<ns2:ARBID>1</ns2:ARBID>
|
|
156
|
-
</ns2:work>
|
|
157
|
-
{{else if (eq model.typeOfConstructionProject 6010)}}
|
|
158
|
-
{{#each model.work}}
|
|
159
|
-
{{> BuildingWork model=this}}
|
|
160
|
-
{{/each}}
|
|
161
|
-
{{/if}}
|
|
152
|
+
{{#each model.work}}
|
|
153
|
+
{{> BuildingWork model=this}}
|
|
154
|
+
{{/each}}
|
|
162
155
|
{{/if}}
|
|
163
156
|
</ns2:constructionProject>
|
|
164
157
|
`;
|
|
@@ -172,6 +165,10 @@ export default class ConstructionProject extends XMLModel {
|
|
|
172
165
|
static STATUS_NOT_REALIZED = 6708;
|
|
173
166
|
static STATUS_WITHDRAWN = 6709;
|
|
174
167
|
|
|
168
|
+
static INFRASTRUCTURE = 6010;
|
|
169
|
+
static SUPERSTRUCTURE = 6011;
|
|
170
|
+
static SPECIALSTRUCTURE = 6012;
|
|
171
|
+
|
|
175
172
|
// valid state transitions
|
|
176
173
|
static projectStatesMapping = {
|
|
177
174
|
[this.STATUS_PROJECTED]: [
|
package/addon/models/options.js
CHANGED
|
@@ -8,7 +8,7 @@ export const typeOfConstructionOptions = [
|
|
|
8
8
|
6258, 6259, 6261, 6262, 6269, 6271, 6272, 6273, 6274, 6276, 6278, 6279, 6281,
|
|
9
9
|
6282, 6283, 6291, 6292, 6293, 6294, 6295, 6296, 6299,
|
|
10
10
|
];
|
|
11
|
-
export const typeOfConstructionProjectOptions = [6010, 6011];
|
|
11
|
+
export const typeOfConstructionProjectOptions = [6010, 6011, 6012];
|
|
12
12
|
export const typeOfPermitOptions = [
|
|
13
13
|
5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5011, 5012, 5015,
|
|
14
14
|
5021, 5022, 5023, 5031, 5041, 5043, 5044, 5051, 5061, 5062, 5064, 5063, 5071,
|
|
@@ -68,13 +68,17 @@ export default class BuildingEntranceService extends GwrService {
|
|
|
68
68
|
const xmlErrors = await response.text();
|
|
69
69
|
// Throw specific error message for
|
|
70
70
|
// mismatched locality - zip code errors
|
|
71
|
-
const errors = this.extractErrorsFromXML(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
const errors = this.extractErrorsFromXML(xmlErrors, [
|
|
72
|
+
{
|
|
73
|
+
errorKey: this.BuildingEntrance.LOCALITY_ERROR,
|
|
74
|
+
errorMessage: this.intl.t(
|
|
75
|
+
"ember-gwr.buildingEntrance.localityError",
|
|
76
|
+
{
|
|
77
|
+
htmlSafe: true,
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
},
|
|
81
|
+
]);
|
|
78
82
|
|
|
79
83
|
console.error("GWR API: addBuildingEntrance failed");
|
|
80
84
|
throw errors;
|
|
@@ -103,7 +107,7 @@ export default class BuildingEntranceService extends GwrService {
|
|
|
103
107
|
);
|
|
104
108
|
if (!response.ok) {
|
|
105
109
|
const xmlErrors = await response.text();
|
|
106
|
-
const errors = this.extractErrorsFromXML(xmlErrors
|
|
110
|
+
const errors = this.extractErrorsFromXML(xmlErrors);
|
|
107
111
|
|
|
108
112
|
console.error("GWR API: deactivateBuildingEntrance failed");
|
|
109
113
|
throw errors;
|
|
@@ -72,7 +72,14 @@ export default class BuildingService extends GwrService {
|
|
|
72
72
|
|
|
73
73
|
if (!response.ok) {
|
|
74
74
|
const xmlErrors = await response.text();
|
|
75
|
-
const errors = this.extractErrorsFromXML(xmlErrors
|
|
75
|
+
const errors = this.extractErrorsFromXML(xmlErrors, [
|
|
76
|
+
{
|
|
77
|
+
errorKey: Building.FORBIDDEN_BUILDING_CLASS_ERROR,
|
|
78
|
+
errorMessage: this.intl.t(
|
|
79
|
+
"ember-gwr.building.forbiddenBuildingClassError"
|
|
80
|
+
),
|
|
81
|
+
},
|
|
82
|
+
]);
|
|
76
83
|
|
|
77
84
|
console.error("GWR API: modifyBuilding failed");
|
|
78
85
|
throw errors;
|
|
@@ -101,15 +108,25 @@ export default class BuildingService extends GwrService {
|
|
|
101
108
|
|
|
102
109
|
if (!response.ok) {
|
|
103
110
|
const xmlErrors = await response.text();
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
111
|
+
const errors = this.extractErrorsFromXML(xmlErrors, [
|
|
112
|
+
{
|
|
113
|
+
errorKey: Building.FORBIDDEN_BUILDING_CLASS_ERROR,
|
|
114
|
+
|
|
115
|
+
errorMessage: this.intl.t(
|
|
116
|
+
"ember-gwr.building.forbiddenBuildingClassError"
|
|
117
|
+
),
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
{
|
|
121
|
+
errorKey: this.BuildingEntrance.LOCALITY_ERROR,
|
|
122
|
+
errorMessage: this.intl.t(
|
|
123
|
+
"ember-gwr.building.buildingEntrance.localityError",
|
|
124
|
+
{
|
|
125
|
+
htmlSafe: true,
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
},
|
|
129
|
+
]);
|
|
113
130
|
|
|
114
131
|
await this.constructionProject.removeWorkFromProject(EPROID, work.ARBID);
|
|
115
132
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { inject as service } from "@ember/service";
|
|
2
2
|
import { task, lastValue } from "ember-concurrency";
|
|
3
3
|
import Building from "ember-ebau-gwr/models/building";
|
|
4
|
-
import BuildingWork from "ember-ebau-gwr/models/building-work";
|
|
5
4
|
import ConstructionProject from "ember-ebau-gwr/models/construction-project";
|
|
6
5
|
import ConstructionProjectsList from "ember-ebau-gwr/models/construction-projects-list";
|
|
7
6
|
import Dwelling from "ember-ebau-gwr/models/dwelling";
|
|
@@ -72,12 +71,6 @@ export default class ConstructionProjectService extends GwrService {
|
|
|
72
71
|
return this.createAndCache(xml);
|
|
73
72
|
}
|
|
74
73
|
|
|
75
|
-
async addDefaultWork(projectId) {
|
|
76
|
-
const buildingWork = new BuildingWork();
|
|
77
|
-
buildingWork.kindOfWork = 6001;
|
|
78
|
-
return await this.addWorkToProject(projectId, buildingWork);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
74
|
async addWorkToProject(projectId, buildingWork) {
|
|
82
75
|
const body = this.xml.buildXMLRequest("addWorkToProject", buildingWork);
|
|
83
76
|
const response = await this.authFetch.fetch(
|
|
@@ -737,11 +730,14 @@ export default class ConstructionProjectService extends GwrService {
|
|
|
737
730
|
|
|
738
731
|
if (!response.ok) {
|
|
739
732
|
const xmlErrors = await response.text();
|
|
740
|
-
const errors = this.extractErrorsFromXML(
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
733
|
+
const errors = this.extractErrorsFromXML(xmlErrors, [
|
|
734
|
+
{
|
|
735
|
+
errorKey: this.ConstructionProject.MISSING_BUILDING_ERROR,
|
|
736
|
+
errorMessage: this.intl.t(
|
|
737
|
+
"ember-gwr.constructionProject.missingBuildingError"
|
|
738
|
+
),
|
|
739
|
+
},
|
|
740
|
+
]);
|
|
745
741
|
|
|
746
742
|
console.error(`GWR API: ${transition} failed`);
|
|
747
743
|
throw errors;
|
package/addon/services/gwr.js
CHANGED
|
@@ -113,7 +113,8 @@ export default class GwrService extends Service {
|
|
|
113
113
|
})[searchKey];
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
// (xml: String, errorsToMatch: [{errorKey: String,errorMsg: String}]) => [String]
|
|
117
|
+
extractErrorsFromXML(xml, errorsToMatch = []) {
|
|
117
118
|
const model = new XMLModel(xml);
|
|
118
119
|
model.setFieldsFromXML({
|
|
119
120
|
fields: {
|
|
@@ -122,18 +123,16 @@ export default class GwrService extends Service {
|
|
|
122
123
|
},
|
|
123
124
|
});
|
|
124
125
|
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return errors;
|
|
126
|
+
const customErrors =
|
|
127
|
+
model.error?.map(
|
|
128
|
+
(error) =>
|
|
129
|
+
errorsToMatch.find(({ errorKey }) => error === errorKey)
|
|
130
|
+
?.errorMessage ??
|
|
131
|
+
this.intl.t("ember-gwr.generalErrors.genericFormError")
|
|
132
|
+
) ?? [];
|
|
133
|
+
return customErrors.concat(
|
|
134
|
+
model.errorList?.map((error) => error.messageOfError) ?? []
|
|
135
|
+
);
|
|
137
136
|
}
|
|
138
137
|
|
|
139
138
|
concatStates(states) {
|
|
@@ -97,6 +97,14 @@
|
|
|
97
97
|
@type="checkbox"
|
|
98
98
|
@disabled={{true}}
|
|
99
99
|
/>
|
|
100
|
+
<div uk-alert>
|
|
101
|
+
<div class="uk-text-bold">
|
|
102
|
+
{{t "ember-gwr.dwelling.dwellingUsage.mainAndSecondaryResidenceInfoHeading"}}
|
|
103
|
+
</div>
|
|
104
|
+
<div>
|
|
105
|
+
{{t "ember-gwr.dwelling.dwellingUsage.mainAndSecondaryResidenceInfo"}}
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
100
108
|
<Field
|
|
101
109
|
@attr="dwellingUsage.dateFirstOccupancy"
|
|
102
110
|
@type="date"
|