perbaikan master
This commit is contained in:
parent
a9034c1a32
commit
13e5ee01d2
|
@ -13,7 +13,7 @@
|
|||
href="https://allbestsistem.com/"
|
||||
target="_blank"
|
||||
style="background-color: #000000 !important;"
|
||||
>Smart Building Management Systems (V@2024-07-11.03)
|
||||
>Smart Building Management Systems (V@2024-07-12.01)
|
||||
</a></span
|
||||
>
|
||||
</p>
|
||||
|
|
|
@ -48,7 +48,7 @@ export class AddEditMasterBuildingComponent {
|
|||
owner: ["", Validators.required],
|
||||
address: ["", Validators.required],
|
||||
phone: ["", [Validators.required, Validators.pattern(/^[0-9]{10,15}$/)]],
|
||||
kwh: ["", [Validators.required, Validators.maxLength(15), Validators.pattern(/^[0-9]{10,15}$/)]],
|
||||
kwh: ["", [Validators.required, Validators.maxLength(15), Validators.pattern(/^[0-9]{2,15}$/)]],
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ export class AddEditMasterBuildingComponent {
|
|||
address: [this.dataRow.address, Validators.required],
|
||||
phone: [this.dataRow.phone, [Validators.required, Validators.pattern(/^[0-9]{10,15}$/)]],
|
||||
owner: [this.dataRow.owner,Validators.required],
|
||||
kwh: [this.dataRow.kwh, [Validators.required, Validators.maxLength(15), Validators.pattern(/^[0-9]{10,15}$/)]],
|
||||
kwh: [this.dataRow.kwh, [Validators.required, Validators.maxLength(15), Validators.pattern(/^[0-9]{2,15}$/)]],
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { AddEditMasterComponent } from '../add-edit-master/add-edit-master.component';
|
||||
import { TableApiService } from 'src/app/_services/table-api.service';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { Router } from '@angular/router';
|
||||
import { BuildingService } from '../../service/monitoring-api.service';
|
||||
import { AddEditMasterBuildingComponent } from './add-edit-master-building/add-edit-master-building.component';
|
||||
import { LoginService } from '../../service/login.service';
|
||||
import { Component } from "@angular/core";
|
||||
import { AddEditMasterComponent } from "../add-edit-master/add-edit-master.component";
|
||||
import { TableApiService } from "src/app/_services/table-api.service";
|
||||
import { NgbModal } from "@ng-bootstrap/ng-bootstrap";
|
||||
import { Router } from "@angular/router";
|
||||
import { BuildingService } from "../../service/monitoring-api.service";
|
||||
import { AddEditMasterBuildingComponent } from "./add-edit-master-building/add-edit-master-building.component";
|
||||
import { LoginService } from "../../service/login.service";
|
||||
import { ToastrService } from "ngx-toastr";
|
||||
|
||||
@Component({
|
||||
selector: 'app-master-building',
|
||||
templateUrl: './master-building.component.html',
|
||||
styleUrls: ['./master-building.component.css']
|
||||
selector: "app-master-building",
|
||||
templateUrl: "./master-building.component.html",
|
||||
styleUrls: ["./master-building.component.css"],
|
||||
})
|
||||
export class MasterBuildingComponent {
|
||||
data: any;
|
||||
|
@ -24,7 +25,8 @@ export class MasterBuildingComponent {
|
|||
private modalService: NgbModal,
|
||||
private router: Router,
|
||||
private monitoringApiService: BuildingService,
|
||||
private authService: LoginService
|
||||
private authService: LoginService,
|
||||
private toastr: ToastrService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -74,20 +76,38 @@ export class MasterBuildingComponent {
|
|||
openAddMasterModal() {
|
||||
const modalRef = this.modalService.open(AddEditMasterBuildingComponent, {
|
||||
size: "lg",
|
||||
backdrop: 'static',
|
||||
keyboard: false
|
||||
backdrop: "static",
|
||||
keyboard: false,
|
||||
});
|
||||
|
||||
modalRef.componentInstance.mode = "add";
|
||||
modalRef.result.then(
|
||||
(result) => {
|
||||
if (result) {
|
||||
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
|
||||
.postMasterBuildingParam(result)
|
||||
.subscribe((res) => {
|
||||
this.fetchData();
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (result) {
|
||||
// this.monitoringApiService
|
||||
// .postMasterBuildingParam(result)
|
||||
// .subscribe((res) => {
|
||||
// this.fetchData();
|
||||
// });
|
||||
// }
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
|
@ -98,8 +118,8 @@ export class MasterBuildingComponent {
|
|||
editRow(row) {
|
||||
const modalRef = this.modalService.open(AddEditMasterBuildingComponent, {
|
||||
size: "lg",
|
||||
backdrop: 'static',
|
||||
keyboard: false
|
||||
backdrop: "static",
|
||||
keyboard: false,
|
||||
});
|
||||
|
||||
modalRef.componentInstance.dataRow = row;
|
||||
|
@ -107,12 +127,27 @@ export class MasterBuildingComponent {
|
|||
modalRef.result.then(
|
||||
(result) => {
|
||||
if (result) {
|
||||
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
|
||||
.putMasterBuildingParam(result, row.id)
|
||||
.subscribe((res) => {
|
||||
this.fetchData();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// if (result) {
|
||||
// this.monitoringApiService
|
||||
// .putMasterBuildingParam(result, row.id)
|
||||
// .subscribe((res) => {
|
||||
// this.fetchData();
|
||||
// });
|
||||
// }
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
|
|
|
@ -29,7 +29,7 @@ export class MasterCategoryComponent implements OnInit {
|
|||
private router: Router,
|
||||
private monitoringApiService: BuildingService,
|
||||
private toastr: ToastrService,
|
||||
private authService: LoginService
|
||||
private authService: LoginService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -98,23 +98,39 @@ export class MasterCategoryComponent implements OnInit {
|
|||
(result) => {
|
||||
console.log(result);
|
||||
if (result) {
|
||||
this.monitoringApiService.postHeaderDetailParam(result).subscribe(
|
||||
(res) => {
|
||||
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();
|
||||
this.toastr.success("Success", "Save Completed.", {
|
||||
timeOut: 2000,
|
||||
closeButton: true,
|
||||
});
|
||||
},
|
||||
(error) => {
|
||||
console.error(error);
|
||||
this.toastr.error("Error", "Something went wrong!", {
|
||||
timeOut: 2000,
|
||||
closeButton: true,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// if (result) {
|
||||
// this.monitoringApiService.postHeaderDetailParam(result).subscribe(
|
||||
// (res) => {
|
||||
// this.fetchData();
|
||||
// this.toastr.success("Success", "Save Completed.", {
|
||||
// timeOut: 2000,
|
||||
// closeButton: true,
|
||||
// });
|
||||
// },
|
||||
// (error) => {
|
||||
// console.error(error);
|
||||
// this.toastr.error("Error", "Something went wrong!", {
|
||||
// timeOut: 2000,
|
||||
// closeButton: true,
|
||||
// });
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
|
@ -137,25 +153,40 @@ export class MasterCategoryComponent implements OnInit {
|
|||
(result) => {
|
||||
console.log(result);
|
||||
if (result) {
|
||||
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) => {
|
||||
.subscribe((res) => {
|
||||
console.log(res);
|
||||
this.fetchData();
|
||||
this.toastr.success("Success", "Update Completed.", {
|
||||
timeOut: 2000,
|
||||
closeButton: true,
|
||||
});
|
||||
},
|
||||
(error) => {
|
||||
console.error(error);
|
||||
this.toastr.error("Error", "Something went wrong!", {
|
||||
timeOut: 2000,
|
||||
closeButton: true,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
// if (result) {
|
||||
// this.monitoringApiService
|
||||
// .putHeaderDetailParam(result, row.id)
|
||||
// .subscribe(
|
||||
// (res) => {
|
||||
// this.fetchData();
|
||||
// this.toastr.success("Success", "Update Completed.", {
|
||||
// timeOut: 2000,
|
||||
// closeButton: true,
|
||||
// });
|
||||
// },
|
||||
// (error) => {
|
||||
// console.error(error);
|
||||
// this.toastr.error("Error", "Something went wrong!", {
|
||||
// timeOut: 2000,
|
||||
// closeButton: true,
|
||||
// });
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
|
|
|
@ -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-duration-use',
|
||||
|
@ -24,7 +25,8 @@ export class MasterDurationUseComponent {
|
|||
private modalService: NgbModal,
|
||||
private router: Router,
|
||||
private monitoringApiService: BuildingService,
|
||||
private authService: LoginService
|
||||
private authService: LoginService,
|
||||
private toastr: ToastrService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -90,6 +92,13 @@ export class MasterDurationUseComponent {
|
|||
(result) => {
|
||||
console.log(result);
|
||||
if (result) {
|
||||
if (result) {
|
||||
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) => {
|
||||
|
@ -97,6 +106,14 @@ export class MasterDurationUseComponent {
|
|||
this.fetchData();
|
||||
});
|
||||
}
|
||||
}
|
||||
// this.monitoringApiService
|
||||
// .postHeaderDetailParam(result)
|
||||
// .subscribe((res) => {
|
||||
// console.log(res);
|
||||
// this.fetchData();
|
||||
// });
|
||||
}
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
|
@ -118,6 +135,12 @@ export class MasterDurationUseComponent {
|
|||
(result) => {
|
||||
console.log(result);
|
||||
if (result) {
|
||||
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) => {
|
||||
|
@ -125,6 +148,15 @@ export class MasterDurationUseComponent {
|
|||
this.fetchData();
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (result) {
|
||||
// this.monitoringApiService
|
||||
// .putHeaderDetailParam(result, row.id)
|
||||
// .subscribe((res) => {
|
||||
// console.log(res);
|
||||
// this.fetchData();
|
||||
// });
|
||||
// }
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
|
|
|
@ -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-floor',
|
||||
|
@ -24,7 +25,8 @@ export class MasterFloorComponent {
|
|||
private modalService: NgbModal,
|
||||
private router: Router,
|
||||
private monitoringApiService: BuildingService,
|
||||
private authService: LoginService
|
||||
private authService: LoginService,
|
||||
private toastr: ToastrService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -90,6 +92,12 @@ export class MasterFloorComponent {
|
|||
(result) => {
|
||||
console.log(result);
|
||||
if (result) {
|
||||
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) => {
|
||||
|
@ -97,6 +105,15 @@ export class MasterFloorComponent {
|
|||
this.fetchData();
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (result) {
|
||||
// this.monitoringApiService
|
||||
// .postHeaderDetailParam(result)
|
||||
// .subscribe((res) => {
|
||||
// console.log(res);
|
||||
// this.fetchData();
|
||||
// });
|
||||
// }
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
|
@ -118,6 +135,12 @@ export class MasterFloorComponent {
|
|||
(result) => {
|
||||
console.log(result);
|
||||
if (result) {
|
||||
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) => {
|
||||
|
@ -125,6 +148,15 @@ export class MasterFloorComponent {
|
|||
this.fetchData();
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (result) {
|
||||
// this.monitoringApiService
|
||||
// .putHeaderDetailParam(result, row.id)
|
||||
// .subscribe((res) => {
|
||||
// console.log(res);
|
||||
// this.fetchData();
|
||||
// });
|
||||
// }
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
|
|
|
@ -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,6 +92,12 @@ export class MasterRoleComponent {
|
|||
(result) => {
|
||||
console.log(result);
|
||||
if (result) {
|
||||
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) => {
|
||||
|
@ -97,6 +105,15 @@ export class MasterRoleComponent {
|
|||
this.fetchData();
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (result) {
|
||||
// this.monitoringApiService
|
||||
// .postHeaderDetailParam(result)
|
||||
// .subscribe((res) => {
|
||||
// console.log(res);
|
||||
// this.fetchData();
|
||||
// });
|
||||
// }
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
|
@ -118,6 +135,12 @@ export class MasterRoleComponent {
|
|||
(result) => {
|
||||
console.log(result);
|
||||
if (result) {
|
||||
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) => {
|
||||
|
@ -125,6 +148,15 @@ export class MasterRoleComponent {
|
|||
this.fetchData();
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (result) {
|
||||
// this.monitoringApiService
|
||||
// .putHeaderDetailParam(result, row.id)
|
||||
// .subscribe((res) => {
|
||||
// console.log(res);
|
||||
// this.fetchData();
|
||||
// });
|
||||
// }
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
|
|
|
@ -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-room",
|
||||
|
@ -21,7 +22,8 @@ export class MasterRoomComponent {
|
|||
constructor(
|
||||
private modalService: NgbModal,
|
||||
private monitoringApiService: BuildingService,
|
||||
private authService: LoginService
|
||||
private authService: LoginService,
|
||||
private toastr: ToastrService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
|
|
@ -5,6 +5,7 @@ import { TableApiService } from 'src/app/_services/table-api.service';
|
|||
import { BuildingService } from '../../service/monitoring-api.service';
|
||||
import { AddEditMasterComponent } from '../add-edit-master/add-edit-master.component';
|
||||
import { LoginService } from '../../service/login.service';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
|
||||
@Component({
|
||||
selector: 'app-master-status',
|
||||
|
@ -24,7 +25,8 @@ export class MasterStatusComponent {
|
|||
private modalService: NgbModal,
|
||||
private router: Router,
|
||||
private monitoringApiService: BuildingService,
|
||||
private authService: LoginService
|
||||
private authService: LoginService,
|
||||
private toastr: ToastrService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -90,6 +92,12 @@ export class MasterStatusComponent {
|
|||
(result) => {
|
||||
console.log(result);
|
||||
if (result) {
|
||||
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) => {
|
||||
|
@ -97,6 +105,15 @@ export class MasterStatusComponent {
|
|||
this.fetchData();
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (result) {
|
||||
// this.monitoringApiService
|
||||
// .postHeaderDetailParam(result)
|
||||
// .subscribe((res) => {
|
||||
// console.log(res);
|
||||
// this.fetchData();
|
||||
// });
|
||||
// }
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
|
@ -118,6 +135,12 @@ export class MasterStatusComponent {
|
|||
(result) => {
|
||||
console.log(result);
|
||||
if (result) {
|
||||
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) => {
|
||||
|
@ -125,6 +148,15 @@ export class MasterStatusComponent {
|
|||
this.fetchData();
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (result) {
|
||||
// this.monitoringApiService
|
||||
// .putHeaderDetailParam(result, row.id)
|
||||
// .subscribe((res) => {
|
||||
// console.log(res);
|
||||
// this.fetchData();
|
||||
// });
|
||||
// }
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
|
|
|
@ -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-type',
|
||||
|
@ -24,7 +25,8 @@ export class MasterTypeComponent {
|
|||
private modalService: NgbModal,
|
||||
private router: Router,
|
||||
private monitoringApiService: BuildingService,
|
||||
private authService: LoginService
|
||||
private authService: LoginService,
|
||||
private toastr: ToastrService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -88,8 +90,13 @@ export class MasterTypeComponent {
|
|||
modalRef.componentInstance.mode = "add";
|
||||
modalRef.result.then(
|
||||
(result) => {
|
||||
console.log(result);
|
||||
if (result) {
|
||||
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) => {
|
||||
|
@ -97,6 +104,15 @@ export class MasterTypeComponent {
|
|||
this.fetchData();
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (result) {
|
||||
// this.monitoringApiService
|
||||
// .postHeaderDetailParam(result)
|
||||
// .subscribe((res) => {
|
||||
// console.log(res);
|
||||
// this.fetchData();
|
||||
// });
|
||||
// }
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
|
@ -116,8 +132,13 @@ export class MasterTypeComponent {
|
|||
modalRef.componentInstance.mode = "edit";
|
||||
modalRef.result.then(
|
||||
(result) => {
|
||||
console.log(result);
|
||||
if (result) {
|
||||
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) => {
|
||||
|
@ -125,6 +146,15 @@ export class MasterTypeComponent {
|
|||
this.fetchData();
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (result) {
|
||||
// this.monitoringApiService
|
||||
// .putHeaderDetailParam(result, row.id)
|
||||
// .subscribe((res) => {
|
||||
// console.log(res);
|
||||
// this.fetchData();
|
||||
// });
|
||||
// }
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
|
|
|
@ -125,14 +125,21 @@ export class MasterVoltageComponent {
|
|||
modalRef.result.then(
|
||||
(result) => {
|
||||
console.log(result);
|
||||
// if (result) {
|
||||
// this.monitoringApiService
|
||||
// .putHeaderDetailParam(result, row.id)
|
||||
// .subscribe((res) => {
|
||||
// console.log(res);
|
||||
// this.fetchData();
|
||||
// });
|
||||
// }
|
||||
if (result) {
|
||||
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();
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
(reason) => {
|
||||
console.log(`Dismissed: ${reason}`);
|
||||
|
|
|
@ -138,7 +138,7 @@
|
|||
<p
|
||||
class="card-subtitle line-on-side text-muted text-center font-small-3 mx-2 my-1"
|
||||
>
|
||||
<span>(v@2024.07.11.03)</span>
|
||||
<span>(v@2024.07.12.01)</span>
|
||||
</p>
|
||||
<!-- <div class="card-body">
|
||||
<a
|
||||
|
|
Loading…
Reference in New Issue