| 1 |
- {"ast":null,"code":"import * as i0 from \"@angular/core\";\nimport * as i1 from \"./../../../services/statistic.service\";\nfunction StatisticComponent_div_4_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 7);\n i0.ɵɵelement(1, \"canvas\", 8);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r0 = i0.ɵɵnextContext();\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"datasets\", ctx_r0.barChartData)(\"labels\", ctx_r0.barChartLabels)(\"options\", ctx_r0.barChartOptions)(\"plugins\", ctx_r0.barChartPlugins)(\"legend\", ctx_r0.barChartLegend)(\"chartType\", ctx_r0.barChartBar);\n }\n}\nfunction StatisticComponent_div_6_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 7);\n i0.ɵɵelement(1, \"canvas\", 8);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r1 = i0.ɵɵnextContext();\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"datasets\", ctx_r1.barChartData)(\"labels\", ctx_r1.barChartLabels)(\"options\", ctx_r1.barChartOptions)(\"plugins\", ctx_r1.barChartPlugins)(\"legend\", ctx_r1.barChartLegend)(\"chartType\", ctx_r1.barChartHorizontal);\n }\n}\nfunction StatisticComponent_table_10_th_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"th\", 23);\n i0.ɵɵtext(1, \"Gain\");\n i0.ɵɵelementEnd();\n }\n}\nfunction StatisticComponent_table_10_td_3_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"td\", 24);\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const element_r18 = ctx.$implicit;\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", element_r18.gain, \" \");\n }\n}\nfunction StatisticComponent_table_10_td_4_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"td\", 25);\n i0.ɵɵtext(1, \"Totale\");\n i0.ɵɵelementEnd();\n }\n}\nfunction StatisticComponent_table_10_th_6_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"th\", 26);\n i0.ɵɵtext(1, \"Utilis\\u00E9\");\n i0.ɵɵelementEnd();\n }\n}\nfunction StatisticComponent_table_10_td_7_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"td\", 27);\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const element_r19 = ctx.$implicit;\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", element_r19.used, \" \");\n }\n}\nfunction StatisticComponent_table_10_td_8_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"td\", 28);\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r8 = i0.ɵɵnextContext(2);\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", ctx_r8.getUsed(), \" \");\n }\n}\nfunction StatisticComponent_table_10_th_10_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"th\", 26);\n i0.ɵɵtext(1, \"Server\");\n i0.ɵɵelementEnd();\n }\n}\nfunction StatisticComponent_table_10_td_11_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"td\", 27);\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const element_r20 = ctx.$implicit;\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", element_r20.served, \" \");\n }\n}\nfunction StatisticComponent_table_10_td_12_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"td\", 28);\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r11 = i0.ɵɵnextContext(2);\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", ctx_r11.getServed(), \" \");\n }\n}\nfunction StatisticComponent_table_10_th_14_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"th\", 26);\n i0.ɵɵtext(1, \"Totalit\\u00E9\");\n i0.ɵɵelementEnd();\n }\n}\nfunction StatisticComponent_table_10_td_15_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"td\", 27);\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const element_r21 = ctx.$implicit;\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", element_r21.total, \" \");\n }\n}\nfunction StatisticComponent_table_10_td_16_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"td\", 28);\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r14 = i0.ɵɵnextContext(2);\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", ctx_r14.getTotal(), \" \");\n }\n}\nfunction StatisticComponent_table_10_tr_17_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"tr\", 29);\n }\n}\nfunction StatisticComponent_table_10_tr_18_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"tr\", 30);\n }\n}\nfunction StatisticComponent_table_10_tr_19_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"tr\", 31);\n }\n}\nfunction StatisticComponent_table_10_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"table\", 9);\n i0.ɵɵelementContainerStart(1, 10);\n i0.ɵɵtemplate(2, StatisticComponent_table_10_th_2_Template, 2, 0, \"th\", 11);\n i0.ɵɵtemplate(3, StatisticComponent_table_10_td_3_Template, 2, 1, \"td\", 12);\n i0.ɵɵtemplate(4, StatisticComponent_table_10_td_4_Template, 2, 0, \"td\", 13);\n i0.ɵɵelementContainerEnd();\n i0.ɵɵelementContainerStart(5, 14);\n i0.ɵɵtemplate(6, StatisticComponent_table_10_th_6_Template, 2, 0, \"th\", 15);\n i0.ɵɵtemplate(7, StatisticComponent_table_10_td_7_Template, 2, 1, \"td\", 16);\n i0.ɵɵtemplate(8, StatisticComponent_table_10_td_8_Template, 2, 1, \"td\", 17);\n i0.ɵɵelementContainerEnd();\n i0.ɵɵelementContainerStart(9, 18);\n i0.ɵɵtemplate(10, StatisticComponent_table_10_th_10_Template, 2, 0, \"th\", 15);\n i0.ɵɵtemplate(11, StatisticComponent_table_10_td_11_Template, 2, 1, \"td\", 16);\n i0.ɵɵtemplate(12, StatisticComponent_table_10_td_12_Template, 2, 1, \"td\", 17);\n i0.ɵɵelementContainerEnd();\n i0.ɵɵelementContainerStart(13, 19);\n i0.ɵɵtemplate(14, StatisticComponent_table_10_th_14_Template, 2, 0, \"th\", 15);\n i0.ɵɵtemplate(15, StatisticComponent_table_10_td_15_Template, 2, 1, \"td\", 16);\n i0.ɵɵtemplate(16, StatisticComponent_table_10_td_16_Template, 2, 1, \"td\", 17);\n i0.ɵɵelementContainerEnd();\n i0.ɵɵtemplate(17, StatisticComponent_table_10_tr_17_Template, 1, 0, \"tr\", 20);\n i0.ɵɵtemplate(18, StatisticComponent_table_10_tr_18_Template, 1, 0, \"tr\", 21);\n i0.ɵɵtemplate(19, StatisticComponent_table_10_tr_19_Template, 1, 0, \"tr\", 22);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r2 = i0.ɵɵnextContext();\n i0.ɵɵproperty(\"dataSource\", ctx_r2.statisticArray);\n i0.ɵɵadvance(17);\n i0.ɵɵproperty(\"matHeaderRowDef\", ctx_r2.displayedColumns);\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"matRowDefColumns\", ctx_r2.displayedColumns);\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"matFooterRowDef\", ctx_r2.displayedColumns);\n }\n}\nexport let StatisticComponent = /*#__PURE__*/(() => {\n class StatisticComponent {\n constructor(StatisticService) {\n this.StatisticService = StatisticService;\n this.statisticArray = [];\n this.barChartData = [];\n this.isFoo = true;\n //chart\n this.barChartOptions = {\n responsive: true\n };\n this.barChartLabels = ['Une entrée ou un dessert au choix', 'Un burger au choix', 'Un menu du jour', 'Un menu au choix', '70% de réduction'];\n this.barChartBar = 'bar';\n this.barChartHorizontal = 'horizontalBar';\n this.barChartLegend = true;\n this.barChartPlugins = [];\n this.displayedColumns = ['gain', 'used', 'served', 'total'];\n }\n ngOnInit() {\n this.subscribeToStatistic();\n }\n //sbscribe statistic\n subscribeToStatistic() {\n this.StatisticService.getStatistic().subscribe(res => {\n this.statisticArray = res.data;\n this.barChartData = [{\n data: this.statisticArray.map(res => res.total),\n label: 'totalité'\n }, {\n data: this.statisticArray.map(res => res.used),\n label: 'utiliser'\n }, {\n data: this.statisticArray.map(res => res.served),\n label: 'server'\n }];\n });\n }\n getTotal() {\n return this.statisticArray.map(t => t.total).reduce((acc, value) => acc + value, 0);\n }\n getUsed() {\n return this.statisticArray.map(t => t.used).reduce((acc, value) => acc + value, 0);\n }\n getServed() {\n return this.statisticArray.map(t => t.served).reduce((acc, value) => acc + value, 0);\n }\n //texte button \n getBtnText() {\n if (this.isFoo) {\n return 'diagramme à bandes horizontales';\n } else return 'diagramme à bandes verticales';\n }\n static #_ = this.ɵfac = function StatisticComponent_Factory(t) {\n return new (t || StatisticComponent)(i0.ɵɵdirectiveInject(i1.StatisticService));\n };\n static #_2 = this.ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n type: StatisticComponent,\n selectors: [[\"app-statistic\"]],\n decls: 11,\n vars: 4,\n consts: [[1, \"container\", \"navtop\"], [1, \"mb-5\"], [1, \"row\", \"justify-content-center\"], [\"class\", \"col-sm-12 col-lg-8\", 4, \"ngIf\"], [\"mat-raised-button\", \"\", \"color\", \"primary\", 1, \"mt-4\", 3, \"click\"], [1, \"row\", \"justify-content-center\", \"my-5\"], [\"mat-table\", \"\", \"class\", \"mat-elevation-z8 col-11 col-lg-8\", 3, \"dataSource\", 4, \"ngIf\"], [1, \"col-sm-12\", \"col-lg-8\"], [\"baseChart\", \"\", 3, \"datasets\", \"labels\", \"options\", \"plugins\", \"legend\", \"chartType\"], [\"mat-table\", \"\", 1, \"mat-elevation-z8\", \"col-11\", \"col-lg-8\", 3, \"dataSource\"], [\"matColumnDef\", \"gain\"], [\"mat-header-cell\", \"\", 4, \"matHeaderCellDef\"], [\"mat-cell\", \"\", \"class\", \"text-left\", 4, \"matCellDef\"], [\"mat-footer-cell\", \"\", \"class\", \"text-left\", 4, \"matFooterCellDef\"], [\"matColumnDef\", \"used\"], [\"mat-header-cell\", \"\", \"class\", \"text-center\", 4, \"matHeaderCellDef\"], [\"mat-cell\", \"\", 4, \"matCellDef\"], [\"mat-footer-cell\", \"\", 4, \"matFooterCellDef\"], [\"matColumnDef\", \"served\"], [\"matColumnDef\", \"total\"], [\"mat-header-row\", \"\", 4, \"matHeaderRowDef\"], [\"mat-row\", \"\", 4, \"matRowDef\", \"matRowDefColumns\"], [\"mat-footer-row\", \"\", 4, \"matFooterRowDef\"], [\"mat-header-cell\", \"\"], [\"mat-cell\", \"\", 1, \"text-left\"], [\"mat-footer-cell\", \"\", 1, \"text-left\"], [\"mat-header-cell\", \"\", 1, \"text-center\"], [\"mat-cell\", \"\"], [\"mat-footer-cell\", \"\"], [\"mat-header-row\", \"\"], [\"mat-row\", \"\"], [\"mat-footer-row\", \"\"]],\n template: function StatisticComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 0)(1, \"h1\", 1);\n i0.ɵɵtext(2, \"Statistiques du jeux\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(3, \"div\", 2);\n i0.ɵɵtemplate(4, StatisticComponent_div_4_Template, 2, 6, \"div\", 3);\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(5, \"div\", 2);\n i0.ɵɵtemplate(6, StatisticComponent_div_6_Template, 2, 6, \"div\", 3);\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(7, \"button\", 4);\n i0.ɵɵlistener(\"click\", function StatisticComponent_Template_button_click_7_listener() {\n return ctx.isFoo = !ctx.isFoo;\n });\n i0.ɵɵtext(8);\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(9, \"div\", 5);\n i0.ɵɵtemplate(10, StatisticComponent_table_10_Template, 20, 4, \"table\", 6);\n i0.ɵɵelementEnd()();\n }\n if (rf & 2) {\n i0.ɵɵadvance(4);\n i0.ɵɵproperty(\"ngIf\", ctx.isFoo);\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"ngIf\", !ctx.isFoo);\n i0.ɵɵadvance(2);\n i0.ɵɵtextInterpolate(ctx.getBtnText());\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"ngIf\", ctx.statisticArray);\n }\n },\n styles: [\".navtop[_ngcontent-%COMP%]{margin-top:3em}tr.mat-footer-row[_ngcontent-%COMP%]{font-weight:700}\"]\n });\n }\n return StatisticComponent;\n})();","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
|