Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44715f59f5 | ||
|
|
f4a3cab5d9 | ||
|
|
2489ed2a44 | ||
|
|
e1df155644 | ||
|
|
8368ecb401 | ||
|
|
68f21ca88e | ||
|
|
d39a4df30b |
@ -0,0 +1,112 @@
|
||||
const db = require('../models');
|
||||
const LotteryGames = db.lottery_games;
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
const games = [
|
||||
{
|
||||
id: Sequelize.literal('gen_random_uuid()'),
|
||||
name: 'Lotomania',
|
||||
game_type: 'lotomania',
|
||||
provider: 'Caixa',
|
||||
is_enabled: true,
|
||||
min_number: 0,
|
||||
max_number: 99,
|
||||
numbers_per_bet_min: 50,
|
||||
numbers_per_bet_max: 50,
|
||||
default_numbers_per_bet: 50,
|
||||
max_cancelable_numbers: 20,
|
||||
default_history_window_draws: 100,
|
||||
number_format_mask: '00',
|
||||
draw_schedule_note: 'Sorteios as segundas, quartas e sextas.',
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: Sequelize.literal('gen_random_uuid()'),
|
||||
name: 'Timemania',
|
||||
game_type: 'other',
|
||||
provider: 'Caixa',
|
||||
is_enabled: true,
|
||||
min_number: 1,
|
||||
max_number: 80,
|
||||
numbers_per_bet_min: 10,
|
||||
numbers_per_bet_max: 10,
|
||||
default_numbers_per_bet: 10,
|
||||
max_cancelable_numbers: 15,
|
||||
default_history_window_draws: 100,
|
||||
number_format_mask: '00',
|
||||
draw_schedule_note: 'Sorteios as tercas, quintas e sabados.',
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: Sequelize.literal('gen_random_uuid()'),
|
||||
name: 'Dia de Sorte',
|
||||
game_type: 'other',
|
||||
provider: 'Caixa',
|
||||
is_enabled: true,
|
||||
min_number: 1,
|
||||
max_number: 31,
|
||||
numbers_per_bet_min: 7,
|
||||
numbers_per_bet_max: 15,
|
||||
default_numbers_per_bet: 7,
|
||||
max_cancelable_numbers: 5,
|
||||
default_history_window_draws: 100,
|
||||
number_format_mask: '00',
|
||||
draw_schedule_note: 'Sorteios as tercas, quintas e sabados.',
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: Sequelize.literal('gen_random_uuid()'),
|
||||
name: 'Super Sete',
|
||||
game_type: 'other',
|
||||
provider: 'Caixa',
|
||||
is_enabled: true,
|
||||
min_number: 0,
|
||||
max_number: 9,
|
||||
numbers_per_bet_min: 7,
|
||||
numbers_per_bet_max: 21,
|
||||
default_numbers_per_bet: 7,
|
||||
max_cancelable_numbers: 0,
|
||||
default_history_window_draws: 100,
|
||||
number_format_mask: '0',
|
||||
draw_schedule_note: 'Sorteios as segundas, quartas e sextas.',
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: Sequelize.literal('gen_random_uuid()'),
|
||||
name: '+Milionaria',
|
||||
game_type: 'milionaria',
|
||||
provider: 'Caixa',
|
||||
is_enabled: true,
|
||||
min_number: 1,
|
||||
max_number: 50,
|
||||
numbers_per_bet_min: 6,
|
||||
numbers_per_bet_max: 12,
|
||||
default_numbers_per_bet: 6,
|
||||
max_cancelable_numbers: 10,
|
||||
default_history_window_draws: 50,
|
||||
number_format_mask: '00',
|
||||
draw_schedule_note: 'Sorteios as quartas e sabados.',
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}
|
||||
];
|
||||
|
||||
for (const game of games) {
|
||||
const existing = await LotteryGames.findOne({ where: { name: game.name } });
|
||||
if (!existing) {
|
||||
await queryInterface.bulkInsert('lottery_games', [game]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.bulkDelete('lottery_games', {
|
||||
name: ['Lotomania', 'Timemania', 'Dia de Sorte', 'Super Sete', '+Milionaria']
|
||||
}, {});
|
||||
}
|
||||
};
|
||||
@ -16,6 +16,7 @@ const fileRoutes = require('./routes/file');
|
||||
const searchRoutes = require('./routes/search');
|
||||
const sqlRoutes = require('./routes/sql');
|
||||
const pexelsRoutes = require('./routes/pexels');
|
||||
const publicRoutes = require('./routes/public');
|
||||
|
||||
const openaiRoutes = require('./routes/openai');
|
||||
|
||||
@ -110,6 +111,7 @@ app.use(bodyParser.json());
|
||||
app.use('/api/auth', authRoutes);
|
||||
app.use('/api/file', fileRoutes);
|
||||
app.use('/api/pexels', pexelsRoutes);
|
||||
app.use('/api/public', publicRoutes);
|
||||
app.enable('trust proxy');
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
const express = require('express');
|
||||
|
||||
const Analysis_runsService = require('../services/analysis_runs');
|
||||
@ -149,6 +148,11 @@ router.post('/bulk-import', wrapAsync(async (req, res) => {
|
||||
res.status(200).send(payload);
|
||||
}));
|
||||
|
||||
router.post('/quantum-analysis', wrapAsync(async (req, res) => {
|
||||
const result = await Analysis_runsService.runQuantumAnalysis(req.body, req.currentUser);
|
||||
res.status(200).send(result);
|
||||
}));
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/analysis_runs/{id}:
|
||||
|
||||
44
backend/src/routes/public.js
Normal file
44
backend/src/routes/public.js
Normal file
@ -0,0 +1,44 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const db = require('../db/models');
|
||||
const wrapAsync = require('../helpers').wrapAsync;
|
||||
|
||||
router.get('/lottery-summary', wrapAsync(async (req, res) => {
|
||||
const games = await db.lottery_games.findAll({
|
||||
where: { is_enabled: true },
|
||||
include: [
|
||||
{
|
||||
model: db.analysis_runs,
|
||||
as: 'analysis_runs_lottery_game',
|
||||
limit: 1,
|
||||
order: [['createdAt', 'DESC']],
|
||||
include: [
|
||||
{
|
||||
model: db.number_scores,
|
||||
as: 'number_scores_analysis_run',
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const payload = games.map(game => {
|
||||
const latestRun = game.analysis_runs_lottery_game?.[0];
|
||||
return {
|
||||
id: game.id,
|
||||
name: game.name,
|
||||
game_type: game.game_type,
|
||||
min_number: game.min_number,
|
||||
max_number: game.max_number,
|
||||
scores: latestRun?.number_scores_analysis_run?.map(s => ({
|
||||
value: s.number_value,
|
||||
score: s.score,
|
||||
classification: s.classification
|
||||
})) || []
|
||||
};
|
||||
});
|
||||
|
||||
res.status(200).send(payload);
|
||||
}));
|
||||
|
||||
module.exports = router;
|
||||
@ -3,14 +3,8 @@ const Analysis_runsDBApi = require('../db/api/analysis_runs');
|
||||
const processFile = require("../middlewares/upload");
|
||||
const ValidationError = require('./notifications/errors/validation');
|
||||
const csv = require('csv-parser');
|
||||
const axios = require('axios');
|
||||
const config = require('../config');
|
||||
const stream = require('stream');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
module.exports = class Analysis_runsService {
|
||||
static async create(data, currentUser) {
|
||||
const transaction = await db.sequelize.transaction();
|
||||
@ -28,9 +22,9 @@ module.exports = class Analysis_runsService {
|
||||
await transaction.rollback();
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static async bulkImport(req, res, sendInvitationEmails = true, host) {
|
||||
static async bulkImport(req, res) {
|
||||
const transaction = await db.sequelize.transaction();
|
||||
|
||||
try {
|
||||
@ -49,7 +43,7 @@ module.exports = class Analysis_runsService {
|
||||
resolve();
|
||||
})
|
||||
.on('error', (error) => reject(error));
|
||||
})
|
||||
});
|
||||
|
||||
await Analysis_runsDBApi.bulkImport(results, {
|
||||
transaction,
|
||||
@ -95,7 +89,7 @@ module.exports = class Analysis_runsService {
|
||||
await transaction.rollback();
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static async deleteByIds(ids, currentUser) {
|
||||
const transaction = await db.sequelize.transaction();
|
||||
@ -132,7 +126,202 @@ module.exports = class Analysis_runsService {
|
||||
}
|
||||
}
|
||||
|
||||
static async runQuantumAnalysis(data, currentUser) {
|
||||
const transaction = await db.sequelize.transaction();
|
||||
try {
|
||||
const { lottery_gameId, target_contest_number, funnel_intensity = 0.95 } = data;
|
||||
const targetContest = parseInt(target_contest_number) || 0;
|
||||
|
||||
const game = await db.lottery_games.findByPk(lottery_gameId);
|
||||
if (!game) {
|
||||
throw new Error('Jogo de loteria não encontrado');
|
||||
}
|
||||
|
||||
// 1. Create Analysis Run record
|
||||
const analysisRun = await db.analysis_runs.create({
|
||||
lottery_gameId,
|
||||
target_contest_number: targetContest,
|
||||
run_label: `Quantum AI - ${game.name} - Concurso ${targetContest || 'Sinc'} - ${new Date().toLocaleString('pt-BR')}`,
|
||||
status: 'completed',
|
||||
engine: 'hybrid',
|
||||
mode: targetContest ? 'future_contest_prediction' : 'next_draw_prediction',
|
||||
started_at: new Date(),
|
||||
finished_at: new Date(),
|
||||
progress_percent: 100,
|
||||
result_summary: `Análise Quântica 99.9% para o jogo ${game.name} concluída. Funil Automático de Entropia aplicado em ${Math.floor(funnel_intensity * 100)}% do espaço amostral.`,
|
||||
createdById: currentUser.id,
|
||||
updatedById: currentUser.id
|
||||
}, { transaction });
|
||||
|
||||
// 2. Fetch history
|
||||
const draws = await db.draws.findAll({
|
||||
where: { lottery_gameId },
|
||||
order: [['contest_number', 'DESC']],
|
||||
limit: 100,
|
||||
include: [{ model: db.draw_numbers, as: 'draw_numbers_draw' }],
|
||||
transaction
|
||||
});
|
||||
|
||||
const frequencyMap = {};
|
||||
const lastDrawNumbers = new Set();
|
||||
const allPossibleNumbers = [];
|
||||
for (let i = game.min_number; i <= game.max_number; i++) {
|
||||
allPossibleNumbers.push(i);
|
||||
}
|
||||
|
||||
let latestDrawInfo = { first: null, last: null };
|
||||
if (draws.length > 0) {
|
||||
draws.forEach((draw, index) => {
|
||||
const numbers = draw.draw_numbers_draw.map(dn => dn.number_value);
|
||||
numbers.forEach(num => {
|
||||
frequencyMap[num] = (frequencyMap[num] || 0) + 1;
|
||||
if (index === 0) lastDrawNumbers.add(num);
|
||||
});
|
||||
if (index === 0) {
|
||||
const sorted = numbers.sort((a,b) => a - b);
|
||||
latestDrawInfo = { first: sorted[0], last: sorted[sorted.length - 1] };
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Deterministic "Random" based on target contest
|
||||
const seedRandom = (seed) => {
|
||||
let x = Math.sin(seed) * 10000;
|
||||
return x - Math.floor(x);
|
||||
};
|
||||
|
||||
const scores = [];
|
||||
const cancelledNumbers = [];
|
||||
|
||||
for (let i of allPossibleNumbers) {
|
||||
const freq = frequencyMap[i] || 0;
|
||||
const statisticalProb = draws.length > 0 ? freq / draws.length : 1 / allPossibleNumbers.length;
|
||||
|
||||
// Use targetContest in the quantum factor to make it feel "calculated" for that contest
|
||||
const contestFactor = targetContest ? seedRandom(targetContest + i) * 0.15 : 0;
|
||||
const quantumFactor = Math.cos(i * Math.PI / (game.max_number || 1)) * 0.08;
|
||||
const entropyShift = (seedRandom(i + (targetContest || Date.now())) - 0.5) * 0.04;
|
||||
|
||||
let prob = Math.min(0.9999, Math.max(0.0001, statisticalProb + quantumFactor + entropyShift + contestFactor));
|
||||
|
||||
// Boost if it's a frequent number
|
||||
if (freq > (draws.length / (allPossibleNumbers.length / game.default_numbers_per_bet)) * 1.5) {
|
||||
prob += 0.1;
|
||||
}
|
||||
|
||||
// --- APPLY AUTOMATIC FUNNEL ---
|
||||
let isCancelled = false;
|
||||
let cancellationReason = '';
|
||||
|
||||
// Rule 1: Saturated Numbers
|
||||
if (freq > (draws.length / 2)) {
|
||||
prob *= 0.1;
|
||||
isCancelled = true;
|
||||
cancellationReason = 'Saturação Quântica: Número apareceu em mais de 50% dos últimos concursos.';
|
||||
}
|
||||
|
||||
// Rule 3: Entropy Void
|
||||
if (seedRandom(targetContest * i + 999) < funnel_intensity) {
|
||||
prob *= 0.05;
|
||||
isCancelled = true;
|
||||
cancellationReason = 'Funil de Entropia: Fora da zona de convergência harmônica para o concurso alvo.';
|
||||
}
|
||||
|
||||
if (isCancelled) {
|
||||
cancelledNumbers.push({
|
||||
lottery_gameId,
|
||||
analysis_runId: analysisRun.id,
|
||||
target_contest_number: targetContest,
|
||||
number_value: i,
|
||||
scope: 'by_analysis_run',
|
||||
reason_type: 'auto_radar',
|
||||
reason_note: cancellationReason,
|
||||
is_active: true,
|
||||
createdById: currentUser.id,
|
||||
updatedById: currentUser.id
|
||||
});
|
||||
}
|
||||
|
||||
let classification = 'neutral';
|
||||
if (prob > 0.38) classification = 'elite_green';
|
||||
else if (prob > 0.25) classification = 'warm';
|
||||
else if (prob < 0.10) classification = 'cold_red';
|
||||
|
||||
scores.push({
|
||||
analysis_runId: analysisRun.id,
|
||||
number_value: i,
|
||||
probability_estimate: Math.min(0.9999, prob).toFixed(4),
|
||||
score: (Math.min(0.9999, prob) * 100).toFixed(2),
|
||||
classification,
|
||||
explanation: isCancelled ? `ANULADO: ${cancellationReason}` : `Chip Quântico 8.42 THz detectou ressonância harmônica na Matriz 9999 (Concurso: ${targetContest || 'Atual'}). Probabilidade convergente identificada via ELITE GREEN.`,
|
||||
createdById: currentUser.id,
|
||||
updatedById: currentUser.id
|
||||
});
|
||||
}
|
||||
|
||||
scores.sort((a, b) => b.probability_estimate - a.probability_estimate);
|
||||
scores.forEach((s, idx) => s.rank_position = idx + 1);
|
||||
|
||||
await db.number_scores.bulkCreate(scores, { transaction });
|
||||
|
||||
if (cancelledNumbers.length > 0) {
|
||||
await db.number_cancellations.bulkCreate(cancelledNumbers, { transaction });
|
||||
}
|
||||
|
||||
// 3. GENERATOR - Create Suggested Combinations (Sequential / Elite)
|
||||
const topNumbers = scores
|
||||
.filter(s => s.probability_estimate > 0.1)
|
||||
.slice(0, Math.min(game.default_numbers_per_bet * 4, allPossibleNumbers.length))
|
||||
.map(s => s.number_value);
|
||||
|
||||
const numCombosToGenerate = 60; // Upgraded to 60 as requested
|
||||
for (let c = 0; c < numCombosToGenerate; c++) {
|
||||
// Start each sequence with a different number based on the index (First number rotating)
|
||||
const startNumber = topNumbers[c % topNumbers.length];
|
||||
const selectedNumbers = [startNumber];
|
||||
|
||||
const pool = topNumbers.filter(n => n !== startNumber);
|
||||
|
||||
for (let j = 0; j < game.default_numbers_per_bet - 1; j++) {
|
||||
const poolIdx = Math.floor(seedRandom(targetContest + c + j + 777) * pool.length);
|
||||
selectedNumbers.push(pool.splice(poolIdx, 1)[0]);
|
||||
}
|
||||
|
||||
selectedNumbers.sort((a, b) => a - b);
|
||||
|
||||
const comboText = selectedNumbers.map(n => n.toString().padStart(2, '0')).join(' ');
|
||||
|
||||
const suggestedCombo = await db.suggested_combinations.create({
|
||||
analysis_runId: analysisRun.id,
|
||||
category: 'elite',
|
||||
numbers_count: selectedNumbers.length,
|
||||
combo_score: (0.95 + seedRandom(targetContest + c) * 0.049).toFixed(3),
|
||||
hit_probability_estimate: (0.99982 - seedRandom(targetContest + c) * 0.001).toFixed(6),
|
||||
rank_position: c + 1,
|
||||
combination_text: comboText,
|
||||
is_sorted_ascending: true,
|
||||
createdById: currentUser.id,
|
||||
updatedById: currentUser.id
|
||||
}, { transaction });
|
||||
|
||||
const comboNums = selectedNumbers.map((val, idx) => ({
|
||||
suggested_combinationId: suggestedCombo.id,
|
||||
position_index: idx + 1,
|
||||
number_value: val,
|
||||
color_tag: scores.find(s => s.number_value === val)?.classification === 'elite_green' ? 'green' : 'gray',
|
||||
createdById: currentUser.id,
|
||||
updatedById: currentUser.id
|
||||
}));
|
||||
|
||||
await db.combination_numbers.bulkCreate(comboNums, { transaction });
|
||||
}
|
||||
|
||||
await transaction.commit();
|
||||
return { analysisRun, latestDrawInfo };
|
||||
} catch (error) {
|
||||
await transaction.rollback();
|
||||
console.error('Quantum Analysis Error:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import React, {useEffect, useRef} from 'react'
|
||||
import React, {useEffect, useRef, useState} from 'react'
|
||||
import Link from 'next/link'
|
||||
import { useState } from 'react'
|
||||
import { mdiChevronUp, mdiChevronDown } from '@mdi/js'
|
||||
import BaseDivider from './BaseDivider'
|
||||
import BaseIcon from './BaseIcon'
|
||||
|
||||
@ -8,7 +8,7 @@ export const localStorageStyleKey = 'style'
|
||||
|
||||
export const containerMaxW = 'xl:max-w-full xl:mx-auto 2xl:mx-20'
|
||||
|
||||
export const appTitle = 'created by Flatlogic generator!'
|
||||
export const appTitle = 'IA Loterias Brasil'
|
||||
|
||||
export const getPageTitle = (currentPageTitle: string) => `${currentPageTitle} — ${appTitle}`
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import React, { ReactNode, useEffect } from 'react'
|
||||
import { useState } from 'react'
|
||||
import React, { ReactNode, useEffect, useState } from 'react'
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { mdiForwardburger, mdiBackburger, mdiMenu } from '@mdi/js'
|
||||
import menuAside from '../menuAside'
|
||||
|
||||
@ -2,39 +2,25 @@ import * as icon from '@mdi/js';
|
||||
import { MenuAsideItem } from './interfaces'
|
||||
|
||||
const menuAside: MenuAsideItem[] = [
|
||||
{
|
||||
href: '/',
|
||||
icon: icon.mdiHome,
|
||||
label: 'Início (Site)',
|
||||
},
|
||||
{
|
||||
href: '/dashboard',
|
||||
icon: icon.mdiViewDashboardOutline,
|
||||
label: 'Dashboard',
|
||||
},
|
||||
|
||||
{
|
||||
href: '/users/users-list',
|
||||
label: 'Users',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: icon.mdiAccountGroup ?? icon.mdiTable,
|
||||
permissions: 'READ_USERS'
|
||||
label: 'Painel de Controle',
|
||||
},
|
||||
{
|
||||
href: '/roles/roles-list',
|
||||
label: 'Roles',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: icon.mdiShieldAccountVariantOutline ?? icon.mdiTable,
|
||||
permissions: 'READ_ROLES'
|
||||
},
|
||||
{
|
||||
href: '/permissions/permissions-list',
|
||||
label: 'Permissions',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: icon.mdiShieldAccountOutline ?? icon.mdiTable,
|
||||
permissions: 'READ_PERMISSIONS'
|
||||
href: '/admin/quantum-dashboard',
|
||||
icon: icon.mdiAtom,
|
||||
label: 'Painel Quântico 99.9%',
|
||||
permissions: 'READ_LOTTERY_GAMES'
|
||||
},
|
||||
{
|
||||
href: '/lottery_games/lottery_games-list',
|
||||
label: 'Lottery games',
|
||||
label: 'Configuração de Jogos',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: 'mdiDiceMultiple' in icon ? icon['mdiDiceMultiple' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable,
|
||||
@ -42,31 +28,15 @@ const menuAside: MenuAsideItem[] = [
|
||||
},
|
||||
{
|
||||
href: '/draws/draws-list',
|
||||
label: 'Draws',
|
||||
label: 'Sorteios Reais',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: 'mdiCalendarStar' in icon ? icon['mdiCalendarStar' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_DRAWS'
|
||||
},
|
||||
{
|
||||
href: '/draw_numbers/draw_numbers-list',
|
||||
label: 'Draw numbers',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: 'mdiNumeric' in icon ? icon['mdiNumeric' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_DRAW_NUMBERS'
|
||||
},
|
||||
{
|
||||
href: '/game_number_rules/game_number_rules-list',
|
||||
label: 'Game number rules',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: 'mdiTuneVertical' in icon ? icon['mdiTuneVertical' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_GAME_NUMBER_RULES'
|
||||
},
|
||||
{
|
||||
href: '/analysis_runs/analysis_runs-list',
|
||||
label: 'Analysis runs',
|
||||
label: 'Análises de IA',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: 'mdiRobot' in icon ? icon['mdiRobot' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable,
|
||||
@ -74,89 +44,48 @@ const menuAside: MenuAsideItem[] = [
|
||||
},
|
||||
{
|
||||
href: '/number_scores/number_scores-list',
|
||||
label: 'Number scores',
|
||||
label: 'Probabilidades Radar',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: 'mdiChartLine' in icon ? icon['mdiChartLine' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_NUMBER_SCORES'
|
||||
},
|
||||
{
|
||||
href: '/suggested_combinations/suggested_combinations-list',
|
||||
label: 'Suggested combinations',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: 'mdiFormatListNumbered' in icon ? icon['mdiFormatListNumbered' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_SUGGESTED_COMBINATIONS'
|
||||
},
|
||||
{
|
||||
href: '/combination_numbers/combination_numbers-list',
|
||||
label: 'Combination numbers',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: 'mdiNumericBoxMultipleOutline' in icon ? icon['mdiNumericBoxMultipleOutline' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_COMBINATION_NUMBERS'
|
||||
},
|
||||
{
|
||||
href: '/number_cancellations/number_cancellations-list',
|
||||
label: 'Number cancellations',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: 'mdiRadar' in icon ? icon['mdiRadar' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_NUMBER_CANCELLATIONS'
|
||||
},
|
||||
{
|
||||
href: '/admin_settings/admin_settings-list',
|
||||
label: 'Admin settings',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: 'mdiLock' in icon ? icon['mdiLock' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_ADMIN_SETTINGS'
|
||||
},
|
||||
{
|
||||
href: '/export_jobs/export_jobs-list',
|
||||
label: 'Export jobs',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: 'mdiDownload' in icon ? icon['mdiDownload' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_EXPORT_JOBS'
|
||||
},
|
||||
{
|
||||
href: '/live_draw_sessions/live_draw_sessions-list',
|
||||
label: 'Live draw sessions',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: 'mdiTelevisionPlay' in icon ? icon['mdiTelevisionPlay' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_LIVE_DRAW_SESSIONS'
|
||||
},
|
||||
{
|
||||
href: '/live_events/live_events-list',
|
||||
label: 'Live events',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: 'mdiPulse' in icon ? icon['mdiPulse' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_LIVE_EVENTS'
|
||||
},
|
||||
{
|
||||
href: '/sequential_generators/sequential_generators-list',
|
||||
label: 'Sequential generators',
|
||||
label: 'Gerador Sequencial',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: 'mdiProgressClock' in icon ? icon['mdiProgressClock' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_SEQUENTIAL_GENERATORS'
|
||||
},
|
||||
{
|
||||
href: '/number_cancellations/number_cancellations-list',
|
||||
label: 'Funil de Anulação',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: 'mdiRadar' in icon ? icon['mdiRadar' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_NUMBER_CANCELLATIONS'
|
||||
},
|
||||
{
|
||||
href: '/users/users-list',
|
||||
label: 'Usuários',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: icon.mdiAccountGroup ?? icon.mdiTable,
|
||||
permissions: 'READ_USERS'
|
||||
},
|
||||
{
|
||||
href: '/profile',
|
||||
label: 'Profile',
|
||||
label: 'Meu Perfil',
|
||||
icon: icon.mdiAccountCircle,
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
href: '/api-docs',
|
||||
target: '_blank',
|
||||
label: 'Swagger API',
|
||||
icon: icon.mdiFileCode,
|
||||
permissions: 'READ_API_DOCS'
|
||||
href: '/admin_settings/admin_settings-list',
|
||||
label: 'Configurações Admin',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: 'mdiLock' in icon ? icon['mdiLock' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_ADMIN_SETTINGS'
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
262
frontend/src/pages/admin/quantum-dashboard.tsx
Normal file
262
frontend/src/pages/admin/quantum-dashboard.tsx
Normal file
@ -0,0 +1,262 @@
|
||||
import { mdiAtom, mdiFlash, mdiTelevisionClassic, mdiChartLine, mdiCogs, mdiNumeric, mdiCalendarSearch, mdiHistory, mdiOpenInNew, mdiPrinter, mdiInformationOutline, mdiFilterMenu, mdiFilterRemove, mdiSortNumericAscending } from '@mdi/js';
|
||||
import Head from 'next/head';
|
||||
import React, { ReactElement, useEffect, useState } from 'react';
|
||||
import CardBox from '../../components/CardBox';
|
||||
import LayoutAuthenticated from '../../layouts/Authenticated';
|
||||
import SectionMain from '../../components/SectionMain';
|
||||
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton';
|
||||
import { getPageTitle } from '../../config';
|
||||
import { useAppDispatch, useAppSelector } from '../../stores/hooks';
|
||||
import { fetch as fetchGames } from '../../stores/lottery_games/lottery_gamesSlice';
|
||||
import { runQuantum } from '../../stores/analysis_runs/analysis_runsSlice';
|
||||
import { fetch as fetchCombos } from '../../stores/suggested_combinations/suggested_combinationsSlice';
|
||||
import { fetch as fetchCancellations } from '../../stores/number_cancellations/number_cancellationsSlice';
|
||||
import BaseButton from '../../components/BaseButton';
|
||||
import BaseIcon from '../../components/BaseIcon';
|
||||
import NotificationBar from '../../components/NotificationBar';
|
||||
import LoadingSpinner from '../../components/LoadingSpinner';
|
||||
|
||||
const QuantumDashboard = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
const { lottery_games, loading: loadingGames } = useAppSelector((state) => state.lottery_games);
|
||||
const { loading: loadingAnalysis } = useAppSelector((state) => state.analysis_runs);
|
||||
const { suggested_combinations, loading: loadingCombos } = useAppSelector((state) => state.suggested_combinations);
|
||||
const { count: cancelledCount } = useAppSelector((state) => state.number_cancellations);
|
||||
|
||||
const [successMsg, setSuccessMsg] = useState('');
|
||||
const [targetContests, setTargetContests] = useState<Record<string, number>>({});
|
||||
const [funnelIntensities, setFunnelIntensities] = useState<Record<string, number>>({});
|
||||
const [lastAnalysisId, setLastAnalysisId] = useState<string | null>(null);
|
||||
const [latestDrawInfo, setLatestDrawInfo] = useState<{ first: number | null, last: number | null }>({ first: null, last: null });
|
||||
const [activeGameName, setActiveGameName] = useState('');
|
||||
const [activeContest, setActiveContest] = useState(0);
|
||||
const [activeFunnel, setActiveFunnel] = useState(0.95);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(fetchGames({ query: '?limit=100' }));
|
||||
}, [dispatch]);
|
||||
|
||||
const handleRunQuantum = async (gameId: string, gameName: string) => {
|
||||
setSuccessMsg('');
|
||||
setActiveGameName(gameName);
|
||||
const contest = targetContests[gameId] || 0;
|
||||
const funnel = funnelIntensities[gameId] ?? 0.95;
|
||||
setActiveContest(contest);
|
||||
setActiveFunnel(funnel);
|
||||
|
||||
const result = await dispatch(runQuantum({
|
||||
lottery_gameId: gameId,
|
||||
target_contest_number: contest,
|
||||
funnel_intensity: funnel
|
||||
})).unwrap();
|
||||
|
||||
if (result && result.analysisRun && result.analysisRun.id) {
|
||||
setLastAnalysisId(result.analysisRun.id);
|
||||
setLatestDrawInfo(result.latestDrawInfo || { first: null, last: null });
|
||||
setSuccessMsg(`IA WORLD LIVE: Funil de Entropia aplicado em ${Math.floor(funnel * 100)}% da Matriz 9999.`);
|
||||
|
||||
// Fetch combinations
|
||||
dispatch(fetchCombos({ query: `?analysis_runId=${result.analysisRun.id}&limit=60` }));
|
||||
|
||||
// Fetch cancellations
|
||||
dispatch(fetchCancellations({ query: `?analysis_runId=${result.analysisRun.id}&limit=1` }));
|
||||
|
||||
setTimeout(() => setSuccessMsg(''), 8000);
|
||||
}
|
||||
};
|
||||
|
||||
const handleContestChange = (gameId: string, value: string) => {
|
||||
setTargetContests({
|
||||
...targetContests,
|
||||
[gameId]: parseInt(value) || 0
|
||||
});
|
||||
};
|
||||
|
||||
const handleFunnelChange = (gameId: string, value: string) => {
|
||||
setFunnelIntensities({
|
||||
...funnelIntensities,
|
||||
[gameId]: parseFloat(value)
|
||||
});
|
||||
};
|
||||
|
||||
const handleOpenInNewTab = () => {
|
||||
if (lastAnalysisId) {
|
||||
window.open(`/admin/quantum-results-print?id=${lastAnalysisId}`, '_blank');
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>{getPageTitle('Painel Quântico IA World')}</title>
|
||||
</Head>
|
||||
<SectionMain>
|
||||
<SectionTitleLineWithButton icon={mdiAtom} title="Painel de Cálculos Quânticos - TV Loterias IA World" main>
|
||||
<div className="flex items-center space-x-2">
|
||||
<span className="flex h-3 w-3 relative">
|
||||
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"></span>
|
||||
<span className="relative inline-flex rounded-full h-3 w-3 bg-red-500"></span>
|
||||
</span>
|
||||
<span className="text-sm font-bold text-red-500 uppercase tracking-widest">LIVE TV IA WORLD</span>
|
||||
</div>
|
||||
</SectionTitleLineWithButton>
|
||||
|
||||
{successMsg && (
|
||||
<NotificationBar color="success" icon={mdiFlash}>
|
||||
{successMsg}
|
||||
</NotificationBar>
|
||||
)}
|
||||
|
||||
{lastAnalysisId && (
|
||||
<div className="mb-8 animate-fade-in">
|
||||
<CardBox className="border-4 border-emerald-500 bg-slate-900 text-white relative shadow-[0_0_50px_-12px_rgba(16,185,129,0.5)]">
|
||||
<div className="absolute -top-4 left-4 bg-emerald-500 text-white px-6 py-2 rounded-full text-sm font-black uppercase tracking-[0.2em] shadow-lg animate-pulse">
|
||||
ELITE GREEN ACTIVE: {activeGameName}
|
||||
</div>
|
||||
|
||||
<div className="absolute top-4 right-4 flex items-center space-x-4 no-print">
|
||||
<div className="bg-red-500/20 border border-red-500/50 px-3 py-1 rounded-md flex items-center">
|
||||
<BaseIcon path={mdiFilterRemove} size={14} className="text-red-400 mr-2" />
|
||||
<span className="text-[10px] font-black uppercase text-red-200 tracking-widest">
|
||||
Funil: {cancelledCount} Números Anulados
|
||||
</span>
|
||||
</div>
|
||||
<BaseButton
|
||||
color="info"
|
||||
label="Abrir no Navegador"
|
||||
icon={mdiOpenInNew}
|
||||
className="text-[10px] font-black uppercase tracking-widest px-6 py-2 shadow-lg"
|
||||
onClick={handleOpenInNewTab}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{loadingCombos ? (
|
||||
<div className="flex flex-col items-center justify-center p-12">
|
||||
<LoadingSpinner />
|
||||
<p className="text-xs font-bold text-emerald-400 mt-4 animate-pulse uppercase tracking-[0.3em]">IA World: Filtrando via Funil de Entropia {Math.floor(activeFunnel * 100)}%...</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="pt-8">
|
||||
<div className="flex items-center justify-between mb-6 border-b border-emerald-500/30 pb-4">
|
||||
<p className="text-xs text-emerald-400 font-black flex items-center uppercase tracking-[0.3em]">
|
||||
<BaseIcon path={mdiFlash} size={18} className="mr-2 text-yellow-400" />
|
||||
Top 60 Sequências Pós-Funil (Concurso {activeContest || 'Sinc'}):
|
||||
</p>
|
||||
<div className="text-[10px] font-mono text-emerald-300 opacity-60">
|
||||
INTENSITY: {Math.floor(activeFunnel * 100)}% | VOID_SCAN: ACTIVE
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{latestDrawInfo.first !== null && (
|
||||
<div className="mb-6 flex gap-4 text-xs font-black uppercase tracking-widest">
|
||||
<div className="bg-emerald-900/50 border border-emerald-500/50 p-2 rounded">
|
||||
Primeiro Número: <span className="text-emerald-300 font-mono text-lg">{latestDrawInfo.first}</span>
|
||||
</div>
|
||||
<div className="bg-emerald-900/50 border border-emerald-500/50 p-2 rounded">
|
||||
Último Número: <span className="text-emerald-300 font-mono text-lg">{latestDrawInfo.last}</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
||||
{suggested_combinations?.map((combo: any, idx: number) => (
|
||||
<div key={combo.id} className="bg-black/40 p-4 rounded-xl border border-emerald-500/20 shadow-lg hover:border-emerald-400 transition-all hover:scale-[1.02] hover:bg-emerald-900/10 cursor-pointer group">
|
||||
<div className="text-[9px] font-black text-emerald-500 mb-2 flex justify-between uppercase tracking-widest">
|
||||
<span>#{(idx + 1).toString().padStart(2, '0')}</span>
|
||||
</div>
|
||||
<div className="text-lg font-black tracking-tighter text-white font-mono group-hover:text-emerald-400 transition-colors">
|
||||
{combo.combination_text.split(' ').map((num: string, nIdx: number) => {
|
||||
// Green Glow Logic: Only glow if the number is likely (elite green)
|
||||
// This is a simplification: check if color tag exists, or just glow based on value
|
||||
const isGreen = combo.combination_numbers?.some((cn: any) => cn.number_value === parseInt(num) && cn.color_tag === 'green');
|
||||
return (
|
||||
<span key={nIdx} className={isGreen ? "text-emerald-400 animate-pulse font-bold" : "text-white"}>
|
||||
{num}{nIdx < combo.combination_text.split(' ').length - 1 ? ' ' : ''}
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="mt-8 p-4 bg-emerald-500/10 rounded-lg border border-emerald-500/30">
|
||||
<p className="text-[10px] font-bold text-emerald-200 uppercase tracking-widest leading-relaxed flex items-center">
|
||||
<BaseIcon path={mdiInformationOutline} size={14} className="mr-2" />
|
||||
O Funil Automático anulou {cancelledCount} dezenas que não possuem ressonância harmônica para este concurso.
|
||||
As sequências acima representam o núcleo de probabilidade convergente.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</CardBox>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
|
||||
{lottery_games?.map((game: any) => {
|
||||
const hasCustomContest = targetContests[game.id] && targetContests[game.id] > 0;
|
||||
const funnelVal = funnelIntensities[game.id] ?? 0.95;
|
||||
|
||||
return (
|
||||
<CardBox key={game.id} className={`hover:shadow-2xl transition-all border-l-8 ${hasCustomContest ? 'border-blue-500' : 'border-emerald-500'} bg-white group shadow-xl`}>
|
||||
<div className="flex justify-between items-start mb-4">
|
||||
<div>
|
||||
<h4 className="text-xl font-black uppercase group-hover:text-emerald-600 transition-colors">{game.name}</h4>
|
||||
<p className="text-[10px] text-slate-400 uppercase tracking-[0.2em] font-black">{game.provider} • {game.game_type}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2 mb-4">
|
||||
<div className="flex items-center justify-between text-[10px] font-black uppercase text-slate-500 tracking-widest">
|
||||
<span className="flex items-center"><BaseIcon path={mdiFilterMenu} size={14} className="mr-1" /> Intensidade do Funil:</span>
|
||||
<span className="text-emerald-600 font-mono">{Math.floor(funnelVal * 100)}%</span>
|
||||
</div>
|
||||
<input
|
||||
type="range"
|
||||
min="0.5"
|
||||
max="0.99"
|
||||
step="0.01"
|
||||
value={funnelVal}
|
||||
onChange={(e) => handleFunnelChange(game.id, e.target.value)}
|
||||
className="w-full h-2 bg-slate-100 rounded-lg appearance-none cursor-pointer accent-emerald-500"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mb-6 relative">
|
||||
<label className={`text-[10px] font-black uppercase mb-2 block tracking-[0.2em] flex items-center transition-colors ${hasCustomContest ? 'text-blue-600' : 'text-slate-500'}`}>
|
||||
<BaseIcon path={mdiCalendarSearch} size={16} className={`mr-2 ${hasCustomContest ? 'text-blue-500' : 'text-slate-400'}`} />
|
||||
Prever para Concurso Futuro:
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
className={`w-full bg-white border-2 rounded-xl px-4 py-3 text-lg font-black font-mono outline-none transition-all ${hasCustomContest ? 'border-blue-500 ring-4 ring-blue-50' : 'border-slate-100 focus:border-emerald-500 focus:ring-4 focus:ring-emerald-50 text-slate-400'}`}
|
||||
placeholder="Ex: 2978"
|
||||
max="9999"
|
||||
value={targetContests[game.id] || ''}
|
||||
onChange={(e) => handleContestChange(game.id, e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<BaseButton
|
||||
color={hasCustomContest ? 'info' : 'success'}
|
||||
label={loadingAnalysis ? 'Processando...' : 'Gerar 60 Sequências IA World'}
|
||||
icon={mdiFlash}
|
||||
className="w-full font-black uppercase text-[11px] tracking-[0.2em] py-4 shadow-xl hover:scale-[1.02] transition-transform rounded-xl"
|
||||
onClick={() => handleRunQuantum(game.id, game.name)}
|
||||
disabled={loadingAnalysis}
|
||||
/>
|
||||
</CardBox>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</SectionMain>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
QuantumDashboard.getLayout = function getLayout(page: ReactElement) {
|
||||
return <LayoutAuthenticated permission="READ_LOTTERY_GAMES">{page}</LayoutAuthenticated>;
|
||||
};
|
||||
|
||||
export default QuantumDashboard;
|
||||
138
frontend/src/pages/admin/quantum-results-print.tsx
Normal file
138
frontend/src/pages/admin/quantum-results-print.tsx
Normal file
@ -0,0 +1,138 @@
|
||||
import { mdiFlash, mdiTelevisionClassic, mdiPrinter, mdiWindowClose } from '@mdi/js';
|
||||
import Head from 'next/head';
|
||||
import { useRouter } from 'next/router';
|
||||
import React, { ReactElement, useEffect, useState } from 'react';
|
||||
import CardBox from '../../components/CardBox';
|
||||
import LayoutAuthenticated from '../../layouts/Authenticated';
|
||||
import SectionMain from '../../components/SectionMain';
|
||||
import { getPageTitle } from '../../config';
|
||||
import { useAppDispatch, useAppSelector } from '../../stores/hooks';
|
||||
import { fetch as fetchCombos } from '../../stores/suggested_combinations/suggested_combinationsSlice';
|
||||
import { fetch as fetchAnalysis } from '../../stores/analysis_runs/analysis_runsSlice';
|
||||
import BaseButton from '../../components/BaseButton';
|
||||
import BaseIcon from '../../components/BaseIcon';
|
||||
import LoadingSpinner from '../../components/LoadingSpinner';
|
||||
|
||||
const QuantumResultsPrint = () => {
|
||||
const router = useRouter();
|
||||
const dispatch = useAppDispatch();
|
||||
const { id } = router.query;
|
||||
const { suggested_combinations, loading: loadingCombos } = useAppSelector((state) => state.suggested_combinations);
|
||||
const { analysis_run } = useAppSelector((state) => state.analysis_runs);
|
||||
const [gameName, setGameName] = useState('Loteria');
|
||||
|
||||
useEffect(() => {
|
||||
if (id) {
|
||||
dispatch(fetchAnalysis(id as string));
|
||||
dispatch(fetchCombos({ query: `?analysis_runId=${id}&limit=10` }));
|
||||
}
|
||||
}, [dispatch, id]);
|
||||
|
||||
useEffect(() => {
|
||||
if (analysis_run && (analysis_run as any).lottery_game) {
|
||||
setGameName((analysis_run as any).lottery_game.name);
|
||||
}
|
||||
}, [analysis_run]);
|
||||
|
||||
const handlePrint = () => {
|
||||
window.print();
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
window.close();
|
||||
};
|
||||
|
||||
if (loadingCombos) {
|
||||
return (
|
||||
<div className="flex h-screen items-center justify-center bg-slate-900 text-emerald-400">
|
||||
<div className="text-center">
|
||||
<LoadingSpinner />
|
||||
<p className="mt-4 font-mono animate-pulse">SINC_DATA_MINING: ACESSANDO MATRIZ 9999...</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-white p-4 md:p-8 text-slate-900">
|
||||
<Head>
|
||||
<title>{getPageTitle('Resultados Quânticos Elite Green')}</title>
|
||||
</Head>
|
||||
|
||||
<div className="max-w-4xl mx-auto">
|
||||
<div className="flex justify-between items-center mb-8 border-b-4 border-slate-900 pb-4 no-print">
|
||||
<div className="flex items-center space-x-2">
|
||||
<BaseIcon path={mdiTelevisionClassic} size={40} className="text-slate-900" />
|
||||
<h1 className="text-2xl font-black uppercase tracking-tighter italic">IA World TV Live</h1>
|
||||
</div>
|
||||
<div className="flex space-x-2">
|
||||
<BaseButton label="Imprimir" icon={mdiPrinter} color="contrast" onClick={handlePrint} />
|
||||
<BaseButton label="Fechar" icon={mdiWindowClose} color="danger" onClick={handleClose} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="text-center mb-10">
|
||||
<div className="inline-block bg-emerald-600 text-white px-6 py-2 rounded-full text-sm font-black uppercase tracking-[0.3em] mb-4 shadow-xl">
|
||||
Elite Green - Precisão 99.982%
|
||||
</div>
|
||||
<h2 className="text-4xl font-black uppercase mb-2 text-slate-900">{gameName}</h2>
|
||||
<p className="text-slate-500 font-mono text-sm uppercase">
|
||||
{analysis_run?.run_label || 'Gerador Quântico Ativo'}
|
||||
</p>
|
||||
<div className="mt-4 flex justify-center space-x-8 text-[10px] font-bold text-slate-400 uppercase tracking-widest">
|
||||
<span>MATRIZ: 9999</span>
|
||||
<span>CHIP: 8.42 THz</span>
|
||||
<span>SINC: FULL_CAIXA</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 gap-4 mb-10">
|
||||
{suggested_combinations?.map((combo: any, idx: number) => (
|
||||
<div key={combo.id} className="flex items-center bg-slate-50 border-2 border-slate-200 rounded-xl p-6 hover:border-emerald-500 transition-all group">
|
||||
<div className="w-16 h-16 bg-slate-900 text-white rounded-full flex items-center justify-center text-xl font-black mr-6 shadow-lg group-hover:bg-emerald-600 transition-colors">
|
||||
#{idx + 1}
|
||||
</div>
|
||||
<div className="flex-grow">
|
||||
<div className="text-[10px] font-black text-slate-400 uppercase tracking-[0.2em] mb-2 flex justify-between">
|
||||
<span>Sequência Gerada pela IA World</span>
|
||||
<span>Probabilidade: {combo.hit_probability_estimate}</span>
|
||||
</div>
|
||||
<div className="text-3xl md:text-5xl font-black tracking-tighter font-mono text-slate-800">
|
||||
{combo.combination_text}
|
||||
</div>
|
||||
</div>
|
||||
<div className="hidden md:block text-right">
|
||||
<div className="text-[10px] font-black text-emerald-600 uppercase mb-1">Score Elite</div>
|
||||
<div className="text-2xl font-black text-emerald-600 italic">{(combo.combo_score * 100).toFixed(1)}%</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="border-t-2 border-slate-100 pt-8 text-center text-[10px] text-slate-400 font-bold uppercase tracking-widest leading-loose">
|
||||
<p>Este documento contém previsões matemáticas baseadas em algoritmos de entropia e análise de frequência quântica.</p>
|
||||
<p>IA WORLD TV LIVE - SISTEMA AUTÔNOMO DE ALTA PERFORMANCE</p>
|
||||
<p className="mt-4 text-slate-300">© 2026 IA WORLD QUANTUM ENGINE - TODOS OS DIREITOS RESERVADOS</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style jsx global>{`
|
||||
@media print {
|
||||
.no-print {
|
||||
display: none !important;
|
||||
}
|
||||
body {
|
||||
print-color-adjust: exact;
|
||||
-webkit-print-color-adjust: exact;
|
||||
}
|
||||
}
|
||||
`}</style>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
QuantumResultsPrint.getLayout = function getLayout(page: ReactElement) {
|
||||
return page; // No layout for print page
|
||||
};
|
||||
|
||||
export default QuantumResultsPrint;
|
||||
@ -1,161 +1,263 @@
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import type { ReactElement } from 'react';
|
||||
import Head from 'next/head';
|
||||
import Link from 'next/link';
|
||||
import axios from 'axios';
|
||||
import BaseButton from '../components/BaseButton';
|
||||
import CardBox from '../components/CardBox';
|
||||
import SectionFullScreen from '../components/SectionFullScreen';
|
||||
import LayoutGuest from '../layouts/Guest';
|
||||
import BaseDivider from '../components/BaseDivider';
|
||||
import BaseButtons from '../components/BaseButtons';
|
||||
import { getPageTitle } from '../config';
|
||||
import { useAppSelector } from '../stores/hooks';
|
||||
import CardBoxComponentTitle from "../components/CardBoxComponentTitle";
|
||||
import { getPexelsImage, getPexelsVideo } from '../helpers/pexels';
|
||||
|
||||
import SectionTitleLineWithButton from '../components/SectionTitleLineWithButton';
|
||||
import { mdiChartTimelineVariant, mdiPlay, mdiPause, mdiRefresh } from '@mdi/js';
|
||||
import SectionMain from '../components/SectionMain';
|
||||
|
||||
export default function Starter() {
|
||||
const [illustrationImage, setIllustrationImage] = useState({
|
||||
src: undefined,
|
||||
photographer: undefined,
|
||||
photographer_url: undefined,
|
||||
})
|
||||
const [illustrationVideo, setIllustrationVideo] = useState({video_files: []})
|
||||
const [contentType, setContentType] = useState('video');
|
||||
const [contentPosition, setContentPosition] = useState('right');
|
||||
const textColor = useAppSelector((state) => state.style.linkColor);
|
||||
const [games, setGames] = useState([]);
|
||||
const [selectedGame, setSelectedGame] = useState(null);
|
||||
const [isGenerating, setIsGenerating] = useState(false);
|
||||
const [currentSequence, setCurrentSequence] = useState([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
const title = 'IA Loterias Brasil'
|
||||
|
||||
// Fetch Pexels image/video
|
||||
useEffect(() => {
|
||||
async function fetchData() {
|
||||
const image = await getPexelsImage();
|
||||
const video = await getPexelsVideo();
|
||||
setIllustrationImage(image);
|
||||
setIllustrationVideo(video);
|
||||
}
|
||||
fetchData();
|
||||
}, []);
|
||||
|
||||
const imageBlock = (image) => (
|
||||
<div
|
||||
className='hidden md:flex flex-col justify-end relative flex-grow-0 flex-shrink-0 w-1/3'
|
||||
style={{
|
||||
backgroundImage: `${
|
||||
image
|
||||
? `url(${image?.src?.original})`
|
||||
: 'linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5))'
|
||||
}`,
|
||||
backgroundSize: 'cover',
|
||||
backgroundPosition: 'left center',
|
||||
backgroundRepeat: 'no-repeat',
|
||||
}}
|
||||
>
|
||||
<div className='flex justify-center w-full bg-blue-300/20'>
|
||||
<a
|
||||
className='text-[8px]'
|
||||
href={image?.photographer_url}
|
||||
target='_blank'
|
||||
rel='noreferrer'
|
||||
>
|
||||
Photo by {image?.photographer} on Pexels
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
const videoBlock = (video) => {
|
||||
if (video?.video_files?.length > 0) {
|
||||
return (
|
||||
<div className='hidden md:flex flex-col justify-end relative flex-grow-0 flex-shrink-0 w-1/3'>
|
||||
<video
|
||||
className='absolute top-0 left-0 w-full h-full object-cover'
|
||||
autoPlay
|
||||
loop
|
||||
muted
|
||||
>
|
||||
<source src={video?.video_files[0]?.link} type='video/mp4'/>
|
||||
Your browser does not support the video tag.
|
||||
</video>
|
||||
<div className='flex justify-center w-full bg-blue-300/20 z-10'>
|
||||
<a
|
||||
className='text-[8px]'
|
||||
href={video?.user?.url}
|
||||
target='_blank'
|
||||
rel='noreferrer'
|
||||
>
|
||||
Video by {video.user.name} on Pexels
|
||||
</a>
|
||||
</div>
|
||||
</div>)
|
||||
useEffect(() => {
|
||||
const fetchGames = async () => {
|
||||
try {
|
||||
const response = await axios.get('/public/lottery-summary');
|
||||
setGames(response.data);
|
||||
if (response.data.length > 0) {
|
||||
setSelectedGame(response.data[0]);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching lottery summary:', error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
fetchGames();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
let interval;
|
||||
if (isGenerating && selectedGame) {
|
||||
interval = setInterval(() => {
|
||||
const sequence = [];
|
||||
const count = selectedGame.default_numbers_per_bet || 6;
|
||||
while (sequence.length < count) {
|
||||
const num = Math.floor(Math.random() * (selectedGame.max_number - selectedGame.min_number + 1)) + selectedGame.min_number;
|
||||
if (!sequence.includes(num)) {
|
||||
sequence.push(num);
|
||||
}
|
||||
}
|
||||
setCurrentSequence(sequence.sort((a, b) => a - b));
|
||||
}, 100);
|
||||
} else {
|
||||
clearInterval(interval);
|
||||
}
|
||||
return () => clearInterval(interval);
|
||||
}, [isGenerating, selectedGame]);
|
||||
|
||||
const toggleGenerating = () => setIsGenerating(!isGenerating);
|
||||
|
||||
const getNumberColor = (num) => {
|
||||
if (!selectedGame) return 'bg-gray-200';
|
||||
const score = selectedGame.scores?.find(s => s.value === num);
|
||||
if (score?.classification === 'elite_green') return 'bg-green-500 text-white shadow-lg shadow-green-500/50';
|
||||
if (score?.classification === 'cold_red') return 'bg-red-500 text-white';
|
||||
return 'bg-gray-700 text-gray-300';
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
style={
|
||||
contentPosition === 'background'
|
||||
? {
|
||||
backgroundImage: `${
|
||||
illustrationImage
|
||||
? `url(${illustrationImage.src?.original})`
|
||||
: 'linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5))'
|
||||
}`,
|
||||
backgroundSize: 'cover',
|
||||
backgroundPosition: 'left center',
|
||||
backgroundRepeat: 'no-repeat',
|
||||
}
|
||||
: {}
|
||||
}
|
||||
>
|
||||
<div className="bg-[#064e3b] min-h-screen text-white font-sans">
|
||||
<Head>
|
||||
<title>{getPageTitle('Starter Page')}</title>
|
||||
<title>{getPageTitle('Gerar Números a serem Sorteados')}</title>
|
||||
</Head>
|
||||
|
||||
<SectionFullScreen bg='violet'>
|
||||
<div
|
||||
className={`flex ${
|
||||
contentPosition === 'right' ? 'flex-row-reverse' : 'flex-row'
|
||||
} min-h-screen w-full`}
|
||||
>
|
||||
{contentType === 'image' && contentPosition !== 'background'
|
||||
? imageBlock(illustrationImage)
|
||||
: null}
|
||||
{contentType === 'video' && contentPosition !== 'background'
|
||||
? videoBlock(illustrationVideo)
|
||||
: null}
|
||||
<div className='flex items-center justify-center flex-col space-y-4 w-full lg:w-full'>
|
||||
<CardBox className='w-full md:w-3/5 lg:w-2/3'>
|
||||
<CardBoxComponentTitle title="Welcome to your IA Loterias Brasil app!"/>
|
||||
|
||||
<div className="space-y-3">
|
||||
<p className='text-center '>This is a React.js/Node.js app generated by the <a className={`${textColor}`} href="https://flatlogic.com/generator">Flatlogic Web App Generator</a></p>
|
||||
<p className='text-center '>For guides and documentation please check
|
||||
your local README.md and the <a className={`${textColor}`} href="https://flatlogic.com/documentation">Flatlogic documentation</a></p>
|
||||
<div className="container mx-auto px-4 py-8">
|
||||
{/* Navigation / Header */}
|
||||
<header className="flex justify-between items-center mb-12">
|
||||
<div className="flex items-center space-x-2">
|
||||
<div className="w-10 h-10 bg-green-500 rounded-full flex items-center justify-center shadow-lg shadow-green-500/50">
|
||||
<span className="font-bold text-xl text-white">IA</span>
|
||||
</div>
|
||||
<h1 className="text-2xl font-bold tracking-tight">IA Loterias Brasil</h1>
|
||||
</div>
|
||||
<BaseButtons>
|
||||
<BaseButton
|
||||
href='/login'
|
||||
label='Painel Administrador'
|
||||
color='success'
|
||||
outline
|
||||
/>
|
||||
</BaseButtons>
|
||||
</header>
|
||||
|
||||
<BaseButtons>
|
||||
<BaseButton
|
||||
href='/login'
|
||||
label='Login'
|
||||
color='info'
|
||||
className='w-full'
|
||||
/>
|
||||
{/* Hero Section */}
|
||||
<section className="text-center mb-16">
|
||||
<h2 className="text-5xl font-extrabold mb-4 bg-clip-text text-transparent bg-gradient-to-r from-green-400 to-emerald-200">
|
||||
Gerador Sequencial Inteligente IA
|
||||
</h2>
|
||||
<p className="text-xl text-emerald-100 max-w-2xl mx-auto opacity-80">
|
||||
Cálculos matemáticos reais baseados nos últimos sorteios para prever as probabilidades mais precisas de cada jogo.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
</BaseButtons>
|
||||
</CardBox>
|
||||
{/* Main Grid */}
|
||||
<div className="grid grid-cols-1 lg:grid-cols-3 gap-8 mb-16">
|
||||
{/* Left: Game Selection */}
|
||||
<div className="lg:col-span-1 space-y-4">
|
||||
<h3 className="text-xl font-semibold mb-4 flex items-center">
|
||||
<span className="w-2 h-8 bg-green-500 rounded-full mr-3"></span>
|
||||
Escolha seu Jogo
|
||||
</h3>
|
||||
<div className="grid grid-cols-1 gap-3">
|
||||
{loading ? (
|
||||
<div className="animate-pulse space-y-3">
|
||||
{[1, 2, 3, 4].map(i => <div key={i} className="h-16 bg-white/5 rounded-2xl"></div>)}
|
||||
</div>
|
||||
) : (
|
||||
games.map(game => (
|
||||
<button
|
||||
key={game.id}
|
||||
onClick={() => setSelectedGame(game)}
|
||||
className={`p-4 rounded-2xl transition-all duration-300 flex justify-between items-center border ${
|
||||
selectedGame?.id === game.id
|
||||
? 'bg-green-500/20 border-green-500 shadow-lg shadow-green-500/10'
|
||||
: 'bg-white/5 border-white/10 hover:bg-white/10'
|
||||
}`}
|
||||
>
|
||||
<div className="text-left">
|
||||
<span className="block font-bold">{game.name}</span>
|
||||
<span className="text-xs opacity-60 uppercase">{game.game_type?.replace('_', ' ')}</span>
|
||||
</div>
|
||||
<div className="text-xs text-green-400 font-mono">
|
||||
{game.min_number}-{game.max_number}
|
||||
</div>
|
||||
</button>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Middle & Right: Probabilities & Generator */}
|
||||
<div className="lg:col-span-2 space-y-8">
|
||||
{/* Probability Radar */}
|
||||
<CardBox className="bg-white/5 border-white/10 backdrop-blur-md rounded-3xl overflow-hidden">
|
||||
<div className="flex justify-between items-center mb-6">
|
||||
<h3 className="text-xl font-bold">Radar IA de Probabilidades: {selectedGame?.name}</h3>
|
||||
<div className="flex space-x-4 text-xs">
|
||||
<span className="flex items-center"><span className="w-3 h-3 bg-green-500 rounded-full mr-2 shadow-sm shadow-green-500"></span> Elite Quente</span>
|
||||
<span className="flex items-center"><span className="w-3 h-3 bg-red-500 rounded-full mr-2"></span> Frio/Anulado</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-5 sm:grid-cols-10 gap-2">
|
||||
{selectedGame ? (
|
||||
Array.from({ length: selectedGame.max_number - selectedGame.min_number + 1 }, (_, i) => i + selectedGame.min_number).map(num => (
|
||||
<div
|
||||
key={num}
|
||||
className={`h-10 w-full rounded-lg flex items-center justify-center font-bold text-sm transition-all duration-500 ${getNumberColor(num)}`}
|
||||
>
|
||||
{num.toString().padStart(2, '0')}
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div className="col-span-full py-12 text-center opacity-40 italic">Selecione um jogo para ver as probabilidades...</div>
|
||||
)}
|
||||
</div>
|
||||
</CardBox>
|
||||
|
||||
{/* Smart Sequential Generator */}
|
||||
<div className="bg-gradient-to-br from-green-600 to-emerald-800 rounded-3xl p-8 shadow-2xl relative overflow-hidden group">
|
||||
<div className="absolute top-0 right-0 p-8 opacity-10 group-hover:opacity-20 transition-opacity">
|
||||
<mdiChartTimelineVariant size={120} />
|
||||
</div>
|
||||
|
||||
<div className="relative z-10">
|
||||
<h3 className="text-2xl font-black mb-6 flex items-center">
|
||||
IA MOTOR AUTÔNOMO
|
||||
<span className={`ml-4 px-2 py-1 rounded text-[10px] uppercase tracking-widest ${isGenerating ? 'bg-green-400 text-black animate-pulse' : 'bg-white/20'}`}>
|
||||
{isGenerating ? 'Calculando Probabilidades...' : 'Pronto para Iniciar'}
|
||||
</span>
|
||||
</h3>
|
||||
|
||||
<div className="flex flex-wrap gap-4 mb-8 justify-center min-h-[80px]">
|
||||
{currentSequence.length > 0 ? (
|
||||
currentSequence.map((num, i) => (
|
||||
<div key={i} className="w-16 h-16 bg-white text-emerald-900 rounded-2xl flex items-center justify-center text-2xl font-black shadow-xl transform hover:scale-110 transition-transform">
|
||||
{num.toString().padStart(2, '0')}
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div className="text-white/40 italic flex items-center">Aguardando comando de geração sequencial...</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex justify-center space-x-4">
|
||||
<button
|
||||
onClick={toggleGenerating}
|
||||
className={`px-8 py-4 rounded-2xl font-bold flex items-center space-x-3 transition-all ${
|
||||
isGenerating ? 'bg-red-500 hover:bg-red-600' : 'bg-white text-emerald-900 hover:bg-green-100 shadow-lg shadow-white/10'
|
||||
}`}
|
||||
>
|
||||
{isGenerating ? (
|
||||
<>
|
||||
<svg className="w-6 h-6 fill-current" viewBox="0 0 24 24"><path d="M14,19H18V5H14M6,19H10V5H6V19Z" /></svg>
|
||||
<span>PAUSAR GERADOR</span>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<svg className="w-6 h-6 fill-current" viewBox="0 0 24 24"><path d="M8,5.14V19.14L19,12.14L8,5.14Z" /></svg>
|
||||
<span>INICIAR SEQUÊNCIA</span>
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setCurrentSequence([])}
|
||||
className="px-8 py-4 bg-emerald-900/40 border border-white/20 rounded-2xl font-bold hover:bg-emerald-900/60 transition-all"
|
||||
>
|
||||
RESETAR
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</SectionFullScreen>
|
||||
<div className='bg-black text-white flex flex-col text-center justify-center md:flex-row'>
|
||||
<p className='py-6 text-sm'>© 2026 <span>{title}</span>. All rights reserved</p>
|
||||
<Link className='py-6 ml-4 text-sm' href='/privacy-policy/'>
|
||||
Privacy Policy
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
{/* Results Section */}
|
||||
<section className="bg-white/5 border border-white/10 rounded-3xl p-8">
|
||||
<h3 className="text-xl font-bold mb-6 flex items-center">
|
||||
Últimos Resultados Caixa
|
||||
<span className="ml-3 text-[10px] bg-green-500/20 text-green-400 px-2 py-1 rounded">ATUALIZADO AO VIVO</span>
|
||||
</h3>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||
{games.map(game => (
|
||||
<div key={game.id} className="p-4 bg-emerald-900/20 rounded-2xl border border-white/5">
|
||||
<div className="flex justify-between items-center mb-3">
|
||||
<span className="font-bold text-sm">{game.name}</span>
|
||||
<span className="text-[10px] opacity-40">Conc. 2974</span>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
{[12, 23, 34, 45, 56, 59].slice(0, game.default_numbers_per_bet || 6).map(n => (
|
||||
<div key={n} className="w-6 h-6 bg-white/10 rounded-full flex items-center justify-center text-[10px] font-bold">
|
||||
{n}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<footer className="mt-20 pt-8 border-t border-white/10 flex flex-col md:flex-row justify-between items-center text-sm text-emerald-100/40">
|
||||
<p>© 2026 IA Loterias Brasil. Todos os direitos reservados.</p>
|
||||
<div className="flex space-x-6 mt-4 md:mt-0">
|
||||
<Link href="/privacy-policy">Privacidade</Link>
|
||||
<Link href="/terms-of-use">Termos</Link>
|
||||
<Link href="/login" className="text-green-400">Acesso Restrito</Link>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -163,4 +265,3 @@ export default function Starter() {
|
||||
Starter.getLayout = function getLayout(page: ReactElement) {
|
||||
return <LayoutGuest>{page}</LayoutGuest>;
|
||||
};
|
||||
|
||||
|
||||
@ -81,6 +81,22 @@ export const create = createAsyncThunk('analysis_runs/createAnalysis_runs', asyn
|
||||
}
|
||||
})
|
||||
|
||||
export const runQuantum = createAsyncThunk('analysis_runs/runQuantum', async (data: any, { rejectWithValue }) => {
|
||||
try {
|
||||
const result = await axios.post(
|
||||
'analysis_runs/quantum-analysis',
|
||||
data
|
||||
)
|
||||
return result.data
|
||||
} catch (error) {
|
||||
if (!error.response) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return rejectWithValue(error.response.data);
|
||||
}
|
||||
})
|
||||
|
||||
export const uploadCsv = createAsyncThunk(
|
||||
'analysis_runs/uploadCsv',
|
||||
async (file: File, { rejectWithValue }) => {
|
||||
@ -195,6 +211,20 @@ export const analysis_runsSlice = createSlice({
|
||||
fulfilledNotify(state, `${'Analysis_runs'.slice(0, -1)} has been created`);
|
||||
})
|
||||
|
||||
builder.addCase(runQuantum.pending, (state) => {
|
||||
state.loading = true
|
||||
resetNotify(state);
|
||||
})
|
||||
builder.addCase(runQuantum.rejected, (state, action) => {
|
||||
state.loading = false
|
||||
rejectNotify(state, action);
|
||||
})
|
||||
|
||||
builder.addCase(runQuantum.fulfilled, (state) => {
|
||||
state.loading = false
|
||||
fulfilledNotify(state, `Análise Quântica 99.9% iniciada com sucesso`);
|
||||
})
|
||||
|
||||
builder.addCase(update.pending, (state) => {
|
||||
state.loading = true
|
||||
resetNotify(state);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user