forked from GeekTrainer/learn-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request GeekTrainer#2 from SkillUpTech/main
merge from main
- Loading branch information
Showing
33 changed files
with
497 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<template> | ||
<div class="componentBox"> | ||
<h3 style="text-align:center;">Food Preferences</h3> | ||
<p style="text-align:center;"> | ||
<strong>Room Service Fee</strong>{{ roomService }}</p> | ||
<p>Please fill out this form to let us know your food preferences.</p> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
//TODO: Add berth prop | ||
props: { | ||
berth: { | ||
type: Boolean, | ||
required: true, | ||
}, | ||
}, | ||
//TODO: Add computed property | ||
computed: { | ||
roomService() { | ||
if (this.berth) { | ||
return `: No charge`; | ||
} | ||
return `: $24.99`; | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style> | ||
/* styles can be included*/ | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<template> | ||
<!-- TODO: Add <form> element below last <p> tag --> | ||
<div class="componentBox"> | ||
<h3 style="text-align:center;">Food Preferences</h3> | ||
<p style="text-align:center;"><strong>Room Service Fee</strong>{{ roomService }}</p> | ||
<p>Please fill out this form to let us know your food preferences.</p> | ||
|
||
<form @submit.prevent="onSubmit"> | ||
<h4>Submit food preferences</h4> | ||
<label for="passenger">Passenger name:</label> | ||
<input id="passenger" v-model="passenger"> | ||
|
||
<br> | ||
<label for="allergies">Do you have food allergies? </label> | ||
<select id="allergies" v-model.number="allergies"> | ||
<option>Yes</option> | ||
<option>No</option> | ||
</select> | ||
|
||
<br> | ||
<label for="allergydesc">Describe allergies: (enter "None" if not applicable)</label> | ||
<textarea id="allergydesc" v-model="allergydesc"></textarea> | ||
|
||
<label for="glutenfree">Gluten-free? </label> | ||
<select id="glutenfree" v-model.number="glutenfree"> | ||
<option>Yes</option> | ||
<option>No</option> | ||
</select> | ||
|
||
<br><br> | ||
<label for="vegan">Vegan? </label> | ||
<select id="vegan" v-model="vegan"> | ||
<option>Yes</option> | ||
<option>No</option> | ||
</select> | ||
|
||
<br> | ||
<input class="button" type="submit" value="Submit"> | ||
|
||
</form> | ||
</div> | ||
</template> | ||
<script> | ||
export default { | ||
props: { | ||
berth: { | ||
type: Boolean, | ||
required: true, | ||
} | ||
} | ||
} | ||
</script> | ||
/* TODO: Add form data properties and methods */ | ||
data() { | ||
return { | ||
passenger: '', | ||
allergies: '', | ||
allergydesc: '', | ||
glutenfree: '', | ||
vegan: '', | ||
} | ||
}, | ||
/* TODO: Add methods */ | ||
methods: { | ||
onSubmit() { | ||
if (this.passenger === '' || this.allergies === '' || this.allergydesc === '' || this.glutenfree === '' || this.vegan === '') { | ||
alert('Form is incomplete. Please fill out every field.') | ||
return | ||
} | ||
|
||
let foodprefanswers = { | ||
passenger: this.passenger, | ||
allergies: this.allergies, | ||
allergydesc: this.allergydesc, | ||
glutenfree: this.glutenfree, | ||
vegan: this.vegan, | ||
} | ||
|
||
this.$emit('foodpref-submitted', foodprefanswers); | ||
|
||
this.passenger = ''; | ||
this.allergies = ''; | ||
this.allergydesc = ''; | ||
this.glutenfree = ''; | ||
this.vegan = ''; | ||
|
||
}, | ||
}, | ||
computed: { | ||
roomService() { | ||
if (this.berth) { | ||
return `: No charge`; | ||
} | ||
return `: $24.99`; | ||
} | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.