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

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
João Maurício 12 years ago
parent 275a9d022c
commit 8e33e74152

@ -109,7 +109,13 @@
}
};
$scope.gridAddItem = function(item, array){
$scope.gridAddItem = function(item, array, arrayName){
if(!angular.isArray(array))
{
$scope.editing[arrayName] = new Array();
array = $scope.editing[arrayName];
}
array.push(item);
};
@ -158,5 +164,6 @@
$scope.$on('afterrender', function(event, args){
});
});

@ -593,7 +593,7 @@
<div class="form-group">
<label class="col-sm-6 control-label">3.1 - Com que idade iniciou a actividade Laboral?</label>
<div class="col-sm-6">
<input type="text" ng-model="editing.antecentesOcupacionais.idade_inicio_actividade" class="form-control">
<input type="text" ng-model="editing.antecentesOcupacionais.idade_inicio_actividade" data-type="digits" class="form-control" />
</div>
</div>
@ -612,7 +612,7 @@
<tfoot>
<tr>
<td colspan="5">
<button ng-click="gridAddItem({}, editing.antecentesOcupacionaisActividadesAnteriores)" type="button" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span>Adicionar </button>
<button ng-click="gridAddItem({}, editing.antecentesOcupacionaisActividadesAnteriores, 'antecentesOcupacionaisActividadesAnteriores')" type="button" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span>Adicionar </button>
</td>
</tr>
</tfoot>
@ -760,23 +760,23 @@
<tfoot>
<tr>
<td colspan="5">
<button ng-click="gridAddItem({}, editing.antecentesOcupacionaisAcidentesTrabalho)" type="button" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span>Adicionar </button>
<button ng-click="gridAddItem({}, editing.antecentesOcupacionaisAcidentesTrabalho, 'antecentesOcupacionaisAcidentesTrabalho')" type="button" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span>Adicionar </button>
</td>
</tr>
</tfoot>
<tbody>
<tr ng-repeat="item in editing.antecentesOcupacionaisAcidentesTrabalho">
<td>
<input ng-model="item.acidente" type="text" class="form-control" />
<input ng-model="item.acidente" data-required="true" type="text" class="form-control" />
</td>
<td>
<input ng-model="item.data" value="{{item.data}}" data-regexp="^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$" type="text" class="form-control" datepicker />
<input ng-model="item.data" data-required="true" data-regexp="^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$" type="text" class="form-control" datepicker />
</td>
<td>
<input ng-model="item.lesao_corporal" type="text" class="form-control" />
<input ng-model="item.lesao_corporal" data-required="true" type="text" class="form-control" />
</td>
<td>
<input ng-model="item.incapacidade_resultante" type="text" class="form-control" />
<input ng-model="item.incapacidade_resultante" data-required="true" data-type="digits" type="text" class="form-control" />
</td>
<td>
<button ng-click="gridRemoveItem($index, editing.antecentesOcupacionaisAcidentesTrabalho)" type="button" class="btn btn-danger btn-xs">
@ -818,23 +818,23 @@
<tfoot>
<tr>
<td colspan="5">
<button ng-click="gridAddItem({}, editing.antecentesOcupacionaisDoencasProfissionais)" type="button" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span>Adicionar </button>
<button ng-click="gridAddItem({}, editing.antecentesOcupacionaisDoencasProfissionais, 'antecentesOcupacionaisDoencasProfissionais')" type="button" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span>Adicionar </button>
</td>
</tr>
</tfoot>
<tbody>
<tr ng-repeat="item in editing.antecentesOcupacionaisDoencasProfissionais">
<td>
<input ng-model="item.suspeitada" type="text" class="form-control" />
<input ng-model="item.suspeitada" data-required="true" type="text" class="form-control" />
</td>
<td>
<input ng-model="item.data_suspeita" value="{{item.data_suspeita}}" data-regexp="^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$" type="text" class="form-control" datepicker />
<input ng-model="item.data_suspeita" data-required="true" data-regexp="^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$" type="text" class="form-control" datepicker />
</td>
<td>
<input ng-model="item.declarada" type="text" class="form-control" />
<input ng-model="item.declarada" data-required="true" type="text" class="form-control" />
</td>
<td>
<input ng-model="item.data_declaracao" value="{{item.data_declaracao}}" data-regexp="^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$" type="text" class="form-control" datepicker />
<input ng-model="item.data_declaracao" data-required="true" data-regexp="^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$" type="text" class="form-control" datepicker />
</td>
<td>
<button ng-click="gridRemoveItem($index, editing.antecentesOcupacionaisDoencasProfissionais)" type="button" class="btn btn-danger btn-xs">
@ -2243,16 +2243,19 @@
<label class="col-sm-4 control-label">Peso</label>
<div class="col-sm-8">
<div class="input-group">
<input ng-model="editing.exameObjectivo.biometria_peso" type="text" class="form-control" />
<input ng-model="editing.exameObjectivo.biometria_peso" data-type="digits" type="text" class="form-control" />
<span class="input-group-addon">(Kg)</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">T.A.</label>
<div class="col-sm-8">
<div class="input-group">
<input ng-model="editing.exameObjectivo.biometria_ta_sistolica" type="text" class="form-control" />
<div class="col-sm-8 form-inline">
<div class="input-group col-md-6" style="float:left;">
<input ng-model="editing.exameObjectivo.biometria_ta_diastolica" data-type="digits" type="text" class="form-control" />
</div>
<div class="input-group col-md-6" style="float:right;">
<input ng-model="editing.exameObjectivo.biometria_ta_sistolica" data-type="digits" type="text" class="form-control" />
<span class="input-group-addon">(mmHg)</span>
</div>
</div>
@ -2263,7 +2266,7 @@
<label class="col-sm-4 control-label">Altura</label>
<div class="col-sm-8">
<div class="input-group">
<input ng-model="editing.exameObjectivo.biometria_altura" type="text" class="form-control" />
<input ng-model="editing.exameObjectivo.biometria_altura" data-type="digits" type="text" class="form-control" />
<span class="input-group-addon">(cm)</span>
</div>
</div>
@ -2272,7 +2275,7 @@
<label class="col-sm-4 control-label">F.C.</label>
<div class="col-sm-8">
<div class="input-group">
<input ng-model="editing.exameObjectivo.biometria_frequencia_cardiaca" type="text" class="form-control" />
<input ng-model="editing.exameObjectivo.biometria_frequencia_cardiaca" data-type="digits" type="text" class="form-control" />
<span class="input-group-addon">(bpm)</span>
</div>
</div>
@ -2352,19 +2355,19 @@
<tr>
<td>Olho Esquerdo </td>
<td>
<input ng-model="editing.exameObjectivo.acuidade_visual_esquerdo_perto" type="text" class="form-control" />
<input data-regexp="^\d+(\.\d{1,2})?$" ng-model="editing.exameObjectivo.acuidade_visual_esquerdo_perto" type="text" class="form-control" />
</td>
<td>
<input ng-model="editing.exameObjectivo.acuidade_visual_esquerdo_longe" type="text" class="form-control" />
<input data-regexp="^\d+(\.\d{1,2})?$" ng-model="editing.exameObjectivo.acuidade_visual_esquerdo_longe" type="text" class="form-control" />
</td>
</tr>
<tr>
<td>Olho Direito </td>
<td>
<input ng-model="editing.exameObjectivo.acuidade_visual_direito_perto" type="text" class="form-control" />
<input data-regexp="^\d+(\.\d{1,2})?$" ng-model="editing.exameObjectivo.acuidade_visual_direito_perto" type="text" class="form-control" />
</td>
<td>
<input ng-model="editing.exameObjectivo.acuidade_visual_direito_longe" type="text" class="form-control" />
<input data-regexp="^\d+(\.\d{1,2})?$" ng-model="editing.exameObjectivo.acuidade_visual_direito_longe" type="text" class="form-control" />
</td>
</tr>
</tbody>
@ -3363,42 +3366,42 @@
<div class="form-group">
<div class="checkbox">
<label>
<input ng-model="editing.ficha.classificacao_individual_saude_id" name="rb_classificacao_individual_saude_id" value="1" type="radio" />
<input ng-model="editing.ficha.sem_problemas_saude" value="true" type="checkbox" />
Sem problemas de saúde </label>
</div>
<div class="checkbox">
<label>
<input ng-model="editing.ficha.classificacao_individual_saude_id" name="rb_classificacao_individual_saude_id" value="2" type="radio" />
<input ng-model="editing.ficha.alteracao_temporaria_saude" value="true" type="checkbox" />
Com alteração temporária de saúde </label>
</div>
<div class="checkbox">
<label>
<input ng-model="editing.ficha.classificacao_individual_saude_id" name="rb_classificacao_individual_saude_id" value="3" type="radio" />
<input ng-model="editing.ficha.doenca_cronica_sem_interferencia" value="true" type="checkbox" />
Com doença crónica sem interferência na função </label>
</div>
<div class="checkbox">
<label>
<input ng-model="editing.ficha.classificacao_individual_saude_id" name="rb_classificacao_individual_saude_id" value="4" type="radio" />
<input ng-model="editing.ficha.doenca_cronica_com_interferencia" value="true" type="checkbox" />
Com doença crónica com interferência na função </label>
</div>
<div class="checkbox">
<label>
<input ng-model="editing.ficha.classificacao_individual_saude_id" name="rb_classificacao_individual_saude_id" value="5" type="radio" />
<input ng-model="editing.ficha.doenca_profissional" value="true" type="checkbox" />
Com doença profissional </label>
</div>
<div class="checkbox">
<label>
<input ng-model="editing.ficha.classificacao_individual_saude_id" name="rb_classificacao_individual_saude_id" value="6" type="radio" />
<input ng-model="editing.ficha.incapacidade_parcial" value="true" type="checkbox" />
Com incapacidade parcial </label>
</div>
<div class="checkbox">
<label>
<input ng-model="editing.ficha.classificacao_individual_saude_id" name="rb_classificacao_individual_saude_id" value="7" type="radio" />
<input ng-model="editing.ficha.incapacidade_total" value="true" type="checkbox" />
Com incapacidade total </label>
</div>
<div class="checkbox">
<label>
<input ng-model="editing.ficha.classificacao_individual_saude_id" name="rb_classificacao_individual_saude_id" value="8" type="radio" />
<input ng-model="editing.ficha.parecer_em_estudo" value="true" type="checkbox" />
Parecer em estudo </label>
</div>
</div>
@ -3412,7 +3415,7 @@
<div class="panel-body">
<div class="form-group">
<label class="control-label">Nº. Total (médio) de dias de ausência ao trabalho no último ano</label>
<input ng-model="editing.absentismo.dias_ausencia_ultimo_ano" type="text" class="form-control" />
<input ng-model="editing.absentismo.dias_ausencia_ultimo_ano" data-type="digits" type="text" class="form-control" />
</div>
<div class="form-group">
<label class="control-label">Principais motivos de ausência</label>
@ -3682,7 +3685,10 @@
<div class="panel-body">
<div class="row">
<div class="col-md-2">
<input ng-model="editing.conclusoesResumo.data_exame" value="{{editing.conclusoesResumo.data_exame}}" data-regexp="^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$" type="text" class="form-control" datepicker />
<input ng-model="editing.conclusoesResumo.data_exame" type="text" class="form-control" datepicker />
</div>
</div>
</div>

@ -109,6 +109,18 @@
$scope.$on('afterrender', function(event, args){
//var testData = [
// {
// "id" : 206,
// "designacao_social" : "LEYA GLOBAL, SA"
// }, {
// "id" : 112,
// "designacao_social" : "LEYA, S.A."
// }
//];
//$scope.comboEmpresas.store.loadData(testData);
$scope.comboEmpresas.loadStore(function(response, status, headers, config, items){
});

@ -0,0 +1,25 @@
<!-- modal window -->
<div class="modal fade" id="genericModalWindow" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header custom-modal-header bg-light lter">
<div class="btn-group pull-right">
<!--<a href="/#" ng-click="minimize()"><i class="icon-caret-down"></i></a>-->
<a href="/#" ng-click="maximize()"><i class="{{resizeIcon}}"></i></a>
<a href="/#" ng-click="hide()"><i class="icon-remove"></i></a>
</div>
<h5 class="modal-title">{{title}}</h5>
</div>
<div class="modal-body custom-modal-body">
</div>
<div class="modal-footer custom-modal-footer">
<button ng-click="hide()" type="button" class="btn btn-sm btn-white" data-dismiss="modal">Sair</button>
</div>
</div>
</div>
</div>

@ -0,0 +1,150 @@

//https://github.com/jschr/bootstrap-modal
evoapp.directive('modalWindow', function($rootScope) {
var modalWindowEl = $rootScope.viewCache.find('#genericModalWindow'),
template = modalWindowEl[0].outerHTML;
return {
require: '^ngController',
restrict: 'AE',
template: template,
scope: {
itemId: '@',
title: '@',
view: '@'
},
controller: function($rootScope, $scope, $filter, globals, $timeout) {
$scope.main = $scope.$parent.$parent;//TODO: this is a crap!!!
//add reference to this window, in parent controller
if($scope.$parent[$scope.itemId] == undefined)
{
$scope.$parent[$scope.itemId] = $scope;
}
else
{
throw Error('Modal Window ' + $scope.itemId + ' already exists!');
}
},
link: function (scope, elem, attrs) {
$(elem).css('display', 'none');
scope.viewController = null;
scope.resizeIcon = 'icon-resize-full';
scope.modalWindow = $(elem.find('.modal')[0]);
scope.modalBody = $(elem.find('.modal-body')[0]);
var modalDialog = $(scope.modalWindow.find('.modal-dialog')[0]);
//$(modalDialog).draggable({
// handle: ".modal-header"
//});
scope.viewEl = null;
scope.modalWindow.on('show.bs.modal', function () {
});
scope.modalWindow.on('shown.bs.modal', function () {
});
scope.modalWindow.on('hide.bs.modal', function () {
});
scope.modalWindow.on('hidden.bs.modal', function () {
});
modalDialog.removeClass('modal-large');
modalDialog.removeClass('modal-medium');
modalDialog.removeClass('modal-small');
//apply width
if(attrs.width != null && attrs.width != undefined)
{
modalDialog.addClass(attrs.width);
}
scope.show = function(config){
config = config == undefined ? null : config;
scope.main.renderModule(scope.modalBody, scope.view, config, false, function(className, mscope){
scope.modalWindow.modal('show');
scope.$emit('onShow');
});
scope.viewEl = $(scope.modalBody.children()[0]);
scope.viewController = angular.element(scope.viewEl).scope();
//scope.viewController['$$view-id'] = scope.view;
//var currentWindowHeight = $(window).height();
//var newHeight = (currentWindowHeight - (currentWindowHeight * 30 / 100));
//TODO: compute height!!!
scope.modalWindow.modal({
height: 460,
minHeight: 460,
maxHeight: 460,
show: false,
backdrop: false
});
};
scope.hide = function(){
//must be here otherwise controller inside modal will be destroyed
scope.$emit('onHide');
scope.viewEl.remove();
scope.viewController.$destroy();
scope.viewController = null;
scope.modalWindow.modal('hide');
};
scope.maximize = function(){
if(scope.resizeIcon == 'icon-resize-full')
{
scope.resizeIcon = 'icon-resize-small';
}
else
{
scope.resizeIcon = 'icon-resize-full';
}
modalDialog.toggleClass(attrs.width);
modalDialog.toggleClass('modal-large');
scope.$emit('onMaximize');
};
//scope.minimize = function(){
// scope.modalWindow.animate({
// height: '40px',
// top: $(window).height() - 50
// }, 200);
//};
}
}
});

@ -0,0 +1,126 @@
evoapp.directive('pagingToolbar', function ($filter) {
return {
restrict: 'AE',
template:
'<footer class="panel-footer">' +
'<div class="row">' +
'<div class="col-sm-6 text-left text-center-xs">' +
'<small ng-hide="store.items.length == 0" class="text-muted inline m-t-sm m-b-sm" ng-bind="showingInfo()"></small>' +
'<small ng-show="store.items.length == 0" class="text-muted inline m-t-sm m-b-sm">Sem dados para mostrar</small>' +
'</div>' +
'<div ng-show="showPager" class="col-sm-6 text-right text-center-xs">' +
'<div class="btn-group">' +
'<button ng-disabled="store.start == 0" ng-click="move(\'back\')" class="btn btn-white btn-sm">' +
'<i class="icon-chevron-left"></i>' +
'</button>' +
'<button type="button" class="btn btn-white btn-sm" ng-bind="pageInfo()"></button>' +
'<button ng-click="get()" type="button" class="btn btn-white btn-sm"><i class="icon-refresh"></i></button>' +
'<button ng-disabled="currentPage == numberOfPages()" ng-click="move(\'forward\')" class="btn btn-white btn-sm">' +
'<i class="icon-chevron-right"></i>' +
'</button>' +
'</div>' +
'</div>' +
'</div>' +
'</footer>',
scope: {
store: '='
},
link: function (scope, elem, attrs) {
scope.currentPage = 1;
scope.showPager = attrs.showPager ? attrs.showPager : true;
scope.numberOfPages = function(){
var numberOfPages = 0;
if(scope.store.total > 0)
{
numberOfPages = Math.ceil(scope.store.total/scope.store.limit);
}
else
{
numberOfPages = 0;
}
return numberOfPages;
};
scope.move = function(direction) {
if(direction == 'forward')
{
scope.store.start = scope.store.start + scope.store.limit;
scope.currentPage = scope.currentPage + 1;
}
else
{
scope.store.start = scope.store.start - scope.store.limit;
scope.currentPage = scope.currentPage - 1;
}
};
scope.$watch('store.start', function(newValue, oldValue){
if(newValue != oldValue && newValue != undefined)
{
scope.get();
}
});
scope.$watch('store.total', function(newValue, oldValue){
if(!isNaN(newValue))
{
var total = parseInt(newValue);
if(total == 0)
{
scope.currentPage = 0;
}
else
{
scope.currentPage = scope.currentPage == 0 ? 1 : scope.currentPage;
}
}
});
scope.get = function(){
scope.store.get(function(response, status, headers, config, items){
scope.currentPage = scope.store.start == 0 ? (items.length > 0 ? 1 : 0) : scope.currentPage;
});
};
scope.showingInfo = function(){
var from = (scope.store.items.length == 0 ? 0 : (scope.store.start + 1)),
to = (scope.store.start + scope.store.items.length);
return $filter('stringFormat')('A mostrar {0} - {1} de {2}', [from, to, scope.store.total]);
};
scope.pageInfo = function(){
var info = 'Página ' +
scope.currentPage + ' de ' +
scope.numberOfPages();
return info;
};
}
}
});

@ -0,0 +1,84 @@
 evoapp.filter('stringFormat', function () {
///usage from HTML: {{template | stringFormat:[competition.name, competition.place, competition.from, competition.to] }
//usage from Javascript: $filter('stringFormat')('string to format', ['params array'])
// function _toFormattedString is based on String.js from http://ajaxcontroltoolkit.codeplex.com/SourceControl/latest#Client/MicrosoftAjax/Extensions/String.js
// as seen in http://stackoverflow.com/questions/2534803/string-format-in-javascript
function toFormattedString(useLocale, format, values) {
var result = '';
for (var i = 0; ;) {
// Find the next opening or closing brace
var open = format.indexOf('{', i);
var close = format.indexOf('}', i);
if ((open < 0) && (close < 0)) {
// Not found: copy the end of the string and break
result += format.slice(i);
break;
}
if ((close > 0) && ((close < open) || (open < 0))) {
if (format.charAt(close + 1) !== '}') {
throw new Error('format stringFormatBraceMismatch');
}
result += format.slice(i, close + 1);
i = close + 2;
continue;
}
// Copy the string before the brace
result += format.slice(i, open);
i = open + 1;
// Check for double braces (which display as one and are not arguments)
if (format.charAt(i) === '{') {
result += '{';
i++;
continue;
}
if (close < 0) throw new Error('format stringFormatBraceMismatch');
// Find the closing brace
// Get the string between the braces, and split it around the ':' (if any)
var brace = format.substring(i, close);
var colonIndex = brace.indexOf(':');
var argNumber = parseInt((colonIndex < 0) ? brace : brace.substring(0, colonIndex), 10);
if (isNaN(argNumber)) throw new Error('format stringFormatInvalid');
var argFormat = (colonIndex < 0) ? '' : brace.substring(colonIndex + 1);
var arg = values[argNumber];
if (typeof (arg) === "undefined" || arg === null) {
arg = '';
}
// If it has a toFormattedString method, call it. Otherwise, call toString()
if (arg.toFormattedString) {
result += arg.toFormattedString(argFormat);
} else if (useLocale && arg.localeFormat) {
result += arg.localeFormat(argFormat);
} else if (arg.format) {
result += arg.format(argFormat);
} else
result += arg.toString();
i = close + 1;
}
return result;
};
return function (/*string*/template, /*array*/values) {
if (!values || !values.length || !template) {
return template;
}
return toFormattedString(false, template, values);
};
});

@ -67,7 +67,6 @@
<script src="app/Form2/Form2Controller.js"></script>
<script src="app/SearchForm/SearchController.js"></script>
</head>
<body ng-cloak>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save