Initial commit
This commit is contained in:
16
assets/css/admin-ramais.css
Normal file
16
assets/css/admin-ramais.css
Normal file
@@ -0,0 +1,16 @@
|
||||
.wrap h1 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.form-table th {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.form-table input.regular-text {
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.notice {
|
||||
margin: 5px 0 15px;
|
||||
}
|
116
assets/css/ramais.css
Normal file
116
assets/css/ramais.css
Normal file
@@ -0,0 +1,116 @@
|
||||
.ramais-container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.ramais-filtros {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
margin-bottom: 20px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.ramais-filtros input,
|
||||
.ramais-filtros select {
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.ramais-filtros input:focus,
|
||||
.ramais-filtros select:focus {
|
||||
outline: none;
|
||||
border-color: #2271b1;
|
||||
box-shadow: 0 0 0 1px #2271b1;
|
||||
}
|
||||
|
||||
.ramais-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.ramais-table th,
|
||||
.ramais-table td {
|
||||
padding: 12px 15px;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.ramais-table th {
|
||||
background-color: #f5f5f5;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.ramais-table tr:hover {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
.ramais-table a {
|
||||
color: #2271b1;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.ramais-table a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.ramais-no-results,
|
||||
.ramais-loading,
|
||||
.ramais-error {
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 4px;
|
||||
margin: 20px 0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.ramais-pagination {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 5px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.ramais-page-link {
|
||||
padding: 8px 12px;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 4px;
|
||||
text-decoration: none;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.ramais-page-link:hover {
|
||||
background-color: #e5e5e5;
|
||||
}
|
||||
|
||||
.ramais-page-link.active {
|
||||
background-color: #2271b1;
|
||||
color: white;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.ramais-filtros {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.ramais-filtros input,
|
||||
.ramais-filtros select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ramais-table {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.ramais-table th,
|
||||
.ramais-table td {
|
||||
padding: 8px 10px;
|
||||
}
|
||||
}
|
58
assets/js/ramais.js
Normal file
58
assets/js/ramais.js
Normal file
@@ -0,0 +1,58 @@
|
||||
jQuery(document).ready(function($) {
|
||||
const debounceDelay = 300;
|
||||
let debounceTimer;
|
||||
|
||||
function filterRamais(page = 1) {
|
||||
clearTimeout(debounceTimer);
|
||||
|
||||
debounceTimer = setTimeout(() => {
|
||||
const search = $('#ramais-search').val();
|
||||
const secretaria = $('#ramais-secretaria').val();
|
||||
const setor = $('#ramais-setor').val();
|
||||
|
||||
$('.ramais-results').html('<p class="ramais-loading"><?php _e("Carregando...", "ramais-telefonicos"); ?></p>');
|
||||
|
||||
$.ajax({
|
||||
url: ramaisVars.ajaxurl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'filtrar_ramais',
|
||||
nonce: ramaisVars.nonce,
|
||||
search: search,
|
||||
secretaria: secretaria,
|
||||
setor: setor,
|
||||
page: page
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
$('.ramais-results').html(response.data);
|
||||
} else {
|
||||
$('.ramais-results').html('<p class="ramais-error"><?php _e("Erro ao carregar dados.", "ramais-telefonicos"); ?></p>');
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
$('.ramais-results').html('<p class="ramais-error"><?php _e("Erro na comunicação com o servidor.", "ramais-telefonicos"); ?></p>');
|
||||
}
|
||||
});
|
||||
}, debounceDelay);
|
||||
}
|
||||
|
||||
// Eventos de filtro
|
||||
$('#ramais-search').on('input', function() {
|
||||
filterRamais(1);
|
||||
});
|
||||
|
||||
$('#ramais-secretaria, #ramais-setor').on('change', function() {
|
||||
filterRamais(1);
|
||||
});
|
||||
|
||||
// Paginação
|
||||
$(document).on('click', '.ramais-page-link', function(e) {
|
||||
e.preventDefault();
|
||||
const page = $(this).data('page');
|
||||
filterRamais(page);
|
||||
});
|
||||
|
||||
// Carregamento inicial
|
||||
filterRamais(1);
|
||||
});
|
Reference in New Issue
Block a user