Skip to content

Commit

Permalink
Merge pull request #929 from OpenSourceFellows/tuolumne_letter_stub
Browse files Browse the repository at this point in the history
Added hardcoded tuolumne letter
  • Loading branch information
DietBepis1 authored May 28, 2024
2 parents 608f27f + 61dd70b commit ec71bb2
Show file tree
Hide file tree
Showing 6 changed files with 212 additions and 6 deletions.
17 changes: 17 additions & 0 deletions server/db/migrations/20240528133030_adjust_letter_data_types.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
async up(knex) {
await knex.schema.alterTable('letters', (table) => {
table.dropColumn('letter_template')
})

await knex.schema.alterTable('letters', (table) => {
table.text('letter_template')
})
},

async down(knex) {
knex.schema.alterTable('letters', (table) => {
table.dropColumn('letter_template')
})
}
}
3 changes: 1 addition & 2 deletions server/lib/stripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Stripe {
* Think of this as a server-side analog to the 'livemode' attribute on mode Stripe objects. In fact,
* an event object's livemode value and this method should always match.
*/
get livemode() {
livemode() {
return this.livemode === 'true'
}

Expand Down Expand Up @@ -68,7 +68,6 @@ class Stripe {
success_url: redirectUrl,
cancel_url: cancelUrl
})
console.log(session)

return {
url: session.url,
Expand Down
2 changes: 2 additions & 0 deletions server/routes/api/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ router.post('/create-checkout-session', async (req, res) => {
statusCode = 400
}

console.error(error)

// TODO: error logging
return res.status(statusCode).json({ error: error.message }).end()
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/DonateMoney.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default {
city: rep.address_city,
zip: rep.address_zip,
returnAddress: returnAddressId,
mergeVariables
merge_variables: mergeVariables
}
},
styledCustomDonation() {
Expand Down
7 changes: 4 additions & 3 deletions src/components/TakeAction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
</v-list-item>
</v-expansion-panel-header>
<v-expansion-panel-content>
<letter-load :selected-rep="selectedRep" :letter-body="letterBody" />
<!-- <letter-load :selected-rep="selectedRep" :letter-body="letterBody" /> -->
<TuolumneLetterLoad :selected-rep="selectedRep" :letter-body="letterBody" />
</v-expansion-panel-content>
<v-expansion-panel-content>
<v-btn
Expand Down Expand Up @@ -136,13 +137,13 @@
</template>

<script>
import LetterLoad from '@/components/LetterLoad.vue'
import TuolumneLetterLoad from '@/components/TuolumneLetterLoad.vue'
import SignName from '@/components/SignName.vue'
import DonateMoney from '@/components/DonateMoney.vue'
export default {
name: 'TakeAction',
components: { LetterLoad, SignName, DonateMoney },
components: { TuolumneLetterLoad, SignName, DonateMoney },
props: {
letterBody: {
type: String,
Expand Down
187 changes: 187 additions & 0 deletions src/components/TuolumneLetterLoad.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<template>
<section class="letter-load">
<v-card flat>
<div v-show="isSubmitted">
<v-card-subtitle align="left">
<div class="text-left">
{{ currentDate }}
</div>
<div>{{ selectedRep.name }}</div>
<div>{{ selectedRep.address_line1 }}</div>
<div>
{{ selectedRep.address_city }}, {{ selectedRep.address_state }},
{{ selectedRep.address_zip }}
</div>
<br />
<div>{{ user.name }}</div>
<div>
{{ user.line1 }}
<br />
{{ user.line2 }}
</div>
<div>
{{ formattedCityState }}
</div>
</v-card-subtitle>
<v-card-title class="salutation">
Dear {{ selectedRep.name }},
</v-card-title>

<v-card-text>
<div>
<p>
<span style="color: rgb(0, 0, 0); font-size: 10pt"
>As a <strong>{{ constituentType }}</strong></span
><span style="color: rgb(0, 0, 0); font-size: 10pt">, &nbsp;</span
><span style="color: rgb(0, 0, 0); font-size: 10pt"
>I&rsquo;m extremely concerned about our skyrocketing “water and
sewer bills” and the The Design Drought.</span
><span style="color: rgb(0, 0, 0); font-size: 10pt">
San Francisco&rsquo;s combined water and sewer bills are
projected to increase by 8% per year.&nbsp;</span
>
</p>
<p>
<span style="color: rgb(0, 0, 0); font-size: 10pt">
<strong>{{ communityInput }}</strong> At a time when taxpayer water rates are set
to skyrocket for San Franciscans, the SFPUC budget is on the
verge of collapse, and low flows along the Tuolumne River
contribute to the erosion of health for all species, the
economic and ecological tipping point is now.</span
>
</p>
<p>
<span style="color: rgb(0, 0, 0); font-size: 10pt"
>The Design Drought arbitrarily combines two of the worst
droughts on record to create a&nbsp;</span
><span style="color: rgb(0, 0, 0); font-size: 10pt"
>megadrought that might occur once in 25,000 years. It assumes a
huge increase in water use,&nbsp;</span
><span style="color: rgb(0, 0, 0); font-size: 10pt"
>despite the fact that water demand has decreased significantly
over the past three decades.&nbsp;</span
><span style="color: rgb(0, 0, 0); font-size: 10pt"
>The Design Drought has prompted the SFPUC to create an
Alternative Water Supply Plan that &nbsp;</span
><span style="color: rgb(0, 0, 0); font-size: 10pt"
>would cost between $17 billion and $25 billion. This would
double the SFPUC budget (and water rates) to produce expensive
water we won&rsquo;t ever need.&nbsp;</span
>
</p>
<p>
<span style="color: rgb(0, 0, 0); font-size: 10pt"
>Thank you for your continued attention.&nbsp;</span
><span style="color: rgb(0, 0, 0); font-size: 10pt"
>I support n</span
><span style="color: rgb(0, 0, 0); font-size: 10pt"
>ot approving the new budget with rate increases</span
><span style="color: rgb(0, 0, 0); font-size: 10pt"
>&nbsp;and am following this issue closely and with great
concern.</span
>
</p>
</div>
</v-card-text>

<v-card-text>
<v-select
v-model="constituentType"
:items="reasons"
label="You are a ..."
/>
<v-select
v-model="communityInput"
:items="affects"
label="How this affects your community"
/>
</v-card-text>

<p>{{ user.name }}</p>
</div>
<div v-show="!isSubmitted">
<v-card-text> clicked</v-card-text>

<div class="col-md text-center text-md-left">
<!--<h2>You are logged in as {{ $auth.user.name }}</h2>
{ JSON.stringify($auth.user, null, 2) }} -->
</div>
</div>
<!--
<v-card-actions class="justify-center">
<v-btn>
<AuthNav />
</v-btn>
</v-card-actions>
-->
</v-card>
</section>
</template>

<script lang="js">
// import AuthNav from '@/components/AuthNav'
// import { mapState } from 'vuex';
export default {
name: 'TuolumneLetterLoad',
components: {
/* AuthNav */
},
props: {
letterBody: { type: String, default: '' }
},
data() {
return {
isSubmitted: true,
constituentType: '<fill in the input below>',
communityInput: '<fill in the input below>',
reasons: [
'a resident of San Francisco and someone who cares deeply about the Tuolumne River',
'a person adjacent to Hetch Hetchy and someone who cares deeply about the Tuolumne River',
'someone who cares deeply about the Tuolumne River'
],
affects: [
'I\'m already struggling to pay my utility bill.',
'This will place an undue burden on my monthly bills.',
'Rate increases hit lower income residents especially hard.',
],
}
},
computed: {
selectedRep() {
return this.$store.state.selectedRep
},
user() {
return this.$store.state.userData
},
currentDate() {
return new Intl.DateTimeFormat('en-US').format(new Date())
},
formattedCityState() {
if (this.user.city) {
return `${this.user.city}, ${this.user.state} ${this.user.zip}`
}
return ''
},
mergeVariables() {
return { constituentType: this.constituentType, communityInput: this.communityInput }
}
},
watch: {
mergeVariables: function() {
this.$store.commit('setGenericValue', { key: 'mergeVariables', value: this.mergeVariables })
}
}
}
</script>

<style scoped lang="less">
.letter-load {
}
.salutation {
font-size: 18px;
}
</style>

0 comments on commit ec71bb2

Please sign in to comment.