|
207 | 207 | <NcSelect ref="pickAddressbook" |
208 | 208 | v-model="pickedAddressbook" |
209 | 209 | :allow-empty="false" |
210 | | - :options="addressbooksOptions" |
| 210 | + :options="copyableAddressbooksOptions" |
211 | 211 | :placeholder="t('contacts', 'Select address book')" |
212 | 212 | track-by="id" |
213 | 213 | label="name" /> |
|
245 | 245 | empty property because this is a required prop on regular property-select. But since |
246 | 246 | we are hijacking this... (this is supposed to be used with a ICAL.property, but to avoid code |
247 | 247 | duplication, we created a fake propModel and property with our own options here) --> |
| 248 | + <!-- We need to pass all addressbooksOptions not only writable ones. Otherwise the the name |
| 249 | + can't be displayed for readOnly addressbooks --> |
248 | 250 | <PropertySelect :prop-model="addressbookModel" |
249 | 251 | :options="addressbooksOptions" |
250 | 252 | :value.sync="addressbook" |
@@ -531,6 +533,24 @@ export default { |
531 | 533 | }) |
532 | 534 | }, |
533 | 535 |
|
| 536 | + /** |
| 537 | + * Store getters filtered and mapped to usable object |
| 538 | + * This is the list of addressbooks that are available to copy to |
| 539 | + * |
| 540 | + * @return {{id: string, name: string}[]} |
| 541 | + */ |
| 542 | + copyableAddressbooksOptions() { |
| 543 | + return this.addressbooksOptions |
| 544 | + .filter(option => !option.readOnly) |
| 545 | + .filter(option => option.id !== this.contact.addressbook.id) |
| 546 | + .map(addressbook => { |
| 547 | + return { |
| 548 | + id: addressbook.id, |
| 549 | + name: addressbook.name, |
| 550 | + } |
| 551 | + }) |
| 552 | + }, |
| 553 | +
|
534 | 554 | // store getter |
535 | 555 | addressbooks() { |
536 | 556 | return this.$store.getters.getAddressbooks |
|
0 commit comments