perbaikan master
This commit is contained in:
@@ -5,6 +5,7 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { Router } from '@angular/router';
|
||||
import { BuildingService } from '../../service/monitoring-api.service';
|
||||
import { LoginService } from '../../service/login.service';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
|
||||
@Component({
|
||||
selector: 'app-master-role',
|
||||
@@ -24,7 +25,8 @@ export class MasterRoleComponent {
|
||||
private modalService: NgbModal,
|
||||
private router: Router,
|
||||
private monitoringApiService: BuildingService,
|
||||
private authService: LoginService
|
||||
private authService: LoginService,
|
||||
private toastr: ToastrService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -90,13 +92,28 @@ export class MasterRoleComponent {
|
||||
(result) => {
|
||||
console.log(result);
|
||||
if (result) {
|
||||
this.monitoringApiService
|
||||
if (this.filteredRows.some(value => value.name.toLowerCase() === result.name.toLowerCase())) {
|
||||
this.toastr.error("Warning", "Data yang anda masukan double.", {
|
||||
timeOut: 5000,
|
||||
closeButton: true,
|
||||
});
|
||||
} else {
|
||||
this.monitoringApiService
|
||||
.postHeaderDetailParam(result)
|
||||
.subscribe((res) => {
|
||||
console.log(res);
|
||||
this.fetchData();
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (result) {
|
||||
// this.monitoringApiService
|
||||
// .postHeaderDetailParam(result)
|
||||
// .subscribe((res) => {
|
||||
// console.log(res);
|
||||
// this.fetchData();
|
||||
// });
|
||||
// }
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
@@ -118,13 +135,28 @@ export class MasterRoleComponent {
|
||||
(result) => {
|
||||
console.log(result);
|
||||
if (result) {
|
||||
this.monitoringApiService
|
||||
if (this.filteredRows.some(value => value.name.toLowerCase() === result.name.toLowerCase())) {
|
||||
this.toastr.error("Warning", "Data yang anda masukan double.", {
|
||||
timeOut: 5000,
|
||||
closeButton: true,
|
||||
});
|
||||
} else {
|
||||
this.monitoringApiService
|
||||
.putHeaderDetailParam(result, row.id)
|
||||
.subscribe((res) => {
|
||||
console.log(res);
|
||||
this.fetchData();
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (result) {
|
||||
// this.monitoringApiService
|
||||
// .putHeaderDetailParam(result, row.id)
|
||||
// .subscribe((res) => {
|
||||
// console.log(res);
|
||||
// this.fetchData();
|
||||
// });
|
||||
// }
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
|
||||
Reference in New Issue
Block a user