Skip to content

Commit

Permalink
gets at-large council members into table
Browse files Browse the repository at this point in the history
  • Loading branch information
ajrothwell committed Jul 24, 2024
1 parent 437de4d commit db76170
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/components/topics/Ballots.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ const nextElectionDate = computed(() => {
>
</div>

<!-- class="table-link" -->
<a
class="table-link"
target="_blank"
:href="'https://vote.phila.gov/voting/vote-by-mail/'"
>{{ $t('ballot.topic.links.link1') }} <font-awesome-icon icon="fa-solid fa-external-link-alt" /></a>
Expand Down
32 changes: 26 additions & 6 deletions src/components/topics/ElectedOfficials.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ import useTransforms from '@/composables/useTransforms';
const { nth, phoneNumber, titleCase } = useTransforms();
import { useElectedOfficialsStore } from '@/stores/ElectedOfficialsStore';
import { computed } from 'vue';
import { computed, getCurrentInstance } from 'vue';
import VerticalTable from '@/components/VerticalTable.vue';
const ElectedOfficialsStore = useElectedOfficialsStore();
const instance = getCurrentInstance();
import i18nFromFiles from '@/i18n/i18n.js';
const messages = computed(() => {
return i18nFromFiles.i18n.data.messages[instance.appContext.config.globalProperties.$i18n.locale];
})
if (import.meta.env.VITE_DEBUG == 'true') console.log('messages:', messages);
const formatMember = (person, termLength, districtLabel) => {
if (import.meta.env.VITE_DEBUG == 'true') console.log('person:', person);
Expand Down Expand Up @@ -88,6 +95,19 @@ const electedOfficial = computed(() => {
return value2;
});
const councilAtLarge = computed(() => {
if (!ElectedOfficialsStore.electedOfficials.rows || !ElectedOfficialsStore.electedOfficials.rows.length) return null;
let councilAtLarge = ElectedOfficialsStore.electedOfficials.rows.filter((item) => {
return item.office == "city_council_at_large";
});
let theString = '';
for (const [ index, councilMember ] of councilAtLarge.entries()) {
theString += formatMember(councilMember, 4);
index < councilAtLarge.length - 1 ? theString += '<br><br>' : theString += '';
}
return theString;
});
// const council = computed(() => {
// if (electedOfficials.value) {
// let value = electedOfficials.value.filter((item) => {
Expand Down Expand Up @@ -124,13 +144,13 @@ const electedOfficial = computed(() => {
const electedRepsData = computed(() => [
{
label: 'District Council Member',
label: messages.value.electedOfficials.topic.verticalTable1.districtCouncilMember,
value: electedOfficial.value,
},
// {
// label: 'City Hall Office',
// value: office.value,
// },
{
label: messages.value.electedOfficials.topic.verticalTable1.atLargeCouncilMembers,
value: councilAtLarge.value,
},
// {
// label: 'Current Term',
// value: term.value,
Expand Down
2 changes: 1 addition & 1 deletion src/components/topics/PollingPlace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ const pollingPlaceData = computed(() => {
:table-id="'pollingPlaceTable'"
:data="pollingPlaceData"
/>
<!-- class="table-link" -->
<a
class="table-link"
target="_blank"
:href="`https://vote.phila.gov/voting/vote-by-mail/`"
>{{ $t('pollingPlace.topic.verticalTable1.link') }} <font-awesome-icon icon="fa-solid fa-external-link-alt" /></a>
Expand Down
6 changes: 3 additions & 3 deletions src/i18n/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ export default {
"term": "Term",
"pollingPlace": "Polling Place",
"verticalTable1": {
"title": "City Officials",
"districtCouncilMember": "District Council Member",
"atLargeCouncilMembers": "At-Large Council Members",
"title": "Spanish City Officials",
"districtCouncilMember": "Spanish District Council Member",
"atLargeCouncilMembers": "Spanish At-Large Council Members",
"mayor": "Mayor",
"districtAttorney": "District Attorney",
"controller": "Controller",
Expand Down
1 change: 1 addition & 0 deletions src/stores/ElectedOfficialsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const useElectedOfficialsStore = defineStore("ElectedOfficialsStore", {
OR eo.office = 'state_house' AND eo.district = s.state_house \
OR eo.office = 'state_senate' AND eo.district = s.state_senate \
OR eo.office = 'us_house' AND eo.district = s.federal_house \
OR eo.office != 'city_council' AND eo.office != 'state_house' AND eo.office != 'state_senate' AND eo.office != 'us_house' \
`;
const response = await fetch(url);
this.electedOfficials = await response.json();
Expand Down

0 comments on commit db76170

Please sign in to comment.