Skip to content

Commit

Permalink
fix(entrance): ensure street is set for building creation
Browse files Browse the repository at this point in the history
  • Loading branch information
luytena committed Oct 28, 2024
1 parent bf146f4 commit 8bb2e42
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion addon/components/link-building-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import BuildingWork from "ember-ebau-gwr/models/building-work";

// Remove the state "Neubau" from the array since you cant link
// existing buildings as "Neubau".
const KIND_OF_WORK_OPTIONS = BuildingWork.kindOfWorkOptions.slice(1);
const KIND_OF_WORK_OPTIONS = BuildingWork.kindOfWorkOptions;

export default class LinkBuildingModalComponent extends Component {
@service config;
Expand Down
3 changes: 3 additions & 0 deletions addon/controllers/building/edit/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ export default class BuildingFormController extends ImportController {
"building.buildingEntrance.locality.swissZipCodeAddOn",
streetList.locality.swissZipCodeAddOn,
);
changeset.set(
"building.buildingEntrance.street", streetList
)
}

@dropTask
Expand Down
2 changes: 1 addition & 1 deletion addon/models/address.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import XMLModel from "./xml-model";

export class Country extends XMLModel {
@tracked countryNameShort;
@tracked countryNameShort = "ch";

constructor(...args) {
super(...args);
Expand Down
11 changes: 3 additions & 8 deletions addon/templates/building/edit/entrance/edit/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
{{/unless}}
<Field
@attr="locality.name.nameLong"
@disabled={{not this.buildingEntrance.isNew}}
@disabled={{true}}
@required={{true}}
/>
<Field
@attr="locality.swissZipCode"
@type="number"
@disabled={{not this.buildingEntrance.isNew}}
@disabled={{true}}
@required={{true}}
/>
{{#if this.buildingEntrance.isNew}}
Expand All @@ -47,11 +47,6 @@
)
}}
@on-update={{fn this.syncLocalityWithSelectedStreet changeset}}
@disabled={{not
(changeset-get
changeset "locality.swissZipCode"
)
}}
@required={{true}}
/>
{{else}}
Expand Down Expand Up @@ -112,4 +107,4 @@
{{/unless}}
</ModelForm>
{{/if}}
</div>
</div>
14 changes: 8 additions & 6 deletions addon/templates/building/edit/form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,18 @@
<small class="uk-margin-bottom">
{{t "ember-gwr.building.buildingEntrance.info"}}
</small>
<Field
@attr="building.buildingEntrance.locality.name.nameLong"
@required={{true}}
@label="ember-gwr.buildingEntrance.fields.locality.name.nameLong"
@disabled={{true}}
/>
<Field
@attr="building.buildingEntrance.locality.swissZipCode"
@type="number"
@label="ember-gwr.buildingEntrance.fields.locality.swissZipCode"
@required={{true}}
@disabled={{true}}
/>
<Field
@attr="building.buildingEntrance.locality.street"
Expand All @@ -165,11 +172,6 @@
)
}}
@on-update={{fn this.syncLocalityWithStreet changeset}}
@disabled={{not
(changeset-get
changeset "building.buildingEntrance.locality.swissZipCode"
)
}}
@required={{true}}
/>
<Field
Expand Down Expand Up @@ -472,4 +474,4 @@
<Field @attr="building.buildingFreeText2" />
</ModelForm>
{{/if}}
</div>
</div>

0 comments on commit 8bb2e42

Please sign in to comment.