ember-ebau-gwr 8.1.2 → 9.0.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,29 @@
1
+ # [9.0.0](https://github.com/inosca/ember-ebau-gwr/compare/v8.1.3...v9.0.0) (2026-08-19)
2
+
3
+
4
+ ### chore
5
+
6
+ * bump minimum required node version to 20 ([ade5dfe](https://github.com/inosca/ember-ebau-gwr/commit/ade5dfec812de6e0f4baa2448eb8324d4bcafa85))
7
+
8
+
9
+ ### Features
10
+
11
+ * **dwellings:** add character length validation with whitespace cleanup ([7088e99](https://github.com/inosca/ember-ebau-gwr/commit/7088e99195912813de37a21c88322e908b607949))
12
+ * **dwellings:** add mandatory reason for removing dwellings ([40b9a86](https://github.com/inosca/ember-ebau-gwr/commit/40b9a86bf4895cc3a13cc47b6280f6c941c0f6a5))
13
+ * **translations:** use global translations for common modal terms ([6c2929d](https://github.com/inosca/ember-ebau-gwr/commit/6c2929d2f783ee6e93e1b563735b235eb35a1509))
14
+
15
+
16
+ ### BREAKING CHANGES
17
+
18
+ * bump required node version to v20
19
+
20
+ ## [8.1.3](https://github.com/inosca/ember-ebau-gwr/compare/v8.1.2...v8.1.3) (2026-06-09)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * **project:** replace unused parameter with value from [@attr](https://github.com/attr) ([dac9956](https://github.com/inosca/ember-ebau-gwr/commit/dac99563dd8e0f9c4e796dd2973fd3a338231d2c))
26
+
1
27
  ## [8.1.2](https://github.com/inosca/ember-ebau-gwr/compare/v8.1.1...v8.1.2) (2026-06-04)
2
28
 
3
29
 
@@ -55,7 +55,7 @@
55
55
  <Modal.footer class="uk-flex uk-flex-column">
56
56
  <div class="uk-flex uk-flex-between">
57
57
  <UkButton @onClick={{@close}}>
58
- {{t "ember-gwr.components.linkBuildingModal.cancel"}}
58
+ {{t "ember-gwr.components.modal.cancel"}}
59
59
  </UkButton>
60
60
  <UkButton
61
61
  @color="primary"
@@ -0,0 +1,40 @@
1
+ <UkModal
2
+ @visible={{@visible}}
3
+ @onHide={{@onHide}}
4
+ @container={{this.config.modalContainer}}
5
+ as |Modal|
6
+ >
7
+ <ValidatedForm
8
+ @model={{changeset @model this.RemoveModalValidations}}
9
+ @on-submit={{@on-submit}}
10
+ @on-invalid-submit={{@on-invalid-submit}}
11
+ ...attributes
12
+ as |Form|
13
+ >
14
+ <Modal.header>
15
+ <h2 class="uk-modal-title">
16
+ {{@title}}
17
+ </h2>
18
+ </Modal.header>
19
+ <Modal.body class="uk-overflow-auto">
20
+ <Form.input
21
+ @type="textarea"
22
+ @label={{@label}}
23
+ @name="removeReason"
24
+ @rows="10"
25
+ @required={{true}}
26
+ @hint={{@hint}}
27
+ @errorComponent={{component "validated-form-error"}}
28
+ />
29
+ </Modal.body>
30
+ <Modal.footer class="uk-text-right">
31
+ <Form.button
32
+ @label={{t "ember-gwr.components.modal.cancel" }}
33
+ class="uk-modal-close"
34
+ />
35
+ <Form.submit
36
+ @label={{t "ember-gwr.components.modal.save" }}
37
+ />
38
+ </Modal.footer>
39
+ </ValidatedForm>
40
+ </UkModal>
@@ -0,0 +1,9 @@
1
+ import { service } from "@ember/service";
2
+ import Component from "@glimmer/component";
3
+ import RemoveModalValidations from "ember-ebau-gwr/validations/remove-modal";
4
+
5
+ export default class RemoveModalComponent extends Component {
6
+ RemoveModalValidations = RemoveModalValidations;
7
+
8
+ @service config;
9
+ }
@@ -1,6 +1,7 @@
1
1
  import Controller from "@ember/controller";
2
2
  import { action } from "@ember/object";
3
3
  import { inject as service } from "@ember/service";
4
+ import { tracked } from "@glimmer/tracking";
4
5
  import { task } from "ember-concurrency";
5
6
 
6
7
  export default class BuildingEditDwellingsController extends Controller {
@@ -9,6 +10,8 @@ export default class BuildingEditDwellingsController extends Controller {
9
10
  @service intl;
10
11
  @service notification;
11
12
 
13
+ @tracked dwellingToRemove;
14
+
12
15
  @task
13
16
  *fetchDwellings() {
14
17
  try {
@@ -28,13 +31,24 @@ export default class BuildingEditDwellingsController extends Controller {
28
31
  }
29
32
 
30
33
  @action
31
- async removeDwelling(dwelling) {
34
+ confirmRemoveDwelling(dwelling) {
35
+ this.dwellingToRemove = dwelling.EWID;
36
+ }
37
+
38
+ @action
39
+ async removeDwelling(formValues) {
32
40
  try {
33
- await this.dwelling.deactivate(this.model, dwelling.EWID);
41
+ await this.dwelling.deactivate(
42
+ this.model,
43
+ this.dwellingToRemove,
44
+ formValues.get("removeReason"),
45
+ );
34
46
  await this.fetchDwellings.perform();
35
47
  this.notification.success(
36
48
  this.intl.t("ember-gwr.building.dwellings.removeLinkSuccess"),
37
49
  );
50
+ // Closes modal on success
51
+ this.dwellingToRemove = null;
38
52
  } catch (error) {
39
53
  console.error(error);
40
54
  this.notification.danger(
@@ -220,8 +220,8 @@ export default class ProjectFormController extends ImportController {
220
220
  }
221
221
 
222
222
  @action
223
- updateWork(work, attr, value) {
224
- work[attr] = value;
223
+ updateWork(work, value) {
224
+ work.kindOfWork = value;
225
225
  }
226
226
 
227
227
  @action
@@ -108,12 +108,8 @@ export default class DwellingService extends GwrService {
108
108
  return this.createAndCache(xml);
109
109
  }
110
110
 
111
- async deactivate(EGID, EWID) {
112
- const body = this.xml.buildXMLRequest(
113
- "deactivateDwelling",
114
- null,
115
- "Remove Dwelling",
116
- );
111
+ async deactivate(EGID, EWID, reason) {
112
+ const body = this.xml.buildXMLRequest("deactivateDwelling", null, reason);
117
113
  const response = await this.authFetch.fetch(
118
114
  `/buildings/${EGID}/dwellings/${EWID}`,
119
115
  {
@@ -6,7 +6,7 @@
6
6
  @models={{this.fetchDwellings.lastSuccessful.value}}
7
7
  @modelName="dwelling"
8
8
  @newRoute="building.edit.dwelling.new"
9
- @removeLink={{this.removeDwelling}}
9
+ @removeLink={{this.confirmRemoveDwelling}}
10
10
  >
11
11
  <:list as |model|>
12
12
  <td class="uk-table-shrink">
@@ -52,3 +52,13 @@
52
52
  </LinkedModels>
53
53
  {{/if}}
54
54
  </div>
55
+
56
+ <RemoveModal
57
+ @visible={{this.dwellingToRemove}}
58
+ @onHide={{fn (mut this.dwellingToRemove) null}}
59
+ @model={{@model}}
60
+ @on-submit={{this.removeDwelling}}
61
+ @title={{t "ember-gwr.building.dwellings.removeModalTitle" }}
62
+ @label={{t "ember-gwr.building.dwellings.removeModalLabel" }}
63
+ @hint={{t "ember-gwr.building.dwellings.removeModalHint" }}
64
+ />
@@ -0,0 +1,22 @@
1
+ import {
2
+ validateLength,
3
+ validatePresence,
4
+ } from "ember-changeset-validations/validators";
5
+
6
+ export default {
7
+ removeReason: [
8
+ (key, value) => {
9
+ return validateLength({ min: 10 })(
10
+ key,
11
+ value
12
+ ? value
13
+ // replace multiple whitespaces with one
14
+ .replace(/[\s]+/gm, " ")
15
+ // trim left and right whitespace
16
+ .trim()
17
+ : "",
18
+ );
19
+ },
20
+ validatePresence({ presence: true, ignoreBlank: true }),
21
+ ],
22
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-ebau-gwr",
3
- "version": "8.1.2",
3
+ "version": "9.0.0",
4
4
  "description": "Ember engine to integrate ebau-gwr into an ember app.",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -119,7 +119,7 @@
119
119
  "webpack": "5.98.0"
120
120
  },
121
121
  "engines": {
122
- "node": ">= 18"
122
+ "node": ">= 20"
123
123
  },
124
124
  "ember": {
125
125
  "edition": "octane"
@@ -40,6 +40,9 @@ ember-gwr:
40
40
  cellar: "{number}. Untergeschoss"
41
41
  floor: "{number}. Stock"
42
42
  error: Beim Laden der Wohnungen ist ein Fehler aufgetreten.
43
+ removeModalTitle: Verknüpfung entfernen
44
+ removeModalLabel: Grund für die Entfernung
45
+ removeModalHint: Bitte geben Sie den Grund für die Entfernung der Verknüpfung ein.
43
46
  removeLinkError: Beim Entfernen der Verknüpfung ist ein Fehler aufgetreten.
44
47
  removeLinkSuccess: "Ihre Anfrage wurde vom BfS erfasst. Das Support-Team wird Ihre Anfrage bearbeiten und Sie, falls nötig kontaktieren. Telefon: 0800 866 600 E-mail: housing-stat@bfs.admin.ch"
45
48
  sections:
@@ -41,6 +41,9 @@ ember-gwr:
41
41
  cellar: "{number}e sous-sol"
42
42
  floor: "{number}e étage"
43
43
  error: Une erreur s'est produite lors du chargement des logements.
44
+ removeModalTitle: Supprimer le lien
45
+ removeModalLabel: Motif de la suppression
46
+ removeModalHint: Veuillez indiquer la motif de la suppression du lien.
44
47
  removeLinkError: Une erreur s'est produite lors de la suppression du lien.
45
48
  removeLinkSuccess: "Votre demande a été enregistrée par l'OFS. L'équipe de support traitera votre demande et vous contactera si nécessaire. Téléphone: 0800 866 600 e-mail: housing-stat@bfs.admin.ch"
46
49
  sections:
@@ -40,6 +40,9 @@ ember-gwr:
40
40
  cellar: "{number}° piano interrato"
41
41
  floor: "{number}° piano"
42
42
  error: Errore nel tentativo di caricare le abitazioni.
43
+ removeModalTitle: Elimina collegamento
44
+ removeModalLabel: Motivo della eliminazione
45
+ removeModalHint: Si prega di indicare il motivo della eliminazione del collegamento.
43
46
  removeLinkError: Errore nel tentativo di eliminare il collegamento.
44
47
  removeLinkSuccess: "L'UFS ha registrato la sua richiesta. Il team di supporto procederà all'elaborazione della richiesta e, se necessario, si metterà in contatto con lei. Telefono: 0800 866 600 e-mail: housing-stat@bfs.admin.ch"
45
48
  sections:
@@ -240,6 +240,10 @@ ember-gwr:
240
240
 
241
241
  logout: Abmelden
242
242
 
243
+ modal:
244
+ save: Speichern
245
+ cancel: Abbrechen
246
+
243
247
  modelForm:
244
248
  save: Speichern
245
249
  cancelImport: Import abbrechen
@@ -299,7 +303,6 @@ ember-gwr:
299
303
 
300
304
  linkBuildingModal:
301
305
  linkBuilding: Gebäude verknüpfen
302
- cancel: Abbrechen
303
306
 
304
307
  header:
305
308
  status:
@@ -240,6 +240,10 @@ ember-gwr:
240
240
 
241
241
  logout: Se déconnecter
242
242
 
243
+ modal:
244
+ save: Enregistrer
245
+ cancel: Interrompre
246
+
243
247
  modelForm:
244
248
  save: Enregistrer
245
249
  cancelImport: Interrompre l'import
@@ -299,7 +303,6 @@ ember-gwr:
299
303
 
300
304
  linkBuildingModal:
301
305
  linkBuilding: Lier un bâtiment
302
- cancel: Interrompre
303
306
 
304
307
  header:
305
308
  status:
@@ -240,6 +240,10 @@ ember-gwr:
240
240
 
241
241
  logout: Logout
242
242
 
243
+ modal:
244
+ save: Salva
245
+ cancel: Annulla
246
+
243
247
  modelForm:
244
248
  save: Salva
245
249
  cancelImport: Annulla import
@@ -298,7 +302,6 @@ ember-gwr:
298
302
 
299
303
  linkBuildingModal:
300
304
  linkBuilding: Collega edificio
301
- cancel: Annulla
302
305
 
303
306
  header:
304
307
  status: