Skip to content

Commit 11d646d

Browse files
committed
fix: TT-290 added component dropdown in tables of customers, activities and projects and remove code smell
1 parent ea45e58 commit 11d646d

20 files changed

+280
-90
lines changed

src/app/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ import { NgxMaterialTimepickerModule } from 'ngx-material-timepicker';
8484
import { TechnologyReportTableComponent } from './modules/technology-report/components/technology-report-table/technology-report-table.component';
8585
import { TechnologyReportComponent } from './modules/technology-report/pages/technology-report.component';
8686
import { CalendarComponent } from './modules/time-entries/components/calendar/calendar.component';
87+
import { DropdownComponent } from './modules/shared/components/dropdown/dropdown.component';
8788

8889
const maskConfig: Partial<IConfig> = {
8990
validation: false,
@@ -137,6 +138,7 @@ const maskConfig: Partial<IConfig> = {
137138
TechnologyReportComponent,
138139
TechnologyReportTableComponent,
139140
CalendarComponent,
141+
DropdownComponent,
140142
],
141143
imports: [
142144
NgxMaskModule.forRoot(maskConfig),

src/app/modules/activities-management/components/activity-list/activity-list.component.html

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,10 @@
1919
</button>
2020
</td>
2121
<td class="col-2 text-center">
22-
<button
23-
class="btn btn-sm btn--switch"
24-
data-toggle="modal"
25-
data-target="#deleteModal"
26-
[ngClass]="activity.btnColor"
27-
(click)="changeOperation(activity)">
28-
<em class="fa" [ngClass]="[activity.btnIcon, activity.iconColor]"></em>
29-
{{ activity.btnName }}
30-
<em class="fa iconTwo" [ngClass]="activity.btnIconTwo"></em>
31-
<span *ngIf="activity._status">&nbsp;</span>
32-
</button>
22+
<app-dropdown
23+
[info] = "activity"
24+
(updateInfo) = "changeOperation($event)"
25+
> </app-dropdown>
3326
</td>
3427
</tr>
3528
</tbody>
@@ -43,7 +36,7 @@
4336
tabindex="-1"
4437
role="dialog"
4538
aria-hidden="true"
46-
[title]="'Archive Activity'"
39+
[title]="'Inactive Activity'"
4740
[body]="message"
4841
(closeModalEvent)="deleteActivity()"
4942
>

src/app/modules/activities-management/components/activity-list/activity-list.component.scss

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22

33
.activity-list {
44
overflow: auto;
5-
}
6-
.btn--switch{
7-
font-size: 1rem;
8-
border: 1px solid #c5c5c5;
9-
border-radius: 20px;
5+
106
}
117

12-
.iconTwo{
13-
color: #a1a1a1;
14-
}

src/app/modules/activities-management/components/activity-list/activity-list.component.spec.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('ActivityListComponent', () => {
2424
_status: false,
2525
btnColor: 'btn-white',
2626
btnIcon: 'fa-circle',
27-
btnIconTwo: 'fa-caret-down',
27+
btnIconTwo: 'fa-check',
2828
btnName: 'Active',
2929
iconColor: 'text-success'
3030
},
@@ -33,7 +33,7 @@ describe('ActivityListComponent', () => {
3333
_status: true,
3434
btnColor: 'btn-white',
3535
btnIcon: 'fa-circle',
36-
btnIconTwo: 'fa-caret-up',
36+
btnIconTwo: 'fa-check',
3737
btnName: 'Inactive',
3838
iconColor: 'text-danger'
3939
},
@@ -107,8 +107,8 @@ describe('ActivityListComponent', () => {
107107
expect(store.dispatch).toHaveBeenCalledWith(new UnarchiveActivity('id'));
108108
});
109109

110-
it('openModal should set on true and display \"Are you sure you want to archive activity\"', () => {
111-
const message = 'Are you sure you want to archive activity name?';
110+
it('openModal should set on true and display \"Are you sure you want to inactive activity\"', () => {
111+
const message = 'Are you sure you want to inactive activity name?';
112112
const itemData = {
113113
id: '1',
114114
name: 'name',
@@ -136,7 +136,9 @@ describe('ActivityListComponent', () => {
136136
_status: true,
137137
btnColor: 'btn-primary',
138138
btnIcon: 'fa-arrow-circle-up',
139+
btnIconTwo: 'fa-check',
139140
btnName: 'Active',
141+
iconColor: 'text-danger'
140142
};
141143

142144
spyOn(component, 'unarchiveActivity');
@@ -154,7 +156,9 @@ describe('ActivityListComponent', () => {
154156
_status: false,
155157
btnColor: 'btn-danger',
156158
btnIcon: 'fa-arrow-circle-down',
159+
btnIconTwo: 'fa-caret-check',
157160
btnName: 'Archive',
161+
iconColor: 'text-success'
158162
};
159163

160164
spyOn(component, 'openModal');

src/app/modules/activities-management/components/activity-list/activity-list.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ export class ActivityListComponent implements OnInit {
3030
_status: false,
3131
btnColor: 'btn-white',
3232
btnIcon: 'fa-circle',
33-
btnIconTwo: 'fa-caret-down',
33+
btnIconTwo: 'fa-check',
3434
btnName: 'Active',
3535
iconColor: 'text-success'
3636
}, {
3737
key: 'inactive',
3838
_status: true,
3939
btnColor: 'btn-white',
4040
btnIcon: 'fa-circle',
41-
btnIconTwo: 'fa-caret-up',
41+
btnIconTwo: 'fa-check',
4242
btnName: 'Inactive',
4343
iconColor: 'text-danger'
4444
}];
@@ -74,7 +74,7 @@ export class ActivityListComponent implements OnInit {
7474
}
7575

7676
openModal(item: Activity): void {
77-
this.message = `Are you sure you want to archive activity ${item.name}?`;
77+
this.message = `Are you sure you want to inactive activity ${item.name}?`;
7878
this.showModal = true;
7979
}
8080

src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.html

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,10 @@
2929
</button>
3030
</td>
3131
<td class="col-2 text-center">
32-
<button
33-
class="btn btn-sm btn--switch"
34-
data-toggle="modal"
35-
data-target="#deleteModal"
36-
[ngClass]="customer.btnColor"
37-
(click)="switchStatus(customer)">
38-
<em class="fa" [ngClass]="[customer.btnIcon, customer.iconColor]" ></em>
39-
{{customer.btnName}}
40-
<em class="fa iconTwo" [ngClass]="customer.btnIconTwo"></em>
41-
</button>
32+
<app-dropdown
33+
[info] = "customer"
34+
(updateInfo) = "switchStatus($event)"
35+
> </app-dropdown>
4236
</td>
4337
</tr>
4438
</tbody>
@@ -52,7 +46,7 @@
5246
tabindex="-1"
5347
role="dialog"
5448
aria-hidden="true"
55-
[title]="'Delete Customer'"
49+
[title]="'Inactive Customer'"
5650
[body]="message"
5751
(closeModalEvent)="deleteCustomer()"
5852
>
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +0,0 @@
1-
.btn--switch {
2-
font-size: 1rem;
3-
border: 1px solid #c5c5c5;
4-
border-radius: 20px;
5-
}
6-
7-
.iconTwo {
8-
color: #a1a1a1;
9-
}

src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.spec.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('CustomerTableListComponent', () => {
3636
_status: false,
3737
btnColor: 'btn-white',
3838
btnIcon: 'fa-circle',
39-
btnIconTwo: 'fa-caret-down',
39+
btnIconTwo: 'fa-check',
4040
btnName: 'Active',
4141
iconColor: 'text-success'
4242
},
@@ -45,7 +45,7 @@ describe('CustomerTableListComponent', () => {
4545
_status: true,
4646
btnColor: 'btn-white',
4747
btnIcon: 'fa-circle',
48-
btnIconTwo: 'fa-caret-up',
48+
btnIconTwo: 'fa-check',
4949
btnName: 'Inactive',
5050
iconColor: 'text-danger'
5151
},
@@ -220,7 +220,7 @@ describe('CustomerTableListComponent', () => {
220220
});
221221

222222
it('openModal should set on true and display "Are you sure you want to archive customer"', () => {
223-
const message = 'Are you sure you want to archive name?';
223+
const message = 'Are you sure you want to inactive name?';
224224
const itemData = {
225225
id: '1',
226226
name: 'name',
@@ -248,7 +248,9 @@ describe('CustomerTableListComponent', () => {
248248
_status: false,
249249
btnColor: 'btn-danger',
250250
btnIcon: 'fa-arrow-circle-down',
251+
btnIconTwo: 'fa-caret-check',
251252
btnName: 'Archive',
253+
iconColor: 'text-success'
252254
};
253255

254256
spyOn(component, 'openModal');
@@ -266,7 +268,9 @@ describe('CustomerTableListComponent', () => {
266268
_status: true,
267269
btnColor: 'btn-primary',
268270
btnIcon: 'fa-arrow-circle-up',
271+
btnIconTwo: 'fa-check',
269272
btnName: 'Active',
273+
iconColor: 'text-danger'
270274
};
271275

272276
component.switchStatus(itemData);

src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class CustomerListComponent implements OnInit, OnDestroy, AfterViewInit {
5555
_status: false,
5656
btnColor: 'btn-white',
5757
btnIcon: 'fa-circle',
58-
btnIconTwo: 'fa-caret-down',
58+
btnIconTwo: 'fa-check',
5959
btnName: 'Active',
6060
iconColor: 'text-success'
6161
},
@@ -64,7 +64,7 @@ export class CustomerListComponent implements OnInit, OnDestroy, AfterViewInit {
6464
_status: true,
6565
btnColor: 'btn-white',
6666
btnIcon: 'fa-circle',
67-
btnIconTwo: 'fa-caret-up',
67+
btnIconTwo: 'fa-check',
6868
btnName: 'Inactive',
6969
iconColor: 'text-danger'
7070
},
@@ -176,7 +176,7 @@ export class CustomerListComponent implements OnInit, OnDestroy, AfterViewInit {
176176

177177
openModal(item: Customer) {
178178
this.idToDelete = item.id;
179-
this.message = `Are you sure you want to archive ${item.name}?`;
179+
this.message = `Are you sure you want to inactive ${item.name}?`;
180180
this.showModal = true;
181181
}
182182

src/app/modules/customer-management/components/projects/components/project-list/project-list.component.html

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,10 @@
2020
</button>
2121
</td>
2222
<td class="col-sm-2 text-center">
23-
<button
24-
class="btn btn-sm btn--switch"
25-
data-toggle="modal"
26-
data-target="#deleteModal"
27-
[ngClass]="project.btnColor"
28-
(click)="switchStatus(project)"
29-
>
30-
<em class="fa" [ngClass]="[project.btnIcon, project.iconColor]"></em>
31-
{{project.btnName}}
32-
<em class="fa iconTwo" [ngClass]="project.btnIconTwo"></em>
33-
34-
</button>
23+
<app-dropdown
24+
[info] = "project"
25+
(updateInfo) = "switchStatus($event)">
26+
</app-dropdown>
3527
</td>
3628
</tr>
3729
</tbody>
@@ -45,7 +37,7 @@
4537
tabindex="-1"
4638
role="dialog"
4739
aria-hidden="true"
48-
[title]="'Archive Project'"
40+
[title]="'Inactive Project'"
4941
[body]="message"
5042
(closeModalEvent)="deleteProject()"
5143
>

0 commit comments

Comments
 (0)