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

qc disable form #308

Merged
merged 1 commit into from
Jul 20, 2022
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
62 changes: 33 additions & 29 deletions addon/components/link-street.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -71,35 +71,39 @@
readonly
/>
{{/unless}}
<div class="uk-flex-inline">
<LinkTo
class="uk-button
{{if @buildingEntrance.street.isNew "uk-button-primary" "uk-button-default"
}}"
@route="building.edit.entrance.edit.link-street"
@models={{or
@routeModels
(if @buildingEntrance.isNew (array "new") (array))
}}
@query={{hash
[email protected]
[email protected]
[email protected]
}}
@disabled={{not @buildingEntrance.locality.name.nameLong}}
uk-tooltip="title: {{unless
{{#if (not (or @disabled (not @buildingEntrance.locality.name.nameLong)))}}
<div class="uk-flex-inline">
<LinkTo
class="uk-button
{{if
@buildingEntrance.street.isNew
'uk-button-primary'
'uk-button-default'
}}"
@route="building.edit.entrance.edit.link-street"
@models={{or
@routeModels
(if @buildingEntrance.isNew (array "new") (array))
}}
@query={{hash
[email protected]
[email protected]
[email protected]
}}
uk-tooltip="title: {{unless
@buildingEntrance.locality.name.nameLong
(t "ember-gwr.components.linkStreet.missingLocalityHint")
(t 'ember-gwr.components.linkStreet.missingLocalityHint')
}}; container: {{this.config.modalContainer}}"
>
{{t
(if
@buildingEntrance.street.isNew
"ember-gwr.components.linkStreet.link"
"ember-gwr.components.linkStreet.change"
)
}}
</LinkTo>
</div>
>
{{t
(if
@buildingEntrance.street.isNew
"ember-gwr.components.linkStreet.link"
"ember-gwr.components.linkStreet.change"
)
}}
</LinkTo>
</div>
{{/if}}
{{/let}}
{{/if}}
{{/if}}
4 changes: 3 additions & 1 deletion addon/components/model-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
)
as |Submit SubmitErrors|
}}
{{!-- template-lint-disable no-passed-in-event-handlers --}}
{{! template-lint-disable no-passed-in-event-handlers }}
<ModelForm::Header
@model={{@headerModel}}
@modelId={{@headerModelId}}
Expand All @@ -48,6 +48,7 @@
@translationBase={{@translationBase}}
@submit={{Submit}}
@submitErrors={{SubmitErrors}}
@disabled={{@disabled}}
/>
{{yield
(component
Expand All @@ -58,6 +59,7 @@
input=f.input
registerDiff=this.registerDiff
resolveDiff=this.resolveDiff
disabled=@disabled
)
f.model
}}
Expand Down
1 change: 1 addition & 0 deletions addon/components/model-form/header.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
@openStatus={{fn (mut this.changeStatus) true}}
@modelName={{@modelName}}
@translationBase={{@translationBase}}
@disabled={{@disabled}}
/>
</div>
{{#if (and @model (not @model.isNew))}}
Expand Down
8 changes: 5 additions & 3 deletions addon/components/model-form/header/actions.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<button
class="uk-button uk-button-default uk-flex-none uk-padding-small uk-padding-remove-vertical uk-margin-small-right"
type="button"
disabled={{@disabled}}
>
<span class="uk-icon" uk-icon="more-vertical"></span>
</button>
Expand Down Expand Up @@ -65,6 +66,7 @@
<button
class="uk-button uk-button-default uk-flex-none uk-padding-small uk-padding-remove-vertical"
type="button"
disabled={{@disabled}}
>
<span class="uk-icon" uk-icon="more-vertical"></span>
</button>
Expand Down Expand Up @@ -94,9 +96,9 @@
{{/if}}
{{#if @hasStatus}}
<li>
<a
href="#ember-ebau-gwr-status"
uk-scroll
<a
href="#ember-ebau-gwr-status"
uk-scroll
class="uk-button uk-text-left uk-highlight-hover uk-text-secondary uk-width-1-1 uk-background-default uk-padding-remove"
{{on "click" @openStatus}}
>
Expand Down
4 changes: 4 additions & 0 deletions addon/components/quarterly-closure/disabled-form-info.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div uk-alert class="uk-alert-warning">
<FaIcon @icon="circle-info" />
{{t "ember-gwr.quarterlyClosure.components.disabledFormInfo"}}
</div>
1 change: 1 addition & 0 deletions addon/controllers/building/edit/dwelling/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default class BuildingEditDwellingEditController extends ImportController
@service intl;
@service notification;
@service router;
@service quarterlyClosure;

@tracked errors;

Expand Down
1 change: 1 addition & 0 deletions addon/controllers/building/edit/entrance/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default class BuildingEditEntranceEditIndexController extends ImportContr
@service notification;
@service router;
@service config;
@service quarterlyClosure;

@tracked errors;

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 @@ -19,6 +19,7 @@ export default class BuildingFormController extends ImportController {
@service intl;
@service notification;
@service router;
@service quarterlyClosure;

@tracked BuildingWorkValidations;
@tracked errors;
Expand Down
1 change: 1 addition & 0 deletions addon/controllers/project/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default class ProjectFormController extends ImportController {
@service router;
@service intl;
@service notification;
@service quarterlyClosure;

@tracked buildingWork;
@tracked typeOfConstructionProject;
Expand Down
4 changes: 4 additions & 0 deletions addon/services/quarterly-closure.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export default class QuarterlyClosureService extends Service {
};
}

get disableForms() {
return ![620, 630, 650, 651, 663, 665, 690].includes(this.status.id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe replace with constants

}

get constructionSurveyDeptNumber() {
return this.authFetch.constructionSurveyDeptNumber;
}
Expand Down
25 changes: 14 additions & 11 deletions addon/templates/building/edit/dwelling/edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<UkSpinner @ratio={{3}} />
</div>
{{else}}
{{#if this.quarterlyClosure.disableForms}}
<QuarterlyClosure::DisabledFormInfo />
{{/if}}
<ModelForm
@model={{this.dwelling}}
@validations={{this.DwellingValidations}}
Expand All @@ -23,6 +26,7 @@
@getChangeParameters={{this.getChangeParameters}}
@getCorrectionParameters={{this.getCorrectionParameters}}
@modelStatusField="dwellingStatus"
@disabled={{this.quarterlyClosure.disableForms}}
as |Field changeset|
>
<Field
Expand All @@ -37,21 +41,20 @@

<Field
@attr="floorType"
@type="select" @required={{true}}
@type="select"
@required={{true}}
@gwrEnumOptions={{this.Models.Dwelling.floorTypeOptions}}
@hint={{t "ember-gwr.dwelling.floorHint"}}
/>

{{#if (or
(eq changeset.floorType 3101)
(eq changeset.floorType 3401)
(and this.import this.import.data.floorNumber)
)}}
<Field
@attr="floorNumber"
@type="number"
@required={{true}}
/>
{{#if
(or
(eq changeset.floorType 3101)
(eq changeset.floorType 3401)
(and this.import this.import.data.floorNumber)
)
}}
<Field @attr="floorNumber" @type="number" @required={{true}} />
{{/if}}

<Field @attr="multipleFloor" @type="checkbox" @required={{true}} />
Expand Down
37 changes: 25 additions & 12 deletions addon/templates/building/edit/entrance/edit/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<UkSpinner @ratio={{3}} />
</div>
{{else}}
{{#if this.quarterlyClosure.disableForms}}
<QuarterlyClosure::DisabledFormInfo />
{{/if}}
<ModelForm
@model={{this.buildingEntrance}}
@validations={{this.BuildingEntranceValidations}}
Expand All @@ -17,7 +20,7 @@
@headerModelName="entrance"
@hasStatus={{false}}
@import={{this.import}}
@disabled={{this.hasNoStreet}}
@disabled={{or this.hasNoStreet this.quarterlyClosure.disableForms}}
as |Field|
>
{{#unless this.buildingEntrance.isNew}}
Expand All @@ -27,38 +30,47 @@
<Field
@attr="locality.name.nameLong"
@required={{true}}
@disabled={{not this.buildingEntrance.isNew}}
@disabled={{or
this.quarterlyClosure.disableForms
(not this.buildingEntrance.isNew)
}}
/>
<Field
@attr="locality.swissZipCode"
@type="number"
@disabled={{not this.buildingEntrance.isNew}}
@disabled={{or
this.quarterlyClosure.disableForms
(not this.buildingEntrance.isNew)
}}
@required={{true}}
/>
{{#unless this.buildingEntrance.isNew}}
<Field
@attr="locality.swissZipCodeAddOn"
@type="number"
@disabled={{not this.buildingEntrance.isNew}}
@disabled={{or
this.quarterlyClosure.disableForms
(not this.buildingEntrance.isNew)
}}
/>
{{/unless}}
{{!-- API rejects any modification of the buildingEntranceNo or isOfficial
fields on building entrances that are not linked to a street. --}}
{{! API rejects any modification of the buildingEntranceNo or isOfficial
fields on building entrances that are not linked to a street. }}
<div
uk-tooltip="title: {{if
this.hasNoStreet
(t "ember-gwr.buildingEntrance.missingStreetInfo")
}}
this.hasNoStreet
(t 'ember-gwr.buildingEntrance.missingStreetInfo')
}}
; container: {{this.config.modalContainer}}; pos: top-left"
>
<Field
@attr="buildingEntranceNo"
@disabled={{this.hasNoStreet}}
@disabled={{or this.quarterlyClosure.disableForms this.hasNoStreet}}
/>
<Field
@attr="isOfficialAddress"
@type="checkbox"
@disabled={{this.hasNoStreet}}
@disabled={{or this.quarterlyClosure.disableForms this.hasNoStreet}}
/>
</div>
{{#unless this.buildingEntrance.isNew}}
Expand Down Expand Up @@ -92,8 +104,9 @@
@fieldComponent={{Field}}
@buildingEntrance={{this.buildingEntrance}}
@translationBase="ember-gwr.buildingEntrance.fields"
@disabled={{this.quarterlyClosure.disableForms}}
/>
{{/unless}}
</ModelForm>
{{/if}}
</div>
</div>
Loading