| Total Complexity | 2 |
| Complexity/F | 2 |
| Lines of Code | 27 |
| Function Count | 1 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { Injectable } from '@nestjs/common'; |
||
| 2 | import { ILeaveRequestsOverview } from 'src/Domain/HumanResource/Leave/ILeaveRequestsOverview'; |
||
| 3 | import { Table } from 'src/Infrastructure/Tables'; |
||
| 4 | import { RowFactory } from 'src/Infrastructure/Tables/RowFactory'; |
||
| 5 | |||
| 6 | @Injectable() |
||
| 7 | export class LeaveRequestsOverviewTableFactory { |
||
| 8 | constructor(private rowFactory: RowFactory) {} |
||
| 9 | |||
| 10 | public create(overview: ILeaveRequestsOverview): Table { |
||
| 11 | const columns = []; |
||
| 12 | const rowBuilder = this.rowFactory.createBuilder(); |
||
| 13 | |||
| 14 | for (const type in overview) { |
||
| 15 | columns.push(`leaves-overview-${type}`); |
||
| 16 | rowBuilder.template('pages/leave_requests/_overview_badge.njk', { |
||
| 17 | type, |
||
| 18 | days: overview[type] |
||
| 19 | }); |
||
| 20 | } |
||
| 21 | |||
| 22 | const row = rowBuilder.build(); |
||
| 23 | |||
| 24 | return new Table(columns, [row]); |
||
| 25 | } |
||
| 26 | } |
||
| 27 |