A Pen by Jake Bennett on CodePen.
Created
September 14, 2016 02:00
-
-
Save JacobBennett/8467796d23a3d885228866b26d233b53 to your computer and use it in GitHub Desktop.
Tuition Calculator
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
<div id="app"> | |
<div class="container" style="margin-top: 3em"> | |
<div class="row"> | |
<div class="col-md-6 col-md-offset-3"> | |
<div class="panel panel-default"> | |
<div class="panel-heading"> | |
<h4>Add Student</h4> | |
</div> | |
<div class="panel-body"> | |
<div class="form-group"> | |
<label for="grade">Student Grade</label> | |
<select class="form-control" v-model="student.grade"> | |
<option value="">Please Select a Grade</option> | |
<option v-for="grade in grades" v-bind:value="grade.value"> | |
{{ grade.text }} | |
</option> | |
</select> | |
</div> | |
<div class="form-group"> | |
<label for="returning"> | |
<input type="checkbox" v-model="student.returning" checked/> | |
Returning Student | |
</label> | |
</div> | |
<button @click="add" class="btn btn-primary">Add Student</button> | |
</div> | |
</div> | |
<div class="panel panel-default" v-for="student in students"> | |
<div class="panel-heading"> | |
<h5>{{student.grade}} <small>{{student.returning}}</small></h5> | |
</div> | |
</div> | |
<pre>{{student | json}}</pre> | |
<pre>{{students | json}}</pre> | |
</div> | |
</div> | |
</div> | |
</div> |
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
new Vue({ | |
el: "#app", | |
data: { | |
student: { | |
grade: "", | |
returning: true, | |
}, | |
students: [], | |
grades: [ | |
{ text: "K3 - K4", value: 1}, | |
{ text: "K5", value: 2}, | |
{ text: "Elementary (1st - 5th)", value: 3}, | |
{ text: "Junior High (6th - 8th)", value: 4}, | |
{ text: "High School (9th - 12th)", value: 5} | |
], | |
registration: { | |
returning: "200", | |
new: "275", | |
}, | |
comprehensive: [ | |
"100", | |
"200", | |
"300", | |
"400", | |
] | |
}, | |
methods: { | |
add: function() { | |
console.log(this.student); | |
this.students.push({ | |
grade: this.student.grade, | |
returning: this.student.returning | |
}); | |
this.student.grade = ""; | |
this.student.returning = true; | |
} | |
} | |
}); | |
// Tuition for each grade level across the board | |
// factor in multi student discounts based on number of students in K5 - 12th | |
// Building fee of $250 regardless | |
// Registration fee per student based on if new or returning | |
// Comprehensive fee based on grade level | |
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
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.26/vue.js"></script> |
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
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment