perbaikan master

This commit is contained in:
Fuzi_fauzia 2024-07-26 09:41:23 +07:00
parent a9f3da867f
commit db9a9e415a
4 changed files with 131 additions and 118 deletions

View File

@ -92,7 +92,7 @@ export class CostManagementComponent implements OnInit {
.subscribe((response) => { .subscribe((response) => {
this.data = response.results.data; this.data = response.results.data;
this.filteredRows = this.data; this.filteredRows = this.data;
let kwhData = parseFloat(response.results.kwh) let kwhData = parseFloat(response.results.kwh);
this.kwhTerm = kwhData.toFixed(1); this.kwhTerm = kwhData.toFixed(1);
this.costTerm = response.results.cost; this.costTerm = response.results.cost;
@ -135,8 +135,9 @@ export class CostManagementComponent implements OnInit {
dataListBuilding() { dataListBuilding() {
this.monitoringApiService.getBuildingList().subscribe((data) => { this.monitoringApiService.getBuildingList().subscribe((data) => {
this.dataBuildingList = data.data.filter((item) => item.statusName.toLowerCase() === "aktif"); this.dataBuildingList = data.data.filter(
(item) => item.statusName.toLowerCase() === "aktif"
);
}); });
} }
@ -144,57 +145,44 @@ export class CostManagementComponent implements OnInit {
this.costService.getCompPrevMonthCost(buildingId).subscribe((data) => { this.costService.getCompPrevMonthCost(buildingId).subscribe((data) => {
this.dataCompPrev = data.data; this.dataCompPrev = data.data;
this.chartOption = { this.chartOption = {
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow",
},
formatter: function (params) {
var tar = params[1];
return tar.name + "<br/>" + tar.seriesName + " : " + tar.value;
},
},
grid: { grid: {
left: "25%", left: "25%",
right: "25%", right: "25%",
top: "20%", top: "20%",
bottom: "20%", bottom: "20%",
}, },
// Add tooltip
tooltip: {
trigger: "axis",
enterable: false,
formatter: function (params) {
return `${params[0].name}<br/>${
params[0].seriesName
}: Rp. ${params[0].value.toLocaleString()}`;
},
},
// Add legend
legend: false,
// Add custom colors
color: ["#37A647"], color: ["#37A647"],
xAxis: {
// Horizontal axis
xAxis: [
{
type: "category", type: "category",
splitLine: { show: false },
data: [this.dataCompPrev[0].name, this.dataCompPrev[1].name], data: [this.dataCompPrev[0].name, this.dataCompPrev[1].name],
axisLine: { axisLine: {
show: true, show: true,
lineStyle: { lineStyle: {
color: "#37A647", color: "#37A647",
width: 4, width: 7,
}, },
}, },
axisTick: { axisTick: {
show: false, show: false,
}, },
splitLine: {
show: false,
},
axisLabel: { axisLabel: {
show: false, show: false,
}, },
}, },
],
// Vertical axis yAxis: {
yAxis: [
{
type: "value", type: "value",
axisLine: { axisLine: {
show: false, show: false,
@ -209,14 +197,28 @@ export class CostManagementComponent implements OnInit {
show: false, show: false,
}, },
}, },
],
// Add series
series: [ series: [
{
name: "Placeholder",
type: "bar",
stack: "Total",
itemStyle: {
borderColor: "transparent",
color: "transparent",
},
emphasis: {
itemStyle: {
borderColor: "transparent",
color: "transparent",
},
},
data: [1000, 1000],
},
{ {
name: "Cost", name: "Cost",
type: "bar", type: "bar",
data: [this.dataCompPrev[0].rupiah, this.dataCompPrev[1].rupiah], stack: "Total",
label: { label: {
show: true, show: true,
position: "top", position: "top",
@ -225,7 +227,8 @@ export class CostManagementComponent implements OnInit {
return `Rp. ${params.value.toLocaleString()}`; return `Rp. ${params.value.toLocaleString()}`;
}, },
}, },
barWidth: "50%", // barWidth: "50%",
data: [this.dataCompPrev[0].rupiah, this.dataCompPrev[1].rupiah],
}, },
], ],
}; };
@ -236,57 +239,44 @@ export class CostManagementComponent implements OnInit {
this.costService.getCompActEstCost(buildingId).subscribe((data) => { this.costService.getCompActEstCost(buildingId).subscribe((data) => {
this.dataCompAct = data.data[0]; this.dataCompAct = data.data[0];
this.chartOption2 = { this.chartOption2 = {
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow",
},
formatter: function (params) {
var tar = params[1];
return tar.name + "<br/>" + tar.seriesName + " : " + tar.value;
},
},
grid: { grid: {
left: "25%", left: "25%",
right: "25%", right: "25%",
top: "20%", top: "20%",
bottom: "20%", bottom: "20%",
}, },
// Add tooltip
tooltip: {
trigger: "axis",
enterable: false,
formatter: function (params) {
return `${params[0].name}<br/>${
params[0].seriesName
}: Rp. ${params[0].value.toLocaleString()}`;
},
},
// Add legend
legend: false,
// Add custom colors
color: ["#37A647"], color: ["#37A647"],
xAxis: {
// Horizontal axis
xAxis: [
{
type: "category", type: "category",
splitLine: { show: false },
data: ["Estimation Cost", "Actual Cost"], data: ["Estimation Cost", "Actual Cost"],
axisLine: { axisLine: {
show: true, show: true,
lineStyle: { lineStyle: {
color: "#37A647", color: "#37A647",
width: 4, width: 7,
}, },
}, },
axisTick: { axisTick: {
show: false, show: false,
}, },
splitLine: {
show: false,
},
axisLabel: { axisLabel: {
show: false, show: false,
}, },
}, },
],
// Vertical axis yAxis: {
yAxis: [
{
type: "value", type: "value",
axisLine: { axisLine: {
show: false, show: false,
@ -301,14 +291,28 @@ export class CostManagementComponent implements OnInit {
show: false, show: false,
}, },
}, },
],
// Add series
series: [ series: [
{
name: "Placeholder",
type: "bar",
stack: "Total",
itemStyle: {
borderColor: "transparent",
color: "transparent",
},
emphasis: {
itemStyle: {
borderColor: "transparent",
color: "transparent",
},
},
data: [2500, 2500],
},
{ {
name: "Cost", name: "Cost",
type: "bar", type: "bar",
data: [this.dataCompAct.est_cost, this.dataCompAct.real_cost], stack: "Total",
label: { label: {
show: true, show: true,
position: "top", position: "top",
@ -317,7 +321,8 @@ export class CostManagementComponent implements OnInit {
return `Rp. ${params.value.toLocaleString()}`; return `Rp. ${params.value.toLocaleString()}`;
}, },
}, },
barWidth: "50%", // Adjust bar width // barWidth: "50%",
data: [this.dataCompAct.est_cost, this.dataCompAct.real_cost],
}, },
], ],
}; };

View File

@ -36,6 +36,7 @@
id="code" id="code"
formControlName="code" formControlName="code"
maxlength="10" maxlength="10"
(input)="toUppercase($event)"
/> />
<div <div
*ngIf="myForm.get('code').touched && myForm.get('code').invalid" *ngIf="myForm.get('code').touched && myForm.get('code').invalid"

View File

@ -64,6 +64,12 @@ export class AddEditMasterRoomComponent {
}); });
} }
toUppercase(event: Event) {
const input = event.target as HTMLInputElement;
input.value = input.value.toUpperCase();
this.myForm.get('code').setValue(input.value);
}
listDataStatus() { listDataStatus() {
this.monitoringApiService.getMasterData().subscribe((res) => { this.monitoringApiService.getMasterData().subscribe((res) => {
this.data = res.results.data; this.data = res.results.data;

View File

@ -284,6 +284,7 @@ export class DetailComponent {
legend: {}, legend: {},
toolbox: { toolbox: {
show: true, show: true,
orient: 'vertical',
feature: { feature: {
dataView: { show: true, readOnly: false }, dataView: { show: true, readOnly: false },
magicType: { show: true, type: ['line', 'bar'] }, magicType: { show: true, type: ['line', 'bar'] },