LLEdit.vue 10.7 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="Processes" 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
18
19
20
21
22
23
24
25
26
27
28
29
30
          <b>Measurement Type</b>
          <br />
          <l-select
            v-model="editObj.measurement_type"
            class="text-xs"
            :data="measurementtypes"
            :multiple="false"
          >
            <l-option
              v-for="i in measurementtypes"
              :key="i.value"
              class="text-xs"
              :value="i.value"
              :label="i.label"
            />
Andrzej Obracaj's avatar
Andrzej Obracaj committed
31
          </l-select>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
32
33
34
        </div>
      </div>
      <div class="w-full flex mb-4">
Andrzej Obracaj's avatar
Andrzej Obracaj committed
35
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
          <b>Measurement Method</b>
          <br />
          <l-select
            v-model="editObj.measurement_method"
            class="text-xs"
            :data="measurementmethods"
            :multiple="false"
          >
            <l-option
              v-for="i in measurementmethods"
              :key="i.value"
              class="text-xs"
              :value="i.value"
              :label="i.label"
            />
          </l-select>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
52
53
        </div>
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
54
55
56
          <b>Other Measurement Method</b>
          <br />
          <l-input
57
            placeholder="Enter 'Other Measurement Method' (optional) (text)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
58
59
60
            v-model="editObj.other_measurement_method"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
61
62
63
64
        </div>
      </div>
      <div class="w-full flex mb-4">
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
65
66
67
          <b>Analytical Tech</b>
          <br />
          <l-input
68
            placeholder="Enter 'Analytical Tech' (optional) (text)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
69
70
71
            :value="editObj.analytical_tech"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
72
73
        </div>
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
74
75
76
          <b>Other Analytical Tech</b>
          <br />
          <l-input
77
            placeholder="Enter 'Other Analytical Tech' (optional) (text)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
78
79
80
            v-model="editObj.other_analytical_tech"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
81
82
83
84
        </div>
      </div>
      <div class="w-full flex mb-4">
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
85
86
87
          <b>Sampling Equipment</b>
          <br />
          <l-input
88
            placeholder="Enter 'Sampling Equipment' (optional) (text)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
89
90
91
            :value="editObj.sampling_equipment"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
92
        </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
93
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
94
95
96
          <b>Measurement Equipment</b>
          <br />
          <l-select
97
            v-model="editObj.measurement_equipments"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
98
99
100
101
102
103
104
105
106
107
108
109
            class="text-xs"
            :data="measurementequipments"
            :multiple="false"
          >
            <l-option
              v-for="i in measurementequipments"
              :key="i.value"
              class="text-xs"
              :value="i.value"
              :label="i.label"
            />
          </l-select>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
110
111
        </div>
      </div>
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
112
      <div class="w-full flex mb-4">
Andrzej Obracaj's avatar
Andrzej Obracaj committed
113
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
          <b>Equiv Demonstration</b>
          <br />
          <l-select
            v-model="editObj.equiv_demonstration"
            class="text-xs"
            :data="equivalencedemonstrated"
            :multiple="false"
          >
            <l-option
              v-for="i in equivalencedemonstrated"
              :key="i.value"
              class="text-xs"
              :value="i.value"
              :label="i.label"
            />
          </l-select>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
130
        </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
131
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
132
133
134
          <b>Equiv Demonstration Report</b>
          <br />
          <l-input
135
            placeholder="Enter 'Equiv Demonstration Report' (optional) (text)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
136
137
138
            v-model="editObj.equiv_demonstration_report"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
139
140
        </div>
      </div>
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
141
      <div class="w-full flex mb-4">
Andrzej Obracaj's avatar
Andrzej Obracaj committed
142
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
143
144
145
          <b>Detection Limit</b>
          <br />
          <l-input
146
            placeholder="Enter 'Detection Limit' (optional) (decimal number)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
147
148
149
            :value="editObj.detection_limit"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
150
        </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
151
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
          <b>Detection Limit Uom</b>
          <br />
          <l-select
            v-model="editObj.detection_limit_uom"
            class="text-xs"
            :data="concentrations"
            :multiple="false"
          >
            <l-option
              v-for="i in concentrations"
              :key="i.value"
              class="text-xs"
              :value="i.value"
              :label="i.label"
            />
          </l-select>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
168
169
        </div>
      </div>
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
170
      <div class="w-full flex mb-4">
Andrzej Obracaj's avatar
Andrzej Obracaj committed
171
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
172
173
174
          <b>Uncertainty Estimate</b>
          <br />
          <l-input
175
            placeholder="Enter 'Uncertainty Estimate' (optional) (decimal number)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
176
177
178
            :value="editObj.uncertainty_estimate"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
179
180
        </div>
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
181
182
183
          <b>Documentation</b>
          <br />
          <l-input
184
            placeholder="Enter 'Documentation' (optional) (text)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
185
186
187
            v-model="editObj.documentation"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
188
        </div>
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
189
      </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
190
191
      <div class="w-full flex mb-4">
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
192
193
194
          <b>QA Report</b>
          <br />
          <l-input
195
            placeholder="Enter 'QA Report' (optional) (text)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
196
197
198
            :value="editObj.qa_report"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
199
200
        </div>
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
201
202
203
          <b>Duration Number</b>
          <br />
          <l-input
204
            placeholder="Enter 'Duration Number' (whole number)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
205
206
207
            v-model="editObj.duration_number"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
208
209
210
211
        </div>
      </div>
      <div class="w-full flex mb-4">
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
212
213
214
215
216
217
218
219
220
221
222
          <b>Duration Unit</b>
          <br />
          <l-select v-model="editObj.duration_unit" class="text-xs" :data="times" :multiple="false">
            <l-option
              v-for="i in times"
              :key="i.value"
              class="text-xs"
              :value="i.value"
              :label="i.label"
            />
          </l-select>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
223
224
        </div>
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
225
226
227
          <b>Cadence Number</b>
          <br />
          <l-input
228
            placeholder="Enter 'Cadence Number' (whole number)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
229
230
231
            v-model="editObj.cadence_number"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
232
233
234
235
        </div>
      </div>
      <div class="w-full flex mb-4">
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
236
237
238
239
240
241
242
243
244
245
246
          <b>Cadence Unit</b>
          <br />
          <l-select v-model="editObj.cadence_unit" class="text-xs" :data="times" :multiple="false">
            <l-option
              v-for="i in times"
              :key="i.value"
              class="text-xs"
              :value="i.value"
              :label="i.label"
            />
          </l-select>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
247
248
        </div>
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
          <b>Responsible Authority ID</b>
          <br />
          <l-select
            v-model="editObj.responsible_authority_id"
            class="text-xs"
            :data="responsibleauthorities"
            :multiple="false"
          >
            <l-option
              v-for="i in responsibleauthorities"
              :key="i.value"
              class="text-xs"
              :value="i.value"
              :label="i.label"
            />
264
          </l-select>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
265
266
        </div>
      </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
267
268
      <div class="w-full flex mb-4">
        <div class="w-1/2 mr-2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
269
270
271
          <b>Other Measurement Equipment</b>
          <br />
          <l-input
272
            placeholder="Enter 'Other Measurement Equipment' (optional) (text)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
273
274
275
            :value="editObj.other_measurement_equipment"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
276
277
        </div>
        <div class="w-1/2">
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
278
279
280
          <b>Other Sampling Equipment</b>
          <br />
          <l-input
281
            placeholder="Enter 'Other Sampling Equipment' (optional) (text)"
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
282
283
284
            v-model="editObj.other_sampling_equipment"
            inputClass="text-2xs"
          ></l-input>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
285
        </div>
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
286
      </div>
Andrzej Obracaj's avatar
Andrzej Obracaj committed
287
288
289
290
291
292
293
294
295
296
297
298
299
300
      <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";
import { LInput, LButton, LSelect, LOption } from "@/components/forms";

export default {
  name: "LLEdit",
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
301
302
303
304
305
306
307
308
309
310
311
312
313
  props: [
    "showing",
    "processes",
    "measurementtypes",
    "measurementmethods",
    "measurementequipments",
    "equivalencedemonstrated",
    "concentrations",
    "times",
    "responsibleauthorities",
    "selected",
    "isnew"
  ],
Andrzej Obracaj's avatar
Andrzej Obracaj committed
314
315
316
317
318
319
320
321
322
323
324
325
  components: {
    LModal,
    LInput,
    LButton,
    LSelect,
    LOption
  },
  computed: {
    editObj: function() {
      return Object.assign({}, this.selected);
    }
  },
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
326
  methods: {
Andrzej Obracaj's avatar
Andrzej Obracaj committed
327
328
329
330
    close() {
      this.$emit("close");
    },
    onSave() {
Andrzej Obracaj's avatar
Andrzej Obracaj committed
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
      const mt = this.measurementtypes.find(
        r => r.value == this.editObj.measurement_type
      );
      this.editObj.measurement_type_name = mt.label;

      const mm = this.measurementmethods.find(
        r => r.value == this.editObj.measurement_method
      );
      this.editObj.measurement_method_name = mm.label;

      const me = this.measurementequipments.find(
        r => r.value == this.editObj.measurement_equipment
      );
      this.editObj.measurement_equipment_name = me.label;

      const ed = this.equivalencedemonstrated.find(
347
        r => r.value == this.editObj.equiv_demonstration
Andrzej Obracaj's avatar
Andrzej Obracaj committed
348
      );
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
349
350
      this.editObj.equiv_demonstration_name = ed.label;

Andrzej Obracaj's avatar
Andrzej Obracaj committed
351
      const c = this.concentrations.find(
352
        r => r.value == this.editObj.detection_limit_uom
Andrzej Obracaj's avatar
Andrzej Obracaj committed
353
      );
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
354
      this.editObj.concentration_name = c.label;
Andrzej Obracaj's avatar
Andrzej Obracaj committed
355

Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
356
357
358
359
360
      const du = this.times.find(r => r.value == this.editObj.duration_unit);
      this.editObj.duration_unit_name = du.label;

      const cu = this.times.find(r => r.value == this.editObj.cadence_unit);
      this.editObj.cadence_unit_name = cu.label;
361
362
363

      const ra = this.responsibleauthorities.find(
        r => r.value == this.editObj.responsible_authority_id
Andrzej Obracaj's avatar
Andrzej Obracaj committed
364
      );
Rune Åvar Ødegård's avatar
Rune Åvar Ødegård committed
365
366
      this.editObj.responsible_authority_name = ra.label;

Andrzej Obracaj's avatar
Andrzej Obracaj committed
367
368
369
370
371
372
      this.$emit("save", this.editObj);
      this.close();
    }
  }
};
</script>