Skip to content

Commit

Permalink
Merge branch 'feat/hide-audit-details'
Browse files Browse the repository at this point in the history
  • Loading branch information
Clashsoft committed Sep 4, 2024
2 parents 079fa5a + 6eb0062 commit c3363ce
Show file tree
Hide file tree
Showing 8 changed files with 3,262 additions and 3,916 deletions.
64 changes: 32 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,48 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^17.3.1",
"@angular/cdk": "^17.3.1",
"@angular/common": "^17.3.1",
"@angular/compiler": "^17.3.1",
"@angular/core": "^17.3.1",
"@angular/forms": "^17.3.1",
"@angular/localize": "^17.3.1",
"@angular/material": "^17.3.1",
"@angular/platform-browser": "^17.3.1",
"@angular/platform-browser-dynamic": "^17.3.1",
"@angular/router": "^17.3.1",
"@angular/service-worker": "^17.3.1",
"@babel/runtime": "^7.24.1",
"@angular/animations": "^18.2.3",
"@angular/cdk": "^18.2.2",
"@angular/common": "^18.2.3",
"@angular/compiler": "^18.2.3",
"@angular/core": "^18.2.3",
"@angular/forms": "^18.2.3",
"@angular/localize": "^18.2.3",
"@angular/material": "^18.2.2",
"@angular/platform-browser": "^18.2.3",
"@angular/platform-browser-dynamic": "^18.2.3",
"@angular/router": "^18.2.3",
"@angular/service-worker": "^18.2.3",
"@babel/runtime": "^7.25.6",
"@mean-stream/ngbx": "^0.13.0",
"@ng-bootstrap/ng-bootstrap": "^16.0.0",
"@ng-bootstrap/ng-bootstrap": "^17.0.1",
"@popperjs/core": "^2.11.8",
"bootstrap": "^5.3.3",
"bootstrap-icons": "^1.11.3",
"class-validator": "^0.14.1",
"libphonenumber-js": "^1.10.58",
"libphonenumber-js": "^1.11.7",
"reflect-metadata": "^0.1.14",
"rxjs": "~7.8.1",
"tslib": "^2.6.2",
"validator": "^13.11.0",
"zone.js": "~0.14.4"
"tslib": "^2.7.0",
"validator": "^13.12.0",
"zone.js": "~0.14.10"
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.3.1",
"@angular-eslint/builder": "~17.2.1",
"@angular-eslint/eslint-plugin": "~17.2.1",
"@angular-eslint/eslint-plugin-template": "~17.2.1",
"@angular-eslint/schematics": "~17.2.1",
"@angular-eslint/template-parser": "~17.2.1",
"@angular/cli": "^17.3.1",
"@angular/compiler-cli": "^17.3.1",
"@angular-devkit/build-angular": "^18.2.2",
"@angular-eslint/builder": "~18.3.0",
"@angular-eslint/eslint-plugin": "~18.3.0",
"@angular-eslint/eslint-plugin-template": "~18.3.0",
"@angular-eslint/schematics": "~18.3.0",
"@angular-eslint/template-parser": "~18.3.0",
"@angular/cli": "^18.2.2",
"@angular/compiler-cli": "^18.2.3",
"@types/jasmine": "~3.6.11",
"@types/jasminewd2": "~2.0.13",
"@types/node": "^20.11.30",
"@types/node": "^20.16.4",
"@types/uuid": "^9.0.8",
"@types/validator": "^13.11.9",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@types/validator": "^13.12.1",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"eslint": "^8.57.0",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~5.0.2",
Expand All @@ -61,8 +61,8 @@
"karma-jasmine": "~4.0.2",
"karma-jasmine-html-reporter": "^1.7.0",
"ts-node": "^10.9.2",
"typescript": "~5.3.3",
"undici-types": "^6.10.0"
"typescript": "~5.5.4",
"undici-types": "^6.19.8"
},
"resolutions": {
"webpack-dev-middleware": "^6.1.2"
Expand Down
7,081 changes: 3,207 additions & 3,874 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http';
import {HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi} from '@angular/common/http';
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {ServiceWorkerModule} from '@angular/service-worker';
Expand All @@ -23,7 +23,6 @@ import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
imports: [
BrowserModule,
BrowserAnimationsModule,
HttpClientModule,
AppRoutingModule,
SharedModule,
ServiceWorkerModule.register('ngsw-worker.js', {
Expand All @@ -47,6 +46,7 @@ import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
multi: true,
useClass: ErrorInterceptor,
},
provideHttpClient(withInterceptorsFromDi()),
],
bootstrap: [AppComponent],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class FeatureCardComponent implements OnInit {
}

@Input()
set percentageQuery(query: PercentageQuery) {
set percentageQuery(query: PercentageQuery | undefined) {
this.percentageQuery$.next(query);
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/shared/services/audit-zone.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export class AuditZoneService {
constructor(private http: HttpClient,
) { }

getSingleZone(zoneId: number): Observable<any> {
return this.http.get(`${this.rootUrl}api/auditZone?zoneId=${zoneId}`);
getSingleZone(zoneId: number): Observable<{ data: Zone }> {
return this.http.get<{ data: Zone }>(`${this.rootUrl}api/auditZone?zoneId=${zoneId}`);
}
getAllAuditZone(auditId: number): Observable<{ data: Zone[] }> {
return this.http.get<{ data: Zone[] }>(`${this.rootUrl}api/auditZone?auditId=${auditId}`);
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {map, Observable} from 'rxjs';
import {environment} from 'src/environments/environment.prod';
import {User} from "../model/user.interface";
import {User} from '../model/user.interface';

@Injectable({
providedIn: 'root'
Expand Down
4 changes: 3 additions & 1 deletion src/app/zone/zone/zone-detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ <h1>
</div>
</div>
<div class="container">
@let buildingTotalArea = audit?.pre_audit_form?.data?.['area_building_total_area'] === 'Yes';
<app-feature-card
title="Zone Details"
[subtitle]="buildingTotalArea ? 'Not Required (Building Total Area in Pre Audit is enabled)' : undefined"
routerLink="details"
[percentageQuery]="{percentageType: 'zoneDetails', auditId: route.snapshot.params.aid, zoneId: route.snapshot.params.zid}"
[percentageQuery]="buildingTotalArea ? undefined : {percentageType: 'zoneDetails', auditId: route.snapshot.params.aid, zoneId: route.snapshot.params.zid}"
></app-feature-card>
<hr/>
@for (equipment of equipments; track equipment) {
Expand Down
17 changes: 14 additions & 3 deletions src/app/zone/zone/zone-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ import {AuditService} from 'src/app/shared/services/audit.service';
import {EquipmentService} from 'src/app/shared/services/equipment.service';
import {PercentageCompletion} from '../../shared/model/percentage-completion.interface';
import {EquipmentCategory} from '../../shared/model/equipment.interface';
import {Audit} from '../../shared/model/audit.interface';
import {Zone} from '../../shared/model/zone.interface';

@Component({
selector: 'app-zone-detail',
templateUrl: './zone-detail.component.html',
styleUrls: ['./zone-detail.component.scss'],
})
export class ZoneDetailComponent implements OnInit {

zone: any;
audit?: Audit;
zone?: Zone;
equipments: EquipmentCategory[] = [];
progress?: PercentageCompletion;

Expand All @@ -30,6 +32,12 @@ export class ZoneDetailComponent implements OnInit {
}

ngOnInit(): void {
this.route.params.pipe(
switchMap(({aid}) => this.auditService.getSingleAudit(aid)),
).subscribe(({data}) => {
this.audit = data;
});

this.route.params.pipe(
switchMap(({zid}) => this.auditZoneService.getSingleZone(zid)),
).subscribe(res => {
Expand All @@ -49,12 +57,15 @@ export class ZoneDetailComponent implements OnInit {
}

rename() {
if (!this.zone) {
return;
}
const name = prompt('Rename Zone', this.zone.zoneName);
if (!name) {
return;
}
this.zoneService.updateAuditZone({...this.zone, zoneName: name}, this.zone.zoneId).subscribe(() => {
this.zone.zoneName = name;
this.zone!.zoneName = name;
this.toastService.success('Rename Zone', 'Successfully renamed zone.');
});
}
Expand Down

0 comments on commit c3363ce

Please sign in to comment.