Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(arc-lib): Addition of gantt module #60

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
[attr.gantt-bar-data]="stringify(allocationBar)"
gantt-hover="bar"
[ngClass]="allocationBar.classes ?? []"
[ngStyle]="{
width: allocationBar.percent + '%',
}"
[ngStyle]="{width: allocationBar.percent + '%'}"
[class.empty]="!allocationBar.allocation"
[class.over-allocated]="allocationBar.allocation > allocationBase"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@use 'sass:map';
// @use "../../../../theme/styles/variables" as *;
@use 'projects/arc-lib/src/lib/theme/styles/_variables.scss' as *;
@use '../../../../theme/styles/variables' as *;

.actual-rate {
padding: 0.25rem 0.5rem;
Expand Down Expand Up @@ -28,7 +27,7 @@
display: flex;
justify-content: space-between;
align-items: center;
height: 100%;
height: 20px;
overflow: hidden;

&.actual-bar {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,16 @@
import {ComponentFixture, TestBed} from '@angular/core/testing';
import {AnyObject} from '@project-lib/core/api';
import {TranslationService} from '@project-lib/core/localization';
import {
TranslateFakeLoader,
TranslateLoader,
TranslateModule,
TranslateService,
} from '@ngx-translate/core';

import {GanttBarsComponent} from './gantt-bars.component';

describe('GanttBarsComponent', () => {
let component: GanttBarsComponent<AnyObject>;
let fixture: ComponentFixture<GanttBarsComponent<AnyObject>>;
let component: GanttBarsComponent;
let fixture: ComponentFixture<GanttBarsComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [GanttBarsComponent],
providers: [TranslateService, TranslationService],
imports: [
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useClass: TranslateFakeLoader,
},
}),
],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(GanttBarsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,32 @@
import {Component} from '@angular/core';
import {AnyObject} from '@project-lib/core/api';
import {MAX_ALLOCATION} from '@project-lib/core/constants';
import {TranslationService} from '@project-lib/core/localization';
import {TranslateService} from '@ngx-translate/core';
import {
GanttTaskValue,
GanttTaskValueWithSubAllocation,
SubAllocation,
} from '../../types';
import {Component, Input} from '@angular/core';
import {AllocationBar, Item} from '../../model/item.model';

@Component({
selector: 'gantt-bars',
selector: 'arc-gantt-bars',
templateUrl: './gantt-bars.component.html',
styleUrls: ['./gantt-bars.component.scss'],
})
export class GanttBarsComponent<T extends AnyObject> {
item!: GanttTaskValue<T>;
allocationTypes: AnyObject;
allocationBase = MAX_ALLOCATION;
private translate: TranslateService;
constructor(private translateSvc: TranslationService) {
this.translate = translateSvc.translate;
}
export class GanttBarsComponent {
@Input() item: Item;
@Input() allocationTypes: any;
@Input() allocationBase: number;

stringify(subAllocation: SubAllocation) {
return JSON.stringify(subAllocation);
constructor() {
console.log('hii tiny');
}
formatAllocation(value: number): string {
return `${value} hours`;
}
formatter(rate: number) {
return `$${rate}/${this.translate.instant('hr')}`;

formatter(value: number): string {
return `$${value}/hour`;
}

formatAllocation(allocation: number) {
return `${allocation}${this.translate.instant('h/d')}`;
hasSubAllocation(item: Item): boolean {
return item.subAllocations && item.subAllocations.length > 0;
}

hasSubAllocation(
item: GanttTaskValue<T>,
): item is GanttTaskValueWithSubAllocation<T> {
return !!(item as GanttTaskValueWithSubAllocation<T>).subAllocations;
stringify(allocationBar: AllocationBar): string {
return JSON.stringify(allocationBar);
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="column-container pl-2" *ngIf="item">
<div *ngFor="let item of items" class="employee-list-item">
<nb-icon
*ngIf="item.hasChildren"
[icon]="item.$open ? 'chevron-up' : 'chevron-down'"
Expand All @@ -17,7 +17,7 @@
</div>
<div
[ngClass]="item.subtitle ? 'with-designation' : 'without-designation'"
class="name-container"
class="employee-info"
data-gantt-click="name"
>
<div class="name">{{ item.name }}</div>
Expand All @@ -32,13 +32,4 @@
<div>This resource is over allocated</div>
<nb-icon class="icon" icon="overallocation" pack="svg-boiler"></nb-icon>
</div>
<div class="kebab-container">
<nb-icon
*ngIf="showKebab"
class="cursor-pointer kebab"
icon="kebab"
pack="svg-boiler"
data-gantt-click="kebab"
></nb-icon>
</div>
</div>
Loading