Skip to content

Commit b0fb05e

Browse files
Merge pull request #7820 from abhinavohri/7712
feat(appointments): add duplicate button to clone appointment
2 parents 2c37b80 + 9cc396a commit b0fb05e

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

src/components/AppNavigation/AppointmentConfigList/AppointmentConfigListItem.vue

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,15 @@
3131
</ActionButton>
3232
<ActionButton
3333
:close-after-click="true"
34-
@click="showModal = true">
34+
@click="duplicate">
35+
<template #icon>
36+
<ContentDuplicate :size="20" />
37+
</template>
38+
{{ t('calendar', 'Duplicate') }}
39+
</ActionButton>
40+
<ActionButton
41+
:close-after-click="true"
42+
@click="openEditModal">
3543
<template #icon>
3644
<PencilIcon :size="20" />
3745
</template>
@@ -49,7 +57,8 @@
4957
</AppNavigationItem>
5058
<AppointmentConfigModal
5159
v-if="showModal"
52-
:is-new="false"
60+
:is-new="isDuplicate"
61+
:is-duplicate="isDuplicate"
5362
:config="config"
5463
@close="closeModal" />
5564
</div>
@@ -63,6 +72,7 @@ import {
6372
NcAppNavigationItem as AppNavigationItem,
6473
} from '@nextcloud/vue'
6574
import CalendarCheckIcon from 'vue-material-design-icons/CalendarCheck.vue'
75+
import ContentDuplicate from 'vue-material-design-icons/ContentDuplicate.vue'
6676
import LinkVariantIcon from 'vue-material-design-icons/Link.vue'
6777
import OpenInNewIcon from 'vue-material-design-icons/OpenInNew.vue'
6878
import PencilIcon from 'vue-material-design-icons/PencilOutline.vue'
@@ -78,6 +88,7 @@ export default {
7888
AppNavigationItem,
7989
ActionButton,
8090
ActionLink,
91+
ContentDuplicate,
8192
DeleteIcon,
8293
OpenInNewIcon,
8394
PencilIcon,
@@ -96,6 +107,7 @@ export default {
96107
return {
97108
showModal: false,
98109
loading: false,
110+
isDuplicate: false,
99111
}
100112
},
101113
@@ -108,6 +120,17 @@ export default {
108120
methods: {
109121
closeModal() {
110122
this.showModal = false
123+
this.isDuplicate = false
124+
},
125+
126+
openEditModal() {
127+
this.isDuplicate = false
128+
this.showModal = true
129+
},
130+
131+
duplicate() {
132+
this.isDuplicate = true
133+
this.showModal = true
111134
},
112135
113136
async copyLink() {

src/components/AppointmentConfigModal.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ export default {
199199
type: Boolean,
200200
required: true,
201201
},
202+
203+
isDuplicate: {
204+
type: Boolean,
205+
default: false,
206+
},
202207
},
203208
204209
data() {
@@ -293,6 +298,10 @@ export default {
293298
reset() {
294299
this.editing = this.config.clone()
295300
301+
if (this.isDuplicate) {
302+
this.editing.name = `${this.editing.name} ${this.t('calendar', '(copy)')}`
303+
}
304+
296305
this.enablePreparationDuration = !!this.editing.preparationDuration
297306
this.enableFollowupDuration = !!this.editing.followupDuration
298307
this.enableFutureLimit = !!this.editing.futureLimit

0 commit comments

Comments
 (0)