Commit 62dcd0610776754b2ba24568210515a9593ae41c
Exists in
master
Merge branch 'master' of http://git.focasoftware.com/angular/autoservicio
Showing
6 changed files
Show diff stats
src/app/app.module.ts
1 | //#region MODULES | 1 | //#region MODULES |
2 | import { BrowserModule } from '@angular/platform-browser'; | 2 | import { BrowserModule } from '@angular/platform-browser'; |
3 | import { NgModule } from '@angular/core'; | 3 | import { NgModule } from '@angular/core'; |
4 | import { AppRoutingModule } from './app-routing.module'; | 4 | import { AppRoutingModule } from './app-routing.module'; |
5 | import { HttpClientModule } from '@angular/common/http'; | 5 | import { HttpClientModule } from '@angular/common/http'; |
6 | import { FormsModule, ReactiveFormsModule } from '@angular/forms'; | 6 | import { FormsModule, ReactiveFormsModule } from '@angular/forms'; |
7 | import { TooltipModule } from 'ngx-bootstrap/tooltip'; | 7 | import { TooltipModule } from 'ngx-bootstrap/tooltip'; |
8 | import { PopoverModule } from 'ngx-bootstrap/popover'; | 8 | import { PopoverModule } from 'ngx-bootstrap/popover'; |
9 | import { CarouselModule } from 'ngx-bootstrap/carousel'; | 9 | import { CarouselModule } from 'ngx-bootstrap/carousel'; |
10 | import { PaginationModule } from 'ngx-bootstrap/pagination'; | ||
10 | //#endregion | 11 | //#endregion |
11 | 12 | ||
12 | //#region Keyboard | 13 | //#region Keyboard |
13 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | 14 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; |
14 | import { MatButtonModule } from '@angular/material/button'; | 15 | import { MatButtonModule } from '@angular/material/button'; |
15 | import { MatKeyboardModule } from '@ngx-material-keyboard/core'; | 16 | import { MatKeyboardModule } from '@ngx-material-keyboard/core'; |
16 | //#endregion | 17 | //#endregion |
17 | 18 | ||
18 | //#region COMPONENTS | 19 | //#region COMPONENTS |
19 | import { AppComponent } from './app.component'; | 20 | import { AppComponent } from './app.component'; |
20 | import { HeaderComponent } from './components/header/header.component'; | 21 | import { HeaderComponent } from './components/header/header.component'; |
21 | import { SidebarComponent } from './components/sidebar/sidebar.component'; | 22 | import { SidebarComponent } from './components/sidebar/sidebar.component'; |
22 | import { HomeComponent } from './components/home/home.component'; | 23 | import { HomeComponent } from './components/home/home.component'; |
23 | import { InicioComponent } from './components/inicio/inicio.component'; | 24 | import { InicioComponent } from './components/inicio/inicio.component'; |
24 | import { BusquedaProductosComponent } from './components/busqueda-productos/busqueda-productos.component'; | 25 | import { BusquedaProductosComponent } from './components/busqueda-productos/busqueda-productos.component'; |
25 | import { ConfirmacionCarritoComponent } from './components/confirmacion-carrito/confirmacion-carrito.component'; | 26 | import { ConfirmacionCarritoComponent } from './components/confirmacion-carrito/confirmacion-carrito.component'; |
26 | import { MasterComponent } from './components/master/master.component'; | 27 | import { MasterComponent } from './components/master/master.component'; |
27 | import { PopoverPromosComponent } from './components/popover-promos/popover-promos.component'; | 28 | import { PopoverPromosComponent } from './components/popover-promos/popover-promos.component'; |
28 | import { PopoverSinonimosComponent } from './components/popover-sinonimos/popover-sinonimos.component'; | 29 | import { PopoverSinonimosComponent } from './components/popover-sinonimos/popover-sinonimos.component'; |
29 | import { AmbImagenesComponent } from './components/amb-imagenes/amb-imagenes.component'; | 30 | import { AmbImagenesComponent } from './components/amb-imagenes/amb-imagenes.component'; |
30 | import { PagoComponent } from './components/pago/pago.component'; | 31 | import { PagoComponent } from './components/pago/pago.component'; |
31 | import { CancelarCompraComponent } from './components/cancelar-compra/cancelar-compra.component'; | 32 | import { CancelarCompraComponent } from './components/cancelar-compra/cancelar-compra.component'; |
32 | import { MensajeFinalComponent } from './components/mensaje-final/mensaje-final.component'; | 33 | import { MensajeFinalComponent } from './components/mensaje-final/mensaje-final.component'; |
33 | //#endregion | 34 | //#endregion |
34 | 35 | ||
35 | @NgModule({ | 36 | @NgModule({ |
36 | declarations: [ | 37 | declarations: [ |
37 | AppComponent, | 38 | AppComponent, |
38 | HeaderComponent, | 39 | HeaderComponent, |
39 | SidebarComponent, | 40 | SidebarComponent, |
40 | HomeComponent, | 41 | HomeComponent, |
41 | InicioComponent, | 42 | InicioComponent, |
42 | BusquedaProductosComponent, | 43 | BusquedaProductosComponent, |
43 | ConfirmacionCarritoComponent, | 44 | ConfirmacionCarritoComponent, |
44 | MasterComponent, | 45 | MasterComponent, |
45 | PopoverPromosComponent, | 46 | PopoverPromosComponent, |
46 | PopoverSinonimosComponent, | 47 | PopoverSinonimosComponent, |
47 | AmbImagenesComponent, | 48 | AmbImagenesComponent, |
48 | PagoComponent, | 49 | PagoComponent, |
49 | CancelarCompraComponent, | 50 | CancelarCompraComponent, |
50 | MensajeFinalComponent | 51 | MensajeFinalComponent |
51 | ], | 52 | ], |
52 | imports: [ | 53 | imports: [ |
53 | BrowserModule, | 54 | BrowserModule, |
54 | AppRoutingModule, | 55 | AppRoutingModule, |
55 | HttpClientModule, | 56 | HttpClientModule, |
56 | FormsModule, | 57 | FormsModule, |
57 | ReactiveFormsModule, | 58 | ReactiveFormsModule, |
58 | ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: 'never' }), | 59 | ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: 'never' }), |
59 | TooltipModule.forRoot(), | 60 | TooltipModule.forRoot(), |
60 | PopoverModule.forRoot(), | 61 | PopoverModule.forRoot(), |
61 | BrowserAnimationsModule, | 62 | BrowserAnimationsModule, |
62 | MatKeyboardModule, | 63 | MatKeyboardModule, |
63 | MatButtonModule, | 64 | MatButtonModule, |
64 | CarouselModule.forRoot() | 65 | CarouselModule.forRoot(), |
66 | PaginationModule.forRoot() | ||
65 | ], | 67 | ], |
66 | providers: [], | 68 | providers: [], |
67 | bootstrap: [AppComponent] | 69 | bootstrap: [AppComponent] |
68 | }) | 70 | }) |
69 | export class AppModule { } | 71 | export class AppModule { } |
70 | 72 |
src/app/components/amb-imagenes/amb-imagenes.component.html
1 | <app-header></app-header> | 1 | <app-header></app-header> |
2 | 2 | ||
3 | <div class="container-fluid"> | 3 | <div class="container-fluid"> |
4 | <div class="row m-3"> | 4 | <div class="row m-3"> |
5 | <div class="col"> | 5 | <div class="col"> |
6 | <p class="h2">Configuración imágenes</p> | 6 | <p class="h2">Configuración de imágenes</p> |
7 | </div> | 7 | </div> |
8 | </div> | 8 | </div> |
9 | 9 | ||
10 | <div class="row search"> | 10 | <div class="row mx-3 search"> |
11 | <div class="col"> | 11 | <div class="col"> |
12 | <span class="fa fa-search form-control-lg form-control-search pl-3"></span> | 12 | <span class="fa fa-search form-control-lg form-control-search pl-3"></span> |
13 | <input | 13 | <input |
14 | type="text" | 14 | type="text" |
15 | class="form-control form-control-lg shadow-sm rounded-pill px-5" | 15 | class="form-control form-control-lg shadow-sm rounded-pill px-5" |
16 | placeholder="Búsqueda productos" | 16 | placeholder="Búsqueda productos" |
17 | [(ngModel)]="searchTerm" | 17 | [(ngModel)]="searchTerm" |
18 | (ngModelChange)="filterItems()"> | 18 | (ngModelChange)="filterItems()"> |
19 | </div> | 19 | </div> |
20 | </div> | 20 | </div> |
21 | 21 | ||
22 | <div class="row m-3 vh-70 overflow-scroll"> | 22 | <div class="row m-3 vh-60 overflow-scroll"> |
23 | <div class="col"> | 23 | <div class="col"> |
24 | <h5>Productos</h5> | 24 | <h5>Productos</h5> |
25 | <table class="table"> | 25 | <table class="table table-striped table-hover table-borderless shadow"> |
26 | <thead> | 26 | <thead> |
27 | <tr class="text-center"> | 27 | <tr class="bg-primary text-center text-white shadow-sm"> |
28 | <th>Nombre</th> | 28 | <th>Nombre</th> |
29 | <th>Descripción</th> | ||
30 | <th colspan="2">Imagen</th> | 29 | <th colspan="2">Imagen</th> |
31 | </tr> | 30 | </tr> |
32 | </thead> | 31 | </thead> |
33 | <tbody> | 32 | <tbody> |
34 | <tr *ngFor="let articulo of auxProductos"> | 33 | <tr class="shadow-sm" *ngFor="let articulo of auxProductos"> |
35 | <td>{{articulo.DET_LAR}}</td> | 34 | <td class="align-middle"> |
36 | <td>{{articulo.DET_LAR}}</td> | 35 | <p class="m-0">{{articulo.DET_LAR}}</p> |
36 | <p class="m-0"><small>Descripción: {{articulo.DET_LAR}}</small></p> | ||
37 | <p class="m-0"><small>Sector: {{articulo.CodSec}}</small></p> | ||
38 | <p class="m-0"><small>Código: {{articulo.CodArt}}</small></p> | ||
39 | </td> | ||
37 | <td> | 40 | <td> |
38 | <img *ngIf="articulo.imagenes.length" src="{{apiUrl}}/imagenes/{{articulo.imagenes[0].imagen}}"> | 41 | <img |
39 | <img id="{{articulo.CodSec + articulo.CodArt}}" [hidden]="articulo.imagenes.length"> | 42 | *ngIf="articulo.imagenes.length == 0" |
43 | class="fade-in w-100 mx-auto img-fluid" | ||
44 | src="{{apiUrl}}/imagenes/noImage.jpg"> | ||
45 | <carousel [interval]="false"> | ||
46 | <slide *ngFor="let item of articulo.imagenes; let index = index"> | ||
47 | <img | ||
48 | *ngIf="!item.fromGallery" | ||
49 | class="fade-in img-fluid w-100" | ||
50 | src="{{apiUrl}}/imagenes/{{item.imagen}}"> | ||
51 | <img | ||
52 | *ngIf="item.fromGallery" | ||
53 | class="fade-in img-fluid w-100" | ||
54 | src="{{item.base64}}"> | ||
55 | <button | ||
56 | (click)="deleteImage(articulo.imagenes, index)" | ||
57 | type="button" | ||
58 | class="btn btn-light btn-delete-image position-absolute close"> | ||
59 | <span aria-hidden="true">×</span> | ||
60 | </button> | ||
61 | </slide> | ||
62 | </carousel> | ||
63 | </td> | ||
64 | <td class="align-middle text-center"> | ||
65 | <div class="custom-file"> | ||
66 | <input | ||
67 | type="file" | ||
68 | class="custom-file-input" | ||
69 | id="customFileLang" | ||
70 | accept="image/*" | ||
71 | (change)="onFileSelected($event, articulo)" | ||
72 | lang="es" | ||
73 | multiple> | ||
74 | <label class="custom-file-label text-left pr-5" for="customFileLang"> | ||
75 | <small>Seleccionar archivo</small> | ||
76 | </label> | ||
77 | </div> | ||
40 | </td> | 78 | </td> |
41 | <td><input type="file" accept="image/*" (change)="onFileSelected($event, articulo)"></td> | ||
42 | </tr> | 79 | </tr> |
43 | </tbody> | 80 | </tbody> |
44 | </table> | 81 | </table> |
45 | </div> | 82 | </div> |
46 | </div> | 83 | </div> |
47 | 84 | ||
85 | <div class="row" *ngIf="paginationData"> | ||
86 | <div class="col"> | ||
87 | <pagination | ||
88 | [rotate]="false" | ||
89 | [(ngModel)]="paginationData.page" | ||
90 | [totalItems]="paginationData.rowCount" | ||
91 | [maxSize]="paginationData.pageCount" | ||
92 | [itemsPerPage]="paginationData.pageSize" | ||
93 | (pageChanged)="pageChanged($event)" | ||
94 | [boundaryLinks]="true" | ||
95 | [disabled]="disabledPaginador" | ||
96 | previousText="‹" | ||
97 | nextText="›" | ||
98 | firstText="«" | ||
99 | lastText="»" | ||
100 | ></pagination> | ||
101 | </div> | ||
102 | </div> | ||
103 |
src/app/components/amb-imagenes/amb-imagenes.component.scss
1 | .search .form-control-search { | 1 | .search .form-control-search { |
2 | position: absolute; | 2 | position: absolute; |
3 | z-index: 2; | 3 | z-index: 2; |
4 | display: block; | 4 | display: block; |
5 | text-align: center; | 5 | text-align: center; |
6 | pointer-events: none; | 6 | pointer-events: none; |
7 | color: #aaa; | 7 | color: #aaa; |
8 | line-height: inherit; | 8 | line-height: inherit; |
9 | } | 9 | } |
10 | |||
11 | .custom-file-input:lang(es) ~ .custom-file-label::after { | ||
12 | content: "Elegir"; | ||
13 | } | ||
14 | |||
15 | .btn-delete-image { | ||
16 | top: 0; | ||
17 | left: 95%; | ||
18 | } | ||
10 | 19 |
src/app/components/amb-imagenes/amb-imagenes.component.ts
1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core'; |
2 | import { appSettings } from 'src/etc/AppSettings'; | 2 | import { appSettings } from 'src/etc/AppSettings'; |
3 | import { ProductoService } from 'src/app/services/producto.service'; | 3 | import { ProductoService } from 'src/app/services/producto.service'; |
4 | import { Producto } from 'src/app/wrappers/producto'; | 4 | import { Producto } from 'src/app/wrappers/producto'; |
5 | import { HttpClient } from '@angular/common/http'; | 5 | import { HttpClient } from '@angular/common/http'; |
6 | 6 | ||
7 | @Component({ | 7 | @Component({ |
8 | selector: 'app-amb-imagenes', | 8 | selector: 'app-amb-imagenes', |
9 | templateUrl: './amb-imagenes.component.html', | 9 | templateUrl: './amb-imagenes.component.html', |
10 | styleUrls: ['./amb-imagenes.component.scss'] | 10 | styleUrls: ['./amb-imagenes.component.scss'] |
11 | }) | 11 | }) |
12 | 12 | ||
13 | export class AmbImagenesComponent implements OnInit { | 13 | export class AmbImagenesComponent implements OnInit { |
14 | 14 | ||
15 | apiUrl = appSettings.apiUrl; | 15 | apiUrl = appSettings.apiUrl; |
16 | articulos: Producto[] = []; | 16 | articulos: Producto[] = []; |
17 | private auxProductos: Producto[] = []; | 17 | private auxProductos: Producto[] = []; |
18 | private searchTerm: string = ''; | 18 | private searchTerm: string = ''; |
19 | private paginationData: any; | ||
20 | private disabledPaginador: boolean = false; | ||
19 | 21 | ||
20 | constructor(private productoService: ProductoService, private http: HttpClient) {} | 22 | constructor(private productoService: ProductoService, private http: HttpClient) { } |
21 | 23 | ||
22 | ngOnInit() { | 24 | ngOnInit() { |
23 | 25 | ||
24 | this.productoService.getAll().subscribe((productos: Producto[]) => { | 26 | this.productoService.getAllWithPaginator() |
25 | this.articulos = productos; | 27 | .subscribe((res) => { |
26 | this.filterItems(); | ||
27 | }); | ||
28 | } | ||
29 | |||
30 | onFileSelected(event, articulo) { | ||
31 | |||
32 | let file: File = event.target.files[0]; | ||
33 | 28 | ||
34 | this.onLoad(file) | 29 | this.articulos = res.data; |
35 | .then(result => { | 30 | this.paginationData = res.pagination; |
36 | 31 | this.filterItems(); | |
37 | articulo.imagenes = []; | 32 | }, error => console.error(error)); |
38 | 33 | } | |
39 | document.getElementById(articulo.CodSec + articulo.CodArt)['src'] = result; | ||
40 | 34 | ||
41 | this.saveInBase({ | 35 | onFileSelected(event, articulo: Producto) { |
42 | name: file.name, | 36 | |
43 | base64: result, | 37 | let auxFiles: FileList = event.target.files; |
44 | codigo: articulo.CodArt, | 38 | Array.from(auxFiles).forEach(file => { |
45 | sector: articulo.CodSec | 39 | |
40 | this.onLoad(file) | ||
41 | .then(result => { | ||
42 | // articulo.imagenes.push({ | ||
43 | // name: file.name + articulo.CodArt + articulo.CodSec, | ||
44 | // fromGallery: true, | ||
45 | // imagen: result, | ||
46 | // id_articulo: articulo.id | ||
47 | // }); | ||
48 | let imagenAguardar = { | ||
49 | imagen: { | ||
50 | name: `${articulo.CodSec}${articulo.CodArt}${file.name}`, | ||
51 | base64: result, | ||
52 | codigo: articulo.CodArt, | ||
53 | sector: articulo.CodSec, | ||
54 | id_articulo: articulo.id | ||
55 | }, | ||
56 | articulo: articulo | ||
57 | }; | ||
58 | this.saveInBase(imagenAguardar); | ||
46 | }); | 59 | }); |
47 | }); | 60 | }) |
48 | } | 61 | } |
49 | 62 | ||
50 | filterItems() { | 63 | filterItems() { |
51 | 64 | ||
52 | this.auxProductos = this.articulos.filter(x => { | 65 | this.auxProductos = this.articulos.filter(x => { |
53 | return x.DET_LAR.toLowerCase().includes(this.searchTerm.toLowerCase()) | 66 | return x.DET_LAR.toLowerCase().includes(this.searchTerm.toLowerCase()) || |
67 | x.CodArt.toString().includes(this.searchTerm.toLowerCase()) || | ||
68 | x.CodSec.toString().includes(this.searchTerm.toLowerCase()); | ||
54 | }); | 69 | }); |
55 | } | 70 | } |
56 | 71 | ||
72 | saveInBase(imagenAguardar) { | ||
57 | 73 | ||
58 | saveInBase(img) { | 74 | this.productoService.saveInBase(imagenAguardar.imagen) |
59 | 75 | .subscribe(res => { | |
60 | this.http.post(`${appSettings.apiUrl}/imagenes/guardar`, img) | 76 | imagenAguardar.imagen['id'] = res[0]; |
61 | .subscribe(data => { | 77 | imagenAguardar.imagen['fromGallery'] = true; |
62 | console.log(data); | 78 | imagenAguardar.articulo.imagenes.push(imagenAguardar.imagen); |
63 | }); | 79 | }, error => console.error(error)); |
64 | } | 80 | } |
65 | 81 | ||
66 | onLoad(file) { | 82 | onLoad(file) { |
67 | 83 | ||
68 | return new Promise((resolve, reject) => { | 84 | return new Promise((resolve, reject) => { |
69 | 85 | ||
70 | var fr = new FileReader(); | 86 | var fr = new FileReader(); |
71 | 87 | ||
72 | fr.onload = function() { | 88 | fr.onload = function () { |
73 | 89 | ||
74 | resolve(fr.result); | 90 | resolve(fr.result); |
75 | }; | 91 | }; |
76 | 92 | ||
77 | fr.readAsDataURL(file); | 93 | fr.readAsDataURL(file); |
78 | }); | 94 | }); |
79 | 95 | ||
80 | } | 96 | } |
97 | |||
98 | deleteImage(imagenes, index: number) { | ||
99 | |||
100 | if (!imagenes[index].name) { | ||
101 | imagenes[index].name = imagenes[index].imagen; | ||
102 | } | ||
103 | |||
104 | this.productoService.deleteImage(imagenes[index]) | ||
105 | .subscribe(res => { | ||
106 | |||
107 | if (res) { | ||
108 | imagenes.splice(index, 1); | ||
109 | } | ||
110 | }, error => console.error(error)); | ||
111 | } | ||
112 | |||
113 | pageChanged(event: any): void { | ||
114 | this.disabledPaginador = true; | ||
115 | this.productoService.getAllWithPaginator(event.page) | ||
116 | .subscribe((res) => { | ||
117 | this.disabledPaginador = false; |
src/app/services/producto.service.ts
1 | import { Injectable } from '@angular/core'; | 1 | import { Injectable } from '@angular/core'; |
2 | import { HttpClient } from '@angular/common/http'; | 2 | import { HttpClient } from '@angular/common/http'; |
3 | import { Observable } from 'rxjs'; | 3 | import { Observable } from 'rxjs'; |
4 | import { appSettings } from 'src/etc/AppSettings'; | 4 | import { appSettings } from 'src/etc/AppSettings'; |
5 | import { Producto } from '../wrappers/producto'; | 5 | import { Producto } from '../wrappers/producto'; |
6 | 6 | ||
7 | @Injectable({ | 7 | @Injectable({ |
8 | providedIn: 'root' | 8 | providedIn: 'root' |
9 | }) | 9 | }) |
10 | export class ProductoService { | 10 | export class ProductoService { |
11 | 11 | ||
12 | productos: Producto[] = []; | 12 | productos: Producto[] = []; |
13 | productoAcargar: Producto; | 13 | productoAcargar: Producto; |
14 | promoAcargar: Producto; | 14 | promoAcargar: Producto; |
15 | mostrar: string; | 15 | mostrar: string; |
16 | 16 | ||
17 | constructor(private http: HttpClient) { } | 17 | constructor(private http: HttpClient) { } |
18 | 18 | ||
19 | getProductoById(id): Observable<any> { | 19 | getProductoById(id): Observable<any> { |
20 | 20 | ||
21 | return this.http.get(`${appSettings.apiUrl}/articulos/${id}`); | 21 | return this.http.get(`${appSettings.apiUrl}/articulos/${id}`); |
22 | } | 22 | } |
23 | 23 | ||
24 | getAll(): Observable<any> { | 24 | getAll(page: number = 1): Observable<any> { |
25 | 25 | ||
26 | return this.http.get(`${appSettings.apiUrl}/articulos`); | 26 | return this.http.get(`${appSettings.apiUrl}/articulos/`); |
27 | } | ||
28 | |||
29 | getAllWithPaginator(page: number = 1): Observable<any> { | ||
30 | |||
31 | return this.http.get(`${appSettings.apiUrl}/articulos/${page}`); | ||
27 | } | 32 | } |
28 | 33 | ||
29 | setProductos(producto: Producto) { | 34 | setProductos(producto: Producto) { |
30 | 35 | ||
31 | for (let i = 0; i < this.productos.length; i++) { | 36 | for (let i = 0; i < this.productos.length; i++) { |
32 | 37 | ||
33 | if (this.productos[i].id === producto.id) { | 38 | if (this.productos[i].id === producto.id) { |
34 | 39 | ||
35 | if (producto.PRO) { | 40 | if (producto.PRO) { |
36 | if (this.promosIdenticas(this.productos[i], producto)) { | 41 | if (this.promosIdenticas(this.productos[i], producto)) { |
37 | this.productos[i].cantidad++; | 42 | this.productos[i].cantidad++; |
38 | return; | 43 | return; |
39 | } else { | 44 | } else { |
40 | break; | 45 | break; |
41 | } | 46 | } |
42 | } | 47 | } |
43 | this.productos[i].cantidad++; | 48 | this.productos[i].cantidad++; |
44 | return; | 49 | return; |
45 | } | 50 | } |
46 | } | 51 | } |
47 | 52 | ||
48 | this.productos.push(producto); | 53 | this.productos.push(producto); |
49 | } | 54 | } |
50 | 55 | ||
51 | getPromocionByCodigos(sector, codigo): Observable<any> { | 56 | getPromocionByCodigos(sector, codigo): Observable<any> { |
52 | 57 | ||
53 | var url = `${appSettings.apiUrl}/promociones/by-codigos/${sector}/${codigo}`; | 58 | var url = `${appSettings.apiUrl}/promociones/by-codigos/${sector}/${codigo}`; |
54 | // var url = `${appSettings.apiUrl}/promociones/by-codigos/${2}/${7}`; | 59 | // var url = `${appSettings.apiUrl}/promociones/by-codigos/${2}/${7}`; |
55 | return this.http.get(url); | 60 | return this.http.get(url); |
56 | } | 61 | } |
57 | 62 | ||
58 | getPromociones(sector, codigo): Observable<any> { | 63 | getPromociones(sector, codigo): Observable<any> { |
59 | 64 | ||
60 | var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${sector}/${codigo}`; | 65 | var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${sector}/${codigo}`; |
61 | // var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${2}/${1306}`; | 66 | // var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${2}/${1306}`; |
62 | return this.http.get(url); | 67 | return this.http.get(url); |
63 | } | 68 | } |
64 | 69 | ||
65 | getPromocionSinonimos(sector, codigo): Observable<any> { | 70 | getPromocionSinonimos(sector, codigo): Observable<any> { |
66 | 71 | ||
67 | var url = `${appSettings.apiUrl}/sinonimos/promo/${sector}/${codigo}`; | 72 | var url = `${appSettings.apiUrl}/sinonimos/promo/${sector}/${codigo}`; |
68 | // var url = `${appSettings.apiUrl}/sinonimos/promo/${2}/${7}`; | 73 | // var url = `${appSettings.apiUrl}/sinonimos/promo/${2}/${7}`; |
69 | return this.http.get(url); | 74 | return this.http.get(url); |
70 | } | 75 | } |
71 | 76 | ||
72 | updateImages(body): Observable<any> { | 77 | saveInBase(body): Observable<any> { |
73 | return this.http.post(`${appSettings.apiUrl}/imagenes/guardar`, body); | 78 | return this.http.post(`${appSettings.apiUrl}/imagenes/guardar`, body); |
74 | } | 79 | } |
75 | 80 | ||
81 | deleteImage(body): Observable<any> { | ||
82 | return this.http.post(`${appSettings.apiUrl}/imagen/borrar`, body); | ||
83 | } | ||
84 | |||
76 | getCategorias() { | 85 | getCategorias() { |
77 | return this.http.get(`${appSettings.apiUrl}/categorias`); | 86 | return this.http.get(`${appSettings.apiUrl}/categorias`); |
78 | } | 87 | } |
79 | 88 | ||
80 | pagar(medioPago: string) { | 89 | pagar(medioPago: string) { |
81 | return this.http.post(`${appSettings.apiUrl}/comprobante/guardar/${medioPago}`, { | 90 | return this.http.post(`${appSettings.apiUrl}/comprobante/guardar/${medioPago}`, { |
82 | productos: this.productos | 91 | productos: this.productos |
83 | }); | 92 | }); |
84 | } | 93 | } |
85 | 94 | ||
86 | private promosIdenticas(promoEnCarrito: Producto, promo: Producto) { | 95 | private promosIdenticas(promoEnCarrito: Producto, promo: Producto) { |
87 | 96 | ||
88 | var sonIdenticas = true; | 97 | var sonIdenticas = true; |
89 | var productosPromoCarrito = promoEnCarrito.productos; | 98 | var productosPromoCarrito = promoEnCarrito.productos; |
90 | var productosPromoAcargar = promo.productos; | 99 | var productosPromoAcargar = promo.productos; |
91 | 100 | ||
92 | if (productosPromoCarrito.length !== productosPromoAcargar.length) { | 101 | if (productosPromoCarrito.length !== productosPromoAcargar.length) { |
93 | return false; | 102 | return false; |
94 | } | 103 | } |
95 | 104 | ||
96 | for (let i = 0; i < productosPromoCarrito.length; i++) { | 105 | for (let i = 0; i < productosPromoCarrito.length; i++) { |
97 | 106 | ||
98 | if (productosPromoCarrito[i].id !== productosPromoAcargar[i].id) { | 107 | if (productosPromoCarrito[i].id !== productosPromoAcargar[i].id) { |
99 | return false; | 108 | return false; |
100 | } | 109 | } |
101 | } | 110 | } |
102 | 111 | ||
103 | return sonIdenticas; | 112 | return sonIdenticas; |
104 | } | 113 | } |
105 | 114 | ||
106 | } | 115 | } |
107 | 116 |
src/styles.scss
1 | @import "./assets/scss/animation.scss"; | 1 | @import "./assets/scss/animation.scss"; |
2 | @import "./assets/scss/bootstrap-override.scss"; | 2 | @import "./assets/scss/bootstrap-override.scss"; |
3 | @import "../node_modules/bootstrap/scss/_variables.scss"; | 3 | @import "../node_modules/bootstrap/scss/_variables.scss"; |
4 | 4 | ||
5 | html, | 5 | html, |
6 | body { | 6 | body { |
7 | background-color: #f0f0f0; | 7 | background-color: #f0f0f0; |
8 | font-family: bahnschrift; | 8 | font-family: bahnschrift; |
9 | overflow: hidden !important; | 9 | overflow: hidden !important; |
10 | } | 10 | } |
11 | 11 | ||
12 | .blur { | 12 | .blur { |
13 | filter: blur(10px); | 13 | filter: blur(10px); |
14 | -webkit-filter: blur(10px); | 14 | -webkit-filter: blur(10px); |
15 | } | 15 | } |
16 | 16 | ||
17 | .disable-user-select { | 17 | .disable-user-select { |
18 | -webkit-user-select: none; | 18 | -webkit-user-select: none; |
19 | -moz-user-select: none; | 19 | -moz-user-select: none; |
20 | -ms-user-select: none; | 20 | -ms-user-select: none; |
21 | user-select: none; | 21 | user-select: none; |
22 | } | 22 | } |
23 | 23 | ||
24 | .blue-gradient { | 24 | .blue-gradient { |
25 | background: linear-gradient(0deg, #ffffff00, $white); | 25 | background: linear-gradient(0deg, #ffffff00, $white); |
26 | } | 26 | } |
27 | 27 | ||
28 | .rounded { | 28 | .rounded { |
29 | border-radius: 1.5rem !important; | 29 | border-radius: 1.5rem !important; |
30 | } | 30 | } |
31 | 31 | ||
32 | .rounded-top-sm { | 32 | .rounded-top-sm { |
33 | border-top-left-radius: 0.75rem !important; | 33 | border-top-left-radius: 0.75rem !important; |
34 | border-top-right-radius: 0.75rem !important; | 34 | border-top-right-radius: 0.75rem !important; |
35 | } | 35 | } |
36 | 36 | ||
37 | .rounded-sm { | 37 | .rounded-sm { |
38 | border-radius: 0.75rem !important; | 38 | border-radius: 0.75rem !important; |
39 | } | 39 | } |
40 | 40 | ||
41 | .card-effect { | 41 | .card-effect { |
42 | &:active { | 42 | &:active { |
43 | background-color: #c9c9c9b3 !important; | 43 | background-color: #c9c9c9b3 !important; |
44 | transition: background-color 0.5s; | 44 | transition: background-color 0.5s; |
45 | } | 45 | } |
46 | &:focus { | 46 | &:focus { |
47 | background-color: #c9c9c9b3 !important; | 47 | background-color: #c9c9c9b3 !important; |
48 | transition: background-color 0.5s; | 48 | transition: background-color 0.5s; |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | .overflow-scroll { | 52 | .overflow-scroll { |
53 | overflow-y: auto !important; | 53 | overflow-y: auto !important; |
54 | overflow-x: hidden !important; | 54 | overflow-x: hidden !important; |
55 | &::-webkit-scrollbar { | 55 | &::-webkit-scrollbar { |
56 | width: 1em; | 56 | width: 1em; |
57 | } | 57 | } |
58 | &::-webkit-scrollbar-track { | 58 | &::-webkit-scrollbar-track { |
59 | border-radius: 10px; | 59 | border-radius: 10px; |
60 | box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4); | 60 | box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4); |
61 | -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4); | 61 | -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4); |
62 | background-color: $white; | 62 | background-color: $white; |
63 | } | 63 | } |
64 | &::-webkit-scrollbar-thumb { | 64 | &::-webkit-scrollbar-thumb { |
65 | box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7); | 65 | box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7); |
66 | -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7); | 66 | -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7); |
67 | outline: 1px solid slategrey; | 67 | outline: 1px solid slategrey; |
68 | border-radius: 10px; | 68 | border-radius: 10px; |
69 | height: 12px; | 69 | height: 12px; |
70 | &:active { | 70 | &:active { |
71 | box-shadow: inset 0 0 8px $primary; | 71 | box-shadow: inset 0 0 8px $primary; |
72 | -webkit-box-shadow: inset 0 0 8px $primary; | 72 | -webkit-box-shadow: inset 0 0 8px $primary; |
73 | } | 73 | } |
74 | } | 74 | } |
75 | &::-webkit-scrollbar-corner { | 75 | &::-webkit-scrollbar-corner { |
76 | border-radius: 10px; | 76 | border-radius: 10px; |
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
80 | .bg-gray { | 80 | .bg-gray { |
81 | background-color: #e6e6e6; | 81 | background-color: #e6e6e6; |
82 | } | 82 | } |
83 | 83 | ||
84 | .bg-primary-gradient { | 84 | .bg-primary-gradient { |
85 | background: linear-gradient(135deg, rgba(40, 112, 175, 1) 0%, rgba(0, 32, 66, 1) 100%); | 85 | background: linear-gradient(135deg, rgba(40, 112, 175, 1) 0%, rgba(0, 32, 66, 1) 100%); |
86 | } | 86 | } |
87 | 87 | ||
88 | .bg-primary-gradient-horizontal { | 88 | .bg-primary-gradient-horizontal { |
89 | background: linear-gradient(90deg, rgba(40, 112, 175, 1) 0%, rgba(0, 32, 66, 1) 100%); | 89 | background: linear-gradient(90deg, rgba(40, 112, 175, 1) 0%, rgba(0, 32, 66, 1) 100%); |
90 | } | 90 | } |
91 | 91 | ||
92 | .icon-dim { | 92 | .icon-dim { |
93 | height: 40px !important; | 93 | height: 40px !important; |
94 | width: auto !important; | 94 | width: auto !important; |
95 | background-color: white !important; | 95 | background-color: white !important; |
96 | } | 96 | } |
97 | 97 | ||
98 | .text-purple { | 98 | .text-purple { |
99 | color: $purple; | 99 | color: $purple; |
100 | } | 100 | } |
101 | 101 | ||
102 | .vh-70 { | 102 | .vh-70 { |
103 | min-height: auto !important; | 103 | min-height: auto !important; |
104 | max-height: 70vh !important; | 104 | max-height: 70vh !important; |
105 | } | 105 | } |
106 | 106 | ||
107 | .vh-60 { | 107 | .vh-60 { |
108 | min-height: auto !important; | 108 | min-height: auto !important; |
109 | max-height: 60vh !important; | 109 | max-height: 60vh !important; |
110 | } | 110 | } |
111 | 111 | ||
112 | .vh-50 { | 112 | .vh-50 { |
113 | min-height: auto !important; | 113 | min-height: auto !important; |
114 | max-height: 50vh !important; | 114 | max-height: 50vh !important; |
115 | } | 115 | } |
116 | 116 | ||
117 | .spinner-lg { | 117 | .spinner-lg { |
118 | width: 3rem !important; | 118 | width: 3rem !important; |
119 | height: 3rem !important; | 119 | height: 3rem !important; |
120 | } | 120 | } |
121 | 121 | ||
122 | .sidebar { | 122 | .sidebar { |
123 | right: 0; | 123 | right: 0; |
124 | } | 124 | } |
125 | 125 | ||
126 | .background-image { | 126 | .background-image { |
127 | background-repeat: no-repeat; | 127 | background-repeat: no-repeat; |
128 | background-size: cover; | 128 | background-size: cover; |
129 | position: fixed; | 129 | position: fixed; |
130 | } | 130 | } |
131 | 131 | ||
132 | .rounded-bottom-right { | 132 | .rounded-bottom-right { |
133 | border-bottom-right-radius: 10rem; | 133 | border-bottom-right-radius: 10rem; |
134 | &:before { | 134 | &:before { |
135 | border-radius: 0 40px 40px 0; | 135 | border-radius: 0 40px 40px 0; |
136 | background-color: #fff; | 136 | background-color: #fff; |
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | .rounded-top-left { | 140 | .rounded-top-left { |
141 | border-top-left-radius: 10rem; | 141 | border-top-left-radius: 10rem; |
142 | } | 142 | } |
143 | 143 | ||
144 | .bg-gray { | 144 | .bg-gray { |
145 | background-color: #cccccc; | 145 | background-color: #cccccc; |
146 | } | 146 | } |
147 | 147 | ||
148 | .cdk-overlay-container { | 148 | .cdk-overlay-container { |
149 | position: absolute; | 149 | position: absolute; |
150 | top: 65%; | 150 | top: 65%; |
151 | width: 100%; | 151 | width: 100%; |
152 | } | 152 | } |
153 | 153 | ||
154 | .min-h-40 { | 154 | .min-h-40 { |
155 | min-height: 40px; | 155 | min-height: 40px; |
156 | } | 156 | } |
157 | 157 | ||
158 | .min-h-55 { | 158 | .min-h-55 { |
159 | min-height: 55px; | 159 | min-height: 55px; |
160 | } | 160 | } |
161 | |||
162 | .pagination { | ||
163 | justify-content: center !important; | ||
164 | display: flex !important; | ||
165 | } | ||
161 | 166 |