From 6223eb7fc19cdc7ffc1cf8d7b2e6da5f96831fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Maur=C3=ADcio?= Date: Tue, 29 Apr 2014 15:01:53 +0000 Subject: [PATCH] git-svn-id: https://svn.coded.pt/svn/SIPRP@1876 bb69d46d-e84e-40c8-a05a-06db0d633741 --- .../static/html/app/Form2/Form2Controller.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Form2/Form2Controller.js b/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Form2/Form2Controller.js index cc2b2979..c33f1c98 100644 --- a/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Form2/Form2Controller.js +++ b/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Form2/Form2Controller.js @@ -4,6 +4,17 @@ $scope.descricao = null; + $scope.calculatedAge = 0; + + $scope.storeFichasClinicas = new globals.dataService.store({ + model: null, + actions: { + get: 'getFichaEAdmissaoInicial', + upsert: 'sendFichaEAdmissaoInicial',//TODO: ??? + destroy: 'deleteFichaEAdmissaoInicial'//TODO: ??? + } + }); + $scope.add = function(selected){ $scope.editForm.$reset(); @@ -17,7 +28,16 @@ $scope.editForm.$reset(); + $scope.storeFichasClinicas.extraParams = { + fichaID: selected.id + }; + + $scope.storeFichasClinicas.get(function(response, status, headers, config, items){ + + $scope.selected = items; + $scope.editing = angular.copy($scope.selected); + }); }, 0); }; @@ -37,7 +57,14 @@ $scope.editing.ficha.data_conclusao = null; } + $scope.storeFichasClinicas.upsert($scope.selected, $scope.editing, function(response, selected, editing, isNewRecord){ + //TODO: check the need for other keys!!! + if(response.data) + { + $scope.editing.ficha.id = response.data.ficha.id; + } + }); } };