Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions apps/assistant-panel/src/app/bootstrap.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ const SYS_ID_KEY = 'PLACEOS.ASSISTANT.system';
<div class="absolute inset-0 bg-base-200 z-0"></div>
<div
class="relative bg-base-100 mx-auto my-8 border border-base-300 rounded-lg w-[28rem] z-10 overflow-hidden"
>
>
<header
class="px-4 py-3 bg-secondary text-secondary-content text-xl font-medium flex items-center justify-between w-full"
>
<div>Assistant Panel</div>
<div class="px-2 py-1 rounded text-sm font-mono">SETUP</div>
</header>
<main class="p-4 w-full flex flex-col space-y-2" *ngIf="!loading; else load_state">
<label for="system-id" i18n="@@systemLabel">
<main
class="p-4 w-full flex flex-col space-y-2"
*ngIf="!loading; else load_state"
>
<label for="system-id">
{{ 'PANEL.BOOTSTRAP_LABEL' | translate }}
</label>
<mat-form-field
appearance="outline"
class="w-full"
>
<mat-form-field appearance="outline" class="w-full">
<input
matInput
[ngModel]="system_id$ | async"
Expand Down Expand Up @@ -66,13 +66,14 @@ const SYS_ID_KEY = 'PLACEOS.ASSISTANT.system';
!(space_list | async)?.length
"
>
{{
'PANEL.BOOTSTRAP_INPUT_PLACEHOLDER' | translate
}}
{{ 'PANEL.BOOTSTRAP_INPUT_PLACEHOLDER' | translate }}
</mat-option>
</mat-autocomplete>
</main>
<footer class="w-full px-4 py-2 flex items-center justify-end border-t border-base-300" *ngIf="!loading">
<footer
class="w-full px-4 py-2 flex items-center justify-end border-t border-base-300"
*ngIf="!loading"
>
<button
btn
matRipple
Expand Down Expand Up @@ -114,13 +115,13 @@ export class BootstrapComponent extends AsyncHandler {
});
}),
map((_) => _.data.map((_) => new Space(_ as any))),
shareReplay(1)
shareReplay(1),
);

constructor(
private _org: OrganisationService,
private _router: Router,
private _route: ActivatedRoute
private _route: ActivatedRoute,
) {
super();
}
Expand All @@ -134,11 +135,11 @@ export class BootstrapComponent extends AsyncHandler {
}
if (params.has('system_id') || params.has('sys_id')) {
this.system_id$.next(
params.get('system_id') || params.get('sys_id')
params.get('system_id') || params.get('sys_id'),
);
this.bootstrap();
}
})
}),
);
this.checkBootstrapped();
}
Expand Down
33 changes: 12 additions & 21 deletions apps/concierge/src/app/building-manager/building-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ import { addZone, authority, updateZone } from '@placeos/ts-client';
class="flex flex-col"
*ngIf="(region_list | async)?.length"
>
<label for="region" i18n="@@displayNameLabel">
Region:
</label>
<label for="region"> Region: </label>
<mat-form-field appearance="outline">
<mat-select
name="region"
Expand All @@ -52,9 +50,7 @@ import { addZone, authority, updateZone } from '@placeos/ts-client';
</mat-form-field>
</div>
<div class="flex flex-col">
<label for="display-name" i18n="@@displayNameLabel">
Display Name:
</label>
<label for="display-name"> Display Name: </label>
<mat-form-field appearance="outline">
<input
matInput
Expand All @@ -65,9 +61,7 @@ import { addZone, authority, updateZone } from '@placeos/ts-client';
</mat-form-field>
</div>
<div class="flex flex-col">
<label for="display-name" i18n="@@displayNameLabel">
Timezone:
</label>
<label for="display-name"> Timezone: </label>
<mat-form-field appearance="outline">
<app-icon matPrefix class="text-2xl">search</app-icon>
<input
Expand All @@ -89,9 +83,7 @@ import { addZone, authority, updateZone } from '@placeos/ts-client';
</mat-autocomplete>
</div>
<div class="flex flex-col">
<label for="address" i18n="@@displayNameLabel">
Location:
</label>
<label for="address"> Location: </label>
<mat-form-field appearance="outline">
<input
matInput
Expand Down Expand Up @@ -130,7 +122,7 @@ export class BuildingFormComponent extends AsyncHandler {
]),
display_name: new FormControl('', [Validators.required]),
timezone: new FormControl(
Intl?.DateTimeFormat()?.resolvedOptions()?.timeZone || ''
Intl?.DateTimeFormat()?.resolvedOptions()?.timeZone || '',
),
location: new FormControl(''),
});
Expand All @@ -147,7 +139,7 @@ export class BuildingFormComponent extends AsyncHandler {
this._updateTimezoneList();
this.subscription(
'tz-change',
this.form.valueChanges.subscribe(() => this._updateTimezoneList())
this.form.valueChanges.subscribe(() => this._updateTimezoneList()),
);
if (this.building) this.form.patchValue(this.building);
}
Expand All @@ -166,8 +158,8 @@ export class BuildingFormComponent extends AsyncHandler {
if (!this.form.valid) {
return notifyError(
`Some form fields are invalid. [${getInvalidFields(
this.form
).join(', ')}]`
this.form,
).join(', ')}]`,
);
}
const data = this.form.getRawValue();
Expand All @@ -178,14 +170,13 @@ export class BuildingFormComponent extends AsyncHandler {
tags: ['building'],
name: `BLD ${authority().description} ${data.display_name}`,
};
const building = await (data.id
? updateZone(data.id, body)
: addZone(body)
const building = await (
data.id ? updateZone(data.id, body) : addZone(body)
)
.toPromise()
.catch((e) => {
notifyError(
`Error saving building: ${e.message || e.error || e}`
`Error saving building: ${e.message || e.error || e}`,
);
this.loading = false;
this.loadingChange.emit(false);
Expand All @@ -201,7 +192,7 @@ export class BuildingFormComponent extends AsyncHandler {
const timezone = this.form?.value?.timezone || '';
this.timezones = TIMEZONES_IANA;
this.filtered_timezones = this.timezones.filter((_) =>
_.toLowerCase().includes(timezone.toLowerCase())
_.toLowerCase().includes(timezone.toLowerCase()),
);
}
}
4 changes: 1 addition & 3 deletions apps/concierge/src/app/events/event-manage.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ const EMPTY = [];
</div>
</div>
<div class="flex flex-col">
<label for="display-name" i18n="@@displayNameLabel">
Timezone:
</label>
<label for="display-name"> Timezone: </label>
<mat-form-field appearance="outline">
<app-icon matPrefix class="text-2xl">
search
Expand Down
34 changes: 16 additions & 18 deletions apps/concierge/src/app/level-manager/level-modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { addZone, authority, updateZone } from '@placeos/ts-client';
form.controls.parent_id.invalid &&
form.controls.parent_id.touched
"
i18n="@@zoneLabel"
>
Building<span>*</span>:
</label>
Expand All @@ -51,9 +50,7 @@ import { addZone, authority, updateZone } from '@placeos/ts-client';
</mat-form-field>
</div>
<div class="flex flex-col" *ngIf="form.controls.display_name">
<label for="display-name" i18n="@@displayNameLabel">
Display Name:
</label>
<label for="display-name"> Display Name: </label>
<mat-form-field appearance="outline">
<input
matInput
Expand All @@ -65,7 +62,7 @@ import { addZone, authority, updateZone } from '@placeos/ts-client';
</mat-form-field>
</div>
<div class="flex flex-col" *ngIf="form.controls.map_id">
<label for="map-id" i18n="@@mapIdLabel"> Map URL: </label>
<label for="map-id"> Map URL: </label>
<mat-form-field appearance="outline">
<input
matInput
Expand Down Expand Up @@ -114,36 +111,37 @@ export class LevelModalComponent {
Validators.required,
]),
parking: new FormControl(
this._data?.tags?.includes('parking') || false
this._data?.tags?.includes('parking') || false,
),
});

constructor(
private _org: OrganisationService,
@Inject(MAT_DIALOG_DATA) private _data: BuildingLevel | undefined,
private _dialog_ref: MatDialogRef<LevelModalComponent>
private _dialog_ref: MatDialogRef<LevelModalComponent>,
) {}

public async save() {
if (!this.form.valid) {
return notifyError(
`Some form fields are invalid. [${getInvalidFields(
this.form
).join(', ')}]`
this.form,
).join(', ')}]`,
);
}
this.loading = true;
const data: any = this.form.getRawValue();
data.tags = data.parking ? ['level', 'parking'] : ['level'];
const resp = await (data.id
? updateZone(data.id, {
...data,
name: `LEVEL ${authority().description} ${data.display_name}`,
})
: addZone({
...data,
name: `LEVEL ${authority().description} ${data.display_name}`,
})
const resp = await (
data.id
? updateZone(data.id, {
...data,
name: `LEVEL ${authority().description} ${data.display_name}`,
})
: addZone({
...data,
name: `LEVEL ${authority().description} ${data.display_name}`,
})
)
.toPromise()
.catch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,7 @@ import { ParkingUser } from './parking-state.service';
></textarea>
</mat-form-field>
<div class="px-2 pb-2">
<mat-checkbox
name="deny"
formControlName="deny"
i18n="@@deny"
>
<mat-checkbox name="deny" formControlName="deny">
Deny User Parking Access
</mat-checkbox>
</div>
Expand Down
16 changes: 4 additions & 12 deletions apps/concierge/src/app/poi-manager/poi-modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ import { SelectPOIMapModalComponent } from './select-poi-map-modal.component';
[formGroup]="form"
>
<div class="flex flex-col" *ngIf="form.controls.name">
<label for="name" i18n="@@nameLabel">
Name<span>*</span>:
</label>
<label for="name"> Name<span>*</span>: </label>
<mat-form-field appearance="outline">
<input
matInput
Expand All @@ -57,9 +55,7 @@ import { SelectPOIMapModalComponent } from './select-poi-map-modal.component';
class="flex flex-col"
*ngIf="(building_list | async)?.length > 1"
>
<label for="name" i18n="@@nameLabel">
Building<span>*</span>:
</label>
<label for="name"> Building<span>*</span>: </label>
<mat-form-field appearance="outline">
<mat-select
[(ngModel)]="building"
Expand All @@ -76,9 +72,7 @@ import { SelectPOIMapModalComponent } from './select-poi-map-modal.component';
</mat-form-field>
</div>
<div class="flex flex-col" *ngIf="form.controls.level_id">
<label for="name" i18n="@@nameLabel">
Level<span>*</span>:
</label>
<label for="name"> Level<span>*</span>: </label>
<mat-form-field appearance="outline">
<mat-select
formControlName="level_id"
Expand All @@ -94,9 +88,7 @@ import { SelectPOIMapModalComponent } from './select-poi-map-modal.component';
</mat-form-field>
</div>
<div class="flex flex-col">
<label for="name" i18n="@@nameLabel">
Location<span>*</span>:
</label>
<label for="name"> Location<span>*</span>: </label>
<mat-form-field appearance="outline">
<mat-select
[(ngModel)]="location_type"
Expand Down
Loading
Loading