perbaikan master

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

View File

@ -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>

View File

@ -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}$/)]],
});
}

View File

@ -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) {
this.monitoringApiService
.postMasterBuildingParam(result)
.subscribe((res) => {
this.fetchData();
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) {
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
.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}`);

View File

@ -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) {
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) => {
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,
});
}
);
.subscribe((res) => {
console.log(res);
this.fetchData();
});
}
}
// 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}`);

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-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,12 +92,27 @@ export class MasterDurationUseComponent {
(result) => {
console.log(result);
if (result) {
this.monitoringApiService
.postHeaderDetailParam(result)
.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
.postHeaderDetailParam(result)
.subscribe((res) => {
console.log(res);
this.fetchData();
});
}
}
// this.monitoringApiService
// .postHeaderDetailParam(result)
// .subscribe((res) => {
// console.log(res);
// this.fetchData();
// });
}
},
(reason) => {
@ -118,13 +135,28 @@ export class MasterDurationUseComponent {
(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}`);

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-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,13 +92,28 @@ export class MasterFloorComponent {
(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 MasterFloorComponent {
(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}`);

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

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-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() {

View File

@ -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,13 +92,28 @@ export class MasterStatusComponent {
(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 MasterStatusComponent {
(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}`);

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-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,15 +90,29 @@ export class MasterTypeComponent {
modalRef.componentInstance.mode = "add";
modalRef.result.then(
(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}`);
@ -116,15 +132,29 @@ export class MasterTypeComponent {
modalRef.componentInstance.mode = "edit";
modalRef.result.then(
(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}`);

View File

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

View File

@ -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