String new_prod_category_id;
final ProductCategoryService _prodcatSrv;
final Router _router;
+ var docreate=false;
ProductCategoryComponent(this._prodcatSrv,this._router);
getProductCategories();
}
+ void checkInput() {
+ if(new_prod_category_name=='' || new_prod_category_id=='') {
+ docreate=false;
+ }
+ else {
+ docreate=true;
+ for(var cat in product_categories) {
+ if(cat.id==new_prod_category_id) {
+ docreate=false;
+ break;
+ }
+ }
+ }
+ }
+
choose(ProductCategory pt) {
selected_prod_category=pt;
goto_products(pt);
<div class="mdl-textfield mdl-js-textfield
mdl-textfield--floating-label ain">
<input class="mdl-textfield__input" type=text id=ptn
- [(ngModel)]="new_prod_category_name">
+ [(ngModel)]="new_prod_category_name"
+ (keyup)="checkInput()">
<label class="mdl-textfield__label" for=ptn>Name</label>
</div>
<div class="mdl-textfield mdl-js-textfield
mdl-textfield--floating-label ain">
<input class="mdl-textfield__input" type=text id=pti
- [(ngModel)]="new_prod_category_id">
+ [(ngModel)]="new_prod_category_id"
+ (keyup)="checkInput()">
<label class="mdl-textfield__label" for=pti>Identifier</label>
</div>
<button class="mdl-button mdl-js-button mdl-button--raised abtn"
- (click)="createProductCategory()">
+ (click)="createProductCategory()"
+ [disabled]="!docreate">
Create
</button>
</div>