ember-ebau-gwr 2.5.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/.github/workflows/test.yml +3 -3
- package/CHANGELOG.md +101 -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 +17 -14
- package/addon/components/link-building-modal.js +11 -1
- package/addon/components/link-street.hbs +83 -0
- package/addon/components/link-street.js +6 -0
- package/addon/components/linked-models.hbs +16 -2
- package/addon/components/linked-models.js +6 -0
- package/addon/components/linked-projects.hbs +2 -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 +22 -6
- package/addon/components/model-form/header/actions.hbs +67 -35
- package/addon/components/model-form/header/actions.js +6 -0
- package/addon/components/model-form/header/status-selector.hbs +22 -5
- package/addon/components/model-form/header/status-selector.js +19 -4
- package/addon/components/model-form/header.hbs +10 -4
- package/addon/components/model-form.hbs +14 -9
- package/addon/components/model-form.js +20 -6
- 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/components/search/filters.hbs +1 -1
- package/addon/components/search/filters.js +3 -3
- package/addon/controllers/building/edit/dwelling/edit.js +61 -5
- package/addon/controllers/building/edit/dwellings.js +3 -0
- package/addon/controllers/building/edit/entrance/edit/index.js +22 -8
- 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 +109 -27
- package/addon/controllers/import.js +70 -0
- package/addon/controllers/project/form.js +221 -20
- package/addon/controllers/project/linked-buildings.js +20 -1
- package/addon/controllers/project.js +19 -0
- package/addon/controllers/search-building.js +17 -0
- package/addon/helpers/is-unset.js +7 -0
- package/addon/models/building-entrance.js +4 -5
- package/addon/models/building-work.js +11 -9
- package/addon/models/building.js +171 -114
- package/addon/models/client.js +1 -1
- package/addon/models/construction-project.js +148 -66
- package/addon/models/construction-projects-list.js +1 -1
- package/addon/models/dwelling.js +60 -66
- package/addon/models/identification.js +4 -17
- package/addon/models/options.js +1 -0
- package/addon/models/realestate-identification.js +8 -14
- package/addon/models.js +1 -2
- package/addon/routes/building/edit/dwelling/new.js +3 -0
- package/addon/routes/building/edit/entrance/edit/index.js +7 -0
- package/addon/routes/building/edit/entrance/edit/link-street.js +8 -1
- package/addon/routes/building/edit/entrance/new.js +12 -2
- package/addon/routes/building/edit/index.js +13 -1
- package/addon/routes/building/edit.js +5 -1
- package/addon/routes/building/new.js +25 -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 +412 -55
- package/addon/services/construction-project.js +637 -5
- package/addon/services/dwelling.js +238 -5
- package/addon/services/gwr.js +4 -2
- package/addon/templates/building/edit/dwelling/edit.hbs +20 -13
- package/addon/templates/building/edit/entrance/edit/index.hbs +16 -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 +130 -77
- package/addon/templates/project/errors.hbs +128 -126
- package/addon/templates/project/form.hbs +179 -71
- package/addon/templates/project/linked-buildings.hbs +20 -4
- package/addon/templates/project.hbs +40 -5
- package/addon/templates/search-building.hbs +9 -0
- package/addon/templates/search-project.hbs +4 -0
- package/addon/validations/building-entrance.js +5 -0
- package/addon/validations/building-work.js +30 -10
- package/addon/validations/construction-project.js +12 -0
- package/addon/validations/coordinates.js +7 -5
- package/addon/validations/dwelling.js +10 -0
- package/addon/validations/realestate-identification.js +39 -0
- package/addon/validations/status/status-building-change.js +10 -1
- package/addon/validations/status/status-building-correction.js +13 -3
- package/addon/validations/status/status-dwelling-change.js +20 -12
- package/addon/validations/status/status-dwelling-correction.js +19 -11
- package/addon/validations/status/status-project-change.js +24 -4
- package/addon/validations/status/status-project-correction.js +31 -10
- package/addon/xml/helpers.js +4 -0
- package/addon/xml/templates/building.js +35 -21
- package/addon/xml/templates/construction-project.js +3 -4
- package/addon/xml/templates/dwelling.js +7 -0
- package/app/styles/ember-ebau-gwr.scss +36 -6
- package/package.json +9 -5
- package/translations/building/de.yaml +42 -6
- package/translations/building-entrance/de.yaml +6 -11
- package/translations/construction-project/de.yaml +13 -5
- package/translations/de.yaml +72 -5
- package/translations/dwelling/de.yaml +7 -4
- package/addon/validators/presence-nested.js +0 -47
|
@@ -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=(
|
|
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
|
|
33
|
-
(fn
|
|
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,11 +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
|
-
|
|
31
|
+
return (
|
|
32
|
+
!this.diffResolved &&
|
|
33
|
+
this.importValue &&
|
|
34
|
+
this.importValue !== this.value
|
|
35
|
+
);
|
|
21
36
|
}
|
|
22
37
|
return false;
|
|
23
38
|
}
|
|
@@ -65,15 +80,16 @@ export default class ModelFormFieldComponent extends Component {
|
|
|
65
80
|
);
|
|
66
81
|
}
|
|
67
82
|
|
|
68
|
-
|
|
69
|
-
|
|
83
|
+
@action
|
|
84
|
+
initializeImport() {
|
|
70
85
|
if (this.showDiff) {
|
|
71
86
|
this.args.registerDiff(this.args.attr);
|
|
72
87
|
}
|
|
73
88
|
}
|
|
74
89
|
|
|
75
90
|
@action
|
|
76
|
-
updateModelField(
|
|
91
|
+
updateModelField(eventOrValue) {
|
|
92
|
+
const attr = this.args.attr;
|
|
77
93
|
const value = eventOrValue?.target?.value ?? eventOrValue;
|
|
78
94
|
|
|
79
95
|
// If we supply a custom update method use this
|
|
@@ -1,26 +1,69 @@
|
|
|
1
1
|
<div class="uk-flex uk-flex-column uk-flex-right">
|
|
2
|
+
<ImportModal
|
|
3
|
+
@visible={{and this.showImportModal @import.originalData.length}}
|
|
4
|
+
@close={{fn (mut this.showImportModal) false}}
|
|
5
|
+
@import={{@import}}
|
|
6
|
+
@modelName={{@modelName}}
|
|
7
|
+
/>
|
|
2
8
|
<div class="uk-flex-inline uk-flex-right uk-flex-middle">
|
|
3
|
-
{{#if (and @
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
{{#if (and @modelHasImport @import)}}
|
|
10
|
+
{{#if (and @import.originalData.length (is-unset @import.index))}}
|
|
11
|
+
<button
|
|
12
|
+
class="uk-button uk-button-default uk-margin-small-right uk-flex-none"
|
|
13
|
+
type="button"
|
|
14
|
+
{{on "click" (fn (mut this.showImportModal) true)}}
|
|
15
|
+
>
|
|
16
|
+
{{t "ember-gwr.components.importModal.selectImportData"}}
|
|
17
|
+
</button>
|
|
18
|
+
{{else}}
|
|
19
|
+
<button
|
|
20
|
+
class="uk-button uk-button-default uk-flex-none
|
|
21
|
+
{{if (is-unset @import.index) "uk-margin-small-right"}}"
|
|
22
|
+
type="button"
|
|
23
|
+
{{on "click" @importAllData}}
|
|
24
|
+
>
|
|
25
|
+
{{t "ember-gwr.components.modelForm.applyAll"}}
|
|
26
|
+
</button>
|
|
27
|
+
{{#if (and @import @import.originalData.length)}}
|
|
28
|
+
<button
|
|
29
|
+
class="uk-button uk-button-default uk-flex-none uk-padding-small uk-padding-remove-vertical uk-margin-small-right"
|
|
30
|
+
type="button"
|
|
31
|
+
>
|
|
32
|
+
<span class="uk-icon" uk-icon="more-vertical"></span>
|
|
33
|
+
</button>
|
|
34
|
+
<div
|
|
35
|
+
uk-dropdown="mode: click; pos: bottom-right; offset: 20"
|
|
36
|
+
class="uk-padding-small"
|
|
37
|
+
>
|
|
38
|
+
<ul
|
|
39
|
+
class="uk-nav uk-dropdown-nav uk-list uk-list-divider uk-list-collapse"
|
|
40
|
+
>
|
|
41
|
+
<li>
|
|
42
|
+
<button
|
|
43
|
+
class="uk-button uk-text-left uk-highlight-hover uk-text-secondary uk-width-1-1 uk-background-default uk-padding-remove"
|
|
44
|
+
type="button"
|
|
45
|
+
{{on "click" (fn (mut this.showImportModal) true)}}
|
|
46
|
+
>
|
|
47
|
+
{{t "ember-gwr.components.importModal.selectImportData"}}
|
|
48
|
+
</button>
|
|
49
|
+
</li>
|
|
50
|
+
</ul>
|
|
51
|
+
</div>
|
|
52
|
+
{{/if}}
|
|
53
|
+
{{/if}}
|
|
11
54
|
<LinkTo
|
|
12
|
-
@query={{hash import=false}}
|
|
13
|
-
class="uk-button uk-button-default uk-margin-small-right"
|
|
55
|
+
@query={{hash import=false index=undefined}}
|
|
56
|
+
class="uk-button uk-button-default uk-flex-none uk-margin-small-right"
|
|
14
57
|
>
|
|
15
|
-
{{t "ember-gwr.components.
|
|
58
|
+
{{t "ember-gwr.components.modelForm.cancelImport"}}
|
|
16
59
|
</LinkTo>
|
|
17
60
|
{{/if}}
|
|
18
61
|
{{#let @submit as |Submit|}}
|
|
19
62
|
<Submit />
|
|
20
63
|
{{/let}}
|
|
21
|
-
{{#if (or @
|
|
64
|
+
{{#if (or @modelHasImport @hasStatus)}}
|
|
22
65
|
<button
|
|
23
|
-
class="uk-button uk-button-default uk-padding-small uk-padding-remove-vertical"
|
|
66
|
+
class="uk-button uk-button-default uk-flex-none uk-padding-small uk-padding-remove-vertical"
|
|
24
67
|
type="button"
|
|
25
68
|
>
|
|
26
69
|
<span class="uk-icon" uk-icon="more-vertical"></span>
|
|
@@ -32,28 +75,17 @@
|
|
|
32
75
|
<ul
|
|
33
76
|
class="uk-nav uk-dropdown-nav uk-list uk-list-divider uk-list-collapse"
|
|
34
77
|
>
|
|
35
|
-
{{#if @
|
|
78
|
+
{{#if @modelHasImport}}
|
|
36
79
|
<li>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{{else}}
|
|
47
|
-
<LinkTo
|
|
48
|
-
@disabled={{@import}}
|
|
49
|
-
@query={{hash import=true}}
|
|
50
|
-
class="uk-button uk-text-left uk-highlight-hover
|
|
51
|
-
{{if @import "uk-text-muted" "uk-text-secondary"}}
|
|
52
|
-
uk-width-1-1 uk-background-default uk-padding-remove"
|
|
53
|
-
>
|
|
54
|
-
{{t "ember-gwr.components.projectForm.importFromCaluma"}}
|
|
55
|
-
</LinkTo>
|
|
56
|
-
{{/if}}
|
|
80
|
+
<LinkTo
|
|
81
|
+
@disabled={{@import}}
|
|
82
|
+
@query={{hash import=true}}
|
|
83
|
+
class="uk-button uk-text-left uk-highlight-hover
|
|
84
|
+
{{if @import "uk-text-muted" "uk-text-secondary"}}
|
|
85
|
+
uk-width-1-1 uk-background-default uk-padding-remove"
|
|
86
|
+
>
|
|
87
|
+
{{t "ember-gwr.components.modelForm.importFromCaluma"}}
|
|
88
|
+
</LinkTo>
|
|
57
89
|
</li>
|
|
58
90
|
{{/if}}
|
|
59
91
|
{{#if @hasStatus}}
|
|
@@ -63,7 +95,7 @@
|
|
|
63
95
|
type="button"
|
|
64
96
|
{{on "click" @openStatus}}
|
|
65
97
|
>
|
|
66
|
-
{{t "ember-gwr.components.
|
|
98
|
+
{{t "ember-gwr.components.modelForm.changeStatus"}}
|
|
67
99
|
</button>
|
|
68
100
|
</li>
|
|
69
101
|
{{/if}}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
uk-close
|
|
6
6
|
{{on "click" @closeStatus}}
|
|
7
7
|
></button>
|
|
8
|
-
<div class="uk-flex uk-flex-between uk-flex-
|
|
8
|
+
<div class="uk-flex uk-flex-between uk-flex-middle">
|
|
9
9
|
<div>
|
|
10
10
|
<div class="uk-text-bold">
|
|
11
11
|
{{t "ember-gwr.components.header.statusSelector.statusLabel"}}
|
|
@@ -20,6 +20,26 @@
|
|
|
20
20
|
@update={{this.statusUpdate}}
|
|
21
21
|
/>
|
|
22
22
|
</form>
|
|
23
|
+
<small class="uk-text-muted uk-flex-inline uk-flex-column uk-width-large">
|
|
24
|
+
{{#if this.changeHint}}
|
|
25
|
+
{{!-- TODO: add change hint
|
|
26
|
+
<div>
|
|
27
|
+
{{this.changeHint}}
|
|
28
|
+
</div>
|
|
29
|
+
--}}
|
|
30
|
+
<div class="uk-margin-small-top">
|
|
31
|
+
<label>
|
|
32
|
+
<input
|
|
33
|
+
class="uk-checkbox uk-margin-small-right"
|
|
34
|
+
type="checkbox"
|
|
35
|
+
checked={{if this.isCascading true undefined}}
|
|
36
|
+
{{on "input" this.toggleCascading}}
|
|
37
|
+
/>
|
|
38
|
+
{{t "ember-gwr.lifeCycles.cascadeOption"}}
|
|
39
|
+
</label>
|
|
40
|
+
</div>
|
|
41
|
+
{{/if}}
|
|
42
|
+
</small>
|
|
23
43
|
</div>
|
|
24
44
|
<div class="uk-flex-inline uk-flex-middle">
|
|
25
45
|
<div class="uk-margin-small-right" uk-icon="icon: question"></div>
|
|
@@ -80,10 +100,7 @@
|
|
|
80
100
|
class="uk-flex-inline uk-text-small uk-margin-remove-bottom uk-margin-large-right"
|
|
81
101
|
uk-alert
|
|
82
102
|
>
|
|
83
|
-
<div
|
|
84
|
-
class="uk-margin-right uk-flex-none"
|
|
85
|
-
uk-icon="icon: info"
|
|
86
|
-
></div>
|
|
103
|
+
<div class="uk-margin-right uk-flex-none" uk-icon="icon: info"></div>
|
|
87
104
|
<div class="uk-flex-inline uk-flex-column">
|
|
88
105
|
<div class="uk-flex-inline uk-flex-top">
|
|
89
106
|
<div class="uk-margin-right uk-flex-none">
|
|
@@ -17,6 +17,7 @@ export default class ModelFormHeaderStatusSelectorComponent extends Component {
|
|
|
17
17
|
@tracked isChange;
|
|
18
18
|
@tracked modelStatus;
|
|
19
19
|
@tracked newStatus;
|
|
20
|
+
@tracked isCascading = false;
|
|
20
21
|
|
|
21
22
|
constructor(...args) {
|
|
22
23
|
super(...args);
|
|
@@ -44,6 +45,7 @@ export default class ModelFormHeaderStatusSelectorComponent extends Component {
|
|
|
44
45
|
statusUpdate(value) {
|
|
45
46
|
this.resetErrors();
|
|
46
47
|
this.newStatus = value;
|
|
48
|
+
this.isCascading = false;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
get statusOptions() {
|
|
@@ -107,15 +109,17 @@ export default class ModelFormHeaderStatusSelectorComponent extends Component {
|
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
if (isChange) {
|
|
110
|
-
|
|
111
|
-
// of the status field to the model
|
|
112
|
-
this.args.model[this.args.modelStatusField] = this.newStatus;
|
|
112
|
+
changeset.rollbackProperty(this.args.modelStatusField);
|
|
113
113
|
}
|
|
114
114
|
yield changeset.save();
|
|
115
115
|
|
|
116
116
|
try {
|
|
117
117
|
yield isChange
|
|
118
|
-
? this.args.onStatusChange.perform(
|
|
118
|
+
? this.args.onStatusChange.perform(
|
|
119
|
+
this.modelStatus,
|
|
120
|
+
this.newStatus,
|
|
121
|
+
this.isCascading
|
|
122
|
+
)
|
|
119
123
|
: this.args.onStatusCorrection.perform(this.newStatus);
|
|
120
124
|
|
|
121
125
|
this.modelStatus = this.newStatus;
|
|
@@ -133,4 +137,15 @@ export default class ModelFormHeaderStatusSelectorComponent extends Component {
|
|
|
133
137
|
get correctionParameters() {
|
|
134
138
|
return this.args.getCorrectionParameters(this.newStatus);
|
|
135
139
|
}
|
|
140
|
+
|
|
141
|
+
get changeHint() {
|
|
142
|
+
return this.args.getChangeHint && this.modelStatus && this.newStatus
|
|
143
|
+
? this.args.getChangeHint(this.modelStatus, this.newStatus)
|
|
144
|
+
: undefined;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@action
|
|
148
|
+
toggleCascading() {
|
|
149
|
+
this.isCascading = !this.isCascading;
|
|
150
|
+
}
|
|
136
151
|
}
|
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
@submit={{@submit}}
|
|
10
10
|
@submitErrors={{@submitErrors}}
|
|
11
11
|
@hasStatus={{and @hasStatus @model (not @model.isNew)}}
|
|
12
|
-
@
|
|
12
|
+
@modelHasImport={{@modelHasImport}}
|
|
13
13
|
@import={{@import}}
|
|
14
14
|
@importAllData={{@importAllData}}
|
|
15
15
|
@openStatus={{fn (mut this.changeStatus) true}}
|
|
16
|
+
@modelName={{@modelName}}
|
|
17
|
+
@translationBase={{@translationBase}}
|
|
16
18
|
/>
|
|
17
19
|
</div>
|
|
18
20
|
{{#if (and @model (not @model.isNew))}}
|
|
@@ -24,7 +26,10 @@
|
|
|
24
26
|
uk-flex-bottom uk-flex-wrap uk-flex-wrap-around"
|
|
25
27
|
>
|
|
26
28
|
{{#if @hasStatus}}
|
|
27
|
-
<ModelForm::Header::Status
|
|
29
|
+
<ModelForm::Header::Status
|
|
30
|
+
@model={{@model}}
|
|
31
|
+
@modelName={{@modelName}}
|
|
32
|
+
/>
|
|
28
33
|
{{/if}}
|
|
29
34
|
<ModelForm::Header::Errors
|
|
30
35
|
@model={{@model}}
|
|
@@ -44,10 +49,11 @@
|
|
|
44
49
|
@onStatusCorrection={{@onStatusCorrection}}
|
|
45
50
|
@getChangeParameters={{@getChangeParameters}}
|
|
46
51
|
@getCorrectionParameters={{@getCorrectionParameters}}
|
|
52
|
+
@getChangeHint={{@getChangeHint}}
|
|
47
53
|
@modelStatusField={{@modelStatusField}}
|
|
48
|
-
@translationBase={{@translationBase}}
|
|
54
|
+
@translationBase={{or @translationBaseHeader @translationBase}}
|
|
49
55
|
/>
|
|
50
56
|
{{/if}}
|
|
51
57
|
{{/let}}
|
|
52
|
-
<hr class="uk-margin-small-top
|
|
58
|
+
<hr class="uk-margin-small-top" />
|
|
53
59
|
{{/if}}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
<ValidatedForm
|
|
2
|
-
@model={{changeset @model @validations}}
|
|
2
|
+
@model={{if @validations (changeset @model @validations) @model}}
|
|
3
3
|
@on-submit={{perform this.submit}}
|
|
4
4
|
@validateBeforeSubmit={{true}}
|
|
5
5
|
class="validated-form"
|
|
6
|
-
...attributes
|
|
6
|
+
...attributes
|
|
7
|
+
as |f|
|
|
7
8
|
>
|
|
8
9
|
{{#let
|
|
9
10
|
(component
|
|
10
11
|
f.submit
|
|
11
12
|
type="submit"
|
|
12
13
|
label=(t "ember-gwr.components.modelForm.save")
|
|
13
|
-
disabled=(or this.isSaving @disabled @
|
|
14
|
+
disabled=(or this.isSaving @disabled @import)
|
|
14
15
|
buttonComponent=(component
|
|
15
16
|
"model-form/submit" loading=this.isSaving color="primary"
|
|
16
17
|
)
|
|
@@ -22,7 +23,8 @@
|
|
|
22
23
|
(array (t "ember-gwr.components.modelForm.validationError"))
|
|
23
24
|
@errors
|
|
24
25
|
)
|
|
25
|
-
)
|
|
26
|
+
)
|
|
27
|
+
as |Submit SubmitErrors|
|
|
26
28
|
}}
|
|
27
29
|
<ModelForm::Header
|
|
28
30
|
@model={{@headerModel}}
|
|
@@ -31,8 +33,8 @@
|
|
|
31
33
|
@modelName={{@headerModelName}}
|
|
32
34
|
@modelDescription={{@headerModelDescription}}
|
|
33
35
|
@hasStatus={{@hasStatus}}
|
|
34
|
-
@hasImport={{@hasImport}}
|
|
35
36
|
@import={{@import}}
|
|
37
|
+
@modelHasImport={{this.modelHasImport}}
|
|
36
38
|
@importAllData={{this.importAllData}}
|
|
37
39
|
@modelStatusOptions={{@modelStatusOptions}}
|
|
38
40
|
@nextValidStates={{@nextValidStates}}
|
|
@@ -40,8 +42,10 @@
|
|
|
40
42
|
@onStatusCorrection={{@onStatusCorrection}}
|
|
41
43
|
@getChangeParameters={{@getChangeParameters}}
|
|
42
44
|
@getCorrectionParameters={{@getCorrectionParameters}}
|
|
45
|
+
@getChangeHint={{@getChangeHint}}
|
|
43
46
|
@modelStatusField={{@modelStatusField}}
|
|
44
|
-
@
|
|
47
|
+
@translationBaseHeader={{@translationBaseHeader}}
|
|
48
|
+
@translationBase={{@translationBase}}
|
|
45
49
|
@submit={{Submit}}
|
|
46
50
|
@submitErrors={{SubmitErrors}}
|
|
47
51
|
/>
|
|
@@ -49,16 +53,17 @@
|
|
|
49
53
|
(component
|
|
50
54
|
"model-form/field"
|
|
51
55
|
model=f.model
|
|
52
|
-
importData=@
|
|
56
|
+
importData=@import.data
|
|
53
57
|
translationBase=@translationBase
|
|
54
58
|
input=f.input
|
|
55
59
|
registerDiff=this.registerDiff
|
|
56
60
|
resolveDiff=this.resolveDiff
|
|
57
61
|
)
|
|
62
|
+
f.model
|
|
58
63
|
}}
|
|
59
64
|
<div class="uk-flex-inline uk-flex-nowrap uk-flex-top uk-margin-top">
|
|
60
65
|
<Submit class="uk-flex-none" />
|
|
61
|
-
{{#if @
|
|
66
|
+
{{#if @import}}
|
|
62
67
|
<LinkTo
|
|
63
68
|
@query={{hash import=false}}
|
|
64
69
|
class="uk-button uk-button-default uk-flex-none uk-margin-small-left"
|
|
@@ -73,4 +78,4 @@
|
|
|
73
78
|
{{/if}}
|
|
74
79
|
</div>
|
|
75
80
|
{{/let}}
|
|
76
|
-
</ValidatedForm>
|
|
81
|
+
</ValidatedForm>
|
|
@@ -8,6 +8,7 @@ export default class ModelFormComponent extends Component {
|
|
|
8
8
|
@service router;
|
|
9
9
|
@service notification;
|
|
10
10
|
@service intl;
|
|
11
|
+
@service config;
|
|
11
12
|
|
|
12
13
|
// This array is only used for tracking the still open diffs
|
|
13
14
|
// so we can transition out of the import once the array is empty.
|
|
@@ -18,11 +19,17 @@ export default class ModelFormComponent extends Component {
|
|
|
18
19
|
return this.submit.isRunning || this.args.onSubmit.isRunning;
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
get modelHasImport() {
|
|
23
|
+
return this.config.importModels.includes(this.args.headerModelName);
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
finishImport() {
|
|
22
27
|
this.notification.success(
|
|
23
28
|
this.intl.t("ember-gwr.components.modelForm.diff.resolved")
|
|
24
29
|
);
|
|
25
|
-
this.router.transitionTo({
|
|
30
|
+
this.router.transitionTo({
|
|
31
|
+
queryParams: { import: false, index: undefined },
|
|
32
|
+
});
|
|
26
33
|
}
|
|
27
34
|
|
|
28
35
|
@dropTask
|
|
@@ -36,7 +43,9 @@ export default class ModelFormComponent extends Component {
|
|
|
36
43
|
|
|
37
44
|
@action
|
|
38
45
|
registerDiff(attr) {
|
|
39
|
-
this.diffs.
|
|
46
|
+
if (!this.diffs.find((key) => key === attr)) {
|
|
47
|
+
this.diffs.push(attr);
|
|
48
|
+
}
|
|
40
49
|
}
|
|
41
50
|
|
|
42
51
|
@action
|
|
@@ -51,14 +60,19 @@ export default class ModelFormComponent extends Component {
|
|
|
51
60
|
importAllData() {
|
|
52
61
|
// We cannot just `Object.assign` here since the child object like `identification` would
|
|
53
62
|
// not be classes with tracked fields etc. anymore but just pojos. We need to preserve the classes.
|
|
63
|
+
|
|
64
|
+
// TODO: How should we handle the status field, if this is in the imported data this will get
|
|
65
|
+
// set here...
|
|
54
66
|
const deepMerge = (original, objectToApply) => {
|
|
55
67
|
Object.entries(objectToApply).forEach(([key, value]) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
68
|
+
if (value !== null && value !== undefined) {
|
|
69
|
+
typeof value === "object"
|
|
70
|
+
? deepMerge(original[key], objectToApply[key])
|
|
71
|
+
: (original[key] = value);
|
|
72
|
+
}
|
|
59
73
|
});
|
|
60
74
|
};
|
|
61
|
-
deepMerge(this.args.model, this.args.
|
|
75
|
+
deepMerge(this.args.model, this.args.import.data);
|
|
62
76
|
this.finishImport();
|
|
63
77
|
}
|
|
64
78
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<InputField
|
|
17
17
|
@attr={{@attr}}
|
|
18
18
|
@required={{@required}}
|
|
19
|
-
@value={{get @project @attr}}
|
|
19
|
+
@value={{or @value (get @project @attr)}}
|
|
20
20
|
@options={{@options}}
|
|
21
21
|
@noPlaceholder={{@noPlaceholder}}
|
|
22
22
|
@update={{fn (or @update this.updateProjectField) @attr}}
|
|
@@ -45,7 +45,7 @@ export default class SearchFiltersComponent extends Component {
|
|
|
45
45
|
!realestateIdentification.number
|
|
46
46
|
) {
|
|
47
47
|
this.validationErrors.realestateIdentification = this.intl.t(
|
|
48
|
-
"ember-gwr.
|
|
48
|
+
"ember-gwr.components.search.validation.realestateIdentification"
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -55,7 +55,7 @@ export default class SearchFiltersComponent extends Component {
|
|
|
55
55
|
!(modifyDate.dateTo && modifyDate.dateFrom)
|
|
56
56
|
) {
|
|
57
57
|
this.validationErrors.modifyDate = this.intl.t(
|
|
58
|
-
"ember-gwr.
|
|
58
|
+
"ember-gwr.components.search.validation.bothDatesSet"
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -64,7 +64,7 @@ export default class SearchFiltersComponent extends Component {
|
|
|
64
64
|
!(createDate.dateTo && createDate.dateFrom)
|
|
65
65
|
) {
|
|
66
66
|
this.validationErrors.createDate = this.intl.t(
|
|
67
|
-
"ember-gwr.
|
|
67
|
+
"ember-gwr.components.search.validation.bothDatesSet"
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
70
|
// Return a boolean if there are errors or not
|