Skip to content

Commit

Permalink
fix: process
Browse files Browse the repository at this point in the history
  • Loading branch information
leoriofrio committed Jun 8, 2020
1 parent 2b0b4e1 commit 3c8d41b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 13 deletions.
30 changes: 21 additions & 9 deletions src/app/configuration/product/product.component.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
'use strict';

import { Component, OnInit, ViewChild } from '@angular/core';
import { ProductColumns } from '../../app.keys';
import { ProductColumns, TypeRegion } 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';
import * as _ from 'lodash';
import { ProductService } from 'src/app/shared/service/product.service';


const dataVal = require('./product.json');
//const dataVal = require('./product.json');

@Component({
selector: 'app-product',
templateUrl: './product.component.html',
styleUrls: ['./product.component.css']
styleUrls: ['./product.component.scss']
})
export class ProductComponent implements OnInit {
@ViewChild(ProjectComponent, {static: true}) child: ProjectComponent;


public data = dataVal;
public data: any; //dataVal;
public gridColumns = COLUMNS_PRODUCT;
public enabledTitle: boolean;
public allowExcelExport: boolean;
public val: string;
public pinnedTopRowDataVal: any;
public pinnedBottomRowDataVal: any;
public defaultColDefVal: any;


constructor(private excelExportService: ExcelExportService) {

constructor(
private excelExportService: ExcelExportService,
private productService: ProductService,
) {
const self = this;
this.getDataProduct().subscribe(data => {
self.data = data;
});
}

ngOnInit() {
Expand Down Expand Up @@ -71,8 +78,13 @@ export class ProductComponent implements OnInit {
}
}

public onJsonData(jsonData){
console.log('data de Producto es', jsonData);
public onJsonData(jsonData){
console.log('data de Producto es', JSON.stringify(jsonData));
return this.productService.createProduct('1', JSON.stringify(jsonData));
}

public getDataProduct() {
return this.productService.getProductByRegion(TypeRegion.SIERRA);
}

}
6 changes: 6 additions & 0 deletions src/app/shared/service/product.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@ export class ProductService {
const url = this.baseUrl+`product/`+region.toString();
return this.http.get<any>(url);
}

public createProduct(id: string, product: any): Observable<any> {
debugger;
const url = this.baseUrl+`product/Sierra`;
return this.http.post<any>(url, product, httpOptions);
}
}
8 changes: 6 additions & 2 deletions src/app/ui/proform-add/proform-add.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,18 @@
<tr>
<th>Unidades</th>
<th>Subtotal</th>
<th>% Descuento</th>
<th>Descuento</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ datasetSummary.quantity }}</td>
<td>{{ datasetSummary.subtotal }}</td>
<td>{{ datasetSummary.total }}</td>
<td>{{ datasetSummary.subtotal.toFixed(2) }}</td>
<td>{{ ( ( 1 -datasetSummary.total / datasetSummary.subtotal) * 100 ).toFixed(2) }} %</td>
<td>{{ (datasetSummary.subtotal - datasetSummary.total).toFixed(2) }}</td>
<td>{{ datasetSummary.total.toFixed(2) }}</td>
</tr>
</tbody>
</table>
Expand Down
8 changes: 6 additions & 2 deletions src/app/ui/proform-edit/proform-edit.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,18 @@
<tr>
<th>Unidades</th>
<th>Subtotal</th>
<th>% Descuento</th>
<th>Descuento</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ datasetSummary.quantity }}</td>
<td>{{ datasetSummary.subtotal }}</td>
<td>{{ datasetSummary.total }}</td>
<td>{{ datasetSummary.subtotal.toFixed(2) }}</td>
<td>{{ ( ( 1 -datasetSummary.total / datasetSummary.subtotal) * 100 ).toFixed(2) }} %</td>
<td>{{ (datasetSummary.subtotal - datasetSummary.total).toFixed(2) }}</td>
<td>{{ datasetSummary.total.toFixed(2) }}</td>
</tr>
</tbody>
</table>
Expand Down

0 comments on commit 3c8d41b

Please sign in to comment.