mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-08 12:07:54 -06:00
Fixes labels being serialized incorrectly, automates tag serialization
This commit is contained in:
@@ -54,8 +54,9 @@ class _LabelFormState<T extends Label> extends State<LabelForm<T>> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_enableMatchFormField =
|
||||
widget.initialValue?.matchingAlgorithm != MatchingAlgorithm.auto;
|
||||
_enableMatchFormField = (widget.initialValue?.matchingAlgorithm ??
|
||||
MatchingAlgorithm.defaultValue) !=
|
||||
MatchingAlgorithm.auto;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -83,8 +84,9 @@ class _LabelFormState<T extends Label> extends State<LabelForm<T>> {
|
||||
),
|
||||
FormBuilderDropdown<int?>(
|
||||
name: Label.matchingAlgorithmKey,
|
||||
initialValue: widget.initialValue?.matchingAlgorithm.value ??
|
||||
MatchingAlgorithm.auto.value,
|
||||
initialValue: (widget.initialValue?.matchingAlgorithm ??
|
||||
MatchingAlgorithm.defaultValue)
|
||||
.value,
|
||||
decoration: InputDecoration(
|
||||
labelText: S.of(context).labelMatchingAlgorithmPropertyLabel,
|
||||
errorText: _errors[Label.matchingAlgorithmKey],
|
||||
@@ -99,7 +101,8 @@ class _LabelFormState<T extends Label> extends State<LabelForm<T>> {
|
||||
.map(
|
||||
(algo) => DropdownMenuItem<int?>(
|
||||
child: Text(
|
||||
translateMatchingAlgorithmDescription(context, algo)),
|
||||
translateMatchingAlgorithmDescription(context, algo),
|
||||
),
|
||||
value: algo.value,
|
||||
),
|
||||
)
|
||||
@@ -139,8 +142,8 @@ class _LabelFormState<T extends Label> extends State<LabelForm<T>> {
|
||||
// If auto is selected, the match will be removed.
|
||||
mergedJson[Label.matchKey] = '';
|
||||
}
|
||||
final createdLabel = await widget.submitButtonConfig
|
||||
.onSubmit(widget.fromJsonT(mergedJson));
|
||||
final parsed = widget.fromJsonT(mergedJson);
|
||||
final createdLabel = await widget.submitButtonConfig.onSubmit(parsed);
|
||||
Navigator.pop(context, createdLabel);
|
||||
} on PaperlessServerException catch (error, stackTrace) {
|
||||
showErrorMessage(context, error, stackTrace);
|
||||
|
||||
Reference in New Issue
Block a user