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

Commit

Permalink
Merge pull request #84 from BenShelton/develop
Browse files Browse the repository at this point in the history
Version 1.1 Release
  • Loading branch information
BenShelton authored Oct 15, 2019
2 parents 4866b0c + 8de6052 commit bf00cda
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 21 deletions.
1 change: 1 addition & 0 deletions database/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ const members: ICongregationMember[] = data.map(row => ({
gender: row.gender,
languageGroup: row.languageGroup,
show: !!row.show,
school: null,
privileges: {
chairman: !!row['privileges.chairman'],
highlights: !!row['privileges.highlights'],
Expand Down
4 changes: 2 additions & 2 deletions lambda/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ function validateMember (member: Omit<ICongregationMember, '_id'>): string | nul
}

router.post('/congregation/addMember', (req, res) => {
const { name, appointment, gender, languageGroup, privileges, show } = req.body as APITypes.Congregation.AddMember.Data
const member = { name, appointment, gender, languageGroup, privileges, show }
const { name, appointment, gender, languageGroup, school, privileges, show } = req.body as APITypes.Congregation.AddMember.Data
const member = { name, appointment, gender, languageGroup, school, privileges, show }
const validationError = validateMember(member)
if (validationError) return res.status(400).json({ message: validationError })
congregation.addMember(member)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oclm-planner",
"version": "0.1.0",
"version": "1.1.0",
"private": true,
"scripts": {
"serve": "npm-run-all --parallel serve:**",
Expand Down
4 changes: 3 additions & 1 deletion src/components/AssigneeSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default Vue.extend({
value: { type: String, default: '' },
label: { type: String, required: true },
type: { type: String as PropType<Privileges>, default: '' as Privileges },
school: { type: Number, required: true },
disabled: { type: Boolean, required: true }
},
Expand All @@ -66,8 +67,9 @@ export default Vue.extend({
privilegedMembers (): ICongregationMember[] {
const { inputDisabled, type, restrictLanguage } = this
if (inputDisabled || !type) return []
return congregationModule.activeMembers.filter(({ privileges, languageGroup }) => {
return congregationModule.activeMembers.filter(({ privileges, languageGroup, school }) => {
if (restrictLanguage && languageGroup !== scheduleModule.language) return false
if (school && school !== this.school) return false
return privileges[type]
})
},
Expand Down
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
6 changes: 5 additions & 1 deletion src/components/Schedule/ScheduleWeekView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
v-model="editAssignment.assignee"
label="Assignee"
:type="editAssignment.type"
:school="1"
:disabled="!!(editAssignment.stream || editAssignment.inherit)"
/>
</v-flex>
Expand All @@ -207,6 +208,7 @@
v-model="editAssignment.assistant"
label="Assistant"
:type="editAssignment.type + 'Assist'"
:school="1"
:disabled="!!(editAssignment.stream || editAssignment.inherit)"
/>
</v-flex>
Expand All @@ -216,6 +218,7 @@
v-model="editAssignment.assignee2"
label="Assignee (2)"
:type="editAssignment.type"
:school="2"
:disabled="!!(editAssignment.stream || editAssignment.inherit)"
/>
</v-flex>
Expand All @@ -224,6 +227,7 @@
v-model="editAssignment.assistant2"
label="Assistant (2)"
:type="editAssignment.type + 'Assist'"
:school="2"
:disabled="!!(editAssignment.stream || editAssignment.inherit)"
/>
</v-flex>
Expand Down Expand Up @@ -487,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
16 changes: 14 additions & 2 deletions src/views/Congregation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
<v-flex xs12 sm6 md4>
<v-select v-model="editMember.languageGroup" label="Language Group" :items="USED_LANGUAGES" />
</v-flex>
<v-flex xs12 sm6 md4>
<v-select v-model="editMember.school" label="Preferred School" :items="preferredSchools" />
</v-flex>
<v-flex xs12 sm6 md4>
<v-checkbox v-model="editMember.show" label="Show On Schedule" />
</v-flex>
Expand Down Expand Up @@ -147,7 +150,8 @@ import {
APPOINTMENTS,
SUPPORTED_LANGUAGES,
USED_LANGUAGES,
PRIVILEGES
PRIVILEGES,
SECOND_SCHOOL
} from '@/constants'
import { ICongregationMember, Languages } from 'types'
Expand All @@ -169,6 +173,7 @@ export default Vue.extend({
gender: GENDERS[0],
appointment: APPOINTMENTS[0],
languageGroup: USED_LANGUAGES[0].value,
school: null,
show: true,
privileges: {}
} as unknown as ICongregationMember
Expand Down Expand Up @@ -196,6 +201,11 @@ export default Vue.extend({
languageGroups (): { [key in Languages]: string } {
return SUPPORTED_LANGUAGES.reduce((acc, { text, value }) => Object.assign(acc, { [value]: text }), {}) as { [key in Languages]: string }
},
preferredSchools (): { text: string, value: null | number }[] {
const items: { text: string, value: null | number }[] = [{ text: 'Any', value: null }]
if (SECOND_SCHOOL) items.push({ text: 'First Only', value: 1 }, { text: 'Second Only', value: 2 })
return items
},
headers (): { text: string, value: string, align?: string, sortable?: boolean }[] {
return [
{ text: 'Name', value: 'name' },
Expand Down Expand Up @@ -230,6 +240,7 @@ export default Vue.extend({
gender: GENDERS[0],
appointment: APPOINTMENTS[0],
languageGroup: USED_LANGUAGES[0].value,
school: null,
show: true,
privileges: {}
}
Expand All @@ -239,12 +250,13 @@ export default Vue.extend({
},
onEdit (member: ICongregationMember): void {
this.editID = member._id
const { name, gender, appointment, languageGroup, show, privileges } = member
const { name, gender, appointment, languageGroup, school, show, privileges } = member
const updateProperties: Partial<ICongregationMember> = {
name,
gender,
appointment,
languageGroup,
school,
show,
privileges: { ...privileges }
}
Expand Down
117 changes: 115 additions & 2 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,127 @@
Welcome to OCLM Planner
</h1>
<h2>Getting Started</h2>
<p>Click the navigation menu on the top left to login and navigate the site</p>
<p class="mt-1 mb-4">
Click the navigation menu on the top left to login and navigate the site
</p>
<h2>Changelog</h2>
<v-expansion-panel class="mt-3">
<v-expansion-panel-content v-for="(change, index) of changes" :key="index">
<template v-slot:header>
<v-layout align-center class="no-select">
<span class="title mr-3">Version {{ change.version }}</span>
<v-chip
v-if="index === 0"
class="ma-0"
color="orange"
text-color="white"
small
>
<v-avatar>
<v-icon>star</v-icon>
</v-avatar>
New
</v-chip>
<v-spacer />
<span class="subheading mr-3">Released: {{ change.date }}</span>
</v-layout>
</template>
<v-card class="grey lighten-4">
<v-card-text>
<div v-for="update of change.updates" :key="update.title">
<h3 v-text="update.title" />
<ul>
<li v-for="item of update.items" :key="item" v-text="item" />
</ul>
</div>
</v-card-text>
</v-card>
</v-expansion-panel-content>
</v-expansion-panel>
</v-layout>
</template>

<script lang="ts">
import Vue from 'vue'
interface IChange {
version: string
date: string
summary: string
updates: {
title: 'Features' | 'Fixes' | 'Developer'
items: string[]
}[]
}
export default Vue.extend({
name: 'Home'
name: 'Home',
computed: {
changes (): IChange[] {
return [
{
version: '1.1',
date: '15 Oct 2019',
summary: 'Adds support for different types of congregations',
updates: [
{
title: 'Features',
items: [
'Remove concept of abbreviated names',
'Warning if an assignee is on multiple assignments in one week',
'Add logo',
'Second school support',
'Add Readme',
'Relocates website to custom domain',
'Add Changelog to Homepage'
]
},
{
title: 'Fixes',
items: [
'Default language selection on adding/editing members',
'More responsive design',
'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',
'Update layout of schedule printout to support second school'
]
},
{
title: 'Developer',
items: [
'Update packages',
'Add License',
'Changes to Jest for testing',
'Converts project to Typescript',
'Enforces commit styling'
]
}
]
},
{
version: '1.0',
date: '13 Feb 2019',
summary: 'Initial release of OCLM Planner',
updates: [
{
title: 'Features',
items: [
'Individual or bulk upload of congregation members',
'Per-member privileges',
'Automatic download of schedule information',
'Member suggestions for each assignment',
'Special week support',
'Multi-language group support',
'PDF export of schedule and assignment slips'
]
}
]
}
]
}
}
})
</script>
1 change: 1 addition & 0 deletions types/interfaces.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export interface ICongregationMember {
gender: Genders
appointment: Appointments
languageGroup: Languages
school: null | number
show: boolean
privileges: {
[key in Privileges]?: boolean
Expand Down

0 comments on commit bf00cda

Please sign in to comment.