ember-ebau-gwr 7.4.2 → 7.4.4

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 (49) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +2 -2
  3. package/addon/components/login-modal.js +2 -2
  4. package/addon/components/model-form/field.js +1 -1
  5. package/addon/components/model-form/header/status-selector.js +7 -7
  6. package/addon/components/model-form.js +3 -3
  7. package/addon/components/project-nav.js +3 -3
  8. package/addon/components/quarterly-closure/close-survey-button.js +3 -3
  9. package/addon/components/quarterly-closure/error-list/project-errors.js +7 -3
  10. package/addon/components/quarterly-closure/error-list/survey-department-errors.js +2 -2
  11. package/addon/components/search.js +2 -2
  12. package/addon/components/validated-form-error.js +1 -1
  13. package/addon/controllers/building/edit/dwelling/edit.js +10 -10
  14. package/addon/controllers/building/edit/dwellings.js +4 -4
  15. package/addon/controllers/building/edit/entrance/edit/index.js +7 -7
  16. package/addon/controllers/building/edit/entrance/edit/link-street.js +6 -6
  17. package/addon/controllers/building/edit/entrances.js +4 -4
  18. package/addon/controllers/building/edit/form.js +12 -12
  19. package/addon/controllers/project/errors.js +9 -10
  20. package/addon/controllers/project/form.js +18 -18
  21. package/addon/controllers/project/linked-buildings.js +5 -5
  22. package/addon/controllers/search-building.js +8 -8
  23. package/addon/controllers/search-project.js +3 -3
  24. package/addon/helpers/current-quarter.js +1 -1
  25. package/addon/models/building.js +1 -1
  26. package/addon/models/buildings-list.js +1 -1
  27. package/addon/models/construction-project.js +14 -14
  28. package/addon/models/dwelling.js +8 -5
  29. package/addon/models/xml-model.js +2 -2
  30. package/addon/modifiers/in-viewport.js +2 -2
  31. package/addon/modifiers/inverse-background.js +1 -1
  32. package/addon/resources/import.js +4 -5
  33. package/addon/services/auth-fetch.js +2 -2
  34. package/addon/services/building-entrance.js +10 -10
  35. package/addon/services/building.js +38 -38
  36. package/addon/services/construction-project.js +49 -49
  37. package/addon/services/dwelling.js +16 -16
  38. package/addon/services/gwr.js +6 -6
  39. package/addon/services/quarterly-closure.js +9 -9
  40. package/addon/services/xml.js +1 -1
  41. package/addon/utils.js +2 -2
  42. package/addon/validators/range-state.js +1 -1
  43. package/package.json +54 -50
  44. package/translations/building/fr.yaml +1 -1
  45. package/translations/construction-project/fr.yaml +2 -2
  46. package/translations/dwelling/fr.yaml +2 -2
  47. package/translations/fr.yaml +3 -3
  48. package/tsconfig.declarations.json +10 -0
  49. package/app/mirage-models/gwr-link.js +0 -1
@@ -36,7 +36,7 @@ export default class ProjectFormController extends ImportController {
36
36
 
37
37
  get nextValidStates() {
38
38
  const states = this.constructionProject.nextValidStates(
39
- this.project.projectStatus
39
+ this.project.projectStatus,
40
40
  );
41
41
  return states;
42
42
  }
@@ -53,7 +53,7 @@ export default class ProjectFormController extends ImportController {
53
53
  switch (this.typeOfConstructionProject) {
54
54
  case this.ConstructionProject.INFRASTRUCTURE: {
55
55
  return this.intl.t(
56
- "ember-gwr.linkedBuildings.buildingDisabledForInfrastructure"
56
+ "ember-gwr.linkedBuildings.buildingDisabledForInfrastructure",
57
57
  );
58
58
  }
59
59
  case this.ConstructionProject.SUPERSTRUCTURE: {
@@ -110,18 +110,18 @@ export default class ProjectFormController extends ImportController {
110
110
  added.map((work) =>
111
111
  this.constructionProject.addWorkToProject(
112
112
  this.model.projectId,
113
- work
114
- )
115
- )
113
+ work,
114
+ ),
115
+ ),
116
116
  );
117
117
 
118
118
  yield Promise.all(
119
119
  this.removedWork.map((work) =>
120
120
  this.constructionProject.removeWorkFromProject(
121
121
  this.model.projectId,
122
- work.ARBID
123
- )
124
- )
122
+ work.ARBID,
123
+ ),
124
+ ),
125
125
  );
126
126
  this.removedWork = [];
127
127
  yield this.constructionProject.update(this.project);
@@ -130,7 +130,7 @@ export default class ProjectFormController extends ImportController {
130
130
  this.resetImportQueryParams();
131
131
  this.errors = [];
132
132
  this.notification.success(
133
- this.intl.t("ember-gwr.constructionProject.saveSuccess")
133
+ this.intl.t("ember-gwr.constructionProject.saveSuccess"),
134
134
  );
135
135
  // refresh work list
136
136
  this.constructionProject.clearCache(this.model.projectId);
@@ -138,7 +138,7 @@ export default class ProjectFormController extends ImportController {
138
138
  } catch (error) {
139
139
  this.errors = error;
140
140
  this.notification.danger(
141
- this.intl.t("ember-gwr.constructionProject.saveError")
141
+ this.intl.t("ember-gwr.constructionProject.saveError"),
142
142
  );
143
143
  }
144
144
  }
@@ -158,7 +158,7 @@ export default class ProjectFormController extends ImportController {
158
158
  transition,
159
159
  3,
160
160
  true,
161
- this.project
161
+ this.project,
162
162
  );
163
163
 
164
164
  // execute transition(s)
@@ -169,17 +169,17 @@ export default class ProjectFormController extends ImportController {
169
169
  transition,
170
170
  isCascading ? 3 : 1,
171
171
  false,
172
- this.project
172
+ this.project,
173
173
  );
174
174
  yield this.constructionProject.clearCache(this.model.projectId);
175
175
  this.fetchProject.perform(); // reload for errors;
176
176
  this.notification.success(
177
- this.intl.t("ember-gwr.constructionProject.saveSuccess")
177
+ this.intl.t("ember-gwr.constructionProject.saveSuccess"),
178
178
  );
179
179
  } catch (error) {
180
180
  console.error(error);
181
181
  this.notification.danger(
182
- this.intl.t("ember-gwr.constructionProject.saveError")
182
+ this.intl.t("ember-gwr.constructionProject.saveError"),
183
183
  );
184
184
 
185
185
  throw error.isLifeCycleError
@@ -192,7 +192,7 @@ export default class ProjectFormController extends ImportController {
192
192
  getChangeParameters(currentStatus, newStatus) {
193
193
  return this.constructionProject.getChangeParameters(
194
194
  currentStatus,
195
- newStatus
195
+ newStatus,
196
196
  );
197
197
  }
198
198
 
@@ -204,12 +204,12 @@ export default class ProjectFormController extends ImportController {
204
204
  yield this.constructionProject.clearCache(this.model.projectId);
205
205
  this.fetchProject.perform(); // reload for errors;
206
206
  this.notification.success(
207
- this.intl.t("ember-gwr.constructionProject.saveSuccess")
207
+ this.intl.t("ember-gwr.constructionProject.saveSuccess"),
208
208
  );
209
209
  } catch (error) {
210
210
  console.error(error);
211
211
  this.notification.danger(
212
- this.intl.t("ember-gwr.constructionProject.saveError")
212
+ this.intl.t("ember-gwr.constructionProject.saveError"),
213
213
  );
214
214
  throw error;
215
215
  }
@@ -231,7 +231,7 @@ export default class ProjectFormController extends ImportController {
231
231
  }
232
232
 
233
233
  this.project.work = this.project.work.filter(
234
- (work) => work !== buildingWork
234
+ (work) => work !== buildingWork,
235
235
  );
236
236
  }
237
237
 
@@ -18,14 +18,14 @@ export default class ProjectLinkedBuildingsController extends Controller {
18
18
  *fetchBuildings() {
19
19
  try {
20
20
  const project = yield this.constructionProject.getFromCacheOrApi(
21
- this.model
21
+ this.model,
22
22
  );
23
23
  this.project = project;
24
24
  this.workWithoutBuildings = project.work.filter(
25
- (work) => work.building.isNew
25
+ (work) => work.building.isNew,
26
26
  );
27
27
  this.workWithBuildings = project.work.filter(
28
- (work) => !work.building.isNew
28
+ (work) => !work.building.isNew,
29
29
  );
30
30
  return this.workWithBuildings;
31
31
  } catch (error) {
@@ -39,13 +39,13 @@ export default class ProjectLinkedBuildingsController extends Controller {
39
39
  try {
40
40
  await this.building.unbindBuildingFromConstructionProject(
41
41
  this.model,
42
- EGID
42
+ EGID,
43
43
  );
44
44
  await this.fetchBuildings.perform();
45
45
  } catch (error) {
46
46
  console.error(error);
47
47
  this.notification.danger(
48
- this.intl.t("ember-gwr.linkedBuildings.removeLinkError")
48
+ this.intl.t("ember-gwr.linkedBuildings.removeLinkError"),
49
49
  );
50
50
  }
51
51
  }
@@ -36,7 +36,7 @@ export default class SearchBuildingController extends Controller {
36
36
  return periodOfConstructionOptions.map((option) => ({
37
37
  value: option,
38
38
  label: this.intl.t(
39
- `ember-gwr.building.dateOfConstruction.periodOfConstructionOptions.${option}`
39
+ `ember-gwr.building.dateOfConstruction.periodOfConstructionOptions.${option}`,
40
40
  ),
41
41
  }));
42
42
  }
@@ -46,7 +46,7 @@ export default class SearchBuildingController extends Controller {
46
46
  yield this.building.bindBuildingToConstructionProject(
47
47
  this.model,
48
48
  EGID,
49
- buildingWork
49
+ buildingWork,
50
50
  );
51
51
 
52
52
  // refresh work list
@@ -58,21 +58,21 @@ export default class SearchBuildingController extends Controller {
58
58
  work.building.isNew
59
59
  ? this.constructionProject.removeWorkFromProject(
60
60
  this.model,
61
- work.ARBID
61
+ work.ARBID,
62
62
  )
63
- : work
64
- )
63
+ : work,
64
+ ),
65
65
  );
66
66
 
67
67
  this.activeBuilding = null;
68
68
  this.router.transitionTo("project.linked-buildings", this.model);
69
69
  this.notification.success(
70
- this.intl.t("ember-gwr.searchBuilding.linkSuccess")
70
+ this.intl.t("ember-gwr.searchBuilding.linkSuccess"),
71
71
  );
72
72
  } catch (error) {
73
73
  this.errors = error;
74
74
  this.notification.danger(
75
- this.intl.t("ember-gwr.searchBuilding.linkError")
75
+ this.intl.t("ember-gwr.searchBuilding.linkError"),
76
76
  );
77
77
  }
78
78
  }
@@ -102,7 +102,7 @@ export default class SearchBuildingController extends Controller {
102
102
  } catch (error) {
103
103
  this.errors = error;
104
104
  this.notification.danger(
105
- this.intl.t("ember-gwr.searchBuilding.previewBuildingError")
105
+ this.intl.t("ember-gwr.searchBuilding.previewBuildingError"),
106
106
  );
107
107
  }
108
108
  }
@@ -28,7 +28,7 @@ export default class SearchProjectController extends Controller {
28
28
  return projectStatusOptions.map((option) => ({
29
29
  value: option,
30
30
  label: this.intl.t(
31
- `ember-gwr.searchProject.projectStatusOptions.${option}`
31
+ `ember-gwr.searchProject.projectStatusOptions.${option}`,
32
32
  ),
33
33
  }));
34
34
  }
@@ -45,7 +45,7 @@ export default class SearchProjectController extends Controller {
45
45
  if (!links.length) return [];
46
46
 
47
47
  const instanceLinks = yield this.config.fetchInstanceLinks(
48
- links.map(({ localId }) => localId)
48
+ links.map(({ localId }) => localId),
49
49
  );
50
50
 
51
51
  return links.map(({ eproid, localId }) => ({
@@ -69,7 +69,7 @@ export default class SearchProjectController extends Controller {
69
69
  // Simply cleanup and redirect to project.
70
70
  await link.deleteRecord();
71
71
  this.notification.warning(
72
- this.intl.t("ember-gwr.searchProject.alreadyLinkedInfo")
72
+ this.intl.t("ember-gwr.searchProject.alreadyLinkedInfo"),
73
73
  );
74
74
  }
75
75
  }
@@ -14,7 +14,7 @@ export const getCurrentQuarter = (date = DateTime.now()) => {
14
14
  const currentWeek = parseInt(date.toFormat("W"));
15
15
 
16
16
  const currentQuarter = quarters.find(
17
- ({ firstWeekOfQuarter }) => currentWeek >= firstWeekOfQuarter
17
+ ({ firstWeekOfQuarter }) => currentWeek >= firstWeekOfQuarter,
18
18
  );
19
19
  return {
20
20
  ...currentQuarter,
@@ -95,7 +95,7 @@ export default class Building extends XMLModel {
95
95
 
96
96
  get fullAddressTexts() {
97
97
  return this.buildingEntrance?.map(
98
- (buildingEntrance) => buildingEntrance.fullAddressText
98
+ (buildingEntrance) => buildingEntrance.fullAddressText,
99
99
  );
100
100
  }
101
101
 
@@ -28,7 +28,7 @@ export default class BuildingsList extends XMLModel {
28
28
  buildingEntrance.buildingEntranceNo ?? ""
29
29
  }, ${buildingEntrance.locality.swissZipCode ?? ""} ${
30
30
  buildingEntrance.locality.name.nameLong ?? ""
31
- }`
31
+ }`,
32
32
  );
33
33
  }
34
34
  }
@@ -93,20 +93,20 @@ export default class ConstructionProject extends XMLModel {
93
93
  this.projectStatus = this.projectSuspensionDate
94
94
  ? this.STATUS_SUSPENDED
95
95
  : this.projectCompletionDate
96
- ? this.STATUS_COMPLETED
97
- : this.withdrawalDate
98
- ? this.STATUS_WITHDRAWN
99
- : this.cancellationDate
100
- ? this.STATUS_NOT_REALIZED
101
- : this.constructionAuthorisationDeniedDate
102
- ? this.STATUS_REFUSED
103
- : this.projectStartDate
104
- ? this.STATUS_CONSTRUCTION_STARTED
105
- : this.buildingPermitIssueDate
106
- ? this.STATUS_APPROVED
107
- : this.projectAnnouncementDate
108
- ? this.STATUS_PROJECTED
109
- : undefined;
96
+ ? this.STATUS_COMPLETED
97
+ : this.withdrawalDate
98
+ ? this.STATUS_WITHDRAWN
99
+ : this.cancellationDate
100
+ ? this.STATUS_NOT_REALIZED
101
+ : this.constructionAuthorisationDeniedDate
102
+ ? this.STATUS_REFUSED
103
+ : this.projectStartDate
104
+ ? this.STATUS_CONSTRUCTION_STARTED
105
+ : this.buildingPermitIssueDate
106
+ ? this.STATUS_APPROVED
107
+ : this.projectAnnouncementDate
108
+ ? this.STATUS_PROJECTED
109
+ : undefined;
110
110
  }
111
111
  }
112
112
  // The order of the fields seems to be important. Sometimes fields in wrong orders throw errors.
@@ -126,10 +126,13 @@ export default class Dwelling extends XMLModel {
126
126
  return floor === 3100
127
127
  ? { label: "ember-gwr.building.dwellings.groundFloor" }
128
128
  : floor > 3100 && floor < 3200
129
- ? { label: "ember-gwr.building.dwellings.floor", number: floor - 3100 }
130
- : floor > 3400 && floor < 3420
131
- ? { label: "ember-gwr.building.dwellings.cellar", number: floor - 3400 }
132
- : "";
129
+ ? { label: "ember-gwr.building.dwellings.floor", number: floor - 3100 }
130
+ : floor > 3400 && floor < 3420
131
+ ? {
132
+ label: "ember-gwr.building.dwellings.cellar",
133
+ number: floor - 3400,
134
+ }
135
+ : "";
133
136
  }
134
137
 
135
138
  static STATUS_PROJECTED = 3001;
@@ -308,7 +311,7 @@ export class DwellingComplete extends XMLModel {
308
311
  this.getFieldFromXML(
309
312
  "errorList",
310
313
  [ErrorList],
311
- "dwellingCompleteResponse"
314
+ "dwellingCompleteResponse",
312
315
  ) ?? [];
313
316
  this.dwelling.errorList = errorList;
314
317
  }
@@ -42,13 +42,13 @@ export default class XMLModel {
42
42
 
43
43
  getFieldFromXML(path, type, root) {
44
44
  const elements = this.document.querySelectorAll(
45
- root ? `${root} > ${path}` : path
45
+ root ? `${root} > ${path}` : path,
46
46
  );
47
47
 
48
48
  if (elements.length) {
49
49
  return Array.isArray(type)
50
50
  ? Array.from(elements).map((element) =>
51
- this.castToType(element, type[0])
51
+ this.castToType(element, type[0]),
52
52
  )
53
53
  : this.castToType(elements[0], type);
54
54
  }
@@ -3,11 +3,11 @@ import { modifier } from "ember-modifier";
3
3
  export default modifier(function inViewport(
4
4
  element,
5
5
  _,
6
- { onEnter = () => {}, onExit = () => {}, root = "#scroll-container" }
6
+ { onEnter = () => {}, onExit = () => {}, root = "#scroll-container" },
7
7
  ) {
8
8
  const intersectionObserver = new IntersectionObserver(
9
9
  ([{ isIntersecting }]) => (isIntersecting ? onEnter() : onExit()),
10
- { root: root instanceof Element ? root : document.getElementById(root) }
10
+ { root: root instanceof Element ? root : document.getElementById(root) },
11
11
  );
12
12
  intersectionObserver.observe(element);
13
13
  return () => intersectionObserver.disconnect();
@@ -10,7 +10,7 @@ import { modifier } from "ember-modifier";
10
10
  export default modifier(function inverseBackground(
11
11
  element,
12
12
  _,
13
- { inverse, compareTo }
13
+ { inverse, compareTo },
14
14
  ) {
15
15
  const style = window.getComputedStyle(element);
16
16
  const parentElement = element.closest(compareTo);
@@ -53,16 +53,15 @@ export default class ImportResource extends Resource {
53
53
  if (instanceId && showImport) {
54
54
  assert(
55
55
  "Must set `importModelName` to a string.",
56
- typeof importModelName === "string"
56
+ typeof importModelName === "string",
57
57
  );
58
58
  assert(
59
59
  "Must set `instanceId`.",
60
- instanceId !== null && instanceId !== undefined
60
+ instanceId !== null && instanceId !== undefined,
61
61
  );
62
62
  try {
63
- let data = yield this.dataImport[IMPORT_MAP[importModelName]](
64
- instanceId
65
- );
63
+ let data =
64
+ yield this.dataImport[IMPORT_MAP[importModelName]](instanceId);
66
65
  if (Object.keys(data).length === 0 || data.length === 0) {
67
66
  this.router.externalRouter.transitionTo({
68
67
  queryParams: { import: false },
@@ -57,7 +57,7 @@ export default class AuthFetchService extends Service {
57
57
 
58
58
  if (json["401"]?.source === "external") {
59
59
  this.notification.danger(
60
- this.intl.t("ember-gwr.generalErrors.loginError")
60
+ this.intl.t("ember-gwr.generalErrors.loginError"),
61
61
  );
62
62
  this.showLogin();
63
63
  }
@@ -86,7 +86,7 @@ export default class AuthFetchService extends Service {
86
86
  this.showLogin();
87
87
  } else {
88
88
  this.notification.danger(
89
- this.intl.t("ember-gwr.generalErrors.logoutError")
89
+ this.intl.t("ember-gwr.generalErrors.logoutError"),
90
90
  );
91
91
  }
92
92
  }
@@ -18,7 +18,7 @@ export default class BuildingEntranceService extends GwrService {
18
18
  return null;
19
19
  }
20
20
  const response = await this.authFetch.fetch(
21
- `/buildings/${EGID}/entrance/${EDID}`
21
+ `/buildings/${EGID}/entrance/${EDID}`,
22
22
  );
23
23
  const xml = await response.text();
24
24
  return this.createAndCache(xml);
@@ -29,14 +29,14 @@ export default class BuildingEntranceService extends GwrService {
29
29
  const body = this.xml.buildXMLRequest(
30
30
  "modifyBuildingEntrance",
31
31
  buildingEntrance,
32
- "Update building entrance"
32
+ "Update building entrance",
33
33
  );
34
34
  const response = await this.authFetch.fetch(
35
35
  `/buildings/${EGID}/entrance/${buildingEntrance.EDID}`,
36
36
  {
37
37
  method: "put",
38
38
  body,
39
- }
39
+ },
40
40
  );
41
41
 
42
42
  if (!response.ok) {
@@ -54,14 +54,14 @@ export default class BuildingEntranceService extends GwrService {
54
54
  async create(buildingEntrance, EGID) {
55
55
  const body = this.xml.buildXMLRequest(
56
56
  "addBuildingEntrance",
57
- buildingEntrance
57
+ buildingEntrance,
58
58
  );
59
59
  const response = await this.authFetch.fetch(
60
60
  `/buildings/${EGID}/entrance/`,
61
61
  {
62
62
  method: "post",
63
63
  body,
64
- }
64
+ },
65
65
  );
66
66
 
67
67
  if (!response.ok) {
@@ -75,7 +75,7 @@ export default class BuildingEntranceService extends GwrService {
75
75
  "ember-gwr.buildingEntrance.localityError",
76
76
  {
77
77
  htmlSafe: true,
78
- }
78
+ },
79
79
  ),
80
80
  },
81
81
  ]);
@@ -96,14 +96,14 @@ export default class BuildingEntranceService extends GwrService {
96
96
  const body = this.xml.buildXMLRequest(
97
97
  "deactivateBuildingEntrance",
98
98
  { EDID, EGID },
99
- "Deactivate building entrance"
99
+ "Deactivate building entrance",
100
100
  );
101
101
  const response = await this.authFetch.fetch(
102
102
  `/buildings/${EGID}/entrance/${EDID}`,
103
103
  {
104
104
  method: "delete",
105
105
  body,
106
- }
106
+ },
107
107
  );
108
108
  if (!response.ok) {
109
109
  const xmlErrors = await response.text();
@@ -121,14 +121,14 @@ export default class BuildingEntranceService extends GwrService {
121
121
  const body = this.xml.buildXMLRequest(
122
122
  "modifyBuildingEntrance",
123
123
  buildingEntrance,
124
- "Set street"
124
+ "Set street",
125
125
  );
126
126
  const response = await this.authFetch.fetch(
127
127
  `/buildings/${EGID}/entrance/${EDID}`,
128
128
  {
129
129
  method: "put",
130
130
  body,
131
- }
131
+ },
132
132
  );
133
133
 
134
134
  if (!response.ok) {