31 lines
1.2 KiB
Dart
31 lines
1.2 KiB
Dart
import '../../../errors/app_exception.dart';
|
|
import '../../marianumconnect_query.dart';
|
|
import 'absence_prefill_response.dart';
|
|
|
|
/// GETs the absence-report form prefill (`absence/prefill`, bearer-auth).
|
|
/// Guardians pass the [childId] the report is for; the identity then comes
|
|
/// from that child.
|
|
class AbsencePrefill extends MarianumConnectQuery {
|
|
AbsencePrefill({super.dio});
|
|
|
|
Future<AbsencePrefillResponse> run({String? childId}) => getObject(
|
|
'absence/prefill',
|
|
AbsencePrefillResponse.fromJson,
|
|
queryParameters: {'childId': ?childId},
|
|
);
|
|
}
|
|
|
|
/// The prefill of a guardian's report is missing a field the form cannot ask
|
|
/// for: name and class come from the child and are not editable there, so an
|
|
/// incomplete prefill would leave a locked, unsubmittable form behind.
|
|
class AbsencePrefillIncompleteException extends AppException {
|
|
const AbsencePrefillIncompleteException({super.technicalDetails})
|
|
: super(
|
|
userMessage:
|
|
'Für dieses Kind sind in der Schulverwaltung noch nicht alle '
|
|
'Angaben hinterlegt, die für eine Abwesenheitsmeldung nötig sind. '
|
|
'Bitte wende dich an das Sekretariat.',
|
|
allowRetry: false,
|
|
);
|
|
}
|