fixed guardian login edge cases and misleading placeholders on failed loads
This commit is contained in:
@@ -25,10 +25,17 @@ class ParentLetterFormPolicy {
|
||||
final List<ParentLetterField> fields;
|
||||
final bool signatureRequired;
|
||||
|
||||
/// The letter asks for something this app version drops from [fields].
|
||||
/// Only a required one blocks the form ([ParentLetterFormMode.unsupported]);
|
||||
/// an optional one still has to be named, or the response looks complete
|
||||
/// while a question went unanswered.
|
||||
final bool hasUnsupportedFields;
|
||||
|
||||
const ParentLetterFormPolicy._(
|
||||
this.mode,
|
||||
this.fields,
|
||||
this.signatureRequired,
|
||||
this.hasUnsupportedFields,
|
||||
);
|
||||
|
||||
bool get canSubmit =>
|
||||
@@ -89,6 +96,11 @@ class ParentLetterFormPolicy {
|
||||
? ParentLetterFormMode.change
|
||||
: ParentLetterFormMode.open;
|
||||
}
|
||||
return ParentLetterFormPolicy._(mode, supported, request.signatureRequired);
|
||||
return ParentLetterFormPolicy._(
|
||||
mode,
|
||||
supported,
|
||||
request.signatureRequired,
|
||||
supported.length != request.fields.length,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,10 +101,14 @@ class _ParentLetterResponseCardState extends State<ParentLetterResponseCard> {
|
||||
ParentLetterFormMode.open ||
|
||||
ParentLetterFormMode.change => _form(policy),
|
||||
ParentLetterFormMode.done => _result(theme, policy),
|
||||
// The server locks a response for other reasons too (withdrawn,
|
||||
// finalised), so only name the deadline when there is one.
|
||||
ParentLetterFormMode.closed => [
|
||||
_note(
|
||||
'Die Frist ist abgelaufen. Eine Rückmeldung ist nicht mehr '
|
||||
'möglich.',
|
||||
deadline != null
|
||||
? 'Die Frist ist abgelaufen. Eine Rückmeldung ist nicht '
|
||||
'mehr möglich.'
|
||||
: 'Eine Rückmeldung ist nicht mehr möglich.',
|
||||
),
|
||||
],
|
||||
ParentLetterFormMode.unsupported => [
|
||||
@@ -157,6 +161,15 @@ class _ParentLetterResponseCardState extends State<ParentLetterResponseCard> {
|
||||
),
|
||||
),
|
||||
],
|
||||
if (policy.hasUnsupportedFields)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
child: _note(
|
||||
'Dieser Elternbrief enthält zusätzlich eine Abfrage, die diese '
|
||||
'App-Version nicht anzeigen kann. Bitte aktualisiere die App, um '
|
||||
'vollständig zu antworten.',
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 4, 16, 0),
|
||||
child: AsyncActionButton(
|
||||
|
||||
Reference in New Issue
Block a user