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.
Files changed (116) hide show
  1. package/.github/workflows/release.yml +2 -0
  2. package/CHANGELOG.md +95 -0
  3. package/addon/components/back-route.hbs +10 -0
  4. package/addon/components/import-modal/building-data.hbs +64 -0
  5. package/addon/components/import-modal/dwelling-data.hbs +30 -0
  6. package/addon/components/import-modal/entrance-data.hbs +14 -0
  7. package/addon/components/import-modal.hbs +54 -0
  8. package/addon/components/import-modal.js +6 -0
  9. package/addon/components/link-building-modal.hbs +1 -1
  10. package/addon/components/link-building-modal.js +2 -0
  11. package/addon/components/link-street.hbs +105 -0
  12. package/addon/components/link-street.js +24 -0
  13. package/addon/components/linked-models.hbs +12 -6
  14. package/addon/components/linked-models.js +6 -0
  15. package/addon/components/linked-projects.hbs +1 -1
  16. package/addon/components/linked-projects.js +6 -0
  17. package/addon/components/model-errors/error-indicator.hbs +3 -1
  18. package/addon/components/model-errors/header.hbs +4 -2
  19. package/addon/components/model-errors.hbs +1 -0
  20. package/addon/components/model-form/date.hbs +1 -0
  21. package/addon/components/model-form/date.js +6 -6
  22. package/addon/components/model-form/diff.hbs +40 -27
  23. package/addon/components/model-form/field.hbs +13 -8
  24. package/addon/components/model-form/field.js +36 -9
  25. package/addon/components/model-form/header/actions.hbs +70 -36
  26. package/addon/components/model-form/header/actions.js +6 -0
  27. package/addon/components/model-form/header/status-selector/submit-parameters.hbs +1 -1
  28. package/addon/components/model-form/header/status-selector.hbs +1 -1
  29. package/addon/components/model-form/header.hbs +4 -2
  30. package/addon/components/model-form/submit-errors.hbs +41 -23
  31. package/addon/components/model-form.hbs +6 -5
  32. package/addon/components/model-form.js +25 -5
  33. package/addon/components/model-inview.hbs +8 -0
  34. package/addon/components/model-inview.js +12 -0
  35. package/addon/components/project-form/date.hbs +1 -1
  36. package/addon/components/project-form/field.hbs +1 -1
  37. package/addon/components/project-form/field.js +5 -1
  38. package/addon/components/search/filters.hbs +0 -5
  39. package/addon/components/search/filters.js +1 -3
  40. package/addon/components/sub-nav.hbs +5 -10
  41. package/addon/controllers/building/edit/dwelling/edit.js +27 -32
  42. package/addon/controllers/building/edit/dwellings.js +1 -1
  43. package/addon/controllers/building/edit/entrance/edit/index.js +26 -13
  44. package/addon/controllers/building/edit/entrance/edit/link-street.js +45 -20
  45. package/addon/controllers/building/edit/entrances.js +18 -2
  46. package/addon/controllers/building/edit/form.js +29 -44
  47. package/addon/controllers/import.js +70 -0
  48. package/addon/controllers/project/errors.js +25 -29
  49. package/addon/controllers/project/form.js +35 -48
  50. package/addon/controllers/project.js +2 -1
  51. package/addon/helpers/housing-stat-link.js +13 -0
  52. package/addon/helpers/is-unset.js +7 -0
  53. package/addon/helpers/show-model-field.js +13 -0
  54. package/addon/models/address.js +39 -9
  55. package/addon/models/building-entrance.js +17 -7
  56. package/addon/models/building.js +74 -75
  57. package/addon/models/client.js +1 -1
  58. package/addon/models/construction-project.js +18 -16
  59. package/addon/models/date-partially-known.js +1 -1
  60. package/addon/models/dwelling.js +28 -1
  61. package/addon/models/heating.js +1 -1
  62. package/addon/models/identification.js +2 -1
  63. package/addon/models/options.js +251 -1
  64. package/addon/models/organisation-identification.js +6 -3
  65. package/addon/models/realestate-identification.js +0 -6
  66. package/addon/models/street.js +2 -0
  67. package/addon/models/xml-model.js +18 -7
  68. package/addon/models.js +2 -1
  69. package/addon/routes/building/edit/entrance/edit/index.js +0 -2
  70. package/addon/routes/building/edit/entrance/edit/link-street.js +10 -1
  71. package/addon/routes/building/edit/entrance/new.js +9 -16
  72. package/addon/routes/building/edit/index.js +8 -1
  73. package/addon/routes/building/new.js +10 -1
  74. package/addon/routes/project/form.js +5 -0
  75. package/addon/routes/project/new.js +3 -2
  76. package/addon/services/building-entrance.js +13 -9
  77. package/addon/services/building.js +195 -193
  78. package/addon/services/construction-project.js +140 -152
  79. package/addon/services/gwr.js +47 -2
  80. package/addon/services/street.js +10 -0
  81. package/addon/templates/building/edit/dwelling/edit.hbs +29 -6
  82. package/addon/templates/building/edit/dwellings.hbs +7 -4
  83. package/addon/templates/building/edit/entrance/edit/index.hbs +49 -84
  84. package/addon/templates/building/edit/entrance/edit/link-street.hbs +41 -12
  85. package/addon/templates/building/edit/entrances.hbs +6 -3
  86. package/addon/templates/building/edit/form.hbs +75 -21
  87. package/addon/templates/project/errors.hbs +121 -132
  88. package/addon/templates/project/form.hbs +126 -97
  89. package/addon/templates/project/linked-buildings.hbs +13 -20
  90. package/addon/templates/project.hbs +29 -19
  91. package/addon/templates/search-building.hbs +6 -0
  92. package/addon/templates/search-project.hbs +6 -0
  93. package/addon/utils.js +8 -0
  94. package/addon/validations/building-entrance.js +6 -4
  95. package/addon/validations/building-work.js +131 -11
  96. package/addon/validations/construction-project.js +154 -6
  97. package/addon/validations/coordinates.js +2 -2
  98. package/addon/validations/dwelling.js +61 -6
  99. package/addon/validations/realestate-identification.js +9 -9
  100. package/addon/validations/status/status-project-change.js +1 -1
  101. package/addon/validations/status/status-project-correction.js +1 -1
  102. package/addon/validators/range-state.js +27 -0
  103. package/addon/xml/helpers.js +4 -0
  104. package/addon/xml/templates/building-entrance.js +0 -14
  105. package/addon/xml/templates/building.js +0 -6
  106. package/addon/xml/templates/construction-project.js +2 -9
  107. package/addon/xml/templates/street.js +1 -7
  108. package/app/styles/ember-ebau-gwr.scss +32 -5
  109. package/config/environment.js +3 -0
  110. package/package.json +2 -2
  111. package/translations/building/de.yaml +13 -8
  112. package/translations/building-entrance/de.yaml +4 -10
  113. package/translations/construction-project/de.yaml +270 -15
  114. package/translations/de.yaml +46 -13
  115. package/translations/dwelling/de.yaml +14 -0
  116. package/translations/locality/de.yaml +2 -0
@@ -1,11 +1,14 @@
1
1
  import { inject as service } from "@ember/service";
2
2
  import Building from "ember-ebau-gwr/models/building";
3
+ import BuildingEntrance from "ember-ebau-gwr/models/building-entrance";
3
4
  import BuildingsList from "ember-ebau-gwr/models/buildings-list";
4
5
  import Dwelling from "ember-ebau-gwr/models/dwelling";
5
6
 
6
7
  import GwrService from "./gwr";
7
8
 
8
9
  export default class BuildingService extends GwrService {
10
+ BuildingEntrance = BuildingEntrance;
11
+
9
12
  @service constructionProject;
10
13
  @service dwelling;
11
14
 
@@ -98,9 +101,18 @@ export default class BuildingService extends GwrService {
98
101
 
99
102
  if (!response.ok) {
100
103
  const xmlErrors = await response.text();
101
- const errors = this.extractErrorsFromXML(xmlErrors);
104
+ // Throw specific error message for
105
+ // mismatched locality - zip code errors
106
+ const errors = this.extractErrorsFromXML(
107
+ xmlErrors,
108
+ this.BuildingEntrance.LOCALITY_ERROR,
109
+ this.intl.t("ember-gwr.building.buildingEntrance.localityError")
110
+ );
102
111
 
103
112
  await this.constructionProject.removeWorkFromProject(EPROID, work.ARBID);
113
+
114
+ buildingWork.ARBID = undefined;
115
+ buildingWork.isNew = true;
104
116
  console.error("GWR API: addBuildingToConstructionProject failed");
105
117
  throw errors;
106
118
  }
@@ -141,37 +153,36 @@ export default class BuildingService extends GwrService {
141
153
  buildingWork
142
154
  ) {
143
155
  await Promise.all(
144
- buildingWork.building.buildingEntrance.map(
145
- async (buildingEntrance) =>
146
- await Promise.all(
147
- buildingEntrance.dwelling.map(async (dwelling) => {
148
- if (
149
- [Dwelling.STATUS_PROJECTED, Dwelling.STATUS_APPROVED].includes(
150
- dwelling.dwellingStatus
151
- )
152
- ) {
153
- await this.dwelling.setToApprovedDwelling(
154
- "setToApprovedDwelling",
155
- cascadeLevel - 1,
156
- isDryRun,
157
- dwelling,
158
- buildingWork.building.EGID
159
- );
160
- } else {
161
- // Display message with link to dwelling with issue
162
- const states =
163
- cascadeLevel > 1
164
- ? [Dwelling.STATUS_PROJECTED, Dwelling.STATUS_APPROVED]
165
- : [Dwelling.STATUS_APPROVED];
166
- throw {
167
- isLifeCycleError: true,
168
- dwellingId: dwelling.EWID,
169
- buildingId: buildingWork.building.EGID,
170
- states,
171
- };
172
- }
173
- })
174
- )
156
+ buildingWork.building.buildingEntrance.map((buildingEntrance) =>
157
+ Promise.all(
158
+ buildingEntrance.dwelling.map(async (dwelling) => {
159
+ if (
160
+ [Dwelling.STATUS_PROJECTED, Dwelling.STATUS_APPROVED].includes(
161
+ dwelling.dwellingStatus
162
+ )
163
+ ) {
164
+ await this.dwelling.setToApprovedDwelling(
165
+ "setToApprovedDwelling",
166
+ cascadeLevel - 1,
167
+ isDryRun,
168
+ dwelling,
169
+ buildingWork.building.EGID
170
+ );
171
+ } else {
172
+ // Display message with link to dwelling with issue
173
+ const states =
174
+ cascadeLevel > 1
175
+ ? [Dwelling.STATUS_PROJECTED, Dwelling.STATUS_APPROVED]
176
+ : [Dwelling.STATUS_APPROVED];
177
+ throw {
178
+ isLifeCycleError: true,
179
+ dwellingId: dwelling.EWID,
180
+ buildingId: buildingWork.building.EGID,
181
+ states,
182
+ };
183
+ }
184
+ })
185
+ )
175
186
  )
176
187
  );
177
188
 
@@ -203,29 +214,28 @@ export default class BuildingService extends GwrService {
203
214
  buildingWork
204
215
  ) {
205
216
  await Promise.all(
206
- buildingWork.building.buildingEntrance.map(
207
- async (buildingEntrance) =>
208
- await Promise.all(
209
- buildingEntrance.dwelling.map(async (dwelling) => {
210
- if (
211
- ![
217
+ buildingWork.building.buildingEntrance.map((buildingEntrance) =>
218
+ Promise.all(
219
+ buildingEntrance.dwelling.map(async (dwelling) => {
220
+ if (
221
+ ![
222
+ Dwelling.STATUS_APPROVED,
223
+ Dwelling.STATUS_CONSTRUCTION_STARTED,
224
+ ].includes(dwelling.dwellingStatus)
225
+ ) {
226
+ // Display message with link to dwelling with issue
227
+ throw {
228
+ isLifeCycleError: true,
229
+ dwellingId: dwelling.EWID,
230
+ buildingId: buildingWork.building.EGID,
231
+ states: [
212
232
  Dwelling.STATUS_APPROVED,
213
233
  Dwelling.STATUS_CONSTRUCTION_STARTED,
214
- ].includes(dwelling.dwellingStatus)
215
- ) {
216
- // Display message with link to dwelling with issue
217
- throw {
218
- isLifeCycleError: true,
219
- dwellingId: dwelling.EWID,
220
- buildingId: buildingWork.building.EGID,
221
- states: [
222
- Dwelling.STATUS_APPROVED,
223
- Dwelling.STATUS_CONSTRUCTION_STARTED,
224
- ],
225
- };
226
- }
227
- })
228
- )
234
+ ],
235
+ };
236
+ }
237
+ })
238
+ )
229
239
  )
230
240
  );
231
241
 
@@ -259,31 +269,30 @@ export default class BuildingService extends GwrService {
259
269
  buildingWork
260
270
  ) {
261
271
  await Promise.all(
262
- buildingWork.building.buildingEntrance.map(
263
- async (buildingEntrance) =>
264
- await Promise.all(
265
- buildingEntrance.dwelling.map(async (dwelling) => {
266
- if (
267
- ![
272
+ buildingWork.building.buildingEntrance.map((buildingEntrance) =>
273
+ Promise.all(
274
+ buildingEntrance.dwelling.map(async (dwelling) => {
275
+ if (
276
+ ![
277
+ Dwelling.STATUS_APPROVED,
278
+ Dwelling.STATUS_CONSTRUCTION_STARTED,
279
+ Dwelling.STATUS_COMPLETED,
280
+ ].includes(dwelling.dwellingStatus)
281
+ ) {
282
+ // Display message with link to dwelling with issue
283
+ throw {
284
+ isLifeCycleError: true,
285
+ dwellingId: dwelling.EWID,
286
+ buildingId: buildingWork.building.EGID,
287
+ states: [
268
288
  Dwelling.STATUS_APPROVED,
269
289
  Dwelling.STATUS_CONSTRUCTION_STARTED,
270
290
  Dwelling.STATUS_COMPLETED,
271
- ].includes(dwelling.dwellingStatus)
272
- ) {
273
- // Display message with link to dwelling with issue
274
- throw {
275
- isLifeCycleError: true,
276
- dwellingId: dwelling.EWID,
277
- buildingId: buildingWork.building.EGID,
278
- states: [
279
- Dwelling.STATUS_APPROVED,
280
- Dwelling.STATUS_CONSTRUCTION_STARTED,
281
- Dwelling.STATUS_COMPLETED,
282
- ],
283
- };
284
- }
285
- })
286
- )
291
+ ],
292
+ };
293
+ }
294
+ })
295
+ )
287
296
  )
288
297
  );
289
298
 
@@ -315,47 +324,46 @@ export default class BuildingService extends GwrService {
315
324
  buildingWork
316
325
  ) {
317
326
  await Promise.all(
318
- buildingWork.building.buildingEntrance.map(
319
- async (buildingEntrance) =>
320
- await Promise.all(
321
- buildingEntrance.dwelling.map(async (dwelling) => {
322
- if (
323
- [
324
- Dwelling.STATUS_COMPLETED,
325
- Dwelling.STATUS_UNUSABLE,
326
- Dwelling.STATUS_DEMOLISHED,
327
- ].includes(dwelling.dwellingStatus)
328
- ) {
329
- if (dwelling.dwellingStatus !== Dwelling.STATUS_DEMOLISHED) {
330
- dwelling.yearOfDemolition =
331
- buildingWork.building.yearOfDemolition;
332
- }
333
- await this.dwelling.setToDemolishedDwelling(
334
- "setToDemolishedDwelling",
335
- cascadeLevel - 1,
336
- isDryRun,
337
- dwelling,
338
- buildingWork.building.EGID
339
- );
340
- } else {
341
- // Display message with link to dwelling with issue
342
- const states =
343
- cascadeLevel > 1
344
- ? [
345
- Dwelling.STATUS_COMPLETED,
346
- Dwelling.STATUS_UNUSABLE,
347
- Dwelling.STATUS_DEMOLISHED,
348
- ]
349
- : [Dwelling.STATUS_DEMOLISHED];
350
- throw {
351
- isLifeCycleError: true,
352
- dwellingId: dwelling.EWID,
353
- buildingId: buildingWork.building.EGID,
354
- states,
355
- };
327
+ buildingWork.building.buildingEntrance.map((buildingEntrance) =>
328
+ Promise.all(
329
+ buildingEntrance.dwelling.map(async (dwelling) => {
330
+ if (
331
+ [
332
+ Dwelling.STATUS_COMPLETED,
333
+ Dwelling.STATUS_UNUSABLE,
334
+ Dwelling.STATUS_DEMOLISHED,
335
+ ].includes(dwelling.dwellingStatus)
336
+ ) {
337
+ if (dwelling.dwellingStatus !== Dwelling.STATUS_DEMOLISHED) {
338
+ dwelling.yearOfDemolition =
339
+ buildingWork.building.yearOfDemolition;
356
340
  }
357
- })
358
- )
341
+ await this.dwelling.setToDemolishedDwelling(
342
+ "setToDemolishedDwelling",
343
+ cascadeLevel - 1,
344
+ isDryRun,
345
+ dwelling,
346
+ buildingWork.building.EGID
347
+ );
348
+ } else {
349
+ // Display message with link to dwelling with issue
350
+ const states =
351
+ cascadeLevel > 1
352
+ ? [
353
+ Dwelling.STATUS_COMPLETED,
354
+ Dwelling.STATUS_UNUSABLE,
355
+ Dwelling.STATUS_DEMOLISHED,
356
+ ]
357
+ : [Dwelling.STATUS_DEMOLISHED];
358
+ throw {
359
+ isLifeCycleError: true,
360
+ dwellingId: dwelling.EWID,
361
+ buildingId: buildingWork.building.EGID,
362
+ states,
363
+ };
364
+ }
365
+ })
366
+ )
359
367
  )
360
368
  );
361
369
 
@@ -387,45 +395,44 @@ export default class BuildingService extends GwrService {
387
395
  buildingWork
388
396
  ) {
389
397
  await Promise.all(
390
- buildingWork.building.buildingEntrance.map(
391
- async (buildingEntrance) =>
392
- await Promise.all(
393
- buildingEntrance.dwelling.map(async (dwelling) => {
394
- if (
395
- [
396
- Dwelling.STATUS_PROJECTED,
397
- Dwelling.STATUS_APPROVED,
398
- Dwelling.STATUS_CONSTRUCTION_STARTED,
399
- Dwelling.STATUS_NOT_REALIZED,
400
- ].includes(dwelling.dwellingStatus)
401
- ) {
402
- await this.dwelling.setToNotRealizedDwelling(
403
- "setToNotRealizedDwelling",
404
- cascadeLevel - 1,
405
- isDryRun,
406
- dwelling,
407
- buildingWork.building.EGID
408
- );
409
- } else {
410
- // Display message with link to dwelling with issue
411
- const states =
412
- cascadeLevel > 1
413
- ? [
414
- Dwelling.STATUS_PROJECTED,
415
- Dwelling.STATUS_APPROVED,
416
- Dwelling.STATUS_CONSTRUCTION_STARTED,
417
- Dwelling.STATUS_NOT_REALIZED,
418
- ]
419
- : [Dwelling.STATUS_NOT_REALIZED];
420
- throw {
421
- isLifeCycleError: true,
422
- dwellingId: dwelling.EWID,
423
- buildingId: buildingWork.building.EGID,
424
- states,
425
- };
426
- }
427
- })
428
- )
398
+ buildingWork.building.buildingEntrance.map((buildingEntrance) =>
399
+ Promise.all(
400
+ buildingEntrance.dwelling.map(async (dwelling) => {
401
+ if (
402
+ [
403
+ Dwelling.STATUS_PROJECTED,
404
+ Dwelling.STATUS_APPROVED,
405
+ Dwelling.STATUS_CONSTRUCTION_STARTED,
406
+ Dwelling.STATUS_NOT_REALIZED,
407
+ ].includes(dwelling.dwellingStatus)
408
+ ) {
409
+ await this.dwelling.setToNotRealizedDwelling(
410
+ "setToNotRealizedDwelling",
411
+ cascadeLevel - 1,
412
+ isDryRun,
413
+ dwelling,
414
+ buildingWork.building.EGID
415
+ );
416
+ } else {
417
+ // Display message with link to dwelling with issue
418
+ const states =
419
+ cascadeLevel > 1
420
+ ? [
421
+ Dwelling.STATUS_PROJECTED,
422
+ Dwelling.STATUS_APPROVED,
423
+ Dwelling.STATUS_CONSTRUCTION_STARTED,
424
+ Dwelling.STATUS_NOT_REALIZED,
425
+ ]
426
+ : [Dwelling.STATUS_NOT_REALIZED];
427
+ throw {
428
+ isLifeCycleError: true,
429
+ dwellingId: dwelling.EWID,
430
+ buildingId: buildingWork.building.EGID,
431
+ states,
432
+ };
433
+ }
434
+ })
435
+ )
429
436
  )
430
437
  );
431
438
 
@@ -457,41 +464,40 @@ export default class BuildingService extends GwrService {
457
464
  buildingWork
458
465
  ) {
459
466
  await Promise.all(
460
- buildingWork.building.buildingEntrance.map(
461
- async (buildingEntrance) =>
462
- await Promise.all(
463
- buildingEntrance.dwelling.map(async (dwelling) => {
464
- if (
465
- [
466
- Dwelling.STATUS_CONSTRUCTION_STARTED,
467
- Dwelling.STATUS_UNUSABLE,
468
- ].includes(dwelling.dwellingStatus)
469
- ) {
470
- await this.dwelling.setToUnusableDwelling(
471
- "setToUnusableDwelling",
472
- cascadeLevel - 1,
473
- isDryRun,
474
- dwelling,
475
- buildingWork.building.EGID
476
- );
477
- } else {
478
- // Display message with link to dwelling with issue
479
- const states =
480
- cascadeLevel > 1
481
- ? [
482
- Dwelling.STATUS_CONSTRUCTION_STARTED,
483
- Dwelling.STATUS_UNUSABLE,
484
- ]
485
- : [Dwelling.STATUS_UNUSABLE];
486
- throw {
487
- isLifeCycleError: true,
488
- dwellingId: dwelling.EWID,
489
- buildingId: buildingWork.building.EGID,
490
- states,
491
- };
492
- }
493
- })
494
- )
467
+ buildingWork.building.buildingEntrance.map((buildingEntrance) =>
468
+ Promise.all(
469
+ buildingEntrance.dwelling.map(async (dwelling) => {
470
+ if (
471
+ [
472
+ Dwelling.STATUS_CONSTRUCTION_STARTED,
473
+ Dwelling.STATUS_UNUSABLE,
474
+ ].includes(dwelling.dwellingStatus)
475
+ ) {
476
+ await this.dwelling.setToUnusableDwelling(
477
+ "setToUnusableDwelling",
478
+ cascadeLevel - 1,
479
+ isDryRun,
480
+ dwelling,
481
+ buildingWork.building.EGID
482
+ );
483
+ } else {
484
+ // Display message with link to dwelling with issue
485
+ const states =
486
+ cascadeLevel > 1
487
+ ? [
488
+ Dwelling.STATUS_CONSTRUCTION_STARTED,
489
+ Dwelling.STATUS_UNUSABLE,
490
+ ]
491
+ : [Dwelling.STATUS_UNUSABLE];
492
+ throw {
493
+ isLifeCycleError: true,
494
+ dwellingId: dwelling.EWID,
495
+ buildingId: buildingWork.building.EGID,
496
+ states,
497
+ };
498
+ }
499
+ })
500
+ )
495
501
  )
496
502
  );
497
503
 
@@ -552,8 +558,4 @@ export default class BuildingService extends GwrService {
552
558
  getCorrectionParameters(newStatus) {
553
559
  return Building.buildingTransitionParametersMapping[newStatus];
554
560
  }
555
-
556
- getChangeHint(currentStatus, newStatus) {
557
- return Building.buildingTransitionHint[currentStatus][newStatus];
558
- }
559
561
  }