Skip to content

Commit

Permalink
set-up basic creation-flow of installation meetings for municipalities
Browse files Browse the repository at this point in the history
  • Loading branch information
elpoelma authored and abeforgit committed Jul 13, 2024
1 parent 7f67c79 commit 0a43cb3
Show file tree
Hide file tree
Showing 12 changed files with 120 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-stingrays-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'frontend-gelinkt-notuleren': minor
---

Set-up basic creation-flow for installation meetings (installatievergadering) of a municipal council (gemeenteraad)
1 change: 1 addition & 0 deletions app/components/agenda-manager/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default class AgendaManagerEditComponent extends Component {
}

submitTask = task(async (item) => {
console.log('Item: ', item);
await this.args.saveTask.unlinked().perform(item);
const behandeling = await item.get('behandeling');
if (
Expand Down
10 changes: 9 additions & 1 deletion app/components/meeting-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@
</AuToolbar>
<AuToolbar @size='small' class='au-u-padding-top-none' as |Group|>
<Group>
<h1 class='au-c-app-chrome__title'>{{t 'meeting-form.scheduled-text'}}
<h1 class='au-c-app-chrome__title'>
{{#if this.isInstallationMeeting}}
Installatievergadering gepland op
{{else}}
{{t 'meeting-form.scheduled-text'}}
{{/if}}
{{plain-date @zitting.geplandeStart}}</h1>
{{#if this.status}}
<AuPill @skin='success'>
Expand Down Expand Up @@ -124,6 +129,9 @@
<AuHeading>
{{t 'meeting-form.meeting-heading-part-one'}}
{{t this.headerArticleTranslationString}}
{{#if this.isInstallationMeeting}}
Installatievergadering
{{/if}}
<span
class='au-c-meeting-chrome__highlight'
>{{@zitting.bestuursorgaan.isTijdsspecialisatieVan.naam}},</span>
Expand Down
5 changes: 5 additions & 0 deletions app/components/meeting-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import isValidMandateeForMeeting from 'frontend-gelinkt-notuleren/utils/is-valid
import { articlesBasedOnClassifcationMap } from '../utils/classification-utils';
import { trackedFunction } from 'ember-resources/util/function';
import { trackedTask } from 'ember-resources/util/ember-concurrency';
import InstallatieVergaderingModel from 'frontend-gelinkt-notuleren/models/installatievergadering';

/** @typedef {import("../models/agendapunt").default[]} Agendapunt */

Expand Down Expand Up @@ -67,6 +68,10 @@ export default class MeetingForm extends Component {
return this.args.zitting;
}

get isInstallationMeeting() {
return this.zitting instanceof InstallatieVergaderingModel;
}

get isComplete() {
return !this.zitting?.isNew && this.behandelingen?.length > 0;
}
Expand Down
60 changes: 59 additions & 1 deletion app/controllers/inbox/meetings.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { service } from '@ember/service';
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';

import { action } from '@ember/object';
import InstallatieVergaderingModel from 'frontend-gelinkt-notuleren/models/installatievergadering';
export default class InboxMeetingsController extends Controller {
@service store;
@service currentSession;
@service router;

sort = '-geplande-start';
@tracked debounceTime = 2000;
Expand All @@ -14,4 +16,60 @@ export default class InboxMeetingsController extends Controller {
get readOnly() {
return !this.currentSession.canWrite && this.currentSession.canRead;
}

isInstallationMeeting = (meeting) => {
return meeting instanceof InstallatieVergaderingModel;
};

@action
async createInstallationMeeting() {
let now = new Date();
const bestuursorgaan = (
await this.store.query('bestuursorgaan', {
include: [
'is-tijdsspecialisatie-van.bestuurseenheid',
'is-tijdsspecialisatie-van.classificatie',
].join(','),
filter: {
'is-tijdsspecialisatie-van': {
bestuurseenheid: {
id: this.currentSession.group.id,
},
classificatie: {
':uri:':
'http://data.vlaanderen.be/id/concept/BestuursorgaanClassificatieCode/5ab0e9b8a3b2ca7c5e000005',
},
},
},
})
)[0];
const installationmeeting = this.store.createRecord(
'installatievergadering',
{
geplandeStart: now,
gestartOpTijdstip: now,
bestuursorgaan,
},
);
await installationmeeting.save();
const promises = [];
let previousAgendapoint;
for (let i = 0; i < 9; i++) {
const agendapoint = this.store.createRecord('agendapunt', {
position: i,
geplandOpenbaar: true,
titel: `Naam Agendapunt ${i}`,
zitting: installationmeeting,
vorigeAgendapunt: previousAgendapoint,
});
const treatment = this.store.createRecord('behandeling-van-agendapunt', {
openbaar: true,
onderwerp: agendapoint,
});
promises.push(agendapoint.save(), treatment.saveAndPersistDocument());
previousAgendapoint = agendapoint;
}
await Promise.all(promises);
this.router.replaceWith('meetings.edit', installationmeeting.id);
}
}
2 changes: 1 addition & 1 deletion app/models/agenda.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class Agenda extends Model {
@attr renderedContent;
@attr('boolean', { defaultValue: false }) deleted;

@belongsTo('zitting', { inverse: null }) zitting;
@belongsTo('zitting', { inverse: null, polymorphic: true }) zitting;
@belongsTo('published-resource', { inverse: 'agenda' }) publishedResource;

@hasMany('signed-resource', { inverse: 'agenda' }) signedResources;
Expand Down
6 changes: 5 additions & 1 deletion app/models/agendapunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ export default class Agendapunt extends Model {
@attr('number') position;

@belongsTo('agendapunt', { inverse: null }) vorigeAgendapunt;
@belongsTo('zitting', { inverse: 'agendapunten' }) zitting;
@belongsTo('zitting', {
inverse: 'agendapunten',
polymorphic: true,
})
zitting;
@belongsTo('behandeling-van-agendapunt', { inverse: 'onderwerp' })
behandeling;

Expand Down
3 changes: 3 additions & 0 deletions app/models/installatievergadering.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ZittingModel from './zitting';

export default class InstallatieVergaderingModel extends ZittingModel {}
6 changes: 5 additions & 1 deletion app/models/intermission.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ export default class IntermissionModel extends Model {
@attr('datetime') startedAt;
@attr('datetime') endedAt;
@attr comment;
@belongsTo('zitting', { inverse: 'intermissions' }) zitting;
@belongsTo('zitting', {
inverse: 'intermissions',
polymorphic: true,
})
zitting;
@belongsTo('agenda-position', { inverse: null }) agendaPosition;
}
4 changes: 2 additions & 2 deletions app/models/mandataris.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export default class MandatarisModel extends Model {
aanwezigBijBehandeling;
@hasMany('behandeling-van-agendapunt', { inverse: null })
afwezigBijBehandeling;
@hasMany('zitting', { inverse: null }) aanwezigBijZitting;
@hasMany('zitting', { inverse: null }) afwezigBijZitting;
@hasMany('zitting', { inverse: null, polymorphic: true }) aanwezigBijZitting;
@hasMany('zitting', { inverse: null, polymorphic: true }) afwezigBijZitting;

rdfaBindings = {
class: 'http://data.vlaanderen.be/ns/mandaat#Mandataris',
Expand Down
2 changes: 1 addition & 1 deletion app/models/publishing-log.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export default class PublishingLogs extends Model {
@belongsTo('published-resource') publishedResource;

@belongsTo('gebruiker') user;
@belongsTo('zitting') zitting;
@belongsTo('zitting', { polymorphic: true }) zitting;
}
31 changes: 24 additions & 7 deletions app/templates/inbox/meetings.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,24 @@
</Group>
<Group class='au-c-toolbar__group--center au-u-hide-on-print'>
{{#unless this.readOnly}}
<AuLink
@route='inbox.meetings.new'
@skin='button'
@icon='add'
@iconAlignment='left'
>{{t 'inbox.meetings.new.title'}}</AuLink>
<AuDropdown
@skin="primary"
@title="Zitting aanmaken"
@alignment="left"
@icon="chevron-down"
role="menu">
<AuLink
@route='inbox.meetings.new'
role='menuitem'>
{{t 'inbox.meetings.new.title'}}
</AuLink>
<AuButton

@skin="link"
{{on 'click' this.createInstallationMeeting}}
role='menuitem'
>Installatievergadering aanmaken</AuButton>
</AuDropdown>
{{/unless}}
</Group>
</AuToolbar>
Expand Down Expand Up @@ -56,7 +68,12 @@
@route='meetings.edit'
@model={{meeting.id}}
class='au-c-link'
>{{t 'inbox.meetings.meeting-of'}}
>
{{#if (this.isInstallationMeeting meeting)}}
Installatievergadering
{{else}}
{{t 'inbox.meetings.meeting-of'}}
{{/if}}
{{meeting.bestuursorgaan.isTijdsspecialisatieVan.naam}}
{{t 'inbox.meetings.at'}}
{{detailed-date meeting.geplandeStart}}</LinkTo>
Expand Down

0 comments on commit 0a43cb3

Please sign in to comment.