Skip to content

Commit 177a599

Browse files
committed
fixup! Implement CRUD UI for appointment configs
1 parent 74369ea commit 177a599

4 files changed

Lines changed: 22 additions & 6 deletions

File tree

src/components/AppNavigation/AppointmentConfigList.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
</AppNavigationCaption>
3535
<AppointmentConfigListItem
3636
v-for="config in configs"
37-
:key="config.id"
37+
:key="config.name"
3838
:config="config" />
3939

4040
<AppointmentConfigModal
@@ -72,12 +72,20 @@ export default {
7272
}
7373
},
7474
computed: {
75+
/*
7576
...mapState({
7677
configs: state => state.appointmentConfigs.configs,
7778
}),
79+
80+
*/
7881
defaultConfig() {
7982
return AppointmentConfig.createDefault(this.$store)
8083
},
84+
configs() {
85+
const configs = this.$store.getters.allConfigs()
86+
logger.debug('Configs changed', { configs })
87+
return configs
88+
},
8189
},
8290
methods: {
8391
closeModal() {

src/components/AppointmentConfigModal.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,14 @@ export default {
219219
this.editing.targetCalendarUri = calendar.url
220220
},
221221
save() {
222+
const defaultConfig = AppointmentConfig.createDefault(this.$store)
223+
222224
if (!this.enablePreparationDuration) {
223-
this.editing.preparationDuration = undefined
225+
this.editing.preparationDuration = defaultConfig.preparationDuration
224226
}
225227
226228
if (!this.enableFollowupDuration) {
227-
this.editing.followupDuration = undefined
229+
this.editing.followupDuration = defaultConfig.followupDuration
228230
}
229231
230232
this.$emit('save', this.editing)

src/models/appointmentConfig.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ export default class AppointmentConfig {
5050
/** @member {number} */
5151
increment
5252

53-
/** @member {?number} */
53+
/** @member {number} */
5454
preparationDuration
5555

56-
/** @member {?number} */
56+
/** @member {number} */
5757
followupDuration
5858

5959
/** @member {number} */
@@ -98,7 +98,12 @@ export default class AppointmentConfig {
9898
visibility: 'PUBLIC',
9999
length: 5 * 60,
100100
increment: 15 * 60,
101+
preparationDuration: 0,
102+
followupDuration: 0,
103+
buffer: 0,
104+
freebusyUris: [],
101105
})
106+
102107
}
103108

104109
/**

src/store/appointmentConfigs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const mutations = {
3838
}
3939
},
4040
addConfig(state, { config }) {
41-
state.configs = [...state.configs, config]
41+
Vue.set(state, 'configs', [...state.configs, config])
4242
logger.debug('addConfig', { configs: state.configs })
4343
},
4444
deleteConfig(state, { id }) {
@@ -47,6 +47,7 @@ const mutations = {
4747
}
4848

4949
const getters = {
50+
allConfigs: state => () => state.configs,
5051
}
5152

5253
const actions = {

0 commit comments

Comments
 (0)