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.
- package/CHANGELOG.md +312 -299
- package/README.md +25 -8
- package/addon/components/building-preview.hbs +53 -0
- package/addon/components/housing-stat-link.hbs +8 -0
- package/addon/components/import-modal/building-data.hbs +1 -55
- package/addon/components/import-modal/dwelling-data.hbs +3 -3
- package/addon/components/import-modal/entrance-data.hbs +1 -1
- package/addon/components/import-modal.hbs +1 -4
- package/addon/components/link-building-modal.hbs +38 -24
- package/addon/components/link-building-modal.js +13 -5
- package/addon/components/link-street.hbs +33 -31
- package/addon/components/linked-models.hbs +13 -6
- package/addon/components/linked-projects.hbs +8 -6
- package/addon/components/linked-projects.js +13 -0
- package/addon/components/loading.hbs +3 -0
- package/addon/components/login-modal.hbs +86 -68
- package/addon/components/model-errors/error-indicator.hbs +1 -2
- package/addon/components/model-errors/header.hbs +6 -2
- package/addon/components/model-errors/list.hbs +13 -4
- package/addon/components/model-errors/skeleton-errors.hbs +14 -0
- package/addon/components/model-errors/skeleton.hbs +1 -16
- package/addon/components/model-errors.hbs +14 -16
- package/addon/components/model-form/date.hbs +10 -6
- package/addon/components/model-form/diff.hbs +8 -8
- package/addon/components/model-form/field.hbs +3 -2
- package/addon/components/model-form/field.js +7 -5
- package/addon/components/model-form/header/actions.hbs +25 -22
- package/addon/components/model-form/header/actions.js +6 -3
- package/addon/components/model-form/header/errors.hbs +16 -16
- package/addon/components/model-form/header/status-selector/submit-parameters.hbs +2 -1
- package/addon/components/model-form/header/status-selector.hbs +15 -3
- package/addon/components/model-form/header/status.hbs +2 -1
- package/addon/components/model-form/header.hbs +6 -5
- package/addon/components/model-form/step.hbs +5 -5
- package/addon/components/model-form/submit.hbs +1 -0
- package/addon/components/model-form.hbs +110 -77
- package/addon/components/model-form.js +38 -2
- package/addon/components/model-inview.hbs +2 -7
- package/addon/components/project-landing-page.hbs +26 -0
- package/addon/components/project-nav.hbs +65 -0
- package/addon/components/project-nav.js +27 -0
- package/addon/components/quarterly-closure/card-status.hbs +11 -0
- package/addon/components/quarterly-closure/card-status.js +36 -0
- package/addon/components/quarterly-closure/close-survey-button.hbs +10 -0
- package/addon/components/quarterly-closure/close-survey-button.js +46 -0
- package/addon/components/quarterly-closure/disabled-form-info.hbs +4 -0
- package/addon/components/quarterly-closure/error-list/project-errors.hbs +22 -0
- package/addon/components/quarterly-closure/error-list/project-errors.js +41 -0
- package/addon/components/quarterly-closure/error-list/survey-department-errors.hbs +22 -0
- package/addon/components/quarterly-closure/error-list/survey-department-errors.js +28 -0
- package/addon/components/quarterly-closure/error-list.hbs +4 -0
- package/addon/components/quarterly-closure/status.hbs +8 -0
- package/addon/components/quarterly-closure/status.js +6 -0
- package/addon/components/quarterly-closure/title.hbs +15 -0
- package/addon/components/quarterly-closure/title.js +11 -0
- package/addon/components/quarterly-closure.hbs +9 -0
- package/addon/components/quarterly-closure.js +6 -0
- package/addon/components/search/filters.hbs +128 -106
- package/addon/components/search/filters.js +13 -59
- package/addon/components/search/result-table/head/header.hbs +1 -1
- package/addon/components/search/result-table/head.hbs +1 -1
- package/addon/components/search/result-table/load-more.hbs +5 -0
- package/addon/components/search/result-table/row/field.hbs +1 -1
- package/addon/components/search/result-table/row.hbs +12 -13
- package/addon/components/search/result-table.hbs +3 -2
- package/addon/components/search.hbs +29 -0
- package/addon/components/search.js +96 -0
- package/addon/components/soon-available.hbs +7 -0
- package/addon/components/sub-nav.hbs +5 -8
- package/addon/components/title-card.hbs +28 -0
- package/addon/components/validated-form-error.hbs +4 -0
- package/addon/components/validated-form-error.js +14 -0
- package/addon/controllers/building/edit/dwelling/edit.js +2 -3
- package/addon/controllers/building/edit/entrance/edit/index.js +2 -3
- package/addon/controllers/building/edit/entrance/edit/link-street.js +4 -1
- package/addon/controllers/building/edit/form.js +57 -39
- package/addon/controllers/import.js +8 -64
- package/addon/controllers/project/form.js +3 -4
- package/addon/controllers/project.js +22 -44
- package/addon/controllers/search-building.js +39 -14
- package/addon/controllers/search-project.js +24 -19
- package/addon/helpers/current-quarter.js +8 -0
- package/addon/helpers/current-route-is-not.js +7 -0
- package/addon/helpers/current-route-is.js +15 -0
- package/addon/helpers/is-set.js +9 -0
- package/addon/helpers/is-unset.js +4 -4
- package/addon/helpers/show-model-field.js +4 -4
- package/addon/models/check-construction-project-response.js +20 -0
- package/addon/models/check-survey-department-response.js +20 -0
- package/addon/models/quarterly-closure-status.js +52 -0
- package/addon/modifiers/in-viewport.js +14 -0
- package/addon/modifiers/inverse-background.js +21 -0
- package/addon/resources/import.js +69 -0
- package/addon/routes/building/edit.js +1 -1
- package/addon/routes/building/new.js +1 -1
- package/addon/routes/building.js +7 -2
- package/addon/routes/global-landing-page.js +9 -0
- package/addon/routes/project/errors.js +1 -1
- package/addon/routes/project/form.js +1 -1
- package/addon/routes/project/new.js +1 -1
- package/addon/routes/project.js +1 -1
- package/addon/routes/quarterly-closure.js +3 -0
- package/addon/routes/search-building.js +7 -2
- package/addon/routes.js +7 -3
- package/addon/services/auth-fetch.js +6 -7
- package/addon/services/construction-project.js +10 -0
- package/addon/services/gwr.js +19 -7
- package/addon/services/quarterly-closure.js +147 -0
- package/addon/templates/building/edit/dwelling/edit.hbs +22 -19
- package/addon/templates/building/edit/dwelling/new.hbs +1 -1
- package/addon/templates/building/edit/dwelling.hbs +1 -1
- package/addon/templates/building/edit/dwellings.hbs +3 -4
- package/addon/templates/building/edit/entrance/edit/index.hbs +32 -18
- package/addon/templates/building/edit/entrance/edit/link-street.hbs +79 -75
- package/addon/templates/building/edit/entrance/edit.hbs +1 -1
- package/addon/templates/building/edit/entrance/new.hbs +1 -1
- package/addon/templates/building/edit/entrance.hbs +6 -5
- package/addon/templates/building/edit/entrances.hbs +4 -6
- package/addon/templates/building/edit/form.hbs +127 -112
- package/addon/templates/building/edit/index.hbs +1 -1
- package/addon/templates/building/edit.hbs +33 -23
- package/addon/templates/building.hbs +1 -1
- package/addon/templates/global-landing-page.hbs +34 -0
- package/addon/templates/project/errors.hbs +116 -109
- package/addon/templates/project/form.hbs +96 -63
- package/addon/templates/project/index.hbs +0 -1
- package/addon/templates/project/linked-buildings.hbs +7 -10
- package/addon/templates/project.hbs +12 -73
- package/addon/templates/quarterly-closure.hbs +1 -0
- package/addon/templates/search-building.hbs +202 -134
- package/addon/templates/search-project.hbs +98 -85
- package/addon/validations/building-work.js +106 -97
- package/addon/validations/extended-search-fields.js +27 -0
- package/addon/validations/realestate-identification.js +1 -0
- package/addon/xml/helpers.js +3 -0
- package/addon/xml/templates/building.js +1 -1
- package/addon/xml/templates/construction-project.js +1 -1
- package/app/styles/ember-ebau-gwr.scss +19 -0
- package/config/environment.js +4 -0
- package/config/icons.js +15 -0
- package/package.json +19 -15
- package/translations/de.yaml +29 -26
- package/translations/fr.yaml +11 -19
- package/translations/quarterly-closure/de.yaml +59 -0
- package/translations/validation-errors/de.yaml +37 -0
- package/addon/components/landing-page.hbs +0 -24
- package/addon/components/project-form/checkbox.hbs +0 -11
- package/addon/components/project-form/checkbox.js +0 -9
- package/addon/components/project-form/date.hbs +0 -10
- package/addon/components/project-form/diff.hbs +0 -43
- package/addon/components/project-form/diff.js +0 -18
- package/addon/components/project-form/field.hbs +0 -32
- package/addon/components/project-form/field.js +0 -59
- package/addon/components/project-form/input.hbs +0 -7
- package/addon/components/project-form/label.hbs +0 -17
- package/addon/components/project-form/select.hbs +0 -17
- package/addon/components/project-form/textarea.hbs +0 -7
- package/addon/components/project-form.hbs +0 -19
- package/addon/components/project-form.js +0 -14
- package/addon/components/sub-nav.js +0 -18
- package/addon/services/import-state.js +0 -10
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { inject as service } from "@ember/service";
|
|
2
|
+
import Component from "@glimmer/component";
|
|
3
|
+
import { tracked } from "@glimmer/tracking";
|
|
4
|
+
import { trackedFunction } from "ember-resources/util/function";
|
|
5
|
+
import { DateTime } from "luxon";
|
|
6
|
+
|
|
7
|
+
export default class SurveyDepartmentErrors extends Component {
|
|
8
|
+
@service quarterlyClosure;
|
|
9
|
+
@service notification;
|
|
10
|
+
@service intl;
|
|
11
|
+
|
|
12
|
+
get isFirstQuarter() {
|
|
13
|
+
return DateTime.now().toFormat("q") === "1";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@tracked errors = trackedFunction(this, async () => {
|
|
17
|
+
try {
|
|
18
|
+
return await this.quarterlyClosure.checkQuarterlySurveyDept();
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.error(error);
|
|
21
|
+
this.notification.danger(
|
|
22
|
+
this.intl.t(
|
|
23
|
+
"ember-gwr.quarterlyClosure.components.departmentErrors.error"
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<h2>
|
|
2
|
+
{{t "ember-gwr.globalLandingPage.quarterlyClosure" quarter=(current-quarter)}}
|
|
3
|
+
</h2>
|
|
4
|
+
{{#if this.displayErrorInfo}}
|
|
5
|
+
<div class="uk-flex uk-flex-middle uk-margin-bottom">
|
|
6
|
+
<FaIcon
|
|
7
|
+
@icon="circle-exclamation"
|
|
8
|
+
@fixedWidth={{true}}
|
|
9
|
+
class="uk-text-danger uk-margin-small-right"
|
|
10
|
+
/>
|
|
11
|
+
<span class="uk-text-meta">
|
|
12
|
+
{{t "ember-gwr.quarterlyClosure.needsCorrection"}}
|
|
13
|
+
</span>
|
|
14
|
+
</div>
|
|
15
|
+
{{/if}}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { inject as service } from "@ember/service";
|
|
2
|
+
import Component from "@glimmer/component";
|
|
3
|
+
import { ERROR } from "ember-ebau-gwr/models/quarterly-closure-status";
|
|
4
|
+
|
|
5
|
+
export default class QuarterlyClosureTitle extends Component {
|
|
6
|
+
@service quarterlyClosure;
|
|
7
|
+
|
|
8
|
+
get displayErrorInfo() {
|
|
9
|
+
return this.quarterlyClosure.status.type === ERROR;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<QuarterlyClosure::Title />
|
|
2
|
+
<UkFlex @horizontal="between" @vertical="bottom" class="uk-margin-bottom">
|
|
3
|
+
<QuarterlyClosure::Status />
|
|
4
|
+
<QuarterlyClosure::CloseSurveyButton />
|
|
5
|
+
</UkFlex>
|
|
6
|
+
|
|
7
|
+
<QuarterlyClosure::ErrorList
|
|
8
|
+
@isLoading={{this.quarterlyClosure.status.isLoading}}
|
|
9
|
+
/>
|
|
@@ -1,130 +1,152 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
<ValidatedForm
|
|
2
|
+
@model={{@changeset}}
|
|
3
|
+
@on-submit={{(perform @onSubmit @changeset)}}
|
|
4
|
+
class="validated-form"
|
|
5
|
+
...attributes
|
|
6
|
+
as |Form|
|
|
7
|
+
>
|
|
8
|
+
{{yield
|
|
9
|
+
(component
|
|
10
|
+
Form.input
|
|
11
|
+
errorComponent=(component "validated-form-error")
|
|
12
|
+
optionLabelPath="label"
|
|
13
|
+
optionValuePath="value"
|
|
14
|
+
optionTargetPath="value"
|
|
15
|
+
)
|
|
16
|
+
(component
|
|
17
|
+
Form.input
|
|
18
|
+
name="hasError"
|
|
19
|
+
type="select"
|
|
20
|
+
label=(t "ember-gwr.search.hasError")
|
|
21
|
+
optionLabelPath="label"
|
|
22
|
+
optionValuePath="value"
|
|
23
|
+
optionTargetPath="value"
|
|
24
|
+
options=this.errorOptions
|
|
25
|
+
prompt=(t "ember-gwr.search.hasErrorPlaceholder")
|
|
26
|
+
promptIsSelectable=true
|
|
27
|
+
errorComponent=(component "validated-form-error")
|
|
28
|
+
)
|
|
29
|
+
Form
|
|
30
|
+
}}
|
|
31
|
+
{{#if (and @extendedSearch this.extendedSearchActive)}}
|
|
11
32
|
{{#let
|
|
12
33
|
(component
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
34
|
+
Form.input
|
|
35
|
+
errorComponent=(component "validated-form-error")
|
|
36
|
+
disabled=(get Form.model @idField)
|
|
16
37
|
)
|
|
17
|
-
as |
|
|
38
|
+
as |FilterInput|
|
|
18
39
|
}}
|
|
19
|
-
|
|
20
|
-
<div class="uk-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
<div class="uk-flex uk-flex-between uk-margin-small-bottom uk-margin-top">
|
|
41
|
+
<div class="uk-width-1-2">
|
|
42
|
+
<h3>
|
|
43
|
+
{{t "ember-gwr.components.search.realestateIdentificationHeading"}}
|
|
44
|
+
</h3>
|
|
45
|
+
<FilterInput
|
|
46
|
+
@name="realestateIdentification.number"
|
|
47
|
+
@label={{t "ember-gwr.building.realestateIdentification.number"}}
|
|
48
|
+
/>
|
|
49
|
+
<FilterInput
|
|
50
|
+
@name="realestateIdentification.EGRID"
|
|
51
|
+
@label={{t "ember-gwr.building.realestateIdentification.EGRID"}}
|
|
52
|
+
/>
|
|
53
|
+
<FilterInput
|
|
54
|
+
@name="realestateIdentification.subDistrict"
|
|
55
|
+
@label={{t
|
|
56
|
+
"ember-gwr.building.realestateIdentification.subDistrict"
|
|
57
|
+
}}
|
|
58
|
+
type="number"
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
37
61
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
62
|
+
<div>
|
|
63
|
+
<hr
|
|
64
|
+
class="uk-divider-vertical uk-height-1-1 uk-margin-left uk-margin-right"
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
43
67
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
68
|
+
<div class="uk-width-1-2">
|
|
69
|
+
<div class="uk-margin">
|
|
70
|
+
<h3>
|
|
71
|
+
{{t "ember-gwr.components.search.createDateHeading"}}
|
|
72
|
+
</h3>
|
|
73
|
+
<div class="uk-flex">
|
|
74
|
+
<div class="uk-width-1-2">
|
|
75
|
+
<div class="uk-margin-small-right">
|
|
76
|
+
<FilterInput
|
|
77
|
+
@name="createDate.dateFrom"
|
|
78
|
+
@label={{t
|
|
79
|
+
"ember-gwr.components.search.createDate.dateFrom"
|
|
80
|
+
}}
|
|
81
|
+
@type="date"
|
|
82
|
+
/>
|
|
54
83
|
</div>
|
|
55
|
-
|
|
56
|
-
<div class="uk-
|
|
84
|
+
</div>
|
|
85
|
+
<div class="uk-width-1-2">
|
|
57
86
|
<div class="uk-margin-small-right">
|
|
58
|
-
<
|
|
59
|
-
@
|
|
60
|
-
@
|
|
61
|
-
@
|
|
87
|
+
<FilterInput
|
|
88
|
+
@name="createDate.dateTo"
|
|
89
|
+
@label={{t "ember-gwr.components.search.createDate.dateTo"}}
|
|
90
|
+
@type="date"
|
|
62
91
|
/>
|
|
63
92
|
</div>
|
|
64
|
-
<Field
|
|
65
|
-
@attr="createDate.dateTo"
|
|
66
|
-
@noMargin={{true}}
|
|
67
|
-
@inputType="date"
|
|
68
|
-
/>
|
|
69
93
|
</div>
|
|
70
94
|
</div>
|
|
95
|
+
</div>
|
|
71
96
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
97
|
+
<div class="uk-margin">
|
|
98
|
+
<h3>
|
|
99
|
+
{{t "ember-gwr.components.search.modifyDateHeading"}}
|
|
100
|
+
</h3>
|
|
101
|
+
<div class="uk-flex">
|
|
102
|
+
<div class="uk-width-1-2">
|
|
103
|
+
<div class="uk-margin-small-right">
|
|
104
|
+
<FilterInput
|
|
105
|
+
@name="modifyDate.dateFrom"
|
|
106
|
+
@label={{t
|
|
107
|
+
"ember-gwr.components.search.modifyDate.dateFrom"
|
|
108
|
+
}}
|
|
109
|
+
@type="date"
|
|
110
|
+
/>
|
|
81
111
|
</div>
|
|
82
|
-
|
|
83
|
-
<div class="uk-
|
|
112
|
+
</div>
|
|
113
|
+
<div class="uk-width-1-2">
|
|
84
114
|
<div class="uk-margin-small-right">
|
|
85
|
-
<
|
|
86
|
-
@
|
|
87
|
-
@
|
|
88
|
-
@
|
|
115
|
+
<FilterInput
|
|
116
|
+
@name="modifyDate.dateTo"
|
|
117
|
+
@label={{t "ember-gwr.components.search.modifyDate.dateTo"}}
|
|
118
|
+
@type="date"
|
|
89
119
|
/>
|
|
90
120
|
</div>
|
|
91
|
-
<Field
|
|
92
|
-
@attr="modifyDate.dateTo"
|
|
93
|
-
@noMargin={{true}}
|
|
94
|
-
@inputType="date"
|
|
95
|
-
/>
|
|
96
121
|
</div>
|
|
97
122
|
</div>
|
|
98
123
|
</div>
|
|
99
124
|
</div>
|
|
100
|
-
|
|
125
|
+
</div>
|
|
101
126
|
{{/let}}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
class="uk-button uk-button-default"
|
|
107
|
-
{{on
|
|
108
|
-
"click"
|
|
109
|
-
(fn (mut this.extendedSearch) (not this.extendedSearch))
|
|
110
|
-
}}
|
|
111
|
-
>
|
|
112
|
-
{{t
|
|
113
|
-
(concat
|
|
114
|
-
"ember-gwr.components.search.extendedSearch."
|
|
115
|
-
(if this.extendedSearch "collapse" "extend")
|
|
116
|
-
)
|
|
117
|
-
}}
|
|
118
|
-
</button>
|
|
119
|
-
{{/if}}
|
|
127
|
+
{{/if}}
|
|
128
|
+
|
|
129
|
+
<div class="uk-flex uk-flex-right">
|
|
130
|
+
{{#if @extendedSearch}}
|
|
120
131
|
<UkButton
|
|
121
|
-
@
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
{{
|
|
127
|
-
|
|
128
|
-
|
|
132
|
+
@label={{if
|
|
133
|
+
this.extendedSearchActive
|
|
134
|
+
(t "ember-gwr.components.search.extendedSearch.collapse")
|
|
135
|
+
(t "ember-gwr.components.search.extendedSearch.extend")
|
|
136
|
+
}}
|
|
137
|
+
@value={{this.extendedSearchActive}}
|
|
138
|
+
@onClick={{fn
|
|
139
|
+
(mut this.extendedSearchActive)
|
|
140
|
+
(not this.extendedSearchActive)
|
|
141
|
+
}}
|
|
142
|
+
class="uk-margin-small-right"
|
|
143
|
+
/>
|
|
144
|
+
{{/if}}
|
|
145
|
+
<Form.submit
|
|
146
|
+
data-test-submit-btn
|
|
147
|
+
@label={{@submitLabel}}
|
|
148
|
+
@loading={{@onSubmit.isRunning}}
|
|
149
|
+
@buttonComponent={{component "model-form/submit" color="primary"}}
|
|
150
|
+
/>
|
|
129
151
|
</div>
|
|
130
|
-
</
|
|
152
|
+
</ValidatedForm>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { action
|
|
1
|
+
import { action } from "@ember/object";
|
|
2
2
|
import { inject as service } from "@ember/service";
|
|
3
3
|
import Component from "@glimmer/component";
|
|
4
4
|
import { tracked } from "@glimmer/tracking";
|
|
@@ -6,66 +6,20 @@ import { tracked } from "@glimmer/tracking";
|
|
|
6
6
|
export default class SearchFiltersComponent extends Component {
|
|
7
7
|
@service intl;
|
|
8
8
|
|
|
9
|
-
@tracked
|
|
10
|
-
@tracked
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
9
|
+
@tracked extendedSearchActive = false;
|
|
10
|
+
@tracked errorOptions = [
|
|
11
|
+
{
|
|
12
|
+
value: true,
|
|
13
|
+
label: this.intl.t("ember-gwr.search.hasErrorOptions.true"),
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
value: false,
|
|
17
|
+
label: this.intl.t("ember-gwr.search.hasErrorOptions.false"),
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
20
|
|
|
21
21
|
@action
|
|
22
22
|
updateField(fieldName, value) {
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@action
|
|
27
|
-
submit(event) {
|
|
28
|
-
event.preventDefault();
|
|
29
|
-
// If the validation returns no error then we can emit the search event.
|
|
30
|
-
if (!(this.extendedSearch && this.validateSearchQuery(this.query))) {
|
|
31
|
-
this.args.search.perform(this.query);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// This is ugly state modifying code with side effects. But i didnt know a nicer way.
|
|
36
|
-
validateSearchQuery({ realestateIdentification, modifyDate, createDate }) {
|
|
37
|
-
this.validationErrors = {};
|
|
38
|
-
// Since the api needs a number for the realestateIdentification
|
|
39
|
-
// We have to check that the number is set.
|
|
40
|
-
if (
|
|
41
|
-
(realestateIdentification.EGRID ||
|
|
42
|
-
realestateIdentification.subDistrict) &&
|
|
43
|
-
!realestateIdentification.number
|
|
44
|
-
) {
|
|
45
|
-
this.validationErrors.realestateIdentification = this.intl.t(
|
|
46
|
-
"ember-gwr.components.search.validation.realestateIdentification"
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// If setting a date filter, both the to and from date have to be set.
|
|
51
|
-
if (
|
|
52
|
-
(modifyDate.dateTo || modifyDate.dateFrom) &&
|
|
53
|
-
!(modifyDate.dateTo && modifyDate.dateFrom)
|
|
54
|
-
) {
|
|
55
|
-
this.validationErrors.modifyDate = this.intl.t(
|
|
56
|
-
"ember-gwr.components.search.validation.bothDatesSet"
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (
|
|
61
|
-
(createDate.dateTo || createDate.dateFrom) &&
|
|
62
|
-
!(createDate.dateTo && createDate.dateFrom)
|
|
63
|
-
) {
|
|
64
|
-
this.validationErrors.createDate = this.intl.t(
|
|
65
|
-
"ember-gwr.components.search.validation.bothDatesSet"
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
// Return a boolean if there are errors or not
|
|
69
|
-
return Object.keys(this.validationErrors).length;
|
|
23
|
+
this.query[fieldName] = value;
|
|
70
24
|
}
|
|
71
25
|
}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
<tbody>
|
|
2
|
+
{{#each @results as |result|}}
|
|
3
|
+
<tr ...attributes>
|
|
4
|
+
{{yield (component "search/result-table/row/field" data=result) result}}
|
|
5
|
+
</tr>
|
|
6
|
+
{{else}}
|
|
7
|
+
<tr>
|
|
8
|
+
<td colspan="99" class="uk-text-center">
|
|
9
|
+
{{t "ember-gwr.components.search.noResults"}}
|
|
10
|
+
</td>
|
|
11
|
+
</tr>
|
|
12
|
+
{{/each}}
|
|
2
13
|
{{#if @loading}}
|
|
3
14
|
<tr>
|
|
4
15
|
<td colspan="99" class="uk-text-center">
|
|
5
16
|
{{t "ember-gwr.components.search.loading"}}
|
|
6
17
|
</td>
|
|
7
18
|
</tr>
|
|
8
|
-
{{else}}
|
|
9
|
-
{{#each @results as |result|}}
|
|
10
|
-
<tr ...attributes>
|
|
11
|
-
{{yield (component "search/result-table/row/field" data=result) result}}
|
|
12
|
-
</tr>
|
|
13
|
-
{{else}}
|
|
14
|
-
<tr>
|
|
15
|
-
<td colspan="99" class="uk-text-center">
|
|
16
|
-
{{t "ember-gwr.components.search.noResults"}}
|
|
17
|
-
</td>
|
|
18
|
-
</tr>
|
|
19
|
-
{{/each}}
|
|
20
19
|
{{/if}}
|
|
21
|
-
</tbody>
|
|
20
|
+
</tbody>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<table
|
|
2
|
-
class="uk-table uk-table-middle uk-table-divider uk-table-striped"
|
|
2
|
+
class="uk-table uk-table-middle uk-table-divider uk-table-striped uk-margin-top"
|
|
3
3
|
...attributes
|
|
4
4
|
>
|
|
5
5
|
{{yield
|
|
6
|
+
(component "search/result-table/head")
|
|
6
7
|
(component "search/result-table/row" results=@results loading=@loading)
|
|
7
8
|
}}
|
|
8
|
-
</table>
|
|
9
|
+
</table>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{{#let
|
|
2
|
+
(component
|
|
3
|
+
"search/filters"
|
|
4
|
+
changeset=this.changeset
|
|
5
|
+
onSubmit=this.onSubmit
|
|
6
|
+
validateBeforeSubmit=true
|
|
7
|
+
extendedSearch=@extendedSearch
|
|
8
|
+
idField=@idField
|
|
9
|
+
)
|
|
10
|
+
(component
|
|
11
|
+
"search/result-table"
|
|
12
|
+
results=this.searchResults
|
|
13
|
+
loading=this.search.isRunning
|
|
14
|
+
)
|
|
15
|
+
as |Filters Results|
|
|
16
|
+
}}
|
|
17
|
+
{{yield Filters to="filters"}}
|
|
18
|
+
|
|
19
|
+
{{#if this.search.lastSuccessful}}
|
|
20
|
+
{{yield Results to="results"}}
|
|
21
|
+
{{/if}}
|
|
22
|
+
|
|
23
|
+
{{#if this.hasMoreResults}}
|
|
24
|
+
<Search::ResultTable::LoadMore
|
|
25
|
+
@onClick={{(perform this.loadMore)}}
|
|
26
|
+
@loading={{this.search.isRunning}}
|
|
27
|
+
/>
|
|
28
|
+
{{/if}}
|
|
29
|
+
{{/let}}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { inject as service } from "@ember/service";
|
|
2
|
+
import Component from "@glimmer/component";
|
|
3
|
+
import { tracked } from "@glimmer/tracking";
|
|
4
|
+
import { Changeset } from "ember-changeset";
|
|
5
|
+
import lookupValidator from "ember-changeset-validations";
|
|
6
|
+
import { dropTask } from "ember-concurrency";
|
|
7
|
+
import ExtendedSearchValidations from "ember-ebau-gwr/validations/extended-search-fields";
|
|
8
|
+
|
|
9
|
+
export default class SearchComponent extends Component {
|
|
10
|
+
@tracked page = 1;
|
|
11
|
+
@tracked searchResults = null;
|
|
12
|
+
@tracked hasMoreResults = false;
|
|
13
|
+
|
|
14
|
+
@service notification;
|
|
15
|
+
@service intl;
|
|
16
|
+
@service config;
|
|
17
|
+
|
|
18
|
+
constructor(owner, args) {
|
|
19
|
+
super(owner, args);
|
|
20
|
+
|
|
21
|
+
let validations = {
|
|
22
|
+
...this.args.validations,
|
|
23
|
+
};
|
|
24
|
+
let baseQuery = {
|
|
25
|
+
...(this.args.baseQuery ?? {}),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
if (this.args.extendedSearch) {
|
|
29
|
+
validations = {
|
|
30
|
+
...validations,
|
|
31
|
+
...ExtendedSearchValidations,
|
|
32
|
+
};
|
|
33
|
+
baseQuery = {
|
|
34
|
+
realestateIdentification: {
|
|
35
|
+
number: null,
|
|
36
|
+
EGRID: null,
|
|
37
|
+
subDistrict: null,
|
|
38
|
+
},
|
|
39
|
+
createDate: {
|
|
40
|
+
dateFrom: null,
|
|
41
|
+
dateTo: null,
|
|
42
|
+
},
|
|
43
|
+
modifyDate: {
|
|
44
|
+
dateFrom: null,
|
|
45
|
+
dateTo: null,
|
|
46
|
+
},
|
|
47
|
+
...baseQuery,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
this.changeset = new Changeset(
|
|
52
|
+
baseQuery,
|
|
53
|
+
lookupValidator(validations),
|
|
54
|
+
validations
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@dropTask
|
|
59
|
+
*search(_query) {
|
|
60
|
+
try {
|
|
61
|
+
this.rawQuery = {
|
|
62
|
+
...this.rawQuery,
|
|
63
|
+
..._query?.pendingData,
|
|
64
|
+
page: this.page,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const _results = yield this.args.service.search(this.rawQuery);
|
|
68
|
+
if (!_results || _results.length < this.config.pageSize) {
|
|
69
|
+
this.hasMoreResults = false;
|
|
70
|
+
} else {
|
|
71
|
+
this.hasMoreResults = true;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
this.searchResults =
|
|
75
|
+
this.page === 1 ? _results : this.searchResults.concat(_results);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error(error);
|
|
78
|
+
this.notification.danger(
|
|
79
|
+
this.intl.t("ember-gwr.generalErrors.searchError")
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@dropTask
|
|
85
|
+
*onSubmit(args) {
|
|
86
|
+
this.searchResults = [];
|
|
87
|
+
this.page = 1;
|
|
88
|
+
yield this.search.perform(args);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@dropTask
|
|
92
|
+
*loadMore() {
|
|
93
|
+
this.page += 1;
|
|
94
|
+
yield this.search.perform();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
{{#
|
|
2
|
-
<BackRoute
|
|
3
|
-
@backRoute={{@backRoute}}
|
|
4
|
-
@backModel={{@backModel}}
|
|
5
|
-
@backText={{@backText}}
|
|
6
|
-
/>
|
|
1
|
+
{{#if (current-route-is-not @hiddenOnRoute)}}
|
|
7
2
|
<UkTab ...attributes as |Tab|>
|
|
8
3
|
{{#each @links as |link|}}
|
|
9
|
-
<Tab.item
|
|
4
|
+
<Tab.item
|
|
5
|
+
@href={{build-url link.route link.models}}
|
|
6
|
+
>{{link.text}}</Tab.item>
|
|
10
7
|
{{/each}}
|
|
11
8
|
</UkTab>
|
|
12
|
-
{{/
|
|
9
|
+
{{/if}}
|