Skip to content

Commit

Permalink
Merge branch 'develop' into feature/#230-organization-teams
Browse files Browse the repository at this point in the history
  • Loading branch information
evereq committed Nov 8, 2019
2 parents 8874706 + 1a95045 commit 641f8a2
Show file tree
Hide file tree
Showing 38 changed files with 921 additions and 342 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -53,7 +53,7 @@ You can run seed any moment manually (e.g. if you changed entities schemas) with

- Check [Gauzy Pulumi](https://github.com/ever-co/gauzy-pulumi) project, it will make Clouds deployments possible with a single command (`pulumi up`)

Note: it's WIP, currently supports AWS Fargate Clusters (for web app and backend api), Application Load Balancers and Serverless PostgreSQL DB deployments.
Note: it's WIP, currently supports AWS EKS (Kubernetes) and Fargate Clusters (for web app and backend api), Application Load Balancers and AWS RDS Serverless PostgreSQL DB deployments.

## Technology Stack

Expand Down
24 changes: 24 additions & 0 deletions apps/api/src/app/organization/organization.entity.ts
Expand Up @@ -51,4 +51,28 @@ export class Organization extends Base implements IOrganization {
@ApiModelProperty({ type: Boolean, default: true })
@Column({ default: true })
isActive: boolean;

@ApiModelProperty({ type: String })
@Column()
@IsOptional()
@Column({ nullable: true })
defaultAlignmentType?: string;

@ApiModelProperty({ type: String })
@Column()
@IsOptional()
@Column({ nullable: true })
timeZone?: string;

@ApiModelProperty({ type: String })
@Column()
@IsOptional()
@Column({ nullable: true })
brandColor?: string;

@ApiModelProperty({ type: String })
@Column()
@IsOptional()
@Column({ nullable: true })
dateFormat?: string;
}
@@ -0,0 +1,16 @@
<div class="profit-history">
<h5>Profit Report</h5>
<div class="totals">
<div>
<span>Total Expenses: {{ expensesTotal }}</span>
<span class="margin-offset">Total Income: {{ incomeTotal }}</span>
</div>
<span> Total Profit: {{ incomeTotal - expensesTotal }}</span>
</div>
<ng2-smart-table
class="table"
[settings]="smartTableSettings"
[source]="smartTableSource"
>
</ng2-smart-table>
</div>
@@ -0,0 +1,12 @@
.profit-history {
box-shadow: 0px 0px 16px 9px grey;
background: white;
padding: 15px;
.totals {
display: flex;
justify-content: space-between;
}
.margin-offset {
margin-left: 69px;
}
}
@@ -0,0 +1,85 @@
import { OnInit, OnDestroy, Component } from '@angular/core';
import { LocalDataSource } from 'ng2-smart-table';
import { DateViewComponent } from '../../table-components/date-view/date-view.component';
import * as moment from 'moment';

@Component({
templateUrl: './profit-history.component.html',
styleUrls: ['./profit-history.component.scss']
})
export class ProfitHistoryComponent implements OnInit, OnDestroy {
smartTableSettings;
smartTableSource = new LocalDataSource();
recordsData: any;
incomeTotal: number;
expensesTotal: number;

constructor() {}

ngOnInit() {
this.loadSettingsSmartTable();
const incomeList = this.recordsData.income.map((inc) => {
return {
income: inc.amount,
expense: 0,
valueDate: inc.valueDate,
notes: inc.notes
};
});

const expenseList = this.recordsData.expenses.map((exp) => {
return {
expense: exp.amount,
income: 0,
valueDate: exp.valueDate,
notes: exp.notes
};
});
const combinedTableData = [...incomeList, ...expenseList];

this.incomeTotal = combinedTableData.reduce((a, b) => a + b.income, 0);

this.expensesTotal = combinedTableData.reduce(
(a, b) => a + b.expense,
0
);

this.smartTableSource.load(combinedTableData);
}

loadSettingsSmartTable() {
this.smartTableSettings = {
actions: false,
mode: 'external',
editable: true,
noDataMessage: 'No Data',
columns: {
expense: {
title: 'Expenses',
type: 'string'
},
income: {
title: 'Income',
type: 'string'
},
notes: {
title: 'Description',
type: 'string'
},
valueDate: {
title: 'Date',
type: 'custom',
width: '20%',
renderComponent: DateViewComponent,
filter: false
}
},
pager: {
display: true,
perPage: 8
}
};
}

ngOnDestroy() {}
}
@@ -0,0 +1,15 @@
import { NgModule } from '@angular/core';
import { Ng2SmartTableModule } from 'ng2-smart-table';
import { IncomeModule } from '../../../pages/income/income.module';
import { NbEvaIconsModule } from '@nebular/eva-icons';
import { NbIconModule } from '@nebular/theme';
import { ProfitHistoryComponent } from './profit-history.component';

@NgModule({
imports: [Ng2SmartTableModule, IncomeModule, NbIconModule],
exports: [ProfitHistoryComponent],
declarations: [ProfitHistoryComponent],
entryComponents: [ProfitHistoryComponent],
providers: [ProfitHistoryComponent]
})
export class ProfitHistoryModule {}
50 changes: 45 additions & 5 deletions apps/gauzy/src/app/@theme/components/header/header.component.html
Expand Up @@ -27,7 +27,7 @@
[class.left]="position === 'normal'"
[class.right]="position === 'inverse'"
>
<nb-action>
<nb-action *ngIf="getWindowWidth() > largeBreakpoint">
<button
nbButton
status="success"
Expand All @@ -38,25 +38,39 @@
</button>
</nb-action>

<nb-action *ngIf="showEmployeesSelector">
<nb-action
*ngIf="showEmployeesSelector && getWindowWidth() > largeBreakpoint"
>
<ga-employee-selector
class="header-selector employee-selector"
></ga-employee-selector>
</nb-action>

<nb-action *ngIf="showDateSelector">
<nb-action
*ngIf="showDateSelector && getWindowWidth() > largeBreakpoint"
>
<ga-date-selector class="date-selector"></ga-date-selector>
</nb-action>

<nb-action *ngIf="showOrganizationsSelector">
<nb-action
*ngIf="
showOrganizationsSelector && getWindowWidth() > largeBreakpoint
"
>
<ga-organization-selector
class="header-selector organization-selector"
></ga-organization-selector>
</nb-action>

<!-- <nb-action *nbIsGranted="['view', 'user']">
<nb-user [nbContextMenu]="userMenu" [name]="(user?.name || user?.email)" [picture]="user?.picture"></nb-user>
</nb-action> -->
</nb-action> -->
<nb-action
*ngIf="getWindowWidth() < largeBreakpoint"
icon="options-2-outline"
class="toggle-layout"
(click)="toggleExtraActions()"
></nb-action>
<nb-action
icon="message-circle-outline"
class="toggle-layout"
Expand All @@ -75,3 +89,29 @@
</nb-action> -->
</nb-actions>
</div>

<div
class="extra-actions"
*ngIf="showExtraActions && getWindowWidth() < largeBreakpoint"
>
<div><h6>Select Employee</h6></div>

<ga-employee-selector
*ngIf="showEmployeesSelector"
class="header-selector employee-selector"
></ga-employee-selector>

<div><h6>Select A date</h6></div>

<ga-date-selector
*ngIf="showDateSelector"
class="date-selector"
></ga-date-selector>

<div><h6>Select An Organization</h6></div>

<ga-organization-selector
*ngIf="showOrganizationsSelector"
class="header-selector organization-selector"
></ga-organization-selector>
</div>
35 changes: 35 additions & 0 deletions apps/gauzy/src/app/@theme/components/header/header.component.scss
Expand Up @@ -31,6 +31,7 @@
display: flex;
align-items: center;
width: auto;
z-index: 5;

.sidebar-toggle {
@include nb-ltr(padding-right, 1.25rem);
Expand Down Expand Up @@ -90,4 +91,38 @@

.date-selector {
max-width: 180px;
min-width: 170px;
}

.extra-actions {
position: fixed;
left: 0px;
top: 4.75rem;
width: 100%;
height: calc(100vh - 4.75rem);
background: white;
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
z-index: -1;
padding-top: 2.25rem;
padding-left: 2rem;
padding-right: 2rem;

div {
min-width: 300px;
width: 100%;
max-width: 500px;
margin-left: 10px;
}

.organization-selector,
.employee-selector,
.date-selector {
min-width: 300px;
width: 100%;
max-width: 500px;
padding-bottom: 20px;
}
}
28 changes: 24 additions & 4 deletions apps/gauzy/src/app/@theme/components/header/header.component.ts
Expand Up @@ -25,6 +25,8 @@ export class HeaderComponent implements OnInit, OnDestroy {
theme: string;
createContextMenu: NbMenuItem[];
supportContextMenu: NbMenuItem[];
showExtraActions = false;
largeBreakpoint = 1290;

private _ngDestroy$ = new Subject<void>();

Expand Down Expand Up @@ -71,14 +73,23 @@ export class HeaderComponent implements OnInit, OnDestroy {
}

toggleSidebar(): boolean {
this.sidebarService.toggle(true, 'menu-sidebar');
this.layoutService.changeLayoutSize();

if (this.showExtraActions) {
this.toggleExtraActions(false);
this.sidebarService.expand('menu-sidebar');
} else {
this.sidebarService.toggle(true, 'menu-sidebar');
this.layoutService.changeLayoutSize();
}
return false;
}

toggleSettings(): boolean {
this.sidebarService.toggle(false, 'settings-sidebar');
if (this.showExtraActions) {
this.toggleExtraActions(false);
this.sidebarService.expand('settings-sidebar');
} else {
this.sidebarService.toggle(false, 'settings-sidebar');
}
return false;
}

Expand All @@ -87,6 +98,15 @@ export class HeaderComponent implements OnInit, OnDestroy {
return false;
}

getWindowWidth() {
return window.innerWidth;
}

toggleExtraActions(bool?: boolean) {
this.showExtraActions =
bool !== undefined ? bool : !this.showExtraActions;
}

loadItems() {
this.createContextMenu = [
{
Expand Down
Expand Up @@ -3,6 +3,7 @@
max-height: 40px;
input {
width: 100%;
max-width: 100% !important;
margin-right: 1rem;
}
.calendar {
Expand All @@ -18,7 +19,7 @@
}
.date-reset {
position: absolute;
top: 33%;
top: 28%;
transform: scale(1.5);
right: 20px;
cursor: pointer;
Expand Down

0 comments on commit 641f8a2

Please sign in to comment.