Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(entrance): ensure street is set for building creation #798

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions addon/components/link-building-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
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
1 change: 1 addition & 0 deletions addon/controllers/building/edit/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ 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>