Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GN-4358: addition of a document-type filter to the publication actions page #509

Merged
merged 4 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/publishing-log-document-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default class PublishingLogDocumentNameComponent extends Component {
const versionedBehandeling = logResource.versionedBehandeling;
if (versionedBehandeling) {
documentName = this.intl.t(
'meetings.publish.publication-actions.treatment'
'meetings.publish.publication-actions.extract'
);
versionedResource = await logResource.versionedBehandeling;
const behandeling = await versionedResource.behandeling;
Expand Down
38 changes: 38 additions & 0 deletions app/controllers/meetings/publish/publication-actions/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,49 @@
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { service } from '@ember/service';
import { action } from '@ember/object';

export default class MeetingsPublishPublicationActionsController extends Controller {
queryParams = ['type'];
@service intl;

types = [
{
value: 'agenda',
label: this.intl.t('meetings.publish.agenda.title'),
},
{
value: 'versioned-besluiten-lijst',
label: this.intl.t('meetings.publish.decision-list.title'),
},
{
value: 'versioned-behandeling',
label: this.intl.t('meetings.publish.extracts.title'),
},
{
value: 'versioned-notulen',
label: this.intl.t('meetings.publish.document.title'),
},
];

sort = '-date';
@tracked page = 0;
@tracked pageSize = 20;
@tracked type = null;

@action
updateType(type) {
if (type) {
this.type = type.value;
this.page = 0;
} else {
this.type = null;
}
}

get selectedType() {
return this.types.find((type) => type.value === this.type);
}

actionLabel = (log) => {
return this.intl.t(
Expand Down
31 changes: 26 additions & 5 deletions app/routes/meetings/publish/publication-actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,41 @@ export default class MeetingsPublishPublicationActionsIndexRoute extends Route {
page: { refreshModel: true },
size: { refreshModel: true },
sort: { refreshModel: true },
filter: { refreshModel: true },
type: { refreshModel: true },
// filter params
};

model(params) {
const { sort, size, page, type } = params;
const query = {
filter: { zitting: { ':id:': this.meetingId } },
sort: params.sort,
filter: {
zitting: { ':id:': this.meetingId },
...(type && {
':or:': {
'signed-resource': {
[`:has:${type}`]: 'yes',
},
'published-resource': {
[`:has:${type}`]: 'yes',
},
},
}),
},
sort,
page: {
size: params.size,
number: params.page,
size,
number: page,
},
};

return this.store.query('publishing-log', query);
}

resetController(controller, isExiting) {
if (isExiting) {
controller.set('type', null);
controller.set('sort', '-date');
controller.set('page', 0);
}
}
}
14 changes: 14 additions & 0 deletions app/templates/meetings/publish/publication-actions/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@
{{t 'meetings.publish.publication-actions.title'}}
</AuHeading>
</Group>
<Group>
<AuLabel>
{{t "meetings.publish.publication-actions.document-type-filter.label"}}
</AuLabel>
<PowerSelect
@allowClear={{true}}
@options={{this.types}}
@selected={{this.selectedType}}
@onChange={{this.updateType}}
@placeholder={{t "meetings.publish.publication-actions.document-type-filter.placeholder"}}
as |category|>
{{category.label}}
</PowerSelect>
</Group>
</AuToolbar>
</menu.general>
</table.menu>
Expand Down
5 changes: 4 additions & 1 deletion translations/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,11 @@ meetings:
urgent-agenda: Urgent Agenda
notulen: Document
decision-list: Decision list
treatment: Treatment
extract: Extract
deleted: Deleted
document-type-filter:
label: Document type
placeholder: Select an option
return: Back to all publication actions
details: Details
delete:
Expand Down
5 changes: 4 additions & 1 deletion translations/nl-BE.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,11 @@ meetings:
urgent-agenda: Spoedeisende Agenda
notulen: Notulen
decision-list: Besluitenlijst
treatment: Uittreksel
extract: Uittreksel
deleted: verwijderd
document-type-filter:
label: Type document
placeholder: Selecteer een optie
return: Terug naar alle publicatie acties
details: Details
delete:
Expand Down