Commit aa492da5235b84d3d0a679289bdf651374b7b7f8

Authored by Marcelo Puebla
1 parent 09bbac881e

Agregados primeros servicios

1 # See http://help.github.com/ignore-files/ for more about ignoring files. 1 # See http://help.github.com/ignore-files/ for more about ignoring files.
2 2
3 # compiled output 3 # compiled output
4 /dist 4 /dist
5 /tmp 5 /tmp
6 /out-tsc 6 /out-tsc
7 # Only exists if Bazel was run 7 # Only exists if Bazel was run
8 /bazel-out 8 /bazel-out
9 9
10 # dependencies 10 # dependencies
11 /node_modules 11 /node_modules
12 /dist 12 /dist
13 /src/etc/appSettings.ts
13 14
14 # profiling files 15 # profiling files
15 chrome-profiler-events*.json 16 chrome-profiler-events*.json
16 speed-measure-plugin*.json 17 speed-measure-plugin*.json
17 18
18 # IDEs and editors 19 # IDEs and editors
19 /.idea 20 /.idea
20 .project 21 .project
21 .classpath 22 .classpath
22 .c9/ 23 .c9/
23 *.launch 24 *.launch
24 .settings/ 25 .settings/
25 *.sublime-workspace 26 *.sublime-workspace
26 27
27 # IDE - VSCode 28 # IDE - VSCode
28 .vscode/* 29 .vscode/*
29 !.vscode/settings.json 30 !.vscode/settings.json
30 !.vscode/tasks.json 31 !.vscode/tasks.json
31 !.vscode/launch.json 32 !.vscode/launch.json
32 !.vscode/extensions.json 33 !.vscode/extensions.json
33 .history/* 34 .history/*
34 35
35 # misc 36 # misc
36 /.sass-cache 37 /.sass-cache
37 /connect.lock 38 /connect.lock
38 /coverage 39 /coverage
39 /libpeerconnection.log 40 /libpeerconnection.log
40 npm-debug.log 41 npm-debug.log
41 yarn-error.log 42 yarn-error.log
42 testem.log 43 testem.log
43 /typings 44 /typings
44 45
45 # System Files 46 # System Files
46 .DS_Store 47 .DS_Store
47 Thumbs.db 48 Thumbs.db
48 49
src/app/interfaces/IArticulo.ts
File was created 1 export interface IArticulo {
2 cantidad?: number;
3 cantidadAdicionada?: number;
4 cantidadVendida?: number;
5 categoria_selfservice?: number;
6 CodArt: number;
7 codigoBarra?: ICodigoBarra[];
8 CodSec: number;
9 DetArt: string;
10 DET_LAR: string;
11 ELBPRO: string;
12 esAdicionable?: boolean;
13 esSustraible?: boolean;
14 FPP?: boolean;
15 id: number;
16 idSinonimo?: number;
17 imagenes?: any[];
18 ImpInt: number;
19 ImpInt2: number;
20 ImpInt3: number;
21 importeValorExtra?: number;
22 PreVen: number;
23 PRO: boolean;
24 productos?: IArticulo[];
25 seleccionado?: boolean;
26 tieneSinonimo?: boolean;
27 tipo_articulo?: number;
28 comentario?: string;
29 }
30
31 export interface ICodigoBarra {
32 CodBar: string;
33 CodArt: number;
34 CodSec: string;
35 }
36
src/app/interfaces/ICliente.ts
File was created 1 export interface ICliente {
2 COD: number;
3 NOM: string;
4 DOM: string;
5 CPO: string;
6 LOC: string;
7 PCI: string;
8 CUIT: string;
9 TEL: string;
10 FPA: number;
11 TIP: string;
12 ZON: string;
13 ACT: string;
14 PDA: boolean;
15 MCC: number;
16 MCH: number;
17 CTA: number;
18 IDE: string;
19 TLI: string;
20 MOD: string;
21 SUR: boolean;
22 IVA: number;
23 SIT: string;
24 TCO: string;
25 LOX: number;
26 PCX: number;
27 OBS: string;
28 FUP: string;
29 DIC: number;
30 GRP: boolean;
31 BLO: boolean;
32 PLP: boolean;
33 FRE: boolean;
34 VEN: number;
35 FEA: string;
36 ICP: boolean;
37 PER: boolean;
38 RANT: boolean;
39 D_EN: string;
40 D_Y: string;
41 REC: number;
42 NHA: boolean;
43 EMG: number;
44 E_HD: string;
45 C_HD: string;
46 PDA_A: number;
47 CAN_KIL: number;
48 PER_MAY: boolean;
49 ES_MAY: boolean;
50 SEG_MAY: number;
51 INC_MAY: number;
52 ZON_MAY: number;
53 PER_IVA_MAY: number;
54 LPCC: boolean;
55 EREPL: boolean;
56 IMP_ABONO: number;
57 ID_LEY: number;
58 NRO_PER_MAY: string;
59 JUR_MAY_PER: string;
60 NARIB: string;
61 DIC_1: number;
62 REC_1: number;
63 TASA_DIC: number;
64 TASA_DIC_1: number;
65 IMP_CANJE: boolean;
66 USOINT: boolean;
67 PERC: number;
68 CTRL_LIT: boolean;
69 CTRL_SEC: boolean;
70 CLI_CON: number;
71 ITC_SUR: boolean;
72 PIDVEN: boolean;
73 MAIL: string;
74 HAB_NOTIF: boolean;
75 TIPO_NOTIFICACION: boolean;
76 VEH_CHF: boolean;
77 ICIVAL: boolean;
78 LEY_ABO1: string;
79 LEY_ABO2: string;
80 LEY_ABO3: string;
81 LEY_ABO4: string;
82 SALDO_ABONO: number;
83 FACT_ABONO: number;
84 FACT_AUTO: boolean;
85 MES_VDO: boolean;
86 FEC_CTRL: string;
87 SEG_FID: number;
88 MARCA_SALDO: boolean;
89 CTRL_SEC_FPA: boolean;
90 TIPO_RET: number;
91 COD_EXT: string;
92 RIESGO_FISCAL: boolean;
93 POR_RED: number;
94 DESTINO_VENTA: number;
95 FT_ANT: boolean;
96 FID_PART: boolean;
97 PER_SL: number;
98 EN_COBRO: number;
99 BLO_CTA_PROPIA: boolean;
100 TIENE_CERTIFICADO_IIBB: boolean;
101 NOTIF_FT_RE: boolean;
102 IMP_DET_VAL: boolean;
103 EX_PER_HASTA: string;
104 REVENDEDOR: boolean;
105 CONVMULTILATERAL: boolean;
106 PERCPORC?: any;
107 MAIL_COBRANZA: string;
108 MAIL_COMPRAS: string;
109 MAIL_OTROS: string;
110 IMP_OBS_CLI: boolean;
111 PASSWEB: string;
112 COD_REG_CANJ: number;
113 CERTIF_JURIS: boolean;
114 PER_IVARG17: number;
115 PER_ATER: number;
116 OpJurMis: boolean;
117 TIPO_RES_60: number;
118 FEB: string;
119 idPreciosConcidiones: number;
120 idprecioscondiciones: number;
121 ES_PROS?: any;
122 idCobrador: string;
123 ECI: boolean;
124 MUM: string;
125 TipoClienteAbonado: number;
126 EMAIL?: any;
127 FNAC?: any;
128 PAIS?: any;
129 control_saldos_vencidos: boolean;
130 Ignora_bloqueo_auto: boolean;
131 iva: IIva;
132 cuenta: ICuenta;
133 tipoComprobante: ITipoComprobante;
134 estadoCuenta: ICuenta;
135 }
136
137 export interface ICuenta {
138 autorizado: number;
139 extracciones: number;
140 saldo: number;
141 facturasvencidas: number;
142 }
143
144 export interface IIva {
145 ID: number;
146 NOMBRE: string;
147 ABR: string;
148 IFE: string;
149 IFH: string;
150 IFO: string;
151 TIP: string;
152 COI: number;
153 }
154
155 export interface ITipoComprobante {
156 ID: string;
157 NOMBRE: string;
158 TIP: number;
159 CLA: number;
160 RES_SUM: number;
161 }
162
src/app/services/articulo/articulo.service.spec.ts
File was created 1 import { TestBed } from '@angular/core/testing';
2
3 import { ArticuloService } from './articulo.service';
4
5 describe('ArticuloService', () => {
6 beforeEach(() => TestBed.configureTestingModule({}));
7
8 it('should be created', () => {
9 const service: ArticuloService = TestBed.get(ArticuloService);
10 expect(service).toBeTruthy();
11 });
12 });
13
src/app/services/articulo/articulo.service.ts
File was created 1 import { Injectable } from '@angular/core';
2 import { HttpClient } from '@angular/common/http';
3 import { APP_SETTINGS } from '../../../etc/AppSettings';
4 import { IArticulo } from '../../interfaces/IArticulo';
5 import { ClienteService } from '../cliente/cliente.service';
6 import { Observable } from 'rxjs';
7
8 @Injectable({
9 providedIn: 'root'
10 })
11 export class ArticuloService {
12 articulos: IArticulo[] = [];
13 articuloAcargar: IArticulo;
14 promoAcargar: IArticulo;
15 mostrar: string;
16 esPromoPersonalizada: boolean = false;
17 urlArticulos = `${APP_SETTINGS.apiDeboSuite}/articulos`;
18 urlPromociones = `${APP_SETTINGS.apiDeboSuite}/promociones`;
19 urlSinonimos = `${APP_SETTINGS.apiDeboSuite}/sinonimos`;
20 urlCategorias = `${APP_SETTINGS.apiDeboSuite}/categorias`;
21 urlComprobante = `${APP_SETTINGS.apiDeboSuite}/comprobante`;
22
23 constructor(private http: HttpClient, private clienteService: ClienteService) { }
24
25 getById(id) {
26 return this.http.get(`${this.urlArticulos}/${id}`);
27 }
28
29 getAll() {
30 return this.http.get(`${this.urlArticulos}`);
31 }
32
33 getAllWithPaginator(page: number = 1) {
34 return this.http.get(`${this.urlArticulos}/${page}`);
35 }
36
37 setArticulos(articulo: IArticulo) {
38 for (let i = 0; i < this.articulos.length; i++) {
39 if (this.articulos[i].id === articulo.id) {
40 if (articulo.PRO) break;
41 this.articulos[i].cantidad++;
42 return;
43 }
44 }
45 this.articulos.unshift(articulo);
46 }
47
48 getPromocionByCodigos(sector, codigo) {
49 return this.http.get(`${this.urlPromociones}/by-codigos/${sector}/${codigo}`);
50 }
51
52 getPromociones(sector, codigo) {
53 return this.http.get(`${this.urlPromociones}/in-articulo/${sector}/${codigo}`);
54 }
55
56 getPromocionSinonimos(sector, codigo) {
57 return this.http.get(`${this.urlSinonimos}/promo/${sector}/${codigo}`);
58 }
59
60 getCategorias() {
61 return this.http.get(`${this.urlCategorias}`);
62 }
63
64 getComponentes(sector, codigo) {
65 return this.http.get(`${this.urlPromociones}/articulos/${sector}/${codigo}`);
66 }
67
68 pay(dataPago: any) {
69 return new Observable((observer) => {
70 this.clienteService.getById(-1)
71 .subscribe(cliente => {
72 let puntoVenta = parseInt(localStorage.getItem('impresoraPVE'));
73 this.markArticuloInPromoAsRemoved();
74 this.http.post(`${this.urlComprobante}/guardar/${dataPago.medioPago}`, {
75 productos: this.articulos,
76 cliente: cliente,
77 origen: 'autoservicio',
78 codigoVendedor: 5,
79 puntoVenta: dataPago.medioPago === 9 ? -1 * puntoVenta : puntoVenta,
80 pedidoAnombreDe: dataPago.pedidoAnombreDe,
81 numeroPlanilla: '11111',
82 })
83 .subscribe((data) => {
84 observer.next(data);
85 observer.complete();
86 });
87 });
88 });
89 }
90
91 cleanShoppingCar() {
92 this.articuloAcargar = undefined;
93 this.promoAcargar = undefined;
94 this.articulos = [];
95 }
96
97 setArticulosSinImagen(articulos: IArticulo[]) {
98 articulos.forEach((articulo: IArticulo) => {
99 articulo.imagenes = !articulo.imagenes ? [{ imagen: 'noImage.jpg' }] :
100 !articulo.imagenes.length ? [{ imagen: 'noImage.jpg' }] : articulo.imagenes;
101 });
102 }
103
104 markArticuloInPromoAsRemoved() {
105 this.articulos.forEach((articulo: IArticulo) => {
106 if (articulo.PRO) {
107 articulo.productos.forEach((articulo: IArticulo) => {
108 if (articulo.cantidadAdicionada === 0) {
109 articulo.cantidad = 0;
110 articulo.importeValorExtra = 0;
111 }
112 });
113 }
114 });
115 }
116 }
117
src/app/services/cliente/cliente.service.spec.ts
File was created 1 import { TestBed } from '@angular/core/testing';
2
3 import { ClienteService } from './cliente.service';
4
5 describe('ClienteService', () => {
6 beforeEach(() => TestBed.configureTestingModule({}));
7
8 it('should be created', () => {
9 const service: ClienteService = TestBed.get(ClienteService);
10 expect(service).toBeTruthy();
11 });
12 });
13
src/app/services/cliente/cliente.service.ts
File was created 1 import { Injectable } from '@angular/core';
2 import { HttpClient } from '@angular/common/http';
3 import { APP_SETTINGS } from "src/etc/AppSettings";
4
5 @Injectable({
6 providedIn: 'root'
7 })
8 export class ClienteService {
9 urlClientes = `${APP_SETTINGS.apiDeboSuite}/clientes`;
10
11 constructor(private http: HttpClient) { }
12
13 getById(id: number) {
14 return this.http.get(`${this.urlClientes}/get/${id}`);
15 }
16 }
17
src/etc/AppSettings.ejemplo.ts
File was created 1 // export const APP_SETTINGS = {
2 // apiDeboSuite: 'http://localhost:9900'
3 // }
4