Skip to content
This repository has been archived by the owner on Jul 7, 2023. It is now read-only.

Commit

Permalink
feat: add bibleReading to the second school talk list
Browse files Browse the repository at this point in the history
  • Loading branch information
BenShelton committed Oct 15, 2019
1 parent 360901a commit c2faf43
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/components/Schedule/ScheduleAssignment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default Vue.extend({
hasSecondSchool (): boolean {
const { details } = this.assignment
if (!details) return false
return SECOND_SCHOOL && ['initialCall', 'returnVisit', 'bibleStudy', 'studentTalk'].includes(details.type)
return SECOND_SCHOOL && ['initialCall', 'returnVisit', 'bibleStudy', 'studentTalk', 'bibleReading'].includes(details.type)
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/Schedule/ScheduleWeekView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ export default class ScheduleWeekView extends Vue {
}
get hasSecondSchool (): boolean {
return SECOND_SCHOOL && ['initialCall', 'returnVisit', 'bibleStudy', 'studentTalk'].includes(this.editAssignment.type)
return SECOND_SCHOOL && ['initialCall', 'returnVisit', 'bibleStudy', 'studentTalk', 'bibleReading'].includes(this.editAssignment.type)
}
// Methods
Expand Down
21 changes: 10 additions & 11 deletions src/plugins/pdfMake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
ScheduleWeek
} from 'types'

type ScheduleTableRow = [string | null, string, string | null, string | null, string | null, boolean?] | null
type ScheduleTableRow = [string | null, string, string | null, string | null, string | null, boolean?, boolean?] | null

pdfMake.vfs = pdfFonts.pdfMake.vfs

Expand Down Expand Up @@ -190,7 +190,7 @@ function getScheduleAssignees (assignment?: IScheduleAssignment): string {
if (!assignment) return ''
if (assignment.stream) return '(Video Stream)'
const { type, assignee, assistant, assignee2, assistant2 } = assignment
if (SECOND_SCHOOL && ['initialCall', 'returnVisit', 'bibleStudy', 'studentTalk'].includes(type)) {
if (SECOND_SCHOOL && ['initialCall', 'returnVisit', 'bibleStudy', 'studentTalk', 'bibleReading'].includes(type)) {
if (['initialCall', 'returnVisit', 'bibleStudy'].includes(type)) {
return getAssigneeName(assignee, '-', true) + ' & ' + getAssigneeName(assistant, '-', true) + ' | ' + getAssigneeName(assignee2, '-', true) + ' & ' + getAssigneeName(assistant2, '-', true)
} else {
Expand Down Expand Up @@ -228,7 +228,7 @@ function createScheduleSeparator (pageStart = false): Content {
}
}

function createScheduleTable (markerColor: string, rows: ScheduleTableRow[], expandAssigneeName = false): Content {
function createScheduleTable (markerColor: string, rows: ScheduleTableRow[]): Content {
const body = []
for (const row of rows) {
const bodyRow: Content[] = []
Expand All @@ -237,18 +237,18 @@ function createScheduleTable (markerColor: string, rows: ScheduleTableRow[], exp
bodyRow.push({ text: '', colSpan: 7 })
continue
}
const [timeOn, title, assigneeTitle, assigneeName, timeOff] = row
const [timeOn, title, assigneeTitle, assigneeName, timeOff, , expandAssigneeName = false] = row
bodyRow.push(
{ text: timeOn || '' },
{ text: '•', fontSize: 24, color: markerColor, margin: [0, -8] },
{ text: title, paddingLeft: 0, colSpan: expandAssigneeName ? 1 : 2 }
)
if (SECOND_SCHOOL && expandAssigneeName) {
bodyRow.push({ text: assigneeName || '', colSpan: 3 }, { text: '' }, { text: '' })
bodyRow.push({ text: assigneeName || '', colSpan: 3, alignment: 'right' }, { text: '' }, { text: '' })
} else {
if (!expandAssigneeName) bodyRow.push({ text: '' })
bodyRow.push({ text: assigneeTitle || '', fontSize: 8, color: '#6F6F6F', alignment: 'right', margin: [0, 1, 0, 0] })
bodyRow.push({ text: assigneeName || '', colSpan: expandAssigneeName ? 2 : 1 })
bodyRow.push({ text: assigneeName || '', colSpan: expandAssigneeName ? 2 : 1, alignment: 'right' })
if (expandAssigneeName) bodyRow.push({ text: '' })
}
bodyRow.push({ text: timeOff || '', alignment: 'right' })
Expand Down Expand Up @@ -390,7 +390,7 @@ export const generateSchedule: PDFGenerator = function (weeks, month) {
stack.push(createScheduleTable(COLORS.TREASURES, [
[timer, getAssignmentTitle(highlights), null, getScheduleAssignees(highlights), addTime(highlights.time), highlights.inherit],
[timer, translation.gems + ' (10 min.)', null, getScheduleAssignees(gems), addTime(gems.time), gems.inherit],
[timer, bibleReadingTitle, null, getScheduleAssignees(bibleReading), addTime(bibleReading.time), bibleReading.inherit]
[timer, bibleReadingTitle, null, getScheduleAssignees(bibleReading), addTime(bibleReading.time), bibleReading.inherit, true]
]))

// MINISTRY Section
Expand All @@ -406,9 +406,9 @@ export const generateSchedule: PDFGenerator = function (weeks, month) {
let assigneeTitle = `${translation.student}/${translation.assistant}:`
if (studentTalk.type === 'ministryVideo') assigneeTitle = ''
if (studentTalk.type === 'studentTalk') assigneeTitle = translation.student + ':'
ministryTableRows.push([timer, getAssignmentTitle(studentTalk), assigneeTitle, getScheduleAssignees(studentTalk), addTime(studentTalk.time), studentTalk.inherit])
ministryTableRows.push([timer, getAssignmentTitle(studentTalk), assigneeTitle, getScheduleAssignees(studentTalk), addTime(studentTalk.time), studentTalk.inherit, true])
}
stack.push(createScheduleTable(COLORS.MINISTRY, ministryTableRows, true))
stack.push(createScheduleTable(COLORS.MINISTRY, ministryTableRows))

// LIVING Section
stack.push(createScheduleSubheader(translation.living, COLORS.LIVING))
Expand Down Expand Up @@ -603,7 +603,6 @@ export const generateAssignmentSlips: PDFGenerator = function (weeks, month) {

const slips = []
const VALID_TYPES = ['bibleReading', 'initialCall', 'returnVisit', 'bibleStudy', 'studentTalk']
const SECOND_SCHOOL_TYPES = ['initialCall', 'returnVisit', 'bibleStudy', 'studentTalk']
const language = scheduleModule.language
const translation = ASSIGNMENT_SLIP_TRANSLATIONS[language]
if (!translation) throw new Error('Translations not created for the selected language')
Expand All @@ -619,7 +618,7 @@ export const generateAssignmentSlips: PDFGenerator = function (weeks, month) {
const talk: IScheduleAssignment | undefined = assignments[index]
if (!talk || talk.inherit || !(VALID_TYPES.includes(talk.type))) continue
slips.push(createSlip(translation, talk, false, date))
if (SECOND_SCHOOL && SECOND_SCHOOL_TYPES.includes(talk.type)) slips.push(createSlip(translation, talk, true, date))
if (SECOND_SCHOOL) slips.push(createSlip(translation, talk, true, date))
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ export default Vue.extend({
'Simplifies user experience for changing languages and logging in',
'Date picker no longer closes immediately',
'Use correct color on printed schedule for Treasures bullet points',
'Clears month data when leaving schedule page'
'Clears month data when leaving schedule page',
'Update layout of schedule printout to support second school'
]
},
{
Expand Down

0 comments on commit c2faf43

Please sign in to comment.