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; + } + }); } };