From 4630bd226572242b0b43d84e4a192b991992c673 Mon Sep 17 00:00:00 2001 From: Fuzi_fauzia Date: Wed, 26 Jun 2024 11:26:02 +0700 Subject: [PATCH] penambahan button new device --- .../header/vertical/vertical.component.html | 6 +- .../_layout/settings/menu-settings.config.ts | 1432 ++++++++--------- src/app/app.routing.ts | 4 + .../hemat-app/device/device.component.html | 61 +- .../hemat-app/device/device.component.ts | 39 +- .../user-profile/user-profile.component.css | 4 + .../user-profile/user-profile.component.html | 12 + .../user-profile.component.spec.ts | 23 + .../user-profile/user-profile.component.ts | 10 + .../user-profile/user-profile.module.ts | 24 + 10 files changed, 886 insertions(+), 729 deletions(-) create mode 100644 src/app/content/hemat-app/user-profile/user-profile.component.css create mode 100644 src/app/content/hemat-app/user-profile/user-profile.component.html create mode 100644 src/app/content/hemat-app/user-profile/user-profile.component.spec.ts create mode 100644 src/app/content/hemat-app/user-profile/user-profile.component.ts create mode 100644 src/app/content/hemat-app/user-profile/user-profile.module.ts diff --git a/src/app/_layout/header/vertical/vertical.component.html b/src/app/_layout/header/vertical/vertical.component.html index 454c580..0a9d62b 100644 --- a/src/app/_layout/header/vertical/vertical.component.html +++ b/src/app/_layout/header/vertical/vertical.component.html @@ -340,10 +340,10 @@ class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownProfileMenu" > - Edit Profile - My Inbox Chats - + --> Logout import('../app/content/hemat-app/master/master.module').then(m => m.MasterModule) , canActivate: [AuthGuard] }, + { + path: 'user-profil', loadChildren: () => import('../app/content/hemat-app/user-profile/user-profile.module').then(m => m.UserProfileModule) + , canActivate: [AuthGuard] + }, { path: 'dashboard', loadChildren: () => import('../app/content/dashboard/dashboard.module').then(m => m.DashboardModule) , canActivate: [AuthGuard] diff --git a/src/app/content/hemat-app/device/device.component.html b/src/app/content/hemat-app/device/device.component.html index bd976a8..7a8cfc9 100644 --- a/src/app/content/hemat-app/device/device.component.html +++ b/src/app/content/hemat-app/device/device.component.html @@ -43,10 +43,7 @@
-
+
@@ -80,10 +77,7 @@
-
+
@@ -132,6 +126,7 @@ class="select-custom" [items]="dataBuildingList" [searchable]="true" + [disabled]="newDeviceActive" bindLabel="name" bindValue="id" placeholder="Select Building" @@ -146,6 +141,7 @@ class="select-custom" [items]="dataMasterCategori" [searchable]="true" + [disabled]="newDeviceActive" bindLabel="name" bindValue="id" placeholder="Select Category" @@ -160,6 +156,7 @@ class="select-custom" [items]="dataMasterStatus" [searchable]="true" + [disabled]="newDeviceActive" bindLabel="name" bindValue="id" placeholder="Select Status" @@ -179,7 +176,7 @@ border-color: #ffffff !important; border-radius: 12px; " - [disabled]="spinnerFilterActive" + [disabled]="spinnerFilterActive || newDeviceActive" > Export
+
+ + +
diff --git a/src/app/content/hemat-app/device/device.component.ts b/src/app/content/hemat-app/device/device.component.ts index 4500849..baf91c3 100644 --- a/src/app/content/hemat-app/device/device.component.ts +++ b/src/app/content/hemat-app/device/device.component.ts @@ -35,7 +35,9 @@ export class DeviceComponent implements OnInit { public breadcrumb: any; spinnerActive: boolean = false; spinnerExportActive: boolean = false; - + spinnerNewDeviceActive: boolean = false; + newDeviceActive: boolean = false; + singlebasicSelected: any; constructor( @@ -64,6 +66,10 @@ export class DeviceComponent implements OnInit { }; this.storedData = JSON.parse(localStorage.getItem("currentUser")); this.buildingSelected = this.storedData.buildingId; + + if (this.newDeviceActive === true) { + + } this.fetchData( this.buildingSelected, this.categorySelected, @@ -74,6 +80,8 @@ export class DeviceComponent implements OnInit { } fetchData(buildingSelected, categorySelected, statusSelected) { + this.newDeviceActive = false; + this.buildingSelected = buildingSelected; this.deviceService .getDeviceData(buildingSelected, categorySelected, statusSelected) .subscribe((res) => { @@ -99,6 +107,35 @@ export class DeviceComponent implements OnInit { }); } + newDevice() { + this.spinnerNewDeviceActive = true; + this.newDeviceActive = true; + this.deviceService.getDeviceData(0, 0, 0).subscribe((res) => { + this.data = res; + this.filteredRows = this.data.results.data; + this.spinnerNewDeviceActive = false; + this.data_device = this.filteredRows.map((item) => ({ + buildingName: item.building_name, + id: item.id, + name: item.name, + icon: item.icon, + watt: item.watt, + categoryName: item.category_name, + typeName: item.type_name, + voltageName: item.voltage_name, + statusName: item.status_name, + })); + }); + } + + allDevice(){ + this.fetchData( + this.buildingSelected, + this.categorySelected, + this.statusSelected + ); + } + dataListMaster() { this.monitoringApiService.getMasterListData().subscribe((data) => { const dataCategory = data.data.find( diff --git a/src/app/content/hemat-app/user-profile/user-profile.component.css b/src/app/content/hemat-app/user-profile/user-profile.component.css new file mode 100644 index 0000000..cef2f54 --- /dev/null +++ b/src/app/content/hemat-app/user-profile/user-profile.component.css @@ -0,0 +1,4 @@ +:host ::ng-deep .nav.nav-tabs .nav-item .nav-link { + padding: 1.5rem 0.7rem !important; + display: inline-flex; +} \ No newline at end of file diff --git a/src/app/content/hemat-app/user-profile/user-profile.component.html b/src/app/content/hemat-app/user-profile/user-profile.component.html new file mode 100644 index 0000000..811879e --- /dev/null +++ b/src/app/content/hemat-app/user-profile/user-profile.component.html @@ -0,0 +1,12 @@ +
+
+
+ +
+
+
+ +
+
+
+
diff --git a/src/app/content/hemat-app/user-profile/user-profile.component.spec.ts b/src/app/content/hemat-app/user-profile/user-profile.component.spec.ts new file mode 100644 index 0000000..f4ff0ad --- /dev/null +++ b/src/app/content/hemat-app/user-profile/user-profile.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UserProfileComponent } from './user-profile.component'; + +describe('UserProfileComponent', () => { + let component: UserProfileComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ UserProfileComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(UserProfileComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/content/hemat-app/user-profile/user-profile.component.ts b/src/app/content/hemat-app/user-profile/user-profile.component.ts new file mode 100644 index 0000000..49f8d71 --- /dev/null +++ b/src/app/content/hemat-app/user-profile/user-profile.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-user-profile', + templateUrl: './user-profile.component.html', + styleUrls: ['./user-profile.component.css'] +}) +export class UserProfileComponent { + public breadcrumb: any; +} diff --git a/src/app/content/hemat-app/user-profile/user-profile.module.ts b/src/app/content/hemat-app/user-profile/user-profile.module.ts new file mode 100644 index 0000000..b1265ff --- /dev/null +++ b/src/app/content/hemat-app/user-profile/user-profile.module.ts @@ -0,0 +1,24 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { UserProfileComponent } from './user-profile.component'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { BreadcrumbModule } from 'src/app/_layout/breadcrumb/breadcrumb.module'; +import { RouterModule } from '@angular/router'; + + + +@NgModule({ + declarations: [UserProfileComponent], + imports: [ + CommonModule, + NgbModule, + BreadcrumbModule, + RouterModule.forChild([ + { + path: '', + component: UserProfileComponent + }, + ]) + ] +}) +export class UserProfileModule { }