att
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
application.type=widget
|
||||
application.code=dashtabela
|
||||
application.title=dashtabela
|
||||
application.description=dashtabela
|
||||
application.fluig.version=null
|
||||
application.category=SYSTEM
|
||||
application.renderer=freemarker
|
||||
developer.code=andrey.cunha
|
||||
developer.name=andrey.cunha
|
||||
developer.url=http://www.fluig.com
|
||||
application.uiwidget=true
|
||||
application.mobileapp=false
|
||||
application.version=${build.version}-${build.revision}
|
||||
view.file=view.ftl
|
||||
edit.file=edit.ftl
|
||||
locale.file.base.name=dashtabela
|
||||
application.resource.js.1=/resources/js/dashtabela.js
|
||||
application.resource.css.2=/resources/css/dashtabela.css
|
||||
hash=4a16315e9e66fa7d797b3f6b1fb365b69f9a4ce2
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<div id="MyWidget_${instanceId}" class="super-widget wcm-widget-class fluig-style-guide" data-params="MyWidget.instance()">
|
||||
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<div id="dashTabela_${instanceId}"
|
||||
class="super-widget wcm-widget-class fluig-style-guide"
|
||||
data-params="DashTabela.instance()">
|
||||
|
||||
<table class="table table-hover">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Data Início</th>
|
||||
<th>Data Limite</th>
|
||||
<th>Ciclo</th>
|
||||
<th>Auditor</th>
|
||||
<th>Responsável Loja</th>
|
||||
<th>Loja</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id="lista_${instanceId}">
|
||||
<tr>
|
||||
<td colspan="7" class="text-center">Aguardando filtro...</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
<div class="dash-table-footer">
|
||||
<div class="dash-page-size">
|
||||
<label for="page_size_${instanceId}">Itens por página</label>
|
||||
<select id="page_size_${instanceId}" class="form-control input-sm">
|
||||
<option value="5" selected>5</option>
|
||||
<option value="10">10</option>
|
||||
<option value="20">20</option>
|
||||
<option value="50">50</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="page_info_${instanceId}" class="dash-page-info">Aguardando filtro</div>
|
||||
<div class="dash-page-actions">
|
||||
<button id="page_prev_${instanceId}" type="button" class="btn btn-default btn-sm">Anterior</button>
|
||||
<button id="page_next_${instanceId}" type="button" class="btn btn-default btn-sm">Próxima</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<jboss-web>
|
||||
<context-root>/dashtabela</context-root>
|
||||
<disable-cross-context>false</disable-cross-context>
|
||||
</jboss-web>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
<session-config>
|
||||
<session-timeout>
|
||||
30
|
||||
</session-timeout>
|
||||
</session-config>
|
||||
</web-app>
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
div[id^="dashTabela_"] table th,
|
||||
div[id^="dashTabela_"] table td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
div[id^="dashTabela_"] table th:nth-child(1),
|
||||
div[id^="dashTabela_"] table td:nth-child(1),
|
||||
div[id^="dashTabela_"] table th:nth-child(2),
|
||||
div[id^="dashTabela_"] table td:nth-child(2),
|
||||
div[id^="dashTabela_"] table th:nth-child(3),
|
||||
div[id^="dashTabela_"] table td:nth-child(3) {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
div[id^="dashTabela_"] table th:nth-child(6),
|
||||
div[id^="dashTabela_"] table td:nth-child(6) {
|
||||
min-width: 220px;
|
||||
}
|
||||
|
||||
div[id^="dashTabela_"] .dash-table-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
padding-top: 8px;
|
||||
border-top: 1px solid #eee;
|
||||
}
|
||||
|
||||
div[id^="dashTabela_"] .dash-page-size {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
div[id^="dashTabela_"] .dash-page-size label {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
div[id^="dashTabela_"] .dash-page-size select {
|
||||
width: 72px;
|
||||
}
|
||||
|
||||
div[id^="dashTabela_"] .dash-page-info {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
div[id^="dashTabela_"] .dash-page-actions {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
@@ -0,0 +1,122 @@
|
||||
var DashTabela = SuperWidget.extend({
|
||||
|
||||
dados:[],
|
||||
paginaAtual:1,
|
||||
itensPorPagina:5,
|
||||
|
||||
init:function(){
|
||||
|
||||
var self=this;
|
||||
|
||||
$("#page_prev_"+this.instanceId).on("click",function(){
|
||||
if(self.paginaAtual>1){
|
||||
self.paginaAtual--;
|
||||
self.renderPage();
|
||||
}
|
||||
});
|
||||
|
||||
$("#page_next_"+this.instanceId).on("click",function(){
|
||||
var totalPaginas = self.getTotalPaginas();
|
||||
if(self.paginaAtual<totalPaginas){
|
||||
self.paginaAtual++;
|
||||
self.renderPage();
|
||||
}
|
||||
});
|
||||
|
||||
$("#page_size_"+this.instanceId).on("change",function(){
|
||||
self.itensPorPagina = parseInt($(this).val(),10) || 5;
|
||||
self.paginaAtual = 1;
|
||||
self.renderPage();
|
||||
});
|
||||
|
||||
window.addEventListener("dashboardData",function(e){
|
||||
|
||||
self.render(e.detail || []);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
render:function(dados){
|
||||
|
||||
this.dados = dados;
|
||||
this.paginaAtual = 1;
|
||||
this.renderPage();
|
||||
|
||||
},
|
||||
|
||||
renderPage:function(){
|
||||
|
||||
var html="";
|
||||
var totalPaginas = this.getTotalPaginas();
|
||||
|
||||
if(this.paginaAtual > totalPaginas){
|
||||
this.paginaAtual = totalPaginas;
|
||||
}
|
||||
|
||||
var inicio = (this.paginaAtual - 1) * this.itensPorPagina;
|
||||
var fim = inicio + this.itensPorPagina;
|
||||
var paginaDados = this.dados.slice(inicio,fim);
|
||||
|
||||
paginaDados.forEach(function(item){
|
||||
|
||||
html+="<tr>";
|
||||
html+="<td>"+esc(formataData(item.dataAuditoria))+"</td>";
|
||||
html+="<td>"+esc(formataData(item.dataLimite))+"</td>";
|
||||
html+="<td>"+esc(item.ciclo || "")+"</td>";
|
||||
html+="<td>"+esc(item.auditor || item.usuarioRetorno)+"</td>";
|
||||
html+="<td>"+esc(item.responsavelLoja)+"</td>";
|
||||
html+="<td>"+esc(item.loja)+"</td>";
|
||||
html+="<td>"+esc(statusResumido(item))+"</td>";
|
||||
html+="</tr>";
|
||||
|
||||
});
|
||||
|
||||
if(!html){
|
||||
html+="<tr><td colspan='7' class='text-center'>Sem dados para o filtro selecionado</td></tr>";
|
||||
}
|
||||
|
||||
$("#lista_"+this.instanceId).html(html);
|
||||
$("#page_info_"+this.instanceId).text("Página " + this.paginaAtual + " de " + totalPaginas + " (" + this.dados.length + " registros)");
|
||||
$("#page_prev_"+this.instanceId).prop("disabled", this.paginaAtual <= 1);
|
||||
$("#page_next_"+this.instanceId).prop("disabled", this.paginaAtual >= totalPaginas);
|
||||
|
||||
},
|
||||
|
||||
getTotalPaginas:function(){
|
||||
if(!this.dados.length){
|
||||
return 1;
|
||||
}
|
||||
return Math.ceil(this.dados.length / this.itensPorPagina);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function esc(v){
|
||||
return String(v == null ? "" : v)
|
||||
.replace(/&/g,"&")
|
||||
.replace(/</g,"<")
|
||||
.replace(/>/g,">")
|
||||
.replace(/\"/g,""")
|
||||
.replace(/'/g,"'");
|
||||
}
|
||||
|
||||
function formataData(v){
|
||||
var s = String(v || "").trim();
|
||||
if(!s){
|
||||
return "";
|
||||
}
|
||||
if(/^\d{4}-\d{2}-\d{2}$/.test(s)){
|
||||
var p = s.split("-");
|
||||
return p[2] + "/" + p[1] + "/" + p[0];
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
function statusResumido(item){
|
||||
var s = String(item.saidaAnalise || item.status || "").trim().toUpperCase();
|
||||
if(s === "CONFORME"){
|
||||
return "CONFORME";
|
||||
}
|
||||
return "NAO_CONFORME";
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user