Skip to content

Instantly share code, notes, and snippets.

@bangpound
Created May 31, 2016 16:16
Show Gist options
  • Save bangpound/7eb867f34c81fe44bda1a427ee7d2189 to your computer and use it in GitHub Desktop.
Save bangpound/7eb867f34c81fe44bda1a427ee7d2189 to your computer and use it in GitHub Desktop.
diff --git a/src/app/controllers/accounts.controller.js b/src/app/controllers/accounts.controller.js
index 223be0e..b720462 100644
--- a/src/app/controllers/accounts.controller.js
+++ b/src/app/controllers/accounts.controller.js
@@ -10,6 +10,15 @@ export class AccountsController {
this.HateoasResource = HateoasResource;
this.$scope = $scope;
this.$state = $state;
+ this.period = 'P1M';
+ this.schedules = [
+ { id: 'P1W', name: 'Weekly' },
+ { id: 'P2W', name: 'Biweekly' },
+ { id: 'P15D', name: 'Semimonthly' },
+ { id: 'P1M', name: 'Monthly' },
+ { id: 'P4M', name: 'Quarterly' },
+ { id: 'P1Y', name: 'Yearly' }
+ ];
this.progressType = this.accountType === ACCOUNT_TYPES.saving ? 'success' : 'danger';
diff --git a/src/app/filters/moneyPeriod.filter.js b/src/app/filters/moneyPeriod.filter.js
index eecf40a..de196af 100644
--- a/src/app/filters/moneyPeriod.filter.js
+++ b/src/app/filters/moneyPeriod.filter.js
@@ -1,6 +1,6 @@
angular
.module('bmmFilter')
- .filter('moneyPeriod', (moment)=> {
+ .filter('moneyPeriod', (moment) => {
'ngInject';
return (input, originalDuration, newDuration) => {
let originalMonths = moment.duration(originalDuration).asMonths();
diff --git a/src/app/style/sass/content/_accounts.scss b/src/app/style/sass/content/_accounts.scss
index 9d0c08a..944d0bc 100644
--- a/src/app/style/sass/content/_accounts.scss
+++ b/src/app/style/sass/content/_accounts.scss
@@ -69,7 +69,9 @@
.table-spacing {
- width: 22%;
+ width: 24%;
+ padding-left: 3rem;
+ padding-right: 3rem;
}
#account-time-views {
diff --git a/src/app/views/accountFormEdit.html b/src/app/views/accountFormEdit.html
index 90e5cad..aad91b1 100644
--- a/src/app/views/accountFormEdit.html
+++ b/src/app/views/accountFormEdit.html
@@ -2,7 +2,7 @@
<button type="button" class="close" ng-click="accountForm.close()">
<i class="fa fa-times"></i>
</button>
- <h4 class="modal-title">{{ accountForm.currentAccount.category }}</h4>
+ <h4 class="modal-title" ng-repeat="category in accountForm.categories | filter: { id: accountForm.currentAccount.category }">{{ category.name }}</h4>
</div>
<div class="modal-body">
<form name="form" ng-if="accountForm.currentAccount.category">
diff --git a/src/app/views/accounts.html b/src/app/views/accounts.html
index 31f8e84..35ee1ed 100644
--- a/src/app/views/accounts.html
+++ b/src/app/views/accounts.html
@@ -59,14 +59,10 @@
</div>
<div class="dropdown" uib-dropdown>
<button id="account-time-views" type="button" class="btn btn-block btn-lg dropdown-toggle" uib-dropdown-toggle>
- Bi-weekly <i class="fa fa-arrow-down"></i>
+ <span ng-repeat="selected in accounts.schedules | filter: { id: accounts.period }">{{ selected.name }}</span> <i class="fa fa-arrow-down"></i>
</button>
<ul class="dropdown-menu" uib-dropdown-menu role="menu" aria-labelledby="account-time-views">
- <li role="menuitem"><a href="#">Semi-Monthly</a></li>
- <li role="menuitem"><a href="#">Monthly</a></li>
- <li role="menuitem"><a href="#">Quarterly</a></li>
- <li role="menuitem"><a href="#">Semi-Annually</a></li>
- <li role="menuitem"><a href="#">Annually</a></li>
+ <li role="menuitem" ng-repeat="value in accounts.schedules"><a ng-click="accounts.period = value.id">{{ value.name }}</a></li>
</ul>
</div>
</div>
@@ -78,7 +74,7 @@
<table class="accounts-table">
<thead>
<tr>
- <th>Account Name</th>
+ <th class="table-spacing">Account Name</th>
<th class="table-spacing heading-dollar-align">Balance</th>
<th class="table-spacing heading-dollar-align" ng-if="accounts.viewingCurrentMonth()">{{ accounts.accountType === accounts.ACCOUNT_TYPES.saving ? 'Ongoing Contribution' : 'Ongoing Payment' }}</th>
<th class="table-spacing heading-dollar-align" ng-if="accounts.currentMonth > accounts.viewedMonth">{{ accounts.accountType === accounts.ACCOUNT_TYPES.saving ? 'Month Saved' : 'Payment' }}</th>
@@ -95,7 +91,7 @@
<span ng-if="!accounts.getViewedLedger(account)">--</span>
</td>
<td class="table-spacing dollar-align">
- {{ accounts.getViewedLedger(account).amount_submitted | absoluteValue | currency : '$' : 0 }}
+ {{ accounts.getViewedLedger(account).amount_submitted | moneyPeriod : account.schedule : accounts.period | absoluteValue | currency : '$' : 0 }}
<span ng-if="!accounts.getViewedLedger(account)">--</span>
</td>
<td class="table-spacing dollar-align" ng-if="accounts.accountType == accounts.ACCOUNT_TYPES.saving">{{ account.goal | currency : '$' : 0 }}</td>
diff --git a/src/app/views/createAccountForm.html b/src/app/views/createAccountForm.html
index a7ea9b0..ac2e463 100644
--- a/src/app/views/createAccountForm.html
+++ b/src/app/views/createAccountForm.html
@@ -24,7 +24,10 @@
</div>
<div class="form-group">
<label for="interestRate">Interest Rate</label>
- <input type="number" class="form-control" id="interestRate" step="any" ng-model="accountForm.currentAccount.interest_rate" min="0" required />
+ <div class="input-group">
+ <input type="number" class="form-control" id="interestRate" ng-model="accountForm.currentAccount.interest_rate" min="0" max="100" step=".1" required />
+ <span class="input-group-addon">%</span>
+ </div>
</div>
<div class="form-group text-right">
<button class="account-form btn btn-primary" type="submit" ng-click="accountForm.save()" ng-disabled="form.$invalid">Add</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment