Cobranças Recorrentes
body {
font-family: Arial, sans-serif;
margin: 20px;
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
border: 1px solid #ddd;
text-align: left;
padding: 5px;
max-width: 1cm;
word-wrap: break-word;
}
th {
background-color: #f4f4f4;
}
.actions {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
}
.actions button {
padding: 10px;
font-size: 14px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
.actions button:hover {
background-color: #0056b3;
}
.status-select {
width: 100%;
}
Nome |
Telefone |
Mensagem |
Dia do Mês |
Status |
Ações |
João |
+5511999999999 |
Olá João! Lembre-se do vencimento do contrato amanhã. |
15 |
Ativo
Encerrado
|
|
Maria |
+5511988888888 |
Maria, estamos enviando sua cadeira hoje às 14h. |
20 |
Ativo
Encerrado
|
|
function downloadCSV() {
const table = document.getElementById(‘billingTable’);
const rows = Array.from(table.rows);
let csvContent = “Nome,Telefone,Mensagem,Dia_do_Mês,Status\n”;
rows.slice(1).forEach(row => {
const cells = Array.from(row.cells);
const status = cells[4].querySelector(‘select’).value;
if (status === “Ativo”) {
const rowData = cells.slice(0, 4).map(cell => {
const text = cell.textContent.trim() || “Mensagem de exemplo”;
return text.includes(“,”) ? `”${text}”` : text;
});
rowData.push(status);
csvContent += rowData.join(“,”) + “\n”;
}
});
const blob = new Blob([csvContent], { type: ‘text/csv;charset=utf-8;’ });
const link = document.createElement(‘a’);
const url = URL.createObjectURL(blob);
link.setAttribute(‘href’, url);
link.setAttribute(‘download’, ‘cobrancas_recorrentes.csv’);
link.style.visibility = ‘hidden’;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
function addRow() {
const table = document.getElementById(‘billingTable’).querySelector(‘tbody’);
const newRow = document.createElement(‘tr’);
newRow.innerHTML = `
|
|
Mensagem de exemplo |
|
Ativo
Encerrado
|
|
`;
table.appendChild(newRow);
}
function deleteRow(button) {
const row = button.parentNode.parentNode;
row.parentNode.removeChild(row);
}