-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/#230-organization-teams
- Loading branch information
Showing
38 changed files
with
921 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
apps/gauzy/src/app/@shared/dashboard/profit-history/profit-history.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
12 changes: 12 additions & 0 deletions
12
apps/gauzy/src/app/@shared/dashboard/profit-history/profit-history.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
apps/gauzy/src/app/@shared/dashboard/profit-history/profit-history.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} | ||
} |
15 changes: 15 additions & 0 deletions
15
apps/gauzy/src/app/@shared/dashboard/profit-history/profit-history.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.