Commits

Dan Connolly committed 36197a1

begin to format results of OFXImport.prepare()

Comments (0)

Files changed (2)

finquick/static/accounts.html

     <button ng-click='execute()' ng-disabled='true'
 	    >Execute</button>
 
-    <pre>{{prepare_out}}</pre>
+    <table><caption>OFX Import</caption>
+      <tr>
+	<th>Financial Institution</th><td>{{ofx_prep.summary.org}}</td>
+      </tr>
+      <tr>
+	<th>Server Date</th><td>{{ofx_prep.summary.dtserver}}</td>
+      </tr>
+    </table>
+    <table>
+    <thead>
+      <tr><th>Date Posted</th><th>Description</th><th>Amount</th></tr>
+    </thead>
+    <tbody>
+      <tr ng-repeat="tx in ofx_prep.transactions">
+	<td>{{tx.dtposted}}</td>
+	<td>{{tx.name}}</td>
+	<td>{{tx.trnamt / 100 | currency }}</td>
+      </tr>
+    </tbody>
+    </table>
     </div>
 
     <hr />

finquick/static/fin.js

 	};
 	reader.onload = function(evt) {
 	    var content = evt.target.result;
-	    var body = JSON.stringify({
+	    var body = angular.toJson({
 		account_guid: $scope.selected_account.guid,
 		ofx_data: content});
 	    console.log('WIN!: ' + content.substr(1, 20));
 
-	    OFXImport.prepare({}, body, function (x) {
+	    OFXImport.prepare({}, body, function (response_body) {
 		console.log('prepare POST success.');
-		$scope.prepare_out = x;
+		var data = angular.fromJson(response_body);
+		console.log('JSON decode:' + Object.keys(data));
+		$scope.$evalAsync(function(s) {
+		    console.log('import prepare evalAsync');
+		    s.ofx_prep = data;
+		});
 	    }, function (x) {
 		console.log('prepare POST failure.');
 	    });