From a1585c597b7db5c30d483383d34f17f6d5a9d2f3 Mon Sep 17 00:00:00 2001 From: matias mella Date: Tue, 27 Jul 2021 00:00:36 -0400 Subject: [PATCH] nuevas vistas --- frontend/package.json | 2 +- frontend/src/app/app-routing.module.ts | 4 + frontend/src/app/app.component.html | 63 +- frontend/src/app/app.module.ts | 10 +- .../agregar-res/agregar-res.component.html | 23 +- .../agregar-res/agregar-res.component.ts | 21 +- .../agregar-usuario.component.html | 33 +- .../agregar-usuario.component.scss | 4 + .../agregar-usuario.component.ts | 11 + .../mesas-restarant.component.html | 33 + .../mesas-restarant.component.scss | 1 + .../mesas-restarant.component.ts | 15 + .../modal-usuario.component.html | 67 + .../modal-usuario.component.scss | 0 .../modal-usuario/modal-usuario.component.ts | 54 + .../app/components/modal/modal.component.html | 69 + .../app/components/modal/modal.component.scss | 0 .../app/components/modal/modal.component.ts | 57 + .../components/private/private.component.html | 23 +- .../components/private/private.component.ts | 17 +- .../components/public/public.component.html | 41 +- .../components/public/public.component.scss | 13 + .../sectores/sectores.component.html | 52 + .../sectores/sectores.component.scss | 0 .../components/sectores/sectores.component.ts | 43 + frontend/src/app/restaurantes.service.ts | 32 +- frontend/src/index.html | 5 + frontend/src/styles.scss | 21685 ++++++++++++++++ 28 files changed, 22263 insertions(+), 115 deletions(-) create mode 100644 frontend/src/app/components/mesas-restarant/mesas-restarant.component.html create mode 100644 frontend/src/app/components/mesas-restarant/mesas-restarant.component.scss create mode 100644 frontend/src/app/components/mesas-restarant/mesas-restarant.component.ts create mode 100644 frontend/src/app/components/modal-usuario/modal-usuario.component.html create mode 100644 frontend/src/app/components/modal-usuario/modal-usuario.component.scss create mode 100644 frontend/src/app/components/modal-usuario/modal-usuario.component.ts create mode 100644 frontend/src/app/components/modal/modal.component.html create mode 100644 frontend/src/app/components/modal/modal.component.scss create mode 100644 frontend/src/app/components/modal/modal.component.ts create mode 100644 frontend/src/app/components/sectores/sectores.component.html create mode 100644 frontend/src/app/components/sectores/sectores.component.scss create mode 100644 frontend/src/app/components/sectores/sectores.component.ts diff --git a/frontend/package.json b/frontend/package.json index b3954cc..e4b6eba 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -21,7 +21,7 @@ "@angular/router": "~12.0.1", "@auth0/auth0-angular": "^1.5.1", "@ng-bootstrap/ng-bootstrap": "^10.0.0", - "bootstrap": "^4.5.0", + "bootstrap": "^4.6.0", "rxjs": "~6.6.0", "tslib": "^2.1.0", "zone.js": "~0.11.4" diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index 2e1cbf2..6138331 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -7,6 +7,8 @@ import {AuthGuard} from "./guards/auth.guard"; //import { AuthGuard } from '@auth0/auth0-angular'; import {AgregarResComponent} from "./components/agregar-res/agregar-res.component"; import {AgregarUsuarioComponent} from "./components/agregar-usuario/agregar-usuario.component"; +import {MesasRestarantComponent} from "./components/mesas-restarant/mesas-restarant.component"; +import {SectoresComponent} from "./components/sectores/sectores.component"; const routes: Routes = [ @@ -14,6 +16,8 @@ const routes: Routes = [ { path: 'private', component:PrivateComponent, canActivate: [AuthGuard]}, {path: 'agregar.res', component:AgregarResComponent, canActivate:[AuthGuard]}, {path: 'agregar.usu', component:AgregarUsuarioComponent, canActivate:[AuthGuard]}, + {path: 'mesaRers', component:MesasRestarantComponent, canActivate:[AuthGuard]}, + {path: 'sectoresRes', component:SectoresComponent, canActivate:[AuthGuard]}, {path: '**', pathMatch: 'full', redirectTo: 'public'} ]; diff --git a/frontend/src/app/app.component.html b/frontend/src/app/app.component.html index 3491052..cd522da 100644 --- a/frontend/src/app/app.component.html +++ b/frontend/src/app/app.component.html @@ -1,37 +1,38 @@ - + +
+
+ +
+
+ diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index f9f5e80..685c8a8 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -10,6 +10,10 @@ import { PrivateComponent } from './components/private/private.component'; import { AgregarResComponent } from './components/agregar-res/agregar-res.component'; import { AgregarUsuarioComponent } from './components/agregar-usuario/agregar-usuario.component'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { ModalComponent } from './components/modal/modal.component'; +import { ModalUsuarioComponent } from './components/modal-usuario/modal-usuario.component'; +import { MesasRestarantComponent } from './components/mesas-restarant/mesas-restarant.component'; +import { SectoresComponent } from './components/sectores/sectores.component'; @NgModule({ declarations: [ @@ -17,7 +21,11 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; PublicComponent, PrivateComponent, AgregarResComponent, - AgregarUsuarioComponent + AgregarUsuarioComponent, + ModalComponent, + ModalUsuarioComponent, + MesasRestarantComponent, + SectoresComponent ], imports: [ BrowserModule, diff --git a/frontend/src/app/components/agregar-res/agregar-res.component.html b/frontend/src/app/components/agregar-res/agregar-res.component.html index b6b5060..018bde3 100644 --- a/frontend/src/app/components/agregar-res/agregar-res.component.html +++ b/frontend/src/app/components/agregar-res/agregar-res.component.html @@ -1,19 +1,17 @@
- + +
- + - - + + - - - @@ -21,16 +19,7 @@
- -

- nombre: -

-

-

-

- -
- + diff --git a/frontend/src/app/components/agregar-res/agregar-res.component.ts b/frontend/src/app/components/agregar-res/agregar-res.component.ts index f874f69..74e99a8 100644 --- a/frontend/src/app/components/agregar-res/agregar-res.component.ts +++ b/frontend/src/app/components/agregar-res/agregar-res.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit, Output,EventEmitter} from '@angular/core'; import {RestaurantesService} from "../../restaurantes.service"; @Component({ @@ -9,6 +9,10 @@ import {RestaurantesService} from "../../restaurantes.service"; export class AgregarResComponent implements OnInit { restaurante: any; + idSelect:any; + nombreSelect:any; + + agre={ nombre:null @@ -22,24 +26,31 @@ export class AgregarResComponent implements OnInit { } recuperartodos(){ + console.log(this.restaurante); this.restaurantServ.mostrarTodosRes().subscribe(result => this.restaurante = result); } agregarRes(){ - this.restaurantServ.agregar(this.agre).subscribe(this.recuperartodos) + this.restaurantServ.agregar(this.agre).subscribe((respuesta)=>{ + this.recuperartodos(); + }); } eliminarRes(id:any){ if(confirm("Esta seguro de eliminar este registro?")) { this.restaurantServ.eliminar(id).subscribe() } } - modificarRes(id:any){ - console.log(id,this.agre) - this.restaurantServ.modificar(id,this.agre).subscribe(); + modificarResModal(id:any,nombre:any){ + this.idSelect= id; + this.nombreSelect= nombre; + } + + + hayregistro(){ return true; } diff --git a/frontend/src/app/components/agregar-usuario/agregar-usuario.component.html b/frontend/src/app/components/agregar-usuario/agregar-usuario.component.html index 433a3d1..dcbed4c 100644 --- a/frontend/src/app/components/agregar-usuario/agregar-usuario.component.html +++ b/frontend/src/app/components/agregar-usuario/agregar-usuario.component.html @@ -1,35 +1,20 @@ -
idnombreidnombre
{{r.id}}
{{r.id}} {{r.nombre}}

- +
+ - + - + - - - +
idnombrecreacionmodificacionrolesidnombreroles
{{r.id}} {{r.nombre}}{{r['created_at']}}{{r['updated_at']}}{{r.roles}} {{f}}
-
-

- nombre: -

-

email:

-

nombre de usuario:

-

Contraseña:

-

roles:

-

restaurante:

+ -

-

-
-
-

nombre:

-

roles:

-

-
+ diff --git a/frontend/src/app/components/agregar-usuario/agregar-usuario.component.scss b/frontend/src/app/components/agregar-usuario/agregar-usuario.component.scss index e69de29..9abed18 100644 --- a/frontend/src/app/components/agregar-usuario/agregar-usuario.component.scss +++ b/frontend/src/app/components/agregar-usuario/agregar-usuario.component.scss @@ -0,0 +1,4 @@ +.spam_magin{ + margin-right: 2px; + margin-left: 2px; +} diff --git a/frontend/src/app/components/agregar-usuario/agregar-usuario.component.ts b/frontend/src/app/components/agregar-usuario/agregar-usuario.component.ts index 470abc4..d5b84f8 100644 --- a/frontend/src/app/components/agregar-usuario/agregar-usuario.component.ts +++ b/frontend/src/app/components/agregar-usuario/agregar-usuario.component.ts @@ -10,6 +10,9 @@ import {RestaurantesService} from "../../restaurantes.service"; export class AgregarUsuarioComponent implements OnInit { usuarios: any; + idSelect:any; + nombreSelect:any; + agreU={ nombre:null, @@ -44,6 +47,14 @@ export class AgregarUsuarioComponent implements OnInit { } modificarUsu(id:any){ this.restaurantServ.moficiarUsu(id,this.modi).subscribe(); + } + modificarModelUsuario(id:any,nombre:any){ + this.idSelect=id; + this.nombreSelect=nombre; + + + + } } diff --git a/frontend/src/app/components/mesas-restarant/mesas-restarant.component.html b/frontend/src/app/components/mesas-restarant/mesas-restarant.component.html new file mode 100644 index 0000000..efb338c --- /dev/null +++ b/frontend/src/app/components/mesas-restarant/mesas-restarant.component.html @@ -0,0 +1,33 @@ +
+
+
Mesa 1
+ +
    +
  • Cras justo odio
  • +
  • Dapibus ac facilisis in
  • +
  • Morbi leo risus
  • +
  • Porta ac consectetur ac
  • +
  • Vestibulum at eros
  • +
+ + Go somewhere +
+
+
+ Card image cap +
+
Card title
+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
    +
  • Cras justo odio
  • +
  • Dapibus ac facilisis in
  • +
  • Vestibulum at eros
  • +
+ +
+ + diff --git a/frontend/src/app/components/mesas-restarant/mesas-restarant.component.scss b/frontend/src/app/components/mesas-restarant/mesas-restarant.component.scss new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/frontend/src/app/components/mesas-restarant/mesas-restarant.component.scss @@ -0,0 +1 @@ + diff --git a/frontend/src/app/components/mesas-restarant/mesas-restarant.component.ts b/frontend/src/app/components/mesas-restarant/mesas-restarant.component.ts new file mode 100644 index 0000000..9958a08 --- /dev/null +++ b/frontend/src/app/components/mesas-restarant/mesas-restarant.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-mesas-restarant', + templateUrl: './mesas-restarant.component.html', + styleUrls: ['./mesas-restarant.component.scss'] +}) +export class MesasRestarantComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/frontend/src/app/components/modal-usuario/modal-usuario.component.html b/frontend/src/app/components/modal-usuario/modal-usuario.component.html new file mode 100644 index 0000000..5ecfb3b --- /dev/null +++ b/frontend/src/app/components/modal-usuario/modal-usuario.component.html @@ -0,0 +1,67 @@ + + + diff --git a/frontend/src/app/components/modal-usuario/modal-usuario.component.scss b/frontend/src/app/components/modal-usuario/modal-usuario.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/app/components/modal-usuario/modal-usuario.component.ts b/frontend/src/app/components/modal-usuario/modal-usuario.component.ts new file mode 100644 index 0000000..f8ec753 --- /dev/null +++ b/frontend/src/app/components/modal-usuario/modal-usuario.component.ts @@ -0,0 +1,54 @@ +import { Component, OnInit,Input } from '@angular/core'; +import {RestaurantesService} from "../../restaurantes.service"; + +@Component({ + selector: 'app-modal-usuario', + templateUrl: './modal-usuario.component.html', + styleUrls: ['./modal-usuario.component.scss'] +}) +export class ModalUsuarioComponent implements OnInit { + + usuarios: any; + + @Input()idModalUsu:any; + @Input()NombreModalusu:any; + + + agreU={ + nombre:null, + email:null, + username:null, + password:null, + roles:['admines'], + restaurant:null + } + modi={ + nombre: null, + roles:['productor'] + } + + constructor(private restaurantServ : RestaurantesService) { } + + ngOnInit(): void { + this.recuperarUsuarios(); + } + + recuperarUsuarios(){ + this.restaurantServ.mostrarUsuarios().subscribe(result => this.usuarios = result) + } + AgregarUsu(){ + this.restaurantServ.agregarUsu(this.agreU).subscribe(this.recuperarUsuarios) + } + eliminarUsu(id:any){ + if(confirm("Esta seguro de eliminar este registro?")){ + this.restaurantServ.eliminarUsu(id).subscribe(); + + } + + } + modificarUsu(id:any){ + this.restaurantServ.moficiarUsu(id,this.modi).subscribe(); + } + + +} diff --git a/frontend/src/app/components/modal/modal.component.html b/frontend/src/app/components/modal/modal.component.html new file mode 100644 index 0000000..b9b3974 --- /dev/null +++ b/frontend/src/app/components/modal/modal.component.html @@ -0,0 +1,69 @@ + + + + + + + + + + diff --git a/frontend/src/app/components/modal/modal.component.scss b/frontend/src/app/components/modal/modal.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/app/components/modal/modal.component.ts b/frontend/src/app/components/modal/modal.component.ts new file mode 100644 index 0000000..c33c2c4 --- /dev/null +++ b/frontend/src/app/components/modal/modal.component.ts @@ -0,0 +1,57 @@ +import {Component, Input, OnInit} from '@angular/core'; +import {RestaurantesService} from "../../restaurantes.service"; + +@Component({ + selector: 'app-modal', + templateUrl: './modal.component.html', + styleUrls: ['./modal.component.scss'] +}) +export class ModalComponent implements OnInit { + + @Input()idModalRes:any; + @Input()nombreSelect:any; + id:any; + restaurante:any; + + + + agre={ + nombre:null + + } + + + + constructor(private restaurantServ : RestaurantesService) { + this.id = this.idModalRes; + } + + ngOnInit(): void { + console.log(this.id); + this.recuperartodos(); + } + +recuperartodos(){ + console.log(this.restaurante); + this.restaurantServ.mostrarTodosRes().subscribe(result => this.restaurante = result); +} + + agregarRes(){ + + this.restaurantServ.agregar(this.agre).subscribe((respuesta)=>{ + this.recuperartodos(); + }); + } + modificarRes(id:any){ + console.log(id,this.agre) + + this.restaurantServ.modificar(id,this.agre).subscribe(); + } + eliminarRes(id:any){ + if(confirm("Esta seguro de eliminar este registro?")) { + this.restaurantServ.eliminar(id).subscribe() + } + } + + +} diff --git a/frontend/src/app/components/private/private.component.html b/frontend/src/app/components/private/private.component.html index a7b776c..92c5834 100644 --- a/frontend/src/app/components/private/private.component.html +++ b/frontend/src/app/components/private/private.component.html @@ -1,5 +1,18 @@ -
-  
-    {{dato | json}}
-  
-
+
+{{user | json}}
+  
+ + + + + + + + + + + + + + +
idnombreroles
{{r.id}}{{r.nombre}} {{f}}
diff --git a/frontend/src/app/components/private/private.component.ts b/frontend/src/app/components/private/private.component.ts index e6c07e7..2661279 100644 --- a/frontend/src/app/components/private/private.component.ts +++ b/frontend/src/app/components/private/private.component.ts @@ -3,6 +3,7 @@ import {AuthService} from "@auth0/auth0-angular"; import { concatMap, tap, pluck } from 'rxjs/operators'; import { HttpClient } from '@angular/common/http'; +import {RestaurantesService} from "../../restaurantes.service"; @Component({ selector: 'app-private', @@ -11,21 +12,15 @@ import { HttpClient } from '@angular/common/http'; }) export class PrivateComponent implements OnInit { dato = {}; + usuarios: any; + algo:any; - constructor(public auth: AuthService, private http: HttpClient) { } + constructor(public auth: AuthService, private http: HttpClient, private restaurantServ : RestaurantesService) { } ngOnInit(): void { - this.auth.user$ - .pipe( - tap((user)=>console.log(user)), - concatMap((user)=> - this.http.get(`https://api.unified.restaurant/api/v1/users/${user?.sub}`) - ), - tap((userdato) =>(this.dato = userdato)) - ).subscribe(); - console.log(); - } + + } diff --git a/frontend/src/app/components/public/public.component.html b/frontend/src/app/components/public/public.component.html index 8b9e47d..e463b24 100644 --- a/frontend/src/app/components/public/public.component.html +++ b/frontend/src/app/components/public/public.component.html @@ -1,22 +1,27 @@ - - -
- Random first slide +