diff options
Diffstat (limited to 'usecaseui-portal/src/app/management/management.component.ts')
-rw-r--r-- | usecaseui-portal/src/app/management/management.component.ts | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/usecaseui-portal/src/app/management/management.component.ts b/usecaseui-portal/src/app/management/management.component.ts index 5cc6be7b..0a5bfd2e 100644 --- a/usecaseui-portal/src/app/management/management.component.ts +++ b/usecaseui-portal/src/app/management/management.component.ts @@ -15,6 +15,7 @@ */ import { Component, OnInit , HostBinding} from '@angular/core'; import { showHideAnimate, slideToRight } from '../animates'; +import { ManagemencsService } from '../managemencs.service'; @Component({ selector: 'app-management', @@ -27,23 +28,41 @@ import { showHideAnimate, slideToRight } from '../animates'; export class ManagementComponent implements OnInit { @HostBinding('@routerAnimate') routerAnimateState; //Routing animation - constructor() { } + constructor(private managemencs: ManagemencsService) { } ngOnInit() { + this.getAllCustomers(); } - show = "show"; - hide = "hide"; - custerhide = false; - customershow(){ - this.show = "show"; - this.hide = "hide"; - this.custerhide = true; - } - customerhide(){ - this.show = "hide"; - this.hide = "show"; - this.custerhide = false; - } + nocuster = true; + firstCustomer = null; + AllCustomersdata = []; + + // Get all customers + getAllCustomers() { + this.managemencs.getAllCustomers().subscribe((data) => { + if (data.length > 0) { + this.nocuster = false; + } else { + this.nocuster = true; + } + }) + } + createNewCustomer(customer) { + let createParams = { + customerId: customer + }; + this.managemencs.createCustomer(customer, createParams).subscribe((data) => { + if (data["status"] == 'SUCCESS') { + this.nocuster = false; + } else { + this.nocuster = true; + console.log(data, "Interface returned error") + } + }) + } + clearCustomerInput(){ + this.firstCustomer=null; + } } |