From ff5a45bcad3f3503aa07d0c4660e2c7ee46bc1c0 Mon Sep 17 00:00:00 2001 From: jogaec22 Date: Tue, 1 Sep 2020 12:37:00 -0500 Subject: [PATCH 1/3] changes for each row pathc or post --- .../configuration/colleges/colleges.component.ts | 2 +- src/app/configuration/product/product.component.ts | 14 +++++++++----- src/app/shared/service/import-excel.service.ts | 11 +++++++++++ src/app/shared/service/product.service.ts | 2 +- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/app/configuration/colleges/colleges.component.ts b/src/app/configuration/colleges/colleges.component.ts index f0f659e..382f5f9 100644 --- a/src/app/configuration/colleges/colleges.component.ts +++ b/src/app/configuration/colleges/colleges.component.ts @@ -1,7 +1,7 @@ 'use strict'; import { Component, OnInit, ViewChild } from '@angular/core'; -import { ClientColumns, CollegesColumns } from '../../app.keys'; +import { ClientColumns, CollegesColumns, TransformColumns } from '../../app.keys'; import { COLUMNS_COLLEGES } from './collegesColumns'; import { ProjectComponent } from '../../shared/components/project/project.component'; import { ExcelExportService } from '../../shared/service/export-excel.service'; diff --git a/src/app/configuration/product/product.component.ts b/src/app/configuration/product/product.component.ts index ea2a3f8..73c120d 100644 --- a/src/app/configuration/product/product.component.ts +++ b/src/app/configuration/product/product.component.ts @@ -7,6 +7,7 @@ import { COLUMNS_PRODUCT, COLUMNS_PINNED_TOP_DATA } from './productColumns'; import { ExcelExportService } from '../../shared/service/export-excel.service'; import * as _ from 'lodash'; import { ProductService } from 'src/app/shared/service/product.service'; +import { ExcelImportService } from 'src/app/shared/service/import-excel.service'; //const dataVal = require('./product.json'); @@ -31,6 +32,7 @@ export class ProductComponent implements OnInit, TransformColumns { constructor( private excelExportService: ExcelExportService, + private excelImportService: ExcelImportService, private productService: ProductService, ) { const self = this; @@ -78,11 +80,13 @@ export class ProductComponent implements OnInit, TransformColumns { } } - public onJsonData(jsonData){ - console.log('data de Producto es', JSON.stringify(jsonData)); - let jsonFinal = this.namesToProps(jsonData); - console.log('jsonFinal', jsonFinal); - return this.productService.createProduct('1', JSON.stringify(jsonFinal)); + public onJsonData(jsonData){ + //console.log('data de Producto es', JSON.stringify(jsonData)); + const jsonFinal = this.namesToProps(jsonData); + const postPatch = this.excelImportService.setDataToPostOrPatch(jsonFinal); + console.log('POST', postPatch.POST); + console.log('PATCH', postPatch.PATCH); + //return this.productService.createProduct('1', JSON.stringify(jsonFinal)); } public getDataProduct() { diff --git a/src/app/shared/service/import-excel.service.ts b/src/app/shared/service/import-excel.service.ts index 6e23115..53d737a 100644 --- a/src/app/shared/service/import-excel.service.ts +++ b/src/app/shared/service/import-excel.service.ts @@ -40,4 +40,15 @@ export class ExcelImportService { }); } + public setDataToPostOrPatch(json){ + /*const a = json.filter( j => j.id ); + const b = json.filter( j => !j.id ); + console.log('a es', a); + console.log('b es', b);*/ + return { + POST: json.filter( j => !j.id ), + PATCH: json.filter( j => j.id ) + } + } + } diff --git a/src/app/shared/service/product.service.ts b/src/app/shared/service/product.service.ts index 9988fd1..ecd007b 100644 --- a/src/app/shared/service/product.service.ts +++ b/src/app/shared/service/product.service.ts @@ -27,7 +27,7 @@ export class ProductService { } public createProduct(id: string, product: any): Observable { - debugger; + //debugger; const url = this.baseUrl+`product/Sierra`; return this.http.post(url, product, httpOptions); } From 41c06ce7e7c245140d348bcc38670ac4e713cf91 Mon Sep 17 00:00:00 2001 From: jogaec22 Date: Sat, 19 Sep 2020 18:09:07 -0500 Subject: [PATCH 2/3] add loader --- src/app/app.keys.ts | 4 ++++ .../configuration/client/client.component.ts | 8 ++++++-- .../components/project/project.component.html | 4 +++- .../components/project/project.component.ts | 19 +++++++++++++------ 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/app/app.keys.ts b/src/app/app.keys.ts index e906944..52e79d9 100644 --- a/src/app/app.keys.ts +++ b/src/app/app.keys.ts @@ -224,4 +224,8 @@ export const ValidatesPattern = { export declare interface TransformColumns { namesToProps(json): any; +} + +export namespace LoaderIds { + export const LOADER_PROJECT = 'loader-project'; } \ No newline at end of file diff --git a/src/app/configuration/client/client.component.ts b/src/app/configuration/client/client.component.ts index 6fdf7c1..1557c95 100644 --- a/src/app/configuration/client/client.component.ts +++ b/src/app/configuration/client/client.component.ts @@ -1,7 +1,7 @@ 'use strict'; import { Component, OnInit, ViewChild } from '@angular/core'; -import { ClientColumns, TransformColumns } from '../../app.keys'; +import { ClientColumns, LoaderIds, TransformColumns } from '../../app.keys'; import { COLUMNS_CLIENT } from './clientColumns'; import { ProjectComponent } from '../../shared/components/project/project.component'; import { ExcelExportService } from '../../shared/service/export-excel.service'; @@ -9,6 +9,7 @@ import * as _ from 'lodash'; import { ClientService } from 'src/app/shared/service/client.service'; import { Router, ActivatedRoute } from '@angular/router'; import { forkJoin } from 'rxjs'; +import { NgxUiLoaderService } from 'ngx-ui-loader'; //const dataVal = require('./client.json'); @@ -24,14 +25,16 @@ export class ClientComponent implements OnInit, TransformColumns { public gridColumns = COLUMNS_CLIENT; public enabledTitle: boolean; public allowExcelExport: boolean; + public loaderProject: string; constructor( private excelExportService: ExcelExportService, private clientService: ClientService, private router: Router, private route: ActivatedRoute, + private loaderService: NgxUiLoaderService ) { - + this.loaderProject = LoaderIds.LOADER_PROJECT; } ngOnInit(): void { @@ -77,6 +80,7 @@ export class ClientComponent implements OnInit, TransformColumns { this.clientService.updateClient(JSON.stringify(jsonEditClient)) ).subscribe( ([addClient, editClient ]) => { alert('Se ha guardado correctamente los clientes'); + this.loaderService.stopLoader(this.loaderProject); this.router.navigateByUrl('/client', { skipLocationChange: true }).then(() => { this.router.navigate(['/client']); }); diff --git a/src/app/shared/components/project/project.component.html b/src/app/shared/components/project/project.component.html index dd5056c..84e196a 100644 --- a/src/app/shared/components/project/project.component.html +++ b/src/app/shared/components/project/project.component.html @@ -29,4 +29,6 @@ [processDataFromClipboard]="processDataFromClipboard" (gridReady)="onGridReady($event)"> - \ No newline at end of file + + + \ No newline at end of file diff --git a/src/app/shared/components/project/project.component.ts b/src/app/shared/components/project/project.component.ts index d3029b2..7bca5cf 100644 --- a/src/app/shared/components/project/project.component.ts +++ b/src/app/shared/components/project/project.component.ts @@ -1,7 +1,7 @@ 'use strict'; import { Component, OnInit, Input, ViewChild, Output, EventEmitter, ElementRef } from '@angular/core'; import { ExcelExportService } from '../../service/export-excel.service'; -import { AppKeys, ExcelKeys } from 'src/app/app.keys'; +import { AppKeys, ExcelKeys, LoaderIds } from 'src/app/app.keys'; import { Module } from 'ag-grid-community'; @@ -9,6 +9,7 @@ import * as _ from 'lodash'; import { selectionRenderComponent } from '../../render/selection-render.component'; import { SelectProjectRendererComponent } from './select-project-renderer.component'; import { ExcelImportService } from '../../service/import-excel.service'; +import { NgxUiLoaderService } from 'ngx-ui-loader'; @Component({ selector: 'app-project', @@ -25,6 +26,7 @@ export class ProjectComponent implements OnInit { public context; // ag-grid's parent context public frameworkComponents; // framework component public uploadFile: boolean = true; + public loaderProject: string; @Input() public gridColumns; @@ -51,12 +53,16 @@ export class ProjectComponent implements OnInit { public file: File; - constructor(private excelExportService: ExcelExportService, private excelImportService: ExcelImportService) { + constructor( + private excelExportService: ExcelExportService, + private excelImportService: ExcelImportService, + private loaderService: NgxUiLoaderService) { this.context = { componentParent: this }; this.frameworkComponents = { selectionRender: selectionRenderComponent, selectProjectRenderer: SelectProjectRendererComponent, }; + this.loaderProject = LoaderIds.LOADER_PROJECT; } ngOnInit() { @@ -112,7 +118,7 @@ export class ProjectComponent implements OnInit { public onGridReady(params) { this.gridApi = params.api; - this.gridColumnApi = params.columnApi; + this.gridColumnApi = params.columnApi; } @@ -120,10 +126,11 @@ export class ProjectComponent implements OnInit { this.file = event.target.files[0]; } - upload() { - this.excelImportService.excelToJson(this.file).subscribe((jsonData: any[]): void => { + upload() { + this.loaderService.startLoader(this.loaderProject); + this.excelImportService.excelToJson(this.file).subscribe((jsonData: any[]): void => { this.emitJsonData.emit(jsonData); - this.changeView(); + this.changeView(); }); } } From 415167803ceccd08e910372a49f3543dd3366afb Mon Sep 17 00:00:00 2001 From: jogaec22 Date: Fri, 2 Oct 2020 15:01:50 -0500 Subject: [PATCH 3/3] loader and combo state proform --- package-lock.json | 310 +++++++++++++++--- package.json | 2 + src/app/admin/login/login.component.ts | 2 +- src/app/admin/menu/menu.component.html | 1 + .../configuration/client/client.component.ts | 51 +-- .../colleges/colleges.component.ts | 5 +- .../product/product.component.ts | 7 +- .../components/project/project.component.ts | 11 +- src/app/shared/service/auth.service.ts | 4 +- src/app/shared/shared.module.ts | 6 +- .../proform-options-state/options.ts | 15 + .../proform-options-state.component.css | 3 + .../proform-options-state.component.html | 11 + .../proform-options-state.component.spec.ts | 25 ++ .../proform-options-state.component.ts | 29 ++ .../proform-state/proform-state.component.css | 0 .../proform-state.component.html | 22 ++ .../proform-state.component.spec.ts | 25 ++ .../proform-state/proform-state.component.ts | 76 +++++ src/app/ui/proform-state/proformColumns.ts | 24 ++ src/app/ui/ui-routing.module.ts | 2 + src/app/ui/ui.module.ts | 8 +- src/polyfills.ts | 4 + 23 files changed, 569 insertions(+), 74 deletions(-) create mode 100644 src/app/ui/proform-state/proform-options-state/options.ts create mode 100644 src/app/ui/proform-state/proform-options-state/proform-options-state.component.css create mode 100644 src/app/ui/proform-state/proform-options-state/proform-options-state.component.html create mode 100644 src/app/ui/proform-state/proform-options-state/proform-options-state.component.spec.ts create mode 100644 src/app/ui/proform-state/proform-options-state/proform-options-state.component.ts create mode 100644 src/app/ui/proform-state/proform-state.component.css create mode 100644 src/app/ui/proform-state/proform-state.component.html create mode 100644 src/app/ui/proform-state/proform-state.component.spec.ts create mode 100644 src/app/ui/proform-state/proform-state.component.ts create mode 100644 src/app/ui/proform-state/proformColumns.ts diff --git a/package-lock.json b/package-lock.json index 1375290..a8f6de7 100755 --- a/package-lock.json +++ b/package-lock.json @@ -396,6 +396,235 @@ "integrity": "sha512-IZG1kvw48JyFRy7bfMHqBixWrEHZmXmkP5DWsi5Tw6KusaczkMghI20BevCkodPcajXWHAUHNKyp1tlE3OnH0w==", "dev": true }, + "@angular/localize": { + "version": "9.1.12", + "resolved": "https://registry.npmjs.org/@angular/localize/-/localize-9.1.12.tgz", + "integrity": "sha512-31OalfES+dLrxN0VXCxxtT5dWoOSlQ40KYmzMS8X+mQ20gy9eFiZK4qf3DEq3JPqRltBMdEDnwR38uGIMAu2gQ==", + "requires": { + "@babel/core": "7.8.3", + "glob": "7.1.2", + "yargs": "15.3.0" + }, + "dependencies": { + "@babel/core": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.8.3.tgz", + "integrity": "sha512-4XFkf8AwyrEG7Ziu3L2L0Cv+WyY47Tcsp70JFmpftbAA1K7YL/sgE9jh9HyNj08Y/U50ItUchpN0w6HxAoX1rA==", + "requires": { + "@babel/code-frame": "^7.8.3", + "@babel/generator": "^7.8.3", + "@babel/helpers": "^7.8.3", + "@babel/parser": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.1", + "json5": "^2.1.0", + "lodash": "^4.17.13", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + } + }, + "@babel/generator": { + "version": "7.11.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.11.6.tgz", + "integrity": "sha512-DWtQ1PV3r+cLbySoHrwn9RWEgKMBLLma4OBQloPRyDYvc5msJM9kvTLo1YnlJd1P/ZuKbdli3ijr5q3FvAF3uA==", + "requires": { + "@babel/types": "^7.11.5", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + }, + "dependencies": { + "@babel/types": { + "version": "7.11.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.5.tgz", + "integrity": "sha512-bvM7Qz6eKnJVFIn+1LPtjlBFPVN5jNDc1XmN15vWe7Q3DPBufWWsLiIvUu7xW87uTG6QoggpIDnUgLQvPheU+Q==", + "requires": { + "@babel/helper-validator-identifier": "^7.10.4", + "lodash": "^4.17.19", + "to-fast-properties": "^2.0.0" + } + }, + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" + } + } + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "json5": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", + "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", + "requires": { + "minimist": "^1.2.5" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "requires": { + "p-limit": "^2.2.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "yargs": { + "version": "15.3.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.0.tgz", + "integrity": "sha512-g/QCnmjgOl1YJjGsnUg2SatC7NUYEiLXJqxNOQU9qSpjzGtGXda9b+OKccr1kLTy8BN9yqEyqfq5lxlwdc13TA==", + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.0" + } + }, + "yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, "@angular/material": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/@angular/material/-/material-9.2.2.tgz", @@ -434,7 +663,6 @@ "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", - "dev": true, "requires": { "@babel/highlight": "^7.8.3" } @@ -570,7 +798,6 @@ "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz", "integrity": "sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA==", - "dev": true, "requires": { "@babel/helper-get-function-arity": "^7.8.3", "@babel/template": "^7.8.3", @@ -581,7 +808,6 @@ "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz", "integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==", - "dev": true, "requires": { "@babel/types": "^7.8.3" } @@ -691,11 +917,15 @@ "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz", "integrity": "sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA==", - "dev": true, "requires": { "@babel/types": "^7.8.3" } }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==" + }, "@babel/helper-wrap-function": { "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.8.3.tgz", @@ -712,7 +942,6 @@ "version": "7.8.4", "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.8.4.tgz", "integrity": "sha512-VPbe7wcQ4chu4TDQjimHv/5tj73qz88o12EPkO2ValS2QiQS/1F2SsjyIGNnAD0vF/nZS6Cf9i+vW6HIlnaR8w==", - "dev": true, "requires": { "@babel/template": "^7.8.3", "@babel/traverse": "^7.8.4", @@ -723,7 +952,6 @@ "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.8.3.tgz", "integrity": "sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg==", - "dev": true, "requires": { "chalk": "^2.0.0", "esutils": "^2.0.2", @@ -733,8 +961,7 @@ "@babel/parser": { "version": "7.8.8", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.8.8.tgz", - "integrity": "sha512-mO5GWzBPsPf6865iIbzNE0AvkKF3NE+2S3eRUpE+FE07BOAkXh6G+GW/Pj01hhXjve1WScbaIO4UlY1JKeqCcA==", - "dev": true + "integrity": "sha512-mO5GWzBPsPf6865iIbzNE0AvkKF3NE+2S3eRUpE+FE07BOAkXh6G+GW/Pj01hhXjve1WScbaIO4UlY1JKeqCcA==" }, "@babel/plugin-proposal-async-generator-functions": { "version": "7.8.3", @@ -1246,7 +1473,6 @@ "version": "7.8.6", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz", "integrity": "sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg==", - "dev": true, "requires": { "@babel/code-frame": "^7.8.3", "@babel/parser": "^7.8.6", @@ -1257,7 +1483,6 @@ "version": "7.8.6", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.8.6.tgz", "integrity": "sha512-2B8l0db/DPi8iinITKuo7cbPznLCEk0kCxDoB9/N6gGNg/gxOXiR/IcymAFPiBwk5w6TtQ27w4wpElgp9btR9A==", - "dev": true, "requires": { "@babel/code-frame": "^7.8.3", "@babel/generator": "^7.8.6", @@ -1274,7 +1499,6 @@ "version": "7.8.8", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.8.8.tgz", "integrity": "sha512-HKyUVu69cZoclptr8t8U5b6sx6zoWjh8jiUhnuj3MpZuKT2dJ8zPTuiy31luq32swhI0SpwItCIlU8XW7BZeJg==", - "dev": true, "requires": { "@babel/types": "^7.8.7", "jsesc": "^2.5.1", @@ -1285,8 +1509,7 @@ "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" } } }, @@ -1294,7 +1517,6 @@ "version": "7.8.7", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.8.7.tgz", "integrity": "sha512-k2TreEHxFA4CjGkL+GYjRyx35W0Mr7DP5+9q6WMkyKXB+904bYmG40syjMFV0oLlhhFCwWl0vA0DyzTDkwAiJw==", - "dev": true, "requires": { "esutils": "^2.0.2", "lodash": "^4.17.13", @@ -1337,6 +1559,21 @@ "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", "dev": true }, + "@ng-bootstrap/ng-bootstrap": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@ng-bootstrap/ng-bootstrap/-/ng-bootstrap-7.0.0.tgz", + "integrity": "sha512-SxUaptGWJmCxM0d2Zy1mx7K7p/YBwGZ69NmmBQVY4BE6p5av0hWrVmv9rzzfBz0rhxU7RPZLor2Jpaoq8Xyl4w==", + "requires": { + "tslib": "^2.0.0" + }, + "dependencies": { + "tslib": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", + "integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==" + } + } + }, "@ng-select/ng-select": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@ng-select/ng-select/-/ng-select-4.0.0.tgz", @@ -2155,6 +2392,11 @@ } } }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" + }, "@types/estree": { "version": "0.0.43", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.43.tgz", @@ -3588,8 +3830,7 @@ "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" }, "caniuse-api": { "version": "3.0.0", @@ -4099,7 +4340,6 @@ "version": "1.7.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", - "dev": true, "requires": { "safe-buffer": "~5.1.1" } @@ -4683,8 +4923,7 @@ "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, "decode-uri-component": { "version": "0.2.0", @@ -6330,6 +6569,11 @@ "integrity": "sha512-KGDOARWVga7+rnB3z9Sd2Letx515owfk0hSxHGuqjANb1M+x2bGZGqHLiozPsYMdM2OubeMni/Hpwmjq6qIUhA==", "dev": true }, + "gensync": { + "version": "1.0.0-beta.1", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", + "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==" + }, "get-caller-file": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", @@ -6394,8 +6638,7 @@ "globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" }, "globby": { "version": "7.1.1", @@ -7548,8 +7791,7 @@ "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "js-yaml": { "version": "3.13.1", @@ -7569,8 +7811,7 @@ "jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" }, "json-parse-better-errors": { "version": "1.0.2", @@ -9194,7 +9435,6 @@ "version": "2.2.2", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz", "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==", - "dev": true, "requires": { "p-try": "^2.0.0" } @@ -9229,8 +9469,7 @@ "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" }, "pacote": { "version": "9.5.8", @@ -10924,8 +11163,7 @@ "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" }, "require-main-filename": { "version": "1.0.1", @@ -11402,8 +11640,7 @@ "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, "set-immediate-shim": { "version": "1.0.1", @@ -12650,8 +12887,7 @@ "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "dev": true + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=" }, "to-object-path": { "version": "0.3.0", @@ -14898,8 +15134,7 @@ "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" }, "wmf": { "version": "1.0.2", @@ -15034,8 +15269,7 @@ "y18n": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" }, "yallist": { "version": "4.0.0", diff --git a/package.json b/package.json index b252584..259b28c 100755 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "@angular/compiler": "~9.0.7", "@angular/core": "~9.0.7", "@angular/forms": "~9.0.7", + "@angular/localize": "^9.1.12", "@angular/material": "^9.2.2", "@angular/platform-browser": "~9.0.7", "@angular/platform-browser-dynamic": "~9.0.7", @@ -24,6 +25,7 @@ "@auth0/auth0-spa-js": "^1.11.0", "@fortawesome/free-solid-svg-icons": "^5.13.0", "@handsontable/angular": "^5.1.1", + "@ng-bootstrap/ng-bootstrap": "^7.0.0", "@ng-select/ng-select": "^4.0.0", "@ngtools/webpack": "^9.1.0", "@ngx-formly/bootstrap": "^5.0.0", diff --git a/src/app/admin/login/login.component.ts b/src/app/admin/login/login.component.ts index 4f58421..c23f40d 100644 --- a/src/app/admin/login/login.component.ts +++ b/src/app/admin/login/login.component.ts @@ -6,7 +6,7 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./login.component.css'] }) export class LoginComponent implements OnInit { - + constructor() { } ngOnInit(): void { diff --git a/src/app/admin/menu/menu.component.html b/src/app/admin/menu/menu.component.html index 30e8de8..14282bc 100644 --- a/src/app/admin/menu/menu.component.html +++ b/src/app/admin/menu/menu.component.html @@ -56,6 +56,7 @@

Santillana

diff --git a/src/app/configuration/client/client.component.ts b/src/app/configuration/client/client.component.ts index 1557c95..612eeea 100644 --- a/src/app/configuration/client/client.component.ts +++ b/src/app/configuration/client/client.component.ts @@ -25,7 +25,6 @@ export class ClientComponent implements OnInit, TransformColumns { public gridColumns = COLUMNS_CLIENT; public enabledTitle: boolean; public allowExcelExport: boolean; - public loaderProject: string; constructor( private excelExportService: ExcelExportService, @@ -33,22 +32,21 @@ export class ClientComponent implements OnInit, TransformColumns { private router: Router, private route: ActivatedRoute, private loaderService: NgxUiLoaderService - ) { - this.loaderProject = LoaderIds.LOADER_PROJECT; + ) { } ngOnInit(): void { - const self = this; + const self = this; this.enabledTitle = true; this.allowExcelExport = true; this.getDataClient().subscribe(data => { - self.data = data; - }); + self.data = data; + }); } - + public onExportExcel(excelData): any { if (!_.isNil(excelData.data) && !_.isEmpty(excelData.data)) { this.excelExportService.generateExcelFromJson( @@ -63,33 +61,36 @@ export class ClientComponent implements OnInit, TransformColumns { let jsonEditClient: any[] = []; let jsonAddClient: any[] = []; let jsonFinal = this.namesToProps(jsonData); - for ( const row of jsonFinal ){ - if( !_.isNil(row['id']) ){ + for (const row of jsonFinal) { + if (!_.isNil(row['id'])) { jsonEditClient.push(row); } else { jsonAddClient.push(row); } } - for ( const row of jsonAddClient ) + for (const row of jsonAddClient) delete row['id']; - const self = this; - forkJoin( - this.clientService.createClient(JSON.stringify(jsonAddClient)), - this.clientService.updateClient(JSON.stringify(jsonEditClient)) - ).subscribe( ([addClient, editClient ]) => { - alert('Se ha guardado correctamente los clientes'); - this.loaderService.stopLoader(this.loaderProject); - this.router.navigateByUrl('/client', { skipLocationChange: true }).then(() => { - this.router.navigate(['/client']); - }); - setTimeout(() => {}, 1000); - }); + const self = this; + forkJoin( + this.clientService.createClient(JSON.stringify(jsonAddClient)), + this.clientService.updateClient(JSON.stringify(jsonEditClient)) + ).subscribe(([addClient, editClient]) => { + alert('Se ha guardado correctamente los clientes'); + this.loaderService.stopLoader(LoaderIds.LOADER_PROJECT); + this.router.navigateByUrl('/client', { skipLocationChange: true }).then(() => { + this.router.navigate(['/client']); + }); + setTimeout(() => { }, 1000); + }, err => { + alert('Ha ocurrido un error al guardar los clientes'); + this.loaderService.stopLoader(LoaderIds.LOADER_PROJECT); + }); } - public namesToProps(json){ - return json.map(key => { + public namesToProps(json) { + return json.map(key => { let res = {}; res[`${ClientColumns.ID.prop}`] = key[ClientColumns.ID.name]; res[`${ClientColumns.COD_CLIENT.prop}`] = key[ClientColumns.COD_CLIENT.name]; @@ -98,7 +99,7 @@ export class ClientComponent implements OnInit, TransformColumns { res[`${ClientColumns.NAME.prop}`] = key[ClientColumns.NAME.name]; res[`${ClientColumns.NICKNAME.prop}`] = key[ClientColumns.NICKNAME.name]; res[`${ClientColumns.TYPE.prop}`] = key[ClientColumns.TYPE.name]; - res[`${ClientColumns.STATUS.prop}`] = key[ClientColumns.STATUS.name]; + res[`${ClientColumns.STATUS.prop}`] = key[ClientColumns.STATUS.name]; return res; }); } diff --git a/src/app/configuration/colleges/colleges.component.ts b/src/app/configuration/colleges/colleges.component.ts index e874f3c..2cd018c 100644 --- a/src/app/configuration/colleges/colleges.component.ts +++ b/src/app/configuration/colleges/colleges.component.ts @@ -1,7 +1,7 @@ 'use strict'; import { Component, OnInit, ViewChild } from '@angular/core'; -import { ClientColumns, CollegesColumns, TransformColumns, TypeRegion } from '../../app.keys'; +import { ClientColumns, CollegesColumns, LoaderIds, TransformColumns, TypeRegion } from '../../app.keys'; import { COLUMNS_COLLEGES } from './collegesColumns'; import { ProjectComponent } from '../../shared/components/project/project.component'; import { ExcelExportService } from '../../shared/service/export-excel.service'; @@ -9,6 +9,7 @@ import * as _ from 'lodash'; import { forkJoin } from 'rxjs'; import { CollegeService } from 'src/app/shared/service/college.service'; import { Router } from '@angular/router'; +import { NgxUiLoaderService } from 'ngx-ui-loader'; //const dataVal = require('./colleges.json'); @@ -29,6 +30,7 @@ export class CollegesComponent implements OnInit, TransformColumns { private excelExportService: ExcelExportService, private collegeService: CollegeService, private router: Router, + private loaderService: NgxUiLoaderService ) { } ngOnInit(): void { @@ -79,6 +81,7 @@ export class CollegesComponent implements OnInit, TransformColumns { this.collegeService.updateCollege(JSON.stringify(jsonEditCollege)) ).subscribe( ([addCollege, editCollege ]) => { alert('Se ha guardado correctamente los colegios'); + this.loaderService.stopLoader(LoaderIds.LOADER_PROJECT); this.router.navigateByUrl('/college', { skipLocationChange: true }).then(() => { this.router.navigate(['/college']); }); diff --git a/src/app/configuration/product/product.component.ts b/src/app/configuration/product/product.component.ts index 7b832ec..92c48c6 100644 --- a/src/app/configuration/product/product.component.ts +++ b/src/app/configuration/product/product.component.ts @@ -1,7 +1,7 @@ 'use strict'; import { Component, OnInit, ViewChild } from '@angular/core'; -import { ProductColumns, TypeRegion, TransformColumns } from '../../app.keys'; +import { ProductColumns, TypeRegion, TransformColumns, LoaderIds } from '../../app.keys'; import { ProjectComponent } from '../../shared/components/project/project.component'; import { COLUMNS_PRODUCT, COLUMNS_PINNED_TOP_DATA } from './productColumns'; import { ExcelExportService } from '../../shared/service/export-excel.service'; @@ -11,6 +11,7 @@ import { ExcelImportService } from 'src/app/shared/service/import-excel.service' import { forkJoin, pipe } from 'rxjs'; import { Router, NavigationStart, ActivatedRoute, NavigationEnd } from '@angular/router'; import { filter } from 'rxjs/operators'; +import { NgxUiLoaderService } from 'ngx-ui-loader'; //const dataVal = require('./product.json'); @@ -31,6 +32,7 @@ export class ProductComponent implements OnInit, TransformColumns { public pinnedTopRowDataVal: any; public pinnedBottomRowDataVal: any; public defaultColDefVal: any; + constructor( @@ -39,8 +41,8 @@ export class ProductComponent implements OnInit, TransformColumns { private productService: ProductService, private router: Router, private route: ActivatedRoute, + private loaderService: NgxUiLoaderService ) { - } ngOnInit() { @@ -108,6 +110,7 @@ export class ProductComponent implements OnInit, TransformColumns { this.productService.updateProduct('1', JSON.stringify(jsonEditProduct)) ).subscribe( ([addProduct, editProduct ]) => { alert('Se ha guardado correctamente los productos'); + this.loaderService.stopLoader(LoaderIds.LOADER_PROJECT); this.router.navigateByUrl('/product', { skipLocationChange: true }).then(() => { this.router.navigate(['/product']); }); diff --git a/src/app/shared/components/project/project.component.ts b/src/app/shared/components/project/project.component.ts index 7bca5cf..5fa5760 100644 --- a/src/app/shared/components/project/project.component.ts +++ b/src/app/shared/components/project/project.component.ts @@ -10,6 +10,7 @@ import { selectionRenderComponent } from '../../render/selection-render.componen import { SelectProjectRendererComponent } from './select-project-renderer.component'; import { ExcelImportService } from '../../service/import-excel.service'; import { NgxUiLoaderService } from 'ngx-ui-loader'; +import { ProformOptionsStateComponent } from 'src/app/ui/proform-state/proform-options-state/proform-options-state.component'; @Component({ selector: 'app-project', @@ -61,6 +62,8 @@ export class ProjectComponent implements OnInit { this.frameworkComponents = { selectionRender: selectionRenderComponent, selectProjectRenderer: SelectProjectRendererComponent, + proformOptionsStateRenderer: ProformOptionsStateComponent + }; this.loaderProject = LoaderIds.LOADER_PROJECT; } @@ -126,13 +129,17 @@ export class ProjectComponent implements OnInit { this.file = event.target.files[0]; } - upload() { + upload() { this.loaderService.startLoader(this.loaderProject); this.excelImportService.excelToJson(this.file).subscribe((jsonData: any[]): void => { this.emitJsonData.emit(jsonData); - this.changeView(); + this.changeView(); }); } + + getProformState(valueState) { + alert(valueState); + } } // https://www.ag-grid.com/javascript-grid-clipboard/ diff --git a/src/app/shared/service/auth.service.ts b/src/app/shared/service/auth.service.ts index 711a3b9..b444c86 100644 --- a/src/app/shared/service/auth.service.ts +++ b/src/app/shared/service/auth.service.ts @@ -12,8 +12,8 @@ export class AuthService { // Create an observable of Auth0 instance of client auth0Client$ = (from( createAuth0Client({ - domain: "YOUR_DOMAIN", - client_id: "YOUR_CLIENT_ID", + domain: "dev-eo7zm-kx.us.auth0.com", + client_id: "y8Nlf3Dr1He3eWYmoesSxmehs8wtdNVw", redirect_uri: `${window.location.origin}` }) ) as Observable).pipe( diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 2fee3a3..69911b2 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -15,6 +15,8 @@ import { FormlyFieldNgbTimePicker } from './components/form/ngb-time-picker.typ import { BrowserModule } from '@angular/platform-browser'; import { SelectProjectRendererComponent } from './components/project/select-project-renderer.component'; import { NgxUiLoaderModule } from 'ngx-ui-loader'; +import { NgbDropdownModule, NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { ProformOptionsStateComponent } from '../ui/proform-state/proform-options-state/proform-options-state.component'; @NgModule({ imports: [ @@ -23,7 +25,7 @@ import { NgxUiLoaderModule } from 'ngx-ui-loader'; FormsModule, ReactiveFormsModule, NgxUiLoaderModule, - AgGridModule.withComponents([selectionRenderComponent, SelectProjectRendererComponent]), + AgGridModule.withComponents([selectionRenderComponent, SelectProjectRendererComponent, ProformOptionsStateComponent]), HotTableModule.forRoot(), FormlyModule.forRoot({ types: [ @@ -34,6 +36,8 @@ import { NgxUiLoaderModule } from 'ngx-ui-loader'; { name: 'required', message: 'Este campo es requerido' }, ] }), + NgbModule, + NgbDropdownModule ], declarations: [ ProjectComponent, diff --git a/src/app/ui/proform-state/proform-options-state/options.ts b/src/app/ui/proform-state/proform-options-state/options.ts new file mode 100644 index 0000000..2262b06 --- /dev/null +++ b/src/app/ui/proform-state/proform-options-state/options.ts @@ -0,0 +1,15 @@ +export const options = { + EnCurso: { + id: '1', label: 'En curso' + }, + PorEditar: { + id:'2', label: 'Por editar' + }, + Anulado: { + id:'3', label: 'Anulado' + }, + Aprobado: { + id:'4', label: 'Aprobado' + }, + +}; \ No newline at end of file diff --git a/src/app/ui/proform-state/proform-options-state/proform-options-state.component.css b/src/app/ui/proform-state/proform-options-state/proform-options-state.component.css new file mode 100644 index 0000000..54e8964 --- /dev/null +++ b/src/app/ui/proform-state/proform-options-state/proform-options-state.component.css @@ -0,0 +1,3 @@ +.custom-container { + margin-left: 2vh; +} \ No newline at end of file diff --git a/src/app/ui/proform-state/proform-options-state/proform-options-state.component.html b/src/app/ui/proform-state/proform-options-state/proform-options-state.component.html new file mode 100644 index 0000000..654c3d2 --- /dev/null +++ b/src/app/ui/proform-state/proform-options-state/proform-options-state.component.html @@ -0,0 +1,11 @@ +
+ +
+ + + + +
+
\ No newline at end of file diff --git a/src/app/ui/proform-state/proform-options-state/proform-options-state.component.spec.ts b/src/app/ui/proform-state/proform-options-state/proform-options-state.component.spec.ts new file mode 100644 index 0000000..a7633d8 --- /dev/null +++ b/src/app/ui/proform-state/proform-options-state/proform-options-state.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ProformOptionsStateComponent } from './proform-options-state.component'; + +describe('ProformOptionsStateComponent', () => { + let component: ProformOptionsStateComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ProformOptionsStateComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ProformOptionsStateComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/ui/proform-state/proform-options-state/proform-options-state.component.ts b/src/app/ui/proform-state/proform-options-state/proform-options-state.component.ts new file mode 100644 index 0000000..608dabd --- /dev/null +++ b/src/app/ui/proform-state/proform-options-state/proform-options-state.component.ts @@ -0,0 +1,29 @@ +import { Component, OnInit } from '@angular/core'; +import { ICellRendererAngularComp } from 'ag-grid-angular'; +import { ICellRendererParams, IAfterGuiAttachedParams } from 'ag-grid-community'; +import { options } from './options'; + +@Component({ + selector: 'app-proform-options-state', + templateUrl: './proform-options-state.component.html', + styleUrls: ['./proform-options-state.component.css'] +}) +export class ProformOptionsStateComponent implements ICellRendererAngularComp { + + public params: ICellRendererParams; + public options = options; + + constructor() { } + refresh(params: any): boolean { + return false; + } + agInit(params: ICellRendererParams): void { + this.params = params; + } + + public invokeParentMethod(status) { + this.params.context.componentParent.getProformState(status); + } + + +} diff --git a/src/app/ui/proform-state/proform-state.component.css b/src/app/ui/proform-state/proform-state.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/ui/proform-state/proform-state.component.html b/src/app/ui/proform-state/proform-state.component.html new file mode 100644 index 0000000..3672b7d --- /dev/null +++ b/src/app/ui/proform-state/proform-state.component.html @@ -0,0 +1,22 @@ + + + +
+
+
+
Estado de Proformas x + +
+
+
+ +
+ +
+
+
+ + +
\ No newline at end of file diff --git a/src/app/ui/proform-state/proform-state.component.spec.ts b/src/app/ui/proform-state/proform-state.component.spec.ts new file mode 100644 index 0000000..50c143b --- /dev/null +++ b/src/app/ui/proform-state/proform-state.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ProformStateComponent } from './proform-state.component'; + +describe('ProformStateComponent', () => { + let component: ProformStateComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ProformStateComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ProformStateComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/ui/proform-state/proform-state.component.ts b/src/app/ui/proform-state/proform-state.component.ts new file mode 100644 index 0000000..3965514 --- /dev/null +++ b/src/app/ui/proform-state/proform-state.component.ts @@ -0,0 +1,76 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { ExcelExportService } from '../../shared/service/export-excel.service'; +import { COLUMNS_PROFORM } from './proformColumns'; +import * as _ from 'lodash'; +import { ProjectComponent } from 'src/app/shared/components/project/project.component'; +import { ProformService } from '../../shared/service/proform.service'; +import { Router } from '@angular/router'; + +@Component({ + selector: 'app-proform-state', + templateUrl: './proform-state.component.html', + styleUrls: ['./proform-state.component.css'] +}) +export class ProformStateComponent implements OnInit { + + @ViewChild(ProjectComponent, { static: true }) child: ProjectComponent; + + + public data: any; + public gridColumns = COLUMNS_PROFORM; + public enabledTitle: boolean; + public allowExcelExport: boolean; + public proformId: any; + + constructor( + private excelExportService: ExcelExportService, + private proformService: ProformService, + private router: Router, + ) { + + } + + + ngOnInit(): void { + this.enabledTitle = false; + this.allowExcelExport = false; + this.getProform(); + } + + public getProform(): void { + this.proformService.getProform().subscribe(proform => { + _.forEach(proform, function (value, key) { + value['number_proform'] = value['number_proform'] + ' - ' + value['state_number']; + value['user_id'] = value['user']['codUser'] + ' - ' + value['user']['userName']; + value['college_id'] = value['college']['codSantillana'] + ' - ' + value['college']['name']; + value['client_id'] = value['client']['codClient'] + ' - ' + value['client']['name']; + }); + this.data = proform; + }); + } + + /** + * Export Excel + * @param {name, gridColumns, data} + * + */ + public onExportExcel(excelData): any { + if (!_.isNil(excelData.data) && !_.isEmpty(excelData.data)) { + this.excelExportService.generateExcelFromJson( + excelData.name, + excelData.gridColumns, + excelData.data + ); + } + } + + public selectProject(row): any { + this.router.navigate(['proform-edit', row['data']['id']]); + } + + public edit() { + const idProform = (document.getElementById("txtProforma")).value; + this.router.navigate(['proform-edit', idProform]); + } + +} diff --git a/src/app/ui/proform-state/proformColumns.ts b/src/app/ui/proform-state/proformColumns.ts new file mode 100644 index 0000000..28fafe1 --- /dev/null +++ b/src/app/ui/proform-state/proformColumns.ts @@ -0,0 +1,24 @@ +import { Proform } from '../../app.keys'; + +export const COLUMNS_PROFORM = [ + { + headerName: ' ', + field: 'value', + cellRenderer: 'selectProjectRenderer', + colId: 'params', + width: 85 + }, + { field: Proform.ID.prop, headerName: Proform.ID.name, resizable: true, width: 90 }, + { field: Proform.NUMBER_PROFORM.prop, headerName: Proform.NUMBER_PROFORM.name, resizable: true, width: 150 }, + { field: Proform.DATE_PROFORM.prop, headerName: Proform.DATE_PROFORM.name, resizable: true, width: 120 }, + { field: Proform.DATE_DELIVERY.prop, headerName: Proform.DATE_DELIVERY.name, resizable: true, width: 120 }, + { field: Proform.USER_ID.prop, headerName: Proform.USER_ID.name, resizable: true, width: 150 }, + { field: Proform.CLIENT_ID.prop, headerName: Proform.CLIENT_ID.name, resizable: true, width: 150 }, + { field: Proform.COLLEGE_ID.prop, headerName: Proform.COLLEGE_ID.name, resizable: true, width: 200 }, + { + headerName: ' ', + field: 'value', + cellRenderer: 'proformOptionsStateRenderer', + width: 250 + } +]; \ No newline at end of file diff --git a/src/app/ui/ui-routing.module.ts b/src/app/ui/ui-routing.module.ts index d0c3aa8..004601b 100644 --- a/src/app/ui/ui-routing.module.ts +++ b/src/app/ui/ui-routing.module.ts @@ -4,10 +4,12 @@ import { ProformAddComponent } from './proform-add/proform-add.component'; import {USER_ROLES} from '../app.keys'; import { ProformListComponent } from './proform-list/proform-list.component'; import { ProformEditComponent } from './proform-edit/proform-edit.component'; +import { ProformStateComponent } from './proform-state/proform-state.component'; const configurationRoutes: Routes = [ { path: 'proform', component: ProformAddComponent }, { path: 'proform-list', component: ProformListComponent }, + { path: 'proform-state', component: ProformStateComponent}, { path: 'proform-edit/:id', component: ProformEditComponent } ]; @NgModule({ diff --git a/src/app/ui/ui.module.ts b/src/app/ui/ui.module.ts index 0a7cb66..63f73e8 100644 --- a/src/app/ui/ui.module.ts +++ b/src/app/ui/ui.module.ts @@ -11,6 +11,9 @@ import { MatInputModule } from '@angular/material/input'; import { ProformListComponent } from './proform-list/proform-list.component'; import { ProformEditComponent } from './proform-edit/proform-edit.component'; import { NgxUiLoaderModule } from 'ngx-ui-loader'; +import { ProformStateComponent } from './proform-state/proform-state.component'; +import { ProformOptionsStateComponent } from './proform-state/proform-options-state/proform-options-state.component'; +import { NgbDropdownModule, NgbModule } from '@ng-bootstrap/ng-bootstrap'; @NgModule({ @@ -30,9 +33,10 @@ import { NgxUiLoaderModule } from 'ngx-ui-loader'; { name: 'required', message: 'This field is required' }, ] }), - + NgbModule, + NgbDropdownModule ], - declarations: [ProformAddComponent, ProformListComponent, ProformEditComponent], + declarations: [ProformAddComponent, ProformListComponent, ProformEditComponent, ProformStateComponent, ProformOptionsStateComponent], providers: [], exports: [ProformAddComponent] }) diff --git a/src/polyfills.ts b/src/polyfills.ts index 03711e5..01e24d6 100755 --- a/src/polyfills.ts +++ b/src/polyfills.ts @@ -1,3 +1,7 @@ +/*************************************************************************************************** + * Load `$localize` onto the global scope - used if i18n tags appear in Angular templates. + */ +import '@angular/localize/init'; /** * This file includes polyfills needed by Angular and is loaded before the app. * You can add your own extra polyfills to this file.