Added recurrence to new request add/edit page (#16)

still need to get the actual non-immediate recurrence stuff to work correctly
This commit is contained in:
Daniel J. Summers 2018-08-18 13:46:03 -05:00
parent 0c21e6c1c0
commit 9f1e258180
2 changed files with 78 additions and 17 deletions

View File

@ -101,6 +101,14 @@ a[role="button"]:hover {
color: white; color: white;
text-decoration: none; text-decoration: none;
} }
label {
font-variant: small-caps;
font-size: 1.1rem;
}
label.normal {
font-variant: unset;
font-size: unset;
}
footer { footer {
border-top: solid 1px lightgray; border-top: solid 1px lightgray;
margin-top: 1rem; margin-top: 1rem;

View File

@ -12,22 +12,52 @@ article.mpj-main-content(role='main')
template(v-if='!isNew') template(v-if='!isNew')
label Also Mark As label Also Mark As
br br
input(type='radio' label.normal
id='status_updated' input(v-model='form.status'
value='Updated' type='radio'
v-model='form.status') name='status'
label(for='status_updated')= ' Updated' value='Updated')
input(type='radio' | Updated
id='status_prayed' |    
value='Prayed' label.normal
v-model='form.status') input(v-model='form.status'
label(for='status_prayed')= ' Prayed' type='radio'
input(type='radio' name='status'
id='status_answered' value='Prayed')
value='Answered' | Prayed
v-model='form.status') |    
label(for='status_answered')= ' Answered' label.normal
br(v-else) input(v-model='form.status'
type='radio'
name='status'
value='Answered')
| Answered
br
label Recurrence
|    
em.mpj-muted-text After prayer, request reappears...
br
label.normal
input(v-model='form.recur.typ'
type='radio'
name='recur'
value='immediate')
| Immediately
|    
label.normal
input(v-model='form.recur.typ'
type='radio'
name='recur'
value='other')
| Every...
input#recur_count(v-model='form.recur.count'
type='number'
:disabled='!showRecurrence')
select(v-model='form.recur.other'
:disabled='!showRecurrence')
option(value='hours') hours
option(value='days') days
option(value='weeks') weeks
.mpj-text-right .mpj-text-right
button(@click.stop='saveRequest()').primary button(@click.stop='saveRequest()').primary
md-icon(icon='save') md-icon(icon='save')
@ -60,7 +90,12 @@ export default {
form: { form: {
requestId: '', requestId: '',
requestText: '', requestText: '',
status: 'Updated' status: 'Updated',
recur: {
typ: 'immediate',
other: '',
count: ''
}
} }
} }
}, },
@ -68,6 +103,9 @@ export default {
toast () { toast () {
return this.$parent.$refs.toast return this.$parent.$refs.toast
}, },
showRecurrence () {
this.form.recur.typ !== 'immediate'
},
...mapState(['journal']) ...mapState(['journal'])
}, },
async mounted () { async mounted () {
@ -77,6 +115,9 @@ export default {
this.form.requestId = '' this.form.requestId = ''
this.form.requestText = '' this.form.requestText = ''
this.form.status = 'Created' this.form.status = 'Created'
this.form.recur.typ = 'immediate'
this.form.recur.other = ''
this.form.recur.count = ''
} else { } else {
this.title = 'Edit Prayer Request' this.title = 'Edit Prayer Request'
this.isNew = false this.isNew = false
@ -87,6 +128,15 @@ export default {
this.form.requestId = this.id this.form.requestId = this.id
this.form.requestText = req.text this.form.requestText = req.text
this.form.status = 'Updated' this.form.status = 'Updated'
if (req.recurType === 'immediate') {
this.form.recur.typ = 'immediate'
this.form.recur.other = ''
this.form.recur.count = ''
} else {
this.form.recur.typ = 'other'
this.form.recur.other = req.recurType
this.form.recur.count = req.recurCount
}
} }
}, },
methods: { methods: {
@ -126,4 +176,7 @@ export default {
#request_text { #request_text {
width: 100%; width: 100%;
} }
#recur_count {
width: 3rem;
}
</style> </style>