From d8146bbbf0e9f8e074e3243dc041ec571ec30312 Mon Sep 17 00:00:00 2001 From: Adwaith Rao Date: Wed, 24 Nov 2021 18:55:13 +0530 Subject: [PATCH] Rename user selection component --- src/app/app-routing.module.ts | 4 - src/app/app.module.ts | 4 +- src/app/layout/tabs/tabs.component.html | 3 +- .../create-committee.component.html | 20 ----- .../create-committee.component.ts | 66 --------------- .../key-value-holder.component.ts | 10 ++- .../select-entities.component.html | 11 +++ .../select-entities.component.scss} | 0 .../select-entities.component.spec.ts} | 12 +-- .../select-entities.component.ts | 84 +++++++++++++++++++ src/app/widgets/table/table.component.html | 4 +- src/app/widgets/table/table.component.scss | 2 +- 12 files changed, 113 insertions(+), 107 deletions(-) delete mode 100644 src/app/widgets/create-committee/create-committee.component.html delete mode 100644 src/app/widgets/create-committee/create-committee.component.ts create mode 100644 src/app/widgets/select-entities/select-entities.component.html rename src/app/widgets/{create-committee/create-committee.component.scss => select-entities/select-entities.component.scss} (100%) rename src/app/widgets/{create-committee/create-committee.component.spec.ts => select-entities/select-entities.component.spec.ts} (51%) create mode 100644 src/app/widgets/select-entities/select-entities.component.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index f3dfff8..2da967e 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,7 +1,6 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { CheckStatusComponent } from './widgets/check-status/check-status.component'; -import { CreateCommitteeComponent } from './widgets/create-committee/create-committee.component'; import { EServicesComponent } from './pages/e-services/e-services.component'; import { LoginComponent } from './pages/login/login.component'; import { MockComponent } from './widgets/mock/mock.component'; @@ -24,9 +23,6 @@ const routes: Routes = [ }, { path: 'register-business', component: RegisterBusinessComponent, - }, { - path:'create-committee', - component: CreateCommitteeComponent }] }, ]; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 7243e3c..00ab740 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -10,7 +10,7 @@ import { FormsModule } from '@angular/forms'; import { MockComponent } from './widgets/mock/mock.component'; import { EServicesComponent } from './pages/e-services/e-services.component'; import { NotificationsComponent } from './layout/notifications/notifications.component'; -import { CreateCommitteeComponent } from './widgets/create-committee/create-committee.component'; +import { SelectEntitiesComponent } from './widgets/select-entities/select-entities.component'; import { CheckStatusComponent } from './widgets/check-status/check-status.component'; import { TableComponent } from './widgets/table/table.component'; import { KeyValueHolderComponent } from './widgets/key-value-holder/key-value-holder.component'; @@ -25,7 +25,7 @@ import { DownloadButtonComponent } from './widgets/download-button/download-butt MockComponent, EServicesComponent, NotificationsComponent, - CreateCommitteeComponent, + SelectEntitiesComponent, CheckStatusComponent, TableComponent, KeyValueHolderComponent, diff --git a/src/app/layout/tabs/tabs.component.html b/src/app/layout/tabs/tabs.component.html index 4a7319b..41fe192 100644 --- a/src/app/layout/tabs/tabs.component.html +++ b/src/app/layout/tabs/tabs.component.html @@ -5,8 +5,7 @@
diff --git a/src/app/widgets/create-committee/create-committee.component.html b/src/app/widgets/create-committee/create-committee.component.html deleted file mode 100644 index 250be46..0000000 --- a/src/app/widgets/create-committee/create-committee.component.html +++ /dev/null @@ -1,20 +0,0 @@ -
-

Select committe members for panel

-
- - - -
- - -
\ No newline at end of file diff --git a/src/app/widgets/create-committee/create-committee.component.ts b/src/app/widgets/create-committee/create-committee.component.ts deleted file mode 100644 index d123c22..0000000 --- a/src/app/widgets/create-committee/create-committee.component.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-create-committee', - templateUrl: './create-committee.component.html', - styleUrls: ['./create-committee.component.scss'] -}) -export class CreateCommitteeComponent implements OnInit { - committees: Array<{ - name: string; - avatar: string; - designation: string - isActive: boolean, - }> = [{ - name: "Alfred E. Kaplan", - avatar: '../../assets/avatars/1.jpg', - designation: 'Engineer', - isActive: false - }, { - name: "Ernest L. Hall", - avatar: '../../assets/avatars/2.jpg', - designation: 'Investigator', - isActive: false - }, { - name: "Leslie L. Barber", - avatar: '../../assets/avatars/3.jpg', - designation: 'Engineer', - isActive: false - }, { - name: "Todd K. Carrico", - avatar: '../../assets/avatars/4.jpg', - designation: 'Engineer', - isActive: false - }, { - name: "Louise K. Parker", - avatar: '../../assets/avatars/5.jpg', - designation: 'Investigator', - isActive: false - }, { - name: "Jessica R. Folger", - avatar: '../../assets/avatars/6.jpg', - designation: 'Engineer', - isActive: false - }, { - name: "Charles M. Pollard", - avatar: '../../assets/avatars/7.jpg', - designation: 'Engineer', - isActive: false - }, { - name: "David B. Boaz", - avatar: '../../assets/avatars/8.jpg', - designation: 'Investigator', - isActive: false - }, { - name: "Julia R. Bedwell", - avatar: '../../assets/avatars/9.jpg', - designation: 'Engineer', - isActive: false - }] - - constructor() { } - - ngOnInit(): void { - } - -} diff --git a/src/app/widgets/key-value-holder/key-value-holder.component.ts b/src/app/widgets/key-value-holder/key-value-holder.component.ts index ed13b83..2dbad1f 100644 --- a/src/app/widgets/key-value-holder/key-value-holder.component.ts +++ b/src/app/widgets/key-value-holder/key-value-holder.component.ts @@ -1,15 +1,17 @@ import { Component, Input, OnInit } from '@angular/core'; +export interface KeyValue { + key: string, + value: string, +}; + @Component({ selector: 'app-key-value-holder', templateUrl: './key-value-holder.component.html', styleUrls: ['./key-value-holder.component.scss'] }) export class KeyValueHolderComponent implements OnInit { - @Input() keyValues: Array<{ - key: string, - value: string, - }> = []; + @Input() keyValues: Array = []; constructor() { } diff --git a/src/app/widgets/select-entities/select-entities.component.html b/src/app/widgets/select-entities/select-entities.component.html new file mode 100644 index 0000000..8cee590 --- /dev/null +++ b/src/app/widgets/select-entities/select-entities.component.html @@ -0,0 +1,11 @@ +
    +
  • + entity.name +
    +
    {{ entity.name }}
    + {{ entity.subTitle }} +
    + +
  • +
\ No newline at end of file diff --git a/src/app/widgets/create-committee/create-committee.component.scss b/src/app/widgets/select-entities/select-entities.component.scss similarity index 100% rename from src/app/widgets/create-committee/create-committee.component.scss rename to src/app/widgets/select-entities/select-entities.component.scss diff --git a/src/app/widgets/create-committee/create-committee.component.spec.ts b/src/app/widgets/select-entities/select-entities.component.spec.ts similarity index 51% rename from src/app/widgets/create-committee/create-committee.component.spec.ts rename to src/app/widgets/select-entities/select-entities.component.spec.ts index 9f4452b..34f5761 100644 --- a/src/app/widgets/create-committee/create-committee.component.spec.ts +++ b/src/app/widgets/select-entities/select-entities.component.spec.ts @@ -1,20 +1,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CreateCommitteeComponent } from './create-committee.component'; +import { SelectEntitiesComponent } from './select-entities.component'; -describe('CreateCommitteeComponent', () => { - let component: CreateCommitteeComponent; - let fixture: ComponentFixture; +describe('SelectEntitiesComponent', () => { + let component: SelectEntitiesComponent; + let fixture: ComponentFixture; beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ CreateCommitteeComponent ] + declarations: [ SelectEntitiesComponent ] }) .compileComponents(); }); beforeEach(() => { - fixture = TestBed.createComponent(CreateCommitteeComponent); + fixture = TestBed.createComponent(SelectEntitiesComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/widgets/select-entities/select-entities.component.ts b/src/app/widgets/select-entities/select-entities.component.ts new file mode 100644 index 0000000..da6a7f0 --- /dev/null +++ b/src/app/widgets/select-entities/select-entities.component.ts @@ -0,0 +1,84 @@ +import { Component, Input, OnInit } from '@angular/core'; + +export interface SelectableEntity { + id: string|number; + name: string; + avatar: string; + subTitle: string + isSelected: boolean, +}; + +const HARDCODED_USERS: Array = [{ + id: 0, + name: "Alfred E. Kaplan", + avatar: '../../assets/avatars/1.jpg', + subTitle: 'Engineer', + isSelected: false +}, { + id: 0, + name: "Ernest L. Hall", + avatar: '../../assets/avatars/2.jpg', + subTitle: 'Investigator', + isSelected: false +}, { + id: 0, + name: "Leslie L. Barber", + avatar: '../../assets/avatars/3.jpg', + subTitle: 'Engineer', + isSelected: false +}, { + id: 0, + name: "Todd K. Carrico", + avatar: '../../assets/avatars/4.jpg', + subTitle: 'Engineer', + isSelected: false +}, { + id: 0, + name: "Louise K. Parker", + avatar: '../../assets/avatars/5.jpg', + subTitle: 'Investigator', + isSelected: false +}, { + id: 0, + name: "Jessica R. Folger", + avatar: '../../assets/avatars/6.jpg', + subTitle: 'Engineer', + isSelected: false +}, { + id: 0, + name: "Charles M. Pollard", + avatar: '../../assets/avatars/7.jpg', + subTitle: 'Engineer', + isSelected: false +}, { + id: 0, + name: "David B. Boaz", + avatar: '../../assets/avatars/8.jpg', + subTitle: 'Investigator', + isSelected: false +}, { + id: 0, + name: "Julia R. Bedwell", + avatar: '../../assets/avatars/9.jpg', + subTitle: 'Engineer', + isSelected: false +}]; + +@Component({ + selector: 'app-select-entities', + templateUrl: './select-entities.component.html', + styleUrls: ['./select-entities.component.scss'] +}) +export class SelectEntitiesComponent implements OnInit { + @Input() entities: Array = HARDCODED_USERS; + + constructor() { } + + ngOnInit(): void { + } + + selectEntity(entity: SelectableEntity) { + entity.isSelected = !entity.isSelected; + } + +} diff --git a/src/app/widgets/table/table.component.html b/src/app/widgets/table/table.component.html index fca8856..7700d5a 100644 --- a/src/app/widgets/table/table.component.html +++ b/src/app/widgets/table/table.component.html @@ -4,12 +4,12 @@
{{ heading }}
-
    +
    1. {{ i + 1 }}

      {{ detail }}

    2. -
+ \ No newline at end of file diff --git a/src/app/widgets/table/table.component.scss b/src/app/widgets/table/table.component.scss index 7ea4164..7edc977 100644 --- a/src/app/widgets/table/table.component.scss +++ b/src/app/widgets/table/table.component.scss @@ -26,7 +26,7 @@ } } - ul { + ol { list-style: none; }