ember-ebau-gwr 4.0.7 → 5.0.2

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.
Files changed (161) hide show
  1. package/CHANGELOG.md +312 -299
  2. package/README.md +25 -8
  3. package/addon/components/building-preview.hbs +53 -0
  4. package/addon/components/housing-stat-link.hbs +8 -0
  5. package/addon/components/import-modal/building-data.hbs +1 -55
  6. package/addon/components/import-modal/dwelling-data.hbs +3 -3
  7. package/addon/components/import-modal/entrance-data.hbs +1 -1
  8. package/addon/components/import-modal.hbs +1 -4
  9. package/addon/components/link-building-modal.hbs +38 -24
  10. package/addon/components/link-building-modal.js +13 -5
  11. package/addon/components/link-street.hbs +33 -31
  12. package/addon/components/linked-models.hbs +13 -6
  13. package/addon/components/linked-projects.hbs +8 -6
  14. package/addon/components/linked-projects.js +13 -0
  15. package/addon/components/loading.hbs +3 -0
  16. package/addon/components/login-modal.hbs +86 -68
  17. package/addon/components/model-errors/error-indicator.hbs +1 -2
  18. package/addon/components/model-errors/header.hbs +6 -2
  19. package/addon/components/model-errors/list.hbs +13 -4
  20. package/addon/components/model-errors/skeleton-errors.hbs +14 -0
  21. package/addon/components/model-errors/skeleton.hbs +1 -16
  22. package/addon/components/model-errors.hbs +14 -16
  23. package/addon/components/model-form/date.hbs +10 -6
  24. package/addon/components/model-form/diff.hbs +8 -8
  25. package/addon/components/model-form/field.hbs +3 -2
  26. package/addon/components/model-form/field.js +7 -5
  27. package/addon/components/model-form/header/actions.hbs +25 -22
  28. package/addon/components/model-form/header/actions.js +6 -3
  29. package/addon/components/model-form/header/errors.hbs +16 -16
  30. package/addon/components/model-form/header/status-selector/submit-parameters.hbs +2 -1
  31. package/addon/components/model-form/header/status-selector.hbs +15 -3
  32. package/addon/components/model-form/header/status.hbs +2 -1
  33. package/addon/components/model-form/header.hbs +6 -5
  34. package/addon/components/model-form/step.hbs +5 -5
  35. package/addon/components/model-form/submit.hbs +1 -0
  36. package/addon/components/model-form.hbs +110 -77
  37. package/addon/components/model-form.js +38 -2
  38. package/addon/components/model-inview.hbs +2 -7
  39. package/addon/components/project-landing-page.hbs +26 -0
  40. package/addon/components/project-nav.hbs +65 -0
  41. package/addon/components/project-nav.js +27 -0
  42. package/addon/components/quarterly-closure/card-status.hbs +11 -0
  43. package/addon/components/quarterly-closure/card-status.js +36 -0
  44. package/addon/components/quarterly-closure/close-survey-button.hbs +10 -0
  45. package/addon/components/quarterly-closure/close-survey-button.js +46 -0
  46. package/addon/components/quarterly-closure/disabled-form-info.hbs +4 -0
  47. package/addon/components/quarterly-closure/error-list/project-errors.hbs +22 -0
  48. package/addon/components/quarterly-closure/error-list/project-errors.js +41 -0
  49. package/addon/components/quarterly-closure/error-list/survey-department-errors.hbs +22 -0
  50. package/addon/components/quarterly-closure/error-list/survey-department-errors.js +28 -0
  51. package/addon/components/quarterly-closure/error-list.hbs +4 -0
  52. package/addon/components/quarterly-closure/status.hbs +8 -0
  53. package/addon/components/quarterly-closure/status.js +6 -0
  54. package/addon/components/quarterly-closure/title.hbs +15 -0
  55. package/addon/components/quarterly-closure/title.js +11 -0
  56. package/addon/components/quarterly-closure.hbs +9 -0
  57. package/addon/components/quarterly-closure.js +6 -0
  58. package/addon/components/search/filters.hbs +128 -106
  59. package/addon/components/search/filters.js +13 -59
  60. package/addon/components/search/result-table/head/header.hbs +1 -1
  61. package/addon/components/search/result-table/head.hbs +1 -1
  62. package/addon/components/search/result-table/load-more.hbs +5 -0
  63. package/addon/components/search/result-table/row/field.hbs +1 -1
  64. package/addon/components/search/result-table/row.hbs +12 -13
  65. package/addon/components/search/result-table.hbs +3 -2
  66. package/addon/components/search.hbs +29 -0
  67. package/addon/components/search.js +96 -0
  68. package/addon/components/soon-available.hbs +7 -0
  69. package/addon/components/sub-nav.hbs +5 -8
  70. package/addon/components/title-card.hbs +28 -0
  71. package/addon/components/validated-form-error.hbs +4 -0
  72. package/addon/components/validated-form-error.js +14 -0
  73. package/addon/controllers/building/edit/dwelling/edit.js +2 -3
  74. package/addon/controllers/building/edit/entrance/edit/index.js +2 -3
  75. package/addon/controllers/building/edit/entrance/edit/link-street.js +4 -1
  76. package/addon/controllers/building/edit/form.js +57 -39
  77. package/addon/controllers/import.js +8 -64
  78. package/addon/controllers/project/form.js +3 -4
  79. package/addon/controllers/project.js +22 -44
  80. package/addon/controllers/search-building.js +39 -14
  81. package/addon/controllers/search-project.js +24 -19
  82. package/addon/helpers/current-quarter.js +8 -0
  83. package/addon/helpers/current-route-is-not.js +7 -0
  84. package/addon/helpers/current-route-is.js +15 -0
  85. package/addon/helpers/is-set.js +9 -0
  86. package/addon/helpers/is-unset.js +4 -4
  87. package/addon/helpers/show-model-field.js +4 -4
  88. package/addon/models/check-construction-project-response.js +20 -0
  89. package/addon/models/check-survey-department-response.js +20 -0
  90. package/addon/models/quarterly-closure-status.js +52 -0
  91. package/addon/modifiers/in-viewport.js +14 -0
  92. package/addon/modifiers/inverse-background.js +21 -0
  93. package/addon/resources/import.js +69 -0
  94. package/addon/routes/building/edit.js +1 -1
  95. package/addon/routes/building/new.js +1 -1
  96. package/addon/routes/building.js +7 -2
  97. package/addon/routes/global-landing-page.js +9 -0
  98. package/addon/routes/project/errors.js +1 -1
  99. package/addon/routes/project/form.js +1 -1
  100. package/addon/routes/project/new.js +1 -1
  101. package/addon/routes/project.js +1 -1
  102. package/addon/routes/quarterly-closure.js +3 -0
  103. package/addon/routes/search-building.js +7 -2
  104. package/addon/routes.js +7 -3
  105. package/addon/services/auth-fetch.js +6 -7
  106. package/addon/services/construction-project.js +10 -0
  107. package/addon/services/gwr.js +19 -7
  108. package/addon/services/quarterly-closure.js +147 -0
  109. package/addon/templates/building/edit/dwelling/edit.hbs +22 -19
  110. package/addon/templates/building/edit/dwelling/new.hbs +1 -1
  111. package/addon/templates/building/edit/dwelling.hbs +1 -1
  112. package/addon/templates/building/edit/dwellings.hbs +3 -4
  113. package/addon/templates/building/edit/entrance/edit/index.hbs +32 -18
  114. package/addon/templates/building/edit/entrance/edit/link-street.hbs +79 -75
  115. package/addon/templates/building/edit/entrance/edit.hbs +1 -1
  116. package/addon/templates/building/edit/entrance/new.hbs +1 -1
  117. package/addon/templates/building/edit/entrance.hbs +6 -5
  118. package/addon/templates/building/edit/entrances.hbs +4 -6
  119. package/addon/templates/building/edit/form.hbs +127 -112
  120. package/addon/templates/building/edit/index.hbs +1 -1
  121. package/addon/templates/building/edit.hbs +33 -23
  122. package/addon/templates/building.hbs +1 -1
  123. package/addon/templates/global-landing-page.hbs +34 -0
  124. package/addon/templates/project/errors.hbs +116 -109
  125. package/addon/templates/project/form.hbs +96 -63
  126. package/addon/templates/project/index.hbs +0 -1
  127. package/addon/templates/project/linked-buildings.hbs +7 -10
  128. package/addon/templates/project.hbs +12 -73
  129. package/addon/templates/quarterly-closure.hbs +1 -0
  130. package/addon/templates/search-building.hbs +202 -134
  131. package/addon/templates/search-project.hbs +98 -85
  132. package/addon/validations/building-work.js +106 -97
  133. package/addon/validations/extended-search-fields.js +27 -0
  134. package/addon/validations/realestate-identification.js +1 -0
  135. package/addon/xml/helpers.js +3 -0
  136. package/addon/xml/templates/building.js +1 -1
  137. package/addon/xml/templates/construction-project.js +1 -1
  138. package/app/styles/ember-ebau-gwr.scss +19 -0
  139. package/config/environment.js +4 -0
  140. package/config/icons.js +15 -0
  141. package/package.json +19 -15
  142. package/translations/de.yaml +29 -26
  143. package/translations/fr.yaml +11 -19
  144. package/translations/quarterly-closure/de.yaml +59 -0
  145. package/translations/validation-errors/de.yaml +37 -0
  146. package/addon/components/landing-page.hbs +0 -24
  147. package/addon/components/project-form/checkbox.hbs +0 -11
  148. package/addon/components/project-form/checkbox.js +0 -9
  149. package/addon/components/project-form/date.hbs +0 -10
  150. package/addon/components/project-form/diff.hbs +0 -43
  151. package/addon/components/project-form/diff.js +0 -18
  152. package/addon/components/project-form/field.hbs +0 -32
  153. package/addon/components/project-form/field.js +0 -59
  154. package/addon/components/project-form/input.hbs +0 -7
  155. package/addon/components/project-form/label.hbs +0 -17
  156. package/addon/components/project-form/select.hbs +0 -17
  157. package/addon/components/project-form/textarea.hbs +0 -7
  158. package/addon/components/project-form.hbs +0 -19
  159. package/addon/components/project-form.js +0 -14
  160. package/addon/components/sub-nav.js +0 -18
  161. package/addon/services/import-state.js +0 -10
package/README.md CHANGED
@@ -13,8 +13,8 @@ yarn start
13
13
 
14
14
  ## Compatibility
15
15
 
16
- - Ember.js v3.24 or above
17
- - Ember CLI v3.24 or above
16
+ - Ember.js v3.28 or above
17
+ - Ember CLI v3.28 or above
18
18
  - Node.js v12 or above
19
19
 
20
20
  ## Installation
@@ -32,6 +32,19 @@ will then be used to filter the `gwr-links` by their attribute `local_id`.
32
32
  this.mount("ember-ebau-gwr", { as: "gwr", path: "gwr/:id" });
33
33
  ```
34
34
 
35
+ ### Enviroment configuration
36
+ In your `config/environment.js` you need to define the following option for
37
+ `changeset-validations`. We use this feature to generate translated errors:
38
+ ```js
39
+ "changeset-validations": { rawOutput: true },
40
+ ```
41
+
42
+ > **Important**
43
+ > This currentlry has the limitation, that if your app uses
44
+ `changeset-validations` itself, this option changes the behaviour in the whole
45
+ app. Due to engine config restrictions, there is sadly currently no other way
46
+ than maybe implementing something on build-pipeline level.
47
+
35
48
  ### Styling
36
49
 
37
50
  The engine uses the UI framework "UIkit" through [ember-uikit](https://github.com/adfinis-sygroup/ember-uikit). To enable the styling, add the following import to `app/styles/app.scss`:
@@ -62,12 +75,16 @@ dependencies = {
62
75
 
63
76
  The config service is used to pass config to the engine. The following properties can be configured:
64
77
 
65
- | Name | Type |
66
- | ------------------------------ | -------- |
67
- | `municipalityId` | `Number` |
68
- | `municipalityName` | `String` |
69
- | `cantonAbbreviation` | `String` |
70
- | `constructionSurveyDeptNumber` | `Number` |
78
+ | Name | Type | Description |
79
+ | -------------------- | ---------------- | -------------------------------------------------------------------------------------------------- |
80
+ | `gwrAPI` | `URL Path` | URL path to the gwr api proxy. Example: `/housing-stat/regbl/api/ech0216/` |
81
+ | `isTestEnvironment` | `Boolean` | Is the code deployed on staging or production |
82
+ | `cantonAbbreviation` | `String` | `BE`, `SZ`,`UR` etc. |
83
+ | `importModels` | `[String]` | A list of model names for which the import should be available. Example: `["project", "building"]` |
84
+ | `authToken` | `String` | The authentication toke from the host app. |
85
+ | `camacGroup` | `String\|Number` | The current camac group of the user. |
86
+ | `pageSize` | `Number` | The page size which the gwr api should return. |
87
+ | `modalContainer` | `CSS Selector` | A CSS selector to render the modals in. |
71
88
 
72
89
  All values should follow the officially used format.
73
90
 
@@ -0,0 +1,53 @@
1
+ <span class="uk-flex uk-child-width-1-2">
2
+ <span>{{t "ember-gwr.building.buildingStatus"}}</span>
3
+ <span class="uk-text-muted">{{if
4
+ @model.buildingStatus
5
+ (t
6
+ (concat
7
+ "ember-gwr.building.buildingStatusOptions." @model.buildingStatus
8
+ )
9
+ )
10
+ "-"
11
+ }}</span>
12
+ </span>
13
+ <hr />
14
+ <span class="uk-flex uk-child-width-1-2">
15
+ <span>{{t "ember-gwr.building.nameOfBuilding"}}</span>
16
+ <span class="uk-text-muted">{{or @model.nameOfBuilding "-"}}</span>
17
+ </span>
18
+ <hr />
19
+ <span class="uk-flex uk-child-width-1-2">
20
+ <span>{{t "ember-gwr.building.buildingCategory"}}</span>
21
+ <span class="uk-text-muted">
22
+ {{if
23
+ @model.buildingCategory
24
+ (t
25
+ (concat
26
+ "ember-gwr.building.buildingCategoryOptions."
27
+ @model.buildingCategory
28
+ )
29
+ )
30
+ "-"
31
+ }}
32
+ </span>
33
+ </span>
34
+ <hr />
35
+ <span class="uk-flex uk-child-width-1-2">
36
+ <span>{{t "ember-gwr.building.buildingClass"}}</span>
37
+ <span class="uk-text-muted">
38
+ {{if
39
+ @model.buildingClass
40
+ (t
41
+ (concat
42
+ "ember-gwr.building.buildingClassOptions." @model.buildingClass
43
+ )
44
+ )
45
+ "-"
46
+ }}
47
+ </span>
48
+ </span>
49
+ <hr />
50
+ <span class="uk-flex uk-child-width-1-2">
51
+ <span>{{t "ember-gwr.building.numberOfFloors"}}</span>
52
+ <span class="uk-text-muted">{{or @model.numberOfFloors "-"}}</span>
53
+ </span>
@@ -0,0 +1,8 @@
1
+ <a
2
+ class="uk-button uk-button-default"
3
+ href={{housing-stat-link}}
4
+ target="_blank"
5
+ rel="noopener noreferrer"
6
+ >
7
+ {{t "ember-gwr.nav.housingStatLink"}}
8
+ </a>
@@ -7,58 +7,4 @@
7
7
  }}</span>
8
8
  </span>
9
9
  <hr />
10
- <span class="uk-flex uk-child-width-1-2">
11
- <span>{{t "ember-gwr.building.buildingStatus"}}</span>
12
- <span class="uk-text-muted">{{if
13
- @model.building.buildingStatus
14
- (t
15
- (concat
16
- "ember-gwr.building.buildingStatusOptions."
17
- @model.building.buildingStatus
18
- )
19
- )
20
- "-"
21
- }}</span>
22
- </span>
23
- <hr />
24
- <span class="uk-flex uk-child-width-1-2">
25
- <span>{{t "ember-gwr.building.nameOfBuilding"}}</span>
26
- <span class="uk-text-muted">{{or @model.building.nameOfBuilding "-"}}</span>
27
- </span>
28
- <hr />
29
- <span class="uk-flex uk-child-width-1-2">
30
- <span>{{t "ember-gwr.building.buildingCategory"}}</span>
31
- <span class="uk-text-muted">
32
- {{if
33
- @model.building.buildingCategory
34
- (t
35
- (concat
36
- "ember-gwr.building.buildingCategoryOptions."
37
- @model.building.buildingCategory
38
- )
39
- )
40
- "-"
41
- }}
42
- </span>
43
- </span>
44
- <hr />
45
- <span class="uk-flex uk-child-width-1-2">
46
- <span>{{t "ember-gwr.building.buildingClass"}}</span>
47
- <span class="uk-text-muted">
48
- {{if
49
- @model.building.buildingClass
50
- (t
51
- (concat
52
- "ember-gwr.building.buildingClassOptions."
53
- @model.building.buildingClass
54
- )
55
- )
56
- "-"
57
- }}
58
- </span>
59
- </span>
60
- <hr />
61
- <span class="uk-flex uk-child-width-1-2">
62
- <span>{{t "ember-gwr.building.numberOfFloors"}}</span>
63
- <span class="uk-text-muted">{{or @model.building.numberOfFloors "-"}}</span>
64
- </span>
10
+ <BuildingPreview @model={{@model.building}} />
@@ -2,8 +2,8 @@
2
2
  <span>{{t "ember-gwr.dwelling.floor"}}</span>
3
3
  <span class="uk-text-muted">
4
4
  {{#if @model.floorType}}
5
- {{concat
6
- (if @model.floorNumber (concat @model.floorNumber ". "))
5
+ {{concat
6
+ (if @model.floorNumber (concat @model.floorNumber ". "))
7
7
  (t (concat "ember-gwr.dwelling.floorTypeOptions." @model.floorType))
8
8
  }}
9
9
  {{else}}
@@ -36,4 +36,4 @@
36
36
  <span class="uk-text-muted">
37
37
  {{or @model.locationOfDwellingOnFloor "-"}}
38
38
  </span>
39
- </span>
39
+ </span>
@@ -11,4 +11,4 @@
11
11
  <span class="uk-flex uk-child-width-1-2">
12
12
  <span>{{t "ember-gwr.buildingEntrance.fields.locality.swissZipCode"}}</span>
13
13
  <span class="uk-text-muted">{{or @model.locality.swissZipCode "-"}}</span>
14
- </span>
14
+ </span>
@@ -3,7 +3,6 @@
3
3
  @btnClose={{false}}
4
4
  @escClose={{false}}
5
5
  @bgClose={{false}}
6
- @onHide={{@close}}
7
6
  @container={{this.config.modalContainer}}
8
7
  as |Modal|
9
8
  >
@@ -33,7 +32,6 @@
33
32
  <LinkTo
34
33
  @query={{hash import=true index=index}}
35
34
  class="uk-button uk-button-primary uk-margin-medium-top uk-width-1"
36
- {{on "click" @close}}
37
35
  >
38
36
  {{t "ember-gwr.components.modelForm.importFromCaluma"}}
39
37
  </LinkTo>
@@ -44,9 +42,8 @@
44
42
  </Modal.body>
45
43
  <Modal.footer>
46
44
  <LinkTo
47
- @query={{hash import=false index=undefined}}
45
+ @query={{hash import=false index=null}}
48
46
  class="uk-button uk-button-default uk-width-1"
49
- {{on "click" @close}}
50
47
  >
51
48
  {{t "ember-gwr.components.modelForm.cancelImport"}}
52
49
  </LinkTo>
@@ -10,33 +10,47 @@
10
10
  </h2>
11
11
  </Modal.header>
12
12
  <Modal.body>
13
- {{#let
14
- (component
15
- "project-form/field"
16
- project=this.buildingWork
17
- translationBase="ember-gwr.buildingWork"
18
- )
19
- as |Field|
20
- }}
21
- <Field
22
- @attr="kindOfWork"
23
- @inputType="select"
24
- @convertValueTo="number"
25
- @noPlaceholder={{true}}
13
+ <ValidatedForm
14
+ @model={{this.buildingWork}}
15
+ @on-submit={{perform this.submit}}
16
+ class="validated-form"
17
+ ...attributes
18
+ as |Form|
19
+ >
20
+ <Form.input
21
+ @name="kindOfWork"
22
+ @type="select"
23
+ @label={{t "ember-gwr.buildingWork.kindOfWork"}}
24
+ @prompt={{t "ember-gwr.buildingWork.kindOfWorkPlaceholder"}}
25
+ @optionLabelPath="label"
26
+ @optionValuePath="value"
27
+ @optionTargetPath="value"
26
28
  @options={{this.kindOfWorkOptions}}
29
+ @validateBeforeSubmit={{false}}
27
30
  />
28
31
  {{#if (eq this.buildingWork.kindOfWork 6002)}}
29
- <Field @attr="energeticRestauration" @inputType="checkbox" />
30
- <Field @attr="renovationHeatingsystem" @inputType="checkbox" />
31
- <Field @attr="innerConversionRenovation" @inputType="checkbox" />
32
- <Field @attr="conversion" @inputType="checkbox" />
33
- <Field @attr="extensionHeighteningHeated" @inputType="checkbox" />
34
- <Field @attr="extensionHeighteningNotHeated" @inputType="checkbox" />
35
- <Field @attr="thermicSolarFacility" @inputType="checkbox" />
36
- <Field @attr="photovoltaicSolarFacility" @inputType="checkbox" />
37
- <Field @attr="otherWorks" @inputType="checkbox" />
32
+ {{#each
33
+ (array
34
+ "energeticRestauration"
35
+ "renovationHeatingsystem"
36
+ "innerConversionRenovation"
37
+ "conversion"
38
+ "extensionHeighteningHeated"
39
+ "extensionHeighteningNotHeated"
40
+ "thermicSolarFacility"
41
+ "photovoltaicSolarFacility"
42
+ "otherWorks"
43
+ )
44
+ as |attr|
45
+ }}
46
+ <Form.input
47
+ @name={{attr}}
48
+ @type="checkbox"
49
+ @label={{t (concat "ember-gwr.buildingWork." attr)}}
50
+ />
51
+ {{/each}}
38
52
  {{/if}}
39
- {{/let}}
53
+ </ValidatedForm>
40
54
  </Modal.body>
41
55
  <Modal.footer class="uk-flex uk-flex-column">
42
56
  <div class="uk-flex uk-flex-between">
@@ -57,4 +71,4 @@
57
71
  </div>
58
72
  {{/if}}
59
73
  </Modal.footer>
60
- </UkModal>
74
+ </UkModal>
@@ -3,16 +3,24 @@ import Component from "@glimmer/component";
3
3
  import { tracked } from "@glimmer/tracking";
4
4
  import BuildingWork from "ember-ebau-gwr/models/building-work";
5
5
 
6
+ // Remove the state "Neubau" from the array since you cant link
7
+ // existing buildings as "Neubau".
8
+ const KIND_OF_WORK_OPTIONS = BuildingWork.kindOfWorkOptions.slice(1);
9
+
6
10
  export default class LinkBuildingModalComponent extends Component {
7
11
  @service config;
12
+ @service intl;
8
13
  @tracked buildingWork = new BuildingWork();
9
- // Remove the state "Neubau" from the array since you cant link
10
- // existing buildings as "Neubau".
11
- kindOfWorkOptions = BuildingWork.kindOfWorkOptions.slice(1);
12
14
 
13
15
  constructor(...args) {
14
16
  super(...args);
15
- this.buildingWork = new BuildingWork();
16
- this.buildingWork.kindOfWork = this.kindOfWorkOptions[0];
17
+ this.buildingWork.kindOfWork = this.kindOfWorkOptions[0].value;
18
+ }
19
+
20
+ get kindOfWorkOptions() {
21
+ return KIND_OF_WORK_OPTIONS.map((option) => ({
22
+ value: option,
23
+ label: this.intl.t(`ember-gwr.buildingWork.kindOfWorkOptions.${option}`),
24
+ }));
17
25
  }
18
26
  }
@@ -1,7 +1,5 @@
1
1
  {{#if this.fetchStreet.isRunning}}
2
- <div class="uk-flex uk-flex-center uk-flex-middle uk-margin-large-top">
3
- <UkSpinner @ratio={{3}} />
4
- </div>
2
+ <Loading />
5
3
  {{else}}
6
4
  {{#let @fieldComponent as |Field|}}
7
5
  {{#unless @buildingEntrance.street.isNew}}
@@ -71,35 +69,39 @@
71
69
  readonly
72
70
  />
73
71
  {{/unless}}
74
- <div class="uk-flex-inline">
75
- <LinkTo
76
- class="uk-button
77
- {{if @buildingEntrance.street.isNew "uk-button-primary" "uk-button-default"
78
- }}"
79
- @route="building.edit.entrance.edit.link-street"
80
- @models={{or
81
- @routeModels
82
- (if @buildingEntrance.isNew (array "new") (array))
83
- }}
84
- @query={{hash
85
- locality=@buildingEntrance.locality.name.nameLong
86
- PLZ4=@buildingEntrance.locality.swissZipCode
87
- PLZ6=@buildingEntrance.locality.swissZipCodeAddOn
88
- }}
89
- @disabled={{not @buildingEntrance.locality.name.nameLong}}
90
- uk-tooltip="title: {{unless
72
+ {{#if (not (or @disabled (not @buildingEntrance.locality.name.nameLong)))}}
73
+ <div class="uk-flex-inline">
74
+ <LinkTo
75
+ class="uk-button
76
+ {{if
77
+ @buildingEntrance.street.isNew
78
+ 'uk-button-primary'
79
+ 'uk-button-default'
80
+ }}"
81
+ @route="building.edit.entrance.edit.link-street"
82
+ @models={{or
83
+ @routeModels
84
+ (if @buildingEntrance.isNew (array "new") (array))
85
+ }}
86
+ @query={{hash
87
+ locality=@buildingEntrance.locality.name.nameLong
88
+ PLZ4=@buildingEntrance.locality.swissZipCode
89
+ PLZ6=@buildingEntrance.locality.swissZipCodeAddOn
90
+ }}
91
+ uk-tooltip="title: {{unless
91
92
  @buildingEntrance.locality.name.nameLong
92
- (t "ember-gwr.components.linkStreet.missingLocalityHint")
93
+ (t 'ember-gwr.components.linkStreet.missingLocalityHint')
93
94
  }}; container: {{this.config.modalContainer}}"
94
- >
95
- {{t
96
- (if
97
- @buildingEntrance.street.isNew
98
- "ember-gwr.components.linkStreet.link"
99
- "ember-gwr.components.linkStreet.change"
100
- )
101
- }}
102
- </LinkTo>
103
- </div>
95
+ >
96
+ {{t
97
+ (if
98
+ @buildingEntrance.street.isNew
99
+ "ember-gwr.components.linkStreet.link"
100
+ "ember-gwr.components.linkStreet.change"
101
+ )
102
+ }}
103
+ </LinkTo>
104
+ </div>
105
+ {{/if}}
104
106
  {{/let}}
105
107
  {{/if}}
@@ -27,7 +27,9 @@
27
27
  type="button"
28
28
  class="uk-icon-button"
29
29
  uk-icon="trash"
30
- uk-tooltip="title: {{t "ember-gwr.components.linkedModels.removeLink"}}; container: {{this.config.modalContainer}}"
30
+ uk-tooltip="title: {{t
31
+ 'ember-gwr.components.linkedModels.removeLink'
32
+ }}; container: {{this.config.modalContainer}}"
31
33
  {{on "click" (fn @removeLink model)}}
32
34
  ></button>
33
35
  </td>
@@ -51,7 +53,8 @@
51
53
  <LinkTo
52
54
  @route={{@searchRoute}}
53
55
  @models={{or @searchModels (array)}}
54
- >
56
+ @query={{or @searchQuery (hash)}}
57
+ >
55
58
  {{#if (eq @modelName "building")}}
56
59
  {{t "ember-gwr.components.linkedModels.linkExistingBuilding"}}
57
60
  {{else}}
@@ -66,16 +69,20 @@
66
69
  {{t "ember-gwr.components.linkedModels.or"}}
67
70
  {{/if}}
68
71
  {{#if @newRoute}}
69
- <LinkTo @route={{@newRoute}} @models={{or @newModels (array)}}>
72
+ <LinkTo
73
+ @route={{@newRoute}}
74
+ @models={{or @newModels (array)}}
75
+ @query={{or @newQuery (hash)}}
76
+ >
70
77
  {{t
71
78
  "ember-gwr.components.linkedModels.createEntry"
72
79
  modelName=modelName
73
- model=@modelName
80
+ model=@modelName
74
81
  }}
75
82
  </LinkTo>
76
83
  {{else if @addLink}}
77
- <button
78
- type="button"
84
+ <button
85
+ type="button"
79
86
  class="uk-button uk-button-link"
80
87
  {{on "click" @addLink}}
81
88
  >
@@ -9,26 +9,28 @@
9
9
  <td
10
10
  class={{concat
11
11
  "uk-table-shrink "
12
- (if (eq @activeProject project.EPROID) "uk-text-bold")
12
+ (if (eq @activeProjectId project.EPROID) "uk-text-bold")
13
13
  }}
14
14
  >
15
15
  <LinkTo @route="project.form" @model={{project.EPROID}} class="uk-link">
16
16
  {{project.EPROID}}
17
17
  </LinkTo>
18
18
  </td>
19
- <td class={{if (eq @activeProject project.EPROID) "uk-text-bold"}}>
19
+ <td class={{if (eq @activeProjectId project.EPROID) "uk-text-bold"}}>
20
20
  {{project.constructionProjectDescription}}
21
21
  </td>
22
22
  <td class="uk-table-shrink">
23
- {{#if (eq @activeProject project.EPROID)}}
23
+ {{#if (eq @activeProjectId project.EPROID)}}
24
24
  <button
25
25
  type="button"
26
26
  class="uk-icon-button"
27
27
  uk-icon="trash"
28
- uk-tooltip="title: {{t "ember-gwr.components.linkedModels.removeLink"}}; container: {{this.config.modalContainer}}"
29
- {{on "click" @removeProject}}
28
+ uk-tooltip="title: {{t
29
+ 'ember-gwr.components.linkedModels.removeLink'
30
+ }}; container: {{this.config.modalContainer}}"
31
+ {{on "click" this.removeProjectLink}}
30
32
  >
31
33
  </button>
32
34
  {{/if}}
33
35
  </td>
34
- </LinkedModels>
36
+ </LinkedModels>
@@ -1,6 +1,19 @@
1
+ import { action } from "@ember/object";
1
2
  import { inject as service } from "@ember/service";
2
3
  import Component from "@glimmer/component";
3
4
 
4
5
  export default class LinkedProjectsComponent extends Component {
5
6
  @service config;
7
+ @service router;
8
+ @service store;
9
+ @service constructionProject;
10
+
11
+ @action
12
+ async removeProjectLink() {
13
+ const link = this.store
14
+ .peekAll("gwr-link")
15
+ .find(({ eproid }) => Number(eproid) === this.args.activeProjectId);
16
+ await link.destroyRecord();
17
+ await this.constructionProject.all.perform(this.args.instanceId);
18
+ }
6
19
  }
@@ -0,0 +1,3 @@
1
+ <div class="uk-flex uk-flex-center uk-flex-middle uk-margin-large-top">
2
+ <UkSpinner @ratio={{3}} />
3
+ </div>