Spaces:
Running

lelo / index.html
hellkat33's picture
cria um programa que faça registros de entrada de clientes e lutadores,o valor da entrada e do lutador será configuravel,um botao para registro de cada um,os clientes e os lutadores vao ficar na base de dados do programa para futuramente serem usados no sistema de apostas.na segunda aba que se vai chamar BlackList vou poder registrar nomes e id de clientes que eu nao quero no meu evento e colocar uma barra de pesquisa na mesma aba para poder procurar pelo nome ou pelo id para saber se o cliente ou o lutador estao proibidos de entrar e automaticamente aparecer o nome marcado a vermelho se o cliente estiver banido e a verde se nao estiver banido.criar um sistema de apostas em outra aba em que quem vai poder apostar sao os clientes nos lutadores,cria um sistema facil de busca para escolher clientes e lutadores em duas listas,coloca 3 botoes para ser mais facil apostar,um botao com 10.000 outro com 20.000 e outro com 50.000 e um botao para confirmar,cria outra aba com uma grelha de eliminatórias personalizavel de 1 a 20 combates cada combate com dois lutadores e sempre um contra o outro,á medida que se vao adicionando os lutadores a lista de registros na primeira aba o programa vai colocando ja os lutadores na grelha aleatoriamente para alinhar os combates para o torneio e a medida que sao registradas as vitorias e as derotas os lutadores vao avançando na grelha até chegar a um combate final tudo interactivo e bem elaborado.uma aba para resultados,nessa aba vai aparecer o nome de cada vencedor dos combates e os vencedores e perdedores das apostas,vai fazer as contas de quanto cada um perdeu e de quanto cada um ganhou,de todo esse dinheiro arrecadado das apostas e das entradas a casa fica com 10% de todo o valor,deixa ficar um contador de quanto ja ganhamos em tempo real no topo da aplicaçao.faz um sistema de apostas bem funcional simples facil de mexer um sistema de black list simples e eficaz todo o programa que seja bem animado e simples de usar o tema escuro e dourado,uma aparencia cuidada,o nome da aplicaçao vai ser Fight Club Diamond o tema vai ser em tons de preto com detalhes em dourado,e traduz tudo para portugues,coloca a possibilidade se salvar os ficheiros de registro para ser mais facia a aplicaçao encontrar os nomes nas listas nas futuras utilizaçoes - Initial Deployment
81b724d verified
Raw History Blame Contribute Delete
39.7 kB
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fight Club Diamond</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<style>
.gold-gradient {
background: linear-gradient(135deg, #D4AF37 0%, #F9D423 100%);
}
.gold-text {
background: linear-gradient(135deg, #D4AF37 0%, #F9D423 100%);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.dark-bg {
background-color: #0a0a0a;
}
.darker-bg {
background-color: #050505;
}
.border-gold {
border-color: #D4AF37;
}
</style>
</head>
<body class="dark-bg text-gray-100 min-h-screen">
<div id="app" class="container mx-auto px-4 py-8">
<!-- Header -->
<header class="flex justify-between items-center mb-12 border-b border-gold pb-6">
<div class="flex items-center">
<i data-feather="diamond" class="w-10 h-10 gold-text"></i>
<h1 class="text-3xl font-bold ml-3 gold-text">Fight Club Diamond</h1>
</div>
<div class="flex items-center bg-black bg-opacity-50 px-4 py-2 rounded-lg border border-gold">
<i data-feather="dollar-sign" class="w-5 h-5 mr-2 gold-text"></i>
<span class="font-bold gold-text">Lucro Total: </span>
<span id="totalProfit" class="ml-2 font-mono">R$ 0,00</span>
</div>
</header>
<!-- Navigation Tabs -->
<div class="mb-8">
<div class="flex overflow-x-auto pb-2">
<button @click="activeTab = 'registros'" :class="{'gold-gradient text-black': activeTab === 'registros', 'bg-gray-900 text-gray-300': activeTab !== 'registros'}" class="px-6 py-3 rounded-t-lg font-medium mr-2 transition-all">
<i data-feather="user-plus" class="inline mr-2"></i> Registros
</button>
<button @click="activeTab = 'blacklist'" :class="{'gold-gradient text-black': activeTab === 'blacklist', 'bg-gray-900 text-gray-300': activeTab !== 'blacklist'}" class="px-6 py-3 rounded-t-lg font-medium mr-2 transition-all">
<i data-feather="slash" class="inline mr-2"></i> BlackList
</button>
<button @click="activeTab = 'apostas'" :class="{'gold-gradient text-black': activeTab === 'apostas', 'bg-gray-900 text-gray-300': activeTab !== 'apostas'}" class="px-6 py-3 rounded-t-lg font-medium mr-2 transition-all">
<i data-feather="dollar-sign" class="inline mr-2"></i> Apostas
</button>
<button @click="activeTab = 'eliminatorias'" :class="{'gold-gradient text-black': activeTab === 'eliminatorias', 'bg-gray-900 text-gray-300': activeTab !== 'eliminatorias'}" class="px-6 py-3 rounded-t-lg font-medium mr-2 transition-all">
<i data-feather="award" class="inline mr-2"></i> Eliminatórias
</button>
<button @click="activeTab = 'resultados'" :class="{'gold-gradient text-black': activeTab === 'resultados', 'bg-gray-900 text-gray-300': activeTab !== 'resultados'}" class="px-6 py-3 rounded-t-lg font-medium transition-all">
<i data-feather="bar-chart-2" class="inline mr-2"></i> Resultados
</button>
</div>
</div>
<!-- Main Content -->
<main class="bg-gray-900 rounded-lg p-6 border border-gold min-h-[500px]">
<!-- Registros Tab -->
<div v-if="activeTab === 'registros'" class="grid md:grid-cols-2 gap-8">
<div class="bg-gray-800 p-6 rounded-lg border border-gray-700">
<h2 class="text-xl font-bold mb-4 gold-text">
<i data-feather="user" class="inline mr-2"></i> Registrar Cliente
</h2>
<div class="space-y-4">
<div>
<label class="block text-gray-300 mb-1">Nome do Cliente</label>
<input v-model="newClient.name" type="text" class="w-full bg-gray-700 border border-gray-600 rounded px-4 py-2 focus:border-gold focus:ring-1 focus:ring-gold">
</div>
<div>
<label class="block text-gray-300 mb-1">ID do Cliente</label>
<input v-model="newClient.id" type="text" class="w-full bg-gray-700 border border-gray-600 rounded px-4 py-2 focus:border-gold focus:ring-1 focus:ring-gold">
</div>
<div>
<label class="block text-gray-300 mb-1">Valor da Entrada (R$)</label>
<input v-model="entryFee" type="number" class="w-full bg-gray-700 border border-gray-600 rounded px-4 py-2 focus:border-gold focus:ring-1 focus:ring-gold">
</div>
<button @click="registerClient" class="gold-gradient text-black font-bold py-2 px-6 rounded-lg flex items-center">
<i data-feather="save" class="mr-2"></i> Registrar Cliente
</button>
</div>
</div>
<div class="bg-gray-800 p-6 rounded-lg border border-gray-700">
<h2 class="text-xl font-bold mb-4 gold-text">
<i data-feather="users" class="inline mr-2"></i> Registrar Lutador
</h2>
<div class="space-y-4">
<div>
<label class="block text-gray-300 mb-1">Nome do Lutador</label>
<input v-model="newFighter.name" type="text" class="w-full bg-gray-700 border border-gray-600 rounded px-4 py-2 focus:border-gold focus:ring-1 focus:ring-gold">
</div>
<div>
<label class="block text-gray-300 mb-1">ID do Lutador</label>
<input v-model="newFighter.id" type="text" class="w-full bg-gray-700 border border-gray-600 rounded px-4 py-2 focus:border-gold focus:ring-1 focus:ring-gold">
</div>
<div>
<label class="block text-gray-300 mb-1">Valor Base de Aposta (R$)</label>
<input v-model="newFighter.baseBet" type="number" class="w-full bg-gray-700 border border-gray-600 rounded px-4 py-2 focus:border-gold focus:ring-1 focus:ring-gold">
</div>
<button @click="registerFighter" class="gold-gradient text-black font-bold py-2 px-6 rounded-lg flex items-center">
<i data-feather="save" class="mr-2"></i> Registrar Lutador
</button>
</div>
</div>
<div class="md:col-span-2 bg-gray-800 p-6 rounded-lg border border-gray-700">
<h2 class="text-xl font-bold mb-4 gold-text">
<i data-feather="list" class="inline mr-2"></i> Registros Atuais
</h2>
<div class="grid md:grid-cols-2 gap-6">
<div>
<h3 class="text-lg font-semibold mb-3 gold-text">Clientes</h3>
<div class="max-h-60 overflow-y-auto">
<table class="w-full">
<thead>
<tr class="border-b border-gray-600">
<th class="text-left py-2">Nome</th>
<th class="text-left py-2">ID</th>
</tr>
</thead>
<tbody>
<tr v-for="client in clients" :key="client.id" class="border-b border-gray-700 hover:bg-gray-700">
<td class="py-2">{{ client.name }}</td>
<td class="py-2">{{ client.id }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>
<h3 class="text-lg font-semibold mb-3 gold-text">Lutadores</h3>
<div class="max-h-60 overflow-y-auto">
<table class="w-full">
<thead>
<tr class="border-b border-gray-600">
<th class="text-left py-2">Nome</th>
<th class="text-left py-2">ID</th>
<th class="text-left py-2">Valor Base</th>
</tr>
</thead>
<tbody>
<tr v-for="fighter in fighters" :key="fighter.id" class="border-b border-gray-700 hover:bg-gray-700">
<td class="py-2">{{ fighter.name }}</td>
<td class="py-2">{{ fighter.id }}</td>
<td class="py-2">R$ {{ fighter.baseBet }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- BlackList Tab -->
<div v-if="activeTab === 'blacklist'" class="space-y-6">
<div class="bg-gray-800 p-6 rounded-lg border border-gray-700">
<h2 class="text-xl font-bold mb-4 gold-text">
<i data-feather="slash" class="inline mr-2"></i> Gerenciar BlackList
</h2>
<div class="grid md:grid-cols-2 gap-6">
<div>
<div class="mb-4">
<label class="block text-gray-300 mb-1">Adicionar à BlackList</label>
<div class="flex">
<select v-model="blacklistType" class="bg-gray-700 border border-gray-600 rounded-l px-4 py-2 focus:border-gold focus:ring-1 focus:ring-gold">
<option value="client">Cliente</option>
<option value="fighter">Lutador</option>
</select>
<input v-model="newBlacklistItem" type="text" class="w-full bg-gray-700 border border-gray-600 rounded-r px-4 py-2 focus:border-gold focus:ring-1 focus:ring-gold" placeholder="ID ou Nome">
</div>
</div>
<button @click="addToBlacklist" class="gold-gradient text-black font-bold py-2 px-6 rounded-lg flex items-center">
<i data-feather="plus" class="mr-2"></i> Adicionar
</button>
</div>
<div>
<div class="mb-4">
<label class="block text-gray-300 mb-1">Pesquisar BlackList</label>
<input v-model="blacklistSearch" type="text" class="w-full bg-gray-700 border border-gray-600 rounded px-4 py-2 focus:border-gold focus:ring-1 focus:ring-gold" placeholder="Pesquisar por nome ou ID">
</div>
</div>
</div>
</div>
<div class="bg-gray-800 p-6 rounded-lg border border-gray-700">
<h3 class="text-lg font-semibold mb-3 gold-text">Resultados da Pesquisa</h3>
<div class="max-h-60 overflow-y-auto">
<table class="w-full">
<thead>
<tr class="border-b border-gray-600">
<th class="text-left py-2">Tipo</th>
<th class="text-left py-2">Nome/ID</th>
<th class="text-left py-2">Status</th>
<th class="text-left py-2">Ações</th>
</tr>
</thead>
<tbody>
<tr v-for="item in filteredBlacklist" :key="item.id" class="border-b border-gray-700 hover:bg-gray-700">
<td class="py-2">{{ item.type === 'client' ? 'Cliente' : 'Lutador' }}</td>
<td class="py-2">{{ item.name || item.id }}</td>
<td class="py-2">
<span :class="{'text-red-500': isBlacklisted(item), 'text-green-500': !isBlacklisted(item)}">
{{ isBlacklisted(item) ? 'Banido' : 'Liberado' }}
</span>
</td>
<td class="py-2">
<button v-if="isBlacklisted(item)" @click="removeFromBlacklist(item)" class="text-red-500 hover:text-red-400">
<i data-feather="trash-2" class="w-4 h-4"></i>
</button>
<button v-else @click="addToBlacklist(item)" class="text-green-500 hover:text-green-400">
<i data-feather="plus" class="w-4 h-4"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Apostas Tab -->
<div v-if="activeTab === 'apostas'" class="space-y-6">
<div class="bg-gray-800 p-6 rounded-lg border border-gray-700">
<h2 class="text-xl font-bold mb-4 gold-text">
<i data-feather="dollar-sign" class="inline mr-2"></i> Registrar Aposta
</h2>
<div class="grid md:grid-cols-2 gap-6">
<div>
<label class="block text-gray-300 mb-1">Selecionar Cliente</label>
<select v-model="selectedClient" class="w-full bg-gray-700 border border-gray-600 rounded px-4 py-2 focus:border-gold focus:ring-1 focus:ring-gold">
<option v-for="client in clients" :value="client.id">{{ client.name }} ({{ client.id }})</option>
</select>
</div>
<div>
<label class="block text-gray-300 mb-1">Selecionar Lutador</label>
<select v-model="selectedFighter" class="w-full bg-gray-700 border border-gray-600 rounded px-4 py-2 focus:border-gold focus:ring-1 focus:ring-gold">
<option v-for="fighter in fighters" :value="fighter.id">{{ fighter.name }} ({{ fighter.id }})</option>
</select>
</div>
</div>
<div class="mt-6">
<label class="block text-gray-300 mb-1">Valor da Aposta (R$)</label>
<div class="flex flex-wrap gap-2 mb-4">
<button @click="betAmount = 10000" class="bg-gray-700 hover:bg-gray-600 border border-gray-600 px-4 py-2 rounded">
R$ 10.000
</button>
<button @click="betAmount = 20000" class="bg-gray-700 hover:bg-gray-600 border border-gray-600 px-4 py-2 rounded">
R$ 20.000
</button>
<button @click="betAmount = 50000" class="bg-gray-700 hover:bg-gray-600 border border-gray-600 px-4 py-2 rounded">
R$ 50.000
</button>
</div>
<input v-model="betAmount" type="number" class="w-full bg-gray-700 border border-gray-600 rounded px-4 py-2 focus:border-gold focus:ring-1 focus:ring-gold" placeholder="Ou digite outro valor">
</div>
<button @click="placeBet" class="mt-6 gold-gradient text-black font-bold py-2 px-6 rounded-lg flex items-center">
<i data-feather="check" class="mr-2"></i> Confirmar Aposta
</button>
</div>
<div class="bg-gray-800 p-6 rounded-lg border border-gray-700">
<h3 class="text-lg font-semibold mb-3 gold-text">Apostas Registradas</h3>
<div class="max-h-60 overflow-y-auto">
<table class="w-full">
<thead>
<tr class="border-b border-gray-600">
<th class="text-left py-2">Cliente</th>
<th class="text-left py-2">Lutador</th>
<th class="text-left py-2">Valor (R$)</th>
<th class="text-left py-2">Status</th>
</tr>
</thead>
<tbody>
<tr v-for="bet in bets" :key="bet.id" class="border-b border-gray-700 hover:bg-gray-700">
<td class="py-2">{{ getClientName(bet.clientId) }}</td>
<td class="py-2">{{ getFighterName(bet.fighterId) }}</td>
<td class="py-2">{{ bet.amount }}</td>
<td class="py-2">
<span :class="{'text-yellow-500': bet.status === 'pending', 'text-green-500': bet.status === 'won', 'text-red-500': bet.status === 'lost'}">
{{ bet.status === 'pending' ? 'Pendente' : bet.status === 'won' ? 'Ganhou' : 'Perdeu' }}
</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Eliminatórias Tab -->
<div v-if="activeTab === 'eliminatorias'" class="space-y-6">
<div class="bg-gray-800 p-6 rounded-lg border border-gray-700">
<h2 class="text-xl font-bold mb-4 gold-text">
<i data-feather="award" class="inline mr-2"></i> Configurar Torneio
</h2>
<div class="grid md:grid-cols-2 gap-6">
<div>
<label class="block text-gray-300 mb-1">Número de Combates</label>
<input v-model="numberOfFights" type="number" min="1" max="20" class="w-full bg-gray-700 border border-gray-600 rounded px-4 py-2 focus:border-gold focus:ring-1 focus:ring-gold">
</div>
<div>
<label class="block text-gray-300 mb-1">Lutadores Participantes</label>
<select v-model="selectedFighters" multiple class="w-full bg-gray-700 border border-gray-600 rounded px-4 py-2 focus:border-gold focus:ring-1 focus:ring-gold h-[100px]">
<option v-for="fighter in fighters" :value="fighter.id">{{ fighter.name }} ({{ fighter.id }})</option>
</select>
</div>
</div>
<button @click="setupTournament" class="mt-6 gold-gradient text-black font-bold py-2 px-6 rounded-lg flex items-center">
<i data-feather="play" class="mr-2"></i> Iniciar Torneio
</button>
</div>
<div v-if="tournamentRounds.length > 0" class="bg-gray-800 p-6 rounded-lg border border-gray-700">
<h3 class="text-lg font-semibold mb-3 gold-text">Eliminatórias</h3>
<div class="overflow-x-auto">
<div class="flex space-x-8 min-w-max">
<div v-for="(round, roundIndex) in tournamentRounds" :key="roundIndex" class="flex flex-col space-y-4">
<h4 class="text-center font-medium gold-text">Rodada {{ roundIndex + 1 }}</h4>
<div v-for="(fight, fightIndex) in round" :key="fightIndex" class="bg-gray-700 p-3 rounded border border-gray-600">
<div class="text-center mb-2 text-sm gold-text">Combate {{ fightIndex + 1 }}</div>
<div class="flex flex-col space-y-2">
<div class="flex items-center justify-between">
<span>{{ getFighterName(fight.fighter1) }}</span>
<button @click="recordFightResult(roundIndex, fightIndex, fight.fighter1)" class="bg-green-600 hover:bg-green-700 text-white px-2 py-1 rounded text-xs">
Vitória
</button>
</div>
<div class="flex items-center justify-between">
<span>{{ getFighterName(fight.fighter2) }}</span>
<button @click="recordFightResult(roundIndex, fightIndex, fight.fighter2)" class="bg-green-600 hover:bg-green-700 text-white px-2 py-1 rounded text-xs">
Vitória
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Resultados Tab -->
<div v-if="activeTab === 'resultados'" class="space-y-6">
<div class="bg-gray-800 p-6 rounded-lg border border-gray-700">
<h2 class="text-xl font-bold mb-4 gold-text">
<i data-feather="bar-chart-2" class="inline mr-2"></i> Resultados Finais
</h2>
<div v-if="tournamentWinner" class="mb-6">
<h3 class="text-lg font-semibold mb-3 gold-text">Campeão do Torneio</h3>
<div class="bg-gray-700 p-4 rounded border border-gold flex items-center">
<i data-feather="award" class="w-8 h-8 gold-text mr-4"></i>
<div>
<h4 class="text-xl font-bold">{{ getFighterName(tournamentWinner) }}</h4>
<p class="text-gray-300">ID: {{ tournamentWinner }}</p>
</div>
</div>
</div>
<div class="grid md:grid-cols-2 gap-6">
<div>
<h3 class="text-lg font-semibold mb-3 gold-text">Resultados das Apostas</h3>
<div class="max-h-60 overflow-y-auto">
<table class="w-full">
<thead>
<tr class="border-b border-gray-600">
<th class="text-left py-2">Cliente</th>
<th class="text-left py-2">Resultado</th>
<th class="text-left py-2">Valor (R$)</th>
</tr>
</thead>
<tbody>
<tr v-for="bet in resolvedBets" :key="bet.id" class="border-b border-gray-700 hover:bg-gray-700">
<td class="py-2">{{ getClientName(bet.clientId) }}</td>
<td class="py-2">
<span :class="{'text-green-500': bet.status === 'won', 'text-red-500': bet.status === 'lost'}">
{{ bet.status === 'won' ? 'Ganhou' : 'Perdeu' }}
</span>
</td>
<td class="py-2">{{ bet.amount }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>
<h3 class="text-lg font-semibold mb-3 gold-text">Resumo Financeiro</h3>
<div class="bg-gray-700 p-4 rounded border border-gray-600">
<div class="flex justify-between py-2 border-b border-gray-600">
<span>Total de Apostas:</span>
<span>R$ {{ totalBets }}</span>
</div>
<div class="flex justify-between py-2 border-b border-gray-600">
<span>Total de Entradas:</span>
<span>R$ {{ totalEntryFees }}</span>
</div>
<div class="flex justify-between py-2 border-b border-gray-600">
<span>Total Arrecadado:</span>
<span>R$ {{ totalRevenue }}</span>
</div>
<div class="flex justify-between py-2 border-b border-gray-600">
<span>Prêmios Pagos:</span>
<span>R$ {{ totalPayouts }}</span>
</div>
<div class="flex justify-between py-2 font-bold gold-text">
<span>Lucro da Casa (10%):</span>
<span>R$ {{ houseProfit }}</span>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<!-- Footer -->
<footer class="mt-12 text-center text-gray-500 text-sm">
<p>Fight Club Diamond &copy; 2023 - Todos os direitos reservados</p>
</footer>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@3.2.47/dist/vue.global.min.js"></script>
<script>
const { createApp, ref, computed, onMounted } = Vue;
createApp({
setup() {
// Data
const activeTab = ref('registros');
const totalProfit = ref(0);
// Registros
const newClient = ref({ name: '', id: '' });
const newFighter = ref({ name: '', id: '', baseBet: 10000 });
const entryFee = ref(5000);
const clients = ref([]);
const fighters = ref([]);
// BlackList
const blacklistType = ref('client');
const newBlacklistItem = ref('');
const blacklistSearch = ref('');
const blacklist = ref([]);
// Apostas
const selectedClient = ref('');
const selectedFighter = ref('');
const betAmount = ref(10000);
const bets = ref([]);
// Eliminatórias
const numberOfFights = ref(4);
const selectedFighters = ref([]);
const tournamentRounds = ref([]);
const tournamentWinner = ref(null);
// Resultados
const resolvedBets = ref([]);
// Computed
const filteredBlacklist = computed(() => {
if (!blacklistSearch.value) return [...clients.value, ...fighters.value];
const searchTerm = blacklistSearch.value.toLowerCase();
return [...clients.value, ...fighters.value].filter(item =>
item.name.toLowerCase().includes(searchTerm) ||
item.id.toLowerCase().includes(searchTerm)
);
});
const totalBets = computed(() => {
return bets.value.reduce((sum, bet) => sum + bet.amount, 0);
});
const totalEntryFees = computed(() => {
return clients.value.length * entryFee.value;
});
const totalRevenue = computed(() => {
return totalBets.value + totalEntryFees.value;
});
const totalPayouts = computed(() => {
return resolvedBets.value
.filter(bet => bet.status === 'won')
.reduce((sum, bet) => sum + bet.amount * 2, 0);
});
const houseProfit = computed(() => {
return (totalRevenue.value - totalPayouts.value) * 0.1;
});
// Methods
const registerClient = () => {
if (!newClient.value.name || !newClient.value.id) return;
clients.value.push({ ...newClient.value });
newClient.value = { name: '', id: '' };
totalProfit.value += entryFee.value;
};
const registerFighter = () => {
if (!newFighter.value.name || !newFighter.value.id) return;
fighters.value.push({ ...newFighter.value });
newFighter.value = { name: '', id: '', baseBet: 10000 };
};
const isBlacklisted = (item) => {
return blacklist.value.some(b => b.id === item.id && b.type === (item.baseBet ? 'fighter' : 'client'));
};
const addToBlacklist = () => {
if (!newBlacklistItem.value) return;
const item = {
id: newBlacklistItem.value,
type: blacklistType.value
};
if (!blacklist.value.some(b => b.id === item.id && b.type === item.type)) {
blacklist.value.push(item);
}
newBlacklistItem.value = '';
};
const removeFromBlacklist = (item) => {
blacklist.value = blacklist.value.filter(b =>
!(b.id === item.id && b.type === (item.baseBet ? 'fighter' : 'client'))
);
};
const placeBet = () => {
if (!selectedClient.value || !selectedFighter.value || !betAmount.value) return;
bets.value.push({
id: Date.now(),
clientId: selectedClient.value,
fighterId: selectedFighter.value,
amount: betAmount.value,
status: 'pending'
});
selectedClient.value = '';
selectedFighter.value = '';
betAmount.value = 10000;
};
const setupTournament = () => {
if (selectedFighters.value.length < 2) return;
// Shuffle fighters
const shuffled = [...selectedFighters.value].sort(() => 0.5 - Math.random());
// Create first round
const firstRound = [];
for (let i = 0; i < numberOfFights.value; i++) {
const fighter1 = shuffled[i * 2];
const fighter2 = shuffled[i * 2 + 1];
if (fighter1 && fighter2) {
firstRound.push({
fighter1,
fighter2,
winner: null
});
}
}
tournamentRounds.value = [firstRound];
tournamentWinner.value = null;
};
const recordFightResult = (roundIndex, fightIndex, winnerId) => {
// Mark the winner in current fight
tournamentRounds.value[roundIndex][fightIndex].winner = winnerId;
// If it's the last fight in the round, create next round
if (fightIndex === tournamentRounds.value[roundIndex].length - 1) {
const winners = tournamentRounds.value[roundIndex].map(fight => fight.winner);
if (winners.length > 1) {
const nextRound = [];
for (let i = 0; i < winners.length / 2; i++) {
const fighter1 = winners[i * 2];
const fighter2 = winners[i * 2 + 1];
if (fighter1 && fighter2) {
nextRound.push({
fighter1,
fighter2,
winner: null
});
}
}
tournamentRounds.value.push(nextRound);
} else {
// Tournament finished
tournamentWinner.value = winners[0];
resolveBets();
}
}
};
const resolveBets = () => {
resolvedBets.value = bets.value.map(bet => ({
...bet,
status: bet.fighterId === tournamentWinner.value ? 'won' : 'lost'
}));
// Update total profit
totalProfit.value += houseProfit.value;
};
const getClientName = (id) => {
const client = clients.value.find(c => c.id === id);
return client ? client.name : 'Desconhecido';
};
const getFighterName = (id) => {
const fighter = fighters.value.find(f => f.id === id);
return fighter ? fighter.name : 'Desconhecido';
};
// Initialize with some sample data
onMounted(() => {
clients.value = [
{ name: 'João Silva', id: 'CL001' },
{ name: 'Maria Santos', id: 'CL002' },
{ name: 'Carlos Oliveira', id: 'CL003' }
];
fighters.value = [
{ name: 'Tyson Fury', id: 'FT001', baseBet: 15000 },
{ name: 'Mike Tyson', id: 'FT002', baseBet: 20000 },
{ name: 'Muhammad Ali', id: 'FT003', baseBet: 25000 },
{ name: 'Floyd Mayweather', id: 'FT004', baseBet: 30000 }
];
blacklist.value = [
{ id: 'CL003', type: 'client' }
];
selectedFighters.value = fighters.value.map(f => f.id);
});
return {
activeTab,
totalProfit,
// Registros
newClient,
newFighter,
entryFee,
clients,
fighters,
registerClient,
registerFighter,
// BlackList
blacklistType,
newBlacklistItem,
blacklistSearch,
blacklist,
filteredBlacklist,
isBlacklisted,
addToBlacklist,
removeFromBlacklist,
// Apostas
selectedClient,
selectedFighter,
betAmount,
bets,
placeBet,
getClientName,
getFighterName,
// Eliminatórias
numberOfFights,
selectedFighters,
tournamentRounds,
tournamentWinner,
setupTournament,
recordFightResult,
// Resultados
resolvedBets,
totalBets,
totalEntryFees,
totalRevenue,
totalPayouts,
houseProfit
};
}
}).mount('#app');
// Initialize feather icons and AOS
document.addEventListener('DOMContentLoaded', () => {
feather.replace();
AOS.init();
});
</script>
<script>feather.replace();</script>
<script>AOS.init();</script>
</body>
</html>