Skip to content

Commit

Permalink
Merge pull request #99 from Crudzaso/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
DiegoAndresRamirez authored Dec 9, 2024
2 parents e43cac0 + 300d8c4 commit 49b4977
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 3 deletions.
33 changes: 33 additions & 0 deletions database/migrations/2024_12_09_080953_update_lotteries_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('lotteries', function (Blueprint $table) {
$table->text('description')->nullable()->change();
$table->string('url_imagen')->nullable()->change();

$table->string('slug')->unique()->after('name');
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('lotteries', function (Blueprint $table) {
$table->text('description')->nullable(false)->change();
$table->string('url_imagen')->nullable(false)->change();
$table->dropColumn('slug');
});
}
};
2 changes: 2 additions & 0 deletions database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class DatabaseSeeder extends Seeder
public function run(): void
{

$this->call(LotterySeeder::class);

$this->call([
RolesPermissionsSeeder::class,
]);
Expand Down
135 changes: 135 additions & 0 deletions database/seeders/LotterySeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Modules\Lottery\Models\Lottery;

class LotterySeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$lotteries = [
["name" => "ANTIOQUEÑITA MAÑANA FESTIVO", "slug" => "antioquenita-manana-festivo"],
["name" => "ANTIOQUEÑITA TARDE FESTIVO", "slug" => "antioquenita-tarde-festivo"],
["name" => "CARIBEÑA DIA FESTIVO", "slug" => "caribena-dia-festivo"],
["name" => "CHONTICO DIA FESTIVO", "slug" => "chontico-dia-festivo"],
["name" => "CULONA DIA FESTIVO", "slug" => "culona-dia-festivo"],
["name" => "MOTILON DIA", "slug" => "motilon-dia"],
["name" => "PAISITA DIA FESTIVO", "slug" => "paisita-dia-festivo"],
["name" => "SAMAN FESTIVO", "slug" => "saman-festivo"],
["name" => "SINUANO DIA FESTIVO", "slug" => "sinuano-dia-festivo"],
["name" => "ANTIOQUEÑITA FESTIVA MAÑANA", "slug" => "antioqueaita-festiva-maaana"],
["name" => "ANTIOQUEÑITA FESTIVA TARDE", "slug" => "antioqueaita-festiva-tarde"],
["name" => "ANTIOQUEÑITA MAÑANA", "slug" => "antioqueaita-maaana"],
["name" => "ANTIOQUEÑITA TARDE", "slug" => "antioqueaita-tarde"],
["name" => "ANTIOQUEÑITA FESTIVA MAÑANA", "slug" => "antioquenita-festiva-manana"],
["name" => "ANTIOQUEÑITA FESTIVA TARDE", "slug" => "antioquenita-festiva-tarde"],
["name" => "ANTIOQUEÑITA MAÑANA", "slug" => "antioquenita-manana"],
["name" => "ANTIOQUEÑITA TARDE", "slug" => "antioquenita-tarde"],
["name" => "AST-LUN 21:50", "slug" => "ast-lun-2150"],
["name" => "AST-SOL 13:50", "slug" => "ast-sol-1350"],
["name" => "ASTRO LUNA", "slug" => "astro-luna"],
["name" => "ASTRO SOL", "slug" => "astro-sol"],
["name" => "BOGOTA", "slug" => "bogota"],
["name" => "BOYACA", "slug" => "boyaca"],
["name" => "CAFETERITO FESTIVO", "slug" => "cafeterito-festivo"],
["name" => "CAFETERITO NOCHE", "slug" => "cafeterito-noche"],
["name" => "CAFETERITO NOCHE FESTIVO", "slug" => "cafeterito-noche-festivo"],
["name" => "CAFETERO", "slug" => "cafetero"],
["name" => "CAFETERO DIA", "slug" => "cafetero-dia"],
["name" => "CAFETERO NOCHE", "slug" => "cafetero-noche"],
["name" => "CAFETERO NOCHE FESTIVO", "slug" => "cafetero-noche-festivo"],
["name" => "CARIBEÑA DIA", "slug" => "caribeaa-dia"],
["name" => "CARIBEÑA FESTIVO DIA", "slug" => "caribeaa-festivo-dia"],
["name" => "CARIBEÑA NOCHE", "slug" => "caribeaa-noche"],
["name" => "CARIBEÑA DIA", "slug" => "caribena-dia"],
["name" => "CARIBEÑA FESTIVA NOCHE", "slug" => "caribena-festiva-noche"],
["name" => "CARIBEÑA FESTIVO DIA", "slug" => "caribena-festivo-dia"],
["name" => "CARIBEÑA NOCHE", "slug" => "caribena-noche"],
["name" => "CARIBEÑA NOCHE FESTIVO", "slug" => "caribena-noche-festivo"],
["name" => "CAUCA", "slug" => "cauca"],
["name" => "CHONTICO", "slug" => "chontico"],
["name" => "CHONTICO DIA", "slug" => "chontico-dia"],
["name" => "CHONTICO FESTIVO", "slug" => "chontico-festivo"],
["name" => "CHONTICO FESTIVO DIA", "slug" => "chontico-festivo-dia"],
["name" => "CHONTICO NOCHE", "slug" => "chontico-noche"],
["name" => "CHONTICO NOCHE FESTIVO", "slug" => "chontico-noche-festivo"],
["name" => "CHONTICO NOCHE JUEVES", "slug" => "chontico-noche-jueves"],
["name" => "CRUZ ROJA", "slug" => "cruz-roja"],
["name" => "CULONA", "slug" => "culona"],
["name" => "CULONA DIA", "slug" => "culona-dia"],
["name" => "CULONA FESTIVO", "slug" => "culona-festivo"],
["name" => "CULONA FESTIVO DIA", "slug" => "culona-festivo-dia"],
["name" => "CULONA FESTIVO NOCHE", "slug" => "culona-festivo-noche"],
["name" => "CULONA NOCHE", "slug" => "culona-noche"],
["name" => "CULONA NOCHE FESTIVO", "slug" => "culona-noche-festivo"],
["name" => "CUNDINAMARCA", "slug" => "cundinamarca"],
["name" => "DORADO", "slug" => "dorado"],
["name" => "DORADO FESTIVO", "slug" => "dorado-festivo"],
["name" => "DORADO MAÑANA", "slug" => "dorado-manana"],
["name" => "DORADO NOCHE", "slug" => "dorado-noche"],
["name" => "DORADO NOCHE FESTIVO", "slug" => "dorado-noche-festivo"],
["name" => "DORADO TARDE", "slug" => "dorado-tarde"],
["name" => "EXTRA CRUZ ROJA", "slug" => "extra-cruz-roja"],
["name" => "EXTRA DE COLOMBIA", "slug" => "extra-de-colombia"],
["name" => "FANTASTICA DIA", "slug" => "fantastica-dia"],
["name" => "FANTASTICA NOCHE", "slug" => "fantastica-noche"],
["name" => "FANTASTICA NOCHE FESTIVO", "slug" => "fantastica-noche-festivo"],
["name" => "HUILA", "slug" => "huila"],
["name" => "LA FANTASTICA DIA", "slug" => "la-fantastica-dia"],
["name" => "LA FANTASTICA FESTIVO", "slug" => "la-fantastica-festivo"],
["name" => "LA FANTASTICA NOCHE", "slug" => "la-fantastica-noche"],
["name" => "LA FANTASTICA NOCHE FESTIVO", "slug" => "la-fantastica-noche-festivo"],
["name" => "MANIZALES", "slug" => "manizales"],
["name" => "MEDELLIN", "slug" => "medellin"],
["name" => "META", "slug" => "meta"],
["name" => "MOTILON", "slug" => "motilon"],
["name" => "MOTILON FESTIVO", "slug" => "motilon-festivo"],
["name" => "MOTILON NOCHE", "slug" => "motilon-noche"],
["name" => "PAISITA 3 SABADOS", "slug" => "paisita-3-sabados"],
["name" => "PAISITA DIA", "slug" => "paisita-dia"],
["name" => "PAISITA FESTIVO", "slug" => "paisita-festivo"],
["name" => "PAISITA FESTIVO DIA", "slug" => "paisita-festivo-dia"],
["name" => "PAISITA FESTIVO NOCHE", "slug" => "paisita-festivo-noche"],
["name" => "PAISITA NOCHE", "slug" => "paisita-noche"],
["name" => "PAISITA NOCHE FESTIVO", "slug" => "paisita-noche-festivo"],
["name" => "PIJAO", "slug" => "pijao"],
["name" => "PIJAO FESTIVO", "slug" => "pijao-festivo"],
["name" => "PIJAO NOCHE FESTIVO", "slug" => "pijao-noche-festivo"],
["name" => "QUINDIO", "slug" => "quindio"],
["name" => "RISARALDA", "slug" => "risaralda"],
["name" => "SAMAN", "slug" => "saman"],
["name" => "SAMANFESTIVO", "slug" => "samanfestivo"],
["name" => "SANTANDER", "slug" => "santander"],
["name" => "SINUANO DIA", "slug" => "sinuano-dia"],
["name" => "SINUANO FESTIVO DIA", "slug" => "sinuano-festivo-dia"],
["name" => "SINUANO FESTIVO NOCHE", "slug" => "sinuano-festivo-noche"],
["name" => "SINUANO NOCHE", "slug" => "sinuano-noche"],
["name" => "SINUANO NOCHE FESTIVO", "slug" => "sinuano-noche-festivo"],
["name" => "SORTEO EXTRA CAUCA", "slug" => "sorteo-extra-cauca"],
["name" => "SORTEO EXTRA CRUZROJA-VALLE", "slug" => "sorteo-extra-cruzroja-valle"],
["name" => "SORTEO EXTRA DE BOGOTA", "slug" => "sorteo-extra-de-bogota"],
["name" => "SORTEO EXTRA DE BOYACA", "slug" => "sorteo-extra-de-boyaca"],
["name" => "SORTEO EXTRA DE MANIZALES", "slug" => "sorteo-extra-de-manizales"],
["name" => "SORTEO EXTRA DEL TOLIMA", "slug" => "sorteo-extra-del-tolima"],
["name" => "SORTEO EXTRA SANTANDER", "slug" => "sorteo-extra-santander"],
["name" => "SUPER EXTRA MEDELLIN", "slug" => "super-extra-medellin"],
["name" => "SUPER EXTRA NAVIDAD MEDELLIN", "slug" => "super-extra-navidad-medellin"],
["name" => "TOLIMA", "slug" => "tolima"],
["name" => "VALLE", "slug" => "valle"]
];

foreach ($lotteries as $lottery) {
Lottery::create([
'name' => $lottery['name'],
'slug' => $lottery['slug'],
'description' => 'Descripción predeterminada para la lotería ' . $lottery['name'],
'url_imagen' => 'https://via.placeholder.com/150', // URL de imagen predeterminada
]);
}
}
}
5 changes: 2 additions & 3 deletions resources/js/Components/Dashboard/RaffleCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
Números disponibles: <span class="font-medium">{{ raffle.total_tickets }}</span>
</p>
<p :class="theme.textSecondary">
Total vendido: <span class="font-medium">${{ raffle.total_sales }}</span>
Loteria: <span class="font-medium">{{ raffle.lottery ? raffle.lottery.name : 'No especificada' }}</span>
</p>
</div>

Expand Down Expand Up @@ -220,7 +220,6 @@ import { TransitionRoot, TransitionChild, Dialog, DialogPanel } from '@headlessu
import axios from "axios";
/* Props and Reactive Data */
const raffleProps = defineProps({ raffle: Object });
const showSelectionModal = ref(false);
const showModal = ref(false);
Expand Down Expand Up @@ -333,7 +332,7 @@ const clearSelection = () => {
const selectRandomNumbers = () => {
const availableNumbers = paginatedNumbers.value;
const randomNumbers = [];
while (randomNumbers.length < 5 && availableNumbers.length > 0) {
while (randomNumbers.length < 2 && availableNumbers.length > 0) {
const randomIndex = Math.floor(Math.random() * availableNumbers.length);
const number = availableNumbers[randomIndex];
if (!randomNumbers.includes(number)) {
Expand Down

0 comments on commit 49b4977

Please sign in to comment.