summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/views/management/management.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'usecaseui-portal/src/app/views/management/management.component.ts')
-rw-r--r--usecaseui-portal/src/app/views/management/management.component.ts28
1 files changed, 18 insertions, 10 deletions
diff --git a/usecaseui-portal/src/app/views/management/management.component.ts b/usecaseui-portal/src/app/views/management/management.component.ts
index 727de636..75ce4de7 100644
--- a/usecaseui-portal/src/app/views/management/management.component.ts
+++ b/usecaseui-portal/src/app/views/management/management.component.ts
@@ -13,9 +13,10 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-import { Component, OnInit, HostBinding } from '@angular/core'
-import { showHideAnimate, slideToRight } from '../../shared/utils/animates'
-import { ManagemencsService } from '../../core/services/managemencs.service'
+import { Component, OnInit, HostBinding } from '@angular/core';
+import { showHideAnimate, slideToRight } from '../../shared/utils/animates';
+import { ManagemencsService } from '../../core/services/managemencs.service';
+import {NzMessageService} from "ng-zorro-antd";
@Component({
selector: 'app-management',
@@ -26,10 +27,13 @@ import { ManagemencsService } from '../../core/services/managemencs.service'
export class ManagementComponent implements OnInit {
@HostBinding('@routerAnimate') routerAnimateState //Routing animation
- nocuster: boolean
- firstCustomer: string
+ nocuster: boolean = true;
+ firstCustomer: string = "";
- constructor (private managemencs: ManagemencsService) {}
+ constructor(
+ private managemencs: ManagemencsService,
+ private message: NzMessageService,
+ ) { }
ngOnInit () {
this.getAllCustomers()
@@ -38,7 +42,7 @@ export class ManagementComponent implements OnInit {
// Get all customers
getAllCustomers () {
this.managemencs.getAllCustomers().subscribe(data => {
- this.nocuster = data.length > 0 ? false : true
+ this.nocuster = data.length !== 0 ? false : true;
})
}
createNewCustomer (customer) {
@@ -51,13 +55,17 @@ export class ManagementComponent implements OnInit {
this.managemencs.createCustomer(customer, createParams).subscribe(data => {
if (data['status'] == 'SUCCESS') {
this.nocuster = false
- } else {
- this.nocuster = true
- console.log(data, 'Interface returned error')
+ } else {
+ this.nocuster = true;
+ this.clearCustomerInput();
+ this.message.error(data["errorMessage"]);
}
})
}
clearCustomerInput () {
this.firstCustomer = ''
}
+ closeCustomer(isClose){
+ this.nocuster = isClose;
+ }
}