-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 💄 refactored routes + added a sidebar to the municipality + ref…
…actored code to be more optimised
- Loading branch information
1 parent
f4d6f5c
commit 65c951f
Showing
68 changed files
with
707 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Controller from '@ember/controller'; | ||
|
||
export default class Index extends Controller.extend({ | ||
// anything which *must* be merged to prototype here | ||
}) { | ||
// normal class body definition here | ||
} | ||
|
||
// DO NOT DELETE: this is how TypeScript knows how to look up your controllers. | ||
declare module '@ember/controller' { | ||
interface Registry { | ||
'index': Index; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import Controller from '@ember/controller'; | ||
import { action } from '@ember/object'; | ||
import { inject as service } from '@ember/service'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import axios from 'axios'; | ||
import ToasterService from 'frontend/services/toaster'; | ||
import { Municipality } from 'index'; | ||
import { municipality_data } from '../../data/municipality-data'; | ||
|
||
export default class BesluitenForm extends Controller { | ||
@service declare toaster: ToasterService; | ||
@tracked category: string = 'Categorie'; | ||
@tracked name: string = 'Titel'; | ||
@tracked aanwezig: string = 'Senne Bels'; | ||
@tracked juridische_grond: string = 'Aarde'; | ||
@tracked context_en_argumentatie: string = 'Goeie argumentatie'; | ||
@tracked besluit: string = 'Besluit'; | ||
@tracked for: string = 'Voor'; | ||
@tracked against: string = 'Tegen'; | ||
@tracked neutral: string = 'Neutraal'; | ||
@tracked begin: string = 'Begin'; | ||
@tracked end: string = 'Einde'; | ||
@tracked accepted: boolean = true; | ||
@tracked query: any = 'Antwerpen'; | ||
@tracked municipalityData = municipality_data; | ||
|
||
@action toggleAccepted() { | ||
this.accepted = !this.accepted; | ||
} | ||
|
||
@action searchRepo(term: string) { | ||
if (term === '') { | ||
return this.municipalityData; | ||
} | ||
return this.municipalityData.filter((municipality: Municipality) => | ||
municipality.title.toLowerCase().includes(term.toLowerCase()) | ||
); | ||
} | ||
|
||
@action async submitDecision() { | ||
await axios | ||
.post( | ||
`http://localhost:3000/municipality/${this.query.title.toLowerCase()}/besluiten`, | ||
{ | ||
category: this.category, | ||
name: this.name, | ||
date: { | ||
begin: this.begin, | ||
end: this.end, | ||
}, | ||
body: { | ||
aanwezig: this.aanwezig, | ||
juridische_grond: this.juridische_grond, | ||
context_en_argumentatie: this.context_en_argumentatie, | ||
besluit: this.besluit, | ||
}, | ||
municipal_vote: { | ||
for: this.for, | ||
against: this.against, | ||
neutral: this.neutral, | ||
}, | ||
accepted: this.accepted, | ||
} | ||
) | ||
.then(() => { | ||
this.toaster.success(`Besluit toegevoegd aan databank`, 'Success'); | ||
}) | ||
.catch((err) => { | ||
console.log(err); | ||
this.toaster.success(`Er is iets fout gegaan`, 'Error'); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.