forked from firka/firka
ref: kreta_api
This commit is contained in:
@@ -1581,12 +1581,12 @@ class LiveActivityService {
|
|||||||
final emptyType = NameUidDesc(
|
final emptyType = NameUidDesc(
|
||||||
uid: 'placeholder',
|
uid: 'placeholder',
|
||||||
name: 'Placeholder',
|
name: 'Placeholder',
|
||||||
description: null,
|
description: '',
|
||||||
);
|
);
|
||||||
final emptyState = NameUidDesc(
|
final emptyState = NameUidDesc(
|
||||||
uid: 'active',
|
uid: 'active',
|
||||||
name: 'Active',
|
name: 'Active',
|
||||||
description: null,
|
description: '',
|
||||||
);
|
);
|
||||||
|
|
||||||
placeholderLesson = Lesson(
|
placeholderLesson = Lesson(
|
||||||
|
|||||||
@@ -156,18 +156,7 @@ class _HomeGradesScreen extends FirkaState<HomeGradesScreen> {
|
|||||||
if (lessons != null && lessons!.response != null) {
|
if (lessons != null && lessons!.response != null) {
|
||||||
for (var lesson in lessons!.response!) {
|
for (var lesson in lessons!.response!) {
|
||||||
if (subjects.where((s) => s.uid == lesson.uid).isEmpty) {
|
if (subjects.where((s) => s.uid == lesson.uid).isEmpty) {
|
||||||
subjects.add(
|
subjects.add(lesson.subject);
|
||||||
Subject(
|
|
||||||
uid: lesson.uid,
|
|
||||||
name: lesson.name,
|
|
||||||
category: NameUidDesc(
|
|
||||||
uid: lesson.subjectCategoryId,
|
|
||||||
name: lesson.subjectCategoryName,
|
|
||||||
description: lesson.subjectCategoryDescription,
|
|
||||||
),
|
|
||||||
sortIndex: lesson.sortIndex,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
17
kreta_api/lib/src/extensions.dart
Normal file
17
kreta_api/lib/src/extensions.dart
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
extension JsonHelper on Map<String, dynamic> {
|
||||||
|
double? dbl(String key) {
|
||||||
|
final value = this[key];
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (value as num).toDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
DateTime? localDate(String key) {
|
||||||
|
final value = this[key];
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return DateTime.parse(value as String).toLocal();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
|
import '../extensions.dart';
|
||||||
import 'generic.dart';
|
import 'generic.dart';
|
||||||
|
import 'subject.dart';
|
||||||
|
|
||||||
class ClassGroup {
|
class ClassGroup {
|
||||||
final String uid;
|
final String uid;
|
||||||
@@ -27,17 +29,11 @@ class ClassGroup {
|
|||||||
return ClassGroup(
|
return ClassGroup(
|
||||||
uid: json['Uid'],
|
uid: json['Uid'],
|
||||||
name: json['Nev'],
|
name: json['Nev'],
|
||||||
headTeacher: json['OsztalyFonok'] != null
|
headTeacher: json.uid('OsztalyFonok'),
|
||||||
? UidObj.fromJson(json['OsztalyFonok'])
|
substituteHeadTeacher: json.uid('OsztalyFonokHelyettes'),
|
||||||
: null,
|
studyGroup: json.nameUidDesc('OktatasNevelesiKategoria')!,
|
||||||
substituteHeadTeacher: json['OsztalyFonokHelyettes'] != null
|
|
||||||
? UidObj.fromJson(json['OsztalyFonokHelyettes'])
|
|
||||||
: null,
|
|
||||||
studyGroup: NameUidDesc.fromJson(json['OktatasNevelesiKategoria']),
|
|
||||||
studyGroupSortIndex: json['OktatasNevelesiKategoriaSortIndex'],
|
studyGroupSortIndex: json['OktatasNevelesiKategoriaSortIndex'],
|
||||||
studyTask: json['OktatasNevelesiFeladat'] != null
|
studyTask: json.nameUidDesc('OktatasNevelesiFeladat'),
|
||||||
? NameUidDesc.fromJson(json['OktatasNevelesiFeladat'])
|
|
||||||
: null,
|
|
||||||
isActive: json['IsAktiv'],
|
isActive: json['IsAktiv'],
|
||||||
type: json['Tipus'],
|
type: json['Tipus'],
|
||||||
);
|
);
|
||||||
@@ -59,55 +55,32 @@ class ClassGroup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SubjectAverage {
|
class SubjectAverage extends UidObj {
|
||||||
final String uid;
|
final Subject subject;
|
||||||
final String name;
|
|
||||||
final String? teacherName;
|
|
||||||
final String subjectCategoryId;
|
|
||||||
final String subjectCategoryName;
|
|
||||||
final String subjectCategoryDescription;
|
|
||||||
final double? average;
|
final double? average;
|
||||||
final double? weightedSum;
|
final double? weightedSum;
|
||||||
final double? weightedCount;
|
final double? weightedCount;
|
||||||
final int sortIndex;
|
|
||||||
|
|
||||||
SubjectAverage({
|
SubjectAverage({
|
||||||
required this.uid,
|
required super.uid,
|
||||||
required this.name,
|
required this.subject,
|
||||||
this.teacherName,
|
|
||||||
required this.subjectCategoryId,
|
|
||||||
required this.subjectCategoryName,
|
|
||||||
required this.subjectCategoryDescription,
|
|
||||||
this.average,
|
this.average,
|
||||||
this.weightedSum,
|
this.weightedSum,
|
||||||
this.weightedCount,
|
this.weightedCount,
|
||||||
required this.sortIndex,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
factory SubjectAverage.fromJson(Map<String, dynamic> json) {
|
factory SubjectAverage.fromJson(Map<String, dynamic> json) {
|
||||||
final tantargy = json['Tantargy'] ?? {};
|
|
||||||
final kategori = tantargy['Kategoria'] ?? {};
|
|
||||||
|
|
||||||
return SubjectAverage(
|
return SubjectAverage(
|
||||||
uid: json['Uid'] ?? '',
|
uid: json['Uid'],
|
||||||
name: tantargy['Nev'] ?? '',
|
subject: Subject.fromJson(json['Tantargy']),
|
||||||
teacherName: json['TeacherName'],
|
average: json.dbl('Atlag'),
|
||||||
subjectCategoryId: kategori['Uid'] ?? '',
|
weightedSum: json.dbl('SulyozottOsztalyzatOsszege'),
|
||||||
subjectCategoryName: kategori['Nev'] ?? '',
|
weightedCount: json.dbl('SulyozottOsztalyzatSzama'),
|
||||||
subjectCategoryDescription: kategori['Leiras'] ?? '',
|
|
||||||
average: json['Atlag'] != null ? (json['Atlag'] as num).toDouble() : null,
|
|
||||||
weightedSum: json['SulyozottOsztalyzatOsszege'] != null
|
|
||||||
? (json['SulyozottOsztalyzatOsszege'] as num).toDouble()
|
|
||||||
: null,
|
|
||||||
weightedCount: json['SulyozottOsztalyzatSzama'] != null
|
|
||||||
? (json['SulyozottOsztalyzatSzama'] as num).toDouble()
|
|
||||||
: null,
|
|
||||||
sortIndex: tantargy['SortIndex'] ?? 0,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SubjectAverage(uid: "$uid", name: "$name", category: "$subjectCategoryName", average: $average)';
|
return 'SubjectAverage(uid: "$uid", name: "${subject.name}", category: "${subject.category.name}", average: $average)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
class NameUidDesc {
|
class NameUidDesc extends NameUid {
|
||||||
final String uid;
|
final String description;
|
||||||
final String? name;
|
|
||||||
final String? description;
|
|
||||||
|
|
||||||
NameUidDesc({
|
NameUidDesc({
|
||||||
required this.uid,
|
required super.uid,
|
||||||
required this.name,
|
required super.name,
|
||||||
required this.description,
|
required this.description,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -31,11 +29,10 @@ class NameUidDesc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class NameUid {
|
class NameUid extends UidObj {
|
||||||
final String uid;
|
|
||||||
final String name;
|
final String name;
|
||||||
|
|
||||||
NameUid({required this.uid, required this.name});
|
NameUid({required super.uid, required this.name});
|
||||||
|
|
||||||
factory NameUid.fromJson(Map<String, dynamic> json) {
|
factory NameUid.fromJson(Map<String, dynamic> json) {
|
||||||
return NameUid(uid: json['Uid'], name: json['Nev']);
|
return NameUid(uid: json['Uid'], name: json['Nev']);
|
||||||
@@ -62,3 +59,29 @@ class UidObj {
|
|||||||
')';
|
')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension ToUidObj on Map<String, dynamic> {
|
||||||
|
UidObj? uid(String key) {
|
||||||
|
final value = this[key];
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return UidObj.fromJson(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
NameUid? nameUid(String key) {
|
||||||
|
final value = this[key];
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return NameUid.fromJson(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
NameUidDesc? nameUidDesc(String key) {
|
||||||
|
final value = this[key];
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return NameUidDesc.fromJson(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import 'generic.dart';
|
import 'generic.dart';
|
||||||
import 'subject.dart';
|
import 'subject.dart';
|
||||||
|
|
||||||
class Grade {
|
class Grade extends UidObj {
|
||||||
final String uid;
|
|
||||||
final DateTime recordDate;
|
final DateTime recordDate;
|
||||||
final DateTime creationDate;
|
final DateTime creationDate;
|
||||||
final DateTime? ackDate;
|
final DateTime? ackDate;
|
||||||
@@ -21,7 +20,7 @@ class Grade {
|
|||||||
final int sortIndex;
|
final int sortIndex;
|
||||||
|
|
||||||
Grade({
|
Grade({
|
||||||
required this.uid,
|
required super.uid,
|
||||||
required this.recordDate,
|
required this.recordDate,
|
||||||
required this.creationDate,
|
required this.creationDate,
|
||||||
this.ackDate,
|
this.ackDate,
|
||||||
@@ -50,18 +49,16 @@ class Grade {
|
|||||||
: null,
|
: null,
|
||||||
subject: Subject.fromJson(json['Tantargy']),
|
subject: Subject.fromJson(json['Tantargy']),
|
||||||
topic: json['Tema'],
|
topic: json['Tema'],
|
||||||
type: NameUidDesc.fromJson(json['Tipus']),
|
type: json.nameUidDesc('Tipus')!,
|
||||||
mode: json['Mod'] != null ? NameUidDesc.fromJson(json['Mod']) : null,
|
mode: json.nameUidDesc('Mod'),
|
||||||
valueType: NameUidDesc.fromJson(json['ErtekFajta']),
|
valueType: json.nameUidDesc('ErtekFajta')!,
|
||||||
teacher: json['ErtekeloTanarNeve'],
|
teacher: json['ErtekeloTanarNeve'],
|
||||||
kind: json['Kind'],
|
kind: json['Kind'],
|
||||||
numericValue: json['SzamErtek'],
|
numericValue: json['SzamErtek'],
|
||||||
strValue: json['SzovegesErtek'],
|
strValue: json['SzovegesErtek'],
|
||||||
weightPercentage: json['SulySzazalekErteke'],
|
weightPercentage: json['SulySzazalekErteke'],
|
||||||
shortStrValue: json['SzovegesErtekelesRovidNev'],
|
shortStrValue: json['SzovegesErtekelesRovidNev'],
|
||||||
classGroup: json['OsztalyCsoport'] != null
|
classGroup: json.uid('OsztalyCsoport'),
|
||||||
? UidObj.fromJson(json['OsztalyCsoport'])
|
|
||||||
: null,
|
|
||||||
sortIndex: json['SortIndex'],
|
sortIndex: json['SortIndex'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
class Guardian {
|
import 'generic.dart';
|
||||||
|
|
||||||
|
class Guardian extends NameUid {
|
||||||
final String? email;
|
final String? email;
|
||||||
final bool isLegalRepresentative;
|
final bool isLegalRepresentative;
|
||||||
final String? name;
|
|
||||||
final String? phoneNumber;
|
final String? phoneNumber;
|
||||||
final String uid;
|
|
||||||
|
|
||||||
Guardian({
|
Guardian({
|
||||||
required this.email,
|
required this.email,
|
||||||
required this.isLegalRepresentative,
|
required this.isLegalRepresentative,
|
||||||
required this.name,
|
required super.name,
|
||||||
required this.phoneNumber,
|
required this.phoneNumber,
|
||||||
required this.uid,
|
required super.uid,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory Guardian.fromJson(Map<String, dynamic> json) {
|
factory Guardian.fromJson(Map<String, dynamic> json) {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import '../extensions.dart';
|
||||||
import 'generic.dart';
|
import 'generic.dart';
|
||||||
import 'subject.dart';
|
import 'subject.dart';
|
||||||
|
|
||||||
class Homework {
|
class Homework extends UidObj {
|
||||||
final String uid;
|
|
||||||
final Subject subject;
|
final Subject subject;
|
||||||
final String subjectName;
|
final String subjectName;
|
||||||
final String teacherName;
|
final String teacherName;
|
||||||
@@ -17,7 +17,7 @@ class Homework {
|
|||||||
final bool canAttach;
|
final bool canAttach;
|
||||||
|
|
||||||
Homework({
|
Homework({
|
||||||
required this.uid,
|
required super.uid,
|
||||||
required this.subject,
|
required this.subject,
|
||||||
required this.subjectName,
|
required this.subjectName,
|
||||||
required this.teacherName,
|
required this.teacherName,
|
||||||
@@ -39,13 +39,13 @@ class Homework {
|
|||||||
subjectName: json["TantargyNeve"],
|
subjectName: json["TantargyNeve"],
|
||||||
teacherName: json["RogzitoTanarNeve"],
|
teacherName: json["RogzitoTanarNeve"],
|
||||||
description: json["Szoveg"],
|
description: json["Szoveg"],
|
||||||
startDate: DateTime.parse(json["FeladasDatuma"]).toLocal(),
|
startDate: json.localDate("FeladasDatuma")!,
|
||||||
dueDate: DateTime.parse(json["HataridoDatuma"]).toLocal(),
|
dueDate: json.localDate("HataridoDatuma")!,
|
||||||
creationDate: DateTime.parse(json["RogzitesIdopontja"]).toLocal(),
|
creationDate: json.localDate("RogzitesIdopontja")!,
|
||||||
isCreatedByTeacher: json["IsTanarRogzitette"],
|
isCreatedByTeacher: json["IsTanarRogzitette"],
|
||||||
isDone: json["IsMegoldva"],
|
isDone: json["IsMegoldva"],
|
||||||
canBeSubmitted: json["IsBeadhato"],
|
canBeSubmitted: json["IsBeadhato"],
|
||||||
classGroup: UidObj.fromJson(json["OsztalyCsoport"]),
|
classGroup: json.uid("OsztalyCsoport")!,
|
||||||
canAttach: json["IsCsatolasEngedelyezes"],
|
canAttach: json["IsCsatolasEngedelyezes"],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
class Institution {
|
import 'generic.dart';
|
||||||
|
|
||||||
|
class Institution extends UidObj {
|
||||||
final CustomizationSettings customizationSettings;
|
final CustomizationSettings customizationSettings;
|
||||||
final String shortName;
|
final String shortName;
|
||||||
final List<SystemModule> systemModuleList;
|
final List<SystemModule> systemModuleList;
|
||||||
final String uid;
|
|
||||||
|
|
||||||
Institution({
|
Institution({
|
||||||
required this.customizationSettings,
|
required this.customizationSettings,
|
||||||
required this.shortName,
|
required this.shortName,
|
||||||
required this.systemModuleList,
|
required this.systemModuleList,
|
||||||
required this.uid,
|
required super.uid,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory Institution.fromJson(Map<String, dynamic> json) {
|
factory Institution.fromJson(Map<String, dynamic> json) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import '../extensions.dart';
|
||||||
import 'generic.dart';
|
import 'generic.dart';
|
||||||
|
|
||||||
class NoticeBoardItem {
|
class NoticeBoardItem extends UidObj {
|
||||||
final String uid;
|
|
||||||
final String author;
|
final String author;
|
||||||
final DateTime validFrom;
|
final DateTime validFrom;
|
||||||
final DateTime validTo;
|
final DateTime validTo;
|
||||||
@@ -10,7 +10,7 @@ class NoticeBoardItem {
|
|||||||
final String contentText;
|
final String contentText;
|
||||||
|
|
||||||
NoticeBoardItem({
|
NoticeBoardItem({
|
||||||
required this.uid,
|
required super.uid,
|
||||||
required this.author,
|
required this.author,
|
||||||
required this.validFrom,
|
required this.validFrom,
|
||||||
required this.validTo,
|
required this.validTo,
|
||||||
@@ -23,8 +23,8 @@ class NoticeBoardItem {
|
|||||||
return NoticeBoardItem(
|
return NoticeBoardItem(
|
||||||
uid: json['Uid'],
|
uid: json['Uid'],
|
||||||
author: json['RogzitoNeve'],
|
author: json['RogzitoNeve'],
|
||||||
validFrom: DateTime.parse(json['ErvenyessegKezdete']),
|
validFrom: json.localDate('ErvenyessegKezdete')!,
|
||||||
validTo: DateTime.parse(json['ErvenyessegVege']),
|
validTo: json.localDate('ErvenyessegVege')!,
|
||||||
title: json['Cim'],
|
title: json['Cim'],
|
||||||
contentHTML: json['Tartalom'],
|
contentHTML: json['Tartalom'],
|
||||||
contentText: json['TartalomText'],
|
contentText: json['TartalomText'],
|
||||||
@@ -45,8 +45,7 @@ class NoticeBoardItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class InfoBoardItem {
|
class InfoBoardItem extends UidObj {
|
||||||
final String uid;
|
|
||||||
final String title;
|
final String title;
|
||||||
final DateTime date;
|
final DateTime date;
|
||||||
final String author;
|
final String author;
|
||||||
@@ -56,7 +55,7 @@ class InfoBoardItem {
|
|||||||
final NameUidDesc type;
|
final NameUidDesc type;
|
||||||
|
|
||||||
InfoBoardItem({
|
InfoBoardItem({
|
||||||
required this.uid,
|
required super.uid,
|
||||||
required this.title,
|
required this.title,
|
||||||
required this.date,
|
required this.date,
|
||||||
required this.author,
|
required this.author,
|
||||||
@@ -70,12 +69,12 @@ class InfoBoardItem {
|
|||||||
return InfoBoardItem(
|
return InfoBoardItem(
|
||||||
uid: json['Uid'],
|
uid: json['Uid'],
|
||||||
title: json['Cim'],
|
title: json['Cim'],
|
||||||
date: DateTime.parse(json['Datum']),
|
date: json.localDate('Datum')!,
|
||||||
author: json['KeszitoTanarNeve'],
|
author: json['KeszitoTanarNeve'],
|
||||||
createdAt: DateTime.parse(json['KeszitesDatuma']),
|
createdAt: json.localDate('KeszitesDatuma')!,
|
||||||
contentText: json['Tartalom'],
|
contentText: json['Tartalom'],
|
||||||
contentHTML: json['TartalomFormazott'],
|
contentHTML: json['TartalomFormazott'],
|
||||||
type: NameUidDesc.fromJson(json['Tipus']),
|
type: json.nameUidDesc('Tipus')!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import '../extensions.dart';
|
||||||
import 'generic.dart';
|
import 'generic.dart';
|
||||||
import 'subject.dart';
|
import 'subject.dart';
|
||||||
|
|
||||||
class Omission {
|
class Omission extends UidObj {
|
||||||
final String uid;
|
|
||||||
final Subject subject;
|
final Subject subject;
|
||||||
final Class? c;
|
final Class? c;
|
||||||
final DateTime date;
|
final DateTime date;
|
||||||
@@ -16,7 +16,7 @@ class Omission {
|
|||||||
final UidObj? classGroup;
|
final UidObj? classGroup;
|
||||||
|
|
||||||
Omission({
|
Omission({
|
||||||
required this.uid,
|
required super.uid,
|
||||||
required this.subject,
|
required this.subject,
|
||||||
required this.c,
|
required this.c,
|
||||||
required this.date,
|
required this.date,
|
||||||
@@ -35,19 +35,15 @@ class Omission {
|
|||||||
uid: json['Uid'],
|
uid: json['Uid'],
|
||||||
subject: Subject.fromJson(json['Tantargy']),
|
subject: Subject.fromJson(json['Tantargy']),
|
||||||
c: json['Osztaly'] != null ? Class.fromJson(json['Osztaly']) : null,
|
c: json['Osztaly'] != null ? Class.fromJson(json['Osztaly']) : null,
|
||||||
date: DateTime.parse(json['Datum']).toLocal(),
|
date: json.localDate('Datum')!,
|
||||||
teacher: json['RogzitoTanarNeve'],
|
teacher: json['RogzitoTanarNeve'],
|
||||||
type: json['Tipus'] != null ? NameUidDesc.fromJson(json['Tipus']) : null,
|
type: json.nameUidDesc('Tipus'),
|
||||||
mode: json['Mod'] != null ? NameUidDesc.fromJson(json['Mod']) : null,
|
mode: json.nameUidDesc('Mod'),
|
||||||
lateForMin: json['KesesPercben'],
|
lateForMin: json['KesesPercben'],
|
||||||
createdAt: DateTime.parse(json['KeszitesDatuma']).toLocal(),
|
createdAt: json.localDate('KeszitesDatuma')!,
|
||||||
state: json['IgazolasAllapota'],
|
state: json['IgazolasAllapota'],
|
||||||
proofType: json['IgazolasTipusa'] != null
|
proofType: json.nameUidDesc('IgazolasTipusa'),
|
||||||
? NameUidDesc.fromJson(json['IgazolasTipusa'])
|
classGroup: json.uid('OsztalyCsoport'),
|
||||||
: null,
|
|
||||||
classGroup: json['OsztalyCsoport'] != null
|
|
||||||
? UidObj.fromJson(json['OsztalyCsoport'])
|
|
||||||
: null,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,8 +75,8 @@ class Class {
|
|||||||
|
|
||||||
factory Class.fromJson(Map<String, dynamic> json) {
|
factory Class.fromJson(Map<String, dynamic> json) {
|
||||||
return Class(
|
return Class(
|
||||||
start: DateTime.parse(json['KezdoDatum']).toLocal(),
|
start: json.localDate('KezdoDatum')!,
|
||||||
end: DateTime.parse(json['VegDatum']).toLocal(),
|
end: json.localDate('VegDatum')!,
|
||||||
classNo: json['Oraszam'],
|
classNo: json['Oraszam'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
import 'generic.dart';
|
import 'generic.dart';
|
||||||
|
|
||||||
class Subject {
|
class Subject extends NameUid {
|
||||||
final String uid;
|
|
||||||
final String name;
|
|
||||||
final NameUidDesc category;
|
final NameUidDesc category;
|
||||||
final int sortIndex;
|
final int sortIndex;
|
||||||
final String? teacherName;
|
final String? teacherName;
|
||||||
|
|
||||||
Subject({
|
Subject({
|
||||||
required this.uid,
|
required super.uid,
|
||||||
required this.name,
|
required super.name,
|
||||||
required this.category,
|
required this.category,
|
||||||
required this.sortIndex,
|
required this.sortIndex,
|
||||||
this.teacherName,
|
this.teacherName,
|
||||||
@@ -19,7 +17,7 @@ class Subject {
|
|||||||
return Subject(
|
return Subject(
|
||||||
uid: json['Uid'],
|
uid: json['Uid'],
|
||||||
name: json['Nev'],
|
name: json['Nev'],
|
||||||
category: NameUidDesc.fromJson(json['Kategoria']),
|
category: json.nameUidDesc('Kategoria')!,
|
||||||
sortIndex: json['SortIndex'],
|
sortIndex: json['SortIndex'],
|
||||||
teacherName: json['alkalmazottNev'],
|
teacherName: json['alkalmazottNev'],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import '../extensions.dart';
|
||||||
import 'generic.dart';
|
import 'generic.dart';
|
||||||
import 'subject.dart';
|
import 'subject.dart';
|
||||||
|
|
||||||
class Test {
|
class Test extends UidObj {
|
||||||
final String uid;
|
|
||||||
final DateTime date;
|
final DateTime date;
|
||||||
final DateTime reportDate;
|
final DateTime reportDate;
|
||||||
final String teacherName;
|
final String teacherName;
|
||||||
@@ -14,7 +14,7 @@ class Test {
|
|||||||
final UidObj classGroup;
|
final UidObj classGroup;
|
||||||
|
|
||||||
Test({
|
Test({
|
||||||
required this.uid,
|
required super.uid,
|
||||||
required this.date,
|
required this.date,
|
||||||
required this.reportDate,
|
required this.reportDate,
|
||||||
required this.teacherName,
|
required this.teacherName,
|
||||||
@@ -29,15 +29,15 @@ class Test {
|
|||||||
factory Test.fromJson(Map<String, dynamic> json) {
|
factory Test.fromJson(Map<String, dynamic> json) {
|
||||||
return Test(
|
return Test(
|
||||||
uid: json['Uid'],
|
uid: json['Uid'],
|
||||||
date: DateTime.parse(json['Datum']).toLocal(),
|
date: json.localDate('Datum')!,
|
||||||
reportDate: DateTime.parse(json['BejelentesDatuma']).toLocal(),
|
reportDate: json.localDate('BejelentesDatuma')!,
|
||||||
teacherName: json['RogzitoTanarNeve'],
|
teacherName: json['RogzitoTanarNeve'],
|
||||||
lessonNumber: json['OrarendiOraOraszama'],
|
lessonNumber: json['OrarendiOraOraszama'],
|
||||||
subject: Subject.fromJson(json['Tantargy']),
|
subject: Subject.fromJson(json['Tantargy']),
|
||||||
subjectName: json['TantargyNeve'],
|
subjectName: json['TantargyNeve'],
|
||||||
theme: json['Temaja'],
|
theme: json['Temaja'],
|
||||||
method: NameUidDesc.fromJson(json['Modja']),
|
method: json.nameUidDesc('Modja')!,
|
||||||
classGroup: UidObj.fromJson(json['OsztalyCsoport']),
|
classGroup: json.uid('OsztalyCsoport')!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
|
import '../extensions.dart';
|
||||||
import 'generic.dart';
|
import 'generic.dart';
|
||||||
import 'subject.dart';
|
import 'subject.dart';
|
||||||
|
|
||||||
class Lesson {
|
class Lesson extends NameUid {
|
||||||
final String uid;
|
|
||||||
final String date;
|
final String date;
|
||||||
final DateTime start;
|
final DateTime start;
|
||||||
final DateTime end;
|
final DateTime end;
|
||||||
final String name;
|
|
||||||
final int? lessonNumber;
|
final int? lessonNumber;
|
||||||
final int? lessonSeqNumber;
|
final int? lessonSeqNumber;
|
||||||
final NameUid? classGroup;
|
final NameUid? classGroup;
|
||||||
@@ -33,11 +32,11 @@ class Lesson {
|
|||||||
final DateTime lastModifiedAt;
|
final DateTime lastModifiedAt;
|
||||||
|
|
||||||
Lesson({
|
Lesson({
|
||||||
required this.uid,
|
required super.uid,
|
||||||
required this.date,
|
required this.date,
|
||||||
required this.start,
|
required this.start,
|
||||||
required this.end,
|
required this.end,
|
||||||
required this.name,
|
required super.name,
|
||||||
this.lessonNumber,
|
this.lessonNumber,
|
||||||
this.lessonSeqNumber,
|
this.lessonSeqNumber,
|
||||||
this.classGroup,
|
this.classGroup,
|
||||||
@@ -74,25 +73,21 @@ class Lesson {
|
|||||||
return Lesson(
|
return Lesson(
|
||||||
uid: json['Uid'],
|
uid: json['Uid'],
|
||||||
date: json['Datum'],
|
date: json['Datum'],
|
||||||
start: DateTime.parse(json['KezdetIdopont']).toLocal(),
|
start: json.localDate('KezdetIdopont')!,
|
||||||
end: DateTime.parse(json['VegIdopont']).toLocal(),
|
end: json.localDate('VegIdopont')!,
|
||||||
name: json['Nev'],
|
name: json['Nev'],
|
||||||
lessonNumber: json['Oraszam'],
|
lessonNumber: json['Oraszam'],
|
||||||
lessonSeqNumber: json['OraEvesSorszama'],
|
lessonSeqNumber: json['OraEvesSorszama'],
|
||||||
classGroup: json['OsztalyCsoport'] != null
|
classGroup: json.nameUid('OsztalyCsoport'),
|
||||||
? NameUid.fromJson(json['OsztalyCsoport'])
|
|
||||||
: null,
|
|
||||||
teacher: json['TanarNeve'],
|
teacher: json['TanarNeve'],
|
||||||
subject: json['Tantargy'] != null
|
subject: json['Tantargy'] != null
|
||||||
? Subject.fromJson(json['Tantargy'])
|
? Subject.fromJson(json['Tantargy'])
|
||||||
: null,
|
: null,
|
||||||
theme: json['Tema'],
|
theme: json['Tema'],
|
||||||
roomName: json['TeremNeve'],
|
roomName: json['TeremNeve'],
|
||||||
type: NameUidDesc.fromJson(json['Tipus']),
|
type: json.nameUidDesc('Tipus')!,
|
||||||
studentPresence: json['TanuloJelenlet'] != null
|
studentPresence: json.nameUidDesc('TanuloJelenlet'),
|
||||||
? NameUidDesc.fromJson(json['TanuloJelenlet'])
|
state: json.nameUidDesc('Allapot')!,
|
||||||
: null,
|
|
||||||
state: NameUidDesc.fromJson(json['Allapot']),
|
|
||||||
substituteTeacher: json['HelyettesTanarNeve'],
|
substituteTeacher: json['HelyettesTanarNeve'],
|
||||||
homeworkUid: json['HaziFeladatUid'],
|
homeworkUid: json['HaziFeladatUid'],
|
||||||
taskGroupUid: json['FeladatGroupUid'],
|
taskGroupUid: json['FeladatGroupUid'],
|
||||||
@@ -108,8 +103,8 @@ class Lesson {
|
|||||||
json['DigitalisTamogatoEszkozTipusList'] != null
|
json['DigitalisTamogatoEszkozTipusList'] != null
|
||||||
? List<String>.from(json['DigitalisTamogatoEszkozTipusList'])
|
? List<String>.from(json['DigitalisTamogatoEszkozTipusList'])
|
||||||
: List<String>.empty(),
|
: List<String>.empty(),
|
||||||
createdAt: DateTime.parse(json['Letrehozas']).toLocal(),
|
createdAt: json.localDate('Letrehozas')!,
|
||||||
lastModifiedAt: DateTime.parse(json['UtolsoModositas']).toLocal(),
|
lastModifiedAt: json.localDate('UtolsoModositas')!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user