Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
589 changes: 80 additions & 509 deletions package-lock.json

Large diffs are not rendered by default.

558 changes: 558 additions & 0 deletions src/components/AppSidebar/RecurrenceItem.vue

Large diffs are not rendered by default.

504 changes: 504 additions & 0 deletions src/components/Repeat/Repeat.vue

Large diffs are not rendered by default.

196 changes: 196 additions & 0 deletions src/components/Repeat/RepeatEndRepeat.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
<!--
- SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->

<template>
<div class="repeat-option-set repeat-option-set--end">
<span class="repeat-option-end__label">{{ t('tasks', 'End repeat') }}</span>
<NcSelect class="repeat-option-end__end-type-select"
:options="options"
:searchable="false"
:name="t('tasks', 'Select to end repeat')"
:model-value="selectedOption"
:clearable="false"
input-id="value"
label="label"
@update:model-value="changeEndType" />
<NcDateTimePicker v-if="isUntil"
class="repeat-option-end__until"
:value="until"
:append-to-body="true"
type="date"
@input="changeUntil" />
<input v-if="isCount"
class="repeat-option-end__count"
type="number"
min="1"
max="3500"
:value="count"
@input="changeCount">
<span v-if="isCount"
class="repeat-option-end__count">
{{ occurrencesLabel }}
</span>
</div>
</template>

<script>
import { NcSelect, NcDateTimePicker } from '@nextcloud/vue'
import { translate as t, translatePlural as n } from '@nextcloud/l10n'

export default {
name: 'RepeatEndRepeat',
components: {
NcDateTimePicker,
NcSelect,
},

props: {
/**
* The calendar-object instance
*/
calendarObjectInstance: {
type: Object,
required: true,
},

count: {
type: Number,
default: null,
},

until: {
type: Date,
default: null,
},
},

computed: {
/**
* The minimum date the user can select in the until date-picker
*
* @return {Date}
*/
minimumDate() {
return this.calendarObjectInstance.startDate
},

/**
* Whether or not this event is recurring until a given date
*
* @return {boolean}
*/
isUntil() {
return this.count === null && this.until !== null
},

/**
* Whether or not this event is recurring after a given amount of occurrences
*
* @return {boolean}
*/
isCount() {
return this.count !== null && this.until === null
},

/**
* Label for time/times
*
* @return {string}
*/
occurrencesLabel() {
return n('tasks', 'time', 'times', this.count)
},

/**
* Options for recurrence-end
*
* @return {object[]}
*/
options() {
return [{
label: t('tasks', 'never'),
value: 'never',
}, {
label: t('tasks', 'on date'),
value: 'until',
}, {
label: t('tasks', 'after'),
value: 'count',
}]
},

/**
* The selected option for the recurrence-end
*
* @return {object}
*/
selectedOption() {
if (this.count !== null) {
return this.options.find((option) => option.value === 'count')
} else if (this.until !== null) {
return this.options.find((option) => option.value === 'until')
} else {
return this.options.find((option) => option.value === 'never')
}
},
},

methods: {
t,
n,

/**
* Changes the type of recurrence-end
* Whether it ends never, on a given date or after an amount of occurrences
*
* @param {object} value The new type of recurrence-end to select
*/
changeEndType(value) {
console.debug(value)
if (!value) {
return
}

switch (value.value) {
case 'until':
this.$emit('change-to-until')
break

case 'count':
this.$emit('change-to-count')
break

case 'never':
default:
this.$emit('set-infinite')
}
},

/**
* Changes the until-date of this recurrence-set
*
* @param {Date} date The new date to set as end
*/
changeUntil(date) {
this.$emit('set-until', date)
},

/**
* Changes the number of occurrences in this recurrence-set
*
* @param {Event} event The input event
*/
changeCount(event) {
const minimumValue = parseInt(event.target.min, 10)
const maximumValue = parseInt(event.target.max, 10)
const selectedValue = parseInt(event.target.value, 10)

if (selectedValue >= minimumValue && selectedValue <= maximumValue) {
this.$emit('set-count', selectedValue)
}
},
},
}
</script>
23 changes: 23 additions & 0 deletions src/components/Repeat/RepeatExceptionWarning.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
- SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->

<template>
<div class="repeat-option-warning">
<strong>
{{ t('tasks', 'This task is the recurrence-exception of a recurrence-set. You cannot add a recurrence-rule to it.') }}
</strong>
</div>
</template>

<script>
import { translate as t } from '@nextcloud/l10n'

export default {
name: 'RepeatExceptionWarning',
methods: {
t,
},
}
</script>
74 changes: 74 additions & 0 deletions src/components/Repeat/RepeatFirstLastSelect.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<!--
- SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->

<template>
<NcSelect :allow-empty="false"
:options="options"
:model-value="selected"
:disabled="disabled"
:placeholder="t('tasks', 'first')"
:clearable="false"
input-id="value"
label="label"
@update:model-value="select" />
</template>

<script>
import { NcSelect } from '@nextcloud/vue'
import { translate as t } from '@nextcloud/l10n'
import { getTranslatedOrdinalNumber } from '../../filters/recurrenceRuleFormat.js'

export default {
name: 'RepeatFirstLastSelect',
components: {
NcSelect,
},

props: {
/**
*
*/
bySetPosition: {
type: Number,
default: null,
},

/**
*
*/
disabled: {
type: Boolean,
required: true,
},
},

computed: {
options() {
return [1, 2, 3, 4, 5, -2, -1].map((ordinal) => ({
label: getTranslatedOrdinalNumber(ordinal),
value: ordinal,
}))
},

selected() {
return this.options.find((option) => option.value === this.bySetPosition)
},
},

methods: {
t,

select(value) {
if (!value) {
return
}

console.debug(value)

this.$emit('change', value.value)
},
},
}
</script>
19 changes: 19 additions & 0 deletions src/components/Repeat/RepeatForkWarning.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!--
- SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->

<template>
<div class="repeat-option-warning">
<div class="repeat-option-warning__icon icon icon-info" />
<strong class="repeat-option-warning__info">
{{ $t('tasks', 'Changes to the recurrence-rule will only apply to this and all future occurrences.') }}
</strong>
</div>
</template>

<script>
export default {
name: 'RepeatForkWarning',
}
</script>
Loading