igen
This commit is contained in:
@@ -1,76 +1,76 @@
|
||||
import "category.dart";
|
||||
import "subject.dart";
|
||||
|
||||
class Absence {
|
||||
Map? json;
|
||||
String id;
|
||||
DateTime date;
|
||||
int delay;
|
||||
DateTime submitDate;
|
||||
String teacher;
|
||||
Justification state;
|
||||
Category? justification;
|
||||
Category? type;
|
||||
Category? mode;
|
||||
Subject subject;
|
||||
DateTime lessonStart;
|
||||
DateTime lessonEnd;
|
||||
int? lessonIndex;
|
||||
String group;
|
||||
|
||||
Absence({
|
||||
required this.id,
|
||||
required this.date,
|
||||
required this.delay,
|
||||
required this.submitDate,
|
||||
required this.teacher,
|
||||
required this.state,
|
||||
this.justification,
|
||||
this.type,
|
||||
this.mode,
|
||||
required this.subject,
|
||||
required this.lessonStart,
|
||||
required this.lessonEnd,
|
||||
this.lessonIndex,
|
||||
required this.group,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Absence.fromJson(Map json) {
|
||||
DateTime lessonStart;
|
||||
DateTime lessonEnd;
|
||||
int? lessonIndex;
|
||||
if (json["Ora"] != null) {
|
||||
lessonStart = json["Ora"]["KezdoDatum"] != null ? DateTime.parse(json["Ora"]["KezdoDatum"]).toLocal() : DateTime(0);
|
||||
lessonEnd = json["Ora"]["VegDatum"] != null ? DateTime.parse(json["Ora"]["VegDatum"]).toLocal() : DateTime(0);
|
||||
lessonIndex = json["Ora"]["Oraszam"];
|
||||
} else {
|
||||
lessonStart = DateTime(0);
|
||||
lessonEnd = DateTime(0);
|
||||
}
|
||||
|
||||
return Absence(
|
||||
id: json["Uid"],
|
||||
date: json["Datum"] != null ? DateTime.parse(json["Datum"]).toLocal() : DateTime(0),
|
||||
delay: json["KesesPercben"] ?? 0,
|
||||
submitDate: json["KeszitesDatuma"] != null ? DateTime.parse(json["KeszitesDatuma"]).toLocal() : DateTime(0),
|
||||
teacher: (json["RogzitoTanarNeve"] ?? "").trim(),
|
||||
state: json["IgazolasAllapota"] == "Igazolt"
|
||||
? Justification.excused
|
||||
: json["IgazolasAllapota"] == "Igazolando"
|
||||
? Justification.pending
|
||||
: Justification.unexcused,
|
||||
justification: json["IgazolasTipusa"] != null ? Category.fromJson(json["IgazolasTipusa"]) : null,
|
||||
type: json["Tipus"] != null ? Category.fromJson(json["Tipus"]) : null,
|
||||
mode: json["Mod"] != null ? Category.fromJson(json["Mod"]) : null,
|
||||
subject: Subject.fromJson(json["Tantargy"] ?? {}),
|
||||
lessonStart: lessonStart,
|
||||
lessonEnd: lessonEnd,
|
||||
lessonIndex: lessonIndex,
|
||||
group: json["OsztalyCsoport"] != null ? json["OsztalyCsoport"]["Uid"] : "",
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
import "category.dart";
|
||||
import "subject.dart";
|
||||
|
||||
class Absence {
|
||||
Map? json;
|
||||
String id;
|
||||
DateTime date;
|
||||
int delay;
|
||||
DateTime submitDate;
|
||||
String teacher;
|
||||
Justification state;
|
||||
Category? justification;
|
||||
Category? type;
|
||||
Category? mode;
|
||||
Subject subject;
|
||||
DateTime lessonStart;
|
||||
DateTime lessonEnd;
|
||||
int? lessonIndex;
|
||||
String group;
|
||||
|
||||
Absence({
|
||||
required this.id,
|
||||
required this.date,
|
||||
required this.delay,
|
||||
required this.submitDate,
|
||||
required this.teacher,
|
||||
required this.state,
|
||||
this.justification,
|
||||
this.type,
|
||||
this.mode,
|
||||
required this.subject,
|
||||
required this.lessonStart,
|
||||
required this.lessonEnd,
|
||||
this.lessonIndex,
|
||||
required this.group,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Absence.fromJson(Map json) {
|
||||
DateTime lessonStart;
|
||||
DateTime lessonEnd;
|
||||
int? lessonIndex;
|
||||
if (json["Ora"] != null) {
|
||||
lessonStart = json["Ora"]["KezdoDatum"] != null ? DateTime.parse(json["Ora"]["KezdoDatum"]).toLocal() : DateTime(0);
|
||||
lessonEnd = json["Ora"]["VegDatum"] != null ? DateTime.parse(json["Ora"]["VegDatum"]).toLocal() : DateTime(0);
|
||||
lessonIndex = json["Ora"]["Oraszam"];
|
||||
} else {
|
||||
lessonStart = DateTime(0);
|
||||
lessonEnd = DateTime(0);
|
||||
}
|
||||
|
||||
return Absence(
|
||||
id: json["Uid"],
|
||||
date: json["Datum"] != null ? DateTime.parse(json["Datum"]).toLocal() : DateTime(0),
|
||||
delay: json["KesesPercben"] ?? 0,
|
||||
submitDate: json["KeszitesDatuma"] != null ? DateTime.parse(json["KeszitesDatuma"]).toLocal() : DateTime(0),
|
||||
teacher: (json["RogzitoTanarNeve"] ?? "").trim(),
|
||||
state: json["IgazolasAllapota"] == "Igazolt"
|
||||
? Justification.excused
|
||||
: json["IgazolasAllapota"] == "Igazolando"
|
||||
? Justification.pending
|
||||
: Justification.unexcused,
|
||||
justification: json["IgazolasTipusa"] != null ? Category.fromJson(json["IgazolasTipusa"]) : null,
|
||||
type: json["Tipus"] != null ? Category.fromJson(json["Tipus"]) : null,
|
||||
mode: json["Mod"] != null ? Category.fromJson(json["Mod"]) : null,
|
||||
subject: Subject.fromJson(json["Tantargy"] ?? {}),
|
||||
lessonStart: lessonStart,
|
||||
lessonEnd: lessonEnd,
|
||||
lessonIndex: lessonIndex,
|
||||
group: json["OsztalyCsoport"] != null ? json["OsztalyCsoport"]["Uid"] : "",
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
enum Justification { excused, unexcused, pending }
|
||||
@@ -1,32 +1,32 @@
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:filcnaplo_kreta_api/client/api.dart';
|
||||
|
||||
class Attachment {
|
||||
Map? json;
|
||||
int id;
|
||||
PlatformFile? file;
|
||||
String name;
|
||||
String? fileId;
|
||||
String kretaFilePath;
|
||||
|
||||
Attachment({
|
||||
required this.id,
|
||||
this.file,
|
||||
required this.name,
|
||||
this.fileId,
|
||||
required this.kretaFilePath,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Attachment.fromJson(Map json) {
|
||||
return Attachment(
|
||||
id: json["azonosito"],
|
||||
name: (json["fajlNev"] ?? "attachment").trim(),
|
||||
kretaFilePath: json["utvonal"] ?? "",
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
|
||||
String get downloadUrl => KretaAPI.downloadAttachment(id.toString());
|
||||
bool get isImage => name.endsWith(".jpg") || name.endsWith(".jpeg") || name.endsWith(".png");
|
||||
}
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:filcnaplo_kreta_api/client/api.dart';
|
||||
|
||||
class Attachment {
|
||||
Map? json;
|
||||
int id;
|
||||
PlatformFile? file;
|
||||
String name;
|
||||
String? fileId;
|
||||
String kretaFilePath;
|
||||
|
||||
Attachment({
|
||||
required this.id,
|
||||
this.file,
|
||||
required this.name,
|
||||
this.fileId,
|
||||
required this.kretaFilePath,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Attachment.fromJson(Map json) {
|
||||
return Attachment(
|
||||
id: json["azonosito"],
|
||||
name: (json["fajlNev"] ?? "attachment").trim(),
|
||||
kretaFilePath: json["utvonal"] ?? "",
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
|
||||
String get downloadUrl => KretaAPI.downloadAttachment(id.toString());
|
||||
bool get isImage => name.endsWith(".jpg") || name.endsWith(".jpeg") || name.endsWith(".png");
|
||||
}
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
import 'grade.dart';
|
||||
|
||||
class Category {
|
||||
String id;
|
||||
String description;
|
||||
String name;
|
||||
|
||||
Category({
|
||||
required this.id,
|
||||
this.description = "",
|
||||
this.name = "",
|
||||
});
|
||||
|
||||
factory Category.fromJson(Map json) {
|
||||
return Category(
|
||||
id: json["Uid"] ?? "",
|
||||
description: json["Leiras"] != "Na" ? json["Leiras"] ?? "" : "",
|
||||
name: json["Nev"] != "Na" ? json["Nev"] ?? "" : "",
|
||||
);
|
||||
}
|
||||
|
||||
static GradeType getGradeType(String string) {
|
||||
switch (string) {
|
||||
case "evkozi_jegy_ertekeles":
|
||||
return GradeType.midYear;
|
||||
case "I_ne_jegy_ertekeles":
|
||||
return GradeType.firstQ;
|
||||
case "II_ne_jegy_ertekeles":
|
||||
return GradeType.secondQ;
|
||||
case "felevi_jegy_ertekeles":
|
||||
return GradeType.halfYear;
|
||||
case "III_ne_jegy_ertekeles":
|
||||
return GradeType.thirdQ;
|
||||
case "IV_ne_jegy_ertekeles":
|
||||
return GradeType.fourthQ;
|
||||
case "evvegi_jegy_ertekeles":
|
||||
return GradeType.endYear;
|
||||
case "osztalyozo_vizsga":
|
||||
return GradeType.levelExam;
|
||||
default:
|
||||
return GradeType.unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
import 'grade.dart';
|
||||
|
||||
class Category {
|
||||
String id;
|
||||
String description;
|
||||
String name;
|
||||
|
||||
Category({
|
||||
required this.id,
|
||||
this.description = "",
|
||||
this.name = "",
|
||||
});
|
||||
|
||||
factory Category.fromJson(Map json) {
|
||||
return Category(
|
||||
id: json["Uid"] ?? "",
|
||||
description: json["Leiras"] != "Na" ? json["Leiras"] ?? "" : "",
|
||||
name: json["Nev"] != "Na" ? json["Nev"] ?? "" : "",
|
||||
);
|
||||
}
|
||||
|
||||
static GradeType getGradeType(String string) {
|
||||
switch (string) {
|
||||
case "evkozi_jegy_ertekeles":
|
||||
return GradeType.midYear;
|
||||
case "I_ne_jegy_ertekeles":
|
||||
return GradeType.firstQ;
|
||||
case "II_ne_jegy_ertekeles":
|
||||
return GradeType.secondQ;
|
||||
case "felevi_jegy_ertekeles":
|
||||
return GradeType.halfYear;
|
||||
case "III_ne_jegy_ertekeles":
|
||||
return GradeType.thirdQ;
|
||||
case "IV_ne_jegy_ertekeles":
|
||||
return GradeType.fourthQ;
|
||||
case "evvegi_jegy_ertekeles":
|
||||
return GradeType.endYear;
|
||||
case "osztalyozo_vizsga":
|
||||
return GradeType.levelExam;
|
||||
default:
|
||||
return GradeType.unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
class Event {
|
||||
Map? json;
|
||||
String id;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
String title;
|
||||
String content;
|
||||
|
||||
Event({
|
||||
required this.id,
|
||||
required this.start,
|
||||
required this.end,
|
||||
this.title = "",
|
||||
this.content = "",
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Event.fromJson(Map json) {
|
||||
return Event(
|
||||
id: json["Uid"] ?? "",
|
||||
start: json["ErvenyessegKezdete"] != null ? DateTime.parse(json["ErvenyessegKezdete"]).toLocal() : DateTime(0),
|
||||
end: json["ErvenyessegVege"] != null ? DateTime.parse(json["ErvenyessegVege"]).toLocal() : DateTime(0),
|
||||
title: json["Cim"] ?? "",
|
||||
content: json["Tartalom"] != null ? json["Tartalom"].replaceAll("\r", "") : "",
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
class Event {
|
||||
Map? json;
|
||||
String id;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
String title;
|
||||
String content;
|
||||
|
||||
Event({
|
||||
required this.id,
|
||||
required this.start,
|
||||
required this.end,
|
||||
this.title = "",
|
||||
this.content = "",
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Event.fromJson(Map json) {
|
||||
return Event(
|
||||
id: json["Uid"] ?? "",
|
||||
start: json["ErvenyessegKezdete"] != null ? DateTime.parse(json["ErvenyessegKezdete"]).toLocal() : DateTime(0),
|
||||
end: json["ErvenyessegVege"] != null ? DateTime.parse(json["ErvenyessegVege"]).toLocal() : DateTime(0),
|
||||
title: json["Cim"] ?? "",
|
||||
content: json["Tartalom"] != null ? json["Tartalom"].replaceAll("\r", "") : "",
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
import 'category.dart';
|
||||
|
||||
class Exam {
|
||||
Map? json;
|
||||
DateTime date;
|
||||
DateTime writeDate;
|
||||
Category? mode;
|
||||
int? subjectIndex;
|
||||
String subjectName;
|
||||
String teacher;
|
||||
String description;
|
||||
String group;
|
||||
String id;
|
||||
|
||||
Exam({
|
||||
required this.id,
|
||||
required this.date,
|
||||
required this.writeDate,
|
||||
this.mode,
|
||||
this.subjectIndex,
|
||||
required this.subjectName,
|
||||
required this.teacher,
|
||||
required this.description,
|
||||
required this.group,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Exam.fromJson(Map json) {
|
||||
return Exam(
|
||||
id: json["Uid"] ?? "",
|
||||
date: json["BejelentesDatuma"] != null ? DateTime.parse(json["BejelentesDatuma"]).toLocal() : DateTime(0),
|
||||
writeDate: json["Datum"] != null ? DateTime.parse(json["Datum"]).toLocal() : DateTime(0),
|
||||
mode: json["Modja"] != null ? Category.fromJson(json["Modja"]) : null,
|
||||
subjectIndex: json["OrarendiOraOraszama"],
|
||||
subjectName: json["TantargyNeve"] ?? "",
|
||||
teacher: (json["RogzitoTanarNeve"] ?? "").trim(),
|
||||
description: (json["Temaja"] ?? "").trim(),
|
||||
group: json["OsztalyCsoport"] != null ? json["OsztalyCsoport"]["Uid"] ?? "" : "",
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'category.dart';
|
||||
|
||||
class Exam {
|
||||
Map? json;
|
||||
DateTime date;
|
||||
DateTime writeDate;
|
||||
Category? mode;
|
||||
int? subjectIndex;
|
||||
String subjectName;
|
||||
String teacher;
|
||||
String description;
|
||||
String group;
|
||||
String id;
|
||||
|
||||
Exam({
|
||||
required this.id,
|
||||
required this.date,
|
||||
required this.writeDate,
|
||||
this.mode,
|
||||
this.subjectIndex,
|
||||
required this.subjectName,
|
||||
required this.teacher,
|
||||
required this.description,
|
||||
required this.group,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Exam.fromJson(Map json) {
|
||||
return Exam(
|
||||
id: json["Uid"] ?? "",
|
||||
date: json["BejelentesDatuma"] != null ? DateTime.parse(json["BejelentesDatuma"]).toLocal() : DateTime(0),
|
||||
writeDate: json["Datum"] != null ? DateTime.parse(json["Datum"]).toLocal() : DateTime(0),
|
||||
mode: json["Modja"] != null ? Category.fromJson(json["Modja"]) : null,
|
||||
subjectIndex: json["OrarendiOraOraszama"],
|
||||
subjectName: json["TantargyNeve"] ?? "",
|
||||
teacher: (json["RogzitoTanarNeve"] ?? "").trim(),
|
||||
description: (json["Temaja"] ?? "").trim(),
|
||||
group: json["OsztalyCsoport"] != null ? json["OsztalyCsoport"]["Uid"] ?? "" : "",
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,120 +1,120 @@
|
||||
import 'package:filcnaplo/utils/format.dart';
|
||||
import 'category.dart';
|
||||
import 'subject.dart';
|
||||
|
||||
class Grade {
|
||||
Map? json;
|
||||
String id;
|
||||
DateTime date;
|
||||
GradeValue value;
|
||||
String teacher;
|
||||
String description;
|
||||
GradeType type;
|
||||
String groupId;
|
||||
Subject subject;
|
||||
Category? gradeType;
|
||||
Category mode;
|
||||
DateTime writeDate;
|
||||
DateTime seenDate;
|
||||
String form;
|
||||
|
||||
Grade({
|
||||
required this.id,
|
||||
required this.date,
|
||||
required this.value,
|
||||
required this.teacher,
|
||||
required this.description,
|
||||
required this.type,
|
||||
required this.groupId,
|
||||
required this.subject,
|
||||
this.gradeType,
|
||||
required this.mode,
|
||||
required this.writeDate,
|
||||
required this.seenDate,
|
||||
required this.form,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Grade.fromJson(Map json) {
|
||||
return Grade(
|
||||
id: json["Uid"] ?? "",
|
||||
date: json["KeszitesDatuma"] != null ? DateTime.parse(json["KeszitesDatuma"]).toLocal() : DateTime(0),
|
||||
value: GradeValue(
|
||||
json["SzamErtek"] ?? 0,
|
||||
json["SzovegesErtek"] ?? "",
|
||||
json["SzovegesErtekelesRovidNev"] ?? "",
|
||||
json["SulySzazalekErteke"] ?? 0,
|
||||
percentage: json["ErtekFajta"] != null ? json["ErtekFajta"]["Uid"] == "3,Szazalekos" : false,
|
||||
),
|
||||
teacher: (json["ErtekeloTanarNeve"] ?? "").trim(),
|
||||
description: json["Tema"] ?? "",
|
||||
type: json["Tipus"] != null ? Category.getGradeType(json["Tipus"]["Nev"]) : GradeType.unknown,
|
||||
groupId: (json["OsztalyCsoport"] ?? {})["Uid"] ?? "",
|
||||
subject: Subject.fromJson(json["Tantargy"] ?? {}),
|
||||
gradeType: json["ErtekFajta"] != null ? Category.fromJson(json["ErtekFajta"]) : null,
|
||||
mode: Category.fromJson(json["Mod"] ?? {}),
|
||||
writeDate: json["RogzitesDatuma"] != null ? DateTime.parse(json["RogzitesDatuma"]).toLocal() : DateTime(0),
|
||||
seenDate: json["LattamozasDatuma"] != null ? DateTime.parse(json["LattamozasDatuma"]).toLocal() : DateTime(0),
|
||||
form: (json["Jelleg"] ?? "Na") != "Na" ? json["Jelleg"] : "",
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
|
||||
bool compareTo(dynamic other) {
|
||||
if (runtimeType != other.runtimeType) return false;
|
||||
|
||||
if (id == other.id && seenDate == other.seenDate) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class GradeValue {
|
||||
int _value;
|
||||
set value(int v) => _value = v;
|
||||
int get value {
|
||||
String _valueName = valueName.toLowerCase().specialChars();
|
||||
if (_value == 0 && ["peldas", "jo", "valtozo", "rossz", "hanyag"].contains(_valueName)) {
|
||||
switch (_valueName) {
|
||||
case "peldas":
|
||||
return 5;
|
||||
case "jo":
|
||||
return 4;
|
||||
case "valtozo":
|
||||
return 3;
|
||||
case "rossz":
|
||||
return 2;
|
||||
case "hanyag":
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return _value;
|
||||
}
|
||||
|
||||
String _valueName;
|
||||
set valueName(String v) => _valueName = v;
|
||||
String get valueName => _valueName.split("(")[0];
|
||||
String shortName;
|
||||
int _weight;
|
||||
set weight(int v) => _weight = v;
|
||||
int get weight {
|
||||
String _valueName = valueName.toLowerCase().specialChars();
|
||||
if (_value == 0 && ["peldas", "jo", "valtozo", "rossz", "hanyag"].contains(_valueName)) {
|
||||
return 0;
|
||||
}
|
||||
return _weight;
|
||||
}
|
||||
|
||||
final bool _percentage;
|
||||
bool get percentage => _percentage;
|
||||
|
||||
GradeValue(int value, String valueName, this.shortName, int weight, {bool percentage = false})
|
||||
: _value = value,
|
||||
_valueName = valueName,
|
||||
_weight = weight,
|
||||
_percentage = percentage;
|
||||
}
|
||||
|
||||
enum GradeType { midYear, firstQ, secondQ, halfYear, thirdQ, fourthQ, endYear, levelExam, ghost, unknown }
|
||||
import 'package:filcnaplo/utils/format.dart';
|
||||
import 'category.dart';
|
||||
import 'subject.dart';
|
||||
|
||||
class Grade {
|
||||
Map? json;
|
||||
String id;
|
||||
DateTime date;
|
||||
GradeValue value;
|
||||
String teacher;
|
||||
String description;
|
||||
GradeType type;
|
||||
String groupId;
|
||||
Subject subject;
|
||||
Category? gradeType;
|
||||
Category mode;
|
||||
DateTime writeDate;
|
||||
DateTime seenDate;
|
||||
String form;
|
||||
|
||||
Grade({
|
||||
required this.id,
|
||||
required this.date,
|
||||
required this.value,
|
||||
required this.teacher,
|
||||
required this.description,
|
||||
required this.type,
|
||||
required this.groupId,
|
||||
required this.subject,
|
||||
this.gradeType,
|
||||
required this.mode,
|
||||
required this.writeDate,
|
||||
required this.seenDate,
|
||||
required this.form,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Grade.fromJson(Map json) {
|
||||
return Grade(
|
||||
id: json["Uid"] ?? "",
|
||||
date: json["KeszitesDatuma"] != null ? DateTime.parse(json["KeszitesDatuma"]).toLocal() : DateTime(0),
|
||||
value: GradeValue(
|
||||
json["SzamErtek"] ?? 0,
|
||||
json["SzovegesErtek"] ?? "",
|
||||
json["SzovegesErtekelesRovidNev"] ?? "",
|
||||
json["SulySzazalekErteke"] ?? 0,
|
||||
percentage: json["ErtekFajta"] != null ? json["ErtekFajta"]["Uid"] == "3,Szazalekos" : false,
|
||||
),
|
||||
teacher: (json["ErtekeloTanarNeve"] ?? "").trim(),
|
||||
description: json["Tema"] ?? "",
|
||||
type: json["Tipus"] != null ? Category.getGradeType(json["Tipus"]["Nev"]) : GradeType.unknown,
|
||||
groupId: (json["OsztalyCsoport"] ?? {})["Uid"] ?? "",
|
||||
subject: Subject.fromJson(json["Tantargy"] ?? {}),
|
||||
gradeType: json["ErtekFajta"] != null ? Category.fromJson(json["ErtekFajta"]) : null,
|
||||
mode: Category.fromJson(json["Mod"] ?? {}),
|
||||
writeDate: json["RogzitesDatuma"] != null ? DateTime.parse(json["RogzitesDatuma"]).toLocal() : DateTime(0),
|
||||
seenDate: json["LattamozasDatuma"] != null ? DateTime.parse(json["LattamozasDatuma"]).toLocal() : DateTime(0),
|
||||
form: (json["Jelleg"] ?? "Na") != "Na" ? json["Jelleg"] : "",
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
|
||||
bool compareTo(dynamic other) {
|
||||
if (runtimeType != other.runtimeType) return false;
|
||||
|
||||
if (id == other.id && seenDate == other.seenDate) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class GradeValue {
|
||||
int _value;
|
||||
set value(int v) => _value = v;
|
||||
int get value {
|
||||
String _valueName = valueName.toLowerCase().specialChars();
|
||||
if (_value == 0 && ["peldas", "jo", "valtozo", "rossz", "hanyag"].contains(_valueName)) {
|
||||
switch (_valueName) {
|
||||
case "peldas":
|
||||
return 5;
|
||||
case "jo":
|
||||
return 4;
|
||||
case "valtozo":
|
||||
return 3;
|
||||
case "rossz":
|
||||
return 2;
|
||||
case "hanyag":
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return _value;
|
||||
}
|
||||
|
||||
String _valueName;
|
||||
set valueName(String v) => _valueName = v;
|
||||
String get valueName => _valueName.split("(")[0];
|
||||
String shortName;
|
||||
int _weight;
|
||||
set weight(int v) => _weight = v;
|
||||
int get weight {
|
||||
String _valueName = valueName.toLowerCase().specialChars();
|
||||
if (_value == 0 && ["peldas", "jo", "valtozo", "rossz", "hanyag"].contains(_valueName)) {
|
||||
return 0;
|
||||
}
|
||||
return _weight;
|
||||
}
|
||||
|
||||
final bool _percentage;
|
||||
bool get percentage => _percentage;
|
||||
|
||||
GradeValue(int value, String valueName, this.shortName, int weight, {bool percentage = false})
|
||||
: _value = value,
|
||||
_valueName = valueName,
|
||||
_weight = weight,
|
||||
_percentage = percentage;
|
||||
}
|
||||
|
||||
enum GradeType { midYear, firstQ, secondQ, halfYear, thirdQ, fourthQ, endYear, levelExam, ghost, unknown }
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import 'package:filcnaplo_kreta_api/models/subject.dart';
|
||||
|
||||
class GroupAverage {
|
||||
String uid;
|
||||
double average;
|
||||
Subject subject;
|
||||
Map json;
|
||||
|
||||
GroupAverage({required this.uid, required this.average, required this.subject, this.json = const {}});
|
||||
|
||||
factory GroupAverage.fromJson(Map json) {
|
||||
return GroupAverage(
|
||||
uid: json["Uid"] ?? "",
|
||||
average: json["OsztalyCsoportAtlag"] ?? 0,
|
||||
subject: Subject.fromJson(json["Tantargy"] ?? {}),
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:filcnaplo_kreta_api/models/subject.dart';
|
||||
|
||||
class GroupAverage {
|
||||
String uid;
|
||||
double average;
|
||||
Subject subject;
|
||||
Map json;
|
||||
|
||||
GroupAverage({required this.uid, required this.average, required this.subject, this.json = const {}});
|
||||
|
||||
factory GroupAverage.fromJson(Map json) {
|
||||
return GroupAverage(
|
||||
uid: json["Uid"] ?? "",
|
||||
average: json["OsztalyCsoportAtlag"] ?? 0,
|
||||
subject: Subject.fromJson(json["Tantargy"] ?? {}),
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +1,69 @@
|
||||
import 'package:filcnaplo_kreta_api/client/api.dart';
|
||||
|
||||
class Homework {
|
||||
Map? json;
|
||||
DateTime date;
|
||||
DateTime lessonDate;
|
||||
DateTime deadline;
|
||||
bool byTeacher;
|
||||
bool homeworkEnabled;
|
||||
String teacher;
|
||||
String content;
|
||||
String subjectName;
|
||||
String group;
|
||||
List<HomeworkAttachment> attachments;
|
||||
String id;
|
||||
|
||||
Homework({
|
||||
required this.date,
|
||||
required this.lessonDate,
|
||||
required this.deadline,
|
||||
required this.byTeacher,
|
||||
required this.homeworkEnabled,
|
||||
required this.teacher,
|
||||
required this.content,
|
||||
required this.subjectName,
|
||||
required this.group,
|
||||
required this.attachments,
|
||||
required this.id,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Homework.fromJson(Map json) {
|
||||
return Homework(
|
||||
id: json["Uid"] ?? "",
|
||||
date: json["RogzitesIdopontja"] != null ? DateTime.parse(json["RogzitesIdopontja"]).toLocal() : DateTime(0),
|
||||
lessonDate: json["FeladasDatuma"] != null ? DateTime.parse(json["FeladasDatuma"]).toLocal() : DateTime(0),
|
||||
deadline: json["HataridoDatuma"] != null ? DateTime.parse(json["HataridoDatuma"]).toLocal() : DateTime(0),
|
||||
byTeacher: json["IsTanarRogzitette"] ?? true,
|
||||
homeworkEnabled: json["IsTanuloHaziFeladatEnabled"] ?? false,
|
||||
teacher: (json["RogzitoTanarNeve"] ?? "").trim(),
|
||||
content: (json["Szoveg"] ?? "").trim(),
|
||||
subjectName: json["TantargyNeve"] ?? "",
|
||||
group: json["OsztalyCsoport"] != null ? json["OsztalyCsoport"]["Uid"] ?? "" : "",
|
||||
attachments: ((json["Csatolmanyok"] ?? []) as List).cast<Map>().map((Map json) => HomeworkAttachment.fromJson(json)).toList(),
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class HomeworkAttachment {
|
||||
Map? json;
|
||||
String id;
|
||||
String name;
|
||||
String type;
|
||||
|
||||
HomeworkAttachment({required this.id, this.name = "", this.type = "", this.json});
|
||||
|
||||
factory HomeworkAttachment.fromJson(Map json) {
|
||||
return HomeworkAttachment(
|
||||
id: json["Uid"] ?? "",
|
||||
name: json["Nev"] ?? "",
|
||||
type: json["Tipus"] ?? "",
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
|
||||
String downloadUrl(String iss) => KretaAPI.downloadHomeworkAttachments(iss, id, type);
|
||||
bool get isImage => name.endsWith(".jpg") || name.endsWith(".jpeg") || name.endsWith(".png");
|
||||
}
|
||||
import 'package:filcnaplo_kreta_api/client/api.dart';
|
||||
|
||||
class Homework {
|
||||
Map? json;
|
||||
DateTime date;
|
||||
DateTime lessonDate;
|
||||
DateTime deadline;
|
||||
bool byTeacher;
|
||||
bool homeworkEnabled;
|
||||
String teacher;
|
||||
String content;
|
||||
String subjectName;
|
||||
String group;
|
||||
List<HomeworkAttachment> attachments;
|
||||
String id;
|
||||
|
||||
Homework({
|
||||
required this.date,
|
||||
required this.lessonDate,
|
||||
required this.deadline,
|
||||
required this.byTeacher,
|
||||
required this.homeworkEnabled,
|
||||
required this.teacher,
|
||||
required this.content,
|
||||
required this.subjectName,
|
||||
required this.group,
|
||||
required this.attachments,
|
||||
required this.id,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Homework.fromJson(Map json) {
|
||||
return Homework(
|
||||
id: json["Uid"] ?? "",
|
||||
date: json["RogzitesIdopontja"] != null ? DateTime.parse(json["RogzitesIdopontja"]).toLocal() : DateTime(0),
|
||||
lessonDate: json["FeladasDatuma"] != null ? DateTime.parse(json["FeladasDatuma"]).toLocal() : DateTime(0),
|
||||
deadline: json["HataridoDatuma"] != null ? DateTime.parse(json["HataridoDatuma"]).toLocal() : DateTime(0),
|
||||
byTeacher: json["IsTanarRogzitette"] ?? true,
|
||||
homeworkEnabled: json["IsTanuloHaziFeladatEnabled"] ?? false,
|
||||
teacher: (json["RogzitoTanarNeve"] ?? "").trim(),
|
||||
content: (json["Szoveg"] ?? "").trim(),
|
||||
subjectName: json["TantargyNeve"] ?? "",
|
||||
group: json["OsztalyCsoport"] != null ? json["OsztalyCsoport"]["Uid"] ?? "" : "",
|
||||
attachments: ((json["Csatolmanyok"] ?? []) as List).cast<Map>().map((Map json) => HomeworkAttachment.fromJson(json)).toList(),
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class HomeworkAttachment {
|
||||
Map? json;
|
||||
String id;
|
||||
String name;
|
||||
String type;
|
||||
|
||||
HomeworkAttachment({required this.id, this.name = "", this.type = "", this.json});
|
||||
|
||||
factory HomeworkAttachment.fromJson(Map json) {
|
||||
return HomeworkAttachment(
|
||||
id: json["Uid"] ?? "",
|
||||
name: json["Nev"] ?? "",
|
||||
type: json["Tipus"] ?? "",
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
|
||||
String downloadUrl(String iss) => KretaAPI.downloadHomeworkAttachments(iss, id, type);
|
||||
bool get isImage => name.endsWith(".jpg") || name.endsWith(".jpeg") || name.endsWith(".png");
|
||||
}
|
||||
|
||||
@@ -1,97 +1,97 @@
|
||||
import 'subject.dart';
|
||||
import 'category.dart';
|
||||
|
||||
class Lesson {
|
||||
Map? json;
|
||||
Category? status;
|
||||
DateTime date;
|
||||
Subject subject;
|
||||
String lessonIndex;
|
||||
int? lessonYearIndex;
|
||||
String substituteTeacher;
|
||||
String teacher;
|
||||
bool homeworkEnabled;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
bool studentPresence;
|
||||
String homeworkId;
|
||||
String exam;
|
||||
String id;
|
||||
Category? type;
|
||||
String description;
|
||||
String room;
|
||||
String groupName;
|
||||
String name;
|
||||
bool online;
|
||||
bool isEmpty;
|
||||
|
||||
Lesson({
|
||||
this.status,
|
||||
required this.date,
|
||||
required this.subject,
|
||||
required this.lessonIndex,
|
||||
this.lessonYearIndex,
|
||||
this.substituteTeacher = "",
|
||||
required this.teacher,
|
||||
this.homeworkEnabled = false,
|
||||
required this.start,
|
||||
required this.end,
|
||||
this.studentPresence = true,
|
||||
required this.homeworkId,
|
||||
this.exam = "",
|
||||
required this.id,
|
||||
this.type,
|
||||
required this.description,
|
||||
required this.room,
|
||||
required this.groupName,
|
||||
required this.name,
|
||||
this.online = false,
|
||||
this.isEmpty = false,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Lesson.fromJson(Map json) {
|
||||
return Lesson(
|
||||
id: json["Uid"] ?? "",
|
||||
status: json["Allapot"] != null ? Category.fromJson(json["Allapot"]) : null,
|
||||
date: json["Datum"] != null ? DateTime.parse(json["Datum"]).toLocal() : DateTime(0),
|
||||
subject: Subject.fromJson(json["Tantargy"] ?? {}),
|
||||
lessonIndex: json["Oraszam"] != null ? json["Oraszam"].toString() : "+",
|
||||
lessonYearIndex: json["OraEvesSorszama"],
|
||||
substituteTeacher: (json["HelyettesTanarNeve"] ?? "").trim(),
|
||||
teacher: (json["TanarNeve"] ?? "").trim(),
|
||||
homeworkEnabled: json["IsTanuloHaziFeladatEnabled"] ?? false,
|
||||
start: json["KezdetIdopont"] != null ? DateTime.parse(json["KezdetIdopont"]).toLocal() : DateTime(0),
|
||||
studentPresence: json["TanuloJelenlet"] != null
|
||||
? (json["TanuloJelenlet"]["Nev"] ?? "") == "Hianyzas"
|
||||
? false
|
||||
: true
|
||||
: true,
|
||||
end: json["VegIdopont"] != null ? DateTime.parse(json["VegIdopont"]).toLocal() : DateTime(0),
|
||||
homeworkId: json["HaziFeladatUid"] ?? "",
|
||||
exam: json["BejelentettSzamonkeresUid"] ?? "",
|
||||
type: json["Tipus"] != null ? Category.fromJson(json["Tipus"]) : null,
|
||||
description: json["Tema"] ?? "",
|
||||
room: ((json["TeremNeve"] ?? "").split("_").join(" ") as String).replaceAll(RegExp(r" ?terem ?", caseSensitive: false), ""),
|
||||
groupName: json["OsztalyCsoport"] != null ? json["OsztalyCsoport"]["Nev"] ?? "" : "",
|
||||
name: json["Nev"] ?? "",
|
||||
online: json["IsDigitalisOra"] ?? false,
|
||||
isEmpty: json['isEmpty'] ?? false,
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
|
||||
int? getFloor() {
|
||||
final match = RegExp(r"(\d{3})").firstMatch(room);
|
||||
if (match != null) {
|
||||
final floorNumber = int.tryParse(match[0] ?? "");
|
||||
if (floorNumber != null) {
|
||||
return (floorNumber / 100).floor();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
bool get isChanged => status?.name == "Elmaradt" || substituteTeacher != "";
|
||||
bool get swapDesc => room.length > 8;
|
||||
}
|
||||
import 'subject.dart';
|
||||
import 'category.dart';
|
||||
|
||||
class Lesson {
|
||||
Map? json;
|
||||
Category? status;
|
||||
DateTime date;
|
||||
Subject subject;
|
||||
String lessonIndex;
|
||||
int? lessonYearIndex;
|
||||
String substituteTeacher;
|
||||
String teacher;
|
||||
bool homeworkEnabled;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
bool studentPresence;
|
||||
String homeworkId;
|
||||
String exam;
|
||||
String id;
|
||||
Category? type;
|
||||
String description;
|
||||
String room;
|
||||
String groupName;
|
||||
String name;
|
||||
bool online;
|
||||
bool isEmpty;
|
||||
|
||||
Lesson({
|
||||
this.status,
|
||||
required this.date,
|
||||
required this.subject,
|
||||
required this.lessonIndex,
|
||||
this.lessonYearIndex,
|
||||
this.substituteTeacher = "",
|
||||
required this.teacher,
|
||||
this.homeworkEnabled = false,
|
||||
required this.start,
|
||||
required this.end,
|
||||
this.studentPresence = true,
|
||||
required this.homeworkId,
|
||||
this.exam = "",
|
||||
required this.id,
|
||||
this.type,
|
||||
required this.description,
|
||||
required this.room,
|
||||
required this.groupName,
|
||||
required this.name,
|
||||
this.online = false,
|
||||
this.isEmpty = false,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Lesson.fromJson(Map json) {
|
||||
return Lesson(
|
||||
id: json["Uid"] ?? "",
|
||||
status: json["Allapot"] != null ? Category.fromJson(json["Allapot"]) : null,
|
||||
date: json["Datum"] != null ? DateTime.parse(json["Datum"]).toLocal() : DateTime(0),
|
||||
subject: Subject.fromJson(json["Tantargy"] ?? {}),
|
||||
lessonIndex: json["Oraszam"] != null ? json["Oraszam"].toString() : "+",
|
||||
lessonYearIndex: json["OraEvesSorszama"],
|
||||
substituteTeacher: (json["HelyettesTanarNeve"] ?? "").trim(),
|
||||
teacher: (json["TanarNeve"] ?? "").trim(),
|
||||
homeworkEnabled: json["IsTanuloHaziFeladatEnabled"] ?? false,
|
||||
start: json["KezdetIdopont"] != null ? DateTime.parse(json["KezdetIdopont"]).toLocal() : DateTime(0),
|
||||
studentPresence: json["TanuloJelenlet"] != null
|
||||
? (json["TanuloJelenlet"]["Nev"] ?? "") == "Hianyzas"
|
||||
? false
|
||||
: true
|
||||
: true,
|
||||
end: json["VegIdopont"] != null ? DateTime.parse(json["VegIdopont"]).toLocal() : DateTime(0),
|
||||
homeworkId: json["HaziFeladatUid"] ?? "",
|
||||
exam: json["BejelentettSzamonkeresUid"] ?? "",
|
||||
type: json["Tipus"] != null ? Category.fromJson(json["Tipus"]) : null,
|
||||
description: json["Tema"] ?? "",
|
||||
room: ((json["TeremNeve"] ?? "").split("_").join(" ") as String).replaceAll(RegExp(r" ?terem ?", caseSensitive: false), ""),
|
||||
groupName: json["OsztalyCsoport"] != null ? json["OsztalyCsoport"]["Nev"] ?? "" : "",
|
||||
name: json["Nev"] ?? "",
|
||||
online: json["IsDigitalisOra"] ?? false,
|
||||
isEmpty: json['isEmpty'] ?? false,
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
|
||||
int? getFloor() {
|
||||
final match = RegExp(r"(\d{3})").firstMatch(room);
|
||||
if (match != null) {
|
||||
final floorNumber = int.tryParse(match[0] ?? "");
|
||||
if (floorNumber != null) {
|
||||
return (floorNumber / 100).floor();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
bool get isChanged => status?.name == "Elmaradt" || substituteTeacher != "";
|
||||
bool get swapDesc => room.length > 8;
|
||||
}
|
||||
|
||||
@@ -1,97 +1,97 @@
|
||||
import 'recipient.dart';
|
||||
import 'attachment.dart';
|
||||
|
||||
class Message {
|
||||
Map? json;
|
||||
int id;
|
||||
int? replyId;
|
||||
int messageId;
|
||||
int? conversationId;
|
||||
bool seen;
|
||||
bool deleted;
|
||||
DateTime date;
|
||||
String author;
|
||||
String content;
|
||||
String subject;
|
||||
MessageType? type;
|
||||
List<Recipient> recipients;
|
||||
List<Attachment> attachments;
|
||||
|
||||
Message({
|
||||
required this.id,
|
||||
required this.messageId,
|
||||
required this.seen,
|
||||
required this.deleted,
|
||||
required this.date,
|
||||
required this.author,
|
||||
required this.content,
|
||||
required this.subject,
|
||||
this.type,
|
||||
required this.recipients,
|
||||
required this.attachments,
|
||||
this.replyId,
|
||||
this.conversationId,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Message.fromJson(Map json, {MessageType? forceType}) {
|
||||
Map message = json["uzenet"];
|
||||
|
||||
MessageType? type = forceType;
|
||||
if (type == null) {
|
||||
switch (json["tipus"]["kod"]) {
|
||||
case "BEERKEZETT":
|
||||
type = MessageType.inbox;
|
||||
break;
|
||||
case "ELKULDOTT":
|
||||
type = MessageType.sent;
|
||||
break;
|
||||
case "PISZKOZAT":
|
||||
type = MessageType.draft;
|
||||
break;
|
||||
}
|
||||
|
||||
if (json["isToroltElem"] == true) type = MessageType.trash;
|
||||
}
|
||||
|
||||
return Message(
|
||||
id: json["azonosito"],
|
||||
messageId: message["azonosito"],
|
||||
seen: json["isElolvasva"] ?? false,
|
||||
deleted: json["isToroltElem"] ?? false,
|
||||
date: message["kuldesDatum"] != null ? DateTime.parse(message["kuldesDatum"]).toLocal() : DateTime(0),
|
||||
author: (message["feladoNev"] ?? "").trim(),
|
||||
content: message["szoveg"].replaceAll("\r", "") ?? "",
|
||||
subject: message["targy"] ?? "",
|
||||
type: type,
|
||||
recipients: (message["cimzettLista"] as List).cast<Map>().map((Map recipient) => Recipient.fromJson(recipient)).toList(),
|
||||
attachments: (message["csatolmanyok"] as List).cast<Map>().map((Map attachment) => Attachment.fromJson(attachment)).toList(),
|
||||
replyId: message["elozoUzenetAzonosito"],
|
||||
conversationId: message["beszelgetesAzonosito"],
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
|
||||
bool compareTo(dynamic other) {
|
||||
if (runtimeType != other.runtimeType) return false;
|
||||
|
||||
return id == other.id && seen == other.seen && deleted == other.deleted;
|
||||
}
|
||||
}
|
||||
|
||||
enum MessageType { inbox, sent, trash, draft }
|
||||
|
||||
class Conversation {
|
||||
int id;
|
||||
late List<Message> _messages;
|
||||
List<Message> get messages => _messages;
|
||||
|
||||
Conversation({required this.id, List<Message> messages = const []}) {
|
||||
_messages = List.from(messages);
|
||||
}
|
||||
|
||||
void sort() => _messages.sort((a, b) => -a.date.compareTo(b.date));
|
||||
void add(Message message) => _messages.add(message);
|
||||
|
||||
Message get newest => _messages.first;
|
||||
}
|
||||
import 'recipient.dart';
|
||||
import 'attachment.dart';
|
||||
|
||||
class Message {
|
||||
Map? json;
|
||||
int id;
|
||||
int? replyId;
|
||||
int messageId;
|
||||
int? conversationId;
|
||||
bool seen;
|
||||
bool deleted;
|
||||
DateTime date;
|
||||
String author;
|
||||
String content;
|
||||
String subject;
|
||||
MessageType? type;
|
||||
List<Recipient> recipients;
|
||||
List<Attachment> attachments;
|
||||
|
||||
Message({
|
||||
required this.id,
|
||||
required this.messageId,
|
||||
required this.seen,
|
||||
required this.deleted,
|
||||
required this.date,
|
||||
required this.author,
|
||||
required this.content,
|
||||
required this.subject,
|
||||
this.type,
|
||||
required this.recipients,
|
||||
required this.attachments,
|
||||
this.replyId,
|
||||
this.conversationId,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Message.fromJson(Map json, {MessageType? forceType}) {
|
||||
Map message = json["uzenet"];
|
||||
|
||||
MessageType? type = forceType;
|
||||
if (type == null) {
|
||||
switch (json["tipus"]["kod"]) {
|
||||
case "BEERKEZETT":
|
||||
type = MessageType.inbox;
|
||||
break;
|
||||
case "ELKULDOTT":
|
||||
type = MessageType.sent;
|
||||
break;
|
||||
case "PISZKOZAT":
|
||||
type = MessageType.draft;
|
||||
break;
|
||||
}
|
||||
|
||||
if (json["isToroltElem"] == true) type = MessageType.trash;
|
||||
}
|
||||
|
||||
return Message(
|
||||
id: json["azonosito"],
|
||||
messageId: message["azonosito"],
|
||||
seen: json["isElolvasva"] ?? false,
|
||||
deleted: json["isToroltElem"] ?? false,
|
||||
date: message["kuldesDatum"] != null ? DateTime.parse(message["kuldesDatum"]).toLocal() : DateTime(0),
|
||||
author: (message["feladoNev"] ?? "").trim(),
|
||||
content: message["szoveg"].replaceAll("\r", "") ?? "",
|
||||
subject: message["targy"] ?? "",
|
||||
type: type,
|
||||
recipients: (message["cimzettLista"] as List).cast<Map>().map((Map recipient) => Recipient.fromJson(recipient)).toList(),
|
||||
attachments: (message["csatolmanyok"] as List).cast<Map>().map((Map attachment) => Attachment.fromJson(attachment)).toList(),
|
||||
replyId: message["elozoUzenetAzonosito"],
|
||||
conversationId: message["beszelgetesAzonosito"],
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
|
||||
bool compareTo(dynamic other) {
|
||||
if (runtimeType != other.runtimeType) return false;
|
||||
|
||||
return id == other.id && seen == other.seen && deleted == other.deleted;
|
||||
}
|
||||
}
|
||||
|
||||
enum MessageType { inbox, sent, trash, draft }
|
||||
|
||||
class Conversation {
|
||||
int id;
|
||||
late List<Message> _messages;
|
||||
List<Message> get messages => _messages;
|
||||
|
||||
Conversation({required this.id, List<Message> messages = const []}) {
|
||||
_messages = List.from(messages);
|
||||
}
|
||||
|
||||
void sort() => _messages.sort((a, b) => -a.date.compareTo(b.date));
|
||||
void add(Message message) => _messages.add(message);
|
||||
|
||||
Message get newest => _messages.first;
|
||||
}
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
import 'category.dart';
|
||||
|
||||
class Note {
|
||||
Map? json;
|
||||
String id;
|
||||
String title;
|
||||
DateTime date;
|
||||
DateTime submitDate;
|
||||
String teacher;
|
||||
DateTime seenDate;
|
||||
String groupId;
|
||||
String content;
|
||||
Category? type;
|
||||
|
||||
Note({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.date,
|
||||
required this.submitDate,
|
||||
required this.teacher,
|
||||
required this.seenDate,
|
||||
required this.groupId,
|
||||
required this.content,
|
||||
this.type,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Note.fromJson(Map json) {
|
||||
return Note(
|
||||
id: json["Uid"] ?? "",
|
||||
title: json["Cim"] ?? "",
|
||||
date: json["Datum"] != null ? DateTime.parse(json["Datum"]).toLocal() : DateTime(0),
|
||||
submitDate: json["KeszitesDatuma"] != null ? DateTime.parse(json["KeszitesDatuma"]).toLocal() : DateTime(0),
|
||||
teacher: (json["KeszitoTanarNeve"] ?? "").trim(),
|
||||
seenDate: json["LattamozasDatuma"] != null ? DateTime.parse(json["LattamozasDatuma"]).toLocal() : DateTime(0),
|
||||
groupId: json["OsztalyCsoport"] != null ? json["OsztalyCsoport"]["Uid"] ?? "" : "",
|
||||
content: json["Tartalom"].replaceAll("\r", "") ?? "",
|
||||
type: json["Tipus"] != null ? Category.fromJson(json["Tipus"]) : null,
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'category.dart';
|
||||
|
||||
class Note {
|
||||
Map? json;
|
||||
String id;
|
||||
String title;
|
||||
DateTime date;
|
||||
DateTime submitDate;
|
||||
String teacher;
|
||||
DateTime seenDate;
|
||||
String groupId;
|
||||
String content;
|
||||
Category? type;
|
||||
|
||||
Note({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.date,
|
||||
required this.submitDate,
|
||||
required this.teacher,
|
||||
required this.seenDate,
|
||||
required this.groupId,
|
||||
required this.content,
|
||||
this.type,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Note.fromJson(Map json) {
|
||||
return Note(
|
||||
id: json["Uid"] ?? "",
|
||||
title: json["Cim"] ?? "",
|
||||
date: json["Datum"] != null ? DateTime.parse(json["Datum"]).toLocal() : DateTime(0),
|
||||
submitDate: json["KeszitesDatuma"] != null ? DateTime.parse(json["KeszitesDatuma"]).toLocal() : DateTime(0),
|
||||
teacher: (json["KeszitoTanarNeve"] ?? "").trim(),
|
||||
seenDate: json["LattamozasDatuma"] != null ? DateTime.parse(json["LattamozasDatuma"]).toLocal() : DateTime(0),
|
||||
groupId: json["OsztalyCsoport"] != null ? json["OsztalyCsoport"]["Uid"] ?? "" : "",
|
||||
content: json["Tartalom"].replaceAll("\r", "") ?? "",
|
||||
type: json["Tipus"] != null ? Category.fromJson(json["Tipus"]) : null,
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,56 +1,56 @@
|
||||
class Recipient {
|
||||
Map? json;
|
||||
int id;
|
||||
String? studentId; // oktatasi azonosito
|
||||
int kretaId;
|
||||
String name;
|
||||
RecipientCategory? category;
|
||||
|
||||
Recipient({
|
||||
required this.id,
|
||||
this.studentId,
|
||||
required this.name,
|
||||
required this.kretaId,
|
||||
this.category,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Recipient.fromJson(Map json) {
|
||||
return Recipient(
|
||||
id: json["azonosito"],
|
||||
name: json["nev"] ?? "",
|
||||
kretaId: json["kretaAzonosito"],
|
||||
category: json["tipus"] != null ? RecipientCategory.fromJson(json["tipus"]) : null,
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class RecipientCategory {
|
||||
Map? json;
|
||||
int id;
|
||||
String code;
|
||||
String shortName;
|
||||
String name;
|
||||
String description;
|
||||
|
||||
RecipientCategory({
|
||||
required this.id,
|
||||
required this.code,
|
||||
required this.shortName,
|
||||
required this.name,
|
||||
required this.description,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory RecipientCategory.fromJson(Map json) {
|
||||
return RecipientCategory(
|
||||
id: json["azonosito"],
|
||||
code: json["kod"] ?? "",
|
||||
shortName: json["rovidNev"] ?? "",
|
||||
name: json["nev"] ?? "",
|
||||
description: json["leiras"] ?? "",
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
class Recipient {
|
||||
Map? json;
|
||||
int id;
|
||||
String? studentId; // oktatasi azonosito
|
||||
int kretaId;
|
||||
String name;
|
||||
RecipientCategory? category;
|
||||
|
||||
Recipient({
|
||||
required this.id,
|
||||
this.studentId,
|
||||
required this.name,
|
||||
required this.kretaId,
|
||||
this.category,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Recipient.fromJson(Map json) {
|
||||
return Recipient(
|
||||
id: json["azonosito"],
|
||||
name: json["nev"] ?? "",
|
||||
kretaId: json["kretaAzonosito"],
|
||||
category: json["tipus"] != null ? RecipientCategory.fromJson(json["tipus"]) : null,
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class RecipientCategory {
|
||||
Map? json;
|
||||
int id;
|
||||
String code;
|
||||
String shortName;
|
||||
String name;
|
||||
String description;
|
||||
|
||||
RecipientCategory({
|
||||
required this.id,
|
||||
required this.code,
|
||||
required this.shortName,
|
||||
required this.name,
|
||||
required this.description,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory RecipientCategory.fromJson(Map json) {
|
||||
return RecipientCategory(
|
||||
id: json["azonosito"],
|
||||
code: json["kod"] ?? "",
|
||||
shortName: json["rovidNev"] ?? "",
|
||||
name: json["nev"] ?? "",
|
||||
description: json["leiras"] ?? "",
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
class School {
|
||||
String instituteCode;
|
||||
String name;
|
||||
String city;
|
||||
|
||||
School({
|
||||
required this.instituteCode,
|
||||
required this.name,
|
||||
required this.city,
|
||||
});
|
||||
|
||||
factory School.fromJson(Map json) {
|
||||
return School(
|
||||
instituteCode: json["instituteCode"] ?? "",
|
||||
name: (json["name"] ?? "").trim(),
|
||||
city: json["city"] ?? "",
|
||||
);
|
||||
}
|
||||
}
|
||||
class School {
|
||||
String instituteCode;
|
||||
String name;
|
||||
String city;
|
||||
|
||||
School({
|
||||
required this.instituteCode,
|
||||
required this.name,
|
||||
required this.city,
|
||||
});
|
||||
|
||||
factory School.fromJson(Map json) {
|
||||
return School(
|
||||
instituteCode: json["instituteCode"] ?? "",
|
||||
name: (json["name"] ?? "").trim(),
|
||||
city: json["city"] ?? "",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,55 +1,55 @@
|
||||
import 'school.dart';
|
||||
import 'package:filcnaplo/utils/format.dart';
|
||||
|
||||
class Student {
|
||||
Map? json;
|
||||
String id;
|
||||
String name;
|
||||
School school;
|
||||
DateTime birth;
|
||||
String yearId;
|
||||
String? address;
|
||||
String? groupId;
|
||||
List<String> parents;
|
||||
String? className;
|
||||
|
||||
Student({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.school,
|
||||
required this.birth,
|
||||
required this.yearId,
|
||||
this.address,
|
||||
required this.parents,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Student.fromJson(Map json) {
|
||||
List<String> parents = [];
|
||||
|
||||
parents = ((json["Gondviselok"] ?? []) as List).cast<Map>().map((e) => e["Nev"] ?? "").toList().cast<String>();
|
||||
if (json["AnyjaNeve"] != null) parents.insert(0, json["AnyjaNeve"]);
|
||||
|
||||
parents = parents.map((e) => e.capitalize()).toList(); // fix name casing
|
||||
parents = parents.toSet().toList(); // remove duplicates
|
||||
|
||||
return Student(
|
||||
id: json["Uid"] ?? "",
|
||||
name: (json["Nev"] ?? json["SzuletesiNev"] ?? "").trim(),
|
||||
school: School(
|
||||
instituteCode: json["IntezmenyAzonosito"] ?? "",
|
||||
name: json["IntezmenyNev"] ?? "",
|
||||
city: "",
|
||||
),
|
||||
birth: json["SzuletesiDatum"] != null ? DateTime.parse(json["SzuletesiDatum"]).toLocal() : DateTime(0),
|
||||
yearId: json["TanevUid"] ?? "",
|
||||
address: json["Cimek"] != null
|
||||
? json["Cimek"].length > 0
|
||||
? json["Cimek"][0]
|
||||
: null
|
||||
: null,
|
||||
parents: parents,
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'school.dart';
|
||||
import 'package:filcnaplo/utils/format.dart';
|
||||
|
||||
class Student {
|
||||
Map? json;
|
||||
String id;
|
||||
String name;
|
||||
School school;
|
||||
DateTime birth;
|
||||
String yearId;
|
||||
String? address;
|
||||
String? groupId;
|
||||
List<String> parents;
|
||||
String? className;
|
||||
|
||||
Student({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.school,
|
||||
required this.birth,
|
||||
required this.yearId,
|
||||
this.address,
|
||||
required this.parents,
|
||||
this.json,
|
||||
});
|
||||
|
||||
factory Student.fromJson(Map json) {
|
||||
List<String> parents = [];
|
||||
|
||||
parents = ((json["Gondviselok"] ?? []) as List).cast<Map>().map((e) => e["Nev"] ?? "").toList().cast<String>();
|
||||
if (json["AnyjaNeve"] != null) parents.insert(0, json["AnyjaNeve"]);
|
||||
|
||||
parents = parents.map((e) => e.capitalize()).toList(); // fix name casing
|
||||
parents = parents.toSet().toList(); // remove duplicates
|
||||
|
||||
return Student(
|
||||
id: json["Uid"] ?? "",
|
||||
name: (json["Nev"] ?? json["SzuletesiNev"] ?? "").trim(),
|
||||
school: School(
|
||||
instituteCode: json["IntezmenyAzonosito"] ?? "",
|
||||
name: json["IntezmenyNev"] ?? "",
|
||||
city: "",
|
||||
),
|
||||
birth: json["SzuletesiDatum"] != null ? DateTime.parse(json["SzuletesiDatum"]).toLocal() : DateTime(0),
|
||||
yearId: json["TanevUid"] ?? "",
|
||||
address: json["Cimek"] != null
|
||||
? json["Cimek"].length > 0
|
||||
? json["Cimek"][0]
|
||||
: null
|
||||
: null,
|
||||
parents: parents,
|
||||
json: json,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
import 'category.dart';
|
||||
|
||||
class Subject {
|
||||
String id;
|
||||
Category category;
|
||||
String name;
|
||||
String? renamedTo;
|
||||
|
||||
bool get isRenamed => renamedTo != null;
|
||||
|
||||
Subject({required this.id, required this.category, required this.name, this.renamedTo});
|
||||
|
||||
factory Subject.fromJson(Map json) {
|
||||
final id = json["Uid"] ?? "";
|
||||
return Subject(
|
||||
id: id,
|
||||
category: Category.fromJson(json["Kategoria"] ?? {}),
|
||||
name: (json["Nev"] ?? "").trim(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(other) {
|
||||
if (other is! Subject) return false;
|
||||
return id == other.id;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode;
|
||||
}
|
||||
import 'category.dart';
|
||||
|
||||
class Subject {
|
||||
String id;
|
||||
Category category;
|
||||
String name;
|
||||
String? renamedTo;
|
||||
|
||||
bool get isRenamed => renamedTo != null;
|
||||
|
||||
Subject({required this.id, required this.category, required this.name, this.renamedTo});
|
||||
|
||||
factory Subject.fromJson(Map json) {
|
||||
final id = json["Uid"] ?? "";
|
||||
return Subject(
|
||||
id: id,
|
||||
category: Category.fromJson(json["Kategoria"] ?? {}),
|
||||
name: (json["Nev"] ?? "").trim(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(other) {
|
||||
if (other is! Subject) return false;
|
||||
return id == other.id;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode;
|
||||
}
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
import 'package:filcnaplo_kreta_api/controllers/timetable_controller.dart';
|
||||
|
||||
class Week {
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
|
||||
Week({required this.start, required this.end});
|
||||
|
||||
factory Week.current() => Week.fromDate(DateTime.now());
|
||||
|
||||
factory Week.fromId(int id) {
|
||||
DateTime _now = TimetableController.getSchoolYearStart().add(Duration(days: id * DateTime.daysPerWeek));
|
||||
DateTime now = DateTime(_now.year, _now.month, _now.day);
|
||||
return Week(
|
||||
start: now.subtract(Duration(days: now.weekday - 1)),
|
||||
end: now.add(Duration(days: DateTime.daysPerWeek - now.weekday)),
|
||||
);
|
||||
}
|
||||
|
||||
factory Week.fromDate(DateTime date) {
|
||||
// fix #32
|
||||
DateTime _date = DateTime(date.year, date.month, date.day);
|
||||
return Week(
|
||||
start: _date.subtract(Duration(days: _date.weekday - 1)),
|
||||
end: _date.add(Duration(days: DateTime.daysPerWeek - _date.weekday)),
|
||||
);
|
||||
}
|
||||
|
||||
Week next() => Week.fromDate(start.add(const Duration(days: 8)));
|
||||
|
||||
int get id => -(TimetableController.getSchoolYearStart().difference(start).inDays / DateTime.daysPerWeek).floor();
|
||||
|
||||
@override
|
||||
String toString() => "Week(start: $start, end: $end)";
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => other is Week && id == other.id;
|
||||
|
||||
@override
|
||||
int get hashCode => id;
|
||||
}
|
||||
import 'package:filcnaplo_kreta_api/controllers/timetable_controller.dart';
|
||||
|
||||
class Week {
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
|
||||
Week({required this.start, required this.end});
|
||||
|
||||
factory Week.current() => Week.fromDate(DateTime.now());
|
||||
|
||||
factory Week.fromId(int id) {
|
||||
DateTime _now = TimetableController.getSchoolYearStart().add(Duration(days: id * DateTime.daysPerWeek));
|
||||
DateTime now = DateTime(_now.year, _now.month, _now.day);
|
||||
return Week(
|
||||
start: now.subtract(Duration(days: now.weekday - 1)),
|
||||
end: now.add(Duration(days: DateTime.daysPerWeek - now.weekday)),
|
||||
);
|
||||
}
|
||||
|
||||
factory Week.fromDate(DateTime date) {
|
||||
// fix #32
|
||||
DateTime _date = DateTime(date.year, date.month, date.day);
|
||||
return Week(
|
||||
start: _date.subtract(Duration(days: _date.weekday - 1)),
|
||||
end: _date.add(Duration(days: DateTime.daysPerWeek - _date.weekday)),
|
||||
);
|
||||
}
|
||||
|
||||
Week next() => Week.fromDate(start.add(const Duration(days: 8)));
|
||||
|
||||
int get id => -(TimetableController.getSchoolYearStart().difference(start).inDays / DateTime.daysPerWeek).floor();
|
||||
|
||||
@override
|
||||
String toString() => "Week(start: $start, end: $end)";
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => other is Week && id == other.id;
|
||||
|
||||
@override
|
||||
int get hashCode => id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user