penambahan logic pada cctv

This commit is contained in:
2024-06-25 14:45:11 +07:00
parent 873e24a6ac
commit e27493171e
5 changed files with 143 additions and 36 deletions

View File

@@ -16,6 +16,7 @@ export class ModalAddActualComponent {
dateCurrent: any;
dataCost: any;
formattedDate: any;
formattedDate2: any;
buildingName: any;
constructor(
@@ -29,16 +30,14 @@ export class ModalAddActualComponent {
ngOnInit() {
const currentDate = new Date();
this.dateCurrent = currentDate.toISOString().slice(0, 7);
this.datalistcost();
this.dateFormat();
this.getBuildingById();
this.datalistcost();
}
dateFormat() {
let year = this.periode.slice(0, 4);
let month = this.periode.slice(5);
// Ubah format bulan ke bahasa Indonesia (opsional)
let month = this.periode.slice(5, 7);
let monthNames = [
"Januari",
"Februari",
@@ -53,10 +52,11 @@ export class ModalAddActualComponent {
"November",
"Desember",
];
let monthName = monthNames[parseInt(month) - 1]; // Menggunakan parseInt karena month dalam format string
// Gabungkan kembali untuk mendapatkan format "Juni 2024"
let monthName = monthNames[parseInt(month) - 1];
this.formattedDate = `${monthName} ${year}`;
this.formattedDate2 = `${year}-${month}`;
}
createForm() {
@@ -73,7 +73,7 @@ export class ModalAddActualComponent {
datalistcost() {
this.costService
.getRealCostByBuildingId(this.buildingId, this.dateCurrent)
.getRealCostByBuildingId(this.buildingId, this.formattedDate2)
.subscribe((data) => {
this.dataCost = data.data[0];
this.myForm.patchValue({