forked from Coded/SIPRP
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
147 lines
4.7 KiB
147 lines
4.7 KiB
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
|
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml"%>
|
|
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
|
|
<div class="row" >
|
|
<div class="col-sm-12" id="main_content">
|
|
<tiles:insertAttribute name="main-content"/>
|
|
</div>
|
|
<div class="hidden" id="topten" style="min-height: 230px; padding: 5px;">
|
|
<div class="panel navbar-default" style="background-color: #53616a;">
|
|
<div class="panel-heading" style="color: #eeeeee; border-bottom: 1px solid; margin-bottom: 15px;">
|
|
<h3 class="panel-title">Top 10</h3>
|
|
</div>
|
|
<div class="table" style="padding: 5px;">
|
|
<div data-bind="foreach: items" style="overflow-y: auto">
|
|
<p style="color: #eeeeee;">
|
|
<span data-bind="text: $index() + 1"></span>.
|
|
<a class="nav-link" data-bind="attr: { href: '/safemode/pages/legislacao/listagemDiploma.do?id='+_id }">
|
|
<span data-bind="text: _tipo">
|
|
N/A
|
|
</span>
|
|
Nº
|
|
<span data-bind="text: _numero">
|
|
N/A
|
|
</span>
|
|
de
|
|
<span data-bind="text: moment(_dataPublicacao).format('YYYY-MM-DD') ">
|
|
N/A
|
|
</span>
|
|
</a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="hidden" id="favoritos" style="min-height: 230px; padding: 5px;">
|
|
<div class="panel navbar-default" style="background-color: #53616a;">
|
|
<div class="panel-heading" style="color: #eeeeee; border-bottom: 1px solid; margin-bottom: 15px;">
|
|
<h3 class="panel-title">Diplomas Favoritos</h3>
|
|
</div>
|
|
<div class="table" style="padding: 5px;">
|
|
<div data-bind="foreach: items, event: { scroll: scrolled }" style="overflow-y: auto">
|
|
<p>
|
|
<a class="nav-link" data-bind="attr: { href: '/safemode/pages/legislacao/listagemDiploma.do?id='+_id }">
|
|
<span data-bind="text: _tipo">
|
|
N/A
|
|
</span>
|
|
Nº
|
|
<span data-bind="text: _numero">
|
|
N/A
|
|
</span>
|
|
de
|
|
<span data-bind="text: moment(_dataPublicacao).format('YYYY-MM-DD') ">
|
|
N/A
|
|
</span>
|
|
</a>
|
|
<button class="btn" style="color: #d9534f; padding: 4px; float: right; background-color: transparent;" type="button" data-bind="click: $root.clickAction">
|
|
<span class="glyphicon glyphicon-remove"></span>
|
|
</button>
|
|
<span data-bind="text: ">N/A</span>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
|
|
var webservice1, favoritos, topten;
|
|
|
|
webservice1 = new ws_safemode_pt__LegislacaoWS2();
|
|
webservice1.url = "/safemode/safemode-ws/legislacao";
|
|
|
|
favoritos = {
|
|
items: ko.observableArray([]),
|
|
scrolled: function(data, event) {
|
|
var elem;
|
|
elem = event.target;
|
|
if (elem.scrollTop > (elem.scrollHeight - elem.offsetHeight - 20)) {
|
|
getItems();
|
|
}
|
|
},
|
|
pendingRequest: ko.observable(false),
|
|
max: ko.observable(false),
|
|
clickAction: function( item )
|
|
{
|
|
console.log(item);
|
|
webservice1.mudaEstadoFavorito( function( x, y )
|
|
{
|
|
favoritos.items.remove(item);
|
|
}, function( x, y )
|
|
{
|
|
if( x === 340 )
|
|
{
|
|
window.location.href = window.location.href;
|
|
}
|
|
else alert( x + " " + y );
|
|
}, item._id, true );
|
|
}
|
|
};
|
|
|
|
function getItems() {
|
|
if (!favoritos.pendingRequest()) {
|
|
if (favoritos.max() === false) {
|
|
webservice1.pesquisaFavoritos(function(result) {
|
|
if (result._return._data.length !== 0) {
|
|
ko.utils.arrayForEach(result._return._data, function(entry) {
|
|
favoritos.items.push(entry);
|
|
});
|
|
} else {
|
|
favoritos.max(true);
|
|
}
|
|
favoritos.pendingRequest(false);
|
|
}, function(x, y) {
|
|
if( x === 340 )
|
|
{
|
|
window.location.href = window.location.href;
|
|
}
|
|
else alert( x + " " + y );
|
|
favoritos.pendingRequest(false);
|
|
}, favoritos.items().length, 20);
|
|
}
|
|
}
|
|
};
|
|
|
|
ko.applyBindings(favoritos, jQuery("#favoritos")[0]);
|
|
|
|
getItems();
|
|
|
|
topten = { items: ko.observableArray([]) };
|
|
|
|
webservice1.pesquisaTopTen(function(result) {
|
|
ko.utils.arrayForEach(result._return._data, function(entry)
|
|
{
|
|
topten.items.push(entry);
|
|
});
|
|
}, function(x, y) {
|
|
if( x === 340 )
|
|
{
|
|
window.location.href = window.location.href;
|
|
}
|
|
else alert( x + " " + y );
|
|
});
|
|
|
|
ko.applyBindings(topten, jQuery("#topten")[0]);
|
|
|
|
</script> |