forked from firka/student-legacy
half done absences page
This commit is contained in:
parent
697ed43e5a
commit
73db67c4e3
@ -15,6 +15,7 @@ class StatisticsTile extends StatelessWidget {
|
|||||||
this.valueSuffix = '',
|
this.valueSuffix = '',
|
||||||
this.fill = false,
|
this.fill = false,
|
||||||
this.outline = false,
|
this.outline = false,
|
||||||
|
this.showZero,
|
||||||
});
|
});
|
||||||
|
|
||||||
final double value;
|
final double value;
|
||||||
@ -24,6 +25,7 @@ class StatisticsTile extends StatelessWidget {
|
|||||||
final String valueSuffix;
|
final String valueSuffix;
|
||||||
final bool fill;
|
final bool fill;
|
||||||
final bool outline;
|
final bool outline;
|
||||||
|
final bool? showZero;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -37,7 +39,7 @@ class StatisticsTile extends StatelessWidget {
|
|||||||
valueText = valueText.replaceAll(".", ",");
|
valueText = valueText.replaceAll(".", ",");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.isNaN || value == 0) {
|
if ((value.isNaN || value == 0) && showZero != true) {
|
||||||
valueText = "?";
|
valueText = "?";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import 'dart:math';
|
|||||||
import 'package:animations/animations.dart';
|
import 'package:animations/animations.dart';
|
||||||
import 'package:auto_size_text/auto_size_text.dart';
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:refilc/api/providers/update_provider.dart';
|
import 'package:refilc/api/providers/update_provider.dart';
|
||||||
|
import 'package:refilc/theme/colors/utils.dart';
|
||||||
import 'package:refilc/ui/date_widget.dart';
|
import 'package:refilc/ui/date_widget.dart';
|
||||||
import 'package:refilc_kreta_api/models/absence.dart';
|
import 'package:refilc_kreta_api/models/absence.dart';
|
||||||
import 'package:refilc_kreta_api/models/lesson.dart';
|
import 'package:refilc_kreta_api/models/lesson.dart';
|
||||||
@ -21,6 +22,7 @@ import 'package:refilc_mobile_ui/common/filter_bar.dart';
|
|||||||
import 'package:refilc_mobile_ui/common/panel/panel.dart';
|
import 'package:refilc_mobile_ui/common/panel/panel.dart';
|
||||||
import 'package:refilc_mobile_ui/common/profile_image/profile_button.dart';
|
import 'package:refilc_mobile_ui/common/profile_image/profile_button.dart';
|
||||||
import 'package:refilc_mobile_ui/common/profile_image/profile_image.dart';
|
import 'package:refilc_mobile_ui/common/profile_image/profile_image.dart';
|
||||||
|
import 'package:refilc_mobile_ui/common/splitted_panel/splitted_panel.dart';
|
||||||
import 'package:refilc_mobile_ui/common/widgets/absence/absence_subject_tile.dart';
|
import 'package:refilc_mobile_ui/common/widgets/absence/absence_subject_tile.dart';
|
||||||
import 'package:refilc_mobile_ui/common/widgets/absence/absence_viewable.dart';
|
import 'package:refilc_mobile_ui/common/widgets/absence/absence_viewable.dart';
|
||||||
import 'package:refilc_mobile_ui/common/widgets/statistics_tile.dart';
|
import 'package:refilc_mobile_ui/common/widgets/statistics_tile.dart';
|
||||||
@ -348,6 +350,7 @@ class AbsencesPageState extends State<AbsencesPage>
|
|||||||
(index == 0 && activeData == 0)) {
|
(index == 0 && activeData == 0)) {
|
||||||
int value1 = 0;
|
int value1 = 0;
|
||||||
int value2 = 0;
|
int value2 = 0;
|
||||||
|
int value3 = 0;
|
||||||
String title1 = "";
|
String title1 = "";
|
||||||
String title2 = "";
|
String title2 = "";
|
||||||
String suffix = "";
|
String suffix = "";
|
||||||
@ -361,6 +364,10 @@ class AbsencesPageState extends State<AbsencesPage>
|
|||||||
.where((e) =>
|
.where((e) =>
|
||||||
e.delay == 0 && e.state == Justification.unexcused)
|
e.delay == 0 && e.state == Justification.unexcused)
|
||||||
.length;
|
.length;
|
||||||
|
value3 = absenceProvider.absences
|
||||||
|
.where((e) =>
|
||||||
|
e.delay == 0 && e.state == Justification.pending)
|
||||||
|
.length;
|
||||||
title1 = "stat_1".i18n;
|
title1 = "stat_1".i18n;
|
||||||
title2 = "stat_2".i18n;
|
title2 = "stat_2".i18n;
|
||||||
suffix = " ${"hr".i18n}";
|
suffix = " ${"hr".i18n}";
|
||||||
@ -375,6 +382,11 @@ class AbsencesPageState extends State<AbsencesPage>
|
|||||||
e.delay != 0 && e.state == Justification.unexcused)
|
e.delay != 0 && e.state == Justification.unexcused)
|
||||||
.map((e) => e.delay)
|
.map((e) => e.delay)
|
||||||
.fold(0, (a, b) => a + b);
|
.fold(0, (a, b) => a + b);
|
||||||
|
value3 = absenceProvider.absences
|
||||||
|
.where((e) =>
|
||||||
|
e.delay != 0 && e.state == Justification.pending)
|
||||||
|
.map((e) => e.delay)
|
||||||
|
.fold(0, (a, b) => a + b);
|
||||||
title1 = "stat_3".i18n;
|
title1 = "stat_3".i18n;
|
||||||
title2 = "stat_4".i18n;
|
title2 = "stat_4".i18n;
|
||||||
suffix = " ${"min".i18n}";
|
suffix = " ${"min".i18n}";
|
||||||
@ -382,44 +394,169 @@ class AbsencesPageState extends State<AbsencesPage>
|
|||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
bottom: 24.0, left: 24.0, right: 24.0),
|
bottom: 20.0, left: 24.0, right: 24.0),
|
||||||
child: Row(children: [
|
child: Row(children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: StatisticsTile(
|
child: SplittedPanel(
|
||||||
title: AutoSizeText(
|
padding: EdgeInsets.zero,
|
||||||
title1,
|
cardPadding: const EdgeInsets.symmetric(
|
||||||
textAlign: TextAlign.center,
|
vertical: 16.0,
|
||||||
maxLines: 2,
|
horizontal: 18.0,
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
),
|
||||||
valueSuffix: suffix,
|
spacing: 8.0,
|
||||||
value: value1.toDouble(),
|
children: [
|
||||||
decimal: false,
|
Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
value1.toString() + suffix,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.0,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
color: AppColors.of(context).green,
|
color: AppColors.of(context).green,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 24.0),
|
Text(
|
||||||
Expanded(
|
title1,
|
||||||
child: StatisticsTile(
|
style: TextStyle(
|
||||||
title: AutoSizeText(
|
fontSize: 16.0,
|
||||||
title2,
|
fontWeight: FontWeight.w500,
|
||||||
textAlign: TextAlign.center,
|
height: 1.1,
|
||||||
maxLines: 2,
|
color: ColorsUtils().darken(
|
||||||
overflow: TextOverflow.ellipsis,
|
AppColors.of(context).green,
|
||||||
|
amount: 0.5,
|
||||||
),
|
),
|
||||||
valueSuffix: suffix,
|
),
|
||||||
value: value2.toDouble(),
|
),
|
||||||
decimal: false,
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 18.0,
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
value2.toString() + suffix,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.0,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
color: AppColors.of(context).red,
|
color: AppColors.of(context).red,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Text(
|
||||||
|
title2,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
height: 1.1,
|
||||||
|
color: ColorsUtils().darken(
|
||||||
|
AppColors.of(context).red,
|
||||||
|
amount: 0.4,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
// Column(
|
||||||
|
// children: [
|
||||||
|
// // ide kell valami csik widget diagram idk
|
||||||
|
// // es ala ez
|
||||||
|
// Row(
|
||||||
|
// mainAxisAlignment:
|
||||||
|
// MainAxisAlignment.spaceBetween,
|
||||||
|
// children: [
|
||||||
|
// Text(
|
||||||
|
// "sept".i18n,
|
||||||
|
// ),
|
||||||
|
// Text("now".i18n),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Icon(
|
||||||
|
Icons.av_timer_rounded,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10.0,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"pending".i18n,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
value3.toString() + suffix,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: AppColors.of(context)
|
||||||
|
.text
|
||||||
|
.withOpacity(0.8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Expanded(
|
||||||
|
// child: StatisticsTile(
|
||||||
|
// title: AutoSizeText(
|
||||||
|
// title1,
|
||||||
|
// textAlign: TextAlign.center,
|
||||||
|
// maxLines: 2,
|
||||||
|
// overflow: TextOverflow.ellipsis,
|
||||||
|
// ),
|
||||||
|
// valueSuffix: suffix,
|
||||||
|
// value: value1.toDouble(),
|
||||||
|
// decimal: false,
|
||||||
|
// showZero: true,
|
||||||
|
// color: AppColors.of(context).green,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// const SizedBox(width: 24.0),
|
||||||
|
// Expanded(
|
||||||
|
// child: StatisticsTile(
|
||||||
|
// title: AutoSizeText(
|
||||||
|
// title2,
|
||||||
|
// textAlign: TextAlign.center,
|
||||||
|
// maxLines: 2,
|
||||||
|
// overflow: TextOverflow.ellipsis,
|
||||||
|
// ),
|
||||||
|
// valueSuffix: suffix,
|
||||||
|
// value: value2.toDouble(),
|
||||||
|
// decimal: false,
|
||||||
|
// showZero: true,
|
||||||
|
// color: AppColors.of(context).red,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding:
|
padding: const EdgeInsets.only(
|
||||||
const EdgeInsets.symmetric(horizontal: 24.0, vertical: 6.0),
|
left: 24.0, right: 24.0, bottom: 12.0),
|
||||||
child: filterWidgets[index - (activeData <= 1 ? 1 : 0)],
|
child: filterWidgets[index - (activeData <= 1 ? 1 : 0)],
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -9,16 +9,20 @@ extension ScreensLocalization on String {
|
|||||||
"Misses": "Misses",
|
"Misses": "Misses",
|
||||||
"emptyDelays": "You have no delays.",
|
"emptyDelays": "You have no delays.",
|
||||||
"emptyMisses": "You have no missing homeworks or equipments.",
|
"emptyMisses": "You have no missing homeworks or equipments.",
|
||||||
"stat_1": "Excused Absences",
|
"stat_1": "Excused",
|
||||||
"stat_2": "Unexcused Absences",
|
"stat_2": "Unexcused",
|
||||||
"stat_3": "Excused Delay",
|
"stat_3": "Excused",
|
||||||
"stat_4": "Unexcused Delay",
|
"stat_4": "Unexcused",
|
||||||
"min": "min",
|
"min": "min",
|
||||||
"hr": "hrs",
|
"hr": "hrs",
|
||||||
"Subjects": "Subjects",
|
"Subjects": "Subjects",
|
||||||
"attention": "Attention!",
|
"attention": "Attention!",
|
||||||
"attention_body": "Percentage calculations are only an approximation so they may not be accurate.",
|
"attention_body":
|
||||||
|
"Percentage calculations are only an approximation so they may not be accurate.",
|
||||||
"lesson_not_found": "Cannot find lesson",
|
"lesson_not_found": "Cannot find lesson",
|
||||||
|
"pending": "Pending",
|
||||||
|
"sept": "September",
|
||||||
|
"now": "Now",
|
||||||
},
|
},
|
||||||
"hu_hu": {
|
"hu_hu": {
|
||||||
"Absences": "Hiányzások",
|
"Absences": "Hiányzások",
|
||||||
@ -26,33 +30,42 @@ extension ScreensLocalization on String {
|
|||||||
"Misses": "Hiányok",
|
"Misses": "Hiányok",
|
||||||
"emptyDelays": "Nincsenek késéseid.",
|
"emptyDelays": "Nincsenek késéseid.",
|
||||||
"emptyMisses": "Nincsenek hiányzó házi feladataid, felszereléseid.",
|
"emptyMisses": "Nincsenek hiányzó házi feladataid, felszereléseid.",
|
||||||
"stat_1": "Igazolt hiányzások",
|
"stat_1": "Igazolt",
|
||||||
"stat_2": "Igazolatlan hiányzások",
|
"stat_2": "Igazolatlan",
|
||||||
"stat_3": "Igazolt Késés",
|
"stat_3": "Igazolt",
|
||||||
"stat_4": "Igazolatlan Késés",
|
"stat_4": "Igazolatlan",
|
||||||
"min": "perc",
|
"min": "perc",
|
||||||
"hr": "óra",
|
"hr": "óra",
|
||||||
"Subjects": "Tantárgyak",
|
"Subjects": "Tantárgyak",
|
||||||
"attention": "Figyelem!",
|
"attention": "Figyelem!",
|
||||||
"attention_body": "A százalékos számítások csak közelítések, ezért előfordulhat, hogy nem pontosak.",
|
"attention_body":
|
||||||
|
"A százalékos számítások csak közelítések, ezért előfordulhat, hogy nem pontosak.",
|
||||||
"lesson_not_found": "Nem található óra",
|
"lesson_not_found": "Nem található óra",
|
||||||
|
"pending": "Függőben",
|
||||||
|
"sept": "Szeptember",
|
||||||
|
"now": "Most",
|
||||||
},
|
},
|
||||||
"de_de": {
|
"de_de": {
|
||||||
"Absences": "Fehlen",
|
"Absences": "Fehlen",
|
||||||
"Delays": "Verspätung",
|
"Delays": "Verspätung",
|
||||||
"Misses": "Fehlt",
|
"Misses": "Fehlt",
|
||||||
"emptyDelays": "Sie haben keine Abwesenheiten.",
|
"emptyDelays": "Sie haben keine Abwesenheiten.",
|
||||||
"emptyMisses": "Sie haben noch keine fehlende Hausaufgaben oder Austattung.",
|
"emptyMisses":
|
||||||
"stat_1": "Entschuldigte Fehlen",
|
"Sie haben noch keine fehlende Hausaufgaben oder Austattung.",
|
||||||
"stat_2": "Unentschuldigte Fehlen",
|
"stat_1": "Entschuldigte",
|
||||||
"stat_3": "Entschuldigte Verspätung",
|
"stat_2": "Unentschuldigte",
|
||||||
"stat_4": "Unentschuldigte Verspätung",
|
"stat_3": "Entschuldigte",
|
||||||
|
"stat_4": "Unentschuldigte",
|
||||||
"min": "min",
|
"min": "min",
|
||||||
"hr": "hrs",
|
"hr": "hrs",
|
||||||
"Subjects": "Fächer",
|
"Subjects": "Fächer",
|
||||||
"attention": "Achtung!",
|
"attention": "Achtung!",
|
||||||
"attention_body": "Prozentberechnungen sind nur eine Annäherung und können daher ungenau sein.",
|
"attention_body":
|
||||||
|
"Prozentberechnungen sind nur eine Annäherung und können daher ungenau sein.",
|
||||||
"lesson_not_found": "Lektion kann nicht gefunden werden",
|
"lesson_not_found": "Lektion kann nicht gefunden werden",
|
||||||
|
"pending": "Anhängig",
|
||||||
|
"sept": "September",
|
||||||
|
"now": "Jetzt",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user