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
@@ -28,6 +28,10 @@ export default class Dwelling extends XMLModel {
28
28
  // This is a frontend only state tracking property while creating new records.
29
29
  @tracked EDID;
30
30
 
31
+ // Frontend only tracking to display floor in form
32
+ @tracked floorType;
33
+ @tracked floorNumber;
34
+
31
35
  constructor(xmlOrObject, root = "dwelling") {
32
36
  super(xmlOrObject);
33
37
  this.setFieldsFromXML({
@@ -52,6 +56,17 @@ export default class Dwelling extends XMLModel {
52
56
  dwellingFreeText2: String,
53
57
  },
54
58
  });
59
+
60
+ const floor = Number(this.floor);
61
+ if (floor === 3100) {
62
+ this.floorType = 3100;
63
+ } else if (floor > 3100 && floor < 3200) {
64
+ this.floorType = 3101;
65
+ this.floorNumber = floor - 3100;
66
+ } else if (floor > 3400 && floor < 3420) {
67
+ this.floorType = 3401;
68
+ this.floorNumber = floor - 3400;
69
+ }
55
70
  }
56
71
 
57
72
  static template = `
@@ -94,6 +109,18 @@ export default class Dwelling extends XMLModel {
94
109
  3008, // Nicht realisiert
95
110
  ];
96
111
 
112
+ static floorTypeOptions = [
113
+ 3100, // Parterre
114
+ 3101, // Stock
115
+ 3401, // Untergeschoss
116
+ ];
117
+
118
+ get floorComplete() {
119
+ return this.floorType === 3100
120
+ ? this.floorType
121
+ : Number(this.floorType) + Number(this.floorNumber) - 1;
122
+ }
123
+
97
124
  get floorLabel() {
98
125
  const floor = Number(this.floor);
99
126
  return floor === 3100
@@ -220,7 +247,7 @@ export class DwellingUsage extends XMLModel {
220
247
  fields: {
221
248
  usageCode: Number,
222
249
  informationSource: Number,
223
- revisionDate: String,
250
+ revisionDate: Date,
224
251
  remark: String,
225
252
  personWithMainResidence: Boolean,
226
253
  personWithSecondaryResidence: Boolean,
@@ -14,7 +14,7 @@ export default class Heating extends XMLModel {
14
14
  fields: {
15
15
  energySourceHeating: Number,
16
16
  informationSourceHeating: Number,
17
- revisionDate: String,
17
+ revisionDate: Date,
18
18
  },
19
19
  });
20
20
  }
@@ -14,13 +14,14 @@ export default class Identification extends XMLModel {
14
14
  root,
15
15
  fields: {
16
16
  personIdentification: PersonIdentification,
17
+ organisationIdentification: OrganisationIdentification,
17
18
  },
18
19
  });
19
20
  }
20
21
 
21
22
  static template = `
22
23
  <identification>
23
- {{#if (eq model.typeOfClient 6161)}}
24
+ {{#if (eq typeOfClient 6161)}}
24
25
  {{> PersonIdentification model=model.personIdentification}}
25
26
  {{else}}
26
27
  {{> OrganisationIdentification model=model.organisationIdentification}}
@@ -116,7 +116,257 @@ export const projectStatusOptions = [
116
116
  6709,
117
117
  ];
118
118
 
119
- export const countryOptions = ["ch"];
119
+ export const countryOptions = [
120
+ "af",
121
+ "eg",
122
+ "ax",
123
+ "al",
124
+ "dz",
125
+ "as",
126
+ "ad",
127
+ "ao",
128
+ "ai",
129
+ "aq",
130
+ "ag",
131
+ "gq",
132
+ "ar",
133
+ "am",
134
+ "aw",
135
+ "az",
136
+ "et",
137
+ "au",
138
+ "bs",
139
+ "bh",
140
+ "bd",
141
+ "bb",
142
+ "by",
143
+ "be",
144
+ "bz",
145
+ "bj",
146
+ "bm",
147
+ "bt",
148
+ "bo",
149
+ "bq",
150
+ "ba",
151
+ "bw",
152
+ "bv",
153
+ "br",
154
+ "io",
155
+ "bn",
156
+ "bg",
157
+ "bf",
158
+ "bi",
159
+ "cl",
160
+ "cn",
161
+ "ck",
162
+ "cr",
163
+ "cw",
164
+ "dk",
165
+ "cd",
166
+ "de",
167
+ "dm",
168
+ "do",
169
+ "dj",
170
+ "ec",
171
+ "ci",
172
+ "sv",
173
+ "er",
174
+ "ee",
175
+ "sz",
176
+ "fk",
177
+ "fo",
178
+ "fj",
179
+ "fi",
180
+ "fr",
181
+ "tf",
182
+ "gf",
183
+ "pf",
184
+ "ga",
185
+ "gm",
186
+ "ge",
187
+ "gh",
188
+ "gi",
189
+ "gd",
190
+ "gr",
191
+ "gl",
192
+ "gp",
193
+ "gu",
194
+ "gt",
195
+ "gg",
196
+ "gw",
197
+ "gn",
198
+ "gy",
199
+ "ht",
200
+ "hm",
201
+ "hn",
202
+ "hk",
203
+ "in",
204
+ "id",
205
+ "im",
206
+ "iq",
207
+ "ir",
208
+ "ie",
209
+ "is",
210
+ "il",
211
+ "it",
212
+ "jm",
213
+ "jp",
214
+ "ye",
215
+ "je",
216
+ "jo",
217
+ "vg",
218
+ "vi",
219
+ "ky",
220
+ "kh",
221
+ "cm",
222
+ "ca",
223
+ "cv",
224
+ "kz",
225
+ "qa",
226
+ "ke",
227
+ "kg",
228
+ "ki",
229
+ "cc",
230
+ "co",
231
+ "km",
232
+ "xk",
233
+ "hr",
234
+ "cu",
235
+ "kw",
236
+ "la",
237
+ "ls",
238
+ "lv",
239
+ "lb",
240
+ "lr",
241
+ "ly",
242
+ "li",
243
+ "lt",
244
+ "lu",
245
+ "mo",
246
+ "mg",
247
+ "mw",
248
+ "my",
249
+ "mv",
250
+ "ml",
251
+ "mt",
252
+ "ma",
253
+ "mh",
254
+ "mq",
255
+ "mr",
256
+ "mu",
257
+ "yt",
258
+ "mx",
259
+ "fm",
260
+ "md",
261
+ "mc",
262
+ "mn",
263
+ "me",
264
+ "ms",
265
+ "mz",
266
+ "mm",
267
+ "na",
268
+ "nr",
269
+ "np",
270
+ "nc",
271
+ "nz",
272
+ "ni",
273
+ "nl",
274
+ "ng",
275
+ "ne",
276
+ "nu",
277
+ "kp",
278
+ "mp",
279
+ "mk",
280
+ "nf",
281
+ "no",
282
+ "om",
283
+ "at",
284
+ "tl",
285
+ "pk",
286
+ "ps",
287
+ "pw",
288
+ "pa",
289
+ "pg",
290
+ "py",
291
+ "pe",
292
+ "ph",
293
+ "pn",
294
+ "pl",
295
+ "pt",
296
+ "pr",
297
+ "cg",
298
+ "re",
299
+ "rw",
300
+ "ro",
301
+ "ru",
302
+ "mf",
303
+ "sb",
304
+ "zm",
305
+ "ws",
306
+ "bl",
307
+ "sm",
308
+ "st",
309
+ "sa",
310
+ "se",
311
+ "ch",
312
+ "sn",
313
+ "rs",
314
+ "sc",
315
+ "sl",
316
+ "zw",
317
+ "sg",
318
+ "sx",
319
+ "sk",
320
+ "si",
321
+ "so",
322
+ "es",
323
+ "lk",
324
+ "sh",
325
+ "kn",
326
+ "lc",
327
+ "pm",
328
+ "vc",
329
+ "za",
330
+ "sd",
331
+ "gs",
332
+ "kr",
333
+ "ss",
334
+ "sr",
335
+ "sj",
336
+ "sy",
337
+ "tj",
338
+ "tw",
339
+ "tz",
340
+ "th",
341
+ "tg",
342
+ "tk",
343
+ "to",
344
+ "tt",
345
+ "td",
346
+ "cz",
347
+ "tn",
348
+ "tr",
349
+ "tm",
350
+ "tc",
351
+ "tv",
352
+ "ug",
353
+ "ua",
354
+ "hu",
355
+ "uy",
356
+ "uz",
357
+ "vu",
358
+ "va",
359
+ "ve",
360
+ "ae",
361
+ "gb",
362
+ "us",
363
+ "vn",
364
+ "wf",
365
+ "cx",
366
+ "eh",
367
+ "cf",
368
+ "cy",
369
+ ];
120
370
 
121
371
  export const languageOptions = { de: 9901, fr: 9903, it: 9904 };
122
372
 
@@ -17,9 +17,12 @@ export class LocalOrganisationId extends XMLModel {
17
17
  }
18
18
 
19
19
  static template = `
20
+ {{!--TODO: Dummy values to prevent API errors. The API ignores whatever values
21
+ are entered and returns N/A. But throws an error if localOrganisationId isn't sent.
22
+ Remove once no longer required by API--}}
20
23
  <ns3:localOrganisationId>
21
- <ns3:organisationIdCategory>{{model.organisationIdCategory}}</ns3:organisationIdCategory>
22
- <ns3:organisationId>{{model.organisationId}}</ns3:organisationId>
24
+ <ns3:organisationIdCategory>-</ns3:organisationIdCategory>
25
+ <ns3:organisationId>-</ns3:organisationId>
23
26
  </ns3:localOrganisationId>
24
27
  `;
25
28
  }
@@ -46,7 +49,7 @@ export default class OrganisationIdentification extends XMLModel {
46
49
  {{> LocalOrganisationId model=model.localOrganisationId}}
47
50
 
48
51
  <ns3:organisationName>{{model.organisationName}}</ns3:organisationName>
49
- <ns3:organisationAdditionalName>{{model.organisationAdditionalName}}</ns3:organisationAdditionalName>
52
+ {{{modelField model "organisationAdditionalName" namespace="ns3:"}}}
50
53
  </organisationIdentification>
51
54
  `;
52
55
  }
@@ -5,9 +5,7 @@ import XMLModel from "./xml-model";
5
5
  export default class RealestateIdentification extends XMLModel {
6
6
  @tracked number;
7
7
  @tracked EGRID;
8
- @tracked numberSuffix;
9
8
  @tracked subDistrict;
10
- @tracked lot;
11
9
 
12
10
  constructor(...args) {
13
11
  super(...args);
@@ -15,9 +13,7 @@ export default class RealestateIdentification extends XMLModel {
15
13
  fields: {
16
14
  number: String,
17
15
  EGRID: String,
18
- numberSuffix: String,
19
16
  subDistrict: Number,
20
- lot: String,
21
17
  },
22
18
  });
23
19
  }
@@ -29,9 +25,7 @@ export default class RealestateIdentification extends XMLModel {
29
25
  <ns2:realestateIdentification>
30
26
  {{{modelField model "EGRID" namespace=""}}}
31
27
  <number>{{model.number}}</number>
32
- {{{modelField model "numberSuffix" namespace=""}}}
33
28
  {{{modelField model "subDistrict" namespace=""}}}
34
- {{{modelField model "lot" namespace=""}}}
35
29
  </ns2:realestateIdentification>
36
30
  {{/if}}
37
31
  `;
@@ -37,6 +37,7 @@ export default class Street extends XMLModel {
37
37
  @tracked streetStatus;
38
38
  @tracked streetGeometry;
39
39
  @tracked description = new StreetDescription();
40
+ @tracked locality = new Locality();
40
41
 
41
42
  constructor(xmlOrObject, root = "street") {
42
43
  super(xmlOrObject);
@@ -50,6 +51,7 @@ export default class Street extends XMLModel {
50
51
  streetStatus: Number,
51
52
  streetGeometry: String,
52
53
  description: StreetDescription,
54
+ locality: Locality,
53
55
  },
54
56
  });
55
57
  }
@@ -20,13 +20,24 @@ export default class XMLModel {
20
20
  castToType(element, type) {
21
21
  // We dont want to instantiate the types Number or String with new.
22
22
  // This would cause problems with comparison.
23
- return element.getAttribute("xsi:nil")
24
- ? null
25
- : element.children.length
26
- ? new type(element)
27
- : type === Boolean
28
- ? element.textContent === "true"
29
- : type(element.textContent);
23
+
24
+ if (element.getAttribute("xsi:nil")) {
25
+ return null;
26
+ }
27
+
28
+ if (element.children.length) {
29
+ return new type(element);
30
+ }
31
+
32
+ if (type === Boolean) {
33
+ return element.textContent === "true";
34
+ }
35
+
36
+ if (type === Date) {
37
+ return new type(element.textContent);
38
+ }
39
+
40
+ return type(element.textContent);
30
41
  }
31
42
 
32
43
  getFieldFromXML(path, type, root) {
package/addon/models.js CHANGED
@@ -1,4 +1,4 @@
1
- import Address from "./models/address";
1
+ import Address, { Country } from "./models/address";
2
2
  import Building, { Volume } from "./models/building";
3
3
  import BuildingEntrance from "./models/building-entrance";
4
4
  import BuildingWork from "./models/building-work";
@@ -27,6 +27,7 @@ export default {
27
27
  Coordinates,
28
28
  ConstructionProject,
29
29
  ConstructionProjectsList,
30
+ Country,
30
31
  Building,
31
32
  Volume,
32
33
  BuildingsList,
@@ -5,8 +5,6 @@ export default class BuildingEditEntranceEditIndexRoute extends Route {
5
5
  @service buildingEntrance;
6
6
 
7
7
  model() {
8
- // reset the newRecord
9
- this.buildingEntrance.newRecord = null;
10
8
  return this.modelFor("building.edit.entrance.edit");
11
9
  }
12
10
 
@@ -3,14 +3,23 @@ import { inject as service } from "@ember/service";
3
3
 
4
4
  export default class BuildingEditEntranceLinkStreetRoute extends Route {
5
5
  @service buildingEntrance;
6
+ @service building;
6
7
 
7
8
  model() {
8
9
  return this.modelFor("building.edit.entrance.edit");
9
10
  }
10
11
 
11
12
  afterModel(model) {
12
- if (model.entranceId === "new" && !this.buildingEntrance.newRecord) {
13
+ if (model.buildingId === "new") {
14
+ this.transitionTo("building.new");
15
+ } else if (model.entranceId === "new" && model.buildingId !== "new") {
13
16
  this.transitionTo("building.edit.entrance.new");
14
17
  }
15
18
  }
19
+
20
+ setupController(controller, model) {
21
+ super.setupController(controller, model);
22
+ // Reset search results
23
+ controller.search.last = null;
24
+ }
16
25
  }
@@ -1,9 +1,6 @@
1
1
  import { inject as service } from "@ember/service";
2
- import Changeset from "ember-changeset";
3
- import lookupValidator from "ember-changeset-validations";
4
2
  import BuildingEntrance from "ember-ebau-gwr/models/building-entrance";
5
3
  import { languageOptions } from "ember-ebau-gwr/models/options";
6
- import BuildingEntranceValidations from "ember-ebau-gwr/validations/building-entrance";
7
4
 
8
5
  import IndexRoute from "./edit/index";
9
6
 
@@ -16,19 +13,15 @@ export default class BuildingEditEntranceNewRoute extends IndexRoute {
16
13
 
17
14
  async model() {
18
15
  const model = this.modelFor("building.edit");
19
- // Dont reset if there is already a new record
20
- if (!this.buildingEntrance.newRecord) {
21
- const buildingEntrance = new BuildingEntrance();
22
- buildingEntrance.locality.name.language =
23
- languageOptions[this.intl.primaryLocale];
24
- buildingEntrance.EGID = model.buildingId;
25
16
 
26
- this.buildingEntrance.newRecord = new Changeset(
27
- buildingEntrance,
28
- lookupValidator(BuildingEntranceValidations),
29
- BuildingEntranceValidations
30
- );
31
- }
32
- return { ...model, entranceId: "new" };
17
+ const buildingEntrance = new BuildingEntrance();
18
+ buildingEntrance.locality.name.language =
19
+ languageOptions[this.intl.primaryLocale];
20
+ buildingEntrance.EGID = model.buildingId;
21
+ return {
22
+ ...model,
23
+ entranceId: "new",
24
+ buildingEntrance,
25
+ };
33
26
  }
34
27
  }
@@ -1,3 +1,10 @@
1
1
  import Route from "@ember/routing/route";
2
+ import { inject as service } from "@ember/service";
2
3
 
3
- export default class BuildingEditIndexRoute extends Route {}
4
+ export default class BuildingEditIndexRoute extends Route {
5
+ @service building;
6
+
7
+ model() {
8
+ return this.modelFor("building.edit");
9
+ }
10
+ }
@@ -1,4 +1,5 @@
1
1
  import { inject as service } from "@ember/service";
2
+ import BuildingEntrance from "ember-ebau-gwr/models/building-entrance";
2
3
  import BuildingWork from "ember-ebau-gwr/models/building-work";
3
4
  import municipalities from "ember-ebau-gwr/models/municipalities";
4
5
 
@@ -10,12 +11,16 @@ const WORK_NEW = 6001;
10
11
  export default class BuildingNewRoute extends BuildingFormRoute {
11
12
  @service building;
12
13
  @service config;
14
+ @service intl;
13
15
 
14
16
  templateName = "building.edit.form";
15
17
  controllerName = "building.edit.form";
16
18
 
17
19
  async model() {
18
- const model = { projectId: this.modelFor("building") };
20
+ const model = {
21
+ instanceId: this.modelFor("application").id,
22
+ projectId: this.modelFor("building"),
23
+ };
19
24
  const buildingWork = new BuildingWork();
20
25
  await this.building.authFetch.housingStatToken.lastRunning;
21
26
  buildingWork.building.municipality = this.building.municipality;
@@ -25,6 +30,10 @@ export default class BuildingNewRoute extends BuildingFormRoute {
25
30
  buildingWork.building.buildingStatus = STATUS_PROJECTED;
26
31
  buildingWork.kindOfWork = WORK_NEW;
27
32
 
33
+ // Generate a editable first building entrance for new buildings
34
+ // to prevent having to generate a dummy entrance
35
+ buildingWork.building.buildingEntrance = new BuildingEntrance();
36
+
28
37
  model.buildingWork = buildingWork;
29
38
  return model;
30
39
  }
@@ -7,4 +7,9 @@ export default class ProjectFormRoute extends Route {
7
7
  instanceId: this.modelFor("application").id,
8
8
  };
9
9
  }
10
+
11
+ setupController(controller, model) {
12
+ super.setupController(controller, model);
13
+ controller.fetchProject.perform();
14
+ }
10
15
  }
@@ -1,8 +1,9 @@
1
- import Route from "@ember/routing/route";
2
1
  import { inject as service } from "@ember/service";
3
2
  import ConstructionProject from "ember-ebau-gwr/models/construction-project";
4
3
 
5
- export default class ProjectNewRoute extends Route {
4
+ import FormRoute from "./form";
5
+
6
+ export default class ProjectNewRoute extends FormRoute {
6
7
  @service constructionProject;
7
8
  @service config;
8
9
 
@@ -1,13 +1,12 @@
1
1
  import { inject as service } from "@ember/service";
2
- import { tracked } from "@glimmer/tracking";
3
2
  import BuildingEntrance from "ember-ebau-gwr/models/building-entrance";
4
3
 
5
4
  import GwrService from "./gwr";
6
5
 
7
6
  export default class BuildingEntranceService extends GwrService {
8
- @service building;
7
+ BuildingEntrance = BuildingEntrance;
9
8
 
10
- @tracked newRecord;
9
+ @service building;
11
10
 
12
11
  cacheKey(buildingEntrance) {
13
12
  return `${buildingEntrance.EGAID}-${buildingEntrance.EDID}`;
@@ -67,7 +66,13 @@ export default class BuildingEntranceService extends GwrService {
67
66
 
68
67
  if (!response.ok) {
69
68
  const xmlErrors = await response.text();
70
- const errors = this.extractErrorsFromXML(xmlErrors);
69
+ // Throw specific error message for
70
+ // mismatched locality - zip code errors
71
+ const errors = this.extractErrorsFromXML(
72
+ xmlErrors,
73
+ this.BuildingEntrance.LOCALITY_ERROR,
74
+ this.intl.t("ember-gwr.buildingEntrance.localityError")
75
+ );
71
76
 
72
77
  console.error("GWR API: addBuildingEntrance failed");
73
78
  throw errors;
@@ -77,7 +82,6 @@ export default class BuildingEntranceService extends GwrService {
77
82
  /* eslint-disable-next-line ember/classic-decorator-no-classic-methods */
78
83
  await this.building.get(EGID);
79
84
 
80
- this.newRecord = null;
81
85
  const xml = await response.text();
82
86
  return this.createAndCache(xml);
83
87
  }
@@ -97,7 +101,7 @@ export default class BuildingEntranceService extends GwrService {
97
101
  );
98
102
  if (!response.ok) {
99
103
  const xmlErrors = await response.text();
100
- const errors = this.extractErrorsFromXML(xmlErrors);
104
+ const errors = this.extractErrorsFromXML(xmlErrors, false);
101
105
 
102
106
  console.error("GWR API: deactivateBuildingEntrance failed");
103
107
  throw errors;
@@ -107,10 +111,10 @@ export default class BuildingEntranceService extends GwrService {
107
111
  await this.building.get(EGID);
108
112
  }
109
113
 
110
- async setStreet(EDID, EGID, EGAID, street) {
114
+ async setStreet(EDID, EGID, buildingEntrance) {
111
115
  const body = this.xml.buildXMLRequest(
112
- "setStreet",
113
- { EGAID, street },
116
+ "modifyBuildingEntrance",
117
+ buildingEntrance,
114
118
  "Set street"
115
119
  );
116
120
  const response = await this.authFetch.fetch(