Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- Created for a project by Aaron Everitt -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<div ng-app="myApp" ng-controller="myController">
    <table>
        <tr>
            <th>Camp Fees</th>
            <th>Number of Campers</th>
            <th>Rates</th>
            <th>Totals</th>
        </tr>
        <tr ng-repeat="event in events">
            <td>{{event.name}}</td>
            <td><input placeholder="0" class="qty" type="number" ng-model="quantity" min="0" ng-change="recalc(event, quantity)" restrict-to="[0-9]" />
</td>
<td>{{event.cost | currency : $}}</td>
<td class="subTotal" placeholder="$0.00">{{ quantity*event.cost | currency : $}}</td>
</tr>
</table>
<div>
<!-- <h2 class="price-right">Camp Fee Total : {{GrandTotal | currency : $}}</h2> -->
<!--Creates a max amount of $2,860-->
<!-- <h2 class="price-right">Camp Fee Total : <div class="float-right" ng-if="GrandTotal <= maxAmount">
     {{GrandTotal | currency : $}}
  </div>
  <div class="float-right" ng-if="GrandTotal >= maxAmount">
     {{maxAmount | currency : $}}
  </div></h2> -->
<h2 class="price-right">Camp Fee Total :&nbsp;<div class="float-right" ng-if="GrandTotal <= maxAmount">
     {{GrandTotal | currency : $}}
  </div>
  <div class="float-right red" style="text-decoration: line-through;" ng-if="GrandTotal >= maxAmount">
    {{GrandTotal | currency : $}}
  </div>
  <br>
  <div class="float-right" ng-if="GrandTotal >= maxAmount">Final Camp Fee Total :&nbsp;{{maxAmount | currency : $}}
  </div>
 </h2>
  <br>
  <div class="alert-text" ng-if="GrandTotal >= maxAmount">{{bar}}
  </div>
 <br>
<div ng-controller="myControllerTwo">
    <table>
        <tr>
            <th>Accommodation Fees</th>
            <th>Rooms Needed</th>
            <th>Rates</th>
            <th>Totals</th>
        </tr>
        <tr ng-repeat="eventTwo in eventsTwo" class="accommodation-table">
            <td>{{eventTwo.nameTwo}}</td>
            <td><input placeholder="0" class="qty" type="number" ng-model="quantityTwo" min="0" ng-change="recalcTwo(eventTwo, quantityTwo)" restrict-to="[0-9]" /></td>
            <td>{{eventTwo.costTwo | currency : $}}</td>
            <td class="subTotal">{{ quantityTwo*eventTwo.costTwo | currency : $}}</td>
        </tr>
    </table>
    <div>
        <h2 class="price-right">Accommodation Fee Total : {{GrandTotalTwo | currency : $}}</h2>
    </div>

<div>
  
  <h2 class="price-right final-sum">Total Sum :&nbsp;<div class="float-right" ng-if="GrandTotal <= maxAmount">
     {{GrandTotal*1 + GrandTotalTwo*1 | currency : $}}
  </div>
  <div class="float-right" ng-if="GrandTotal >= maxAmount">
     {{maxAmount*1 + GrandTotalTwo*1 | currency : $}}</div></h2>
  
<!--   <h2 class="price-right final-sum">Total Sum : {{GrandTotal*1 + GrandTotalTwo*1 | currency : $}}</h2> -->
</div>
</div>
              
            
!

CSS

              
                body{
  width:40%;
  margin: 0;
}

/*Disables input field for "Hotel Style Rooms" Row*/
.accommodation-table:nth-child(2) > td:nth-child(2) > input {
	display: none;
}

.red {
  color: rgb(140, 61, 22);
}

.alert-text {
	font-size: 1.2em;
	padding-left: 5%;
	padding-right: 5%;
	color: rgb(140, 61, 22);
  font-family: 'Open Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/*Disables Rates field for "Hotel Style Rooms" Row*/
.accommodation-table:nth-child(2) > td:nth-child(3) {
	opacity: 0;
}

/*Styles for First Row on both Tables*/
table > tbody > tr:nth-child(1),
table > tbody > tr:nth-child(1) {
		background-color: #4A8E1E;
		font-family: "Lato", Times, serif;
		font-size: 20px;
		font-weight: bold;
}

tr,td,th{
	border-right: 1px solid rgba(255, 255, 255, 0.5);/*#999999;*/
	padding: 10px 10px;
	font-family: "Lato", Times, serif;
	font-size: 1.1em !important;
	color: #003C04;
	-webkit-transition: all 0.25s ease-in-out;
	-moz-transition: all 0.25s ease-in-out;
	-ms-transition: all 0.25s ease-in-out;
	-o-transition: all 0.25s ease-in-out;
	transition: all 0.25s ease-in-out;
	vertical-align: middle;
  	width: 25%;  
  	text-align: center;
}

tr > th {
	color: #fff !important;
}

.final-sum {
  background-color: rgba(74, 142, 30, 0.8);
  padding: 1% 1% 1% 1%;
  color: #fff;
}

.float-right {
  float: right;
  
}

/*Aligns Fees Total to the right*/
.price-right {
	text-align: right !important;
  font-family: 'Open Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

table > tbody > tr:nth-child(2), /*Row 2 background color*/
table > tbody > tr:nth-child(4) /*Row 4 background color*/
 {
	background-color: rgba(74, 142, 30, 0.1);
}


table > tbody > tr:nth-child(3), /*Row 3 background color*/
table > tbody > tr:nth-child(5) /*Row 5 background color*/
{
	background-color: rgba(74, 142, 30, 0.2);
}

/* div.divTableRow:hover {
	background-color: rgba(74, 142, 30, 0.8);
	color: #fff;
} */

::placeholder {
	opacity: 0.4;
}

input.qty {
  display: flex;
  flex-direction: column;
  position: relative;
  margin: auto;
}

input {
  border: 1px solid #003C04;
  height: 35px;
  font-size: 1.1em !important;
  padding-left: 10px;
  border-radius: 5px;
  transition: ease-out 0.2s;
  border: 1px solid #9e9e9e;
}

input:focus {
/*  outline: none;*/
}

input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    margin: 0; 
}
              
            
!

JS

              
                (function() {
    var myApp = angular.module("myApp", []);
    myApp.controller("myController", ["$scope", myController]);
    var events = [{
        name: "Adults",
        cost: 485,
        itemTotal: 0
    }, {
        name: "Kids 13-18",
        cost: 394,
        itemTotal: 0
    }, {
        name: "Kids 4-12",
        cost: 307,
        itemTotal: 0
    }, {
        name: "Kids 0-3",
        cost: 100,
        itemTotal: 0
    }];

    function myController($scope) {
        $scope.events = events;
        $scope.recalc = function(item, quantity) {
            item.itemTotal = quantity * item.cost;
            $scope.GrandTotal = 0;
            $scope.maxAmount = 2860;
            $scope.bar = "The maximum camp fees for a Family Camp is $2,860, regardless of the number of campers. (not including accommodation prices)";
            var sum = 0;
            angular.forEach($scope.events, function(event) {
                $scope.GrandTotal = $scope.GrandTotal + event.itemTotal;
                $scope.GrandTotal == NaN ? "custom msg" : $scope.GrandTotal;
                // console.log($scope.GrandTotal);
            })

        };
    }
    myApp.controller("myControllerTwo", ["$scope", myControllerTwo]);
    var eventsTwo = [{
        nameTwo: "Hotel Style Rooms:",
        costTwo: 535, //Not relevant info (display: none in css - line:745)
        itemTotalTwo: 0 //Not relevant info (display: none in css - line:745)

    }, {
        nameTwo: "First Room",
        costTwo: 535,
        itemTotalTwo: 0
    }, {
        nameTwo: "Additional Room(s)",
        costTwo: 445,
        itemTotalTwo: 0
    }, {
        nameTwo: "RV Sites",
        costTwo: 175,
        itemTotalTwo: 0
    }];

    function myControllerTwo($scope) {
        $scope.eventsTwo = eventsTwo;
        $scope.recalcTwo = function(item, quantityTwo) {
            item.itemTotalTwo = quantityTwo * item.costTwo;
            $scope.GrandTotalTwo = 0;
            var sumTwo = 0;
            angular.forEach($scope.eventsTwo, function(eventTwo) {
                $scope.GrandTotalTwo = $scope.GrandTotalTwo + eventTwo.itemTotalTwo;

                $scope.GrandTotalTwo == NaN ? "custom msg" : $scope.GrandTotalTwo;
                // console.log($scope.GrandTotal);
            })

        };
    }
})();
              
            
!
999px

Console