Skip to content

Commit da9979d

Browse files
author
Prashanth Batchu
committed
simple split functional. Now changing group updates the simple screen beautifully. Next step is to bind the total to ind. splits and finish the simple add submit
1 parent 2898345 commit da9979d

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

billrive-client/app/js/controllers.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ billRive.controller('billController', function($scope, billService) {
1212
$scope.addBill = function() {
1313

1414
};
15+
//console.log( $scope.friends);
1516

16-
$scope.setBillGroup = function(id) {
17+
$scope.setBillGroup = function() {
1718
// console.log(id);
1819
var $groupId = $scope.bill.groupId;
1920

@@ -25,15 +26,28 @@ billRive.controller('billController', function($scope, billService) {
2526
$groupMembers = obj.users;
2627
}
2728
}
28-
var $groupUserAndLiableCost=[];
29-
for (var i = 0; i < $groupMembers.length; i++) {
30-
$groupUserAndLiableCost.push({userId:$groupMembers[i],liableCost:null});
29+
var $groupUserAndLiableCost = [];
30+
console.log($scope.friends[0].id);
31+
var $friendNamefromId = null;
32+
for (i = 0; i < $groupMembers.length; i++) {
33+
34+
for (var j = 0; j < $scope.friends.length; j++) {
35+
36+
//
37+
if ($scope.friends[j].id == $groupMembers[i])
38+
{
39+
$friendNamefromId = $scope.friends[j].name;
40+
}
41+
//
42+
}
43+
$groupUserAndLiableCost.push({userId: $groupMembers[i], liableCost: null, name: $friendNamefromId});
3144
}
32-
33-
console.log($groupUserAndLiableCost);
45+
46+
//console.log($groupUserAndLiableCost);
3447
// for(var i=0;i<)
3548
// var $userAndLiableCost=
36-
$scope.bill.billFinances.billItemEntry=$groupUserAndLiableCost;
49+
$scope.bill.billFinances.billItemEntry = $groupUserAndLiableCost;
50+
$groupUserAndLiableCost = [];
3751
//$scope.bill.billFinances.billItemEntry.push($groupUserAndLiableCost);
3852
//console.log($userAndLiableCost);
3953
};

billrive-client/app/partials/addBill/simple.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<div class="span3">
1111
<input type="checkbox" ng-model="todo.done"/>
12-
{{user.userId}}
12+
{{user.name}}
1313
</div>
1414
<div class="span3">
1515
<input type="text" ng-model='user.liableCost' class="span6" placeholder="5.00" />

0 commit comments

Comments
 (0)