ember-ebau-gwr 2.7.1 → 3.0.0
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.
- package/CHANGELOG.md +39 -0
- package/addon/components/import-modal/building-data.hbs +64 -0
- package/addon/components/import-modal/dwelling-data.hbs +30 -0
- package/addon/components/import-modal/entrance-data.hbs +14 -0
- package/addon/components/import-modal.hbs +54 -0
- package/addon/components/import-modal.js +6 -0
- package/addon/components/link-building-modal.hbs +1 -1
- package/addon/components/link-building-modal.js +2 -0
- package/addon/components/link-street.hbs +83 -0
- package/addon/components/link-street.js +6 -0
- package/addon/components/linked-models.hbs +1 -1
- package/addon/components/linked-models.js +6 -0
- package/addon/components/linked-projects.hbs +1 -1
- package/addon/components/linked-projects.js +6 -0
- package/addon/components/model-form/date.hbs +1 -0
- package/addon/components/model-form/date.js +6 -6
- package/addon/components/model-form/diff.hbs +40 -27
- package/addon/components/model-form/field.hbs +13 -8
- package/addon/components/model-form/field.js +27 -8
- package/addon/components/model-form/header/actions.hbs +65 -33
- package/addon/components/model-form/header/actions.js +6 -0
- package/addon/components/model-form/header.hbs +4 -2
- package/addon/components/model-form.hbs +6 -5
- package/addon/components/model-form.js +17 -5
- package/addon/components/project-form/date.hbs +1 -1
- package/addon/components/project-form/field.hbs +1 -1
- package/addon/components/project-form/field.js +1 -1
- package/addon/controllers/building/edit/dwelling/edit.js +11 -2
- package/addon/controllers/building/edit/entrance/edit/index.js +12 -2
- package/addon/controllers/building/edit/entrance/edit/link-street.js +30 -6
- package/addon/controllers/building/edit/entrances.js +18 -2
- package/addon/controllers/building/edit/form.js +23 -11
- package/addon/controllers/import.js +70 -0
- package/addon/controllers/project/form.js +6 -13
- package/addon/controllers/project.js +1 -0
- package/addon/helpers/is-unset.js +7 -0
- package/addon/models/building-entrance.js +4 -3
- package/addon/models/building.js +73 -74
- package/addon/models/client.js +1 -1
- package/addon/models/construction-project.js +8 -8
- package/addon/models/identification.js +2 -1
- package/addon/routes/building/edit/entrance/edit/index.js +3 -1
- package/addon/routes/building/edit/entrance/edit/link-street.js +8 -1
- package/addon/routes/building/edit/index.js +13 -1
- package/addon/routes/building/new.js +19 -0
- package/addon/routes/project/form.js +5 -0
- package/addon/routes/project/new.js +3 -2
- package/addon/services/building-entrance.js +1 -1
- package/addon/services/building.js +6 -0
- package/addon/services/construction-project.js +0 -6
- package/addon/services/gwr.js +4 -2
- package/addon/templates/building/edit/dwelling/edit.hbs +1 -0
- package/addon/templates/building/edit/entrance/edit/index.hbs +7 -60
- package/addon/templates/building/edit/entrance/edit/link-street.hbs +9 -4
- package/addon/templates/building/edit/entrances.hbs +6 -3
- package/addon/templates/building/edit/form.hbs +40 -3
- package/addon/templates/project/form.hbs +20 -20
- package/addon/templates/project.hbs +3 -3
- package/addon/validations/building-entrance.js +5 -0
- package/addon/validations/building-work.js +30 -10
- package/addon/validations/realestate-identification.js +1 -1
- package/addon/validations/status/status-project-change.js +1 -1
- package/addon/validations/status/status-project-correction.js +1 -1
- package/addon/xml/templates/construction-project.js +1 -2
- package/app/styles/ember-ebau-gwr.scss +24 -5
- package/package.json +1 -1
- package/translations/building/de.yaml +7 -0
- package/translations/building-entrance/de.yaml +2 -10
- package/translations/construction-project/de.yaml +1 -1
- package/translations/de.yaml +18 -3
- package/translations/dwelling/de.yaml +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
+
# [3.0.0](https://github.com/adfinis-sygroup/ember-ebau-gwr/compare/v2.7.1...v3.0.0) (2021-09-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **building:** add default building entrance and street validation ([74b1a5b](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/74b1a5b13e713e63785a7eb27a2ccba7d22095d9))
|
|
7
|
+
* **building:** make default building entrance editable ([1ca2c4e](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/1ca2c4e1550da378ac6768c60ebca94f119ed711))
|
|
8
|
+
* **controllers/import:** reset query params while fetching caluma data ([d56ac06](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/d56ac06657cd8db3637e6db7c60f29850a787d61))
|
|
9
|
+
* **data-import:** pass instanceId to import functions ([eacdc4f](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/eacdc4fbfd9aabd61a744cb7daf9723cb9ff76ed))
|
|
10
|
+
* **import:** ignore null values in import data ([ab7df83](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/ab7df83431bab62c0c2edf8b3d5850ce2ff18956))
|
|
11
|
+
* **model-form:** ensure date values are reset on model update ([b73d6a5](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/b73d6a5dafd6984ebba548abc7e68c67734d74a1))
|
|
12
|
+
* **project:** correct confirmation dialog modal container ([1bd5be9](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/1bd5be949225d6d07dfa0670cac3238f5e901a61))
|
|
13
|
+
* **project:** fix client identification template ([9c50743](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/9c50743c069d2a6b21cf0a1ba3f8a9dc2f9e317f))
|
|
14
|
+
* **project:** replace non-realisation date with cancellation date ([bca5f83](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/bca5f83ca15f5a5311a86471a9ce9144a31e3bf0))
|
|
15
|
+
* **project/new:** extend new route from form route ([e2837d3](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/e2837d3825369033bf14b8e876b9bacddf7b7449))
|
|
16
|
+
* **translations:** use a conciser word for cancel to reject a import value ([1ea1a8e](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/1ea1a8eb8dcd64e0ffa295784c992d63d2365a1d))
|
|
17
|
+
* **ui:** render tooltips in correct application container ([65f5265](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/65f5265ce8b010fb13933bc808b8cb510272feb0))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Code Refactoring
|
|
21
|
+
|
|
22
|
+
* **modal-container:** make the modal container configurable via config-service ([328fdd8](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/328fdd8e4753cfe41d2d2b5e5c0d49bb931b18de))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **building:** enable building entrance deactivation ([6840c4a](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/6840c4a1ab8a913259c8dca976d620340d372047))
|
|
28
|
+
* add import for buildings, entrances & dwellings ([9c80eca](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/9c80eca2d75e154232a4c74b8fb6616bb77c4fff))
|
|
29
|
+
* **import:** implement import-modal for dwelling, entrances and buildings ([10db43c](https://github.com/adfinis-sygroup/ember-ebau-gwr/commit/10db43ce61e195191f5b02b43c811facaf476826))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### BREAKING CHANGES
|
|
33
|
+
|
|
34
|
+
* **modal-container:** To keep the previous behavior of modals, `modalContainer` now needs to be set to a
|
|
35
|
+
valid dom-selector in the gwr config service.
|
|
36
|
+
|
|
37
|
+
Example:
|
|
38
|
+
`modalContainer = "#my-modal-div"`
|
|
39
|
+
|
|
1
40
|
## [2.7.1](https://github.com/adfinis-sygroup/ember-ebau-gwr/compare/v2.7.0...v2.7.1) (2021-09-13)
|
|
2
41
|
|
|
3
42
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<span class="uk-flex uk-child-width-1-2">
|
|
2
|
+
<span>{{t "ember-gwr.buildingWork.kindOfWork"}}</span>
|
|
3
|
+
<span class="uk-text-muted">{{if
|
|
4
|
+
@model.kindOfWork
|
|
5
|
+
(t (concat "ember-gwr.buildingWork.kindOfWorkOptions." @model.kindOfWork))
|
|
6
|
+
"-"
|
|
7
|
+
}}</span>
|
|
8
|
+
</span>
|
|
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>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<span class="uk-flex uk-child-width-1-2">
|
|
2
|
+
<span>{{t "ember-gwr.dwelling.floor"}}</span>
|
|
3
|
+
<span class="uk-text-muted">{{or @model.floor "-"}}</span>
|
|
4
|
+
</span>
|
|
5
|
+
<hr />
|
|
6
|
+
<span class="uk-flex uk-child-width-1-2">
|
|
7
|
+
<span>{{t "ember-gwr.dwelling.noOfHabitableRooms"}}</span>
|
|
8
|
+
<span class="uk-text-muted">{{or @model.noOfHabitableRooms "-"}}</span>
|
|
9
|
+
</span>
|
|
10
|
+
<hr />
|
|
11
|
+
<span class="uk-flex uk-child-width-1-2">
|
|
12
|
+
<span>{{t "ember-gwr.dwelling.dwellingUsage.usageCode"}}</span>
|
|
13
|
+
<span class="uk-text-muted">{{if
|
|
14
|
+
@model.dwellingUsage.usageCode
|
|
15
|
+
(t
|
|
16
|
+
(concat
|
|
17
|
+
"ember-gwr.dwelling.dwellingUsage.usageCodeOptions."
|
|
18
|
+
@model.dwellingUsage.usageCode
|
|
19
|
+
)
|
|
20
|
+
)
|
|
21
|
+
"-"
|
|
22
|
+
}}</span>
|
|
23
|
+
</span>
|
|
24
|
+
<hr />
|
|
25
|
+
<span class="uk-flex uk-child-width-1-2">
|
|
26
|
+
<span>{{t "ember-gwr.dwelling.locationOfDwellingOnFloor"}}</span>
|
|
27
|
+
<span class="uk-text-muted">
|
|
28
|
+
{{or @model.locationOfDwellingOnFloor "-"}}
|
|
29
|
+
</span>
|
|
30
|
+
</span>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<span class="uk-flex uk-child-width-1-2">
|
|
2
|
+
<span>{{t "ember-gwr.buildingEntrance.fields.buildingEntranceNo"}}</span>
|
|
3
|
+
<span class="uk-text-muted">{{or @model.buildingEntranceNo "-"}}</span>
|
|
4
|
+
</span>
|
|
5
|
+
<hr />
|
|
6
|
+
<span class="uk-flex uk-child-width-1-2">
|
|
7
|
+
<span>{{t "ember-gwr.buildingEntrance.fields.locality.name.nameLong"}}</span>
|
|
8
|
+
<span class="uk-text-muted">{{or @model.locality.name.nameLong "-"}}</span>
|
|
9
|
+
</span>
|
|
10
|
+
<hr />
|
|
11
|
+
<span class="uk-flex uk-child-width-1-2">
|
|
12
|
+
<span>{{t "ember-gwr.buildingEntrance.fields.locality.swissZipCode"}}</span>
|
|
13
|
+
<span class="uk-text-muted">{{or @model.locality.swissZipCode "-"}}</span>
|
|
14
|
+
</span>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<UkModal
|
|
2
|
+
@visible={{@visible}}
|
|
3
|
+
@btnClose={{false}}
|
|
4
|
+
@escClose={{false}}
|
|
5
|
+
@bgClose={{false}}
|
|
6
|
+
@on-hide={{@close}}
|
|
7
|
+
@container={{this.config.modalContainer}}
|
|
8
|
+
as |Modal|
|
|
9
|
+
>
|
|
10
|
+
<Modal.header>
|
|
11
|
+
<h2 class="uk-modal-title">
|
|
12
|
+
{{t "ember-gwr.components.importModal.selectImportData"}}
|
|
13
|
+
</h2>
|
|
14
|
+
</Modal.header>
|
|
15
|
+
<Modal.body class="uk-overflow-auto">
|
|
16
|
+
<ul
|
|
17
|
+
uk-accordion="collapsible: false;multiple: false; active: 0;"
|
|
18
|
+
class="ember-ebau-gwr-import-building-list"
|
|
19
|
+
>
|
|
20
|
+
{{#each @import.originalData as |model index|}}
|
|
21
|
+
<li>
|
|
22
|
+
<a class="uk-accordion-title" href="#">{{t
|
|
23
|
+
(concat "ember-gwr.models." @modelName)
|
|
24
|
+
count=1
|
|
25
|
+
}}
|
|
26
|
+
{{inc index}}</a>
|
|
27
|
+
<div class="uk-accordion-content">
|
|
28
|
+
{{component
|
|
29
|
+
(concat "import-modal/" @modelName "-data")
|
|
30
|
+
model=model
|
|
31
|
+
}}
|
|
32
|
+
|
|
33
|
+
<LinkTo
|
|
34
|
+
@query={{hash import=true index=index}}
|
|
35
|
+
class="uk-button uk-button-primary uk-margin-medium-top uk-width-1"
|
|
36
|
+
{{on "click" @close}}
|
|
37
|
+
>
|
|
38
|
+
{{t "ember-gwr.components.modelForm.importFromCaluma"}}
|
|
39
|
+
</LinkTo>
|
|
40
|
+
</div>
|
|
41
|
+
</li>
|
|
42
|
+
{{/each}}
|
|
43
|
+
</ul>
|
|
44
|
+
</Modal.body>
|
|
45
|
+
<Modal.footer>
|
|
46
|
+
<LinkTo
|
|
47
|
+
@query={{hash import=false index=undefined}}
|
|
48
|
+
class="uk-button uk-button-default uk-width-1"
|
|
49
|
+
{{on "click" @close}}
|
|
50
|
+
>
|
|
51
|
+
{{t "ember-gwr.components.modelForm.cancelImport"}}
|
|
52
|
+
</LinkTo>
|
|
53
|
+
</Modal.footer>
|
|
54
|
+
</UkModal>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { inject as service } from "@ember/service";
|
|
1
2
|
import Component from "@glimmer/component";
|
|
2
3
|
import { tracked } from "@glimmer/tracking";
|
|
3
4
|
import BuildingWork from "ember-ebau-gwr/models/building-work";
|
|
4
5
|
|
|
5
6
|
export default class LinkBuildingModalComponent extends Component {
|
|
7
|
+
@service config;
|
|
6
8
|
@tracked buildingWork = new BuildingWork();
|
|
7
9
|
// Remove the state "Neubau" from the array since you cant link
|
|
8
10
|
// existing buildings as "Neubau".
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{{#let @fieldComponent as |Field|}}
|
|
2
|
+
<div class="uk-flex uk-flex-between">
|
|
3
|
+
<span>
|
|
4
|
+
{{! this is needed since the h2 selector is * + h2}}
|
|
5
|
+
<span></span>
|
|
6
|
+
<h3>
|
|
7
|
+
{{t "ember-gwr.buildingEntrance.street"}}
|
|
8
|
+
</h3>
|
|
9
|
+
</span>
|
|
10
|
+
<span>
|
|
11
|
+
<LinkTo
|
|
12
|
+
class="uk-button
|
|
13
|
+
{{if @buildingEntrance.isNew "uk-button-primary" "uk-button-default"
|
|
14
|
+
}}"
|
|
15
|
+
@route="building.edit.entrance.edit.link-street"
|
|
16
|
+
@models={{or
|
|
17
|
+
@routeModels
|
|
18
|
+
(if @buildingEntrance.isNew (array "new") (array))
|
|
19
|
+
}}
|
|
20
|
+
@query={{hash locality=@buildingEntrance.locality.name.nameLong}}
|
|
21
|
+
@disabled={{not @buildingEntrance.locality.name.nameLong}}
|
|
22
|
+
uk-tooltip="title: {{unless
|
|
23
|
+
@buildingEntrance.locality.name.nameLong
|
|
24
|
+
(t "ember-gwr.components.linkStreet.missingLocalityHint")
|
|
25
|
+
}}; container: {{this.config.modalContainer}}"
|
|
26
|
+
>
|
|
27
|
+
{{t
|
|
28
|
+
(if
|
|
29
|
+
@buildingEntrance.isNew
|
|
30
|
+
"ember-gwr.components.linkStreet.link"
|
|
31
|
+
"ember-gwr.components.linkStreet.change"
|
|
32
|
+
)
|
|
33
|
+
}}
|
|
34
|
+
</LinkTo>
|
|
35
|
+
</span>
|
|
36
|
+
</div>
|
|
37
|
+
{{#if @buildingEntrance.street.isNew}}
|
|
38
|
+
<div uk-alert class="uk-alert-warning">
|
|
39
|
+
{{t "ember-gwr.components.linkStreet.streetHint"}}
|
|
40
|
+
</div>
|
|
41
|
+
{{else}}
|
|
42
|
+
<Field
|
|
43
|
+
@attr="street.ESID"
|
|
44
|
+
@disabled={{true}}
|
|
45
|
+
@translationBase={{@translationBase}}
|
|
46
|
+
@value={{@buildingEntrance.street.ESID}}
|
|
47
|
+
readonly
|
|
48
|
+
/>
|
|
49
|
+
<Field
|
|
50
|
+
@attr="street.description.descriptionLong"
|
|
51
|
+
@disabled={{true}}
|
|
52
|
+
@translationBase={{@translationBase}}
|
|
53
|
+
@value={{@buildingEntrance.street.description.descriptionLong}}
|
|
54
|
+
readonly
|
|
55
|
+
/>
|
|
56
|
+
<Field
|
|
57
|
+
@attr="street.streetKind"
|
|
58
|
+
@type="select"
|
|
59
|
+
@gwrEnumOptions={{this.Street.streetKindOptions}}
|
|
60
|
+
@convertValueTo="number"
|
|
61
|
+
@disabled={{true}}
|
|
62
|
+
@translationBase={{@translationBase}}
|
|
63
|
+
@value={{@buildingEntrance.street.streetKind}}
|
|
64
|
+
readonly
|
|
65
|
+
/>
|
|
66
|
+
<Field
|
|
67
|
+
@attr="street.officialStreetNumber"
|
|
68
|
+
@type="number"
|
|
69
|
+
@disabled={{true}}
|
|
70
|
+
@translationBase={{@translationBase}}
|
|
71
|
+
@value={{@buildingEntrance.street.officialStreetNumber}}
|
|
72
|
+
readonly
|
|
73
|
+
/>
|
|
74
|
+
<Field
|
|
75
|
+
@attr="street.isOfficialDescription"
|
|
76
|
+
@type="checkbox"
|
|
77
|
+
@disabled={{true}}
|
|
78
|
+
@translationBase={{@translationBase}}
|
|
79
|
+
@value={{@buildingEntrance.street.isOfficialDescription}}
|
|
80
|
+
readonly
|
|
81
|
+
/>
|
|
82
|
+
{{/if}}
|
|
83
|
+
{{/let}}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
type="button"
|
|
28
28
|
class="uk-icon-button"
|
|
29
29
|
uk-icon="trash"
|
|
30
|
-
uk-tooltip={{t "ember-gwr.components.linkedModels.removeLink"}}
|
|
30
|
+
uk-tooltip="title: {{t "ember-gwr.components.linkedModels.removeLink"}}; container: {{this.config.modalContainer}}"
|
|
31
31
|
{{on "click" (fn @removeLink model)}}
|
|
32
32
|
></button>
|
|
33
33
|
</td>
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
type="button"
|
|
26
26
|
class="uk-icon-button"
|
|
27
27
|
uk-icon="trash"
|
|
28
|
-
uk-tooltip={{t "ember-gwr.components.linkedModels.removeLink"}}
|
|
28
|
+
uk-tooltip="title: {{t "ember-gwr.components.linkedModels.removeLink"}}; container: {{this.config.modalContainer}}"
|
|
29
29
|
{{on "click" @removeProject}}
|
|
30
30
|
>
|
|
31
31
|
</button>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import Component from "@glimmer/component";
|
|
2
|
-
import { tracked } from "@glimmer/tracking";
|
|
3
2
|
|
|
4
3
|
// TODO: remove file once two-way binding issue of value is resolved in ember-pikaday
|
|
5
4
|
// https://github.com/adopted-ember-addons/ember-pikaday/issues/212
|
|
6
5
|
export default class ModelFormDateComponent extends Component {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
constructor(...args) {
|
|
10
|
-
super(...args);
|
|
11
|
-
this.value = this.args.value;
|
|
6
|
+
get value() {
|
|
7
|
+
return this.args.value;
|
|
12
8
|
}
|
|
9
|
+
|
|
10
|
+
// prevent pikaday two-way binding from
|
|
11
|
+
// updating "value" field on input
|
|
12
|
+
set value(value) {}
|
|
13
13
|
}
|
|
@@ -7,28 +7,30 @@
|
|
|
7
7
|
{{if @isInvalid "uk-form-danger"}}
|
|
8
8
|
{{if @isValid "uk-form-success"}}"
|
|
9
9
|
>
|
|
10
|
-
|
|
11
|
-
<div
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<span>
|
|
15
|
-
{{t "ember-gwr.components.modelForm.diff.existingData"}}
|
|
16
|
-
</span>
|
|
17
|
-
<button
|
|
18
|
-
type="button"
|
|
19
|
-
class="uk-button uk-button-default uk-button-small"
|
|
20
|
-
{{on "click" (fn @updateModelField @current)}}
|
|
10
|
+
{{#if @current}}
|
|
11
|
+
<div class="uk-margin">
|
|
12
|
+
<div
|
|
13
|
+
class="uk-flex uk-flex-between uk-flex-bottom uk-margin-small-bottom"
|
|
21
14
|
>
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
<span>
|
|
16
|
+
{{t "ember-gwr.components.modelForm.diff.existingData"}}
|
|
17
|
+
</span>
|
|
18
|
+
<button
|
|
19
|
+
type="button"
|
|
20
|
+
class="uk-button uk-button-default uk-button-small"
|
|
21
|
+
{{on "click" (fn @updateModelField @current)}}
|
|
22
|
+
>
|
|
23
|
+
{{t "ember-gwr.components.modelForm.diff.apply"}}
|
|
24
|
+
</button>
|
|
25
|
+
</div>
|
|
26
|
+
{{#let
|
|
27
|
+
(component @inputComponent disabled=true value=@current)
|
|
28
|
+
as |InputComponent|
|
|
29
|
+
}}
|
|
30
|
+
<InputComponent disabled />
|
|
31
|
+
{{/let}}
|
|
24
32
|
</div>
|
|
25
|
-
|
|
26
|
-
(component @inputComponent disabled=true value=@current)
|
|
27
|
-
as |InputComponent|
|
|
28
|
-
}}
|
|
29
|
-
<InputComponent disabled />
|
|
30
|
-
{{/let}}
|
|
31
|
-
</div>
|
|
33
|
+
{{/if}}
|
|
32
34
|
<div>
|
|
33
35
|
<div
|
|
34
36
|
class="uk-flex uk-flex-between uk-flex-bottom uk-margin-small-bottom"
|
|
@@ -36,13 +38,24 @@
|
|
|
36
38
|
<span>
|
|
37
39
|
{{t "ember-gwr.components.modelForm.diff.importData"}}
|
|
38
40
|
</span>
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
<div>
|
|
42
|
+
<button
|
|
43
|
+
type="button"
|
|
44
|
+
class="uk-button uk-button-primary uk-button-small"
|
|
45
|
+
{{on "click" (fn @updateModelField this.newValue)}}
|
|
46
|
+
>
|
|
47
|
+
{{t "ember-gwr.components.modelForm.diff.apply"}}
|
|
48
|
+
</button>
|
|
49
|
+
{{#unless @current}}
|
|
50
|
+
<button
|
|
51
|
+
type="button"
|
|
52
|
+
class="uk-button uk-button-default uk-button-small"
|
|
53
|
+
{{on "click" (fn @updateModelField)}}
|
|
54
|
+
>
|
|
55
|
+
{{t "ember-gwr.components.modelForm.diff.cancel"}}
|
|
56
|
+
</button>
|
|
57
|
+
{{/unless}}
|
|
58
|
+
</div>
|
|
46
59
|
</div>
|
|
47
60
|
{{component
|
|
48
61
|
@inputComponent
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
<div
|
|
1
|
+
<div
|
|
2
|
+
class="{{unless @noMargin "uk-margin"}}"
|
|
3
|
+
{{did-update this.initializeImport @importData @model @attr}}
|
|
4
|
+
>
|
|
2
5
|
{{#let
|
|
3
6
|
(component
|
|
4
7
|
@input
|
|
5
|
-
label=(unless
|
|
8
|
+
label=(unless
|
|
9
|
+
@noLabel (t (or @label (concat @translationBase "." @attr)))
|
|
10
|
+
)
|
|
6
11
|
name=@attr
|
|
7
12
|
inputName=@inputName
|
|
8
13
|
hint=@hint
|
|
9
14
|
type=(or @type @inputType)
|
|
10
15
|
disabled=(or @disabled this.disableInput)
|
|
11
16
|
required=@required
|
|
12
|
-
value=
|
|
17
|
+
value=this.value
|
|
13
18
|
validateBeforeSubmit=true
|
|
14
19
|
auto-complete=@auto-complete
|
|
15
20
|
placeholder=@placeholder
|
|
@@ -29,8 +34,8 @@
|
|
|
29
34
|
promptIsSelectable=true
|
|
30
35
|
on-update=(if
|
|
31
36
|
@on-update
|
|
32
|
-
(queue (fn this.updateModelField
|
|
33
|
-
(fn this.updateModelField
|
|
37
|
+
(queue (fn this.updateModelField) @on-update)
|
|
38
|
+
(fn this.updateModelField)
|
|
34
39
|
)
|
|
35
40
|
renderComponent=(component
|
|
36
41
|
this.fieldComponent
|
|
@@ -45,9 +50,9 @@
|
|
|
45
50
|
{{#if this.showDiff}}
|
|
46
51
|
<ModelForm::Diff
|
|
47
52
|
@inputComponent={{InputComponent}}
|
|
48
|
-
@current={{
|
|
49
|
-
@new={{
|
|
50
|
-
@updateModelField={{fn this.updateModelField
|
|
53
|
+
@current={{this.value}}
|
|
54
|
+
@new={{this.importValue}}
|
|
55
|
+
@updateModelField={{fn this.updateModelField}}
|
|
51
56
|
@horizontal={{this.isHorizontal}}
|
|
52
57
|
/>
|
|
53
58
|
{{else}}
|
|
@@ -13,15 +13,26 @@ export default class ModelFormFieldComponent extends Component {
|
|
|
13
13
|
@service intl;
|
|
14
14
|
@tracked diffResolved = false;
|
|
15
15
|
|
|
16
|
+
constructor(...args) {
|
|
17
|
+
super(...args);
|
|
18
|
+
this.initializeImport();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
get value() {
|
|
22
|
+
return get(this.args.model, this.args.attr);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get importValue() {
|
|
26
|
+
return get(this.args.importData, this.args.attr);
|
|
27
|
+
}
|
|
28
|
+
|
|
16
29
|
get showDiff() {
|
|
17
30
|
if (this.args.importData) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
return showDiff;
|
|
31
|
+
return (
|
|
32
|
+
!this.diffResolved &&
|
|
33
|
+
this.importValue &&
|
|
34
|
+
this.importValue !== this.value
|
|
35
|
+
);
|
|
25
36
|
}
|
|
26
37
|
return false;
|
|
27
38
|
}
|
|
@@ -70,7 +81,15 @@ export default class ModelFormFieldComponent extends Component {
|
|
|
70
81
|
}
|
|
71
82
|
|
|
72
83
|
@action
|
|
73
|
-
|
|
84
|
+
initializeImport() {
|
|
85
|
+
if (this.showDiff) {
|
|
86
|
+
this.args.registerDiff(this.args.attr);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@action
|
|
91
|
+
updateModelField(eventOrValue) {
|
|
92
|
+
const attr = this.args.attr;
|
|
74
93
|
const value = eventOrValue?.target?.value ?? eventOrValue;
|
|
75
94
|
|
|
76
95
|
// If we supply a custom update method use this
|