From 62296b689c6552f3f752217bec1932b7e05bd664 Mon Sep 17 00:00:00 2001 From: Jonas Cosandey Date: Tue, 19 Jul 2022 17:28:21 +0200 Subject: [PATCH] feat(quarterly-closure): disable forms while bfs is checking data --- addon/components/link-street.hbs | 62 ++++---- addon/components/model-form.hbs | 4 +- addon/components/model-form/header.hbs | 1 + .../components/model-form/header/actions.hbs | 8 +- .../quarterly-closure/disabled-form-info.hbs | 4 + .../building/edit/dwelling/edit.js | 1 + .../building/edit/entrance/edit/index.js | 1 + addon/controllers/building/edit/form.js | 1 + addon/controllers/project/form.js | 1 + addon/services/quarterly-closure.js | 4 + .../templates/building/edit/dwelling/edit.hbs | 25 +-- .../building/edit/entrance/edit/index.hbs | 37 +++-- addon/templates/building/edit/form.hbs | 33 ++-- addon/templates/project/form.hbs | 143 ++++++++++++------ translations/quarterly-closure/de.yaml | 1 + 15 files changed, 213 insertions(+), 113 deletions(-) create mode 100644 addon/components/quarterly-closure/disabled-form-info.hbs diff --git a/addon/components/link-street.hbs b/addon/components/link-street.hbs index f34705d1..94602116 100644 --- a/addon/components/link-street.hbs +++ b/addon/components/link-street.hbs @@ -71,35 +71,39 @@ readonly /> {{/unless}} -
- + - {{t - (if - @buildingEntrance.street.isNew - "ember-gwr.components.linkStreet.link" - "ember-gwr.components.linkStreet.change" - ) - }} - -
+ > + {{t + (if + @buildingEntrance.street.isNew + "ember-gwr.components.linkStreet.link" + "ember-gwr.components.linkStreet.change" + ) + }} + + + {{/if}} {{/let}} -{{/if}} \ No newline at end of file +{{/if}} diff --git a/addon/components/model-form.hbs b/addon/components/model-form.hbs index 2ce5a9ae..9b6863ee 100644 --- a/addon/components/model-form.hbs +++ b/addon/components/model-form.hbs @@ -25,7 +25,7 @@ ) as |Submit SubmitErrors| }} - {{!-- template-lint-disable no-passed-in-event-handlers --}} + {{! template-lint-disable no-passed-in-event-handlers }} {{yield (component @@ -58,6 +59,7 @@ input=f.input registerDiff=this.registerDiff resolveDiff=this.resolveDiff + disabled=@disabled ) f.model }} diff --git a/addon/components/model-form/header.hbs b/addon/components/model-form/header.hbs index 5f238ab8..c4669245 100644 --- a/addon/components/model-form/header.hbs +++ b/addon/components/model-form/header.hbs @@ -16,6 +16,7 @@ @openStatus={{fn (mut this.changeStatus) true}} @modelName={{@modelName}} @translationBase={{@translationBase}} + @disabled={{@disabled}} /> {{#if (and @model (not @model.isNew))}} diff --git a/addon/components/model-form/header/actions.hbs b/addon/components/model-form/header/actions.hbs index 9c3330c5..825c5eb3 100644 --- a/addon/components/model-form/header/actions.hbs +++ b/addon/components/model-form/header/actions.hbs @@ -28,6 +28,7 @@ @@ -65,6 +66,7 @@ @@ -94,9 +96,9 @@ {{/if}} {{#if @hasStatus}}
  • - diff --git a/addon/components/quarterly-closure/disabled-form-info.hbs b/addon/components/quarterly-closure/disabled-form-info.hbs new file mode 100644 index 00000000..84932ebb --- /dev/null +++ b/addon/components/quarterly-closure/disabled-form-info.hbs @@ -0,0 +1,4 @@ +
    + + {{t "ember-gwr.quarterlyClosure.components.disabledFormInfo"}} +
    diff --git a/addon/controllers/building/edit/dwelling/edit.js b/addon/controllers/building/edit/dwelling/edit.js index 6a3cae9f..dcf45837 100644 --- a/addon/controllers/building/edit/dwelling/edit.js +++ b/addon/controllers/building/edit/dwelling/edit.js @@ -18,6 +18,7 @@ export default class BuildingEditDwellingEditController extends ImportController @service intl; @service notification; @service router; + @service quarterlyClosure; @tracked errors; diff --git a/addon/controllers/building/edit/entrance/edit/index.js b/addon/controllers/building/edit/entrance/edit/index.js index e428abe7..c86fc8d5 100644 --- a/addon/controllers/building/edit/entrance/edit/index.js +++ b/addon/controllers/building/edit/entrance/edit/index.js @@ -17,6 +17,7 @@ export default class BuildingEditEntranceEditIndexController extends ImportContr @service notification; @service router; @service config; + @service quarterlyClosure; @tracked errors; diff --git a/addon/controllers/building/edit/form.js b/addon/controllers/building/edit/form.js index 1c89b523..11640f76 100644 --- a/addon/controllers/building/edit/form.js +++ b/addon/controllers/building/edit/form.js @@ -19,6 +19,7 @@ export default class BuildingFormController extends ImportController { @service intl; @service notification; @service router; + @service quarterlyClosure; @tracked BuildingWorkValidations; @tracked errors; diff --git a/addon/controllers/project/form.js b/addon/controllers/project/form.js index c749855a..43d667c8 100644 --- a/addon/controllers/project/form.js +++ b/addon/controllers/project/form.js @@ -22,6 +22,7 @@ export default class ProjectFormController extends ImportController { @service router; @service intl; @service notification; + @service quarterlyClosure; @tracked buildingWork; @tracked typeOfConstructionProject; diff --git a/addon/services/quarterly-closure.js b/addon/services/quarterly-closure.js index 526b6292..d63fdb85 100644 --- a/addon/services/quarterly-closure.js +++ b/addon/services/quarterly-closure.js @@ -44,6 +44,10 @@ export default class QuarterlyClosureService extends Service { }; } + get disableForms() { + return ![620, 630, 650, 651, 663, 665, 690].includes(this.status.id); + } + get constructionSurveyDeptNumber() { return this.authFetch.constructionSurveyDeptNumber; } diff --git a/addon/templates/building/edit/dwelling/edit.hbs b/addon/templates/building/edit/dwelling/edit.hbs index 5c1f0562..205b323b 100644 --- a/addon/templates/building/edit/dwelling/edit.hbs +++ b/addon/templates/building/edit/dwelling/edit.hbs @@ -4,6 +4,9 @@ {{else}} + {{#if this.quarterlyClosure.disableForms}} + + {{/if}} - {{#if (or - (eq changeset.floorType 3101) - (eq changeset.floorType 3401) - (and this.import this.import.data.floorNumber) - )}} - + {{#if + (or + (eq changeset.floorType 3101) + (eq changeset.floorType 3401) + (and this.import this.import.data.floorNumber) + ) + }} + {{/if}} diff --git a/addon/templates/building/edit/entrance/edit/index.hbs b/addon/templates/building/edit/entrance/edit/index.hbs index 7857028f..8896f303 100644 --- a/addon/templates/building/edit/entrance/edit/index.hbs +++ b/addon/templates/building/edit/entrance/edit/index.hbs @@ -4,6 +4,9 @@ {{else}} + {{#if this.quarterlyClosure.disableForms}} + + {{/if}} {{#unless this.buildingEntrance.isNew}} @@ -27,38 +30,47 @@ {{#unless 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. }}
    {{#unless this.buildingEntrance.isNew}} @@ -92,8 +104,9 @@ @fieldComponent={{Field}} @buildingEntrance={{this.buildingEntrance}} @translationBase="ember-gwr.buildingEntrance.fields" + @disabled={{this.quarterlyClosure.disableForms}} /> {{/unless}}
    {{/if}} - \ No newline at end of file + diff --git a/addon/templates/building/edit/form.hbs b/addon/templates/building/edit/form.hbs index 124178e9..d8d2a595 100644 --- a/addon/templates/building/edit/form.hbs +++ b/addon/templates/building/edit/form.hbs @@ -16,6 +16,9 @@ {{else}} + {{#if this.quarterlyClosure.disableForms}} + + {{/if}} {{#unless this.buildingWork.isNew}} @@ -142,7 +146,6 @@ @gwrEnumOptions={{this.Models.Building.buildingClassOptions}} /> - {{#if this.buildingWork.building.isNew}}

    {{t "ember-gwr.building.buildingEntrance.mainEntrance"}} @@ -312,17 +315,23 @@ @label="ember-gwr.building.heating.revisionDate" /> -