Skip to content

Commit

Permalink
Merge pull request #86 from pikachu49/components-registerproductlot-r…
Browse files Browse the repository at this point in the history
…egister-subrama

#74 componentRegisterProduct Lot, forms and test
  • Loading branch information
jesusveca authored Nov 26, 2016
2 parents 19e7bcf + 6e06fac commit 58255ca
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -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);
})
}
}

Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ div
span Provider name
input([(ngModel)]="provider.name", type="text", name="providerName")
p
button((click)="submitRegister()") Submit
button((click)="submitRegister()") Registrar
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -74,7 +76,7 @@ export class Resources {
return this.request('registerProviderProduct', params.urlParams, params.data);
}

public registerProductLot (params: { urlParams: any; data: any }): Observable<any> {
public registerProductLot (params: { urlParams: any; data: RegisterProductLotRequestParams }): Observable<any> {
return this.request('registerProductLot', params.urlParams, params.data);
}

Expand Down

0 comments on commit 58255ca

Please sign in to comment.