ember-ebau-gwr 3.1.1 → 3.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/addon/components/back-route.hbs +10 -0
  3. package/addon/components/import-modal/dwelling-data.hbs +10 -1
  4. package/addon/components/linked-models.hbs +11 -5
  5. package/addon/components/model-errors/error-indicator.hbs +3 -1
  6. package/addon/components/model-errors/header.hbs +4 -2
  7. package/addon/components/model-errors.hbs +1 -0
  8. package/addon/components/model-form/field.js +5 -2
  9. package/addon/components/model-form/header/actions.hbs +10 -5
  10. package/addon/components/model-form/header/actions.js +3 -0
  11. package/addon/components/model-form.js +9 -1
  12. package/addon/components/model-inview.hbs +8 -0
  13. package/addon/components/model-inview.js +12 -0
  14. package/addon/components/sub-nav.hbs +5 -10
  15. package/addon/controllers/building/edit/dwelling/edit.js +2 -2
  16. package/addon/controllers/building/edit/form.js +0 -5
  17. package/addon/controllers/import.js +12 -4
  18. package/addon/controllers/project/errors.js +25 -29
  19. package/addon/controllers/project/form.js +25 -5
  20. package/addon/controllers/project.js +1 -1
  21. package/addon/helpers/housing-stat-link.js +13 -0
  22. package/addon/helpers/show-model-field.js +13 -0
  23. package/addon/models/building.js +1 -1
  24. package/addon/models/construction-project.js +1 -1
  25. package/addon/models/options.js +251 -1
  26. package/addon/services/auth-fetch.js +11 -5
  27. package/addon/services/building.js +182 -192
  28. package/addon/services/construction-project.js +134 -145
  29. package/addon/services/gwr.js +4 -0
  30. package/addon/services/import-state.js +10 -0
  31. package/addon/templates/building/edit/dwelling/edit.hbs +25 -22
  32. package/addon/templates/building/edit/entrance/edit/index.hbs +1 -2
  33. package/addon/templates/building/edit/form.hbs +38 -16
  34. package/addon/templates/project/errors.hbs +121 -132
  35. package/addon/templates/project/form.hbs +87 -53
  36. package/addon/templates/project/linked-buildings.hbs +13 -20
  37. package/addon/templates/project.hbs +23 -17
  38. package/addon/templates/search-building.hbs +6 -0
  39. package/addon/templates/search-project.hbs +6 -0
  40. package/addon/utils.js +8 -0
  41. package/addon/validations/building-work.js +2 -0
  42. package/addon/validations/dwelling.js +0 -5
  43. package/app/styles/ember-ebau-gwr.scss +9 -1
  44. package/config/environment.js +3 -0
  45. package/package.json +1 -1
  46. package/translations/building/de.yaml +4 -8
  47. package/translations/building/fr.yaml +281 -0
  48. package/translations/building-entrance/fr.yaml +56 -0
  49. package/translations/construction-project/de.yaml +256 -4
  50. package/translations/construction-project/fr.yaml +430 -0
  51. package/translations/de.yaml +22 -3
  52. package/translations/dwelling/de.yaml +3 -2
  53. package/translations/dwelling/fr.yaml +88 -0
  54. package/translations/fr.yaml +337 -0
  55. package/translations/locality/fr.yaml +7 -0
  56. package/translations/street/fr.yaml +6 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,58 @@
1
+ # [3.4.0](https://github.com/adfinis-sygroup/ember-ebau-gwr/compare/v3.3.0...v3.4.0) (2021-12-29)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **ci:** make ember-release scenario optional ([3f665e9](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/3f665e9a1b950390927a831567a610fc609d9140))
7
+
8
+
9
+ ### Features
10
+
11
+ * **translations:** include French translation files ([a20d7b7](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/a20d7b7f7196655a1d324091dab2c78cb7d7b54c))
12
+
13
+ # [3.3.0](https://github.com/adfinis-sygroup/ember-ebau-gwr/compare/v3.2.1...v3.3.0) (2021-11-04)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **import:** add error handling for failed data imports ([c9980c1](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/c9980c1b1fa4037f4101dc7485dea1af914b99f3))
19
+
20
+
21
+ ### Features
22
+
23
+ * **import:** show floor type/number in dwelling import modal ([cde49d1](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/cde49d1f7a94dfdd5c4bd758057ce3f801e561c9))
24
+
25
+ ## [3.2.1](https://github.com/adfinis-sygroup/ember-ebau-gwr/compare/v3.2.0...v3.2.1) (2021-10-22)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * **login:** remain on login page after failed login attempt ([0ef2728](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/0ef2728ce097b1b892f2a62f5cb69ef4d5f5a60c))
31
+
32
+ # [3.2.0](https://github.com/adfinis-sygroup/ember-ebau-gwr/compare/v3.1.1...v3.2.0) (2021-10-18)
33
+
34
+
35
+ ### Bug Fixes
36
+
37
+ * **building:** add realestate id validation and surface / volume units ([6e8525f](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/6e8525fe696fb34e718d0c78cdc284c99782101d))
38
+ * **dates:** do not show construction / demolition dates on new models ([d7cc4ac](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/d7cc4ac2f071bcdf46a0184364c439cd37d0ed82))
39
+ * **dwelling:** do not show floor number field for ground floor ([dd96b5e](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/dd96b5e3ed419b2a0181944a93105ba9d19e2f3d))
40
+ * **dwelling:** refetch dwellings after dwelling update ([bf02e33](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/bf02e33dab1d242eb22810c8e87ee27377c21140))
41
+ * **entrance:** fix tooltip container on building entrance number ([d5eb009](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/d5eb0091dd554ba69a44cb1c621200bdfec7a26d))
42
+ * **header:** add scroll into view for status change ([7a3ee64](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/7a3ee645bd042689829f1050b65c7a33403e2203))
43
+ * **import:** show conditional fields during import ([0952c69](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/0952c69567b453cd05ca0145733e6410c90204a9))
44
+ * **import:** show import date fields and cast imported dates ([00fe1fa](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/00fe1fa9a468281d070ef500292e4e1953477ede))
45
+ * **project:** add hints for typeOfConstructionProject ([881a945](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/881a945fd6f69bcc5760c2ce5488c83d204ee41c))
46
+ * **project:** filter project list by local_id ([26c55e1](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/26c55e1807a417203ff9b0b4b2b942ad6464b11a))
47
+ * **translations:** fix some typos ([4227439](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/4227439a31190f4cbeb982041530a816925401cf))
48
+
49
+
50
+ ### Features
51
+
52
+ * **linked-models:** clarification info for object additions ([12d7886](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/12d7886d258b964a12860cfa7e2430412c9a149a))
53
+ * **project:** complete client country options ([bd36e3f](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/bd36e3ffe74094021a69ca60c8ff7d824ab55f3b))
54
+ * **search:** add back routes for building and project search ([a22c9d2](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/a22c9d2c42a624123814fbc59e449bec94032561))
55
+
1
56
  ## [3.1.1](https://github.com/adfinis-sygroup/ember-ebau-gwr/compare/v3.1.0...v3.1.1) (2021-10-01)
2
57
 
3
58
 
@@ -0,0 +1,10 @@
1
+ {{#if @backRoute}}
2
+ <LinkTo
3
+ @route={{@backRoute}}
4
+ @models={{if @backModel (array @backModel) (array)}}
5
+ class="uk-link-muted uk-margin-small-bottom"
6
+ >
7
+ <span uk-icon="icon: arrow-left"></span>
8
+ {{@backText}}
9
+ </LinkTo>
10
+ {{/if}}
@@ -1,6 +1,15 @@
1
1
  <span class="uk-flex uk-child-width-1-2">
2
2
  <span>{{t "ember-gwr.dwelling.floor"}}</span>
3
- <span class="uk-text-muted">{{or @model.floor "-"}}</span>
3
+ <span class="uk-text-muted">
4
+ {{#if @model.floorType}}
5
+ {{concat
6
+ (if @model.floorNumber (concat @model.floorNumber ". "))
7
+ (t (concat "ember-gwr.dwelling.floorTypeOptions." @model.floorType))
8
+ }}
9
+ {{else}}
10
+ {{"-"}}
11
+ {{/if}}
12
+ </span>
4
13
  </span>
5
14
  <hr />
6
15
  <span class="uk-flex uk-child-width-1-2">
@@ -51,11 +51,15 @@
51
51
  <LinkTo
52
52
  @route={{@searchRoute}}
53
53
  @models={{or @searchModels (array)}}
54
- >
55
- {{t
56
- "ember-gwr.components.linkedModels.linkEntry"
57
- modelName=modelName
58
- }}
54
+ >
55
+ {{#if (eq @modelName "building")}}
56
+ {{t "ember-gwr.components.linkedModels.linkExistingBuilding"}}
57
+ {{else}}
58
+ {{t
59
+ "ember-gwr.components.linkedModels.linkEntry"
60
+ modelName=modelName
61
+ }}
62
+ {{/if}}
59
63
  </LinkTo>
60
64
  {{/if}}
61
65
  {{#if (and @searchRoute @newRoute)}}
@@ -66,6 +70,7 @@
66
70
  {{t
67
71
  "ember-gwr.components.linkedModels.createEntry"
68
72
  modelName=modelName
73
+ model=@modelName
69
74
  }}
70
75
  </LinkTo>
71
76
  {{else if @addLink}}
@@ -77,6 +82,7 @@
77
82
  {{t
78
83
  "ember-gwr.components.linkedModels.createEntry"
79
84
  modelName=modelName
85
+ model=@modelName
80
86
  }}
81
87
  </button>
82
88
  {{/if}}
@@ -3,6 +3,8 @@
3
3
  class="uk-label uk-label-danger uk-margin-small-left uk-flex-inline
4
4
  uk-flex-middle uk-flex-center uk-flex-none uk-text-small uk-text-bold"
5
5
  >
6
- {{@errorCount}}
6
+ <small>
7
+ {{@errorCount}}
8
+ </small>
7
9
  </div>
8
10
  {{/if}}
@@ -1,6 +1,8 @@
1
1
  {{#unless @noHeader}}
2
2
  <div class="uk-flex-inline uk-flex-top uk-width-expand">
3
- <div class="uk-flex-none">
3
+ <div
4
+ class="uk-flex-none ember-ebau-gwr-model-id-width-{{if @smallHeaderIdWidth "small" "large"}}"
5
+ >
4
6
  <LinkTo
5
7
  class="uk-text-bold"
6
8
  @route={{@linkRoute}}
@@ -9,7 +11,7 @@
9
11
  {{@modelId}}
10
12
  </LinkTo>
11
13
  </div>
12
- <div class="uk-margin-left uk-flex uk-width-expand uk-flex-column">
14
+ <div class="uk-margin-small-left uk-flex uk-width-expand uk-flex-column">
13
15
  <div class="uk-flex-inline uk-flex-middle">
14
16
  <div class="uk-text-bold">
15
17
  {{@modelDescription}}
@@ -7,6 +7,7 @@
7
7
  @linkRoute={{@linkRoute}}
8
8
  @linkModels={{@linkModels}}
9
9
  @modelDescription={{@modelDescription}}
10
+ @smallHeaderIdWidth={{@smallHeaderIdWidth}}
10
11
  >
11
12
  {{#if (has-block)}}
12
13
  {{yield
@@ -2,6 +2,7 @@ import { get, action } from "@ember/object";
2
2
  import { inject as service } from "@ember/service";
3
3
  import Component from "@glimmer/component";
4
4
  import { tracked } from "@glimmer/tracking";
5
+ import { isIsoDate } from "ember-ebau-gwr/utils";
5
6
 
6
7
  export const converstionTypeMapping = {
7
8
  number: Number,
@@ -35,7 +36,8 @@ export default class ModelFormFieldComponent extends Component {
35
36
  if (this.args.importData) {
36
37
  return (
37
38
  !this.diffResolved &&
38
- this.importValue &&
39
+ this.importValue !== null &&
40
+ this.importValue !== undefined &&
39
41
  this.importValue !== this.value
40
42
  );
41
43
  }
@@ -101,7 +103,8 @@ export default class ModelFormFieldComponent extends Component {
101
103
  if (this.args.update) {
102
104
  this.args.update(attr, value);
103
105
  } else {
104
- this.args.model.set(attr, value);
106
+ // Date casts necessary for import
107
+ this.args.model.set(attr, isIsoDate(value) ? new Date(value) : value);
105
108
 
106
109
  if (this.args.importData) {
107
110
  this.diffResolved = true;
@@ -78,11 +78,15 @@
78
78
  {{#if @modelHasImport}}
79
79
  <li>
80
80
  <LinkTo
81
- @disabled={{@import}}
81
+ @disabled={{or @import this.importState.hasError}}
82
82
  @query={{hash import=true}}
83
83
  class="uk-button uk-text-left uk-highlight-hover
84
- {{if @import "uk-text-muted" "uk-text-secondary"}}
84
+ {{if (or @import this.importState.hasError) "uk-text-muted" "uk-text-secondary"}}
85
85
  uk-width-1-1 uk-background-default uk-padding-remove"
86
+ {{on "click" (fn (mut this.showImportModal) true)}}
87
+ uk-tooltip="title: {{if this.importState.hasError
88
+ (t "ember-gwr.components.modelForm.importError")
89
+ }}; container: {{this.config.modalContainer}}"
86
90
  >
87
91
  {{t "ember-gwr.components.modelForm.importFromCaluma"}}
88
92
  </LinkTo>
@@ -90,13 +94,14 @@
90
94
  {{/if}}
91
95
  {{#if @hasStatus}}
92
96
  <li>
93
- <button
97
+ <a
98
+ href="#ember-ebau-gwr-status"
99
+ uk-scroll
94
100
  class="uk-button uk-text-left uk-highlight-hover uk-text-secondary uk-width-1-1 uk-background-default uk-padding-remove"
95
- type="button"
96
101
  {{on "click" @openStatus}}
97
102
  >
98
103
  {{t "ember-gwr.components.modelForm.changeStatus"}}
99
- </button>
104
+ </a>
100
105
  </li>
101
106
  {{/if}}
102
107
  </ul>
@@ -1,6 +1,9 @@
1
+ import { inject as service } from "@ember/service";
1
2
  import Component from "@glimmer/component";
2
3
  import { tracked } from "@glimmer/tracking";
3
4
 
4
5
  export default class ModelFormHeaderActionsComponent extends Component {
5
6
  @tracked showImportModal = false;
7
+ @service importState;
8
+ @service config;
6
9
  }
@@ -3,6 +3,7 @@ import { inject as service } from "@ember/service";
3
3
  import Component from "@glimmer/component";
4
4
  import { tracked } from "@glimmer/tracking";
5
5
  import { dropTask } from "ember-concurrency-decorators";
6
+ import { isIsoDate } from "ember-ebau-gwr/utils";
6
7
 
7
8
  export default class ModelFormComponent extends Component {
8
9
  @service router;
@@ -65,9 +66,16 @@ export default class ModelFormComponent extends Component {
65
66
  // set here...
66
67
  const deepMerge = (original, objectToApply) => {
67
68
  Object.entries(objectToApply).forEach(([key, value]) => {
68
- if (value !== null && value !== undefined) {
69
+ if (
70
+ original !== null &&
71
+ original !== undefined &&
72
+ value !== null &&
73
+ value !== undefined
74
+ ) {
69
75
  typeof value === "object"
70
76
  ? deepMerge(original[key], objectToApply[key])
77
+ : isIsoDate(value) // Date casts necessary for import
78
+ ? (original[key] = new Date(value))
71
79
  : (original[key] = value);
72
80
  }
73
81
  });
@@ -0,0 +1,8 @@
1
+ <div
2
+ class="inview-trigger"
3
+ {{on "inview" (perform this.fetch @model)}}
4
+ >
5
+ {{yield (hash
6
+ model=this.fetchedModel
7
+ )}}
8
+ </div>
@@ -0,0 +1,12 @@
1
+ import Component from "@glimmer/component";
2
+ import { tracked } from "@glimmer/tracking";
3
+ import { task } from "ember-concurrency-decorators";
4
+
5
+ export default class ModelInviewComponent extends Component {
6
+ @tracked fetchedModel;
7
+
8
+ @task
9
+ *fetch(model) {
10
+ this.fetchedModel = yield this.args.fetchModel(model);
11
+ }
12
+ }
@@ -1,14 +1,9 @@
1
1
  {{#unless this.isHidden}}
2
- {{#if @backRoute}}
3
- <LinkTo
4
- @route={{@backRoute}}
5
- @models={{if @backModel (array @backModel) (array)}}
6
- class="uk-link-muted uk-margin-small-bottom"
7
- >
8
- <span uk-icon="icon: arrow-left"></span>
9
- {{@backText}}
10
- </LinkTo>
11
- {{/if}}
2
+ <BackRoute
3
+ @backRoute={{@backRoute}}
4
+ @backModel={{@backModel}}
5
+ @backText={{@backText}}
6
+ />
12
7
  <UkTab ...attributes as |Tab|>
13
8
  {{#each @links as |link|}}
14
9
  <Tab.link-item @route={{link.route}} @models={{link.models}}>
@@ -105,10 +105,10 @@ export default class BuildingEditDwellingEditController extends ImportController
105
105
  this.model.buildingId,
106
106
  this.dwelling
107
107
  );
108
- // Ensure dwelling list is refreshed
109
- this.building.clearCache(this.model.buildingId);
110
108
  }
111
109
  }
110
+ // Ensure dwelling list is refreshed
111
+ this.building.clearCache(this.model.buildingId);
112
112
  this.errors = [];
113
113
  this.notification.success(this.intl.t("ember-gwr.dwelling.saveSuccess"));
114
114
  } catch (error) {
@@ -202,9 +202,4 @@ export default class BuildingFormController extends ImportController {
202
202
  getCorrectionParameters(newStatus) {
203
203
  return this.buildingAPI.getCorrectionParameters(newStatus);
204
204
  }
205
-
206
- @action
207
- getChangeHint(currentStatus, newStatus) {
208
- return this.buildingAPI.getChangeHint(currentStatus, newStatus);
209
- }
210
205
  }
@@ -20,6 +20,7 @@ export default class ImportController extends Controller {
20
20
  ];
21
21
 
22
22
  @service dataImport;
23
+ @service importState;
23
24
 
24
25
  @tracked showImport = false;
25
26
  @tracked importIndex = undefined;
@@ -47,6 +48,7 @@ export default class ImportController extends Controller {
47
48
  resetImport() {
48
49
  this.showImport = false;
49
50
  this.importIndex = null;
51
+ this.importState.error = null;
50
52
  }
51
53
 
52
54
  @lastValue("fetchCalumaData") importData;
@@ -62,9 +64,15 @@ export default class ImportController extends Controller {
62
64
  "Must set `instanceId` on model.",
63
65
  this.model.instanceId !== null && this.model.instanceId !== undefined
64
66
  );
65
- return yield this.dataImport[IMPORT_MAP[this.importModelName]](
66
- this.model.instanceId,
67
- ...args
68
- );
67
+ try {
68
+ return yield this.dataImport[IMPORT_MAP[this.importModelName]](
69
+ this.model.instanceId,
70
+ ...args
71
+ );
72
+ } catch (error) {
73
+ console.error(error);
74
+ this.importState.error = error;
75
+ return error;
76
+ }
69
77
  }
70
78
  }
@@ -16,11 +16,6 @@ export default class ProjectErrorsController extends Controller {
16
16
  @service notification;
17
17
 
18
18
  @tracked projectErrorCount = 0;
19
- @tracked buildingErrorCount = {};
20
- @tracked entranceErrorCount = {};
21
- @tracked dwellingErrorCount = {};
22
-
23
- @tracked buildings = {};
24
19
 
25
20
  @lastValue("fetchProject") project;
26
21
  @restartableTask
@@ -34,34 +29,36 @@ export default class ProjectErrorsController extends Controller {
34
29
  return project;
35
30
  }
36
31
 
32
+ get workBuildings() {
33
+ return this.project.work
34
+ .filter((w) => !w.building.isNew)
35
+ .map((w) => w.building);
36
+ }
37
+
37
38
  @enqueueTask
38
39
  *fetchModel(buildingId) {
39
40
  // building response only contains entrances
40
- const building = yield this.building.getFromCacheOrApi(buildingId);
41
- this.buildingErrorCount = {
42
- ...this.buildingErrorCount,
43
- [buildingId]: building.errorList?.length ?? 0,
44
- };
41
+ const buildingWithErrors = yield this.building.getFromCacheOrApi(
42
+ buildingId
43
+ );
44
+ const buildingErrorCount = buildingWithErrors.errorList?.length ?? 0;
45
45
 
46
46
  // response contains both entrances and dwellings
47
47
  const projectBuilding = this.project.work.find(
48
48
  (buildingWork) => buildingWork.building.EGID === buildingId
49
49
  ).building;
50
50
 
51
- const entrances = yield Promise.all(
51
+ const entrancesWithErrors = yield Promise.all(
52
52
  projectBuilding.buildingEntrance.map((entrance) =>
53
53
  this.buildingEntrance.getFromCacheOrApi(entrance.EDID, buildingId)
54
54
  )
55
55
  );
56
56
 
57
- this.entranceErrorCount = {
58
- ...this.entranceErrorCount,
59
- [buildingId]: entrances
60
- .map((entrance) => entrance.errorList?.length ?? 0)
61
- .reduce((a, b) => a + b, 0),
62
- };
57
+ const entranceErrorCount = entrancesWithErrors
58
+ .map((entrance) => entrance.errorList?.length ?? 0)
59
+ .reduce((a, b) => a + b, 0);
63
60
 
64
- const dwellings = (yield Promise.all(
61
+ const dwellingsWithErrors = (yield Promise.all(
65
62
  projectBuilding.buildingEntrance.map((entrance) => {
66
63
  return Promise.all(
67
64
  entrance.dwelling.map((dwelling) =>
@@ -71,18 +68,17 @@ export default class ProjectErrorsController extends Controller {
71
68
  })
72
69
  )).flat();
73
70
 
74
- this.dwellingErrorCount = {
75
- ...this.dwellingErrorCount,
76
- [buildingId]: dwellings
77
- .map((dwelling) => dwelling.errorList?.length ?? 0)
78
- .reduce((a, b) => a + b, 0),
79
- };
71
+ const dwellingErrorCount = dwellingsWithErrors
72
+ .map((dwelling) => dwelling.dwelling.errorList?.length ?? 0)
73
+ .reduce((a, b) => a + b, 0);
80
74
 
81
- this.buildings = {
82
- ...this.buildings,
83
- [buildingId]: { building, entrances, dwellings },
75
+ return {
76
+ buildingWithErrors,
77
+ buildingErrorCount,
78
+ entrancesWithErrors,
79
+ entranceErrorCount,
80
+ dwellingsWithErrors,
81
+ dwellingErrorCount,
84
82
  };
85
-
86
- return building;
87
83
  }
88
84
  }
@@ -208,11 +208,6 @@ export default class ProjectFormController extends ImportController {
208
208
  return this.constructionProject.getCorrectionParameters(newStatus);
209
209
  }
210
210
 
211
- @action
212
- getChangeHint(currentStatus, newStatus) {
213
- return this.constructionProject.getChangeHint(currentStatus, newStatus);
214
- }
215
-
216
211
  @action
217
212
  updateWork(work, attr, value) {
218
213
  work[attr] = value;
@@ -305,6 +300,12 @@ export default class ProjectFormController extends ImportController {
305
300
  @action
306
301
  cancelTypeOfConstructionProjectChange() {
307
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;
308
309
  }
309
310
 
310
311
  get workWithoutBuildings() {
@@ -314,4 +315,23 @@ export default class ProjectFormController extends ImportController {
314
315
  get workWithBuildings() {
315
316
  return this.project.work.filter((work) => !work.building.isNew);
316
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
+ }
317
337
  }
@@ -65,6 +65,6 @@ export default class ProjectController extends Controller {
65
65
  .peekAll("gwr-link")
66
66
  .find(({ eproid }) => Number(eproid) === this.activeProject);
67
67
  await link.destroyRecord();
68
- await this.constructionProject.all.perform();
68
+ await this.constructionProject.all.perform(this.model);
69
69
  }
70
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);
@@ -325,7 +325,7 @@ export default class Building extends XMLModel {
325
325
  [this.STATUS_NOT_REALIZED]: [],
326
326
  };
327
327
 
328
- static buildingTransitionHint = {
328
+ static transitionHint = {
329
329
  [this.STATUS_PROJECTED]: {
330
330
  [this.STATUS_APPROVED]: true,
331
331
  [this.STATUS_NOT_REALIZED]: true,
@@ -372,7 +372,7 @@ export default class ConstructionProject extends XMLModel {
372
372
  ],
373
373
  };
374
374
 
375
- static projectTransitionHint = {
375
+ static transitionHint = {
376
376
  [this.STATUS_PROJECTED]: {
377
377
  [this.STATUS_APPROVED]: true,
378
378
  [this.STATUS_REFUSED]: true,