diff --git a/.angular-cli.json b/.angular-cli.json index b596454..d0d5d80 100644 --- a/.angular-cli.json +++ b/.angular-cli.json @@ -18,7 +18,8 @@ "testTsconfig": "tsconfig.spec.json", "prefix": "app", "styles": [ - "assets/scss/styles.scss" + "assets/scss/styles.scss", + "assets/css/pre-bootstrap.css" ], "scripts": [ ], diff --git a/src/app/components/login/login.component.scss b/src/app/components/login/login.component.scss index 286cd14..0f79d7a 100644 --- a/src/app/components/login/login.component.scss +++ b/src/app/components/login/login.component.scss @@ -1,4 +1,4 @@ -@import "../../../assets/scss/palette"; +@import "../../../assets/scss/palettes/material-palette"; #login-page { position: fixed; @@ -27,5 +27,3 @@ #login-header { text-align: center; } - - diff --git a/src/app/components/spinner/spinner.component.scss b/src/app/components/spinner/spinner.component.scss index dfe7786..e69de29 100644 --- a/src/app/components/spinner/spinner.component.scss +++ b/src/app/components/spinner/spinner.component.scss @@ -1,3 +0,0 @@ -.spinner { - //position: absolute; -} diff --git a/src/app/modules/finance/components/costs-chart-layout/costs-chart-layout.component.html b/src/app/modules/finance/components/costs-chart-layout/costs-chart-layout.component.html index 8c6e366..3f53258 100644 --- a/src/app/modules/finance/components/costs-chart-layout/costs-chart-layout.component.html +++ b/src/app/modules/finance/components/costs-chart-layout/costs-chart-layout.component.html @@ -1,24 +1,26 @@
-
+
-
-
- +
diff --git a/src/app/modules/finance/components/costs-chart-layout/costs-chart-layout.component.scss b/src/app/modules/finance/components/costs-chart-layout/costs-chart-layout.component.scss index d9a76bc..8ac2bca 100644 --- a/src/app/modules/finance/components/costs-chart-layout/costs-chart-layout.component.scss +++ b/src/app/modules/finance/components/costs-chart-layout/costs-chart-layout.component.scss @@ -1,6 +1,10 @@ -@import "../../../../../assets/scss/palette"; +@import "../../../../../assets/scss/palettes/material-palette"; .chart-switch-container { display: grid; float: right; } + +.chart { + display: grid; +} diff --git a/src/app/modules/finance/components/costs-chart-layout/costs-chart-layout.component.ts b/src/app/modules/finance/components/costs-chart-layout/costs-chart-layout.component.ts index 7238722..ce144b7 100644 --- a/src/app/modules/finance/components/costs-chart-layout/costs-chart-layout.component.ts +++ b/src/app/modules/finance/components/costs-chart-layout/costs-chart-layout.component.ts @@ -8,6 +8,8 @@ import {Component, Output, EventEmitter, OnInit, Input} from "@angular/core"; export class CostsChartLayoutComponent implements OnInit { @Input() service: any; @Input() params: any; + @Input() chartOptions: any; + @Input() chartColors: any[]; @Output() chartClick = new EventEmitter(); @Output() chartHover = new EventEmitter(); public chartDataSet: boolean = false; diff --git a/src/app/modules/finance/components/costs-chart/costs-chart.component.html b/src/app/modules/finance/components/costs-chart/costs-chart.component.html index ab8dafb..e762425 100644 --- a/src/app/modules/finance/components/costs-chart/costs-chart.component.html +++ b/src/app/modules/finance/components/costs-chart/costs-chart.component.html @@ -4,6 +4,11 @@ - + diff --git a/src/app/modules/finance/components/costs-chart/costs-chart.component.scss b/src/app/modules/finance/components/costs-chart/costs-chart.component.scss index f4222eb..8b13789 100644 --- a/src/app/modules/finance/components/costs-chart/costs-chart.component.scss +++ b/src/app/modules/finance/components/costs-chart/costs-chart.component.scss @@ -1,7 +1 @@ -:host { -} - -.costs-chart { - -} diff --git a/src/app/modules/finance/components/costs-chart/costs-chart.component.ts b/src/app/modules/finance/components/costs-chart/costs-chart.component.ts index 546cea3..3e8f4bd 100644 --- a/src/app/modules/finance/components/costs-chart/costs-chart.component.ts +++ b/src/app/modules/finance/components/costs-chart/costs-chart.component.ts @@ -10,15 +10,41 @@ import {CostsService} from "../../services/costs.service"; export class CostsChartComponent { @ViewChild(CostsChartLayoutComponent) private costsChartLayoutComponent: CostsChartLayoutComponent; chartLayoutParams: any; + chartLayoutOptions: any; + chartLayoutColors: any[]; constructor(public costsService: CostsService) { - this.chartLayoutParams = { - fetchMethod: 'getCostsChart' + this.chartLayoutParams = { + fetchMethod: 'getCostsChart', + switchable: true + }; + + this.chartLayoutOptions = { + responsive: true + }; + + this.chartLayoutColors = [ + { + backgroundColor: 'rgba(164,251,166,0.8)', + borderColor: 'rgb(74,229,74)', + pointBackgroundColor: 'rgb(164,251,166)', + pointBorderColor: 'rgb(74,229,74)', + pointHoverBackgroundColor: '#30CB00', + pointHoverBorderColor: '#006203' + }, + { + backgroundColor: 'rgba(250,88,88,0.8)', + borderColor: 'rgb(184,0,0)', + pointBackgroundColor: 'rgb(250,88,88)', + pointBorderColor: 'rgb(184,0,0)', + pointHoverBackgroundColor: '#FF4081', + pointHoverBorderColor: '#FF4081' } + ]; } - updateChart() { - this.costsChartLayoutComponent.getChart(); + updateChart(options?: any) { + this.costsChartLayoutComponent.getChart(options); } chartClick(e: any) { diff --git a/src/app/modules/finance/components/costs-list/costs-list.component.html b/src/app/modules/finance/components/costs-list/costs-list.component.html index 695ee61..a1ce09b 100644 --- a/src/app/modules/finance/components/costs-list/costs-list.component.html +++ b/src/app/modules/finance/components/costs-list/costs-list.component.html @@ -2,7 +2,7 @@
- {{costs['length']}} + {{costs['length'] || 0}}
@@ -16,10 +16,11 @@ cancel

За текущий период нет операций

- - {{cost.type}} + + {{cost.type}} + {{cost.type}}

{{cost.amount}} ₽

-

{{cost.description}}

+

{{cost.description}}

{{cost.formatDate}}

diff --git a/src/app/modules/finance/components/costs-list/costs-list.component.scss b/src/app/modules/finance/components/costs-list/costs-list.component.scss index 0985ddd..326d009 100644 --- a/src/app/modules/finance/components/costs-list/costs-list.component.scss +++ b/src/app/modules/finance/components/costs-list/costs-list.component.scss @@ -1,7 +1,6 @@ -@import "../../../../../assets/scss/palette"; +@import "../../../../../assets/scss/palettes/material-palette"; :host { - width: 17rem; } .costs-list-cost-description { @@ -32,4 +31,12 @@ cursor: pointer; border: solid 1px $primary-color-light; border-radius: 5px; + + .remove { + background-color: rgba(250, 88, 88, 0.8); + } + + .add { + background-color: rgba(164, 251, 166, 0.8); + } } diff --git a/src/app/modules/finance/components/costs-statistic/costs-statistic.component.html b/src/app/modules/finance/components/costs-statistic/costs-statistic.component.html index d913cd1..98195a8 100644 --- a/src/app/modules/finance/components/costs-statistic/costs-statistic.component.html +++ b/src/app/modules/finance/components/costs-statistic/costs-statistic.component.html @@ -1,10 +1,10 @@ - Статистика: - + Текущий период: + {{endDay}} - {{startDay}} -

Финансовый отчет с {{firstDay}} по {{lastDay}}

-

Текущий интервал - {{'интервал'}}.

+

Доход: {{addSummary}}

+

Расход: {{removeSummary}}

diff --git a/src/app/modules/finance/components/costs-statistic/costs-statistic.component.scss b/src/app/modules/finance/components/costs-statistic/costs-statistic.component.scss index dd7d135..1fb6728 100644 --- a/src/app/modules/finance/components/costs-statistic/costs-statistic.component.scss +++ b/src/app/modules/finance/components/costs-statistic/costs-statistic.component.scss @@ -1,3 +1,9 @@ .costs-statistics { margin-top: 7px; + + md-card-header { + .card-subtitle { + color: #000; + } + } } diff --git a/src/app/modules/finance/components/costs-statistic/costs-statistic.component.ts b/src/app/modules/finance/components/costs-statistic/costs-statistic.component.ts index 358f697..4dbe406 100644 --- a/src/app/modules/finance/components/costs-statistic/costs-statistic.component.ts +++ b/src/app/modules/finance/components/costs-statistic/costs-statistic.component.ts @@ -1,4 +1,5 @@ import {Component, OnInit} from "@angular/core"; +import {CostsService} from "../../services/costs.service"; @Component({ selector: 'costs-statistic', @@ -7,15 +8,32 @@ import {Component, OnInit} from "@angular/core"; }) export class CostsStatisticComponent implements OnInit { - firstDay: string; - lastDay: string; - statisticData: any; + startDay: string; + endDay: string; + addSummary: number; + removeSummary: number; + currentInterval: number; - constructor() { + constructor(public costsService: CostsService) { } ngOnInit() { + this.getStatistic(); + } + getStatistic(options?: any) { + this.costsService.getCostsStatistic(options).subscribe( + data => { + this.startDay = data['startDay']; + this.endDay = data['endDay']; + this.addSummary = data['addSummary']; + this.removeSummary = data['removeSummary']; + this.currentInterval = data['daysCount']; + }, + err => { + console.log(err); + } + ) } } diff --git a/src/app/modules/finance/components/costs/costs.component.html b/src/app/modules/finance/components/costs/costs.component.html index cd375ef..9765de4 100644 --- a/src/app/modules/finance/components/costs/costs.component.html +++ b/src/app/modules/finance/components/costs/costs.component.html @@ -2,7 +2,7 @@

Финансы

-
+
diff --git a/src/app/modules/finance/components/costs/costs.component.scss b/src/app/modules/finance/components/costs/costs.component.scss index b43d859..7080291 100644 --- a/src/app/modules/finance/components/costs/costs.component.scss +++ b/src/app/modules/finance/components/costs/costs.component.scss @@ -1,17 +1,12 @@ -.app-statistics { +.app-toolbar { display: grid; - grid-template-columns: auto; + grid-template-columns: 1fr 2fr; } + .app-content { display: grid; margin-top: 7px; - grid-template-columns: auto 2fr; - - * { - :first-child { - - } - } + grid-template-columns: 1fr 3fr; *:nth-child(even) { margin-left: 7px; diff --git a/src/app/modules/finance/components/costs/costs.component.ts b/src/app/modules/finance/components/costs/costs.component.ts index 667db93..3315bbe 100644 --- a/src/app/modules/finance/components/costs/costs.component.ts +++ b/src/app/modules/finance/components/costs/costs.component.ts @@ -20,5 +20,6 @@ export class CostsComponent { requestModifiedData() { this.costsListComponent.getCosts(); this.costsChartComponent.updateChart(); + this.costsStatisticComponent.getStatistic(); } } diff --git a/src/app/modules/finance/services/costs.service.ts b/src/app/modules/finance/services/costs.service.ts index 10b5a80..7ff53d9 100644 --- a/src/app/modules/finance/services/costs.service.ts +++ b/src/app/modules/finance/services/costs.service.ts @@ -32,6 +32,10 @@ export class CostsService extends RootService { return this.fetch(options, `${this.restUrl}/chart`); } + getCostsStatistic(options?: any): Observable { + return this.fetch(options, `${this.restUrl}/statistic`); + } + deleteCost(id: string): Observable { const item = { _id: id diff --git a/src/assets/css/pre-bootstrap.css b/src/assets/css/pre-bootstrap.css new file mode 100644 index 0000000..7dc9402 --- /dev/null +++ b/src/assets/css/pre-bootstrap.css @@ -0,0 +1,13 @@ +#pre-bootstrap-loader-host { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: #C5CAE9; +} + +#pre-bootstrap-loader-host-container { + text-align: center; + margin-top: 20%; +} diff --git a/src/assets/scss/palettes/green-palette.sass b/src/assets/scss/palettes/green-palette.sass new file mode 100644 index 0000000..a35c9b8 --- /dev/null +++ b/src/assets/scss/palettes/green-palette.sass @@ -0,0 +1,7 @@ +// green palette for data + +$dark-green: #006203 +$light-dark-green: #0F9200 +$green: #30CB00 +$light-green: #4AE54A +$very-light-green: #A4FBA6 diff --git a/src/assets/scss/palette.sass b/src/assets/scss/palettes/material-palette.sass similarity index 100% rename from src/assets/scss/palette.sass rename to src/assets/scss/palettes/material-palette.sass diff --git a/src/assets/scss/palettes/red-palette.sass b/src/assets/scss/palettes/red-palette.sass new file mode 100644 index 0000000..55eb026 --- /dev/null +++ b/src/assets/scss/palettes/red-palette.sass @@ -0,0 +1,7 @@ +// red palette for data + +$dark-red: #B80000 +$light-dark-red: #D22525 +$red: #FF0000 +$light-red: #DA4E4E +$very-light-red: #FA5858 diff --git a/src/assets/scss/styles.scss b/src/assets/scss/styles.scss index ef2fd53..927d69a 100644 --- a/src/assets/scss/styles.scss +++ b/src/assets/scss/styles.scss @@ -1,7 +1,9 @@ /* You can add global styles to this file, and also import other style files */ @import "~@angular/material/prebuilt-themes/indigo-pink.css"; @import url('https://fonts.googleapis.com/css?family=Roboto'); -@import "palette"; +@import "palettes/material-palette"; +@import "palettes/green-palette"; +@import "palettes/red-palette"; body { font-family: 'Roboto', sans-serif; diff --git a/src/assets/svg/oval.svg b/src/assets/svg/oval.svg new file mode 100644 index 0000000..f3c9300 --- /dev/null +++ b/src/assets/svg/oval.svg @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/src/index.html b/src/index.html index 833db50..fcc50e3 100644 --- a/src/index.html +++ b/src/index.html @@ -7,8 +7,15 @@ + - + +
+
+ +
+
+