perbaikan master

This commit is contained in:
2024-07-12 15:16:53 +07:00
parent a9034c1a32
commit 13e5ee01d2
12 changed files with 322 additions and 89 deletions

View File

@@ -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}`);