|
|
@@ -36,19 +36,19 @@
|
|
|
<div id="sidebar" class="sidebar-custom p-4">
|
|
|
<ul class="nav flex-column">
|
|
|
<li class="nav-item"><a class="nav-link custom-link" href="#"
|
|
|
- onclick="openModal('modalUser','http://localhost:3000/api/users','user')">Usuários</a></li>
|
|
|
+ onclick="openModal('modalUser','https://report.bcxcorretora.com.br/api/api/users','user')">Usuários</a></li>
|
|
|
<li class="nav-item"><a class="nav-link custom-link" href="#"
|
|
|
- onclick="openModal('modalItType','http://localhost:3000/api/investment-types','it-t')">Tipos
|
|
|
+ onclick="openModal('modalItType','https://report.bcxcorretora.com.br/api/api/investment-types','it-t')">Tipos
|
|
|
de Investimentos</a></li>
|
|
|
<li class="nav-item"><a class="nav-link custom-link" href="#"
|
|
|
- onclick="openModal('modalItRent','http://localhost:3000/api/investment-rentabilities','it-rent')">Rentabilidades
|
|
|
+ onclick="openModal('modalItRent','https://report.bcxcorretora.com.br/api/api/investment-rentabilities','it-rent')">Rentabilidades
|
|
|
de Investimentos</a></li>
|
|
|
<li class="nav-item"><a class="nav-link custom-link" href="#"
|
|
|
- onclick="openModal('modalFee','http://localhost:3000/api/fee','fee')">Tarifas</a></li>
|
|
|
+ onclick="openModal('modalFee','https://report.bcxcorretora.com.br/api/api/fee','fee')">Tarifas</a></li>
|
|
|
<li class="nav-item"><a class="nav-link custom-link" href="#"
|
|
|
- onclick="openModal('modalWd','http://localhost:3000/api/withdraw','wd')">Retiradas</a></li>
|
|
|
+ onclick="openModal('modalWd','https://report.bcxcorretora.com.br/api/api/withdraw','wd')">Retiradas</a></li>
|
|
|
<li class="nav-item"><a class="nav-link custom-link" href="#"
|
|
|
- onclick="openModal('modalIt','http://localhost:3000/api/investments','it')">Investimentos</a>
|
|
|
+ onclick="openModal('modalIt','https://report.bcxcorretora.com.br/api/api/investments','it')">Investimentos</a>
|
|
|
</li>
|
|
|
<div class="sidebar-bottom-logout">
|
|
|
<li class="nav-item">
|
|
|
@@ -65,7 +65,7 @@
|
|
|
<label for="inputRelatorioId">ID do Investimento:</label>
|
|
|
<input type="number" id="inputRelatorioId" class="form-control mb-3" placeholder="Ex: 2" />
|
|
|
<button class="btn btn-primary mb-2"
|
|
|
- onclick="gerarRelatorioPorId('http://localhost:3000/api/investments', 'inputRelatorioId')">
|
|
|
+ onclick="gerarRelatorioPorId('https://report.bcxcorretora.com.br/api/api/investments', 'inputRelatorioId')">
|
|
|
Gerar Relatório PDF
|
|
|
</button>
|
|
|
<br />
|
|
|
@@ -77,7 +77,7 @@
|
|
|
<div class="modal-content">
|
|
|
<div class="modal-header-actions d-flex justify-content-between mb-3">
|
|
|
<button class="btn btn-primary"
|
|
|
- onclick="adicionarItem('http://localhost:3000/api/users','user')">+</button>
|
|
|
+ onclick="adicionarItem('https://report.bcxcorretora.com.br/api/api/users','user')">+</button>
|
|
|
<span class="btn btn-danger btn-close-modal"
|
|
|
onclick="closeModal('modalUser')">×</span>
|
|
|
</div>
|
|
|
@@ -102,7 +102,7 @@
|
|
|
<div class="modal-content">
|
|
|
<div class="modal-header-actions d-flex justify-content-between mb-3">
|
|
|
<button class="btn btn-primary"
|
|
|
- onclick="adicionarItem('http://localhost:3000/api/investment-types','it-t')">+</button>
|
|
|
+ onclick="adicionarItem('https://report.bcxcorretora.com.br/api/api/investment-types','it-t')">+</button>
|
|
|
<span class="btn btn-danger btn-close-modal"
|
|
|
onclick="closeModal('modalItType')">×</span>
|
|
|
</div>
|
|
|
@@ -125,7 +125,7 @@
|
|
|
<div class="modal-content">
|
|
|
<div class="modal-header-actions d-flex justify-content-between mb-3">
|
|
|
<button class="btn btn-primary"
|
|
|
- onclick="adicionarItem('http://localhost:3000/api/investment-rentabilities','it-rent')">+</button>
|
|
|
+ onclick="adicionarItem('https://report.bcxcorretora.com.br/api/api/investment-rentabilities','it-rent')">+</button>
|
|
|
<span class="btn btn-danger btn-close-modal"
|
|
|
onclick="closeModal('modalItRent')">×</span>
|
|
|
</div>
|
|
|
@@ -151,7 +151,7 @@
|
|
|
<div class="modal-content">
|
|
|
<div class="modal-header-actions d-flex justify-content-between mb-3">
|
|
|
<button class="btn btn-primary"
|
|
|
- onclick="adicionarItem('http://localhost:3000/api/fee','fee')">+</button>
|
|
|
+ onclick="adicionarItem('https://report.bcxcorretora.com.br/api/api/fee','fee')">+</button>
|
|
|
<span class="btn btn-danger btn-close-modal" onclick="closeModal('modalFee')">×</span>
|
|
|
</div>
|
|
|
<div class="modal-body">
|
|
|
@@ -174,7 +174,7 @@
|
|
|
<div class="modal-content">
|
|
|
<div class="modal-header-actions d-flex justify-content-between mb-3">
|
|
|
<button class="btn btn-primary"
|
|
|
- onclick="adicionarItem('http://localhost:3000/api/withdraw','wd')">+</button>
|
|
|
+ onclick="adicionarItem('https://report.bcxcorretora.com.br/api/api/withdraw','wd')">+</button>
|
|
|
<span class="btn btn-danger btn-close-modal" onclick="closeModal('modalWd')">×</span>
|
|
|
</div>
|
|
|
<div class="modal-body">
|
|
|
@@ -203,7 +203,7 @@
|
|
|
<div class="modal-content">
|
|
|
<div class="modal-header-actions d-flex justify-content-between mb-3">
|
|
|
<button class="btn btn-primary"
|
|
|
- onclick="adicionarItem('http://localhost:3000/api/investments','it')">+</button>
|
|
|
+ onclick="adicionarItem('https://report.bcxcorretora.com.br/api/api/investments','it')">+</button>
|
|
|
<span class="btn btn-danger btn-close-modal" onclick="closeModal('modalIt')">×</span>
|
|
|
</div>
|
|
|
<div class="modal-body">
|
|
|
@@ -307,12 +307,12 @@
|
|
|
$('#it-rent').DataTable();
|
|
|
$('#it').DataTable();
|
|
|
|
|
|
- fetchData('http://localhost:3000/api/users', 'user');
|
|
|
- fetchData('http://localhost:3000/api/investment-types', 'it-t');
|
|
|
- fetchData('http://localhost:3000/api/investment-rentabilities', 'it-rent');
|
|
|
- fetchData('http://localhost:3000/api/investments', 'it');
|
|
|
- fetchData('http://localhost:3000/api/fee', 'fee');
|
|
|
- fetchData('http://localhost:3000/api/withdraw', 'wd');
|
|
|
+ fetchData('https://report.bcxcorretora.com.br/api/api/users', 'user');
|
|
|
+ fetchData('https://report.bcxcorretora.com.br/api/api/investment-types', 'it-t');
|
|
|
+ fetchData('https://report.bcxcorretora.com.br/api/api/investment-rentabilities', 'it-rent');
|
|
|
+ fetchData('https://report.bcxcorretora.com.br/api/api/investments', 'it');
|
|
|
+ fetchData('https://report.bcxcorretora.com.br/api/api/fee', 'fee');
|
|
|
+ fetchData('https://report.bcxcorretora.com.br/api/api/withdraw', 'wd');
|
|
|
|
|
|
$(document).on('focus', '.datepicker-input', function () {
|
|
|
if (!$(this).hasClass('hasDatepicker')) {
|
|
|
@@ -383,7 +383,7 @@
|
|
|
const colunasParaFormatar = moneyFormatMap[tableId] ?? [];
|
|
|
const dateFields = ['btcv_start_date', 'btcv_end_date', 'investment_start', 'investment_end', 'withdraws_date'];
|
|
|
if (tableId === 'it' && data.length > 0) {
|
|
|
- return fetch('http://localhost:3000/api/users')
|
|
|
+ return fetch('https://report.bcxcorretora.com.br/api/api/users')
|
|
|
.then(resp => resp.json())
|
|
|
.then(users => {
|
|
|
const userMap = new Map(users.map(user => [user.user_api_key, user.user_name]));
|
|
|
@@ -460,7 +460,7 @@
|
|
|
};
|
|
|
async function fetchInvestmentTypes() {
|
|
|
try {
|
|
|
- const response = await fetch('http://localhost:3000/api/investment-types');
|
|
|
+ const response = await fetch('https://report.bcxcorretora.com.br/api/api/investment-types');
|
|
|
if (!response.ok) throw new Error('Erro ao buscar tipos de investimento.');
|
|
|
const types = await response.json();
|
|
|
return types.map(type => type.investment_type_name);
|
|
|
@@ -472,7 +472,7 @@
|
|
|
|
|
|
async function fetchFees() {
|
|
|
try {
|
|
|
- const response = await fetch('http://localhost:3000/api/fee');
|
|
|
+ const response = await fetch('https://report.bcxcorretora.com.br/api/api/fee');
|
|
|
if (!response.ok) throw new Error('Erro ao buscar taxas.');
|
|
|
const fees = await response.json();
|
|
|
return fees.map(fee => fee.fee_id);
|
|
|
@@ -485,7 +485,7 @@
|
|
|
// Funções para buscar dados da API para os dropdowns
|
|
|
async function fetchUsers() {
|
|
|
try {
|
|
|
- const response = await fetch('http://localhost:3000/api/users');
|
|
|
+ const response = await fetch('https://report.bcxcorretora.com.br/api/api/users');
|
|
|
if (!response.ok) throw new Error('Erro ao buscar usuários.');
|
|
|
const users = await response.json();
|
|
|
return users.map(user => ({ name: user.user_name, key: user.user_api_key }));
|
|
|
@@ -827,7 +827,7 @@
|
|
|
for (const cb of selectedCheckboxes) {
|
|
|
const investmentId = cb.dataset.investmentId;
|
|
|
if (investmentId) {
|
|
|
- await gerarRelatorioPorId('http://localhost:3000/api/investments', null, investmentId);
|
|
|
+ await gerarRelatorioPorId('https://report.bcxcorretora.com.br/api/api/investments', null, investmentId);
|
|
|
}
|
|
|
}
|
|
|
alert('PDF(s) selecionado(s) gerado(s) novamente e baixado(s).');
|
|
|
@@ -988,7 +988,7 @@
|
|
|
}
|
|
|
|
|
|
async function buscarFeePorId(feeId) {
|
|
|
- const url = `http://localhost:3000/api/fee/${feeId}`;
|
|
|
+ const url = `https://report.bcxcorretora.com.br/api/api/fee/${feeId}`;
|
|
|
try {
|
|
|
const response = await fetch(url);
|
|
|
if (!response.ok) {
|
|
|
@@ -1019,7 +1019,7 @@
|
|
|
return 'Data Inválida';
|
|
|
};
|
|
|
|
|
|
- const responseSaques = await fetch(`http://localhost:3000/api/withdraw/investment/${investimento.investment_id}`);
|
|
|
+ const responseSaques = await fetch(`https://report.bcxcorretora.com.br/api/api/withdraw/investment/${investimento.investment_id}`);
|
|
|
const todosSaques = await responseSaques.json();
|
|
|
function quebraPagina(yPosAtual) {
|
|
|
const ALTURA_MAXIMA_PAGINA = 280;
|
|
|
@@ -1142,8 +1142,8 @@
|
|
|
currentRunningBalance += currentRunningBalance * (rentabilidadeDoMes / 100);
|
|
|
rendimentoAcumuladoNoMes = currentRunningBalance - initialBalanceForThisMonth;
|
|
|
|
|
|
- const btcValueStart = await fetch(`http://localhost:3000/api/btcvalues/date/${convertToISO(formatDate(mes.startDate))}`);
|
|
|
- const btcValueEnd = await fetch(`http://localhost:3000/api/btcvalues/date/${convertToISO(formatDate(mes.endDate))}`);
|
|
|
+ const btcValueStart = await fetch(`https://report.bcxcorretora.com.br/api/api/btcvalues/date/${convertToISO(formatDate(mes.startDate))}`);
|
|
|
+ const btcValueEnd = await fetch(`https://report.bcxcorretora.com.br/api/api/btcvalues/date/${convertToISO(formatDate(mes.endDate))}`);
|
|
|
|
|
|
let valorBTCStart = null;
|
|
|
if (btcValueStart.ok) {
|
|
|
@@ -1295,7 +1295,7 @@
|
|
|
// 1) Função para checar se já existe um token válido no cookie
|
|
|
(async function checkAuth() {
|
|
|
try {
|
|
|
- const resp = await fetch('http://localhost:3000/auth/me', {
|
|
|
+ const resp = await fetch('https://report.bcxcorretora.com.br/api/auth/me', {
|
|
|
method: 'GET',
|
|
|
credentials: 'include'
|
|
|
});
|
|
|
@@ -1339,7 +1339,7 @@
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- const response = await fetch('http://localhost:3000/auth/login', {
|
|
|
+ const response = await fetch('https://report.bcxcorretora.com.br/api/auth/login', {
|
|
|
method: 'POST',
|
|
|
credentials: 'include',
|
|
|
headers: { 'Content-Type': 'application/json' },
|
|
|
@@ -1365,7 +1365,7 @@
|
|
|
<script>
|
|
|
async function logout() {
|
|
|
try {
|
|
|
- const response = await fetch('http://localhost:3000/auth/logout', {
|
|
|
+ const response = await fetch('https://report.bcxcorretora.com.br/api/auth/logout', {
|
|
|
method: 'POST',
|
|
|
credentials: 'include'
|
|
|
});
|