git-svn-id: https://svn.coded.pt/svn/SIPRP@1972 bb69d46d-e84e-40c8-a05a-06db0d633741

lxbfYeaa
João Maurício 11 years ago
parent 6242a7d54e
commit 13a2fcd041

@ -17,10 +17,8 @@
' <li><a href="#section10">Absentismo</a></li>' + ' <li><a href="#section10">Absentismo</a></li>' +
' <li><a href="#section11">Esquema Vacinal</a></li>' + ' <li><a href="#section11">Esquema Vacinal</a></li>' +
' <li><a href="#section12">Conclusões/Resumo</a></li>' + ' <li><a href="#section12">Conclusões/Resumo</a></li>' +
//' <li><a href="#section13"> Propostas de Solução</a></li>' +
' <li><a href="#section14">Observações</a></li>' + ' <li><a href="#section14">Observações</a></li>' +
' <li><a href="#section15">Parecer/Reavaliação</a></li>' + ' <li><a href="#section15">Parecer/Reavaliação</a></li>' +
//' <li><a href="#section16">Reavaliação</a></li>' +
' <li><a href="#section17">Data do Exame</a></li>' + ' <li><a href="#section17">Data do Exame</a></li>' +
'</ul> ' + '</ul> ' +
'</div>' '</div>'
@ -32,13 +30,6 @@
$scope.habilitacoes = new globals.dataService.store(); $scope.habilitacoes = new globals.dataService.store();
$scope.estadosCivis = new globals.dataService.store(); $scope.estadosCivis = new globals.dataService.store();
$scope.storeDadosFicha = new globals.dataService.store({
model: null,
actions: {
get: 'getDadosFichaFromBD'
}
});
$scope.storeFichasClinicas = new globals.dataService.store({ $scope.storeFichasClinicas = new globals.dataService.store({
model: null, model: null,
@ -50,72 +41,36 @@
}); });
$scope.add = function(selected){ $scope.add = function(selected){
$scope.editForm.$reset(); $scope.editForm.$reset();
$scope.editing = angular.copy(selected); $scope.storeFichasClinicas.extraParams = {
fichaID: null,
$scope.editing.antecentesOcupacionaisActividadesAnteriores = []; trabalhadorID: selected.ficha.trabalhador_id,
$scope.editing.antecentesOcupacionaisAcidentesTrabalho = []; tipoFichaID: selected.ficha.tipo_ficha_id
$scope.editing.antecentesOcupacionaisDoencasProfissionais = [];
$scope.editing.antecentesOcupacionaisActividadesAnteriores = [];
//TODO: rever estes modelos - 3 novas grelhas
$scope.editing.antecedentesPessoaisCirurgias = [];
$scope.editing.antecedentesPessoaisFracturas = [];
$scope.editing.antecedentesPessoaisInternamentos = [];
$scope.editing.actividade = {
posto_representa_risco_saude: false
};
$scope.editing.antecentesOcupacionais = {
exposto_factores_risco: false,
acidentes_trabalho: false,
doencas_profissionais: false,
doencas_relacionadas_com_trabalho: false
};
//TODO: remaining fields!!!
$scope.editing.exameObjectivo = {
boca_nariz_normal: true,
pele_mucosas_normal: true,
acuidade_auditiva_normal: true,
adenopatias_normal: true,
pescoco_normal: true,
torax_normal: true,
auscultacao_cardiaca_normal: true,
auscultacao_pulmonar_normal: true,
mama_normal: true,
abdomen_normal: true,
coluna_vertebral_normal: true,
membros_normal: true,
exame_neurologico_normal: true
};
$scope.editing.classificacaoIndividualSaude = {
sem_problemas_saude: true
};
$scope.editing.conclusoesResumo = {
inapto_radio: 1,
reavaliacao_radio: 1
}; };
globals.plugins.buildFloatingSideMenu({
title: 'Ficha Clinica',
scrollspyItems: scrollspyItems,
afterrender: function(){
$('body').scrollspy({
target: '#scrollspyItems'
});
},
documentclick: function(){
$scope.openModalDocumentos(); $scope.storeFichasClinicas.get(function(response, status, headers, config, items){
}
}); $scope.selected = items.fichaData;
$scope.editing = angular.copy($scope.selected);
globals.plugins.buildFloatingSideMenu({
title: 'Ficha Clinica',
scrollspyItems: scrollspyItems,
afterrender: function(){
$('body').scrollspy({
target: '#scrollspyItems'
});
},
documentclick: function(){
$scope.openModalDocumentos();
}
});
});
}; };
$scope.edit = function(selected){ $scope.edit = function(selected){
@ -123,33 +78,31 @@
$scope.editForm.$reset(); $scope.editForm.$reset();
$scope.storeFichasClinicas.extraParams = { $scope.storeFichasClinicas.extraParams = {
fichaID: selected.id fichaID: selected.id,
trabalhadorID: null,
tipoFichaID: null
}; };
$scope.storeFichasClinicas.get(function(response, status, headers, config, items){ $scope.storeFichasClinicas.get(function(response, status, headers, config, items){
$scope.selected = items; $scope.selected = items.fichaData;
$scope.editing = angular.copy($scope.selected); $scope.editing = angular.copy($scope.selected);
$timeout(function () { globals.plugins.buildFloatingSideMenu({
title: 'Ficha Clinica',
globals.plugins.buildFloatingSideMenu({ scrollspyItems: scrollspyItems,
title: 'Ficha Clinica', afterrender: function(){
scrollspyItems: scrollspyItems,
afterrender: function(){ $('body').scrollspy({
target: '#scrollspyItems'
$('body').scrollspy({ });
target: '#scrollspyItems' },
}); documentclick: function(){
},
documentclick: function(){
$scope.openModalDocumentos();
}
});
}, 0); $scope.openModalDocumentos();
}
});
}); });
}; };
@ -169,15 +122,8 @@
$scope.editing.ficha.data_conclusao = null; $scope.editing.ficha.data_conclusao = null;
} }
//var isNewRecord = $scope.editing.ficha.id == null;
$scope.storeFichasClinicas.upsert($scope.selected, $scope.editing, function(response, selected, editing){ $scope.storeFichasClinicas.upsert($scope.selected, $scope.editing, function(response, selected, editing){
//if(isNewRecord && response.success)
//{
// $scope.isNewRecord = true;
//}
if(response.success && complete) if(response.success && complete)
{ {
globals.plugins.hideFloatingSideMenu(); globals.plugins.hideFloatingSideMenu();
@ -344,27 +290,15 @@
}); });
}; };
$scope.$watch('editing.ficha.tipo_ficha_id', function(tipo_ficha_id, oldVal){ $scope.$watch('storeFichasClinicas.items', function(newVal, oldVal){
if(tipo_ficha_id){ if(newVal.fieldsData){
$scope.storeDadosFicha.extraParams = { $scope.habilitacoes.items = [];
tipoFichaID: tipo_ficha_id $scope.habilitacoes.loadData(newVal.fieldsData.habilitacoes);
};
$scope.storeDadosFicha.get(function(response, status, headers, config, items){ $scope.estadosCivis.items = [];
$scope.estadosCivis.loadData(newVal.fieldsData.estadosCivis);
if(response.data){
if(response.data.habilitacoes){
$scope.habilitacoes.loadData(response.data.habilitacoes);
}
if(response.data.estadosCivis){
$scope.estadosCivis.loadData(response.data.estadosCivis);
}
}
});
} }
}); });
@ -389,11 +323,6 @@
$scope.editing.classificacaoIndividualSaude.sem_problemas_saude = false; $scope.editing.classificacaoIndividualSaude.sem_problemas_saude = false;
} }
}; };
$scope.test = function(){
alert('888');
};
$scope.$on('afterrender', function(event, args){ $scope.$on('afterrender', function(event, args){

@ -7,13 +7,6 @@
$scope.calculatedAge = 0; $scope.calculatedAge = 0;
$scope.motivos = new globals.dataService.store(); $scope.motivos = new globals.dataService.store();
$scope.storeDadosFicha = new globals.dataService.store({
model: null,
actions: {
get: 'getDadosFichaFromBD'
}
});
$scope.storeFichasClinicas = new globals.dataService.store({ $scope.storeFichasClinicas = new globals.dataService.store({
model: null, model: null,
@ -25,46 +18,60 @@
}); });
$scope.add = function(selected){ $scope.add = function(selected){
globals.plugins.buildFloatingSideMenu({
title: 'Ficha Clinica',
documentclick: function(){
$scope.openModalDocumentos();
}
});
$scope.editForm.$reset(); $scope.editForm.$reset();
$scope.editing = angular.copy(selected); $scope.storeFichasClinicas.extraParams = {
fichaID: null,
trabalhadorID: selected.ficha.trabalhador_id,
tipoFichaID: selected.ficha.tipo_ficha_id
};
$scope.storeFichasClinicas.get(function(response, status, headers, config, items){
$scope.selected = items.fichaData;
$scope.editing = angular.copy($scope.selected);
globals.plugins.buildFloatingSideMenu({
title: 'Ficha Clinica',
documentclick: function(){
$scope.openModalDocumentos();
}
});
});
}; };
$scope.edit = function(selected){ $scope.edit = function(selected){
globals.plugins.buildFloatingSideMenu({ $scope.editForm.$reset();
title: 'Ficha Clinica',
documentclick: function(){
$scope.openModalDocumentos(); $scope.storeFichasClinicas.extraParams = {
} fichaID: selected.id,
}); trabalhadorID: null,
tipoFichaID: null
};
$timeout(function () { $scope.storeFichasClinicas.get(function(response, status, headers, config, items){
$scope.editForm.$reset(); $scope.selected = items.fichaData;
$scope.storeFichasClinicas.extraParams = { $scope.editing = angular.copy($scope.selected);
fichaID: selected.id
}; $timeout(function () {
globals.plugins.buildFloatingSideMenu({
title: 'Ficha Clinica',
documentclick: function(){
$scope.storeFichasClinicas.get(function(response, status, headers, config, items){ $scope.openModalDocumentos();
}
$scope.selected = items; });
$scope.editing = angular.copy($scope.selected); }, 0);
});
}, 0); });
}; };
$scope.save = function(complete){ $scope.save = function(complete){
@ -154,26 +161,13 @@
//$scope.modalDocumentos.hide(); //$scope.modalDocumentos.hide();
}); });
}; };
$scope.$watch('editing.ficha.tipo_ficha_id', function(tipo_ficha_id, oldVal){ $scope.$watch('storeFichasClinicas.items', function(newVal, oldVal){
if(tipo_ficha_id){ if(newVal.fieldsData){
$scope.motivos.items = [];
$scope.storeDadosFicha.extraParams = { $scope.motivos.items = [];
tipoFichaID: tipo_ficha_id $scope.motivos.loadData(newVal.fieldsData.motivos);
};
$scope.storeDadosFicha.get(function(response, status, headers, config, items){
if(response.data){
if(response.data.motivos){
$scope.motivos.loadData(response.data.motivos);
}
}
});
} }
}); });

@ -6,14 +6,7 @@
$scope.calculatedAge = 0; $scope.calculatedAge = 0;
$scope.motivos = new globals.dataService.store(); $scope.motivos = new globals.dataService.store();
$scope.storeDadosFicha = new globals.dataService.store({
model: null,
actions: {
get: 'getDadosFichaFromBD'
}
});
$scope.storeFichasClinicas = new globals.dataService.store({ $scope.storeFichasClinicas = new globals.dataService.store({
model: null, model: null,
@ -25,51 +18,56 @@
}); });
$scope.add = function(selected){ $scope.add = function(selected){
$scope.editForm.$reset(); $scope.editForm.$reset();
$scope.editing = angular.copy(selected); $scope.storeFichasClinicas.extraParams = {
fichaID: null,
$scope.editing.conclusoesResumo = { trabalhadorID: selected.ficha.trabalhador_id,
inapto_radio: 1, tipoFichaID: selected.ficha.tipo_ficha_id
reavaliacao_radio: 1
}; };
globals.plugins.buildFloatingSideMenu({
title: 'Ficha Clinica',
documentclick: function(){
$scope.openModalDocumentos(); $scope.storeFichasClinicas.get(function(response, status, headers, config, items){
}
}); $scope.selected = items.fichaData;
$scope.editing = angular.copy($scope.selected);
globals.plugins.buildFloatingSideMenu({
title: 'Ficha Clinica',
documentclick: function(){
$scope.openModalDocumentos();
}
});
});
}; };
$scope.edit = function(selected){ $scope.edit = function(selected){
$timeout(function () { $scope.editForm.$reset();
$scope.editForm.$reset();
$scope.storeFichasClinicas.extraParams = { $scope.storeFichasClinicas.extraParams = {
fichaID: selected.id fichaID: selected.id,
}; trabalhadorID: null,
tipoFichaID: null
};
$scope.storeFichasClinicas.get(function(response, status, headers, config, items){ $scope.storeFichasClinicas.get(function(response, status, headers, config, items){
$scope.selected = items; $scope.selected = items.fichaData;
$scope.editing = angular.copy($scope.selected); $scope.editing = angular.copy($scope.selected);
globals.plugins.buildFloatingSideMenu({ globals.plugins.buildFloatingSideMenu({
title: 'Ficha Clinica', title: 'Ficha Clinica',
documentclick: function(){ documentclick: function(){
$scope.openModalDocumentos(); $scope.openModalDocumentos();
} }
}); });
});
}, 0); });
}; };
$scope.save = function(complete){ $scope.save = function(complete){
@ -160,23 +158,12 @@
}); });
}; };
$scope.$watch('editing.ficha.tipo_ficha_id', function(tipo_ficha_id, oldVal){ $scope.$watch('storeFichasClinicas.items', function(newVal, oldVal){
if(tipo_ficha_id){ if(newVal.fieldsData){
$scope.storeDadosFicha.extraParams = { $scope.motivos.items = [];
tipoFichaID: tipo_ficha_id $scope.motivos.loadData(newVal.fieldsData.motivos);
};
$scope.storeDadosFicha.get(function(response, status, headers, config, items){
if(response.data){
if(response.data.motivos){
$scope.motivos.loadData(response.data.motivos);
}
}
});
} }
}); });

@ -1,407 +1,341 @@
evoapp.controller('Form4Controller', function($rootScope, $scope, $timeout, $compile, $injector, $filter, globals) evoapp.controller('Form4Controller', function($rootScope, $scope, $timeout, $compile, $injector, $filter, globals)
{ {
$scope.globals = globals; $scope.globals = globals;
var scrollspyItems = $( var scrollspyItems = $(
'<div id="scrollspyItems"> ' + '<div id="scrollspyItems"> ' +
'<ul class="nav nav-pills nav-stacked m-t-5 m-b-5"> ' + '<ul class="nav nav-pills nav-stacked m-t-5 m-b-5"> ' +
' <li><a href="#section1">Identifica&ccedil;&atilde;o</a></li>' + ' <li><a href="#section1">Identifica&ccedil;&atilde;o</a></li>' +
' <li><a href="#section2">Actividade</a></li>' + ' <li><a href="#section2">Actividade</a></li>' +
' <li><a href="#section3">Antecedentes Ocupacionais</a></li>' + ' <li><a href="#section3">Antecedentes Ocupacionais</a></li>' +
' <li><a href="#section4">Antecedentes Pessoais</a></li>' + ' <li><a href="#section4">Antecedentes Pessoais</a></li>' +
' <li><a href="#section5">Hábitos</a></li>' + ' <li><a href="#section5">Hábitos</a></li>' +
' <li><a href="#section6">Antecedentes Familiares</a></li>' + ' <li><a href="#section6">Antecedentes Familiares</a></li>' +
' <li><a href="#section7">Exame Objectivo</a></li>' + ' <li><a href="#section7">Exame Objectivo</a></li>' +
' <li><a href="#section8">Doenças Activas</a></li>' + ' <li><a href="#section8">Doenças Activas</a></li>' +
' <li><a href="#section9">Classificação Individual de Saúde</a></li>' + ' <li><a href="#section9">Classificação Individual de Saúde</a></li>' +
' <li><a href="#section10">Absentismo</a></li>' + ' <li><a href="#section10">Absentismo</a></li>' +
' <li><a href="#section11">Esquema Vacinal</a></li>' + ' <li><a href="#section11">Esquema Vacinal</a></li>' +
' <li><a href="#section12">Conclusões/Resumo</a></li>' + ' <li><a href="#section12">Conclusões/Resumo</a></li>' +
//' <li><a href="#section13"> Propostas de Solução</a></li>' + ' <li><a href="#section14">Observações</a></li>' +
' <li><a href="#section14">Observações</a></li>' + ' <li><a href="#section15">Parecer/Reavaliação</a></li>' +
' <li><a href="#section15">Parecer/Reavaliação</a></li>' + ' <li><a href="#section17">Data do Exame</a></li>' +
//' <li><a href="#section16">Reavaliação</a></li>' + '</ul> ' +
' <li><a href="#section17">Data do Exame</a></li>' + '</div>'
'</ul> ' + );
'</div>'
); $scope.descricao = null;
$scope.descricao = null; $scope.calculatedAge = 0;
$scope.calculatedAge = 0; $scope.habilitacoes = new globals.dataService.store();
$scope.estadosCivis = new globals.dataService.store();
$scope.habilitacoes = new globals.dataService.store();
$scope.estadosCivis = new globals.dataService.store(); $scope.storeFichasClinicas = new globals.dataService.store({
model: null,
$scope.storeDadosFicha = new globals.dataService.store({ actions: {
model: null, get: 'getFicha',
actions: { upsert: 'sendFicha',
get: 'getDadosFichaFromBD' destroy: 'sendFicha'
} }
}); });
$scope.storeFichasClinicas = new globals.dataService.store({ $scope.add = function(selected){
model: null,
actions: { $scope.editForm.$reset();
get: 'getFicha',
upsert: 'sendFicha', $scope.storeFichasClinicas.extraParams = {
destroy: 'sendFicha' fichaID: null,
} trabalhadorID: selected.ficha.trabalhador_id,
}); tipoFichaID: selected.ficha.tipo_ficha_id
};
$scope.add = function(selected){
$scope.storeFichasClinicas.get(function(response, status, headers, config, items){
$scope.editForm.$reset();
$scope.selected = items.fichaData;
$scope.editing = angular.copy(selected);
$scope.editing = angular.copy($scope.selected);
$scope.editing.antecentesOcupacionaisActividadesAnteriores = [];
$scope.editing.antecentesOcupacionaisAcidentesTrabalho = []; globals.plugins.buildFloatingSideMenu({
$scope.editing.antecentesOcupacionaisDoencasProfissionais = []; title: 'Ficha Clinica',
$scope.editing.antecentesOcupacionaisActividadesAnteriores = []; scrollspyItems: scrollspyItems,
afterrender: function(){
//TODO: rever estes modelos - 3 novas grelhas
$scope.editing.antecedentesPessoaisCirurgias = []; $('body').scrollspy({
$scope.editing.antecedentesPessoaisFracturas = []; target: '#scrollspyItems'
$scope.editing.antecedentesPessoaisInternamentos = []; });
},
$scope.editing.actividade = { documentclick: function(){
posto_representa_risco_saude: false
}; $scope.openModalDocumentos();
}
$scope.editing.antecentesOcupacionais = { });
exposto_factores_risco: false, });
acidentes_trabalho: false, };
doencas_profissionais: false,
doencas_relacionadas_com_trabalho: false $scope.edit = function(selected){
};
$scope.editForm.$reset();
//TODO: remaining fields!!!
$scope.editing.exameObjectivo = { $scope.storeFichasClinicas.extraParams = {
boca_nariz_normal: true, fichaID: selected.id,
pele_mucosas_normal: true, trabalhadorID: null,
acuidade_auditiva_normal: true, tipoFichaID: null
adenopatias_normal: true, };
pescoco_normal: true,
torax_normal: true, $scope.storeFichasClinicas.get(function(response, status, headers, config, items){
auscultacao_cardiaca_normal: true,
auscultacao_pulmonar_normal: true, $scope.selected = items.fichaData;
mama_normal: true,
abdomen_normal: true, $scope.editing = angular.copy($scope.selected);
coluna_vertebral_normal: true,
membros_normal: true, globals.plugins.buildFloatingSideMenu({
exame_neurologico_normal: true title: 'Ficha Clinica',
}; scrollspyItems: scrollspyItems,
afterrender: function(){
$scope.editing.classificacaoIndividualSaude = {
sem_problemas_saude: true $('body').scrollspy({
}; target: '#scrollspyItems'
});
$scope.editing.conclusoesResumo = { },
inapto_radio: 1, documentclick: function(){
reavaliacao_radio: 1
}; $scope.openModalDocumentos();
}
globals.plugins.buildFloatingSideMenu({ });
title: 'Ficha Clinica',
scrollspyItems: scrollspyItems, });
afterrender: function(){ };
$('body').scrollspy({ $scope.save = function(complete){
target: '#scrollspyItems'
}); var isValid = $scope.editForm.$isValid();
},
documentclick: function(){ if(isValid)
{
$scope.openModalDocumentos(); if(complete)
} {
}); $scope.editing.ficha.data_conclusao = new Date();
}; }
else
$scope.edit = function(selected){ {
$scope.editing.ficha.data_conclusao = null;
$scope.editForm.$reset(); }
$scope.storeFichasClinicas.extraParams = { $scope.storeFichasClinicas.upsert($scope.selected, $scope.editing, function(response, selected, editing){
fichaID: selected.id
}; if(response.success && complete)
{
$scope.storeFichasClinicas.get(function(response, status, headers, config, items){ globals.plugins.hideFloatingSideMenu();
$scope.selected = items; $scope.$parent.loadModule({Controller: 'Search'}, function(className, scope, isNewModule){
$scope.editing = angular.copy($scope.selected); angular.element(scope.comboTrabalhadores.domEl).triggerHandler('change');
});
$timeout(function () { }
});
globals.plugins.buildFloatingSideMenu({ }
title: 'Ficha Clinica', };
scrollspyItems: scrollspyItems,
afterrender: function(){ $scope.gridAddItem = function(item, array, arrayName, el){
$('body').scrollspy({ if(!angular.isArray(array))
target: '#scrollspyItems' {
}); $scope.editing[arrayName] = new Array();
}, array = $scope.editing[arrayName];
documentclick: function(){ }
$scope.openModalDocumentos(); array.push(item);
}
}); $timeout(function () {
}, 0); if(el != undefined)
{
}); var table = $(el.target).closest('table');
}; if(table.length > 0)
{
$scope.save = function(complete){ var inputs = $(table[0]).find('input[data-required="true"]');
var isValid = $scope.editForm.$isValid(); $.each(inputs, function(index, el) {
if(isValid) var input = $(el);
{
if(complete) //activate field validation
{ $scope.editForm.$removeConstraints(input, false);
$scope.editing.ficha.data_conclusao = new Date(); });
} }
else }
{ });
$scope.editing.ficha.data_conclusao = null; };
}
$scope.gridRemoveItem = function(index, array, el){
//var isNewRecord = $scope.editing.ficha.id == null;
if(angular.isArray(array))
$scope.storeFichasClinicas.upsert($scope.selected, $scope.editing, function(response, selected, editing){ {
if(el != undefined)
//if(isNewRecord && response.success) {
//{ var table = $(el.target).closest('table');
// $scope.isNewRecord = true; if(table.length > 0)
//} {
var trs = $(table[0]).find('tr[class="ng-scope"]');
if(response.success && complete)
{ if(trs.length > 0 && trs[index] != undefined)
globals.plugins.hideFloatingSideMenu(); {
var tr = $(trs[index]);
$scope.$parent.loadModule({Controller: 'Search'}, function(className, scope, isNewModule){
var inputs = tr.find('input[data-required="true"]');
angular.element(scope.comboTrabalhadores.domEl).triggerHandler('change');
}); $.each(inputs, function(index, el) {
}
}); var input = $(el);
}
}; //disable field validation
$scope.editForm.$removeConstraints(input, true);
$scope.gridAddItem = function(item, array, arrayName, el){ });
}
if(!angular.isArray(array)) }
{ }
$scope.editing[arrayName] = new Array();
array = $scope.editing[arrayName]; array.splice(index, 1);
} }
};
array.push(item);
$scope.gridClearItems = function(tableId, arrayName){
$timeout(function () {
if(angular.isArray($scope.editing[arrayName]))
if(el != undefined) {
{ $scope.editing[arrayName] = new Array();
var table = $(el.target).closest('table');
if(table.length > 0) var table = $scope.domEl.find('#' + tableId);
{
var inputs = $(table[0]).find('input[data-required="true"]'); if(table.length > 0){
$.each(inputs, function(index, el) { var trs = $(table[0]).find('tr[class="ng-scope"]');
var input = $(el); $.each(trs, function(index, trEl) {
//activate field validation var inputs = $(trEl).find('input[data-required="true"]');
$scope.editForm.$removeConstraints(input, false);
}); $.each(inputs, function(index, inputEl) {
}
} var input = $(inputEl);
});
}; //disable field validation
$scope.editForm.$removeConstraints(input, true);
$scope.gridRemoveItem = function(index, array, el){ });
});
if(angular.isArray(array)) }
{
if(el != undefined) $scope.editing[arrayName] = new Array();
{ }
var table = $(el.target).closest('table'); };
if(table.length > 0)
{ $scope.cancel = function(){
var trs = $(table[0]).find('tr[class="ng-scope"]');
globals.message.custom({
if(trs.length > 0 && trs[index] != undefined) title: null,
{ message: 'Pretende anular as alterações à ficha ou gravar para edição posterior?',
var tr = $(trs[index]); buttons: {
cancelar: {
var inputs = tr.find('input[data-required="true"]'); label: 'Cancelar',
className: 'btn-default',
$.each(inputs, function(index, el) { callback: function() {
//cancelar diálogo
var input = $(el); }
},
//disable field validation anular: {
$scope.editForm.$removeConstraints(input, true); label: 'Anular',
}); className: 'btn-danger',
} callback: function() {
}
} globals.plugins.hideFloatingSideMenu();
array.splice(index, 1); $scope.$parent.loadModule({Controller: 'Search'}, function(className, scope, isNewModule){
}
}; angular.element(scope.comboTrabalhadores.domEl).triggerHandler('change');
});
$scope.gridClearItems = function(tableId, arrayName){ }
},
if(angular.isArray($scope.editing[arrayName])) gravar: {
{ label: 'Gravar',
$scope.editing[arrayName] = new Array(); className: 'btn-success',
callback: function() {
var table = $scope.domEl.find('#' + tableId);
$scope.save(false);
if(table.length > 0){
globals.plugins.hideFloatingSideMenu();
var trs = $(table[0]).find('tr[class="ng-scope"]');
$scope.$parent.loadModule({Controller: 'Search'}, function(className, scope, isNewModule){
$.each(trs, function(index, trEl) {
angular.element(scope.comboTrabalhadores.domEl).triggerHandler('change');
var inputs = $(trEl).find('input[data-required="true"]'); });
$.each(inputs, function(index, inputEl) { }
}
var input = $(inputEl); }
});
//disable field validation };
$scope.editForm.$removeConstraints(input, true);
}); $scope.openModalDocumentos = function(){
});
} $scope.modalDocumentos.show({
$scope.editing[arrayName] = new Array(); });
}
}; $scope.modalDocumentos.viewController.list();
$scope.cancel = function(){ $scope.modalDocumentos.viewController.$on('onAfterEdit', function(event, args) {
globals.message.custom({ //$scope.modalDocumentos.hide();
title: null, });
message: 'Pretende anular as alterações à ficha ou gravar para edição posterior?', };
buttons: {
cancelar: { $scope.$watch('storeFichasClinicas.items', function(newVal, oldVal){
label: 'Cancelar',
className: 'btn-default', if(newVal.fieldsData){
callback: function() {
//cancelar diálogo $scope.habilitacoes.items = [];
} $scope.habilitacoes.loadData(newVal.fieldsData.habilitacoes);
},
anular: { $scope.estadosCivis.items = [];
label: 'Anular', $scope.estadosCivis.loadData(newVal.fieldsData.estadosCivis);
className: 'btn-danger', }
callback: function() { });
globals.plugins.hideFloatingSideMenu(); $scope.classificacaoIndividualSaude = function(selected){
$scope.$parent.loadModule({Controller: 'Search'}, function(className, scope, isNewModule){ if (selected && $scope.editing.classificacaoIndividualSaude.sem_problemas_saude)
{
angular.element(scope.comboTrabalhadores.domEl).triggerHandler('change'); $scope.editing.classificacaoIndividualSaude.alteracao_temporaria_saude = false;
}); $scope.editing.classificacaoIndividualSaude.doenca_cronica_sem_interferencia = false;
} $scope.editing.classificacaoIndividualSaude.doenca_cronica_com_interferencia = false;
}, $scope.editing.classificacaoIndividualSaude.doenca_profissional = false;
gravar: { $scope.editing.classificacaoIndividualSaude.incapacidade_parcial = false;
label: 'Gravar', $scope.editing.classificacaoIndividualSaude.incapacidade_total = false;
className: 'btn-success', $scope.editing.classificacaoIndividualSaude.parecer_em_estudo = false;
callback: function() { }
$scope.save(false); if(selected && !$scope.editing.classificacaoIndividualSaude.sem_problemas_saude){
$scope.editing.classificacaoIndividualSaude.sem_problemas_saude = true;
globals.plugins.hideFloatingSideMenu(); }
$scope.$parent.loadModule({Controller: 'Search'}, function(className, scope, isNewModule){ if(!selected){
$scope.editing.classificacaoIndividualSaude.sem_problemas_saude = false;
angular.element(scope.comboTrabalhadores.domEl).triggerHandler('change'); }
}); };
} $scope.$on('afterrender', function(event, args){
}
} //listeners
}); $scope.$watch('editing.ficha.trabalhador_data_nascimento', function(newVal, oldVal){
};
if(newVal != null && newVal != oldVal)
$scope.openModalDocumentos = function(){ {
var a = moment(new Date());
$scope.modalDocumentos.show({ var b = moment(newVal);
$scope.calculatedAge = a.diff(b, 'years');
}); }
});
$scope.modalDocumentos.viewController.list();
});
$scope.modalDocumentos.viewController.$on('onAfterEdit', function(event, args) {
//$scope.modalDocumentos.hide();
});
};
$scope.$watch('editing.ficha.tipo_ficha_id', function(tipo_ficha_id, oldVal){
if(tipo_ficha_id){
$scope.storeDadosFicha.extraParams = {
tipoFichaID: tipo_ficha_id
};
$scope.storeDadosFicha.get(function(response, status, headers, config, items){
if(response.data){
if(response.data.habilitacoes){
$scope.habilitacoes.loadData(response.data.habilitacoes);
}
if(response.data.estadosCivis){
$scope.estadosCivis.loadData(response.data.estadosCivis);
}
}
});
}
});
$scope.classificacaoIndividualSaude = function(selected){
if (selected && $scope.editing.classificacaoIndividualSaude.sem_problemas_saude)
{
$scope.editing.classificacaoIndividualSaude.alteracao_temporaria_saude = false;
$scope.editing.classificacaoIndividualSaude.doenca_cronica_sem_interferencia = false;
$scope.editing.classificacaoIndividualSaude.doenca_cronica_com_interferencia = false;
$scope.editing.classificacaoIndividualSaude.doenca_profissional = false;
$scope.editing.classificacaoIndividualSaude.incapacidade_parcial = false;
$scope.editing.classificacaoIndividualSaude.incapacidade_total = false;
$scope.editing.classificacaoIndividualSaude.parecer_em_estudo = false;
}
if(selected && !$scope.editing.classificacaoIndividualSaude.sem_problemas_saude){
$scope.editing.classificacaoIndividualSaude.sem_problemas_saude = true;
}
if(!selected){
$scope.editing.classificacaoIndividualSaude.sem_problemas_saude = false;
}
};
$scope.$on('afterrender', function(event, args){
//listeners
$scope.$watch('editing.ficha.trabalhador_data_nascimento', function(newVal, oldVal){
if(newVal != null && newVal != oldVal)
{
var a = moment(new Date());
var b = moment(newVal);
$scope.calculatedAge = a.diff(b, 'years');
}
});
});
}); });

@ -24,27 +24,23 @@
$scope.storeFichasClinicas.get(function(response, status, headers, config, items){ $scope.storeFichasClinicas.get(function(response, status, headers, config, items){
$scope.selected = items; $scope.selected = items.fichaData;
$scope.editing = angular.copy($scope.selected); $scope.editing = angular.copy($scope.selected);
$timeout(function () { globals.plugins.buildFloatingSideMenu({
title: 'Ficha de Aptidão',
globals.plugins.buildFloatingSideMenu({ documentclick: function(){
title: 'Ficha de Aptidão',
documentclick: function(){ $scope.openModalDocumentos();
}
$scope.openModalDocumentos(); });
}
});
}, 0);
}); });
}; };
$scope.edit = function(selected){ $scope.edit = function(selected){
}; };
$scope.save = function(complete){ $scope.save = function(complete){

@ -177,7 +177,7 @@
<div class="col-md-8 p-l-none"> <div class="col-md-8 p-l-none">
<div ng-show="editing.ficha.tipo_ficha_id == 7" class="row"> <div ng-show="editing.ficha.tipo_ficha_id == 7" class="row">
<!--<div class="col-lg-12 p-l-none"> <div class="col-lg-12 p-l-none">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input ng-model="editing.ficha.motivo_id" name="rb_ocasional_motivo" ng-value="200" type="radio"/> <input ng-model="editing.ficha.motivo_id" name="rb_ocasional_motivo" ng-value="200" type="radio"/>
@ -228,7 +228,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> --> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save