ember-ebau-gwr 3.1.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 (44) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/addon/components/back-route.hbs +10 -0
  3. package/addon/components/linked-models.hbs +11 -5
  4. package/addon/components/model-errors/error-indicator.hbs +3 -1
  5. package/addon/components/model-errors/header.hbs +4 -2
  6. package/addon/components/model-errors.hbs +1 -0
  7. package/addon/components/model-form/field.js +5 -2
  8. package/addon/components/model-form/header/actions.hbs +5 -3
  9. package/addon/components/model-form.js +9 -1
  10. package/addon/components/model-inview.hbs +8 -0
  11. package/addon/components/model-inview.js +12 -0
  12. package/addon/components/sub-nav.hbs +5 -10
  13. package/addon/controllers/building/edit/dwelling/edit.js +2 -2
  14. package/addon/controllers/building/edit/form.js +0 -5
  15. package/addon/controllers/project/errors.js +25 -29
  16. package/addon/controllers/project/form.js +25 -5
  17. package/addon/controllers/project.js +1 -1
  18. package/addon/helpers/housing-stat-link.js +13 -0
  19. package/addon/helpers/show-model-field.js +13 -0
  20. package/addon/models/building.js +1 -1
  21. package/addon/models/construction-project.js +1 -1
  22. package/addon/models/options.js +251 -1
  23. package/addon/services/building.js +182 -192
  24. package/addon/services/construction-project.js +134 -145
  25. package/addon/services/gwr.js +4 -0
  26. package/addon/templates/building/edit/dwelling/edit.hbs +25 -22
  27. package/addon/templates/building/edit/entrance/edit/index.hbs +1 -2
  28. package/addon/templates/building/edit/form.hbs +38 -16
  29. package/addon/templates/project/errors.hbs +121 -132
  30. package/addon/templates/project/form.hbs +87 -53
  31. package/addon/templates/project/linked-buildings.hbs +13 -20
  32. package/addon/templates/project.hbs +23 -17
  33. package/addon/templates/search-building.hbs +6 -0
  34. package/addon/templates/search-project.hbs +6 -0
  35. package/addon/utils.js +8 -0
  36. package/addon/validations/building-work.js +2 -0
  37. package/addon/validations/dwelling.js +0 -5
  38. package/app/styles/ember-ebau-gwr.scss +8 -0
  39. package/config/environment.js +3 -0
  40. package/package.json +1 -1
  41. package/translations/building/de.yaml +3 -5
  42. package/translations/construction-project/de.yaml +256 -4
  43. package/translations/de.yaml +21 -3
  44. package/translations/dwelling/de.yaml +3 -1
@@ -222,26 +222,25 @@ export default class ConstructionProjectService extends GwrService {
222
222
  }
223
223
  } else if (buildingWork.kindOfWork === 6002) {
224
224
  await Promise.all(
225
- buildingWork.building.buildingEntrance.map(
226
- async (buildingEntrance) =>
227
- await Promise.all(
228
- buildingEntrance.dwelling.map(async (dwelling) => {
229
- if (
230
- [
231
- Dwelling.STATUS_PROJECTED,
232
- Dwelling.STATUS_APPROVED,
233
- ].includes(dwelling.dwellingStatus)
234
- ) {
235
- await this.dwelling.setToApprovedDwelling(
236
- "setToApprovedDwelling",
237
- cascadeLevel - 1,
238
- isDryRun,
239
- dwelling,
240
- buildingWork.building.EGID
241
- );
242
- }
243
- })
244
- )
225
+ buildingWork.building.buildingEntrance.map((buildingEntrance) =>
226
+ Promise.all(
227
+ buildingEntrance.dwelling.map(async (dwelling) => {
228
+ if (
229
+ [
230
+ Dwelling.STATUS_PROJECTED,
231
+ Dwelling.STATUS_APPROVED,
232
+ ].includes(dwelling.dwellingStatus)
233
+ ) {
234
+ await this.dwelling.setToApprovedDwelling(
235
+ "setToApprovedDwelling",
236
+ cascadeLevel - 1,
237
+ isDryRun,
238
+ dwelling,
239
+ buildingWork.building.EGID
240
+ );
241
+ }
242
+ })
243
+ )
245
244
  )
246
245
  );
247
246
  }
@@ -305,27 +304,26 @@ export default class ConstructionProjectService extends GwrService {
305
304
  }
306
305
  } else if (buildingWork.kindOfWork === 6002) {
307
306
  await Promise.all(
308
- buildingWork.building.buildingEntrance.map(
309
- async (buildingEntrance) =>
310
- await Promise.all(
311
- buildingEntrance.dwelling.map(async (dwelling) => {
312
- if (
313
- [
314
- Dwelling.STATUS_PROJECTED,
315
- Dwelling.STATUS_APPROVED,
316
- Dwelling.STATUS_NOT_REALIZED,
317
- ].includes(dwelling.dwellingStatus)
318
- ) {
319
- await this.dwelling.setToNotRealizedDwelling(
320
- "setToNotRealizedDwelling",
321
- cascadeLevel - 1,
322
- isDryRun,
323
- dwelling,
324
- buildingWork.building.EGID
325
- );
326
- }
327
- })
328
- )
307
+ buildingWork.building.buildingEntrance.map((buildingEntrance) =>
308
+ Promise.all(
309
+ buildingEntrance.dwelling.map(async (dwelling) => {
310
+ if (
311
+ [
312
+ Dwelling.STATUS_PROJECTED,
313
+ Dwelling.STATUS_APPROVED,
314
+ Dwelling.STATUS_NOT_REALIZED,
315
+ ].includes(dwelling.dwellingStatus)
316
+ ) {
317
+ await this.dwelling.setToNotRealizedDwelling(
318
+ "setToNotRealizedDwelling",
319
+ cascadeLevel - 1,
320
+ isDryRun,
321
+ dwelling,
322
+ buildingWork.building.EGID
323
+ );
324
+ }
325
+ })
326
+ )
329
327
  )
330
328
  );
331
329
  }
@@ -406,33 +404,30 @@ export default class ConstructionProjectService extends GwrService {
406
404
  }
407
405
 
408
406
  await Promise.all(
409
- buildingWork.building.buildingEntrance.map(
410
- async (buildingEntrance) =>
411
- await Promise.all(
412
- buildingEntrance.dwelling.map(async (dwelling) => {
413
- if (buildingWork.kindOfWork === 6001) {
414
- if (dwelling.dwellingStatus !== Dwelling.STATUS_COMPLETED) {
415
- throw {
416
- isLifeCycleError: true,
417
- dwellingId: dwelling.EWID,
418
- buildingId: buildingWork.building.EGID,
419
- states: [Dwelling.STATUS_COMPLETED],
420
- };
421
- }
422
- } else if (buildingWork.kindOfWork === 6007) {
423
- if (
424
- dwelling.dwellingStatus !== Dwelling.STATUS_DEMOLISHED
425
- ) {
426
- throw {
427
- isLifeCycleError: true,
428
- dwellingId: dwelling.EWID,
429
- buildingId: buildingWork.building.EGID,
430
- states: [Dwelling.STATUS_DEMOLISHED],
431
- };
432
- }
407
+ buildingWork.building.buildingEntrance.map((buildingEntrance) =>
408
+ Promise.all(
409
+ buildingEntrance.dwelling.map(async (dwelling) => {
410
+ if (buildingWork.kindOfWork === 6001) {
411
+ if (dwelling.dwellingStatus !== Dwelling.STATUS_COMPLETED) {
412
+ throw {
413
+ isLifeCycleError: true,
414
+ dwellingId: dwelling.EWID,
415
+ buildingId: buildingWork.building.EGID,
416
+ states: [Dwelling.STATUS_COMPLETED],
417
+ };
433
418
  }
434
- })
435
- )
419
+ } else if (buildingWork.kindOfWork === 6007) {
420
+ if (dwelling.dwellingStatus !== Dwelling.STATUS_DEMOLISHED) {
421
+ throw {
422
+ isLifeCycleError: true,
423
+ dwellingId: dwelling.EWID,
424
+ buildingId: buildingWork.building.EGID,
425
+ states: [Dwelling.STATUS_DEMOLISHED],
426
+ };
427
+ }
428
+ }
429
+ })
430
+ )
436
431
  )
437
432
  );
438
433
  })
@@ -495,43 +490,42 @@ export default class ConstructionProjectService extends GwrService {
495
490
  }
496
491
  } else if (buildingWork.kindOfWork === 6002) {
497
492
  await Promise.all(
498
- buildingWork.building.buildingEntrance.map(
499
- async (buildingEntrance) =>
500
- await Promise.all(
501
- buildingEntrance.dwelling.map(async (dwelling) => {
502
- if (
503
- [
504
- Dwelling.STATUS_PROJECTED,
505
- Dwelling.STATUS_APPROVED,
506
- Dwelling.STATUS_NOT_REALIZED,
507
- ].includes(dwelling.dwellingStatus)
508
- ) {
509
- await this.dwelling.setToNotRealizedDwelling(
510
- "setToNotRealizedDwelling",
511
- cascadeLevel - 1,
512
- isDryRun,
513
- dwelling,
514
- buildingWork.building.EGID
515
- );
516
- } else {
517
- // Display message with link to dwelling with issue
518
- const states =
519
- cascadeLevel > 1
520
- ? [
521
- Dwelling.STATUS_PROJECTED,
522
- Dwelling.STATUS_APPROVED,
523
- Dwelling.STATUS_NOT_REALIZED,
524
- ]
525
- : [Dwelling.STATUS_NOT_REALIZED];
526
- throw {
527
- isLifeCycleError: true,
528
- dwellingId: dwelling.EWID,
529
- buildingId: buildingWork.building.EGID,
530
- states,
531
- };
532
- }
533
- })
534
- )
493
+ buildingWork.building.buildingEntrance.map((buildingEntrance) =>
494
+ Promise.all(
495
+ buildingEntrance.dwelling.map(async (dwelling) => {
496
+ if (
497
+ [
498
+ Dwelling.STATUS_PROJECTED,
499
+ Dwelling.STATUS_APPROVED,
500
+ Dwelling.STATUS_NOT_REALIZED,
501
+ ].includes(dwelling.dwellingStatus)
502
+ ) {
503
+ await this.dwelling.setToNotRealizedDwelling(
504
+ "setToNotRealizedDwelling",
505
+ cascadeLevel - 1,
506
+ isDryRun,
507
+ dwelling,
508
+ buildingWork.building.EGID
509
+ );
510
+ } else {
511
+ // Display message with link to dwelling with issue
512
+ const states =
513
+ cascadeLevel > 1
514
+ ? [
515
+ Dwelling.STATUS_PROJECTED,
516
+ Dwelling.STATUS_APPROVED,
517
+ Dwelling.STATUS_NOT_REALIZED,
518
+ ]
519
+ : [Dwelling.STATUS_NOT_REALIZED];
520
+ throw {
521
+ isLifeCycleError: true,
522
+ dwellingId: dwelling.EWID,
523
+ buildingId: buildingWork.building.EGID,
524
+ states,
525
+ };
526
+ }
527
+ })
528
+ )
535
529
  )
536
530
  );
537
531
  }
@@ -629,43 +623,42 @@ export default class ConstructionProjectService extends GwrService {
629
623
  }
630
624
  } else if (buildingWork.kindOfWork === 6002) {
631
625
  await Promise.all(
632
- buildingWork.building.buildingEntrance.map(
633
- async (buildingEntrance) =>
634
- await Promise.all(
635
- buildingEntrance.dwelling.map(async (dwelling) => {
636
- if (
637
- [
638
- Dwelling.STATUS_PROJECTED,
639
- Dwelling.STATUS_APPROVED,
640
- Dwelling.STATUS_NOT_REALIZED,
641
- ].includes(dwelling.dwellingStatus)
642
- ) {
643
- await this.dwelling.setToNotRealizedDwelling(
644
- "setToNotRealizedDwelling",
645
- cascadeLevel - 1,
646
- isDryRun,
647
- dwelling,
648
- buildingWork.building.EGID
649
- );
650
- } else {
651
- // Display message with link to dwelling with issue
652
- const states =
653
- cascadeLevel > 1
654
- ? [
655
- Dwelling.STATUS_PROJECTED,
656
- Dwelling.STATUS_APPROVED,
657
- Dwelling.STATUS_NOT_REALIZED,
658
- ]
659
- : [Dwelling.STATUS_NOT_REALIZED];
660
- throw {
661
- isLifeCycleError: true,
662
- dwellingId: dwelling.EWID,
663
- buildingId: buildingWork.building.EGID,
664
- states,
665
- };
666
- }
667
- })
668
- )
626
+ buildingWork.building.buildingEntrance.map((buildingEntrance) =>
627
+ Promise.all(
628
+ buildingEntrance.dwelling.map(async (dwelling) => {
629
+ if (
630
+ [
631
+ Dwelling.STATUS_PROJECTED,
632
+ Dwelling.STATUS_APPROVED,
633
+ Dwelling.STATUS_NOT_REALIZED,
634
+ ].includes(dwelling.dwellingStatus)
635
+ ) {
636
+ await this.dwelling.setToNotRealizedDwelling(
637
+ "setToNotRealizedDwelling",
638
+ cascadeLevel - 1,
639
+ isDryRun,
640
+ dwelling,
641
+ buildingWork.building.EGID
642
+ );
643
+ } else {
644
+ // Display message with link to dwelling with issue
645
+ const states =
646
+ cascadeLevel > 1
647
+ ? [
648
+ Dwelling.STATUS_PROJECTED,
649
+ Dwelling.STATUS_APPROVED,
650
+ Dwelling.STATUS_NOT_REALIZED,
651
+ ]
652
+ : [Dwelling.STATUS_NOT_REALIZED];
653
+ throw {
654
+ isLifeCycleError: true,
655
+ dwellingId: dwelling.EWID,
656
+ buildingId: buildingWork.building.EGID,
657
+ states,
658
+ };
659
+ }
660
+ })
661
+ )
669
662
  )
670
663
  );
671
664
  }
@@ -772,8 +765,4 @@ export default class ConstructionProjectService extends GwrService {
772
765
  }
773
766
  });
774
767
  }
775
-
776
- getChangeHint(currentStatus, newStatus) {
777
- return ConstructionProject.projectTransitionHint[currentStatus][newStatus];
778
- }
779
768
  }
@@ -149,4 +149,8 @@ export default class GwrService extends Service {
149
149
  }),
150
150
  };
151
151
  }
152
+
153
+ getChangeHint(cacheClass, currentStatus, newStatus) {
154
+ return cacheClass.transitionHint[currentStatus][newStatus];
155
+ }
152
156
  }
@@ -23,7 +23,7 @@
23
23
  @getChangeParameters={{this.getChangeParameters}}
24
24
  @getCorrectionParameters={{this.getCorrectionParameters}}
25
25
  @modelStatusField="dwellingStatus"
26
- as |Field|
26
+ as |Field changeset|
27
27
  >
28
28
  <Field
29
29
  @attr="EDID"
@@ -34,25 +34,25 @@
34
34
  @noPlaceholder={{true}}
35
35
  @required={{true}}
36
36
  />
37
- <div class="uk-flex uk-flex-top uk-child-width-1-2 uk-flex-between" >
38
- <div class="uk-margin-large-right">
39
- <Field
40
- @noMargin={{true}}
41
- @attr="floorNumber"
42
- @type="number"
43
- @required={{true}}
44
- />
45
- </div>
46
- <div>
47
- <Field
48
- @noMargin={{true}}
49
- @attr="floorType"
50
- @type="select" @required={{true}}
51
- @gwrEnumOptions={{this.Models.Dwelling.floorTypeOptions}}
52
- @hint={{t "ember-gwr.dwelling.floorNumberGroundFloorHint"}}
53
- />
54
- </div>
55
- </div>
37
+
38
+ <Field
39
+ @attr="floorType"
40
+ @type="select" @required={{true}}
41
+ @gwrEnumOptions={{this.Models.Dwelling.floorTypeOptions}}
42
+ @hint={{t "ember-gwr.dwelling.floorHint"}}
43
+ />
44
+
45
+ {{#if (or
46
+ (eq changeset.floorType 3101)
47
+ (eq changeset.floorType 3401)
48
+ (and this.import this.import.data.floorNumber)
49
+ )}}
50
+ <Field
51
+ @attr="floorNumber"
52
+ @type="number"
53
+ @required={{true}}
54
+ />
55
+ {{/if}}
56
56
 
57
57
  <Field @attr="multipleFloor" @type="checkbox" @required={{true}} />
58
58
  <Field @attr="physicalDwellingNo" />
@@ -67,8 +67,11 @@
67
67
  />
68
68
  <Field @attr="kitchen" @type="checkbox" />
69
69
  <Field @attr="surfaceAreaOfDwelling" @type="number" />
70
- <Field @attr="yearOfConstruction" @type="number" />
71
- <Field @attr="yearOfDemolition" @type="number" />
70
+
71
+ {{#if (or (not this.dwelling.isNew) this.import)}}
72
+ <Field @attr="yearOfConstruction" @type="number" />
73
+ <Field @attr="yearOfDemolition" @type="number" />
74
+ {{/if}}
72
75
 
73
76
  <h2>{{t "ember-gwr.dwelling.usage.heading"}}</h2>
74
77
  <Field
@@ -49,8 +49,7 @@
49
49
  this.hasNoStreet
50
50
  (t "ember-gwr.buildingEntrance.missingStreetInfo")
51
51
  }}
52
- ; container:
53
- {{this.config.modalContainer}}; pos: top-left"
52
+ ; container: {{this.config.modalContainer}}; pos: top-left"
54
53
  >
55
54
  <Field
56
55
  @attr="buildingEntranceNo"
@@ -35,7 +35,7 @@
35
35
  @onStatusCorrection={{this.correctState}}
36
36
  @getChangeParameters={{this.getChangeParameters}}
37
37
  @getCorrectionParameters={{this.getCorrectionParameters}}
38
- @getChangeHint={{this.getChangeHint}}
38
+ @getChangeHint={{fn this.gwr.getChangeHint this.buildingAPI.cacheClass}}
39
39
  @modelStatusField="buildingStatus"
40
40
  as |Field changeset|
41
41
  >
@@ -220,26 +220,26 @@
220
220
 
221
221
  <Field @attr="building.nameOfBuilding" />
222
222
 
223
- <Field @attr="building.dateOfConstruction.yearMonthDay" @type="date" />
224
- {{#if this.buildingWork.building.dateOfConstruction.year}}
225
- <Field @attr="building.dateOfConstruction.year" @disabled={{true}} />
226
- {{/if}}
227
- {{#if this.buildingWork.building.dateOfConstruction.yearMonth}}
228
- <Field
229
- @attr="building.dateOfConstruction.yearMonth"
230
- @disabled={{true}}
231
- />
232
- {{/if}}
233
- {{#if this.buildingWork.building.dateOfConstruction.periodOfConstruction}}
223
+ {{#if (or (not this.buildingWork.isNew) this.import)}}
224
+ <Field @attr="building.dateOfConstruction.yearMonthDay" @type="date" />
225
+ {{#if this.buildingWork.building.dateOfConstruction.year}}
226
+ <Field @attr="building.dateOfConstruction.year" @disabled={{true}} />
227
+ {{/if}}
228
+ {{#if this.buildingWork.building.dateOfConstruction.yearMonth}}
229
+ <Field
230
+ @attr="building.dateOfConstruction.yearMonth"
231
+ @disabled={{true}}
232
+ />
233
+ {{/if}}
234
234
  <Field
235
235
  @attr="building.dateOfConstruction.periodOfConstruction"
236
236
  @type="select"
237
237
  @convertValueTo="number"
238
238
  @gwrEnumOptions={{this.Models.DateOfConstruction.periodOfConstructionOptions}}
239
239
  />
240
- {{/if}}
241
240
 
242
- <Field @attr="building.yearOfDemolition" @type="number" />
241
+ <Field @attr="building.yearOfDemolition" @type="number" />
242
+ {{/if}}
243
243
 
244
244
  <h3>
245
245
  {{t "ember-gwr.components.modelForm.realEstateHeading"}}
@@ -312,7 +312,18 @@
312
312
  @label="ember-gwr.building.heating.revisionDate"
313
313
  />
314
314
 
315
- <ul uk-accordion>
315
+ <ul uk-accordion="active: {{if (or
316
+ (show-model-field
317
+ "building.thermotechnicalDeviceForHeating2.heatGeneratorHeating"
318
+ changeset
319
+ this.import
320
+ )
321
+ (show-model-field
322
+ "building.thermotechnicalDeviceForHeating2.energySourceHeating"
323
+ changeset
324
+ this.import
325
+ )) "0" false}}"
326
+ >
316
327
  <li>
317
328
  <a class="uk-accordion-title" href="#">
318
329
  <h4>
@@ -380,7 +391,18 @@
380
391
  @label="ember-gwr.building.heating.revisionDate"
381
392
  />
382
393
 
383
- <ul uk-accordion>
394
+ <ul uk-accordion="active: {{if (or
395
+ (show-model-field
396
+ "building.thermotechnicalDeviceForHeating2.heatGeneratorHeating"
397
+ changeset
398
+ this.import
399
+ )
400
+ (show-model-field
401
+ "building.thermotechnicalDeviceForHeating2.energySourceHeating"
402
+ changeset
403
+ this.import
404
+ )) "0" false}}"
405
+ >
384
406
  <li>
385
407
  <a class="uk-accordion-title" href="#">
386
408
  <h4>