Skip to content

Commit 6b31b3c

Browse files
author
Prashanth Batchu
committed
working on enable/disable simple bill users based on the corresponding input checkbox.
1 parent 6c7222d commit 6b31b3c

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

billrive-client/app/css/app.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,7 @@ body {
6565
min-height: 500px;
6666
}
6767

68+
.done-true {
69+
text-decoration: line-through;
70+
color: grey;
71+
}

billrive-client/app/js/controllers.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,19 @@ billRive.controller('billController', function($scope, billService) {
2828
if ($scope.friends[j].id == $groupMembers[i])
2929
$friendNamefromId = $scope.friends[j].name;
3030
}
31-
$groupUserAndLiableCost.push({userId: $groupMembers[i], liableCost: null, name: $friendNamefromId});
31+
$groupUserAndLiableCost.push({userId: $groupMembers[i], liableCost: null, name: $friendNamefromId,enabled:true});
3232
}
3333
$scope.bill.billFinances.billSimpleTotals.userIdAndLiableCost = $groupUserAndLiableCost;
3434
$groupUserAndLiableCost = [];
35-
35+
$scope.simpleCalculatedTotal=0;
3636
};
3737

3838
$scope.calculateSimpleSum=function(){
3939

4040
$scope.simpleCalculatedTotal=0;
4141
for (i = 0; i < $scope.bill.billFinances.billSimpleTotals.userIdAndLiableCost.length; i++) {
42-
$scope.simpleCalculatedTotal+= parseInt($scope.bill.billFinances.billSimpleTotals.userIdAndLiableCost[i].liableCost);
42+
if($scope.bill.billFinances.billSimpleTotals.userIdAndLiableCost[i].liableCost!=null)
43+
$scope.simpleCalculatedTotal+= parseInt($scope.bill.billFinances.billSimpleTotals.userIdAndLiableCost[i].liableCost);
4344
}
4445

4546

billrive-client/app/partials/addBill.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@
6262
</div>
6363
</div>
6464
</div>
65-
{{bill}}
65+
<!--{{bill}}-->
6666

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
<div class="row-fluid">
66

77
<div class="span3">
8-
<input type="checkbox" ng-model="todo.done"/>
9-
{{user.name}}
8+
<input type="checkbox" ng-model="user.enabled" />
9+
<span class="done-{{!user.enabled}}"> {{user.name}}</span>
1010
</div>
1111
<div class="span3">
12-
<input ng-change='calculateSimpleSum()' type="text" ng-model='user.liableCost' class="span6" placeholder="0.00" />
12+
<input ng-required='user.enabled' ng-disabled="!user.enabled" ng-change='calculateSimpleSum()' type="text" ng-model='user.liableCost' class="span6" placeholder="0.00" />
1313
</div>
1414
</div>
1515
</li>
@@ -23,7 +23,7 @@
2323

2424
<div class="span3">
2525

26-
Calculated Total
26+
Calculated Total
2727
</div>
2828
<div class="span3">
2929
<input type="text" disabled ng-model='simpleCalculatedTotal' class="span6" placeholder="0.00" />

0 commit comments

Comments
 (0)