|
1 | 1 | <template>
|
2 | 2 | <v-form v-model="valid" class="configuration-form border">
|
3 |
| - <v-row no-gutters> |
4 |
| - <v-col cols="12" sm="5"> |
| 3 | + <v-row |
| 4 | + no-gutters |
| 5 | + v-for="level in Object.keys(formData)" |
| 6 | + :key="level" |
| 7 | + :class="formData[level].enabled ? 'active' : 'inactive'" |
| 8 | + > |
| 9 | + <v-col cols="12" sm="1"> |
5 | 10 | <v-card
|
6 |
| - class="pa-2 full-height d-flex" |
7 |
| - outlined |
8 |
| - tile |
| 11 | + class="full-height d-flex align-center justify-center" |
| 12 | + outlined |
| 13 | + tile |
9 | 14 | >
|
10 |
| - <v-select |
11 |
| - v-model="formData.measure" |
12 |
| - class="hide-label" |
13 |
| - label="Onttrekking toepassen in laag" |
14 |
| - :items="measures" |
15 |
| - :disabled="disabled" |
| 15 | + <v-checkbox |
| 16 | + v-model="formData[level].enabled" |
| 17 | + hide-details |
| 18 | + class="hide-label checkbox align-center" |
| 19 | + label="Plaatsing" |
| 20 | + :disabled="disabled" |
16 | 21 | />
|
17 | 22 | </v-card>
|
18 | 23 | </v-col>
|
19 | 24 | <v-col cols="12" sm="3">
|
20 |
| - <text-field-measure |
21 |
| - :key="formData.measure" |
22 |
| - :differenceRules="differenceRules" |
23 |
| - :disabled="disabled" |
24 |
| - @update-difference-value="onUpdateDifferenceValue" /> |
| 25 | + <v-card |
| 26 | + class=" full-height d-flex align-center" |
| 27 | + outlined |
| 28 | + tile |
| 29 | + > |
| 30 | + <span class="pl-2"> |
| 31 | + {{ levels[level] }} |
| 32 | + </span> |
| 33 | + </v-card> |
25 | 34 | </v-col>
|
26 |
| - <v-col cols="12" sm="3"> |
| 35 | + <v-col |
| 36 | + cols="12" |
| 37 | + sm="4" |
| 38 | + > |
27 | 39 | <v-card
|
28 |
| - class="pa-2 full-height d-flex" |
29 |
| - outlined |
30 |
| - tile |
| 40 | + class="pa-2 full-height d-flex" |
| 41 | + outlined |
| 42 | + tile |
31 | 43 | >
|
32 | 44 | <v-select
|
33 |
| - v-model="formData.calculationLayer" |
34 |
| - class="hide-label" |
35 |
| - label="Onttrekking toepassen in laag" |
36 |
| - :items="calculationLayers.map((l) => ({ text: `Layer ${l}`, value: l }))" |
37 |
| - :disabled="disabled" |
| 45 | + v-model="formData[level].measure" |
| 46 | + class="hide-label" |
| 47 | + label="Onttrekking toepassen in laag" |
| 48 | + :items="measures" |
| 49 | + :disabled="disabled" |
38 | 50 | />
|
39 | 51 | </v-card>
|
40 | 52 | </v-col>
|
41 |
| - <v-col cols="12" sm="1"> |
42 |
| - <div |
43 |
| - v-if="deletable" |
44 |
| - class="d-flex justify-end align-center full-height" |
| 53 | + <v-col |
| 54 | + cols="12" |
| 55 | + sm="2" |
| 56 | + > |
| 57 | + <text-field-measure |
| 58 | + v-model="formData[level].difference" |
| 59 | + :differenceRules="differenceRules" |
| 60 | + :disabled="disabled" |
| 61 | + /> |
| 62 | + </v-col> |
| 63 | + <v-col |
| 64 | + cols="12" |
| 65 | + sm="2" |
| 66 | + > |
| 67 | + <v-card |
| 68 | + class="pa-2 full-height d-flex" |
| 69 | + outlined |
| 70 | + tile |
45 | 71 | >
|
46 |
| - <v-btn |
47 |
| - icon |
48 |
| - @click="handleDelete" |
49 |
| - title="delete form" |
50 |
| - > |
51 |
| - <v-icon>mdi-delete</v-icon> |
52 |
| - </v-btn> |
53 |
| - </div> |
| 72 | + <v-select |
| 73 | + v-model="formData[level].calculationLayer" |
| 74 | + class="hide-label" |
| 75 | + label="Onttrekking toepassen in laag" |
| 76 | + :items="calculationLayers.map((l) => ({ text: l, value: l }))" |
| 77 | + :disabled="disabled" |
| 78 | + /> |
| 79 | + </v-card> |
54 | 80 | </v-col>
|
55 | 81 | </v-row>
|
56 | 82 | </v-form>
|
|
60 | 86 | import TextFieldMeasure from '@/components/text-field-measure';
|
61 | 87 |
|
62 | 88 | export default {
|
63 |
| - components: { |
| 89 | + components: { |
64 | 90 | TextFieldMeasure,
|
65 |
| - |
| 91 | +
|
66 | 92 | },
|
67 | 93 | props: {
|
68 | 94 | id: {
|
|
77 | 103 | type: Object,
|
78 | 104 | required: true,
|
79 | 105 | },
|
| 106 | + type: { |
| 107 | + type: String, |
| 108 | + required: false, |
| 109 | + default: 'default', |
| 110 | + }, |
80 | 111 | deletable: {
|
81 | 112 | type: Boolean,
|
82 | 113 | default: false,
|
|
85 | 116 | data() {
|
86 | 117 | return {
|
87 | 118 | formData: {
|
88 |
| - difference: '1', |
89 |
| - calculationLayer: 1, |
90 |
| - measure: 'riverbedDifference', |
| 119 | + default: { |
| 120 | + main: { |
| 121 | + enabled: true, |
| 122 | + difference: '1', |
| 123 | + calculationLayer: 1, |
| 124 | + measure: 'stageDiff', |
| 125 | + }, |
| 126 | + primary: { |
| 127 | + enabled: false, |
| 128 | + difference: '1', |
| 129 | + calculationLayer: 1, |
| 130 | + measure: 'stageDiff', |
| 131 | + }, |
| 132 | + secondary: { |
| 133 | + enabled: false, |
| 134 | + difference: '1', |
| 135 | + calculationLayer: 1, |
| 136 | + measure: 'stageDiff', |
| 137 | + }, |
| 138 | + tertiary: { |
| 139 | + enabled: false, |
| 140 | + difference: '1', |
| 141 | + calculationLayer: 1, |
| 142 | + measure: 'stageDiff', |
| 143 | + }, |
| 144 | + }, |
91 | 145 | },
|
92 | 146 | calculationLayers: [ 1, 2 ],
|
| 147 | + levels: { |
| 148 | + main: 'Hoofd', |
| 149 | + primary: 'Primair', |
| 150 | + secondary: 'Secundair', |
| 151 | + tertiary: 'Tertiair', |
| 152 | + }, |
93 | 153 | measures: [
|
94 | 154 | {
|
95 | 155 | text: 'Rivierbodem (unit m)',
|
96 |
| - value: 'riverbedDifference', |
| 156 | + value: 'stageDiff', |
97 | 157 | },
|
98 | 158 | {
|
99 | 159 | text: 'Weerstand (unit m/d)',
|
100 |
| - value: 'conductance', |
| 160 | + value: 'condDiff', |
101 | 161 | },
|
102 | 162 | {
|
103 | 163 | text: 'Waterpeil (unit m)',
|
104 |
| - value: 'stageDifference', |
| 164 | + value: 'rbotDiff', |
105 | 165 | },
|
106 | 166 | ],
|
107 | 167 | rules: {
|
|
117 | 177 | computed: {
|
118 | 178 | differenceRules() {
|
119 | 179 | if (this.formData.measure === 'riverbedDifference') {
|
120 |
| - return [ |
| 180 | + return [ |
121 | 181 | this.rules.required,
|
122 | 182 | this.rules.notZero,
|
123 | 183 | (value) =>
|
|
127 | 187 | }
|
128 | 188 |
|
129 | 189 | if (this.formData.measure === 'stageDifference') {
|
130 |
| - |
| 190 | +
|
131 | 191 | return [
|
132 | 192 | this.rules.required,
|
133 | 193 | this.rules.notZero,
|
|
137 | 197 | ];
|
138 | 198 | }
|
139 | 199 |
|
140 |
| - return null; |
| 200 | + return []; |
141 | 201 | },
|
142 | 202 | },
|
143 | 203 | watch: {
|
|
151 | 211 | beforeMount() {
|
152 | 212 | this.formData = this.value;
|
153 | 213 | },
|
154 |
| - methods: { |
155 |
| - handleDelete() { |
156 |
| - this.$emit('delete', this.id); |
157 |
| - }, |
158 |
| - onUpdateDifferenceValue(event) { |
159 |
| - this.formData.difference = event; |
160 |
| - }, |
161 |
| - }, |
162 | 214 | };
|
163 | 215 | </script>
|
164 | 216 |
|
165 | 217 | <style>
|
| 218 | +.inactive * { |
| 219 | + color: rgba(0, 0, 0, 0.4) !important; |
| 220 | + fill: rgba(0, 0, 0, 0.4) !important; |
| 221 | +} |
| 222 | +.checkbox { |
| 223 | + aspect-ratio: 1/1; |
| 224 | +} |
| 225 | +
|
166 | 226 | .hide-label {
|
167 | 227 | padding-top: 0;
|
168 | 228 | margin-top: 0;
|
|
0 commit comments