From 6e06fac28010b7f245575bbba57636eb9702728e Mon Sep 17 00:00:00 2001 From: jesusveca Date: Sat, 26 Nov 2016 15:08:28 -0500 Subject: [PATCH] #74 componentRegisterProduct Lot, forms and test --- .../components/RegisterProductLot/index.ts | 31 ++++++++++++++++--- .../RegisterProductLot/template.jade | 21 ++++++------- .../components/RegisterProvider/template.jade | 2 +- .../dashboard/src/app/services/Resources.ts | 4 ++- 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/src/server/statics/webapps/dashboard/src/app/components/RegisterProductLot/index.ts b/src/server/statics/webapps/dashboard/src/app/components/RegisterProductLot/index.ts index 6b89b2f..e51eeae 100644 --- a/src/server/statics/webapps/dashboard/src/app/components/RegisterProductLot/index.ts +++ b/src/server/statics/webapps/dashboard/src/app/components/RegisterProductLot/index.ts @@ -1,16 +1,37 @@ -import {Component} from '@angular/core'; +import {Component, OnInit} from '@angular/core'; +import {Lot} from '../../../../../../../../core/db-models/Lot.ts'; +import {Resources} from '../../services/Resources.ts'; + @Component({ styles: [require('./style.styl').toString()], template: require('./template.jade')(), }) -export class RegisterProductLotComponent { +export class RegisterProductLotComponent implements OnInit{ // Attributes - + lot: Lot; + resources: Resources; // Methods - constructor () { - + constructor (resources: Resources) { + this.resources = resources; + this.lot = { + code: '', + productId: '' + } } + ngOnInit () {} + submitRegister () { + this.resources.registerProductLot({ + urlParams: {}, + data: { + code: this.lot.code, + productId: this.lot.productId + } + }).subscribe((resp) => { + console.log(resp); + }) + } } + diff --git a/src/server/statics/webapps/dashboard/src/app/components/RegisterProductLot/template.jade b/src/server/statics/webapps/dashboard/src/app/components/RegisterProductLot/template.jade index af91740..a6d9478 100644 --- a/src/server/statics/webapps/dashboard/src/app/components/RegisterProductLot/template.jade +++ b/src/server/statics/webapps/dashboard/src/app/components/RegisterProductLot/template.jade @@ -1,13 +1,10 @@ -h1 Register Product Lot Component - -form(name="add-estimation", method="post") - div.input - span.label Code: - input(type="text", name="code") - div.input - span.label ProveedorId: - input(type="text", name="proveedorId") - - div.actions - input(type="submit", value="Registrar") +div + form + p + span code : + input([(ngModel)]="lot.code", type="text", name="lotCode") + span productId : + input([(ngModel)]="lot.productId", type="text", name="lotProductId") + p + button((click)="submitRegister()") Submit \ No newline at end of file diff --git a/src/server/statics/webapps/dashboard/src/app/components/RegisterProvider/template.jade b/src/server/statics/webapps/dashboard/src/app/components/RegisterProvider/template.jade index 29f11dd..bcb1229 100644 --- a/src/server/statics/webapps/dashboard/src/app/components/RegisterProvider/template.jade +++ b/src/server/statics/webapps/dashboard/src/app/components/RegisterProvider/template.jade @@ -4,4 +4,4 @@ div span Provider name input([(ngModel)]="provider.name", type="text", name="providerName") p - button((click)="submitRegister()") Submit \ No newline at end of file + button((click)="submitRegister()") Registrar \ No newline at end of file diff --git a/src/server/statics/webapps/dashboard/src/app/services/Resources.ts b/src/server/statics/webapps/dashboard/src/app/services/Resources.ts index 3418594..5acbece 100644 --- a/src/server/statics/webapps/dashboard/src/app/services/Resources.ts +++ b/src/server/statics/webapps/dashboard/src/app/services/Resources.ts @@ -8,6 +8,8 @@ import {RequestParams as GetProviderRequestParams, ResponseBody as GetProviderRe import {RequestParams as GetProviderProductsRequestParams, ResponseBody as GetProviderProductsResponseBody} from '../../../../../../../server/routers/handlers/provider/getProviderProducts/interface.ts'; import {RequestParams as RegisterProviderRequestParams, ResponseBody as RegisterProviderResponseBody} from '../../../../../../../server/routers/handlers/provider/registerProvider/interface.ts'; +import {RequestParams as RegisterProductLotRequestParams, ResponseBody as RegisterProductLotResponseBody} from '../../../../../../../server/routers/handlers/product/registerProductLot/interface.ts'; + @Injectable() export class Resources { @@ -74,7 +76,7 @@ export class Resources { return this.request('registerProviderProduct', params.urlParams, params.data); } - public registerProductLot (params: { urlParams: any; data: any }): Observable { + public registerProductLot (params: { urlParams: any; data: RegisterProductLotRequestParams }): Observable { return this.request('registerProductLot', params.urlParams, params.data); }