Export: in filter "Filter accompanying period work (social action) by type, goal and result", order the items alphabetically or with the defined order

This commit is contained in:
Julien Fastré 2023-11-16 11:53:57 +01:00
parent ff344dbb0c
commit 89e19502d3
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
3 changed files with 32 additions and 2 deletions

View File

@ -0,0 +1,6 @@
kind: Feature
body: 'Export: in filter "Filter accompanying period work (social action) by type,
goal and result", order the items alphabetically or with the defined order'
time: 2023-11-16T11:53:15.32989153+01:00
custom:
Issue: "161"

View File

@ -14,7 +14,7 @@
:multiple="true"
:close-on-select="false"
:placeholder="$t('action.placeholder')"
label="text"
:custom-label="formatSocialAction"
track-by="id"
:searchable="true"
></VueMultiselect>
@ -161,9 +161,31 @@ export default {
},
methods: {
async getSocialActionsList() {
this.actions.options = await getSocialActions();
let actions = await getSocialActions();
this.actions.options = actions.toSorted(function (a, b) {
console.log(a, b);
if (a.issue.ordering === b.issue.ordering) {
if (a.ordering === b.ordering) {
return 0;
}
if (a.ordering < b.ordering) {
return -1;
}
return 1;
}
if (a.issue.ordering < b.issue.ordering) {
return -1;
}
return 1;
})
},
formatSocialAction({text, issue}) {
return text + ' (' + issue.text + ')';
},
/**
* Select/unselect in Action Multiselect
* @param value
@ -263,6 +285,7 @@ export default {
if (dump.length > 0) {
//console.log('push ' + dump.length + ' elems in', target, dump);
}
data.sort();
},
/**

View File

@ -35,6 +35,7 @@ class SocialIssueNormalizer implements ContextAwareNormalizerInterface, Normaliz
'children_ids' => $socialIssue->getChildren()->map(static fn (SocialIssue $si) => $si->getId()),
'title' => $socialIssue->getTitle(),
'text' => $this->render->renderString($socialIssue, []),
'ordering' => $socialIssue->getOrdering(),
];
case 'docgen':