View | Details | Raw Unified | Return to bug 38262
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt (-1 / +2 lines)
Lines 30-36 Link Here
30
</head>
30
</head>
31
31
32
[% marcfield_tables = ['subscription', 'aqorders'] %]
32
[% marcfield_tables = ['subscription', 'aqorders'] %]
33
[% searchable_tables = ['subscription', 'aqbasket', 'aqinvoices', 'erm_licenses', 'erm_agreements', 'erm_packages'] %]
33
[% searchable_tables = ['subscription', 'aqbasket', 'aqinvoices', 'erm_licenses', 'erm_agreements', 'erm_packages', 'aqbooksellers'] %]
34
[% show_marcfield = marcfield_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
34
[% show_marcfield = marcfield_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
35
[% show_searchable = searchable_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
35
[% show_searchable = searchable_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
36
36
Lines 130-135 Link Here
130
                        [% IF CAN_user_acquisition_order_manage %]
130
                        [% IF CAN_user_acquisition_order_manage %]
131
                            [% WRAPPER table_option value="aqbasket" %]<span>Order baskets</span>[% END %]
131
                            [% WRAPPER table_option value="aqbasket" %]<span>Order baskets</span>[% END %]
132
                            [% WRAPPER table_option value="aqorders" %]<span>Order lines</span>[% END %]
132
                            [% WRAPPER table_option value="aqorders" %]<span>Order lines</span>[% END %]
133
                            [% WRAPPER table_option value="aqbooksellers:vendor" %]<span>Vendors</span>[% END %]
133
                        [% END %]
134
                        [% END %]
134
                    </ul>
135
                    </ul>
135
                [% END %]
136
                [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/fetch/acquisition-api-client.js (-1 / +1 lines)
Lines 12-18 export class AcquisitionAPIClient { Link Here
12
                    endpoint: "vendors/" + id,
12
                    endpoint: "vendors/" + id,
13
                    headers: {
13
                    headers: {
14
                        "x-koha-embed":
14
                        "x-koha-embed":
15
                            "aliases,subscriptions+count,interfaces,contacts,contracts,baskets",
15
                            "aliases,subscriptions+count,interfaces,contacts,contracts,baskets,extended_attributes,+strings",
16
                    },
16
                    },
17
                }),
17
                }),
18
            getAll: (query, params) =>
18
            getAll: (query, params) =>
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorFormAdd.vue (+12 lines)
Lines 19-24 Link Here
19
            <VendorContacts :vendor="vendor" />
19
            <VendorContacts :vendor="vendor" />
20
            <VendorInterfaces :vendor="vendor" />
20
            <VendorInterfaces :vendor="vendor" />
21
            <VendorOrderingInformation :vendor="vendor" />
21
            <VendorOrderingInformation :vendor="vendor" />
22
            <AdditionalFieldsEntry
23
                resource_type="vendor"
24
                :additional_field_values="vendor.extended_attributes"
25
                @additional-fields-changed="additionalFieldsChanged"
26
            />
22
        </form>
27
        </form>
23
    </template>
28
    </template>
24
</template>
29
</template>
Lines 33-38 import VendorOrderingInformation from "./VendorOrderingInformation.vue"; Link Here
33
import VendorInterfaces from "./VendorInterfaces.vue";
38
import VendorInterfaces from "./VendorInterfaces.vue";
34
import Toolbar from "../Toolbar.vue";
39
import Toolbar from "../Toolbar.vue";
35
import ToolbarButton from "../ToolbarButton.vue";
40
import ToolbarButton from "../ToolbarButton.vue";
41
import AdditionalFieldsEntry from "../AdditionalFieldsEntry.vue";
36
42
37
export default {
43
export default {
38
    data() {
44
    data() {
Lines 66-71 export default { Link Here
66
                aliases: [],
72
                aliases: [],
67
                contacts: [],
73
                contacts: [],
68
                interfaces: [],
74
                interfaces: [],
75
                extended_attributes: [],
69
            },
76
            },
70
            initialized: false,
77
            initialized: false,
71
        };
78
        };
Lines 118-123 export default { Link Here
118
            }
125
            }
119
            delete vendor.physical;
126
            delete vendor.physical;
120
            delete vendor.subscriptions_count;
127
            delete vendor.subscriptions_count;
128
            delete vendor._strings;
121
129
122
            vendor.contacts = this.checkContactOrInterface(
130
            vendor.contacts = this.checkContactOrInterface(
123
                vendor.contacts.map(
131
                vendor.contacts.map(
Lines 168-173 export default { Link Here
168
                return acc;
176
                return acc;
169
            }, []);
177
            }, []);
170
        },
178
        },
179
        additionalFieldsChanged(additionalFieldValues) {
180
            this.vendor.extended_attributes = additionalFieldValues;
181
        },
171
    },
182
    },
172
    components: {
183
    components: {
173
        ButtonSubmit,
184
        ButtonSubmit,
Lines 177-182 export default { Link Here
177
        VendorInterfaces,
188
        VendorInterfaces,
178
        Toolbar,
189
        Toolbar,
179
        ToolbarButton,
190
        ToolbarButton,
191
        AdditionalFieldsEntry,
180
    },
192
    },
181
    name: "VendorFormAdd",
193
    name: "VendorFormAdd",
182
};
194
};
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue (-2 / +84 lines)
Lines 17-22 Link Here
17
                @delete="doDelete"
17
                @delete="doDelete"
18
                @select="doSelect"
18
                @select="doSelect"
19
                @receive="doReceive"
19
                @receive="doReceive"
20
                :searchable_additional_fields="searchable_additional_fields"
21
                :searchable_av_options="searchable_av_options"
20
            ></KohaTable>
22
            ></KohaTable>
21
        </div>
23
        </div>
22
        <div v-else class="alert alert-info">
24
        <div v-else class="alert alert-info">
Lines 64-73 export default { Link Here
64
            vendor_count: 0,
66
            vendor_count: 0,
65
            initialized: false,
67
            initialized: false,
66
            searchTerm: null,
68
            searchTerm: null,
69
            searchable_av_options: [],
70
            searchable_additional_fields: [],
67
            tableOptions: {
71
            tableOptions: {
68
                columns: this.getTableColumns(),
72
                columns: this.getTableColumns(),
69
                options: {
73
                options: {
70
                    embed: "aliases,baskets,subscriptions+count,invoices",
74
                    embed: "aliases,baskets,subscriptions+count,invoices,extended_attributes,+strings",
71
                },
75
                },
72
                url: () => this.tableURL(),
76
                url: () => this.tableURL(),
73
                add_filters: true,
77
                add_filters: true,
Lines 118-124 export default { Link Here
118
    },
122
    },
119
    beforeRouteEnter(to, from, next) {
123
    beforeRouteEnter(to, from, next) {
120
        next(vm => {
124
        next(vm => {
121
            vm.getVendorCount().then(() => (vm.initialized = true));
125
            vm.getVendorCount().then(() =>
126
                vm
127
                    .getSearchableAdditionalFields()
128
                    .then(() =>
129
                        vm
130
                            .getSearchableAVOptions()
131
                            .then(() => (vm.initialized = true))
132
                    )
133
            );
122
            if (to.query.supplier) {
134
            if (to.query.supplier) {
123
                vm.searchTerm = to.query.supplier;
135
                vm.searchTerm = to.query.supplier;
124
            }
136
            }
Lines 272-277 export default { Link Here
272
                },
284
                },
273
            ];
285
            ];
274
        },
286
        },
287
        async getSearchableAdditionalFields() {
288
            const client = APIClient.additional_fields;
289
            await client.additional_fields.getAll("vendor").then(
290
                searchable_additional_fields => {
291
                    this.searchable_additional_fields =
292
                        searchable_additional_fields.filter(
293
                            field => field.searchable
294
                        );
295
                },
296
                error => {}
297
            );
298
        },
299
        async getSearchableAVOptions() {
300
            const client_av = APIClient.authorised_values;
301
            let av_cat_array = this.searchable_additional_fields
302
                .filter(field => field.authorised_value_category_name)
303
                .map(field => field.authorised_value_category_name);
304
305
            await client_av.values
306
                .getCategoriesWithValues([
307
                    ...new Set(av_cat_array.map(av_cat => '"' + av_cat + '"')),
308
                ]) // unique
309
                .then(av_categories => {
310
                    av_cat_array.forEach(av_cat => {
311
                        let av_match = av_categories.find(
312
                            element => element.category_name == av_cat
313
                        );
314
                        this.searchable_av_options[av_cat] =
315
                            av_match.authorised_values.map(av => ({
316
                                value: av.value,
317
                                label: av.description,
318
                            }));
319
                    });
320
                });
321
        },
322
        async getSearchableAdditionalFields() {
323
            const client = APIClient.additional_fields;
324
            await client.additional_fields.getAll("vendor").then(
325
                searchable_additional_fields => {
326
                    this.searchable_additional_fields =
327
                        searchable_additional_fields.filter(
328
                            field => field.searchable
329
                        );
330
                },
331
                error => {}
332
            );
333
        },
334
        async getSearchableAVOptions() {
335
            const client_av = APIClient.authorised_values;
336
            let av_cat_array = this.searchable_additional_fields
337
                .filter(field => field.authorised_value_category_name)
338
                .map(field => field.authorised_value_category_name);
339
340
            await client_av.values
341
                .getCategoriesWithValues([
342
                    ...new Set(av_cat_array.map(av_cat => '"' + av_cat + '"')),
343
                ]) // unique
344
                .then(av_categories => {
345
                    av_cat_array.forEach(av_cat => {
346
                        let av_match = av_categories.find(
347
                            element => element.category_name == av_cat
348
                        );
349
                        this.searchable_av_options[av_cat] =
350
                            av_match.authorised_values.map(av => ({
351
                                value: av.value,
352
                                label: av.description,
353
                            }));
354
                    });
355
                });
356
        },
275
    },
357
    },
276
    components: { flatPickr, Toolbar, ToolbarButton, KohaTable },
358
    components: { flatPickr, Toolbar, ToolbarButton, KohaTable },
277
    name: "VendorList",
359
    name: "VendorList",
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue (-1 / +9 lines)
Lines 77-82 Link Here
77
            <div class="col-sm-6">
77
            <div class="col-sm-6">
78
                <VendorContacts :vendor="vendor" :display="true" />
78
                <VendorContacts :vendor="vendor" :display="true" />
79
                <VendorSubscriptions :vendor="vendor" />
79
                <VendorSubscriptions :vendor="vendor" />
80
                <AdditionalFieldsDisplay
81
                    v-if="vendor._strings"
82
                    resource_type="vendor"
83
                    :additional_field_values="
84
                        vendor._strings.additional_field_values
85
                    "
86
                />
80
            </div>
87
            </div>
81
        </div>
88
        </div>
82
        <div
89
        <div
Lines 100-105 import VendorContacts from "./VendorContacts.vue"; Link Here
100
import VendorSubscriptions from "./VendorSubscriptions.vue";
107
import VendorSubscriptions from "./VendorSubscriptions.vue";
101
import VendorContracts from "./VendorContracts.vue";
108
import VendorContracts from "./VendorContracts.vue";
102
import DropdownButtons from "../DropdownButtons.vue";
109
import DropdownButtons from "../DropdownButtons.vue";
110
import AdditionalFieldsDisplay from "../AdditionalFieldsDisplay.vue";
103
111
104
export default {
112
export default {
105
    setup() {
113
    setup() {
Lines 172-177 export default { Link Here
172
        VendorContacts,
180
        VendorContacts,
173
        VendorSubscriptions,
181
        VendorSubscriptions,
174
        VendorContracts,
182
        VendorContracts,
183
        AdditionalFieldsDisplay,
175
        DropdownButtons,
184
        DropdownButtons,
176
    },
185
    },
177
    name: "VendorShow",
186
    name: "VendorShow",
178
- 

Return to bug 38262