This commit is contained in:
nat 2022-05-25 13:37:14 -03:00
parent dce0620365
commit 7f0c9a23f6
6 changed files with 133 additions and 18 deletions

View File

@ -19,6 +19,8 @@ class CreateUsersTable extends Migration
$table->string('email')->unique()->nullable();
$table->timestamp('email_verified_at')->nullable();
$table->foreignId('grupo_de_compra_id')->nullable();
$table->boolean('is_admin');
$table->unique(['name', 'is_admin']);
$table->string('password');
$table->rememberToken();
$table->timestamps();

View File

@ -32,6 +32,14 @@ class GrupoDeCompraSeeder extends Seeder
$usersToInsert[] = [
'name' => $registro['barrio'],
'password' => Hash::make($registro['barrio']),
"is_admin" => 0,
'grupo_de_compra_id' => $key
];
$usersToInsert[] = [
'name' => $registro['barrio'] . "_admin",
'password' => Hash::make("admin"),
"is_admin" => 1,
'grupo_de_compra_id' => $key
];
}

31
public/js/login.js vendored
View File

@ -109,6 +109,37 @@ Vue.component('login', {
}
});
Vue.component('admin-login', {
template: `
<div v-show="visible" class="block">
<div class="field">
<label class="label">Contraseña de admin</label>
<p class="control">
<input required class="input" type="password" name="password" placeholder="Contraseña de admin">
</p>
<p class="help">Si no la sabés, consultá a la comisión de informática.</p>
</div>
<div class="field">
<div class="control">
<input type="submit" class="button is-success" value="Ingresar">
</input>
</div>
</div>
</div>`,
data() {
return {
visible: false,
gdc: null
}
},
mounted() {
Event.$on('gdc-seleccionado', (gdc) => {
this.gdc = gdc;
this.visible = true;
});
}
});
new Vue({
el: '#root'
});

View File

@ -0,0 +1,53 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ config('app.name', 'Compras del MPS') }}</title>
<script src="https://kit.fontawesome.com/9235d1c676.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
</head>
<body>
<nav class="navbar is-danger" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="https://mps.org.uy">
<img src="/assets/logoMPS.png" height="28">
</a>
<a class="navbar-item" href="login">
<span class="icon">
<i class="fas fa-user"></i>
</span>
<span>Hacer pedido</span>
</a>
</div>
</nav>
<section class="section">
<div id="root" class="container">
<div class="block">
<h1 class="title">
Ingresar como admin
</h1>
<p class="subtitle">
Ingresa aquí para aprobar los pedidos de tus compas del barrio una vez que te hayan transferido el pago.
</p>
@error('name')
<div class="notification is-danger">
Contraseña incorrecta, intentalo nuevamente.
</div>
@enderror
<region-select></region-select>
<form method="post" action="login">
@csrf
<barrio-select></barrio-select>
<admin-login></admin-login>
</form>
</div>
</div>
</section>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="{{ asset('js/login.js') }}" defer></script>
</body>
</html>

View File

@ -4,29 +4,46 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ config('app.name', 'Compras del MPS') }}</title>
<script src="https://kit.fontawesome.com/9235d1c676.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
</head>
<body>
<section class="section">
<div id="root" class="container">
<h1 class="title">
Compras MPS
</h1>
<p class="subtitle">
Bienvenidx a la aplicación de compras del <strong>Mercado Popular de Subsistencia</strong>
</p>
@error('name')
<div class="notification is-danger">
Contraseña incorrecta, intentalo nuevamente.
<nav class="navbar is-danger" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="https://mps.org.uy">
<img src="/assets/logoMPS.png" height="28">
</a>
<a class="navbar-item" href="admin-login">
<span class="icon">
<i class="fas fa-user-check"></i>
</span>
<span>Admin</span>
</a>
</div>
@enderror
<region-select></region-select>
<form method="post" action="login">
@csrf
<barrio-select></barrio-select>
<login></login>
</form>
</nav>
<section class="section">
<div id="root" class="container">
<div class="block">
<h1 class="title">
Canasta 78 - JUNIO
</h1>
<p class="subtitle">
Bienvenidx a la aplicación de compras del <strong>Mercado Popular de Subsistencia</strong>
</p>
@error('name')
<div class="notification is-danger">
Contraseña incorrecta, intentalo nuevamente.
</div>
@enderror
<region-select></region-select>
<form method="post" action="login">
@csrf
<barrio-select></barrio-select>
<login></login>
</form>
</div>
</div>
</section>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>

View File

@ -53,3 +53,7 @@ Route::middleware('auth')->group( function() {
})->name('obtenerSesion');
});
});
Route::get('/admin-login', function() {
return view("auth/admin_login");
});