LLEdit.vue 9.13 KB
Newer Older
Andrzej Obracaj's avatar
Andrzej Obracaj committed
1
<template>
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
2
  <l-modal :showing="showing" text="Stations" icon="edit" color="bg-orange-500" @close="close">
Andrzej Obracaj's avatar
Andrzej Obracaj committed
3
4
    <div class="w-full text-xs" v-if="editObj.id">
      <div class="w-full flex mb-4">
Andrzej Obracaj's avatar
Andrzej Obracaj committed
5
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
6
7
8
          <b>Id</b>
          <br />
          <l-input
9
            placeholder="Enter unique Id"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
10
11
12
13
            v-model="editObj.id"
            inputClass="text-2xs"
            :disabled="!this.isnew"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
14
        </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
15
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
16
17
          <b>Name</b>
          <br />
18
          <l-input placeholder="Enter 'Name' (text)" v-model="editObj.name" inputClass="text-2xs"></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
19
20
21
        </div>
      </div>
      <div class="w-full flex mb-4">
Andrzej Obracaj's avatar
Andrzej Obracaj committed
22
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
23
24
25
26
27
28
29
          <b>Begin Position</b>
          <br />
          <l-input
            placeholder="YYYY-MM-DDTHH:mm:ss+hh:00"
            v-model="editObj.begin_position"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
30
        </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
31
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
32
33
34
35
36
37
38
          <b>End Position</b>
          <br />
          <l-input
            placeholder="YYYY-MM-DDTHH:mm:ss+hh:00 (optional)"
            v-model="editObj.end_position"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
39
40
41
        </div>
      </div>
      <div class="w-full flex mb-4">
Andrzej Obracaj's avatar
Andrzej Obracaj committed
42
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
43
44
45
46
47
48
49
50
51
52
53
          <b>Network</b>
          <br />
          <l-select v-model="editObj.network_id" class="text-xs" :data="networks" :multiple="false">
            <l-option
              v-for="i in networks"
              :key="i.value"
              class="text-xs"
              :value="i.value"
              :label="i.label"
            />
          </l-select>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
54
        </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
55
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
56
57
58
          <b>City</b>
          <br />
          <l-input
59
            placeholder="Enter 'City' (optional) (text)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
60
61
62
            v-model="editObj.city"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
63
64
        </div>
      </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
65
      <div class="w-full flex mb-4">
Andrzej Obracaj's avatar
Andrzej Obracaj committed
66
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
67
68
69
          <b>National Station Code</b>
          <br />
          <l-input
70
            placeholder="Enter 'National Station Code' (optional) (text)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
71
72
73
            v-model="editObj.national_station_code"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
74
        </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
75
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
          <b>Media Monitored</b>
          <br />
          <l-select
            v-model="editObj.media_monitored"
            class="text-xs"
            :data="mediavalues"
            :multiple="false"
          >
            <l-option
              v-for="i in mediavalues"
              :key="i.value"
              class="text-xs"
              :value="i.value"
              :label="i.label"
            />
          </l-select>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
92
93
        </div>
      </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
94
      <div class="w-full flex mb-4">
Andrzej Obracaj's avatar
Andrzej Obracaj committed
95
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
96
97
98
          <b>Mobile</b>
          <br />
          <l-input
99
            placeholder="Enter 'Mobile' ('true' or 'false')"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
100
101
102
            v-model="editObj.mobile"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
103
        </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
104
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
          <b>Measurement Regime</b>
          <br />
          <l-select
            v-model="editObj.measurement_regime"
            class="text-xs"
            :data="measurementregimes"
            :multiple="false"
          >
            <l-option
              v-for="i in measurementregimes"
              :key="i.value"
              class="text-xs"
              :value="i.value"
              :label="i.label"
            />
Andrzej Obracaj's avatar
Andrzej Obracaj committed
120
          </l-select>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
121
122
        </div>
      </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
123
      <div class="w-full flex mb-4">
Andrzej Obracaj's avatar
Andrzej Obracaj committed
124
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
          <b>Area Classsification</b>
          <br />
          <l-select
            v-model="editObj.area_classification"
            class="text-xs"
            :data="areaclassifications"
            :multiple="false"
          >
            <l-option
              v-for="i in areaclassifications"
              :key="i.value"
              class="text-xs"
              :value="i.value"
              :label="i.label"
            />
Andrzej Obracaj's avatar
Andrzej Obracaj committed
140
          </l-select>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
141
        </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
142
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
143
144
145
          <b>Distance Junction</b>
          <br />
          <l-input
146
            placeholder="Enter 'Distance Junction' (optional) (whole number)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
147
148
149
            v-model="editObj.distance_junction"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
150
151
        </div>
      </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
152
      <div class="w-full flex mb-4">
Andrzej Obracaj's avatar
Andrzej Obracaj committed
153
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
154
155
156
          <b>Traffic Volume</b>
          <br />
          <l-input
157
            placeholder="Enter 'Traffic Volume' (optional) (whole number)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
158
159
160
            v-model="editObj.traffic_volume"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
161
        </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
162
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
163
164
165
          <b>Heavy Duty Fraction</b>
          <br />
          <l-input
166
            placeholder="Enter 'Heavy Duty Fraction' (optional) (decimal number)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
167
168
169
            v-model="editObj.heavy_duty_fraction"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
170
171
        </div>
      </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
172
      <div class="w-full flex mb-4">
Andrzej Obracaj's avatar
Andrzej Obracaj committed
173
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
174
175
176
          <b>Street Width</b>
          <br />
          <l-input
177
            placeholder="Enter 'Street Width' (optional) (whole number)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
178
179
180
            v-model="editObj.street_width"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
181
        </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
182
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
183
184
185
          <b>Height Facades</b>
          <br />
          <l-input
186
            placeholder="Enter 'Height Facades' (optional) (whole number)"
Andrzej Obracaj's avatar
bug    
Andrzej Obracaj committed
187
            v-model="editObj.height_facades"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
188
189
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
190
191
        </div>
      </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
192
      <div class="w-full flex mb-4">
Andrzej Obracaj's avatar
Andrzej Obracaj committed
193
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
194
195
196
          <b>Longitude</b>
          <br />
          <l-input
197
            placeholder="Enter 'Longitude' (decimal number)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
198
199
200
            v-model="editObj.longitude"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
201
        </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
202
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
203
204
205
          <b>Latitude</b>
          <br />
          <l-input
206
            placeholder="Enter 'Latitude' (decimal number)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
207
208
209
            v-model="editObj.latitude"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
210
        </div>
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
211
      </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
212
      <div class="w-full flex mb-4">
Andrzej Obracaj's avatar
Andrzej Obracaj committed
213
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
214
215
216
          <b>Altitude</b>
          <br />
          <l-input
217
            placeholder="Enter 'Altitude' (decimal number)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
218
219
220
            v-model="editObj.altitude"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
221
222
        </div>
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
223
224
225
          <b>Epsg</b>
          <br />
          <l-input
226
            placeholder="Enter 'Epsg' (whole number)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
227
228
229
            v-model="editObj.epsg"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
230
        </div>
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
231
      </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
232
      <div class="w-full flex mb-4">
Andrzej Obracaj's avatar
Andrzej Obracaj committed
233
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
234
235
236
          <b>Municipality</b>
          <br />
          <l-input
237
            placeholder="Enter 'Municipality' (optional) (text)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
238
239
240
            v-model="editObj.municipality"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
241
        </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
242
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
243
244
245
          <b>Eoi Code</b>
          <br />
          <l-input
246
            placeholder="Enter 'Eoi Code' (text)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
247
248
249
            v-model="editObj.eoi_code"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
250
        </div>
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
251
      </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
252
253
254
255
256
257
258
259
260
261
      <div class="flex w-full justify-between">
        <l-button type="success" @click="onSave">Save changes</l-button>
        <l-button type="danger" @click="close">Cancel</l-button>
      </div>
    </div>
  </l-modal>
</template>

<script>
import LModal from "@/components/LModal";
Andrzej Obracaj's avatar
Andrzej Obracaj committed
262
263
import { LInput, LButton, LSelect, LOption, LRadio } from "@/components/forms";
import StationsService from "./stations.service";
Andrzej Obracaj's avatar
Andrzej Obracaj committed
264
265
266

export default {
  name: "LLEdit",
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
267
268
269
270
271
272
273
274
275
276
  props: [
    "showing",
    "stations",
    "mediavalues",
    "measurementregimes",
    "areaclassifications",
    "networks",
    "selected",
    "isnew"
  ],
Andrzej Obracaj's avatar
Andrzej Obracaj committed
277
278
279
280
281
  components: {
    LModal,
    LInput,
    LButton,
    LSelect,
Andrzej Obracaj's avatar
Andrzej Obracaj committed
282
283
    LOption,
    LRadio
Andrzej Obracaj's avatar
Andrzej Obracaj committed
284
  },
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
285
286
287
  mounted() {
    console.log(this.$el);
  },
Andrzej Obracaj's avatar
Andrzej Obracaj committed
288
289
290
  data() {
    return {
      mobiles: [
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
291
292
        { value: true, label: "true" },
        { value: false, label: "false" }
Andrzej Obracaj's avatar
Andrzej Obracaj committed
293
294
295
      ]
    };
  },
Andrzej Obracaj's avatar
Andrzej Obracaj committed
296
297
298
  computed: {
    editObj: function() {
      return Object.assign({}, this.selected);
299
      // debugger;
Andrzej Obracaj's avatar
Andrzej Obracaj committed
300
301
    }
  },
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
302
  methods: {
Andrzej Obracaj's avatar
Andrzej Obracaj committed
303
304
305
306
    close() {
      this.$emit("close");
    },
    onSave() {
307
      // debugger;
Andrzej Obracaj's avatar
Andrzej Obracaj committed
308
309
310
      const mv = this.mediavalues.find(
        r => r.value == this.editObj.media_monitored
      );
Andrzej Obracaj's avatar
Andrzej Obracaj committed
311
      this.editObj.media_monitored_name = mv.value;
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
312

Andrzej Obracaj's avatar
Andrzej Obracaj committed
313
314
315
      const mr = this.measurementregimes.find(
        r => r.value == this.editObj.measurement_regime
      );
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
316
      this.editObj.measurement_regime = mr.value;
Andrzej Obracaj's avatar
Andrzej Obracaj committed
317
318
319
320

      const ac = this.areaclassifications.find(
        r => r.value == this.editObj.area_classification
      );
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
321
      this.editObj.area_classification = ac.value;
Andrzej Obracaj's avatar
Andrzej Obracaj committed
322

Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
323
324
      const n = this.networks.find(r => r.value == this.editObj.network_id);
      this.editObj.networks = n.value;
Andrzej Obracaj's avatar
Andrzej Obracaj committed
325

Andrzej Obracaj's avatar
Andrzej Obracaj committed
326
327
      this.$emit("save", this.editObj);
      this.close();
Andrzej Obracaj's avatar
Andrzej Obracaj committed
328
    },
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
329
330
    boolValues() {
      return [{ value: true, label: true }, { value: false, label: false }];
Andrzej Obracaj's avatar
Andrzej Obracaj committed
331
332
333
334
    }
  }
};
</script>