Skip to content

Commit

Permalink
field updates
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamN2424 committed Oct 17, 2023
1 parent 7de571c commit 4af23ae
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 40 deletions.
2 changes: 1 addition & 1 deletion assets/data/initData.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
id: 0,
stipe_features: {},
hymenium: {},
gills: {},
cap_features: {}
}
17 changes: 9 additions & 8 deletions components/formset_basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@
name="mush_native"
class="form-input"
v-model="native"
@change="addMushKey('native_or_introduced', native==='Native')">
<option>Native</option>
<option>Introduced</option>
@change="addMushKey('native_or_introduced', native)">
<option value="native">Native</option>
<option value="introduced">Introduced</option>
</select>

<label for="mush_photos">Photos*</label>
Expand Down Expand Up @@ -184,14 +184,14 @@ const edibility = ref("")
const ecology = ref("")
const environment = ref("")
const timeOfYear = ref([])
const native = ref()
const native = ref("")
const photos = ref("")
// const juvenilePhotos = ref("")
// const adultPhotos = ref("")
// const elderlyPhotos = ref("")
const addMushKey = (key, val, subKey = "") => {
if (["stipe_features", "hymenium", "cap_features"].includes(key) && subKey != "") {
if (["stipe_features", "gills", "cap_features"].includes(key) && subKey != "") {
mushJSON.value[key][subKey] = val;
} else {
mushJSON.value[key] = val;
Expand Down Expand Up @@ -239,11 +239,12 @@ watch(mushJSON, async (newMushJSON, oldMushJSON) => {
timeOfYear.value = mushJSON.value['time_of_year']
}
if (mushJSON.value['native_or_introduced']) {
if (mushJSON.value['native_or_introduced'] == true) {
native.value = "Native"
native.value = mushJSON.value('native')
/* if (mushJSON.value['native_or_introduced'] == true) {
native.value ="Native"
} else {
native.value = "Introduced"
}
} */
}
if (mushJSON.value['photos']) {
photos.value = mushJSON.value['photos'].join(', ')
Expand Down
10 changes: 5 additions & 5 deletions components/formset_cap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,31 @@
<option value="black">Black</option>
</select>

<label for="mush_cap_diameter_min">Min Diameter (mm)</label>
<label for="mush_cap_diameter_min">Min Diameter (cm)</label>
<input
type="text"
id="mush_cap_diameter_min"
class="form-input"
v-model="capDiaMin"
@change="addMushKey('cap_features', parseInt(capDiaMin), 'diameter_min')" />

<label for="mush_cap_diameter_max">Max Diameter (mm)</label>
<label for="mush_cap_diameter_max">Max Diameter (cm)</label>
<input
type="text"
id="mush_cap_diameter_max"
class="form-input"
v-model="capDiaMax"
@change="addMushKey('cap_features', parseInt(capDiaMax), 'diameter_max')" />

<label for="mush_cap_thickness_min">Min Thickness (mm)</label>
<label for="mush_cap_thickness_min">Min Thickness (cm)</label>
<input
type="text"
id="mush_cap_thickness_min"
class="form-input"
v-model="capThcMin"
@change="addMushKey('cap_features', parseInt(capThcMin), 'thickness_min')" />

<label for="mush_cap_thickness_max">Max Thickness (mm)</label>
<label for="mush_cap_thickness_max">Max Thickness (cm)</label>
<input
type="text"
id="mush_cap_thickness_max"
Expand Down Expand Up @@ -118,7 +118,7 @@ const capTexture = ref("")
const capShape = ref("")
const addMushKey = (key, val, subKey = "") => {
if (["stipe_features", "hymenium", "cap_features"].includes(key) && subKey != "") {
if (["stipe_features", "gills", "cap_features"].includes(key) && subKey != "") {
mushJSON.value[key][subKey] = val;
} else {
mushJSON.value[key] = val;
Expand Down
30 changes: 15 additions & 15 deletions components/formset_hymenium.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
id="mush_gills_desc"
class="form-input"
v-model="hymeniumDescription"
@change="addMushKey('hymenium', hymeniumDescription, 'description')" />
@change="addMushKey('gills', hymeniumDescription, 'description')" />

<!-- <label for="mush_gills_type">Type</label>
<input
Expand All @@ -23,7 +23,7 @@
name="mush_gills_colour"
class="form-input h-24"
v-model="hymeniumColour"
@change="addMushKey('hymenium', hymeniumColour, 'colour')"
@change="addMushKey('gills', hymeniumColour, 'colour')"
multiple>
<option value="white">White</option>
<option value="tan">Tan</option>
Expand Down Expand Up @@ -57,7 +57,7 @@
id="mush_gills_attach"
class="form-input"
v-model="hymeniumAttachment"
@change="addMushKey('hymenium', hymeniumAttachment, 'attachment')">
@change="addMushKey('gills', hymeniumAttachment, 'attachment')">
<option value="none">None</option>
<option value="adnate">Adnate</option>
<option value="adnexed">Adnexed</option>
Expand All @@ -75,7 +75,7 @@
name="mush_spore_colour"
class="form-input"
v-model="hymeniumSporeColour"
@change="addMushKey('hymenium', hymeniumSporeColour, 'spore_colour')">
@change="addMushKey('gills', hymeniumSporeColour, 'spore_colour')">
<option value="white">White</option>
<option value="black">Black</option>
<option value="purple brown">Purple Brown</option>
Expand All @@ -95,28 +95,28 @@ const hymeniumAttachment = ref("")
const hymeniumSporeColour = ref("")
const addMushKey = (key, val, subKey = "") => {
if (["stipe_features", "hymenium", "cap_features"].includes(key) && subKey != "") {
if (["stipe_features", "gills", "cap_features"].includes(key) && subKey != "") {
mushJSON.value[key][subKey] = val;
} else {
mushJSON.value[key] = val;
}
}
watch(mushJSON, async (newMushJSON, oldMushJSON) => {
if (mushJSON.value['hymenium']['description']) {
hymeniumDescription.value = mushJSON.value['hymenium']['description']
if (mushJSON.value['gills']['description']) {
hymeniumDescription.value = mushJSON.value['gills']['description']
}
if (mushJSON.value['hymenium']['type']) {
hymeniumType.value = mushJSON.value['hymenium']['type']
if (mushJSON.value['gills']['type']) {
hymeniumType.value = mushJSON.value['gills']['type']
}
if (mushJSON.value['hymenium']['colour']) {
hymeniumColour.value = mushJSON.value['hymenium']['colour']
if (mushJSON.value['gills']['colour']) {
hymeniumColour.value = mushJSON.value['gills']['colour']
}
if (mushJSON.value['hymenium']['attachment']) {
hymeniumAttachment.value = mushJSON.value['hymenium']['attachment']
if (mushJSON.value['gills']['attachment']) {
hymeniumAttachment.value = mushJSON.value['gills']['attachment']
}
if (mushJSON.value['hymenium']['spore_colour']) {
hymeniumSporeColour.value = mushJSON.value['hymenium']['spore_colour']
if (mushJSON.value['gills']['spore_colour']) {
hymeniumSporeColour.value = mushJSON.value['gills']['spore_colour']
}
})
</script>
20 changes: 10 additions & 10 deletions components/formset_stipe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
v-model="stipeDescription"
@change="addMushKey('stipe_features', stipeDescription, 'description')" />

<label for="mush_stipe_diameter_min">Min Diameter (mm)</label>
<label for="mush_stipe_diameter_min">Min Diameter (cm)</label>
<input
type="text"
id="mush_stipe_diameter_min"
class="form-input"
v-model="stipeDiaMin"
@change="addMushKey('stipe_features', parseInt(stipeDiaMin), 'diameter_min')" />

<label for="mush_stipe_diameter_max">Max Diameter (mm)</label>
<label for="mush_stipe_diameter_max">Max Diameter (cm)</label>
<input
type="text"
id="mush_stipe_diameter_max"
Expand Down Expand Up @@ -59,15 +59,15 @@
<option value="black">Black</option>
</select>

<label for="mush_stipe_length_min">Min Length (mm)</label>
<label for="mush_stipe_length_min">Min Length (cm)</label>
<input
type="text"
id="mush_stipe_length_min"
class="form-input"
v-model="stipeLenMin"
@change="addMushKey('stipe_features', parseInt(stipeLenMin), 'length_min')" />

<label for="mush_stipe_length_max">Max Length (mm)</label>
<label for="mush_stipe_length_max">Max Length (cm)</label>
<input
type="text"
id="mush_stipe_length_max"
Expand Down Expand Up @@ -102,17 +102,17 @@
<option value="blueish">Blueish</option>
</select>

<label for="mush_stipe_attachment">Attachment</label>
<label for="mush_stipe_attachment">Type</label>
<select
type="text"
id="mush_stipe_attachment"
class="form-input"
v-model="stipeattachment"
@change="addMushKey('stipe_features', stipeattachment, 'attachment')">
@change="addMushKey('stipe_features', stipeattachment, 'type')">
<option value="bare">Bare</option>
<option value="ring">Ring</option>
<option value="volva">Volva</option>
<option value="both">Both</option>
<option value="ring volva">Both</option>
</select>
</fieldset>
</template>
Expand All @@ -132,7 +132,7 @@ const stipeBruiseColour = ref("")
const stipeattachment = ref("")
const addMushKey = (key, val, subKey = "") => {
if (["stipe_features", "hymenium", "cap_features"].includes(key) && subKey != "") {
if (["stipe_features", "gills", "cap_features"].includes(key) && subKey != "") {
mushJSON.value[key][subKey] = val;
} else {
mushJSON.value[key] = val;
Expand Down Expand Up @@ -167,8 +167,8 @@ watch(mushJSON, async (newMushJSON, oldMushJSON) => {
if (mushJSON.value['stipe_features']['bruising_colour']) {
stipeBruiseColour.value = mushJSON.value['stipe_features']['bruising_colour']
}
if (mushJSON.value['stipe_features']['attachment']) {
stipeattachment.value = mushJSON.value['stipe_features']['attachment']
if (mushJSON.value['stipe_features']['type']) {
stipeattachment.value = mushJSON.value['stipe_features']['type']
}
})
</script>
2 changes: 1 addition & 1 deletion components/formset_tags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const mushJSON = useState('mushJSON')
const tags = ref([])
const addMushKey = (key, val, subKey = "") => {
if (["stipe_features", "hymenium", "cap_features"].includes(key) && subKey != "") {
if (["stipe_features", "gills", "cap_features"].includes(key) && subKey != "") {
mushJSON.value[key][subKey] = val;
} else {
mushJSON.value[key] = val;
Expand Down

0 comments on commit 4af23ae

Please sign in to comment.