Skip to content

Commit 0545690

Browse files
pbatchupbatchu
authored andcommitted
add/list bills now fully functional
1 parent 77cc518 commit 0545690

File tree

18 files changed

+91
-197
lines changed

18 files changed

+91
-197
lines changed

billrive-client/app/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<script src="js/routes.js"></script>-->
3636

3737
</head>
38-
<body>
38+
<body ng-controller="billController">
3939
<!-- <ul class="menu">
4040
<li><a href="#/bills">bills</a></li>
4141
<li><a href="#/view2">view2</a></li>
@@ -116,8 +116,8 @@
116116
-->
117117

118118
<script src="lib/jquery-2.0.0.js"></script>
119-
<script src="lib/angular/angular.js"></script>
120-
119+
<!--<script src="lib/angular/angular.js"></script>-->
120+
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.js"></script>
121121
<script src="js/app.js"></script>
122122
<script src="js/services.js"></script>
123123
<script src="js/controllers.js"></script>

billrive-client/app/index.jade

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
billRive.controller('billController', function($scope, billService) {
22
$scope.friends = billService.getFriends();
33
$scope.groups = billService.getGroups();
4-
$scope.payers = billService.getPayers();
4+
$scope.payers = billService.getPayers();
5+
$scope.simpleUserCostMap=[];
6+
$scope.bills=[];
7+
// $scope.bill = billService.getBill();
8+
$scope.bill =[];//= billService.getBill();
59

6-
$scope.bill = billService.getBill();
7-
var $userAndLiableCost = billService.getUserAndLiableCost();
8-
9-
$scope.addBill = function() {
10-
11-
};
1210
$scope.setBillGroup = function() {
11+
//console.log('hello');
1312
var $groupId = $scope.bill.groupId;
1413

1514
var $groupMembers;
@@ -30,30 +29,46 @@ billRive.controller('billController', function($scope, billService) {
3029
}
3130
$groupUserAndLiableCost.push({userId: $groupMembers[i], liableCost: null, name: $friendNamefromId,enabled:true});
3231
}
33-
$scope.bill.billFinances.billSimpleTotals.userIdAndLiableCost = $groupUserAndLiableCost;
32+
// $scope.simpleUserCostMap = $groupUserAndLiableCost;
33+
$scope.simpleUserCostMap = $groupUserAndLiableCost;
3434
$groupUserAndLiableCost = [];
3535
$scope.simpleCalculatedTotal=0;
36+
3637
};
3738

3839
$scope.simpleCalculateSum=function(){
3940

4041
$scope.simpleCalculatedTotal=0;
41-
for (i = 0; i < $scope.bill.billFinances.billSimpleTotals.userIdAndLiableCost.length; i++) {
42-
if($scope.bill.billFinances.billSimpleTotals.userIdAndLiableCost[i].liableCost!=null)
43-
$scope.simpleCalculatedTotal+= parseInt($scope.bill.billFinances.billSimpleTotals.userIdAndLiableCost[i].liableCost);
42+
for (i = 0; i < $scope.simpleUserCostMap.length; i++) {
43+
if( $scope.simpleUserCostMap[i].liableCost!=null)
44+
$scope.simpleCalculatedTotal+= parseInt( $scope.simpleUserCostMap[i].liableCost);
4445
}
4546

4647

4748
};
4849
$scope.simpleFriendEnabled=function(){
4950

50-
for (i = 0; i < $scope.bill.billFinances.billSimpleTotals.userIdAndLiableCost.length; i++) {
51-
if($scope.bill.billFinances.billSimpleTotals.userIdAndLiableCost[i].enabled===false)
52-
$scope.bill.billFinances.billSimpleTotals.userIdAndLiableCost[i].liableCost=0;
51+
for (i = 0; i < $scope.simpleUserCostMap.length; i++) {
52+
if( $scope.simpleUserCostMap[i].enabled===false)
53+
$scope.simpleUserCostMap[i].liableCost=0;
5354
}
5455

5556
$scope.simpleCalculateSum();
5657
};
5758

5859
});
5960

61+
billRive.controller('BillListCtrl', function($scope, billService) {
62+
$scope.listBills = function() {
63+
64+
};
65+
});
66+
billRive.controller('BillAddCtrl', function($scope, billService, $location) {
67+
68+
$scope.addBill = function() {
69+
$scope.bills.push($scope.bill);
70+
$scope.bill = [];
71+
// $scope.bill=billService.getBill();
72+
$location.url('/');
73+
};
74+
});

billrive-client/app/js/routes.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
billRive.config(['$routeProvider', function($routeProvider) {
2-
$routeProvider.when('/listBills', {templateUrl: 'partials/listBills.html', controller: 'billController'});
3-
$routeProvider.when('/addBill', {templateUrl: 'partials/addBill.html', controller: 'billController'});
2+
// $routeProvider.when('/', {templateUrl: 'partials/dashboard.html', controller: 'billController'});
3+
$routeProvider.when('/listBills', {templateUrl: 'partials/bills/list.html'});
4+
$routeProvider.when('/addBill', {templateUrl: 'partials/bills/add.html', controller: 'BillAddCtrl'});
5+
$routeProvider.when('/editBill', {templateUrl: 'partials/bills/edit.html', controller: 'BillAddCtrl'});
46
$routeProvider.when('/listFriends', {templateUrl: 'partials/listFriends.html', controller: 'billController'});
57
$routeProvider.otherwise({redirectTo: '/listBills'});
68
}]);

billrive-client/app/js/services.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ billRive.factory('billService',function(){
2222
// ];
2323

2424

25-
var bills = {
26-
"data": [
25+
var bills = [
2726
{
2827
"id": 1,
2928
"title": "Walmart",
@@ -166,7 +165,7 @@ var bills = {
166165
"groupId": 2
167166
}
168167
]
169-
};
168+
;
170169
//Bill Object Structure
171170
//var bill=[{
172171
// "id": null,
@@ -281,4 +280,11 @@ var groupFriendRel=[{groupId:'1',friendId:'5'}];
281280

282281

283282
return factory;
284-
});
283+
});
284+
285+
286+
287+
288+
//$scope.bills= billService.getBills();
289+
//$scope.bills= [{"id":1,"title":"Walmart","date":{"year":2013,"dayOfMonth":3,"dayOfWeek":7,"era":1,"dayOfYear":34,"weekOfWeekyear":5,"minuteOfDay":61,"minuteOfHour":1,"monthOfYear":2,"millisOfSecond":0,"yearOfCentury":13,"secondOfDay":3660,"centuryOfEra":20,"millisOfDay":3660000,"secondOfMinute":0,"weekyear":2013,"hourOfDay":1,"yearOfEra":2013,"zone":{"uncachedZone":{"fixed":false,"cachable":true,"id":"America/Denver"},"fixed":false,"id":"America/Denver"},"millis":1359878460000,"chronology":{"zone":{"uncachedZone":{"fixed":false,"cachable":true,"id":"America/Denver"},"fixed":false,"id":"America/Denver"}},"beforeNow":true,"afterNow":false,"equalNow":false},"billPayerId":2,"notes":"Sample Notes","billFinances":{"billPayerId":1,"billItemEntry":[{"itemDescriptionId":1,"itemDescription":"Canola Oil","userIdAndLiableCost":[{"userId":2,"liableCost":10},{"userId":3,"liableCost":20}]},{"itemDescriptionId":2,"itemDescription":"Taco Bell","userIdAndLiableCost":[{"userId":4,"liableCost":50},{"userId":5,"liableCost":40}]}],"billTotal":30},"groupId":2},{"id":2,"title":"Costco","date":{"year":2014,"dayOfMonth":3,"dayOfWeek":1,"era":1,"dayOfYear":34,"weekOfWeekyear":6,"minuteOfDay":61,"minuteOfHour":1,"monthOfYear":2,"millisOfSecond":0,"yearOfCentury":14,"secondOfDay":3660,"centuryOfEra":20,"millisOfDay":3660000,"secondOfMinute":0,"weekyear":2014,"hourOfDay":1,"yearOfEra":2014,"zone":{"uncachedZone":{"fixed":false,"cachable":true,"id":"America/Denver"},"fixed":false,"id":"America/Denver"},"millis":1391414460000,"chronology":{"zone":{"uncachedZone":{"fixed":false,"cachable":true,"id":"America/Denver"},"fixed":false,"id":"America/Denver"}},"beforeNow":false,"afterNow":true,"equalNow":false},"billPayerId":2,"notes":"Second sample Notes","billFinances":{"billPayerId":2,"billItemEntry":[],"billTotal":90},"groupId":2},{"id":null,"title":"Farmers Market","date":"08/03/1986","billPayerId":"5","notes":"No Note","billFinances":{"billPayerId":null,"billSimpleTotals":{"itemDescriptionId":1,"itemDescription":"Simple","userIdAndLiableCost":[{"userId":2,"liableCost":"30","name":"Kris Stewart","enabled":true},{"userId":5,"liableCost":"30","name":"Gavin Mays","enabled":true}]},"billItemEntry":[],"billTotal":"60"},"groupId":"4"},{"id":null,"title":"Farmers Market","date":"08/03/1986","billPayerId":"5","notes":"No Note","billFinances":{"billPayerId":null,"billSimpleTotals":{"itemDescriptionId":1,"itemDescription":"Simple","userIdAndLiableCost":[{"userId":2,"liableCost":"30","name":"Kris Stewart","enabled":true},{"userId":5,"liableCost":"30","name":"Gavin Mays","enabled":true}]},"billItemEntry":[],"billTotal":"60"},"groupId":"4"}]
290+
;

billrive-client/app/partials/addBill.jade

Lines changed: 0 additions & 37 deletions
This file was deleted.

billrive-client/app/partials/addFriend.html

Lines changed: 0 additions & 14 deletions
This file was deleted.

billrive-client/app/partials/addGroup.html

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
<!--<a class="btn btn-success" href="#/listBills"><i class="icon-th-list icon-white"></i>&nbsp;List Bills</a>-->
3+
4+
<div><h4>New Bill</h4></div>
5+
<div class="row">
6+
<div class="span12">
7+
<div class="row-fluid">
8+
<form ng-submit="addBill()" ng-include="'partials/forms/billAddEdit.html'"></form>
9+
</div>
10+
</div>
11+
</div>
12+
<!--{{bill}}-->
13+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
<!--<a class="btn btn-success" href="#/listBills"><i class="icon-th-list icon-white"></i>&nbsp;List Bills</a>-->
3+
4+
<div><h4>Edit Bill</h4></div>
5+
<div class="row">
6+
<div class="span12">
7+
<div class="row-fluid">
8+
<form ng-submit="editBill()" ng-include="'partials/forms/billAddEdit.html'"></form>
9+
</div>
10+
</div>
11+
</div>
12+
<!--{{bill}}-->
13+

0 commit comments

Comments
 (0)