first commit

This commit is contained in:
Alejandro Tasistro 2021-11-27 10:37:23 -03:00
parent 54729310fc
commit e203517ae6
30 changed files with 281 additions and 992 deletions

5
.directory Normal file
View File

@ -0,0 +1,5 @@
[Dolphin]
HeaderColumnWidths=372,72,103
Timestamp=2021,11,27,10,20,55
Version=4
ViewMode=1

View File

@ -1,52 +0,0 @@
APP_NAME=Planifibo7
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=planifibo7
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

View File

@ -1,85 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Models\Dia;
use Illuminate\Http\Request;
class DiaController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param \App\Models\Dia $dia
* @return \Illuminate\Http\Response
*/
public function show(Dia $dia)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Dia $dia
* @return \Illuminate\Http\Response
*/
public function edit(Dia $dia)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Dia $dia
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Dia $dia)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\Dia $dia
* @return \Illuminate\Http\Response
*/
public function destroy(Dia $dia)
{
//
}
}

View File

@ -1,151 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Models\Dia;
use App\Models\Evento;
use App\Models\HoraFlag;
use App\Models\Utils;
use Dotenv\Validator;
use Illuminate\Http\Request;
use mysql_xdevapi\Exception;
class EventoController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function store(Request $request)
{
$request->validate([
'nombre' => 'required',
]);
$evento = new Evento();
$evento->nombre = $request->input("nombre");
$evento->save();
return redirect()->route("edit", ['evento' => $evento]);
}
/**
* Display the specified resource.
*
* @param \App\Models\Evento $evento
* @return \Illuminate\Http\Response
*/
public function show(Evento $evento)
{
// evento->coordinar devuelve los tres mejores marzullos de los días que tiene asociados
// dia->marzullo devuelve array de
// [dia::string, cantidad::integer, inicio::integer, fin::integer, duracion::integer
// inicioLindo::string, finLindo::string, duracionLinda::string]
$marzullos = $evento->coordinar();
return view("resultado", ['marzullos' => $marzullos, 'evento' => $evento]);
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Evento $evento
* @return \Illuminate\Http\Response
*/
public function edit(Evento $evento)
{
return view("edit", ['evento' => $evento]);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Evento $evento
* @return \Illuminate\Http\RedirectResponse
*/
public function update(Request $request, Evento $evento) {
// Validación.
request()->validate([
'dia' => 'array',
'dia.*' => 'required|string|max:100',
'salida' => 'array',
'llegada.*' => 'required|date_format:H:i',
'llegada' => 'array',
'salida.*' => 'required|date_format:H:i|after:llegada.*'
],[
'salida.*.after' => 'La hora de llegada debe ser anterior a la de salida.'
]);
// Adición de días y horas.
foreach ($request->input('dia') as $i => $dia) {
// Busqueda en la lista de días del evento, y adición en su defecto.
$diaNombre = strtolower(trim($dia)); // ¿HACER FUNCIÓN PARA NORMALIZAR NOMBRES?
$arrayAux = $evento->dias()->where('nombre',$diaNombre)->get();
$diaID = null;
if ($arrayAux->count() == 0) {
$nuevo = new Dia(['nombre' => $diaNombre]);
$nuevo->evento_id = $evento->id;
$nuevo->save();
$diaID = $nuevo->id;
} else {
$diaID = $arrayAux[0]->id;
}
// Creación de hora_flags ingresados para cada día.
$llegadaDia = new HoraFlag([
'dia_id' => $diaID,
'minutoDelDia' => Utils::formatMinutos($request->input('llegada')[$i]),
'flag' => 1
]);
$salidaDia = new HoraFlag([
'dia_id' => $diaID,
'minutoDelDia' => Utils::formatMinutos($request->input('salida')[$i]),
'flag' => -1
]);
// Adición de hora_flags ingresados para cada día.
$llegadaDia->save();
$salidaDia->save();
}
return redirect()->route("show", ['evento' => $evento]);
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\Evento $evento
* @return \Illuminate\Http\Response
*/
public function destroy(Evento $evento)
{
//
}
public function prueba()
{
return view("prueba");
}
}

View File

@ -1,85 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Models\HoraFlag;
use Illuminate\Http\Request;
class HoraFlagController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param \App\Models\HoraFlag $horaFlag
* @return \Illuminate\Http\Response
*/
public function show(HoraFlag $horaFlag)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\HoraFlag $horaFlag
* @return \Illuminate\Http\Response
*/
public function edit(HoraFlag $horaFlag)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\HoraFlag $horaFlag
* @return \Illuminate\Http\Response
*/
public function update(Request $request, HoraFlag $horaFlag)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\HoraFlag $horaFlag
* @return \Illuminate\Http\Response
*/
public function destroy(HoraFlag $horaFlag)
{
//
}
}

View File

@ -1,58 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Dia extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['nombre'];
public function evento() {
return $this->belongsTo(Evento::class);
}
public function horaFlags() {
return $this->hasMany(HoraFlag::class);
}
// ordena las horaFlags asociadas a día por minutoDelDía, de menor a mayor;
// las recorre sumando las flags asociadas a cada una y guardándo el número en cant_actual;
// cuando cant_actual supera a la cantidad guardada en best, se hace un nuevo best:
// se pone best["cantidad"] = cant_actual, en best["inicio"] el minutoDelDia de la hora actual
// y en best["fin"] el minutoDelDía de la hora siguiente (esta hora existe porque si cant_actual
// crece es porque llega a alguien, y por lo tanto hay una hora posterior en la que se va).
// finalmente se devuelve best, con la duración del horario devuelto.
public function marzullo() {
// INICIO
$cant_actual = 0;
$best = ["cantidad" => 0, "inicio" => 0, "fin" => 0];
// Ordenar horaFlags por minutoDelDia
$horas = $this->horaFlags()->orderBy('minutoDelDia')->get();
// var_dump($horas);
// ALGORITMO
foreach ($horas as $i => $hora) {
$cant_actual += $hora->flag;
if ($cant_actual > $best["cantidad"] &&
($horas[$i+1]->flag > 0 || $horas[$i+1]->minutoDelDia - $hora->minutoDelDia > 15)) {
$best["cantidad"] = $cant_actual;
$best["inicio"] = $hora->minutoDelDia;
$best["fin"] = $horas[$i+1]->minutoDelDia;
}
}
// RETURN
$duracion = $best["fin"] - $best["inicio"];
return [$best["cantidad"], $best["inicio"], $best["fin"], $duracion];
}
}

View File

@ -1,57 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Evento extends Model
{
use HasFactory;
public function dias() {
return $this->hasMany(Dia::class);
}
// devuelve los tres mejores marzullos de los días que tiene asociados
public function coordinar(): array {
$marzullos = [];
//devuelve array de
// [dia::string, cantidad::integer, inicio::integer, fin::integer, duracion::integer
// inicioLindo::string, finLindo::string, duracionLinda::string]
foreach ($this->dias as $dia) {
[$a, $b, $c, $d] = $dia->marzullo();
$marzullos[] = ["dia" => $dia->nombre, "cantidad" => $a,
"inicio" => $b, "fin" => $c, "duracion" => $d,
"inicioLindo" => Utils::parseHora($b), "finLindo" => Utils::parseHora($c),
"duracionLinda" => Utils::parseHora($d)];
}
usort($marzullos, array($this, "cmp_cant_marzullo"));
return array_slice($marzullos, 0, 3);
}
/* --- */
//compara marzullos
// $a,$b::[nombre::string, cantidad::integer, horario::string, duracion::integer]
// por cantidad
function cmp_cant_marzullo($a, $b): int {
$cant_a = $a["cantidad"];
$cant_b = $b["cantidad"];
if ($cant_a == $cant_b) {
return $this->cmp_dur_marzullo($a, $b);
}
return ($cant_a > $cant_b) ? -1 : 1;
}
// por duracion
private function cmp_dur_marzullo($a, $b): int {
$dur_a = $a["duracion"];
$dur_b = $b["duracion"];
if ($dur_a == $dur_b) {
return 0;
}
return ($dur_a > $dur_b) ? -1 : 1;
}
}

View File

@ -1,22 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class HoraFlag extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['dia_id', 'minutoDelDia', 'flag'];
public function dia() {
return $this->belongsTo(Dia::class);
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace App\Models;
class Utils {
// El INPUT es un string de forma 'hh:mm' con hh entre 00 y 23 y mm entre 00 y 59
// El OUTPUT es un int
public static function formatMinutos($horaMinuto) {
$hora_minuto_array = explode(':', $horaMinuto);
$horas = (int) $hora_minuto_array[0];
$minutos = (int) $hora_minuto_array[1];
$cantMinutos = ($horas*60) + $minutos;
return $cantMinutos;
}
// El INPUT es un int > 0.
// El OUTPUT es un string de forma 'hh:mm' con hh entre 00 y 23 y mm entre 00 y 59
public static function parseHora($cantMinutos) {
$horas = floor($cantMinutos / 60);
if ($horas < 10) $horas = '0' . $horas;
$minutos = $cantMinutos % 60;
if ($minutos < 10) $minutos = '0' . $minutos;
return $horas . ':' . $minutos;
}
}

View File

@ -10,7 +10,8 @@
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.65",
"laravel/sanctum": "^2.11",
"laravel/tinker": "^2.5"
"laravel/tinker": "^2.5",
"mpdf/mpdf":"^8.0"
},
"require-dev": {
"facade/ignition": "^2.5",

269
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "4e7d5b31e3df4b06e37b56fbbfb4290d",
"content-hash": "3e6171f794f1c0ba92534c8e0a7e773d",
"packages": [
{
"name": "asm89/stack-cors",
@ -1517,16 +1517,16 @@
},
{
"name": "league/flysystem",
"version": "1.1.6",
"version": "1.1.7",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "627be7fcde84c71aa0f15097fcf48fd5f2be5287"
"reference": "3ca8f158ee21efa4bbd4f74bea5730c9b9261e2d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/627be7fcde84c71aa0f15097fcf48fd5f2be5287",
"reference": "627be7fcde84c71aa0f15097fcf48fd5f2be5287",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/3ca8f158ee21efa4bbd4f74bea5730c9b9261e2d",
"reference": "3ca8f158ee21efa4bbd4f74bea5730c9b9261e2d",
"shasum": ""
},
"require": {
@ -1599,7 +1599,7 @@
],
"support": {
"issues": "https://github.com/thephpleague/flysystem/issues",
"source": "https://github.com/thephpleague/flysystem/tree/1.1.6"
"source": "https://github.com/thephpleague/flysystem/tree/1.1.7"
},
"funding": [
{
@ -1607,7 +1607,7 @@
"type": "other"
}
],
"time": "2021-11-21T11:04:36+00:00"
"time": "2021-11-25T19:40:58+00:00"
},
{
"name": "league/mime-type-detection",
@ -1764,6 +1764,139 @@
],
"time": "2021-10-01T21:08:31+00:00"
},
{
"name": "mpdf/mpdf",
"version": "v8.0.15",
"source": {
"type": "git",
"url": "https://github.com/mpdf/mpdf.git",
"reference": "d8a5294a6cc2e814c4157aecc8d7ac25014b18ed"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/d8a5294a6cc2e814c4157aecc8d7ac25014b18ed",
"reference": "d8a5294a6cc2e814c4157aecc8d7ac25014b18ed",
"shasum": ""
},
"require": {
"ext-gd": "*",
"ext-mbstring": "*",
"myclabs/deep-copy": "^1.7",
"paragonie/random_compat": "^1.4|^2.0|^9.99.99",
"php": "^5.6 || ^7.0 || ~8.0.0 || ~8.1.0",
"psr/log": "^1.0 || ^2.0",
"setasign/fpdi": "^2.1"
},
"require-dev": {
"mockery/mockery": "^1.3.0",
"mpdf/qrcode": "^1.1.0",
"squizlabs/php_codesniffer": "^3.5.0",
"tracy/tracy": "^2.4",
"yoast/phpunit-polyfills": "^1.0"
},
"suggest": {
"ext-bcmath": "Needed for generation of some types of barcodes",
"ext-xml": "Needed mainly for SVG manipulation",
"ext-zlib": "Needed for compression of embedded resources, such as fonts"
},
"type": "library",
"autoload": {
"psr-4": {
"Mpdf\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0-only"
],
"authors": [
{
"name": "Matěj Humpál",
"role": "Developer, maintainer"
},
{
"name": "Ian Back",
"role": "Developer (retired)"
}
],
"description": "PHP library generating PDF files from UTF-8 encoded HTML",
"homepage": "https://mpdf.github.io",
"keywords": [
"pdf",
"php",
"utf-8"
],
"support": {
"docs": "http://mpdf.github.io",
"issues": "https://github.com/mpdf/mpdf/issues",
"source": "https://github.com/mpdf/mpdf"
},
"funding": [
{
"url": "https://www.paypal.me/mpdf",
"type": "custom"
}
],
"time": "2021-11-10T08:15:22+00:00"
},
{
"name": "myclabs/deep-copy",
"version": "1.10.2",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220",
"reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"replace": {
"myclabs/deep-copy": "self.version"
},
"require-dev": {
"doctrine/collections": "^1.0",
"doctrine/common": "^2.6",
"phpunit/phpunit": "^7.1"
},
"type": "library",
"autoload": {
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
},
"files": [
"src/DeepCopy/deep_copy.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Create deep copies (clones) of your objects",
"keywords": [
"clone",
"copy",
"duplicate",
"object",
"object graph"
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.10.2"
},
"funding": [
{
"url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
"type": "tidelift"
}
],
"time": "2020-11-13T09:40:50+00:00"
},
{
"name": "nesbot/carbon",
"version": "2.54.0",
@ -2127,6 +2260,56 @@
},
"time": "2021-04-09T13:42:10+00:00"
},
{
"name": "paragonie/random_compat",
"version": "v9.99.100",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a",
"reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a",
"shasum": ""
},
"require": {
"php": ">= 7"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*",
"vimeo/psalm": "^1"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"polyfill",
"pseudorandom",
"random"
],
"support": {
"email": "info@paragonie.com",
"issues": "https://github.com/paragonie/random_compat/issues",
"source": "https://github.com/paragonie/random_compat"
},
"time": "2020-10-15T08:29:30+00:00"
},
{
"name": "phpoption/phpoption",
"version": "1.8.0",
@ -2851,6 +3034,78 @@
],
"time": "2021-09-25T23:10:38+00:00"
},
{
"name": "setasign/fpdi",
"version": "v2.3.6",
"source": {
"type": "git",
"url": "https://github.com/Setasign/FPDI.git",
"reference": "6231e315f73e4f62d72b73f3d6d78ff0eed93c31"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Setasign/FPDI/zipball/6231e315f73e4f62d72b73f3d6d78ff0eed93c31",
"reference": "6231e315f73e4f62d72b73f3d6d78ff0eed93c31",
"shasum": ""
},
"require": {
"ext-zlib": "*",
"php": "^5.6 || ^7.0 || ^8.0"
},
"conflict": {
"setasign/tfpdf": "<1.31"
},
"require-dev": {
"phpunit/phpunit": "~5.7",
"setasign/fpdf": "~1.8",
"setasign/tfpdf": "1.31",
"squizlabs/php_codesniffer": "^3.5",
"tecnickcom/tcpdf": "~6.2"
},
"suggest": {
"setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured."
},
"type": "library",
"autoload": {
"psr-4": {
"setasign\\Fpdi\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jan Slabon",
"email": "jan.slabon@setasign.com",
"homepage": "https://www.setasign.com"
},
{
"name": "Maximilian Kresse",
"email": "maximilian.kresse@setasign.com",
"homepage": "https://www.setasign.com"
}
],
"description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
"homepage": "https://www.setasign.com/fpdi",
"keywords": [
"fpdf",
"fpdi",
"pdf"
],
"support": {
"issues": "https://github.com/Setasign/FPDI/issues",
"source": "https://github.com/Setasign/FPDI/tree/v2.3.6"
},
"funding": [
{
"url": "https://tidelift.com/funding/github/packagist/setasign/fpdi",
"type": "tidelift"
}
],
"time": "2021-02-11T11:37:01+00:00"
},
{
"name": "swiftmailer/swiftmailer",
"version": "v6.3.0",

View File

@ -1,28 +0,0 @@
<?php
namespace Database\Factories;
use App\Models\Dia;
use Illuminate\Database\Eloquent\Factories\Factory;
class DiaFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Dia::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
//
];
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace Database\Factories;
use App\Models\Evento;
use Illuminate\Database\Eloquent\Factories\Factory;
class EventoFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Evento::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
//
];
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace Database\Factories;
use App\Models\HoraFlag;
use Illuminate\Database\Eloquent\Factories\Factory;
class HoraFlagFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = HoraFlag::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
//
];
}
}

View File

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateEventosTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('eventos', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string("nombre");
$table->boolean("abierto")->default(true); //true indica que se pueden agregar nuevas disponibilidades, false que no.
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('eventos');
}
}

View File

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateDiasTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('dias', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->foreignId("evento_id");
$table->string("nombre");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('dias');
}
}

View File

@ -1,34 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateHoraFlagsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('hora_flags', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->foreignId("dia_id");
$table->integer("minutoDelDia");
$table->integer("flag");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('hora_flags');
}
}

View File

@ -1,18 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class DiaSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
//
}
}

View File

@ -1,18 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class EventoSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
//
}
}

View File

@ -1,18 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class HoraFlagSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
//
}
}

View File

@ -1,6 +0,0 @@
[Dolphin]
HeaderColumnWidths=641,72,95,143
Timestamp=2021,7,28,19,15,55.598
Version=4
ViewMode=1
VisibleRoles=Details_text,Details_type,Details_size,Details_modificationtime,CustomizedDetails

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

0
public/css/app.css vendored
View File

View File

@ -1,23 +0,0 @@
#logo {
width:80%;
margin: auto;
}
div.p-6 {
text-align: center;
}
button, input[type="submit"] {
background: darkred;
border-radius: 5px;
padding: 5px;
color:white;
margin: 15px;
}
input.formulario {
background-color: white;
border-radius: 5px;
padding: 5px;
}

View File

@ -8,11 +8,11 @@ div.p-6 {
}
button, input[type="submit"] {
background: darkred;
border-radius: 5px;
padding: 5px;
background:teal;
border-radius:5px;
padding:5px;
color:white;
margin: 15px;
margin:15px;
}
input.formulario {

View File

@ -1,11 +0,0 @@
<!-- [dia::string, cantidad::integer, inicio::integer, fin::integer, duracion::integer
inicioLindo::string, finLindo::string, duracionLinda::string] -->
<div class="marzullo">
<h3>
{{ $marzullo["dia"] }}
</h3>
<p>
Desde {{ $marzullo["inicioLindo"] }} hasta {{ $marzullo["finLindo"] }}
pueden {{ $marzullo["cantidad"] }} personas (duración: {{ $marzullo["duracionLinda"] }}).
</p>
</div>

View File

@ -1,64 +0,0 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Planifibot</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap" rel="stylesheet">
<link href='css/welcome.css' rel="stylesheet">
<!-- Styles -->
<style>
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}a{background-color:transparent}[hidden]{display:none}html{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}*,:after,:before{box-sizing:border-box;border:0 solid #e2e8f0}a{color:inherit;text-decoration:inherit}svg,video{display:block;vertical-align:middle}video{max-width:100%;height:auto}.bg-white{--bg-opacity:1;background-color:#fff;background-color:rgba(255,255,255,var(--bg-opacity))}.bg-gray-100{--bg-opacity:1;background-color:#f7fafc;background-color:rgba(247,250,252,var(--bg-opacity))}.border-gray-200{--border-opacity:1;border-color:#edf2f7;border-color:rgba(237,242,247,var(--border-opacity))}.border-t{border-top-width:1px}.flex{display:flex}.grid{display:grid}.hidden{display:none}.items-center{align-items:center}.justify-center{justify-content:center}.font-semibold{font-weight:600}.h-5{height:1.25rem}.h-8{height:2rem}.h-16{height:4rem}.text-sm{font-size:.875rem}.text-lg{font-size:1.125rem}.leading-7{line-height:1.75rem}.mx-auto{margin-left:auto;margin-right:auto}.ml-1{margin-left:.25rem}.mt-2{margin-top:.5rem}.mr-2{margin-right:.5rem}.ml-2{margin-left:.5rem}.mt-4{margin-top:1rem}.ml-4{margin-left:1rem}.mt-8{margin-top:2rem}.ml-12{margin-left:3rem}.-mt-px{margin-top:-1px}.max-w-6xl{max-width:72rem}.min-h-screen{min-height:100vh}.overflow-hidden{overflow:hidden}.p-6{padding:1.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.pt-8{padding-top:2rem}.fixed{position:fixed}.relative{position:relative}.top-0{top:0}.right-0{right:0}.shadow{box-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px 0 rgba(0,0,0,.06)}.text-center{text-align:center}.text-gray-200{--text-opacity:1;color:#edf2f7;color:rgba(237,242,247,var(--text-opacity))}.text-gray-300{--text-opacity:1;color:#e2e8f0;color:rgba(226,232,240,var(--text-opacity))}.text-gray-400{--text-opacity:1;color:#cbd5e0;color:rgba(203,213,224,var(--text-opacity))}.text-gray-500{--text-opacity:1;color:#a0aec0;color:rgba(160,174,192,var(--text-opacity))}.text-gray-600{--text-opacity:1;color:#718096;color:rgba(113,128,150,var(--text-opacity))}.text-gray-700{--text-opacity:1;color:#4a5568;color:rgba(74,85,104,var(--text-opacity))}.text-gray-900{--text-opacity:1;color:#1a202c;color:rgba(26,32,44,var(--text-opacity))}.underline{text-decoration:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.w-5{width:1.25rem}.w-8{width:2rem}.w-auto{width:auto}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}@media (min-width:640px){.sm\:rounded-lg{border-radius:.5rem}.sm\:block{display:block}.sm\:items-center{align-items:center}.sm\:justify-start{justify-content:flex-start}.sm\:justify-between{justify-content:space-between}.sm\:h-20{height:5rem}.sm\:ml-0{margin-left:0}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:pt-0{padding-top:0}.sm\:text-left{text-align:left}.sm\:text-right{text-align:right}}@media (min-width:768px){.md\:border-t-0{border-top-width:0}.md\:border-l{border-left-width:1px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:1024px){.lg\:px-8{padding-left:2rem;padding-right:2rem}}@media (prefers-color-scheme:dark){.dark\:bg-gray-800{--bg-opacity:1;background-color:#2d3748;background-color:rgba(45,55,72,var(--bg-opacity))}.dark\:bg-gray-900{--bg-opacity:1;background-color:#1a202c;background-color:rgba(26,32,44,var(--bg-opacity))}.dark\:border-gray-700{--border-opacity:1;border-color:#4a5568;border-color:rgba(74,85,104,var(--border-opacity))}.dark\:text-white{--text-opacity:1;color:#fff;color:rgba(255,255,255,var(--text-opacity))}.dark\:text-gray-400{--text-opacity:1;color:#cbd5e0;color:rgba(203,213,224,var(--text-opacity))}}
</style>
<style>
body {
font-family: 'Nunito', sans-serif;
}
</style>
</head>
<body class="antialiased">
<div class="relative flex items-top justify-center min-h-screen bg-gray-100 dark:bg-gray-900 sm:items-center py-4 sm:pt-0">
@if (Route::has('login'))
<div class="hidden fixed top-0 right-0 px-6 py-4 sm:block">
@auth
<a href="{{ url('/home') }}" class="text-sm text-gray-700 underline">Home</a>
@else
<a href="{{ route('login') }}" class="text-sm text-gray-700 underline">Log in</a>
@if (Route::has('register'))
<a href="{{ route('register') }}" class="ml-4 text-sm text-gray-700 underline">Register</a>
@endif
@endauth
</div>
@endif
<div class="max-w-6xl mx-auto sm:px-6 lg:px-8">
<div class="flex justify-center pt-8 sm:justify-start sm:pt-0">
<img id= "logo" src="assets/logoMPS.png" alt="Mercado Popular de Subsitencia">
</div>
<div class="mt-8 bg-white dark:bg-gray-800 overflow-hidden shadow sm:rounded-lg">
<div class="grid grid-cols-1 md:grid-cols-2">
<div class="p-6">
<h1>
Funcionó
</h1>
</div>
</div>
</div>
<div class="flex justify-center mt-4 sm:items-center sm:justify-between">
<div class="ml-4 text-center text-sm text-gray-500 sm:text-right sm:ml-0">
Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,73 +0,0 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Planifibot - {{ $evento->nombre }}</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap" rel="stylesheet">
<link href='/css/resultado.css' rel="stylesheet">
<!-- Styles -->
<style>
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}a{background-color:transparent}[hidden]{display:none}html{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}*,:after,:before{box-sizing:border-box;border:0 solid #e2e8f0}a{color:inherit;text-decoration:inherit}svg,video{display:block;vertical-align:middle}video{max-width:100%;height:auto}.bg-white{--bg-opacity:1;background-color:#fff;background-color:rgba(255,255,255,var(--bg-opacity))}.bg-gray-100{--bg-opacity:1;background-color:#f7fafc;background-color:rgba(247,250,252,var(--bg-opacity))}.border-gray-200{--border-opacity:1;border-color:#edf2f7;border-color:rgba(237,242,247,var(--border-opacity))}.border-t{border-top-width:1px}.flex{display:flex}.grid{display:grid}.hidden{display:none}.items-center{align-items:center}.justify-center{justify-content:center}.font-semibold{font-weight:600}.h-5{height:1.25rem}.h-8{height:2rem}.h-16{height:4rem}.text-sm{font-size:.875rem}.text-lg{font-size:1.125rem}.leading-7{line-height:1.75rem}.mx-auto{margin-left:auto;margin-right:auto}.ml-1{margin-left:.25rem}.mt-2{margin-top:.5rem}.mr-2{margin-right:.5rem}.ml-2{margin-left:.5rem}.mt-4{margin-top:1rem}.ml-4{margin-left:1rem}.mt-8{margin-top:2rem}.ml-12{margin-left:3rem}.-mt-px{margin-top:-1px}.max-w-6xl{max-width:72rem}.min-h-screen{min-height:100vh}.overflow-hidden{overflow:hidden}.p-6{padding:1.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.pt-8{padding-top:2rem}.fixed{position:fixed}.relative{position:relative}.top-0{top:0}.right-0{right:0}.shadow{box-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px 0 rgba(0,0,0,.06)}.text-center{text-align:center}.text-gray-200{--text-opacity:1;color:#edf2f7;color:rgba(237,242,247,var(--text-opacity))}.text-gray-300{--text-opacity:1;color:#e2e8f0;color:rgba(226,232,240,var(--text-opacity))}.text-gray-400{--text-opacity:1;color:#cbd5e0;color:rgba(203,213,224,var(--text-opacity))}.text-gray-500{--text-opacity:1;color:#a0aec0;color:rgba(160,174,192,var(--text-opacity))}.text-gray-600{--text-opacity:1;color:#718096;color:rgba(113,128,150,var(--text-opacity))}.text-gray-700{--text-opacity:1;color:#4a5568;color:rgba(74,85,104,var(--text-opacity))}.text-gray-900{--text-opacity:1;color:#1a202c;color:rgba(26,32,44,var(--text-opacity))}.underline{text-decoration:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.w-5{width:1.25rem}.w-8{width:2rem}.w-auto{width:auto}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}@media (min-width:640px){.sm\:rounded-lg{border-radius:.5rem}.sm\:block{display:block}.sm\:items-center{align-items:center}.sm\:justify-start{justify-content:flex-start}.sm\:justify-between{justify-content:space-between}.sm\:h-20{height:5rem}.sm\:ml-0{margin-left:0}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:pt-0{padding-top:0}.sm\:text-left{text-align:left}.sm\:text-right{text-align:right}}@media (min-width:768px){.md\:border-t-0{border-top-width:0}.md\:border-l{border-left-width:1px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:1024px){.lg\:px-8{padding-left:2rem;padding-right:2rem}}@media (prefers-color-scheme:dark){.dark\:bg-gray-800{--bg-opacity:1;background-color:#2d3748;background-color:rgba(45,55,72,var(--bg-opacity))}.dark\:bg-gray-900{--bg-opacity:1;background-color:#1a202c;background-color:rgba(26,32,44,var(--bg-opacity))}.dark\:border-gray-700{--border-opacity:1;border-color:#4a5568;border-color:rgba(74,85,104,var(--border-opacity))}.dark\:text-white{--text-opacity:1;color:#fff;color:rgba(255,255,255,var(--text-opacity))}.dark\:text-gray-400{--text-opacity:1;color:#cbd5e0;color:rgba(203,213,224,var(--text-opacity))}}
</style>
<style>
body {
font-family: 'Nunito', sans-serif;
}
</style>
</head>
<body class="antialiased">
<div class="relative flex items-top justify-center min-h-screen bg-gray-100 dark:bg-gray-900 sm:items-center py-4 sm:pt-0">
@if (Route::has('login'))
<div class="hidden fixed top-0 right-0 px-6 py-4 sm:block">
@auth
<a href="{{ url('/home') }}" class="text-sm text-gray-700 underline">Home</a>
@else
<a href="{{ route('login') }}" class="text-sm text-gray-700 underline">Log in</a>
@if (Route::has('register'))
<a href="{{ route('register') }}" class="ml-4 text-sm text-gray-700 underline">Register</a>
@endif
@endauth
</div>
@endif
<div class="max-w-6xl mx-auto sm:px-6 lg:px-8">
<div class="flex justify-center pt-8 sm:justify-start sm:pt-0">
<img id= "logo" src="/assets/logoMPS.png" alt="Mercado Popular de Subsitencia">
</div>
<div class="flex justify-center pt-8 sm:justify-start sm:pt-0">
<h1>
{{ $evento->nombre }}
</h1>
</div>
<div class="mt-8 bg-white dark:bg-gray-800 overflow-hidden shadow sm:rounded-lg">
<div class="grid grid-cols-1 md:grid-cols-2">
<div class="p-6">
<p>
Hasta ahora estos son los mejores horarios para "{{ $evento->nombre }}":
</p>
@each('marzullo', $marzullos, 'marzullo')
</div>
</div>
</div>
<div class="flex justify-center mt-4 sm:items-center sm:justify-between">
<div class="ml-4 text-center text-sm text-gray-500 sm:text-right sm:ml-0">
Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Planifibo7</title>
<title>Librilladora</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap" rel="stylesheet">
@ -40,28 +40,16 @@
<div class="max-w-6xl mx-auto sm:px-6 lg:px-8">
<div class="flex justify-center pt-8 sm:justify-start sm:pt-0">
<img id= "logo" src="assets/logoMPS.png" alt="Mercado Popular de Subsitencia">
<h1>Librilladora</h1>
</div>
<div class="mt-8 bg-white dark:bg-gray-800 overflow-hidden shadow sm:rounded-lg">
<div class="grid grid-cols-1 md:grid-cols-2">
<div class="p-6">
<form id="nuevoevento" method="post" action="{{route('store')}}">
@csrf
<input required name="nombre" type="text" class="formulario">
@error('nombre')
<div class="alert alert-danger">El evento precisa nombre.</div>
@enderror
<input type="submit" value="Crear evento">
</form>
</div>
<div class="p-6 border-t border-gray-200 dark:border-gray-700 md:border-t-0 md:border-l">
<form id="contrasena">
<input required name="contrasena" type="text" class="formulario">
<input type="submit" value="Gestionar evento">
</form>
</div>
<div class="p-6">
<form id="archivo" >
@csrf
<input required name="Archivo" type="text" class="formulario">
<input type="submit" value="Cargar archivo">
</form>
</div>
</div>

View File

@ -17,11 +17,3 @@ use App\Http\Controllers\EventoController;
Route::get('/', function () {
return view('welcome');
});
Route::post('/eventos', [EventoController::class, 'store'])->name('store');
Route::post('/eventos/{evento}', [EventoController::class, 'update'])->name('update');
Route::get('/eventos/{evento}', [EventoController::class, 'edit'])->name('edit');
Route::get('/eventos/{evento}/resultado', [EventoController::class, 'show'])->name('show');