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

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementResource.vue (-1 / +4 lines)
Lines 108-114 export default { Link Here
108
                },
108
                },
109
                {
109
                {
110
                    name: "vendor_id",
110
                    name: "vendor_id",
111
                    type: "vendor",
111
                    type: "relationshipSelect",
112
                    label: $__("Vendor"),
112
                    label: $__("Vendor"),
113
                    showElement: {
113
                    showElement: {
114
                        type: "text",
114
                        type: "text",
Lines 118-123 export default { Link Here
118
                            slug: "vendor_id",
118
                            slug: "vendor_id",
119
                        },
119
                        },
120
                    },
120
                    },
121
                    relationshipAPIClient: APIClient.acquisition.vendors,
122
                    relationshipOptionLabelAttr: "name",
123
                    relationshipRequiredKey: "id",
121
                },
124
                },
122
                {
125
                {
123
                    name: "description",
126
                    name: "description",
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormElement.vue (-9 lines)
Lines 122-136 Link Here
122
            </template>
122
            </template>
123
        </v-select>
123
        </v-select>
124
    </template>
124
    </template>
125
    <template v-else-if="attr.type == 'vendor'">
126
        <component
127
            :is="requiredComponent"
128
            :id="getElementId"
129
            v-bind="getComponentProps()"
130
            v-on="getEventHandlers()"
131
            v-model="resource[attr.name]"
132
        ></component>
133
    </template>
134
    <template v-else-if="attr.type == 'date'">
125
    <template v-else-if="attr.type == 'date'">
135
        <component
126
        <component
136
            :is="requiredComponent"
127
            :is="requiredComponent"
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormSelectVendors.vue (-45 lines)
Lines 1-45 Link Here
1
<template>
2
    <v-select
3
        label="name"
4
        :reduce="vendor => vendor.id"
5
        :options="vendorOptions"
6
        :filter-by="filterVendors"
7
    >
8
        <template v-slot:option="v">
9
            {{ v.name }}
10
            <br />
11
            <cite>{{ v.aliases.map(a => a.alias).join(", ") }}</cite>
12
        </template>
13
    </v-select>
14
</template>
15
16
<script>
17
import { computed, inject } from "vue";
18
import { storeToRefs } from "pinia";
19
export default {
20
    setup() {
21
        const vendorStore = inject("vendorStore");
22
        const { vendors } = storeToRefs(vendorStore);
23
24
        const filterVendors = (vendor, label, search) => {
25
            return (
26
                (vendor.full_search || "")
27
                    .toLocaleLowerCase()
28
                    .indexOf(search.toLocaleLowerCase()) > -1
29
            );
30
        };
31
32
        const vendorOptions = computed(() => {
33
            return vendors.value.map(v => ({
34
                ...v,
35
                full_search:
36
                    v.name +
37
                    (v.aliases.length > 0
38
                        ? " (" + v.aliases.map(a => a.alias).join(", ") + ")"
39
                        : ""),
40
            }));
41
        });
42
        return { vendors, vendorOptions, filterVendors };
43
    },
44
};
45
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ResourceList.vue (-18 lines)
Lines 159-182 export default { Link Here
159
                    });
159
                    });
160
                    return acc;
160
                    return acc;
161
                }
161
                }
162
                if (attr.type === "vendor") {
163
                    acc.push({
164
                        title: attr.label,
165
                        data: attr.name,
166
                        searchable: true,
167
                        orderable: true,
168
                        render: function (data, type, row, meta) {
169
                            return row.vendor_id != undefined
170
                                ? '<a href="/cgi-bin/koha/acquisition/vendors/' +
171
                                      row.vendor_id +
172
                                      '">' +
173
                                      escape_str(row.vendor.name) +
174
                                      "</a>"
175
                                : "";
176
                        },
177
                    });
178
                    return acc;
179
                }
180
                if (attr.type === "relationshipSelect") {
162
                if (attr.type === "relationshipSelect") {
181
                    acc.push({
163
                    acc.push({
182
                        title: attr.label,
164
                        title: attr.label,
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-element.js (-4 lines)
Lines 10-18 export function useBaseElement(instancedElement) { Link Here
10
        if (attr.type === "date") {
10
        if (attr.type === "date") {
11
            attr.componentPath = "@koha-vue/components/FlatPickrWrapper.vue";
11
            attr.componentPath = "@koha-vue/components/FlatPickrWrapper.vue";
12
        }
12
        }
13
        if (attr.type === "vendor") {
14
            attr.componentPath = "@koha-vue/components/FormSelectVendors.vue";
15
        }
16
        if (attr.type === "relationshipWidget") {
13
        if (attr.type === "relationshipWidget") {
17
            attr.componentPath = "@koha-vue/components/RelationshipWidget.vue";
14
            attr.componentPath = "@koha-vue/components/RelationshipWidget.vue";
18
        }
15
        }
19
- 

Return to bug 41275